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:

  • K8055 (see www.velleman.eu/ot/de/product/view/?id=351346)
  • AVRNET (see www.pollin.de/shop/downloads/D810058B.PDF).

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:\Programme\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 to use the last configuration file. You may accept it or enter a new configuration path. The screen is shown in Figure 1.

Note: In case of AVRNET program you may get problems with IP address. The address in the project has been set to 192.168.2.90. In principle any changes to the specification files should be done using StateWORKS Studio. If you want to test the program before installing StateWORKS Studio you can change the address by hand: open the file AVRNET.swd in a text editor and change the IP address which you find somewhere at the end of the file.

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 SelectUnit 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 exists 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.

Starting the SWExecStandard
Figure 1: Starting the SWExecStandard

RTDB objects

Actually you see in SWMon RTDB objects (see [1] , technical note and descriptions at w.stwww.stateworks.com) 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).P STYLE="margin-bottom: 0cm">

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 type

Name (K8055 unit)

RTDB object

Digital input DI

Di_1

Di_2

Di_3

Di_4

K8055:Di:001

K8055:Di:002

K8055:Di:003

K8055:Di:004

Digital output DO

Do_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 NI

Ni_1

Ni_2

K8055:Ni:001

K8055:Ni:002

Numerical input NO

No_1

No_2

K8055:Ni:001

K8055:Ni:002

Data DAT

Dat_Counter1

Dat_Counter2

K8055:Dat:Counter:001

K8055:Dat:Counter:002

Command CMD

Cmd

K8055:Cmd

Alarm AL

Al_CommError

Al_AddressError

K8055:Al:AlaCommError

K8055:Al:AlaAddressError

Parameter PAR

Par_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 type

Name (AVRNET unit)

RTDB object

Digital input DI

DI1

DI2

DI3

DI4

AVRNET:Di:001

AVRNET:Di:002

AVRNET:Di:003

AVRNET:Di:004

Digital output DO

DO1

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 NI

NI1

NI2

NI3

NI4

AVRNET:Ni:001

AVRNET:Ni:002

AVRNET:Ni:003

AVRNET:Ni:004

Alarm AL

AlaCommError

AVRNET:Al:AlaCommError

Parameter PAR

ParPollTime

AVRNET: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

AVRNET

Board

Unit

Board

Unit

Digital input DI

(Start acknowledgement)

Inp1

K8055:Di:001

Pin an J3: 10

PA0 (ADC0)

AVRNET:Di:001

Digital output DO

(Device On/Off)

01

K8055:Do:001

Pin an J3: 2

PC0 (SCL)

AVRNET:Do:001

Numerical input NI

(Pressure)

A1

K8055:Ni:001

EXT.: 8

PB3 (0C0/AIN1)

AVRNET:Ni:001

Numerical output NO

(SetPressureValue)

DAC1

K8055: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 can be downloaded from www.stateworks.com/product/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.