In this blog post, we will take a look inside an AnyLogic air maintenance model and reveal how it works. The aim is to improve your skills in the development and analysis of models, to teach AnyLogic's advanced capabilities, and also to show how simulation modeling is applied in different areas of business. You can also find links to other analyses at the end of the post.
Today we will look at Airlines Fleet - a model game in which you are responsible for the state of passenger aircraft that have logged thousands of hours of flight. In this model, as in reality, aircraft wear out, they require routine checks and spare parts, as well as the emergency replacement of equipment. Servicing directly affects the flight schedules, and the level of service is reduced when there are significant delays. Eventually, the company can lose money and reputation.
Using this model as an example, we will look at how agent-based modeling helps to analyze and plan maintenance. You will find the model in the list of examples in AnyLogic Professional or University Researcher, as well as in AnyLogic Cloud.
How the model works: an agent-based approach to modeling
In the model airplanes make flights and, on arrival at an airport, are serviced. If the airplane is sound, it can continue flying. During maintenance, the repair or replacement of parts may be required, in which case the aircraft is delayed and must remain in the parking lot.
The model is built using an agent-based approach and its operation is not specified by process diagrams, but is formed from the behavior of individual agents:
- Regular flights from Heathrow Airport (London) to 50 airports around the world (agent type - Flight);
- Aircraft performing these flights and undergoing service (agent type - Plane);
- Aircraft parts that need to be repaired or changed during use (agent type - Equipment).
The agent-based approach was chosen for good reason. In models created with it, each type of agent has an independent structure with properties and behavior, which are specified by statecharts, and a set of parameters and actions. Although agents of the same type have the same structure, they are independent of each other. This allows you to reflect their individual properties. For example, in our model, the time for replacement or repair depends on the equipment type.
The aircraft also have individual characteristics and requirements for equipment types. The model takes into account 16 types of equipment for 6 types of aircraft. Thus, the total number of spare parts is 96. Information about each of them is stored in the built-in database and is used to create agents.
Creating custom agent types
The agent-based approach is also useful if you have not found the desired object in the AnyLogic palette and you need to create your own. For example, to specify the arrival of agents in AnyLogic, a Schedule object is used. In our model, this could be suitable for modeling flight schedules. However, it does not allow you to change the flight schedule dynamically. In addition, the departure time information is already set in the agent parameters of the Flight type. Therefore, the model uses a set of agents, sorted by the date of departure.
Using the model interface, a user can specify a plan for purchasing new aircraft parts. To do this, use the table on Main.
If you open the model, you will see that the table has only one and a half rows. However, during the execution of the model, a full table appears with the required number of rows.
Replicable objects allow you to specify replication rules for one object and then, at the time of execution, get the number of objects required. This concept works for animated shapes and interface elements, as well as agents (an example of replicated agents is the population).
For an object to replicate, you must specify a positive integer in the Replication property. Replication rules are specified by the Java code in the properties of the replicated object and are responsible for parameters such as:
- location and size of the object;
- communication of interface elements with variables;
- custom settings for agents;
- generic Java classes and agent types;
Let's see how replication is set up, using the example of the Monthly Order cell (enterAmount2 element) in the new order execution table.
In the element properties, the monthlyOrderSize[2*index + 1]code determines which variable in the monthlyOrderSize array the text field will be associated with. The index local variable indicates the index of the replicated object. Since there are 8 text fields, their indices are from 0 to 7. Field 0 allows you to change the value of the variable at place zero in the array, and so on.
With the help of replication, it is easy to create large objects, for example, tables, control interfaces, as well as complex animated figures. In our model, replication is used to create the timetable.
The key advantage of simulation models over analytical ones is that they enable dynamic evaluation of system performance. This allows us to assess how operational decisions will affect the operation of a system in the future.
In our model, you can experiment with the equipment purchasing policy and monitor the effects on financial indicators and service levels. As a result, you can:
- find a balance between low storage costs and service level;
- determine the optimal insurance stock for unforeseen repairs;
- Make informed decisions about purchases and maintain a high level of service.
These problems have no analytical solution and can be solved only with the help of the dynamic model of the system.
Simulation of random events
No less important advantage of a simulation model is the ability to assess the stability of the system in the face of random changes. This model allows you to check how the system will cope if several planes fail at the same time or the time distribution between breakages changes.
In analytical models, such random characteristics are taken into account as an average. This does not give the necessary accuracy and level of detail, because different statistical distributions can have one mean value and different deviations from it. In simulation models, random variables are modeled as is, allowing the work to be considered dynamically.
AnyLogic includes a selection of random distributions to choose from and additional distributions can be downloaded from the Stat :: Fit or ExpertFit programs. If you do not know which distribution is right for your data set, use an empirical distribution: load the data into the model, and AnyLogic will compute and graphically show how they are distributed. How-to (video)
In our model, the optimization experiment varies the parameters that are responsible for the number of parts purchased. It helps to choose the lowest cost replenishment policy for the spare parts stocks. Users can determine the purpose of an experiment, the range of parameter variation and the variation rules.
Furthermore, the experiment allows you to exclude unsuitable solutions before running if you specify a constraint in the form of a logical expression. This approach accelerates optimization.
Solutions can also be checked after a run using requirements, which are also logical expressions. For example, if the service level is less than 98% for minimal costs, then this decision can be marked as not suitable for the requirement. Requirements and constraints allow you to fine-tune the experiment and better understand how the model works.
The optimization results can be used in a simulation experiment for deeper analysis of system operation, for example, to set up a "what if" scenario and to assess possible risks.
I hope this model analysis was useful. Check out the following examples for further insight into using AnyLogic:
- Model Overview – Customer Service at a Border Crossing
- Border Checkpoint: Technical Feature Analysis
- What’s new in AnyLogic 7.3? Fluid library Orientation, Part 1
- Fluid Library Orientation Part 2 – Chocolate Production
- Fluid Library Orientation Part 3 - Gas Station Model
- A simulated city - Learning by example
⭐ What models would you like to see in the blog? Let us know!