User Tools

Site Tools


eeros_architecture:safety_system:properties

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
eeros_architecture:safety_system:properties [2017/04/18 07:35] – [Critical Inputs and Outputs] kalberereeros_architecture:safety_system:properties [2023/02/25 07:30] (current) – [Safety Events] ursgraf
Line 35: Line 35:
 <code c> <code c>
   SafetyLevel slOff("off");   SafetyLevel slOff("off");
-  SafetyLevel slIinitializing("initialize";+  SafetyLevel slIinitializing("initialize");
   SafetyLevel slRunning("running");   SafetyLevel slRunning("running");
      
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 //Sequencer//.\\ 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 //Sequencer//.\\
  
-It is also possible to add an event to many levels. In the following example we add from the level //slPowerOn// until the level //slMoving// the event //seDoEmergency//, which causes a transition to the level //emergency// and is a public event.+It is also possible to add an event to many levels. In the following example we add to all levels from //slPowerOn// onwards the event //seDoEmergency//, which causes a transition to the level //emergency// and which is a public event.
 <code c> <code c>
- // Add events to multiple levels +  // Add events to multiple levels 
-  addEventToLevelAndAbove(slPowerOn, slMovingseDoEmergency, kPublicEvent);+  addEventToLevelAndAbove(slPowerOn, seDoEmergencyslEmergency, kPublicEvent);
 </code> </code>
 +Two more functions serve a similar purpose.
 +<code c>
 +  // Add events to all levels equal or smaller than srcLevel
 +  addEventToLevelAndBelow(srcLevel, event, destLevel, kPublicEvent);
 +  // Add events to all levels in between lowerLevel and upperLevel (including lowerLevel and upperLevel)
 +  addEventToAllLevelsBetween(lowerLevel, upperLevel, event, destLevel, kPublicEvent);
 +</code>
 +
  
 ===== 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->triggerEvent(seDoSwInit);     privateContext->triggerEvent(seDoSwInit);
   });   });
-  ... 
 </code> </code>
 The method //setLevelAction// accepts a function, which is used solely here and can be defined without giving it a name. In this example the function is a so called lambda function meaning that it can be passed as a parameter without prior declaration. It must take a parameter itself of type ''SafetyContext''. This ensures that the level function can trigger a private event. The method //setLevelAction// accepts a function, which is used solely here and can be defined without giving it a name. In this example the function is a so called lambda function meaning that it can be passed as a parameter without prior declaration. It must take a parameter itself of type ''SafetyContext''. This ensures that the level function can trigger a private event.
  
 === Counter === === Counter ===
-Each time that the safety system runs in a certain level a counter named ''nofActivations'' is incremented. Whenever the safety level due to an event this counter will be reset to 0. This allows for measuring the time the system will run in a given safety level. The following example demonstrates this. +Each time that the safety system runs in a certain level a counter named ''nofActivations'' is incremented. Whenever the safety level changes due to an event this counter will be reset to 0. This allows for measuring the time the system will run in a given safety level. The following example demonstrates this. 
 <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->triggerEvent(seStop);       privateContext->triggerEvent(seStop);
eeros_architecture/safety_system/properties.1492493743.txt.gz · Last modified: 2017/04/18 07:35 (external edit)