This example shows how to use the safety system. It further uses two inputs and two outputs. For this reason we will use the simulator again, see simulator. In the EEROS library you will find a directory with examples. Open a shell in the build directory of your EEROS library and run
$ sudo LD_LIBRARY_PATH=/home/you/work/compiled/install-x86/lib/ ./examples/system/systemTest2 -c examples/system/SystemTest2Config.json
You have to run a program using real time threads with root privileges and you have to set your library path so that the simulator library can be found.
The example comprises a safety system with five different safety levels and six safety events.
The levels and events are defined in the safety properties. The properties further include one critical input
in1 and one critical output
out1. In order to test and drive them, the configuration file specifies one more input
inTest and one more output
The following events are defined and used in the example:
|name||description||registered for safety level||type||when triggered|
|e1||start initializing||slOff||public event||triggered by the main program immediately after initialization of the safety system|
|e2||initialization done||slIinitializing||public event||triggered by a periodic 5 seconds after the executor started|
|e3||start running||slInitialized||private event||triggered by checking the critical input, this could be an enable button|
|e4||start shutting down||slRunning, slInitialized, slIinitializing||public event||triggered by pressing Ctrl-C|
|e5||stop running||slRunning||private event||triggered by checking the critical input, this could be an enable button|
|e6||switching off||slShuttingDown||private event||triggered by a level action|
The example shows a typical use of safety levels and safety events. The system works as follows:
outTestwith the critical input. After 5 seconds the state on this output pin changes alternately, which causes the safety level to alternate between
Ctrl-Cthe system falls into level
slShuttingDown. A level action for this safety level causes the system to automatically switch to level
slOffwhich then terminates the program. Here again, this would be signalled by the sequencer after a shutting down sequence has finished or by the control system as soon as a certain safe condition is reached.
The example demonstrates how the system should be stopped in a well controlled manner, see Shutting down a System Properly.