sm_protection

State machine governing protective entry hold and exit.

Inherited Component

Inherited Requirements

Relationship Diagram

UML class diagram for sm_protection

SW Unit Relations

Incoming Relations

Relation

UML Type

Visibility

Source Unit

Description

SWR-005

composition

private

ao_safety

Safety active object embeds protection state machine.

Data Types

sm_protection_contextstruct

Internal runtime context for sm_protection.

Struct Members

Name

Type

Description

sm_state

uint8_t

Protection SM state.

hazard_latched

bool

Hazard latch state.

override_forced

bool

Forced override state.

transition_tick

uint32_t

Last transition tick.

sm_protection_eventstruct

Event payload handled by sm_protection.

Struct Members

Name

Type

Description

signal_id

uint16_t

Protection SM event id.

hazard_detected

bool

Hazard trigger input.

clear_request

bool

Clear request input.

sensor_valid

bool

Sensor validity guard input.

sm_protection_resultenum

Result code for sm_protection operations.

Enum Members

Name

Value

Description

OK

0

Protection transition applied.

INVALID_TRANSITION

1

Transition blocked by guards.

LATCH_ACTIVE

2

Hazard latch remains active.

Attributes

Attribute

Type

Visibility

Description

ctx

sm_protection_context

private

Runtime context for sm_protection state timing and error tracking.

Methods

dispatch

  • Return Type: sm_protection_result

  • Visibility: public

  • Description: Process one sm_protection event and update runtime outputs.

Parameters

Name

Type

Direction

Description

event

sm_protection_event

in

Process one sm_protection event and update runtime outputs.

init

  • Return Type: sm_protection_result

  • Visibility: public

  • Description: Initialize sm_protection runtime state and dependencies.

Dynamic Behaviour

State Machines

sm_protection_state

@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.