In this phase we will add the final details of the Transport agent's statechart elements. We will finish defining the transport movement between the maintenance center and turbines.
Define the transport type
- Double-click Truck in the model tree to open its diagram.
- Go to the Properties section Agent actions and specify the agent’s type in the On startup field: type = AUTO;
- In the Helicopter agent properties specify the type accordingly: type = AVIA;
Define the transport statechart
- Double-click Transport in the model tree to open its diagram. There you can find the statechart we have added before. Now we can configure its settings.
- The states ( AtCenter, MovingToTurbine, Servicing, MovingToMC) do not have any specific properties. We will define the logic of transport movement using different kinds of transitions.
- The transition from
MovingToTurbine is triggered by Message of type ServiceRequest. Since the transition is fired Unconditionally, you need to specify Action that the transport should take: move to the turbine coordinates.
- The transition from
Servicing is triggered by Agent arrival. A lorry or helicopter that reached the broken turbine will start their tasks immediately after arrival. When the repair is finished and so the turbine signals, the transport can go home.
- The next transition goes from
MovingToMC. The action to go back to the maintenance center is triggered by Timeout.
- In the figure above you can see that the last transition, from MovingToMC to the branch, is triggered by Agent arrival. When this happens, the transport decides whether it has to move to another turbine to fulfill a new maintenance request, or it can go back to the maintenance center where it will remain available until another turbine needs service.
- Select the transition from the branch to
MovingToTurbine. We need to specify its Condition and Action: the condition code checks out whether at this moment there are any requests from a turbine for scheduled maintenance or failure repair; if there are, the action code checks what kind of request is it and sends the corresponding type of transport to the turbine:
If you open Truck or Helicopter now, you will see that there is a Transport elements projection. These elements are visible here and you can select them to see their properties for your convenience, but they are not editable here:
Run the model. Initially all turbines are operating (indicated with green). Then we can see how a truck moves to the turbine that needs scheduled maintenance (yellow turbines) and the helicopters are moving to the turbines which are out of service (red turbines) to perform urgent repair works.
Demo model: Maintenance — Phase 6
We have finished defining logic of the model, let us now add some animation elements, configure 3D animation view and explore the model during run-time.
How can we improve this article?