evt_dispatcher

Event queue and dispatcher routing events to active objects.

Inherited Component

Inherited Requirements

Relationship Diagram

UML class diagram for evt_dispatcher

SW Unit Relations

Incoming Relations

Relation

UML Type

Visibility

Source Unit

Description

SWR-001

composition

private

ao_runtime_supervisor

Runtime supervisor owns event dispatch lifecycle.

Data Types

evt_dispatcher_contextstruct

Internal runtime context for evt_dispatcher.

Struct Members

Name

Type

Description

queue_depth

uint16_t

Current queue depth.

max_queue_depth

uint16_t

Configured queue capacity.

overflow_flag

bool

Queue overflow indicator.

last_dispatch_tick

uint32_t

Last dispatch tick.

evt_dispatcher_eventstruct

Event payload handled by evt_dispatcher.

Struct Members

Name

Type

Description

signal_id

uint16_t

Dispatcher event id.

target_unit_id

uint16_t

Target unit id.

priority

uint8_t

Dispatch priority class.

enqueue_request

bool

True when event enqueued.

evt_dispatcher_resultenum

Result code for evt_dispatcher operations.

Enum Members

Name

Value

Description

OK

0

Event dispatched.

QUEUE_FULL

1

Queue full at enqueue.

TARGET_UNKNOWN

2

No route for target unit.

Attributes

Attribute

Type

Visibility

Description

ctx

evt_dispatcher_context

private

Runtime context for evt_dispatcher state timing and error tracking.

Methods

dispatch

  • Return Type: evt_dispatcher_result

  • Visibility: public

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

Parameters

Name

Type

Direction

Description

event

evt_dispatcher_event

in

Process one evt_dispatcher event and update runtime outputs.

init

  • Return Type: evt_dispatcher_result

  • Visibility: public

  • Description: Initialize evt_dispatcher runtime state and dependencies.

Dynamic Behaviour

Activity Diagrams

evt_dispatcher_activity

@startuml
start
:Receive event enqueue request;
:Push event into queue;
while (queue not empty?) is (yes)
  :Pop next event (FIFO);
  :Resolve target active object;
  :Call target dispatch(event);
endwhile (no)
stop
@enduml

This activity diagram describes dispatcher queue semantics and event routing policy showing enqueue dequeue target resolution and dispatch invocation ordering that underpins determinism across active objects.

Timing Diagrams

evt_dispatcher_timing

@startuml
robust "evt_dispatcher" as DISP
scale max 1200 width
concise "event queue" as Q

@0
Q is enqueued
DISP is waiting

@50
DISP is dequeue

@120
DISP is route_target

@220
DISP is dispatch_call

@300
DISP is idle

@enduml

This timing diagram characterizes enqueue to dispatch latency segments and highlights where backlog or routing overhead can affect downstream deadline compliance for control and safety events.

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