Skip to content

About

pyarinc653 is a ARINC 653 time‑partitioned simulation framework for Python. It provides deterministic major/minor frame scheduling, partition execution, interrupt/syscall simulation, YAML/Pydantic configuration, and multiple tracing backends. Ideal for RTOS research and tooling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

Repository files navigation

pyarinc653 — ARINC 653 Time‑Partitioned Simulation Framework

Installation

pip install -e .
pip install -e .[test]
pip install -e .[viz]   # optional visualization support

Overview

pyarinc653 simulates an ARINC 653‑style time‑partitioned system.
It models major/minor frame scheduling, partition execution slices, process timing, IPC channels, and tracing.
System definitions are expressed through Pydantic models and can be loaded from YAML or JSON.


Core Concepts

Major / Minor Frames

A system defines:

  • major_frame: total duration
  • minor_frames: ordered list of (partition, duration) windows

Each minor frame activates exactly one partition.

Partitions

Each partition defines:

  • id
  • nb_runs
  • optional name
  • optional processes
  • optional sampling ports
  • optional queuing ports
  • optional scheduling_policy (PRIORITY, RMS, EDF)
  • optional hm_table (health monitoring actions per error code)

IPC Channels

Channels connect ports across partitions:

  • sampling → sampling
  • queuing → queuing

Routing occurs at minor‑frame boundaries.

Health Monitoring

Health monitoring can be defined at:

  • partition level via hm_table
  • system level via system_hm_table

Supported actions:

  • IGNORE
  • STOP_PROCESS
  • RESTART_PROCESS
  • RESTART_PARTITION

Tracing

Tracing backends include:

  • NullTracer
  • LoggingTracer
  • JsonTracer
  • BufferedTracer
  • CompositeTracer
  • ChromeTracer (Perfetto / chrome://tracing)

Python API

from arinc653.config import SystemConfig, MinorFrame, PartitionConfig
from arinc653.scheduler import Scheduler
from arinc653.tracing.null import NullTracer

config = SystemConfig(
    major_frame=100,
    minor_frames=[
        MinorFrame(partition=0, duration=50),
        MinorFrame(partition=1, duration=50),
    ],
    partitions=[
        PartitionConfig(id=0, nb_runs=1),
        PartitionConfig(id=1, nb_runs=1),
    ],
)

sched = Scheduler(config=config, tracer_factory=lambda pid: NullTracer(pid, "traces"))
sched.run()

YAML Configuration

major_frame: 100
minor_frames:
  - partition: 0
    duration: 50
  - partition: 1
    duration: 50

partitions:
  - id: 0
    nb_runs: 1
    sampling_ports:
      - name: out
        max_message_size: 32
        refresh_period: 10

  - id: 1
    nb_runs: 1
    sampling_ports:
      - name: in
        max_message_size: 32
        refresh_period: 10

channels:
  - source_partition: 0
    source_port: out
    dest_partition: 1
    dest_port: in

trace_path: traces
tracer: chrome
random_seed: 123
strict: false
tick_duration: 1
major_frame_repeats: 1

Run:

arinc653 --config system.yaml

Extended YAML (scheduling and health monitoring)

system_hm_table:
  INVALID_SCHEDULE: STOP_PROCESS

partitions:
  - id: 0
    nb_runs: 1
    scheduling_policy: RMS
    hm_table:
      DEADLINE_MISS: RESTART_PROCESS
    processes:
      - id: 1
        name: SensorTask
        priority: 10
        period: 50
        capacity: 20

CLI

YAML mode

arinc653 --config system.yaml

Manual mode

arinc653 \
  --minor-frames "0:50,1:50" \
  --partitions "0:1:P0,1:1:P1" \
  --strict \
  --tick-duration 1 \
  --major-frame-repeats 1 \
  --trace-path traces \
  --tracer chrome

Tracer selection

arinc653 --config system.yaml --tracer chrome
arinc653 --config system.yaml --tracer json
arinc653 --config system.yaml --tracer buffered

Gantt chart visualization

Requires pyarinc653[viz]:

arinc653 --plot-gantt

Reads traces/trace.json and renders a Gantt chart of partition execution.

Utility flags

  • --print-schedule
  • --list-partitions
  • --dry-run
  • --validate — check configuration without running
  • --dump-trace — print trace.json events
  • --export-schedule FILE — write resolved minor‑frame schedule to JSON

Architecture

  • Scheduler
    Executes major/minor frames and routes IPC channels.

  • Partition
    Runs execution slices, manages processes, ports, interrupts, syscalls, scheduling policies, and health monitoring.

  • Scheduling policies
    Supports PRIORITY, RMS, and EDF for intra‑partition process scheduling.

  • Tracing subsystem
    Records events through pluggable backends, including ChromeTracer.

  • Configuration
    Pydantic models with full validation of schedule, ports, channels, and timing.

  • CLI
    Loads YAML or manual definitions and runs the system.
    Supports tracer override, validation, trace utilities, and Gantt visualization.


Examples

See examples/ for complete configurations:

  • minimal.yaml — basic two‑partition schedule
  • ipc.yaml — sampling/queuing channel routing
  • strict.yaml — deterministic execution
  • faults.yaml — fault injection
  • buffered.yaml — in‑memory tracing
  • composite.yaml — multi‑backend tracing
  • json.yaml — JSON trace output
  • chrome.yaml — Perfetto trace output for ChromeTracer
  • logging.yaml — logging‑based tracing
  • stress.yaml — 10‑partition stress test
  • trace.yaml — simple trace output example
  • system.json — JSON configuration example
  • ports.yaml — sampling + queuing ports with IPC routing
  • multi_partition.yaml — 5‑partition schedule for medium‑complexity systems
  • viz.yaml — Gantt‑chart‑friendly schedule for --plot-gantt
  • validate.yaml — minimal config for --validate
  • schedule.yaml — simple schedule for --export-schedule
  • faults_storm.yaml — interrupt storm + syscall failure rate
  • composite_full.yaml — composite tracer with multiple components
  • chrome_full.yaml — ChromeTracer with ports, IPC, and faults
  • system_ipc.json — JSON config with sampling‑port IPC
  • trace_format.json — synthetic example showing the trace file structure
  • hm.yaml — partition and system health monitoring configuration
  • rms_edf.yaml — RMS and EDF scheduling examples
  • deadline.yaml — periodic processes with deadline miss handling

Run:

arinc653 --config examples/minimal.yaml

About

pyarinc653 is a ARINC 653 time‑partitioned simulation framework for Python. It provides deterministic major/minor frame scheduling, partition execution, interrupt/syscall simulation, YAML/Pydantic configuration, and multiple tracing backends. Ideal for RTOS research and tooling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages