sm_protection ============= State machine governing protective entry hold and exit. Inherited Component ------------------- - :doc:`Safety_Manager ` Inherited Requirements ---------------------- - :doc:`REQ-SAF-001 ` - :doc:`REQ-SAF-002 ` - :doc:`REQ-SAF-003 ` - :doc:`REQ-SAF-004 ` - :doc:`REQ-REL-002 ` Relationship Diagram -------------------- .. image:: /_static/sw_unit_uml/sm_protection_e1628b27-5592-4162-9c22-2c606ccff38a_uml.svg :alt: UML class diagram for sm_protection :class: dblclick-open-image SW Unit Relations ----------------- Incoming Relations ~~~~~~~~~~~~~~~~~~ .. list-table:: :header-rows: 1 * - Relation - UML Type - Visibility - Source Unit - Description * - :doc:`SWR-005 ` - composition - private - :doc:`ao_safety ` - Safety active object embeds protection state machine. Data Types ---------- .. _dt-99f20b7b-85e6-49f2-9fcc-b1d420c2e70e: .. raw:: html
sm_protection_contextstruct
Internal runtime context for sm_protection. .. rubric:: Struct Members .. list-table:: :header-rows: 1 * - Name - Type - Description * - sm_state - :ref:`uint8_t ` - Protection SM state. * - hazard_latched - :ref:`bool ` - Hazard latch state. * - override_forced - :ref:`bool ` - Forced override state. * - transition_tick - :ref:`uint32_t ` - Last transition tick. .. _dt-f76d9e29-0ed5-476d-ae70-375d71faeb8b: .. raw:: html
sm_protection_eventstruct
Event payload handled by sm_protection. .. rubric:: Struct Members .. list-table:: :header-rows: 1 * - Name - Type - Description * - signal_id - :ref:`uint16_t ` - Protection SM event id. * - hazard_detected - :ref:`bool ` - Hazard trigger input. * - clear_request - :ref:`bool ` - Clear request input. * - sensor_valid - :ref:`bool ` - Sensor validity guard input. .. _dt-9430e902-7ff2-4430-8fca-320b7409cb5a: .. raw:: html
sm_protection_resultenum
Result code for sm_protection operations. .. rubric:: Enum Members .. list-table:: :header-rows: 1 * - Name - Value - Description * - OK - 0 - Protection transition applied. * - INVALID_TRANSITION - 1 - Transition blocked by guards. * - LATCH_ACTIVE - 2 - Hazard latch remains active. Attributes ---------- .. list-table:: :header-rows: 1 * - Attribute - Type - Visibility - Description * - ctx - :ref:`sm_protection_context ` - private - Runtime context for sm_protection state timing and error tracking. Methods ------- dispatch ~~~~~~~~ - **Return Type:** :ref:`sm_protection_result ` - **Visibility:** public - **Description:** Process one sm_protection event and update runtime outputs. .. rubric:: Parameters .. list-table:: :header-rows: 1 * - Name - Type - Direction - Description * - event - :ref:`sm_protection_event ` - in - Process one sm_protection event and update runtime outputs. init ~~~~ - **Return Type:** :ref:`sm_protection_result ` - **Visibility:** public - **Description:** Initialize sm_protection runtime state and dependencies. Dynamic Behaviour ----------------- State Machines ~~~~~~~~~~~~~~ sm_protection_state ^^^^^^^^^^^^^^^^^^^ .. uml:: @startuml hide empty description [*] --> Idle Idle --> Protective_Entry : EVT_TEMP_HIGH Idle --> Protective_Entry : EVT_VOLT_LOW Idle --> Protective_Entry : EVT_VOLT_HIGH Idle --> Protective_Entry : EVT_SENSOR_INVALID Protective_Entry : entry / latch_fault_source() Protective_Entry : entry / disable_active_outputs() Protective_Entry --> Protective_Hold : EVT_FAULT_LATCH Protective_Hold : do / keep_outputs_disabled() Protective_Hold : do / fault_indication_on() Protective_Hold --> Exit_Eval : EVT_CLEAR_CONDITION Exit_Eval --> Protective_Hold : EVT_TEMP_HIGH Exit_Eval --> Protective_Hold : EVT_VOLT_LOW Exit_Eval --> Protective_Hold : EVT_VOLT_HIGH Exit_Eval --> Idle : EVT_TICK_500MS [all_safe_for_exit] @enduml This state machine specifies protection entry hold and guarded exit behavior including hazard source latching mandatory output disable enforcement and clear condition evaluation that prevents unsafe return to normal operation.