Skip to content

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

1-show-tree

  • Right-click First_controllerTree
  • Select Show Tree Diagram View

2-create-level

  • Select level
  • Create level at tree diagram
  • Set name Level0

img_cfc/3-create-controller-instance

  • Select Controller
  • Create controller instance at Level0

img_cfc/4-create-controller

  • Select Controller Instance
  • Open Property window if missing: Window / Show view / Properties
  • Create a new Controller at instanceOf

5-create-interface

  • Set controller name CYL
  • Create new ControllerInferface

6-interface

  • Set interface name IF_CYL

Statemachine

image2017-6-21%2015%2054%2013

  • Right-click on the Controller resource
  • Select Show State Diagram View → opens state diagram

image2017-6-21%2016%2015%2052

  • Select Start in the palette
  • Click into the State Diagram to create a start point for this UP - Statemachine

image2017-6-21%2016%2016%2046

  • 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.


image2017-6-21%2016%2018%2039

  • Enter 'PON' (power on) as name for the SuperState

image2017-6-21%2016%2021%2046

  • Create three other SuperStates (OFF, POS1, POS2)

image2017-6-21%2016%2025%2053

  • Connect the states according to the picture

Pay close attention to the origin and the target of each transition.


Commands

image2017-6-22%206%2032%2042

  • Open the ControllerInterface and create new Commands

image2017-6-22%206%2034%2018

  • Create three commands (OFF, POS1, POS2)

image2017-6-22%206%2036%209

  • Create a new package 'command' and move the newly created commands into it.

image2017-6-22%206%2039%201

  • 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

image2017-6-22%206%2041%2028

  • Choose the OFF command

image2017-6-23%2015%2046%2031

  • Set the commands as in the picture

Config

image2017-6-22%2016%2030%2033

  • Select the config resource

7-group-assignment

  • Create GroupSelection with instance Group assignment

Congratulation, you have finished the tutorial!

Additional Informations: