eeros_architecture:safety_system:properties
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
eeros_architecture:safety_system:properties [2016/11/06 07:32] – graf | eeros_architecture:safety_system:properties [2023/02/25 07:30] – [Safety Events] ursgraf | ||
---|---|---|---|
Line 6: | Line 6: | ||
Now you can specify the following properties: | Now you can specify the following properties: | ||
- | * Define critical output signals, get references to them from the HAL and assign them. | + | ===== Critical Inputs and Outputs ===== |
+ | Define critical output signals, get references to them from the HAL and assign them. | ||
<code c> | <code c> | ||
- | eeros:: | + | eeros:: |
- | eeros:: | + | eeros:: |
HAL& hal = HAL:: | HAL& hal = HAL:: | ||
- | watchdog = hal.getLogicSystemOutput(" | + | watchdog = hal.getLogicOutput(" |
- | enable0 = hal.getLogicSystemOutput(" | + | enable0 = hal.getLogicOutput(" |
... | ... | ||
criticalOutputs = {watchdog, enable0, ...}; | criticalOutputs = {watchdog, enable0, ...}; | ||
</ | </ | ||
- | * Define critical input signals, get references to them from the HAL and assign them. | + | Define critical input signals, get references to them from the HAL and assign them. |
<code c> | <code c> | ||
- | eeros:: | + | eeros:: |
- | eeros:: | + | eeros:: |
| | ||
- | q0 = hal.getRealSystemInput(" | + | q0 = hal.getScalableInput(" |
- | limitSwitchQ0p = hal.getLogicSystemInput(" | + | limitSwitchQ0p = hal.getLogicInput(" |
... | ... | ||
criticalInputs = {q0, runButton, ...}; | criticalInputs = {q0, runButton, ...}; | ||
</ | </ | ||
- | * Define safety levels. Each level has a unique number and a description. After this the levels have to be added. The order of adding the levels is highly important and determines their logical ordering. Add the lowest safety level first. | + | ===== Safety Levels ===== |
+ | Define safety levels. Each level has a unique number and a description. After this the levels have to be added. The order of adding the levels is highly important and determines their logical ordering. Add the lowest safety level first. | ||
<code c> | <code c> | ||
SafetyLevel slOff(" | SafetyLevel slOff(" | ||
- | SafetyLevel slIinitializing(" | + | SafetyLevel slIinitializing(" |
SafetyLevel slRunning(" | SafetyLevel slRunning(" | ||
| | ||
Line 41: | Line 43: | ||
</ | </ | ||
+ | ===== Safety Events ===== | ||
* Define and add events to the safety levels. A level can have any number of associated events, including zero (no associated events). | * Define and add events to the safety levels. A level can have any number of associated events, including zero (no associated events). | ||
<code c> | <code c> | ||
Line 47: | Line 50: | ||
SafetyEvent seStartRunning(" | SafetyEvent seStartRunning(" | ||
- | | + | slOff.addEvent(seStartInitializing, |
- | | + | slIinitializing.addEvent(seStartRunning, |
- | | + | slRunning.addEvent(seShutDown, |
... | ... | ||
</ | </ | ||
Each event must be defined **kPublicEvent** or **kPrivateEvent**. Private events can only be fired by the safety system itself whereas public events could also be caused by the //Control System// or the // | Each event must be defined **kPublicEvent** or **kPrivateEvent**. Private events can only be fired by the safety system itself whereas public events could also be caused by the //Control System// or the // | ||
- | It is also possible to add an event to many levels. In the following example we add from the level // | + | It is also possible to add an event to many levels. In the following example we add to all levels |
<code c> | <code c> | ||
- | // Add events to multiple levels | + | |
- | addEventToLevelAndAbove(slPowerOn, slMoving, seDoEmergency, | + | addEventToLevelAndAbove(slPowerOn, |
+ | </ | ||
+ | Two more functions serve a similar purpose. | ||
+ | <code c> | ||
+ | // Add events to all levels equal or smaller than srcLevel | ||
+ | addEventToLevelAndBelow(srcLevel, | ||
+ | // Add events to all levels in between lowerLevel and upperLevel (including lowerLevel and upperLevel) | ||
+ | addEventToAllLevelsBetween(lowerLevel, | ||
</ | </ | ||
- | * Add input and output actions to the safety levels. Each safety level has to specify what is done with all the safety critical inputs and how all the safety critical outputs have to be driven. How this is achieved is described in [[.: | ||
- | * Define actions for the safety levels. Each level can cause no or one action. | + | ===== Input and Output Actions ===== |
- | < | + | Add input and output actions to the safety levels. Each safety level has to specify what is done with all the safety critical inputs and how all the safety critical outputs have to be driven. How this is achieved is described in [[.: |
- | slOff.setLevelAction([&](SafetyContext* privateContext) { | + | |
+ | ===== Level Actions ===== | ||
+ | Define actions for the safety levels. Each level can cause no or one action. | ||
+ | < | ||
+ | slOff.setLevelAction([this](SafetyContext* privateContext) { | ||
privateContext-> | privateContext-> | ||
}); | }); | ||
- | ... | ||
</ | </ | ||
- | The method // | + | The method // |
+ | === Counter === | ||
+ | Each time that the safety system runs in a certain level a counter named '' | ||
+ | <code cpp> | ||
+ | slRunning.setLevelAction([this, | ||
+ | if (slRunning.getNofActivations() * period >= 60.0) | ||
+ | privateContext-> | ||
+ | }); | ||
+ | </ | ||
+ | The system will stay for 60 seconds in safety level '' | ||
+ | ===== Entry Level ===== | ||
As a last point, you have to specify with which level the system has to start. | As a last point, you have to specify with which level the system has to start. | ||
<code c> | <code c> |
eeros_architecture/safety_system/properties.txt · Last modified: 2024/06/10 09:45 by ursgraf