ao_runtime_supervisor

Top-level active object driving startup and dispatching periodic and asynchronous events.

Inherited Component

Inherited Requirements

Relationship Diagram

UML class diagram for ao_runtime_supervisor

SW Unit Relations

Outgoing Relations

Relation

UML Type

Visibility

Target Unit

Description

SWR-001

composition

private

evt_dispatcher

Runtime supervisor owns event dispatch lifecycle.

SWR-002

composition

private

evt_timer_service

Runtime supervisor owns timer event service.

SWR-003

composition

private

sm_operation_mode

Runtime supervisor embeds operation mode state machine.

SWR-007

dependency

public

ao_monitoring

Runtime supervisor dispatches monitoring events.

SWR-008

dependency

public

ao_control

Runtime supervisor dispatches control events.

SWR-009

dependency

public

ao_safety

Runtime supervisor dispatches safety events.

SWR-010

dependency

public

ao_diagnostics

Runtime supervisor dispatches diagnostics events.

SWR-011

dependency

public

ao_modbus_server

Runtime supervisor dispatches communication events.

Data Types

ao_runtime_supervisor_contextstruct

Internal runtime context for ao_runtime_supervisor.

Struct Members

Name

Type

Description

lifecycle_state

uint8_t

Runtime lifecycle state.

ready_gate_mask

uint16_t

Startup readiness mask.

degraded_active

bool

Degraded mode active.

watchdog_ok

bool

Watchdog health state.

ao_runtime_supervisor_eventstruct

Event payload handled by ao_runtime_supervisor.

Struct Members

Name

Type

Description

signal_id

uint16_t

Supervisor event signal id.

source_unit_id

uint16_t

Event source unit identifier.

gate_id

uint8_t

Readiness gate identifier.

fault_present

bool

Fault condition input.

ao_runtime_supervisor_resultenum

Result code for ao_runtime_supervisor operations.

Enum Members

Name

Value

Description

OK

0

Lifecycle transition applied.

INIT_TIMEOUT

1

Initialization timed out.

DEGRADED_ENTERED

2

Entered degraded lifecycle.

Attributes

Attribute

Type

Visibility

Description

ctx

ao_runtime_supervisor_context

private

Runtime context for ao_runtime_supervisor state timing and error tracking.

Methods

dispatch

  • Return Type: ao_runtime_supervisor_result

  • Visibility: public

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

Parameters

Name

Type

Direction

Description

event

ao_runtime_supervisor_event

in

Process one ao_runtime_supervisor event and update runtime outputs.

init

  • Return Type: ao_runtime_supervisor_result

  • Visibility: public

  • Description: Initialize ao_runtime_supervisor runtime state and dependencies.

Dynamic Behaviour

State Machines

ao_runtime_supervisor_state

@startuml
hide empty description
[*] --> Boot
Boot --> Init_Subsystems : EVT_BOOT

Init_Subsystems : entry / init_timer_service()
Init_Subsystems : entry / init_dispatcher()
Init_Subsystems : entry / init_active_objects()
Init_Subsystems --> Run : EVT_INIT_OK [timer_ready && dispatcher_ready && required_aos_ready]
Init_Subsystems --> Degraded : EVT_INIT_FAIL [init_timeout || required_service_failed]

Run : do / dispatch_periodic_events()
Run : do / dispatch_async_events()
Run --> Degraded : EVT_FATAL_FAULT

Degraded : do / minimal_safe_dispatch()
Degraded --> Run : EVT_RESET [fault_cleared && watchdog_ok && required_services_ready]
Degraded --> Shutdown : EVT_SHUTDOWN_REQ

Shutdown : entry / publish_shutdown_status()
Shutdown : do / stop_active_objects_orderly()
Shutdown --> [*] : EVT_ALL_STOPPED
@enduml

Runtime supervisor lifecycle with explicit readiness gates degraded entry and recovery criteria and controlled shutdown completion conditions.

Sequence Diagrams

SEQ-001_Runtime_Event_Orchestration

@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-004_Modbus_Event_Servicing

@startuml

hide footbox
title Modbus Server Event Servicing

participant ao_runtime_supervisor
participant ao_modbus_server
participant hal_event_adapter

ao_runtime_supervisor -> ao_modbus_server : dispatch comms_event
ao_modbus_server -> hal_event_adapter : request UART I/O
hal_event_adapter --> ao_modbus_server : uart_rx/tx completion
ao_modbus_server -> hal_event_adapter : publish protocol response

@enduml

Runtime-driven communication events are processed by the Modbus server through hardware-adapted UART event exchange.

SEQ-005_Startup_To_Ready

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

SEQ-006_Degraded_Entry_And_Recovery

@startuml
hide footbox
participant ao_runtime_supervisor
participant evt_dispatcher
participant ao_control
participant ao_safety
participant ao_diagnostics

ao_runtime_supervisor -> evt_dispatcher : dispatch cycle
alt degraded entry criteria met
  note over ao_runtime_supervisor: init_timeout OR required_service_failed OR fatal_fault
  ao_runtime_supervisor -> ao_control : EVT_DEGRADED
  ao_runtime_supervisor -> ao_safety : EVT_DEGRADED
  ao_runtime_supervisor -> ao_diagnostics : EVT_DEGRADED
  ao_runtime_supervisor -> evt_dispatcher : restrict noncritical events
end

ao_runtime_supervisor -> evt_dispatcher : periodic degraded dispatch

alt recovery criteria met
  note over ao_runtime_supervisor: fault_cleared AND watchdog_ok AND required_services_ready
  ao_runtime_supervisor -> evt_dispatcher : EVT_RESET
  ao_runtime_supervisor -> ao_control : EVT_RECOVERY
  ao_runtime_supervisor -> ao_safety : EVT_RECOVERY
  ao_runtime_supervisor -> ao_diagnostics : EVT_RECOVERY
end
@enduml

Lifecycle sequence for degraded entry triggers and guarded recovery back to Run.

SEQ-007_Controlled_Shutdown

@startuml
hide footbox
participant ao_runtime_supervisor
participant evt_dispatcher
participant ao_control
participant ao_safety
participant ao_diagnostics
participant ao_modbus_server

ao_runtime_supervisor -> evt_dispatcher : EVT_SHUTDOWN_REQ
ao_runtime_supervisor -> ao_control : stop outputs to safe state
ao_runtime_supervisor -> ao_safety : keep protective policy active
ao_runtime_supervisor -> ao_diagnostics : publish shutdown status
ao_runtime_supervisor -> ao_modbus_server : stop comm servicing

ao_modbus_server --> ao_runtime_supervisor : EVT_STOPPED
ao_diagnostics --> ao_runtime_supervisor : EVT_STOPPED
ao_safety --> ao_runtime_supervisor : EVT_STOPPED
ao_control --> ao_runtime_supervisor : EVT_STOPPED
evt_dispatcher --> ao_runtime_supervisor : EVT_STOPPED

ao_runtime_supervisor -> ao_runtime_supervisor : EVT_ALL_STOPPED / Shutdown complete
@enduml

Controlled shutdown sequence defining stop ordering and completion criteria.