CBTC/CTCS train-borne ATP overspeed protection and dynamic braking curve calculation engine in MoonBit
| Package | Responsibility |
|---|---|
| src/types | 线路、列车、单位、MA/TSR、ATP 状态和诊断数据类型 |
| src/line_profile | SSP、TSR、MA、坡度、道岔、区间树和线路约束 |
| src/dynamics | 粘着、Davis 阻力、坡度、牵引、气制动和 EBD/SBD 积分 |
| src/protection | 防护阈值、超速比较、测速误差、回溜和制动联锁 |
| src/state_machine | ATP 状态迁移、故障升级和 2oo2 通道比较 |
| src/balise | Eurobalise/CTCS 报文及无线填充数据解析 |
| src/runtime | 将遥测、线路、MA/TSR 和状态机组合为一次 ATP 周期 |
| src/simulation | 高速、城轨、重载、隧道、风雪和密头时距场景 |
moon version --allmoon fmt --check
moon check --target all --deny-warn
moon test --target all --deny-warn
moon build --target allmoon run examples/quick_start --target nativeaction_code=1,state_severity=2,permitted_mps=40,eoa_margin_m=10999.8,reason_code=1telemetry + dual-channel state
-> input validation
-> SSP ∧ TSR ∧ MA/EOA
-> SBD/EBD and odometer bounds
-> state machine + 2oo2 comparison
-> decision + thresholds + reason code.
├── src/ # MoonBit library packages
│ ├── types/ # Domain types and units
│ ├── line_profile/ # SSP, TSR, MA and spatial queries
│ ├── dynamics/ # Train dynamics and braking integration
│ ├── protection/ # Supervision and safety boundaries
│ ├── state_machine/ # ATP FSM and 2oo2 voting
│ ├── balise/ # Telegram decoders
│ ├── runtime/ # One-cycle ATP orchestration
│ ├── simulation/ # Deterministic route scenarios
│ └── tests/ # Unit, boundary and invariant tests
├── examples/quick_start/ # Runnable native example
├── benchmarks/atp_benchmark/ # Deterministic local benchmark runner
├── docs/benchmarks.md # Recorded reference measurements
├── .github/workflows/ci.yml # Stable-toolchain CI matrix
├── moon.mod # Module metadata
├── LICENSE # Apache-2.0
└── README.mdmoon fmt --check
moon check --target all --deny-warn
moon test --target all --deny-warn
moon build --target all
moon info
moon run examples/quick_start --target nativemoon run benchmarks/atp_benchmark --target native --releaseCBTC/CTCS train-borne ATP overspeed protection and dynamic braking curve calculation engine in MoonBit