Create first controller
Prerequisites | * Tutorial first step |
---|---|
Goal | * Create first controller with a state machine |
Topics covered | - Create a Cylinder Controller - Define interface - Create state machine |
Controller
- Right-click First_controllerTree
- Select Show Tree Diagram View
- Select level
- Create level at tree diagram
- Set name Level0
- Select Controller
- Create controller instance at Level0
- Select Controller Instance
- Open Property window if missing: Window / Show view / Properties
- Create a new Controller at instanceOf
- Set controller name CYL
- Create new ControllerInferface
- Set interface name IF_CYL
Statemachine
- Right-click on the Controller resource
- Select Show State Diagram View → opens state diagram
- Select Start in the palette
- Click into the State Diagram to create a start point for this UP - Statemachine
- Select SuperState in the platte
- Click into the diagram to create a SuperState
- Select SuperState_WithBusyFinal → Create a 'standard' SuperState with a transition (busy) and a target (final) state
Best practice
Use SuperState_WithBusyFinal instead of a standard State. This helps to understand the process. Normally an action must be carried out prior to each target state. This is done in this concept in the busy state.
- Enter 'PON' (power on) as name for the SuperState
- Create three other SuperStates (OFF, POS1, POS2)
- Connect the states according to the picture
Pay close attention to the origin and the target of each transition.
Commands
- Open the ControllerInterface and create new Commands
- Create three commands (OFF, POS1, POS2)
- Create a new package 'command' and move the newly created commands into it.
- Select Properties in the palette
- Select the transition from POS1 to OFF → this opens the transition resource in the property view
- Create a new guard → CommandRef
- Choose the OFF command
- Set the commands as in the picture
Config
- Select the config resource
- Create GroupSelection with instance Group assignment
Congratulation, you have finished the tutorial!
Additional Informations: