How glocker/aetherflow works
End-to-end data flow
The primary flow is: controller_simulator emits CAN SYNC frames, those frames traverse a UDP multicast “virtual CAN bus,” eps_simulator consumes them and produces EPS housekeeping telemetry as SpaceCAN REPLY frames, and bridge_service listens passively, reassembles packets, parses telemetry, and exposes the result to a dashboard over HTTP/WebSocket.
Transport boundary
transport/ contains the pluggable bus backends. The current demo backend is udp_transport.c, which uses multicast as a local development bus. socketcan_transport.c and memory_transport.c exist as future/alternate backends. The important boundary is can_frame_t: protocol code never speaks UDP or SocketCAN directly; it only reads/writes canonical CAN frame objects.
Wire encoding
Because UDP is only a transport wrapper, the repo defines an explicit AFC1 wire envelope in can_frame_wire.c / can_frame_wire.h. That keeps frame encoding stable across compilers and platforms by serializing the CAN ID, DLC, and 8-byte data payload explicitly instead of shipping raw C structs.
SpaceCAN protocol stack
src/spacecan_*.c and include/spacecan*.h implement the transport-independent protocol layer: CAN ID calculation, fragmentation of SpaceCAN packets into CAN frames, reassembly back into packets, and parsing of service/subtype/payload fields. The code also defines the core arbitration IDs used throughout the system: SYNC (0x080), REQUEST (0x600 + node_id), REPLY (0x580 + node_id), and HEARTBEAT (0x700 + node_id).
EPS simulator as an onboard subsystem
eps_simulator.c models a single EPS node with a small state machine (BOOT -> PRE_OPERATIONAL -> OPERATIONAL). Once operational, each SYNC tick produces deterministic housekeeping telemetry. That telemetry is encoded as SpaceCAN service 3, subtype 25, then fragmented into CAN frames and sent back on the bus. This subsystem is the source of the demo’s actual telemetry data.
Bridge service as ground-segment ingestion
bridge_service_main.c is the ground station boundary. It subscribes to the multicast bus, reconstructs SpaceCAN packets, filters for the EPS housekeeping service, and converts the decoded values into JSON. It then exposes the data through HTTP endpoints and a WebSocket stream, making it the integration point between the bus layer and any UI/consumer.
Dashboard/UI boundary
openmct/ is a separate frontend subsystem. It contains an Open MCT plugin, telemetry provider, realtime plumbing, formatting/dictionary logic, and custom UI components. Architecturally, it does not talk to the simulators directly; it consumes the bridge’s HTTP/WebSocket API. The repo also includes a minimal built-in dashboard served by bridge_service for a dependency-light smoke test of the bridge boundary.
Compatibility and verification
compat/ and tools/generate_spacecan_vectors.c provide byte-level protocol compatibility checks. The generated vectors and Python harness verify both directions: C-generated frames/packets can be parsed by Python, and Python can re-encode scenarios to exactly match the C output. This is an important architectural guardrail because the protocol is intended to remain portable across future implementations.
Testing strategy
The test suite is split by subsystem: tests/test_spacecan_codec.c validates protocol encoding/decoding and tests/test_eps_simulator.c validates the EPS state machine and telemetry behavior. This mirrors the architecture: protocol correctness is tested separately from simulator behavior, which is separate from transport and UI concerns.
Build and orchestration
Makefile and tools/run_demo.sh orchestrate the full demo. The default demo mode builds the C services, runs them as separate local processes, and starts the Open MCT dev server. Environment variables control the controller rate and bridge/dashboard URLs, which keeps the runtime topology configurable without changing code.
Main entry points: spacecan_id.c SpaceCAN Core · bridge_service_main.c Bridge · transport.h Transport API · run_demo.sh Demo Script
Components 21
Runtime
Simulators and services that run the demo loop
- Controller · Emits SYNC frames to drive the demo bus
src/controller_simulator_main.c - EPS Main · Starts the onboard EPS node process
src/eps_simulator_main.c - EPS Node · Boots, transitions to operational, and generates housekeeping telemetry
src/eps_simulator.c
Protocol
Transport-independent CAN and SpaceCAN layers
- SpaceCAN Core · ID calculation, packet fragmentation, reassembly, and service parsing
src/spacecan_id.c - Packets · SpaceCAN packet framing and payload handling
src/spacecan_packet.c - Reassembly · Rebuilds SpaceCAN packets from CAN frames
src/spacecan_reassembly.c - Services · Defines SpaceCAN service and subtype mappings
src/spacecan_services.c - CAN Frame · Canonical CAN frame abstraction shared by all protocol code
include/can_frame.h - AFC1 Wire · Explicit wire serialization for CAN frames over transport
src/can_frame_wire.c - Transport API · Abstracts bus backends behind a common CAN frame interface
include/transport.h - UDP Bus · Multicast demo backend for the virtual CAN bus
transport/udp_transport.c - SocketCAN · Host CAN backend for future or alternate deployments
transport/socketcan_transport.c - Memory Bus · In-process transport for tests and alternate wiring
transport/memory_transport.c
Ground
Bridge and dashboard ingestion
- Bridge · Reassembles packets, decodes telemetry, and serves JSON/WebSocket output
src/bridge_service_main.c
UI
Open MCT frontend and realtime consumer
- Open MCT · Dashboard plugin, realtime plumbing, and telemetry presentation
openmct/src/plugin.js - Telemetry API · Consumes bridge service data for Open MCT
openmct/src/telemetry-provider.js
Verify
Compatibility vectors and subsystem tests
- Vectors · Reference protocol vectors for byte-level cross-language checks
compat/vectors/aetherflow_spacecan_vectors.json - Vector Check · Python harness that validates generated protocol vectors
compat/python/check_vectors.py - Codec Tests · Validates SpaceCAN encoding and decoding behavior
tests/test_spacecan_codec.c - EPS Tests · Validates EPS state transitions and telemetry output
tests/test_eps_simulator.c
Build
Orchestration and demo launch scripts
- Demo Script · Builds and launches the simulated bus, bridge, and UI
tools/run_demo.sh
Connections 25
- Controller → Transport API: uses bus · Controller publishes SYNC frames through the abstract transport
- EPS Main → EPS Node: starts · Main entry boots the EPS node state machine
- EPS Node → SpaceCAN Core: encodes telemetry · EPS creates SpaceCAN housekeeping packets before fragmentation
- Controller → SpaceCAN Core: SYNC ids · Controller relies on protocol ID constants for SYNC traffic
- SpaceCAN Core → Packets: fragments · Protocol layer fragments packets into CAN frames
- SpaceCAN Core → Reassembly: reassembles · Protocol layer rebuilds packets from incoming frames
- SpaceCAN Core → Services: parses · Protocol layer interprets service and subtype fields
- SpaceCAN Core → CAN Frame: frames · All protocol work is expressed in canonical CAN frames
- CAN Frame → AFC1 Wire: serializes · CAN frames are encoded into the AFC1 wire envelope
- Transport API → UDP Bus: backend · Current demo transport implementation
- Transport API → SocketCAN: backend · Alternative host CAN implementation
- Transport API → Memory Bus: backend · In-process transport implementation
- UDP Bus → AFC1 Wire: ships frames · UDP backend moves serialized CAN frames over multicast
- Bridge → Transport API: listens via · Bridge subscribes to the bus through the transport abstraction
- Bridge → Reassembly: decodes · Bridge reconstructs packets from received frames
- Bridge → Services: filters telemetry · Bridge selects EPS housekeeping service data
- Bridge → Telemetry API: serves api · Bridge exposes decoded telemetry for UI consumption
- Telemetry API → Open MCT: feeds · Open MCT plugin consumes bridge telemetry and status data
- Vectors → Vector Check: verified by · Generated vectors are checked by the Python harness
- Codec Tests → SpaceCAN Core: covers · Codec tests validate protocol behavior
- EPS Tests → EPS Node: covers · EPS tests validate the onboard state machine and output
- Demo Script → Controller: launches · Demo script starts the controller process
- Demo Script → EPS Main: launches · Demo script starts the EPS process
- Demo Script → Bridge: launches · Demo script starts the bridge process
- Demo Script → Open MCT: launches · Demo script serves the dashboard frontend