Phase 5. 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 turbine animation figure has color indicators of its turbine state. 

Set up time intervals on the turbine agent type

  1. Double-click  Turbine in the model tree to open its diagram. Start with adding two Parameter elements from the Agent palette into the graphical editor.
  2. The parameter called MTTF (mean time to failure) is of type Time and its Default value is 50 days (select days in the Units property). The second parameter, serviceTimeout, is also of type Time and its Default value is 2 weeks

Set up functions managing requests for transport

  1. Add a Function  from the Agent palette called sendTransport. This function is Just action and it has two arguments that you can set up in the Arguments section: Transport t and ServiceRequest request. This function sends transport to a turbine when needed using the statechart on  Transport.


  2. Add another Function . Call it sendRequest and specify its properties as shown in the figure below. In the properties section Arguments, add TransportType type argument. The function body refers to the actionchart findTransport that we have created on  MC. When a turbine sends a service request, the maintenance center should send transport of a specified type, AUTO or AVIA.

Define the turbines behavior with the statechart

  1. Now we are ready to create a statechart. Open the Statechart palette and drag and drop into  Turbine diagram the Statechart Entry Point  element.
  2. 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 custom colors for the states.


  3. Each turbine state has its own Entry action. When a turbine 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.

    State

    Entry action

    Failure

    sendRequest(AVIA);

    ScheduledService

    sendRequest(AUTO);
  4. The transition from Operating state to Failure is triggered by Rate  that equals 1/MTTF per day - once in the mean time to failure period. The transition that goes back from Failure to Operating state is triggered by particular Message  "repaired".


  5. When an operating turbine receives a message  "scheduled", it means, a turbine needs scheduled service and the corresponding state is triggered. Being in ScheduledService state, when a turbine receives a message  "repaired", the service is finished, and it can get back to the Operating state.


  6. Add a cyclic timeout Event called scheduledRepair. 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 turbine blades

  1. We need to change the properties of the turbine blades. The Wind turbine rotating figure is actually a group consisting of 2 3D figures: turbine tower and turbine blades. We need to open the properties of the blades.
  2. 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 group:
  3. Go to its properties. Open the section Position and size and type inState(Operating)?time():0 in the property Rotation Y, rad. 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

  1. Open the Presentation palette and double-click the Oval  element to enable the drawing mode. 
  2. Draw a circle around the turbine animation figure with the radius 10
  3. Right-click the circle and select Order > Send to Back from the context menu. 
  4. 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 state. 
  5. In order to switch to dynamic value mode for the property, click its icon .


  6. 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 dispays the red color.

Run the model now. You will see that some turbines are working, some are waiting for the scheduled maintenance and some turbines need urgent repair.

Reference model: Maintenance - Phase 5

Now we are ready to define the transport movement.


          Phase 4. Defining Maintenance Center behavior

          Phase 6. Finishing the Transport logic