ao_modbus_server

Active object handling Modbus RTU request and response event flows.

Inherited Component

Inherited Requirements

Relationship Diagram

UML class diagram for ao_modbus_server

SW Unit Relations

Outgoing Relations

Relation

UML Type

Visibility

Target Unit

Description

SWR-018

dependency

private

hal_event_adapter

Modbus server uses hardware-adapted UART events.

SWR-020

dependency

private

ao_config_manager

Modbus server forwards configuration update requests to config manager for validation and commit.

Incoming Relations

Relation

UML Type

Visibility

Source Unit

Description

SWR-011

dependency

public

ao_runtime_supervisor

Runtime supervisor dispatches communication events.

Data Types

ao_modbus_server_contextstruct

Internal runtime context for ao_modbus_server.

Struct Members

Name

Type

Description

session_state

uint8_t

Modbus session state.

last_function_code

uint8_t

Last processed function code.

exception_active

bool

Exception response active.

last_request_tick

uint32_t

Last request processing tick.

ao_modbus_server_eventstruct

Event payload handled by ao_modbus_server.

Struct Members

Name

Type

Description

signal_id

uint16_t

Modbus event signal id.

function_code

uint8_t

Requested function code.

register_address

uint16_t

Starting register address.

register_count

uint16_t

Register quantity.

ao_modbus_server_resultenum

Result code for ao_modbus_server operations.

Enum Members

Name

Value

Description

OK

0

Transaction served.

FRAME_ERROR

1

Frame parsing failed.

MODBUS_EXCEPTION

2

Exception response returned.

Attributes

Attribute

Type

Visibility

Description

ctx

ao_modbus_server_context

private

Runtime context for ao_modbus_server state timing and error tracking.

Methods

dispatch

  • Return Type: ao_modbus_server_result

  • Visibility: public

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

Parameters

Name

Type

Direction

Description

event

ao_modbus_server_event

in

Process one ao_modbus_server event and update runtime outputs.

init

  • Return Type: ao_modbus_server_result

  • Visibility: public

  • Description: Initialize ao_modbus_server runtime state and dependencies.

Dynamic Behaviour

State Machines

ao_modbus_server_state

@startuml
hide empty description


[*] --> Comms_Init
Comms_Init --> Idle : EVT_INIT_DONE

Idle --> Rx_Frame : EVT_FRAME_RX
Rx_Frame --> Validate : EVT_FRAME_COMPLETE
Validate --> Respond : EVT_REQ_VALID
Validate --> Error : EVT_REQ_INVALID
Validate --> Error : EVT_CRC_FAIL

Respond : do / build_modbus_response()
Respond --> Idle : EVT_TX_DONE

Error : do / send_exception_response()
Error --> Idle : EVT_TX_DONE
Error --> Idle : EVT_TIMEOUT

@enduml

This state machine models Modbus request processing phases including frame reception validation protocol error handling and response transmission to ensure deterministic interface behavior for valid and invalid master transactions.

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