sm_fan_control ============== State machine implementing fan control and anti-chatter behavior. Inherited Component ------------------- - :doc:`Control_Manager ` Inherited Requirements ---------------------- - :doc:`REQ-CTL-001 ` - :doc:`REQ-CTL-002 ` - :doc:`REQ-CTL-004 ` - :doc:`REQ-REL-003 ` Relationship Diagram -------------------- .. image:: /_static/sw_unit_uml/sm_fan_control_2cd69a94-0987-4cd6-839c-002a437c52e1_uml.svg :alt: UML class diagram for sm_fan_control :class: dblclick-open-image SW Unit Relations ----------------- Incoming Relations ~~~~~~~~~~~~~~~~~~ .. list-table:: :header-rows: 1 * - Relation - UML Type - Visibility - Source Unit - Description * - :doc:`SWR-004 ` - composition - private - :doc:`ao_control ` - Control active object embeds fan control state machine. Data Types ---------- .. _dt-701c0b74-dc97-401c-8a05-805abe3129e5: .. raw:: html
sm_fan_control_contextstruct
Internal runtime context for sm_fan_control. .. rubric:: Struct Members .. list-table:: :header-rows: 1 * - Name - Type - Description * - sm_state - :ref:`uint8_t ` - Fan SM current state. * - output_on - :ref:`bool ` - Fan output state. * - override_active - :ref:`bool ` - Override active state. * - transition_tick - :ref:`uint32_t ` - Last state transition tick. .. _dt-4c4a43d5-9deb-4c4a-881e-c130715bfb6e: .. raw:: html
sm_fan_control_eventstruct
Event payload handled by sm_fan_control. .. rubric:: Struct Members .. list-table:: :header-rows: 1 * - Name - Type - Description * - signal_id - :ref:`uint16_t ` - Fan SM event id. * - request_on - :ref:`bool ` - Requested output state. * - protect_active - :ref:`bool ` - Protection input. * - feedback_ok - :ref:`bool ` - Feedback validity. .. _dt-2a7e2bca-6b7e-4a7e-aca8-a49db4c4b064: .. raw:: html
sm_fan_control_resultenum
Result code for sm_fan_control operations. .. rubric:: Enum Members .. list-table:: :header-rows: 1 * - 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 ---------- .. list-table:: :header-rows: 1 * - Attribute - Type - Visibility - Description * - ctx - :ref:`sm_fan_control_context ` - private - Runtime context for sm_fan_control state timing and error tracking. Methods ------- dispatch ~~~~~~~~ - **Return Type:** :ref:`sm_fan_control_result ` - **Visibility:** public - **Description:** Process one sm_fan_control event and update runtime outputs. .. rubric:: Parameters .. list-table:: :header-rows: 1 * - Name - Type - Direction - Description * - event - :ref:`sm_fan_control_event ` - in - Process one sm_fan_control event and update runtime outputs. init ~~~~ - **Return Type:** :ref:`sm_fan_control_result ` - **Visibility:** public - **Description:** Initialize sm_fan_control runtime state and dependencies. Dynamic Behaviour ----------------- State Machines ~~~~~~~~~~~~~~ sm_fan_control_state ^^^^^^^^^^^^^^^^^^^^ .. uml:: @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.