sm_fan_control

State machine implementing fan control and anti-chatter behavior.

Inherited Component

Inherited Requirements

Relationship Diagram

UML class diagram for sm_fan_control

SW Unit Relations

Incoming Relations

Relation

UML Type

Visibility

Source Unit

Description

SWR-004

composition

private

ao_control

Control active object embeds fan control state machine.

Data Types

sm_fan_control_contextstruct

Internal runtime context for sm_fan_control.

Struct Members

Name

Type

Description

sm_state

uint8_t

Fan SM current state.

output_on

bool

Fan output state.

override_active

bool

Override active state.

transition_tick

uint32_t

Last state transition tick.

sm_fan_control_eventstruct

Event payload handled by sm_fan_control.

Struct Members

Name

Type

Description

signal_id

uint16_t

Fan SM event id.

request_on

bool

Requested output state.

protect_active

bool

Protection input.

feedback_ok

bool

Feedback validity.

sm_fan_control_resultenum

Result code for sm_fan_control operations.

Enum Members

Name

Value

Description

OK

0

State transition applied.

INVALID_TRANSITION

1

Illegal transition for current state.

FORCED_SAFE

2

Output forced to safe state.

Attributes

Attribute

Type

Visibility

Description

ctx

sm_fan_control_context

private

Runtime context for sm_fan_control state timing and error tracking.

Methods

dispatch

  • Return Type: sm_fan_control_result

  • Visibility: public

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

Parameters

Name

Type

Direction

Description

event

sm_fan_control_event

in

Process one sm_fan_control event and update runtime outputs.

init

  • Return Type: sm_fan_control_result

  • Visibility: public

  • Description: Initialize sm_fan_control runtime state and dependencies.

Dynamic Behaviour

State Machines

sm_fan_control_state

@startuml
hide empty description


[*] --> Fan_Off

Fan_Off --> Fan_On : EVT_TEMP_ABOVE_ON [not_protective]
Fan_On --> Holdoff : EVT_TEMP_BELOW_OFF
Holdoff --> Fan_Off : EVT_TICK_1S [stable_below_off]
Holdoff --> Fan_On : EVT_TEMP_ABOVE_ON

Fan_On --> Fan_Off : EVT_PROTECT_ACTIVE
Holdoff --> Fan_Off : EVT_PROTECT_ACTIVE
Fan_Off --> Fan_Off : EVT_CFG_UPDATE
Fan_On --> Fan_On : EVT_CFG_UPDATE

@enduml

This state machine captures hysteresis based fan actuation with anti chatter holdoff semantics and protective override handling so temperature threshold crossings produce stable deterministic fan transitions under noisy boundary conditions.