Skip to content

SWExecStandard

Introduction

The SWExecStandard is a ready RTDB based application with IO-Handlers for some hardware boards. The version you have downloaded has IO-Handlers for:

The installation package contains also the monitor SWMon that allows you to display the hardware inputs and change the hardware outputs. In addition it contains a specification Example that demonstrates the possibility of the StateWORKS specification tools: to create application without writing a single line of code. If you want to try a creation of your own application you just download the StateWORKS Studio LE.

Installation

The software package installs itself if started by a click on the downloaded file SWApplicationLE_7.2.exe. The default installation directory is:

C:\Programs\SWSoftware\StateWORKS Application LE 7.2

You may change it during the installation.

Starting the application

In the installation directory you find the application program SWExecStandard.exe. On starting it you will be asked to supply the configuration file. Depending on the board used you should enter the path to:

  • ...Projects\AVRNET\Conf\AVRNET.swd
  • ...Projects\K8055\Conf\K8055.swd

On the next start the program will suggest using the last configuration file. You may accept it or enter a new configuration path. The screen is shown in Figure 1.

Monitoring Inputs and Outputs

To display and change hardware signals you have to start the SWMon program which is in the same installation directory.

On a start accept the default Host and Port values and leave the Password entry empty (assuming that you have not defined the password while starting the SWExecStandard).

With Select → Unit or using the corresponding icon open the “Select Unit” dialog windows where you choose the Unit present there (K8055Unit:001 or AVRNETUnit:001) and close it with OK. You should see all inputs and outputs of the board used (for instance Figure 2 shows all object of the IO-Handler for K8055 board). If the board does not exist yet (is not connected) a corresponding alarm will be active.

If you choose VFSM view (Select → VFSM or corresponding icon) you will see all objects that are used in the Example.

The USER view (Select → Objects) displays all objects used in the specification.

If the board is connected its input values (DI, NI) are displayed, and you can set its outputs (DO, NO) using the service (force) mode. If the board is not connected the input values becomes UNKNOWN (DI) or UNDEF (NI) and a corresponding alarm is generated. You can connect / disconnected the board at any time; the system detects the changes and behaves appropriately.

...\Projects\K8055\Conf\K8055.swd
The program should be called with 0-4 arguments:
* cName: full name (with path) of the configuration file.
If missing the path will be taken from the file .RTDB_Conf.par in the exe directory.
If the .RTDB_Conf.par is also missing the application will ask for the path.
* -sService: 0 -> the application does not run as a service (default)
1 -> the application will run as a service
* -tPort: the tcp/ip port number
If missing the default value 59091 will be used.
* -pPassword: a password string.
If missing it is assumed the RTDB can be accessed without a password.
Type Enter to accept the last Configuration file:
C:\Programs\SWSoftware\StateWORKS Application LE 7.2\Projects\K8055\Conf\K8055.swd
Type any other key to define a new configuration file
Started Configuration file = C:\Programs\SWSoftware\StateWORKS Application LE 7.2\Projects\K8055\Conf\K8055.swd
Application created with 42 objects
RTDB variant: LE
RTDB version: 7.2.1
RTDB Server (port 59091) started
TimeBaseTick thread created
Created k8055unit Unit1
Exit program by pressing the key 'q' and Enter.

Figure 1: Starting the SWExecStandard

RTDB objects

Actually you see in SWMon RTDB objects (see [1], technical note and descriptions on our website) that were used while specifying the IO-Unit for the IO-Handler. That means you see not only the inputs and outputs available on the board but also objects that are required for proper functioning and supervision of the IO-Handler. Especially, you see there a few alarms and parameters (see the description of the IO-Units).

Objects_for_K8055_IO-Handler

Figure 2: Objects for K8055 IO-Handler

K8055 IO-Unit

The Unit specifies the interface between the K8055 board signals and RTDB objects. It defines objects shown in the table below:

Object typeName (K8055 unit)RTDB object
Digital input DIDi_1
Di_2
Di_3
Di_4
K8055:Di:001
K8055:Di:002
K8055:Di:003
K8055:Di:004
Digital output DODo_1
Do_2
Do_3
Do_4
Do_5
Do_6
Do_7
Do_8
K8055:Do:001
K8055:Do:002
K8055:Do:003
K8055:Do:004
K8055:Do:005
K8055:Do:006
K8055:Do:007
K8055:Do:008
Numerical input NINi_1
Ni_2
K8055:Ni:001
K8055:Ni:002
Numerical input NONo_1
No_2
K8055:Ni:001
K8055:Ni:002
Data DATDat_Counter1
Dat_Counter2
K8055:Dat:Counter:001
K8055:Dat:Counter:002
Command CMDCmdK8055:Cmd
Alarm ALAl_CommError
Al_AddressError
K8055:Al:AlaCommError
K8055:Al:AlaAddressError
Parameter PARPar_DebounceTime1
Par_DebounceTime2
Par PollingTime
K8055:Par:DebounceTime1
K8055:Par:DebounceTime2
K8055:Par:PollTime

Several objects are IO-Unit specific ones:

  • Cmd is a command send to the board and could be:
    • AnalogClearAll_Ao 4
    • AnalogSetAll_Ao 3
    • CloseDevice 22
    • CounterResetAll 11
    • CounterReset_1 12
    • CounterReset_2 13
    • CounterSetDebounceTime_1 14
    • CounterSetDebounceTime_2 15
    • DigitalClearAll_Do 2
    • DigitalSetAll_Do 1
    • OpenDevice 21
    • OpenFirstDevice 23
  • AlaCommError is an alarm generated if the communication with the K8055 board is down.
  • Al_AddressError signals an erroneous physical address of the board (must be 0…3).
  • Par_DebounceTime1 and Par_DebounceTime2 are debounce time values for inputs Di_1 and Di_2 that are counted correspondingly by Dat_Counter1 and Dat_Counter2.
  • ParPollTime defines the value of the polling time loop which queries the K8055 input signals. It can be changed at any time in the SWMon.

AVRNET IO-Unit

The Unit specifies the interface between The AVRNET board signals and RTDB objects. It defines objects shown in the table below:

Object typeName (AVRNET unit)RTDB object
Digital input DIDI1
DI2
DI3
DI4
AVRNET:Di:001
AVRNET:Di:002
AVRNET:Di:003
AVRNET:Di:004
Digital output DODO1
DO2
DO3
DO4
DO5
DO6
DO7
DO8
AVRNET:Do:001
AVRNET:Do:002
AVRNET:Do:003
AVRNET:Do:004
AVRNET:Do:005
AVRNET:Do:006
AVRNET:Do:007
AVRNET:Do:008
Numerical input NINI1
NI2
NI3
NI4
AVRNET:Ni:001
AVRNET:Ni:002
AVRNET:Ni:003
AVRNET:Ni:004
Alarm ALAlaCommErrorAVRNET:Al:AlaCommError
Parameter PARParPollTimeAVRNET:Par:PollTime

Two objects are IO-Unit specific objects:

  • AlaCommError is an alarm generated if the communication with the AVRNET board is down.
  • ParPollTime defines the value of the polling time loop which queries the AVRNET input signals. It can be changed at any time in the SWMon.

Example

The Example demonstrates a typical control performed by starting a device and supervision of a controlled value (pressure). We assume that the device is switched on by setting a digital input HIGH and the SetPressureValue is a voltage on an analog (numerical) output (representing the required pressure value). The device supplies a digital signal HIGH to a digital input if switched on and a voltage (proportional to a actual pressure value) to the analog (numerical) input. The use of board inputs and output is shown in the table below. Note that the AVRNET does not have numerical outputs; hence the SetPressureValue goes just to nirvana.

K8055
Board
K8055
Unit
AVRNET
Board
AVRNET
Unit
Digital input DI
(Start acknowledgement)
Inp1K8055:Di:001Pin an J3: 10
PA0 (ADC0)
AVRNET:Di:001
Digital output DO
(Device On/Off)
01K8055:Do:001Pin an J3: 2
PC0 (SCL)
AVRNET:Do:001
Numerical input NI
(Pressure)
A1K8055:Ni:001EXT.: 8
PB3 (0C0/AIN1)
AVRNET:Ni:001
Numerical output NO
(SetPressureValue)
DAC1K8055:No:001--

There are 3 control phases:

  • The first phase begins with the command Cmd_Start which starts the device. If the device acknowledges its start by setting the digital input to HIGH the state machine passes to the second phase. The first phase is supervised by a timer which timeout value is equal to 3 sec. If the timeout elapses before the device acknowledges its start the state machine should terminate the start-up.
  • In the second phase a ramp of the SetPressureValue (required pressure value) is to be generated. The SetPressureValue should increase in 100 steps from 0 to 4 V. If the SetPressureValue reaches its nominal value we should wait 5 seconds to be sure that the pressure has reached its required value and the third phase should begin.
  • The third phase is a supervision of the pressure value which should stay in between maximum and minimum limits. If the pressure leaves the band an alarm should be generated. If this erroneous situation last more than 3 seconds the state machine should stop the device. On the other hand the number of pressure errors is limited to 4. A non-compliance to this requirement should stop the device. Every pressure error-free minute should reduce the number of errors done by one.

At any time the Cmd_Stop should switch off the device and set the SetPressureValue to 0.

The state transition diagram of the state machine Example that does the control is shown in Figure 3. The detailed specification can be found in the document ...\Projects\AVRNET\XmlExample.xml. The specification has been done using StateWORKS Studio which free LE edition is available for download.

Example_state_transition_diagram

Figure 3: Example - state transition diagram

References

[1] Wagner, F. et al., Modeling Software with Finite State Machines – A Practical Approach, Auerbach Publications, 2006.