eeros_architecture:safety_system:properties
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
eeros_architecture:safety_system:properties [2017/02/27 15:25] – [Level Actions] graf | eeros_architecture:safety_system:properties [2025/01/31 11:53] (current) – [Level Actions] ursgraf | ||
---|---|---|---|
Line 9: | Line 9: | ||
Define critical output signals, get references to them from the HAL and assign them. | 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, ...}; | ||
Line 22: | Line 22: | ||
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, ...}; | ||
</ | </ | ||
+ | See [[eeros_architecture: | ||
===== Safety Levels ===== | ===== 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. If you forget to add some levels the safety system will not check its critical inputs and will therefore not run correctly! | 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. If you forget to add some levels the safety system will not check its critical inputs and will therefore not run correctly! | ||
<code c> | <code c> | ||
SafetyLevel slOff(" | SafetyLevel slOff(" | ||
- | SafetyLevel slIinitializing(" | + | SafetyLevel slIinitializing(" |
SafetyLevel slRunning(" | SafetyLevel slRunning(" | ||
| | ||
Line 57: | Line 57: | ||
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, | + | 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, | ||
+ | </ | ||
+ | |||
===== Input and Output Actions ===== | ===== Input and Output Actions ===== | ||
Line 69: | Line 77: | ||
Define actions for the safety levels. Each level can cause no or one action. | Define actions for the safety levels. Each level can cause no or one action. | ||
<code cpp> | <code cpp> | ||
- | slOff.setLevelAction([&](SafetyContext* privateContext) { | + | slOff.setLevelAction([this](SafetyContext* privateContext) { |
privateContext-> | privateContext-> | ||
}); | }); | ||
- | ... | ||
</ | </ | ||
The method // | The method // | ||
+ | |||
+ | === Entry and Exit Actions === | ||
+ | You also have the possibility to define an action which is executed when a safety level is entered. That means when the safety system switches to this level. | ||
+ | <code cpp> | ||
+ | slOff.setEntryAction([this](SafetyContext* privateContext) { | ||
+ | // do anything | ||
+ | }); | ||
+ | </ | ||
+ | |||
+ | Further, you can define an action which is executed when a safety level is left. That means when the safety system switches from this level to another level. | ||
+ | <code cpp> | ||
+ | slOff.setExitAction([this](SafetyContext* privateContext) { | ||
+ | // do anything | ||
+ | }); | ||
+ | </ | ||
=== Counter === | === Counter === | ||
- | Each time that the safety system runs in a certain level a counter named '' | + | Each time that the safety system runs in a certain level a counter named '' |
<code cpp> | <code cpp> | ||
- | slRunning.setLevelAction([&](SafetyContext* privateContext) { | + | slRunning.setLevelAction([this,period](SafetyContext* privateContext) { |
if (slRunning.getNofActivations() * period >= 60.0) | if (slRunning.getNofActivations() * period >= 60.0) | ||
privateContext-> | privateContext-> |
eeros_architecture/safety_system/properties.1488205501.txt.gz · Last modified: 2017/02/27 15:25 (external edit)