Skip to main content

Architecture Overview

High-Level Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│ TickSimulation │
│ │
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ │ User Space │ │
│ │ │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
│ │ │ Unit A │───►│ Unit B │───►│ Unit C │───►│ Unit D │ │ │
│ │ │ tick() │ │ tick() │ │ tick() │ │ tick() │ │ │
│ │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │ │
│ │ │ │ │ │ │ │
│ │ └──────────────┴──────────────┴──────────────┘ │ │
│ │ │ │ │
│ │ Ports (InPort/OutPort) │ │
│ │ │ │
│ └─────────────────────────────────┬──────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────┴──────────────────────────────────────┐ │
│ │ Framework Core │ │
│ │ │ │
│ │ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ │
│ │ │ Dependency │ │ Cycle │ │ Weighted │ │ │
│ │ │ Graph Builder │──│ Analyzer │──│ Partitioner │ │ │
│ │ └──────────────────┘ └──────────────────┘ └──────────────────┘ │ │
│ │ │ │ │
│ │ ┌──────────────────────────────┴───────────────────────────────────┐ │ │
│ │ │ Execution Paths (Sequential / Epoch-Free) │ │ │
│ │ └───────────────────────────────────────────────────────────────────┘ │ │
│ └─────────────────────────────────┼───────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────┴───────────────────────────────────────┐ │
│ │ stdexec::static_thread_pool │ │
│ └──────────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────────┘

See API Contracts and Migration for the public/internal boundary, ownership rules and capability matrix.

Component Relationships

TickSimulation

┌───────────────────┼───────────────────┐
│ │ │
▼ ▼ ▼
Unit Registry Connection Registry Partitioner
│ │ │
│ ▼ │
│ DependencyGraph ◄──────────┘
│ │
│ ▼
│ CycleAnalyzer
│ │
│ ┌─────────┼─────────┐
│ ▼ ▼ ▼
│ Independent Loose Tight
│ Groups Cycles Cycles
│ │ │ │
│ └─────────┼─────────┘
│ ▼
│ WeightedPartitioner
│ │
└───────────────────┼───────────────────┐
▼ │
stdexec::static_thread_pool ◄───────┘

Source map

Start model code with the public entry headers. Follow this map when working on the framework; paths are relative to src/.

ResponsibilityLocation
Model, observation and application entry pointschronon/
Unit lifecycle and simulation executionsender/core/
Typed ports, connections, queues and CDCsender/port/
Dependency analysis, partitioning and profilingsender/schedule/
Pipeline registers, phases and arbitrationsender/util/
YAML loading, unit factories and CLI entrysender/config/, sender/factory/, sender/app/
Counters, timeline events, logs and outputobserve/
Unit hierarchy and parameter declarationstree/, params/

Reading TickSimulation

TickSimulation owns the simulation session. Its public reference groups session/topology/clock domains, execution/termination, and inspection/adapter integration. The implementation files below share that owner; they are not separate public scheduler or lifecycle objects. Paths are relative to src/sender/core/.

ConcernStart here
Model options and execution policyTickSimulationConfig.hpp
Unit construction and typed connectionsTickSimulation.hpp
Session lifetime, finalization and tree bindingsTickSimulationLifecycle.cpp
Initialization, execution selection and sequential ticksTickSimulation.cpp
Single-clock progress and parallel workersTickSimulationParallel.cpp
Clock topology, sequential clock events and CDC drainingTickSimulationClocks.cpp
Parallel clock execution and migrationTickSimulationClockParallel.cpp, TickSimulationClockMigration.cpp
Placement and dependency preparationTickSimulationPartition.cpp, TickSimulationClusters.cpp, TickSimulationDependencies.cpp
Dynamic placement planning, sampling and worker coordinationTickSimulationPlanning.cpp, TickSimulationDynamicSampling.cpp, TickSimulationDynamicRuntime.cpp, TickSimulationDynamicRebalance.cpp
Internal progress and clock stateTickSimulationDescriptors.hpp, TickSimulationClockRuntime.hpp

See scheduling for execution semantics and API contracts for lifecycle and ownership constraints.

Key Components

ComponentPurpose
TickableUnitBase class for simulation units with tick() method
TickSimulationSimulation driver with parallel execution
OutPort<T> / InPort<T>Type-safe communication ports
Connection<T>Connects ports with configurable delay
DependencyGraphCaptures unit interconnections (Floyd-Warshall all-pairs)
CycleAnalyzerTarjan SCC + Johnson's cycle detection and classification
WeightedPartitionerCost-aware graph partitioner for thread assignment
ObservableUnitMixin for counters, traces, logs
ParameterSetSelf-registering YAML-serializable parameters
SimulationAppUnified CLI entry point
CrashHandlerSignal handler and emergency observer flush on crash
TickExceptionException wrapping unit name + cycle from tick() crash