Defining Turbine behavior
In this phase we
will define the behavior of turbines with a statechart: when and how
they get out of service or get scheduled maintenance. Also, we will set
up the turbine animation: we want the blades to stop rotating when a
turbine is out of service; moreover, every
animation figure has color indicators of its
Set up time intervals on the
turbine agent type
- Double-click Turbine
the model tree to open its diagram. Start with adding two Parameter elements from the Agent
palette into the graphical editor.
- The parameter called serviceTimeout
is of type Time
and its Default
value is 2
weeks (select weeks in
The second parameter, MTTF
(mean time to failure),
is also of type Time
and its Default
value is 50 days.
Set up the function managing
- Add a Function from the Agent
palette called sendRequest.
This function is Just
and it has one argument you can set up in the properties section Arguments: TransportType
type. In the
function body we call the function
findTransport that we have created on Main.
turbine sends a service request, the maintenance center
should send transport of a specified type, AUTO or AVIA.
Define the turbines behavior
- Now we are ready to create a
statechart. Open the Statechart
palette and drag and drop into Turbine
diagram the Statechart
- Connect a State
to the statechart entry point, name it Operating. Increase the state size
since we want it to act as a composite state containing two simple
states inside. Into the Operating
state, add Initial state pointer,
then continue with drawing the remaining states, connecting them
together with transitions and configuring the transioins as shown in
the figure below. Additionally, you can resize
the statechart elements and set some
colors for the states.
Each turbine state has its
needs repair, it is in the Failure
state sending a maintenance request for AVIA
transport (a helicopter). When
it is time for the scheduled service, a turbine sends a request for AUTO
type of transport - a truck.
The transition from Operating
state to Failure
that equals 1/MTTF per day -
the mean time to failure period. The transition that goes back from Failure to Operating state is
triggered by particular
- When an operating turbine
turbine needs scheduled service and the corresponding state is
Being in ScheduledService
state, when a turbine receives a message
service is finished, and it can get back to the Operating
- Add a cyclic timeout
This event will
happen when a turbine needs a scheduled maintenance (according to serviceTimeout)
that triggers the
transition from Operating
state to ScheduledService.
Change animation of the
- We need to change the
properties of the turbine blades. The Wind
figure is actually a group
consisting of 2 3D figures: turbine tower and turbine blades. We need
to open the properties of the blades.
- You can select the blades
with a mouse click in the graphical
editor, or open the Projects
view and keep expanding the model tree levels until you get to the wind_blades
- Go to its properties. Open
the section Position
and size and type inState(Operating)?time():0
in the property Rotation
Now the blades will
be rotating when the turbine is working, and when it is out of service
and needs repair the blades will remain still.
Create the turbine state indicator
- Open the Presentation
palette and double-click the Oval element
to enable the drawing
- Draw a circle around the turbine animation figure with the
- Right-click the circle and select Order > Send to Back from
- Go to the Appearance
section of the circle properties. Enter the expression that will be
evaluated during the run-time for the Fill
color to make it change according to the turbine
order to switch to dynamic
for the property,
click its icon .
- If a turbine is waiting for service the shape displays
the yellow color, otherwise the circle is green which is the indicator
for a working turbine, and if it is out of service the indicator
the red color.
Run the model now. You will see that some turbines are
are waiting for the scheduled maintenance and some turbines need urgent
Now we are ready to define the transport movement.
Defining Maintenance Center behavior
Finishing the Transport logic