ao_monitoring
=============
Active object sampling sensors and emitting validated measurement events.
Inherited Component
-------------------
- :doc:`Monitoring_Manager `
Inherited Requirements
----------------------
- :doc:`REQ-MON-001 `
- :doc:`REQ-MON-002 `
- :doc:`REQ-MON-003 `
- :doc:`REQ-MON-004 `
- :doc:`REQ-REL-002 `
Relationship Diagram
--------------------
.. image:: /_static/sw_unit_uml/ao_monitoring_d00a296a-5578-400a-89d7-90d6c2b31039_uml.svg
:alt: UML class diagram for ao_monitoring
:class: dblclick-open-image
SW Unit Relations
-----------------
Outgoing Relations
~~~~~~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Relation
- UML Type
- Visibility
- Target Unit
- Description
* - :doc:`SWR-017 `
- dependency
- private
- :doc:`hal_event_adapter `
- Monitoring consumes hardware-adapted sensor events.
* - :doc:`SWR-021 `
- association
- public
- :doc:`ao_control `
- Monitoring publishes validated sensor snapshots to control for decision logic.
* - :doc:`SWR-022 `
- association
- public
- :doc:`ao_safety `
- Monitoring publishes validated sensor snapshots to safety for protective evaluation.
Incoming Relations
~~~~~~~~~~~~~~~~~~
.. list-table::
:header-rows: 1
* - Relation
- UML Type
- Visibility
- Source Unit
- Description
* - :doc:`SWR-007 `
- dependency
- public
- :doc:`ao_runtime_supervisor `
- Runtime supervisor dispatches monitoring events.
Data Types
----------
.. _dt-43068ab0-2ef2-4306-9aa0-b5b601b1a1e8:
.. raw:: html
ao_monitoring_contextstruct
Internal runtime context for ao_monitoring.
.. rubric:: Struct Members
.. list-table::
:header-rows: 1
* - Name
- Type
- Description
* - sample_period_ms
- :ref:`uint32_t `
- Sampling period.
* - last_sample_tick
- :ref:`uint32_t `
- Last sampling tick.
* - rpm_sampling_enabled
- :ref:`bool `
- RPM sampling enable state.
* - bounds_valid
- :ref:`bool `
- Last bounds validation result.
.. _dt-51e38746-2bfe-41e3-9845-4c36fde605be:
.. raw:: html
ao_monitoring_eventstruct
Event payload handled by ao_monitoring.
.. rubric:: Struct Members
.. list-table::
:header-rows: 1
* - Name
- Type
- Description
* - signal_id
- :ref:`uint16_t `
- Monitoring event signal id.
* - temperature_c
- :ref:`int16_t `
- Measured temperature.
* - supply_voltage_mv
- :ref:`uint16_t `
- Measured supply voltage.
* - fan_rpm
- :ref:`uint16_t `
- Measured fan speed.
.. _dt-8533615b-4835-4533-b5dd-f199c0f00a15:
.. raw:: html
ao_monitoring_resultenum
Result code for ao_monitoring operations.
.. rubric:: Enum Members
.. list-table::
:header-rows: 1
* - Name
- Value
- Description
* - OK
- 0
- Monitoring snapshot published.
* - SENSOR_RANGE_ERROR
- 1
- Sample out of bounds.
* - HAL_DATA_MISSING
- 2
- Required HAL data unavailable.
Attributes
----------
.. list-table::
:header-rows: 1
* - Attribute
- Type
- Visibility
- Description
* - ctx
- :ref:`ao_monitoring_context `
- private
- Runtime context for ao_monitoring state timing and error tracking.
Methods
-------
dispatch
~~~~~~~~
- **Return Type:** :ref:`ao_monitoring_result `
- **Visibility:** public
- **Description:** Process one ao_monitoring event and update runtime outputs.
.. rubric:: Parameters
.. list-table::
:header-rows: 1
* - Name
- Type
- Direction
- Description
* - event
- :ref:`ao_monitoring_event `
- in
- Process one ao_monitoring event and update runtime outputs.
init
~~~~
- **Return Type:** :ref:`ao_monitoring_result `
- **Visibility:** public
- **Description:** Initialize ao_monitoring runtime state and dependencies.
Dynamic Behaviour
-----------------
Activity Diagrams
~~~~~~~~~~~~~~~~~
ao_monitoring_activity
^^^^^^^^^^^^^^^^^^^^^^
.. uml::
@startuml
start
:Trigger periodic sampling;
:Read temperature;
:Read supply voltage;
if (fan command ON?) then (yes)
:Read fan RPM;
endif
:Validate physical bounds;
if (any value invalid?) then (yes)
:Set validity flags false;
else (no)
:Set validity flags true;
endif
:Publish IF_SensorSnapshot;
stop
@enduml
This activity diagram defines ao_monitoring control flow for one acquisition cycle including trigger source conditional RPM acquisition physical range validation and IF SensorSnapshot publication with validity flags used by downstream control and safety logic.
Timing Diagrams
~~~~~~~~~~~~~~~
ao_monitoring_timing
^^^^^^^^^^^^^^^^^^^^
.. uml::
@startuml
robust "ao_monitoring" as MON
scale max 1200 width
concise "500ms scheduler" as S
@0
S is tick
MON is sample_temp
@120
MON is sample_voltage
@250
MON is sample_rpm_if_needed
@380
MON is validate
@500
MON is publish_snapshot
S is tick
@enduml
This timing diagram decomposes the 500 ms monitoring cadence into sensor read stages validation and publish phase so requirement conformance can be checked against worst case execution and scheduling jitter.
Sequence Diagrams
~~~~~~~~~~~~~~~~~
SEQ-001_Runtime_Event_Orchestration
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. uml::
@startuml
hide footbox
title Runtime Event Orchestration
participant ao_runtime_supervisor
participant evt_timer_service
participant evt_dispatcher
participant ao_monitoring
participant ao_control
participant ao_safety
participant ao_diagnostics
participant ao_modbus_server
ao_runtime_supervisor -> evt_timer_service : init periodic tick
ao_runtime_supervisor -> evt_dispatcher : init event loop
loop each scheduler tick
evt_timer_service -> ao_runtime_supervisor : tick event
ao_runtime_supervisor -> evt_dispatcher : dispatch cycle
evt_dispatcher -> ao_monitoring : monitor_event
evt_dispatcher -> ao_control : control_event
evt_dispatcher -> ao_safety : safety_event
evt_dispatcher -> ao_diagnostics : diagnostics_event
evt_dispatcher -> ao_modbus_server : comms_event
end
@enduml
Primary runtime interoperability sequence showing scheduler tick propagation through dispatcher fan-out and deterministic active-object processing order across monitoring control safety diagnostics and communication units.
SEQ-005_Startup_To_Ready
^^^^^^^^^^^^^^^^^^^^^^^^
.. uml::
@startuml
hide footbox
participant ao_runtime_supervisor
participant evt_timer_service
participant evt_dispatcher
participant ao_monitoring
participant ao_control
participant ao_safety
participant ao_diagnostics
participant ao_modbus_server
ao_runtime_supervisor -> evt_timer_service : init()
ao_runtime_supervisor -> evt_dispatcher : init()
ao_runtime_supervisor -> ao_monitoring : init()
ao_runtime_supervisor -> ao_control : init()
ao_runtime_supervisor -> ao_safety : init()
ao_runtime_supervisor -> ao_diagnostics : init()
ao_runtime_supervisor -> ao_modbus_server : init()
group readiness gates
evt_timer_service --> ao_runtime_supervisor : EVT_TIMER_READY
evt_dispatcher --> ao_runtime_supervisor : EVT_DISPATCH_READY
ao_monitoring --> ao_runtime_supervisor : EVT_AO_READY
ao_control --> ao_runtime_supervisor : EVT_AO_READY
ao_safety --> ao_runtime_supervisor : EVT_AO_READY
ao_diagnostics --> ao_runtime_supervisor : EVT_AO_READY
ao_modbus_server --> ao_runtime_supervisor : EVT_AO_READY
end
ao_runtime_supervisor -> evt_dispatcher : EVT_INIT_OK / start Run
@enduml
Startup lifecycle sequence with explicit readiness gates before entering Run state.