Using Sequence Steps to Operate Doors
Introduction
The purpose of this example is to demonstrate how to use the Sequencer to create control steps that must run in sequence one after another. This example uses Sequencer basic blocks to build simple no-code state machines.
The example emulates a simple door with a lock system to allow UI and control system to work without real hardware.
The whole example uses only no-code programming similar to PLC IEC 61131-3 and for sequence steps IEC 61499. This example makes use of CDPPorts as interfaces to simplify the overall system design.
How to Run the Example
To run the example from CDP Studio, open Welcome mode and find it under Examples. Next, in Configure mode right-click on the library project and select Build, then right-click on the system project and select Run & Connect. See the Running the Example Project tutorial for more information.
Project Overview
This example includes:
- A system project containing two applications:
- ControlApp - contains the control and emulation logic.
- GUI - contains widgets to display door and lock positions/controls and the progress of ongoing operations.
In this example, it is possible to start two separate sequences from the GUI.
- Open Sequence to unlock and open the door
- Close Sequence to close and lock the door
The two GUI buttons make use of message buttons to send messages to DoOpen
and DoClose
event inputs in ControlApp.OperateDoor
block to start those sequences. The GUI alarm panel shows door operation alarms, which can be emulated by disconnecting something in the system during runtime. For example, remove the routing for ControlApp.DoorsEmulator.EmuLockOpen.In
before starting Open Sequence.
The sequences are defined in ControlApp.OperateDoor
. The Steps: UnlockDoor
, OpenDoor
, CloseDoor
, LockDoor
make use of the Sequencer basic blocks. The blocks are then connected in two chains to create separate DoOpen
and DoClose
sequences. When for some reason the required status signals on DoorStatus
port don't change before Timeout
, each block will send a Abort
message.
The sequences defined in ControlApp.OperateDoor
also indicates if the block is active at the moment, by using a green tint on the block background color. This is true for all Sequencer blocks and basic block state machines.
The Abort
event messages are collected by ControlApp.DoorReporter
that reports an alarm each time such message arrives at its Alarm
input. The reporting block also uses Sequencer basic block to set and clear alarm input in the AlarmOperator DoorControlAlarm
.
There is an emulation block ControlApp.DoorsEmulator
that emulates door open and lock states with simple delay operators and two very simple cyclic state machines also implemented with the Sequencer basic blocks, but this time without event support. This kind of state machine is equivalent to CDPComponent state machine.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.