Scene format
Schema for ct.scene/1: multiple lock-step MCUs with wired buses, wiring harnesses, LIN, road vehicles and fixed-wing aircraft.
Follows File formats rules (JSON/YAML, camelCase keys, strict validation). ct scene run validates before execution. Guided walkthrough: Wire boards together.
Top-level fields
| Field | What it is |
|---|---|
schemaVersion, id | ct.scene/1 and the scene id (required) |
machines[] | name, board (built-in id, board file or microcontroller twin bundle) and firmware |
uartLinks[] | name, baudBps, ends (machine, uart) |
spiLinks[] | name, clockHz, a master and its slaves (machine, spi) |
i2cBuses[] | name, a controller and its targets (machine, i2c) |
canBuses[] | name, nodes (machine, controller such as CAN1), timing (nominalBps) |
rs485Buses[] | name, baudBps, frameBits (default 8N1), nodes (machine, uart, optional driverEnable and receiverEnable pins) |
media[] | name, kind (ethernet), nodes (machine, peripheral: the MAC as the twin names it, such as Ethernet_MAC) |
linBuses[] | LIN buses, see below |
circuits[] | Analog circuits solved beside a machine; their node voltages reach the machine’s converters |
harness, vehicle, flight | The wiring harness, a road vehicle and a fixed-wing aircraft, see below |
until, maxMs, quantumNs | Stop when a machine prints a marker (machine, marker); the virtual time budget; the lock-step quantum |
registers[] | Peripheral registers to report after the run, read without side effects |
verifies | Requirement ids the scene verifies, for compliance support |
Wiring harness: ct.harness/1
JSON wiring model (connectors, wires, splices, grounds, batteries, fuses, relays, ignition switches) powering ECUs and carrying CAN/LIN buses so opens, shorts and blown fuses hit firmware directly. Write by hand or import KBL, VEC or CSV with ct harness import.
| Field | What it is |
|---|---|
schemaVersion, id | ct.harness/1 and the harness id (required). label is optional. |
ambientC | Wire temperature, °C (default 20) |
cable | Bus pairs: capacitancePfPerM, delayNsPerM (default 5) |
ecus[] | id, machine (the scene machine it is; absent: drawn only) and power: supplyPin, groundPin (X1.1), regulatorV, dropoutV, quiescentA, currentA, resetBelowV (brown-out), citation |
connectors[] | id, ecu (absent: an inline connector), part, pins[] |
splices[], grounds[] | id; a ground point also takes contactOhms (default 0.001) |
batteries[] | id, volts, internalOhms, capacityAh (default 60). Terminals <id>.pos and <id>.neg. |
fuses[] | id, ratingA, part (littelfuse-atof: resistance and melting I²t from its data sheet), i2tA2s, coldOhms. Terminals <id>.a and <id>.b. |
relays[] | id, coil (a switch and the positions that energise it, or a machine and its pin), operateMs (default 10), releaseMs (default 5), contactOhms (default 0.005). Terminals <id>.com and <id>.no. |
switches[] | id, positions (in order), contacts[] (name, closedIn), initial (default: the first position). Terminals <id>.in and <id>.<contact>. |
wires[] | id, from, to (a connector pin X1.3, a splice, a ground point or a terminal such as F1.a), gaugeMm2, lengthM, colour (RD, GN/WH), material (copper, the default, or aluminium), ohmsPerM |
faults[] | Faults present from the start, in the form below |
unmapped, layout | Written by import and the editor: what could not be mapped, and where the wires run for drawing |
Pin function values: passive (default), supply, ground, can_h, can_l, lin, mcu_pin. ECU bus pins specify bus; can_h/lin also name controller (CAN1) or UART (USART2). Optional: transceiver (tcan1042h, tja1021), mcuPin, terminationOhms (can_h), master (lin), signal.
Faults target a wire, connector pin, splice or ground point:
kind | Fields | What it does |
|---|---|---|
open | none | The conductor is broken |
short_to_ground, short_to_battery | none | It touches the body, or a battery feed |
high_resistance | ohms | A corroded or loose contact in series |
intermittent | periodMs, duty (0 to 1) | Open for duty of every period |
short_to_wire | other | It touches another wire, such as the other half of a CAN pair |
babble | none | A node’s TXD stuck dominant until its transceiver times out. Target: its can_h or lin pin. |
CLI ct harness fault uses hyphens (--kind short-to-ground); JSON files use underscores.
{
"schemaVersion": "ct.harness/1",
"id": "powertrain",
"label": "Engine, dash and gateway on one CAN bus",
"ecus": [
{
"id": "ENG",
"machine": "engine",
"power": {
"supplyPin": "X_ENG.3", "groundPin": "X_ENG.4",
"regulatorV": 3.3, "dropoutV": 1.0, "currentA": 0.15, "resetBelowV": 2.7
}
},
{
"id": "DASH",
"machine": "dash",
"power": {
"supplyPin": "X_DASH.3", "groundPin": "X_DASH.4",
"regulatorV": 3.3, "dropoutV": 1.0, "currentA": 0.15, "resetBelowV": 2.7
}
},
{ "id": "GW", "machine": "gw" }
],
"connectors": [
{
"id": "X_ENG",
"ecu": "ENG",
"pins": [
{ "pin": "1", "function": "can_h", "bus": "pt-can", "controller": "CAN1", "terminationOhms": 120 },
{ "pin": "2", "function": "can_l", "bus": "pt-can" },
{ "pin": "3", "function": "supply" },
{ "pin": "4", "function": "ground" }
]
},
{
"id": "X_DASH",
"ecu": "DASH",
"pins": [
{ "pin": "1", "function": "can_h", "bus": "pt-can", "controller": "CAN1", "terminationOhms": 120 },
{ "pin": "2", "function": "can_l", "bus": "pt-can" },
{ "pin": "3", "function": "supply" },
{ "pin": "4", "function": "ground" }
]
},
{
"id": "X_GW",
"ecu": "GW",
"pins": [
{ "pin": "1", "function": "can_h", "bus": "pt-can", "controller": "CAN1" },
{ "pin": "2", "function": "can_l", "bus": "pt-can" }
]
}
],
"splices": [{ "id": "S_IGN" }],
"grounds": [{ "id": "G1" }],
"batteries": [{ "id": "BAT", "volts": 12.6, "internalOhms": 0.02 }],
"fuses": [{ "id": "F1", "ratingA": 10, "part": "littelfuse-atof" }],
"switches": [
{
"id": "KEY",
"positions": ["off", "acc", "on", "start"],
"contacts": [{ "name": "ign", "closedIn": ["on", "start"] }],
"initial": "on"
}
],
"wires": [
{ "id": "W1", "from": "X_ENG.1", "to": "X_DASH.1", "gaugeMm2": 0.35, "lengthM": 2.5, "colour": "WH" },
{ "id": "W2", "from": "X_ENG.2", "to": "X_DASH.2", "gaugeMm2": 0.35, "lengthM": 2.5, "colour": "GN" },
{ "id": "W3", "from": "X_ENG.1", "to": "X_GW.1", "gaugeMm2": 0.35, "lengthM": 1.2, "colour": "WH" },
{ "id": "W4", "from": "X_ENG.2", "to": "X_GW.2", "gaugeMm2": 0.35, "lengthM": 1.2, "colour": "GN" },
{ "id": "W10", "from": "BAT.pos", "to": "F1.a", "gaugeMm2": 2.5, "lengthM": 0.3, "colour": "RD" },
{ "id": "W11", "from": "F1.b", "to": "KEY.in", "gaugeMm2": 1.5, "lengthM": 1.0, "colour": "RD" },
{ "id": "W12", "from": "KEY.ign", "to": "S_IGN", "gaugeMm2": 1.5, "lengthM": 0.5, "colour": "RD/WH" },
{ "id": "W13", "from": "S_IGN", "to": "X_ENG.3", "gaugeMm2": 1.0, "lengthM": 1.0, "colour": "RD/WH" },
{ "id": "W14", "from": "S_IGN", "to": "X_DASH.3", "gaugeMm2": 0.75, "lengthM": 2.0, "colour": "RD/WH" },
{ "id": "W20", "from": "G1", "to": "X_ENG.4", "gaugeMm2": 1.5, "lengthM": 0.5, "colour": "BK" },
{ "id": "W21", "from": "G1", "to": "X_DASH.4", "gaugeMm2": 0.75, "lengthM": 1.5, "colour": "BK" }
]
}The harness section of a scene
| Field | What it is |
|---|---|
file or document | The harness file (relative to the scene), or the harness itself inline |
events[] | atMs and one of: fault (a fault, as above), clear (a target whose fault ends) or switch ([switch, position], such as ["KEY", "off"]) |
faultable | Targets a live session may fault |
powerStepNs | Power network step (default 100 µs) |
Opens CAN_H to the dash at 400 ms and restores it at 700 ms:
{
"schemaVersion": "ct.scene/1",
"id": "powertrain-open-can-h",
"machines": [
{ "name": "engine", "board": "nucleo-f767zi", "firmware": "build/engine.elf" },
{ "name": "dash", "board": "nucleo-f767zi", "firmware": "build/dash.elf" },
{ "name": "gw", "board": "nucleo-f767zi", "firmware": "build/gw.elf" }
],
"canBuses": [
{
"name": "pt-can",
"nodes": [
{ "machine": "engine", "controller": "CAN1" },
{ "machine": "dash", "controller": "CAN1" },
{ "machine": "gw", "controller": "CAN1" }
],
"timing": { "nominalBps": 500000 }
}
],
"harness": {
"file": "powertrain.harness.json",
"events": [
{ "atMs": 400, "fault": { "target": "W1", "kind": "open" } },
{ "atMs": 700, "clear": "W1" }
]
},
"until": { "machine": "dash", "marker": "DASH DONE" },
"maxMs": 1700
}ct harness show powertrain.harness.json
ct harness fault powertrain.scene.json --target W3 --kind short-to-ground --at-ms 900
ct scene run powertrain.scene.jsonLIN buses: linBuses
linBuses joins UARTs of several machines on a LIN bus: break, sync, identifier, data and checksum on one wire, each node optionally through a LIN transceiver twin.
| Field | What it is |
|---|---|
name | Unique among the scene’s LIN buses |
baudBps | 1,000 to 20,000 bit/s |
nodes[] | 2 to 16 nodes: machine, uart (USART2), master (at most one; it labels the report, the firmware decides what it sends), transceiver (tja1021; absent: an ideal transceiver always in normal mode) and slpPin (the pin wired to the transceiver’s SLP_N; needs a transceiver) |
{
"schemaVersion": "ct.scene/1",
"id": "body-lin",
"machines": [
{ "name": "bcm", "board": "nucleo-f767zi", "firmware": "build/linmaster.elf" },
{ "name": "door", "board": "nucleo-f767zi", "firmware": "build/linslave.elf" }
],
"linBuses": [
{
"name": "lin0",
"baudBps": 19200,
"nodes": [
{ "machine": "bcm", "uart": "USART2", "master": true, "transceiver": "tja1021" },
{ "machine": "door", "uart": "USART2", "transceiver": "tja1021" }
]
}
],
"until": { "machine": "door", "marker": "LINS DONE" },
"maxMs": 400
}All nodes receive full frames (break, sync, ID, data, checksum) within LIN baud tolerance. Reports log bytes, breaks, collisions, lost bytes, wake-ups, TXD timeouts and decoded frames with sync/checksum errors.
Road vehicle: vehicle
Adds a firmware-driven road vehicle (requires a world): driver controls come from live sessions or inputs, state feeds machines via outputs, and MCU pins drive traction motor, brake valves and lamps.
| Field | What it is |
|---|---|
vehicle | The vehicle’s ct.vehicle/1 document, inline (required): mass, geometry, tyres, brakes, drivetrain |
road | base surface (dry, wet, snow, ice) and patches[] (xMinM, xMaxM, yMinM, yMaxM, surface; the first patch that holds a point wins). Required |
start | xM, yM, headingRad, speedMps (default all 0) |
inputs[] | A drive cycle: tNs, port, value. Ports: driver.key (0 off, 1 accessory, 2 on, 3 start), driver.throttle and driver.brake (0 to 1), driver.steering_rad (positive to the left), driver.gear (0 park, 1 reverse, 2 neutral, 3 drive). Up to 20,000 |
outputs[] | Up to 64: quantity, then pin (<machine>.<pin>, as volts) or device (<machine>.<instance>) with port; scale (required), offset, samplePeriodNs (default 1 ms), note |
motor | The drive motor: an esc_motor on a machine’s pins, turning the drive shaft |
brakeValves[] | wheel (FL, FR, RL, RR) and pin: the pin’s duty cycle dumps that wheel’s brake pressure |
lamps[] | name, pin, activeHigh (default true) |
stepNs, traceNs | Vehicle step (default 1 ms) and report trace period (default 100 ms) |
Output quantities: ignition_acc, ignition_on, ignition_start, accelerator_position, brake_position, brake_switch, gear_selector, steering_wheel_angle_rad, rack_position_m, wheel_speed_fl_rad_s (and _fr_, _rl_, _rr_), vehicle_speed_mps, yaw_rate_rps, accel_long_mps2, accel_lat_mps2, brake_pressure_front_pa, brake_pressure_rear_pa, motor_speed_rpm, motor_current_a, motor_torque_nm.
The report’s vehicle section traces pose, velocity, acceleration, wheel speeds, brake pressures, tyre loads and slip, steering, the motor and the driver controls.
Flight: flight
Adds a fixed-wing aircraft (ailerons/elevator/rudder or elevons + propeller). Firmware pins drive servos and ESC; motion feeds sensor twins. Use ct world compile on an imported CAD aircraft to auto-populate mass, hinges and sensor positions.
| Field | Required | What it is |
|---|---|---|
vehicle | yes | The aircraft’s ct.flight-vehicle/1 document, inline: mass, inertia, geometry and the aerodynamic coefficients |
gravityMps2 | yes | Gravity, m/s² |
initial | yes | kind trim (airspeedMps, heightM, gammaRad, headingRad), state (positionNedM, eulerRad, velocityBodyMps, rateBodyRps, held) or on_runway (pitchRad, headingRad; needs a runway) |
stepNs, traceNs | no | Flight step (default 1 ms) and report trace period (default 50 ms, a multiple of the step) |
seed | no | Seed of the gusts and the sensor noise (default 0) |
atmosphere | no | baseAltitudeM, seaLevelPressurePa (default 101325), seaLevelTemperatureC (default 15) |
location | no | latitudeDeg, longitudeDeg, heightM, decimalYear: for GNSS and the Earth’s magnetic field |
runway | no | heightM. Absent: free flight. |
gust | no | Dryden gusts: airspeedMps, lengthM and sigmaMps (three values each), source |
inputs[] | no | tNs, port, value: wind.ned_mps (a north, east, down vector) or launch.speed_mps (releases a held aircraft at that speed) |
actuators[] | no | Up to 16: motor, inertiaKgm2, axisCad (a unit vector), limitsRad |
sensors[] | no | Up to 64: device (<machine>.<instance>), port, quantity, positionMm, axisCad (vector quantities only), samplePeriodNs (a multiple of the step), noise (sigma, source), rawTransfer (scale, offset, source, for a port that takes raw codes only) |
faults[] | no | Up to 16: atNs and kind, an object: freeze_sensor (device: its inputs stop changing) or stuck_actuator (actuator: the hinge holds where it is) |
A motor has a name, the joint it turns (a control-surface hinge or the propeller shaft of the vehicle), rotorInertiaKgm2 and a model. An aircraft takes two models:
servo:signal(<machine>.<pin>),pulseMinS,pulseMaxS,angleMinRad,angleMaxRad,deadbandS,speedRadPerS,stallTorqueNm,bandRad,signalTimeoutS,initialRadesc_motor:signal,pulseMinS,pulseMaxS,signalTimeoutS,supplyV,keVSPerRad,windingOhms,noLoadCurrentA,spinSignandpropeller(diameterM,ctTableandcpTableas[rpm, value]pairs,thrustSign, and optionalctJTable,cpJTableagainst the advance ratio)
Sensor quantities: specific_force, angular_rate, magnetic_field (along axisCad), static_pressure, air_temperature, dynamic_pressure, latitude_deg, longitude_deg, height_m, ground_speed_mps, course_deg.
Flying wing held 8 s, hand-launched at 14 m/s, barometer frozen at 20 s, left elevon jammed at 30 s (wing.board.json carries MPU-6050 imu and BMP388 baro on I2C1; vehicle omitted for brevity):
{
"schemaVersion": "ct.scene/1",
"id": "wing-hand-launch",
"quantumNs": 1000000,
"machines": [{ "name": "fc", "board": "wing.board.json", "firmware": "build/fc-wing.elf" }],
"flight": {
"vehicle": { … },
"stepNs": 1000000,
"traceNs": 50000000,
"seed": 1,
"gravityMps2": 9.80665,
"atmosphere": { "baseAltitudeM": 0, "seaLevelPressurePa": 101325, "seaLevelTemperatureC": 15 },
"location": { "latitudeDeg": 51.5, "longitudeDeg": 0.0, "heightM": 0.0, "decimalYear": 2026.86 },
"runway": { "heightM": 0 },
"initial": {
"kind": "state",
"positionNedM": [0, 0, -1.5],
"eulerRad": [0, 0, 0],
"velocityBodyMps": [0, 0, 0],
"held": true
},
"inputs": [
{ "tNs": 0, "port": "wind.ned_mps", "value": [-1.5, 1.5, 0] },
{ "tNs": 8000000000, "port": "launch.speed_mps", "value": 14.0 }
],
"actuators": [
{
"motor": {
"name": "elevon-left",
"joint": "HingeElevonLeft",
"model": {
"kind": "servo", "signal": "fc.PD12",
"pulseMinS": 0.001, "pulseMaxS": 0.002,
"angleMinRad": -0.4363, "angleMaxRad": 0.4363,
"deadbandS": 0.00001, "speedRadPerS": 10.47, "stallTorqueNm": 0.1765,
"bandRad": 0.0873, "signalTimeoutS": 0.1
}
},
"inertiaKgm2": 0.0000365,
"axisCad": [-0.3175295, 0.9482484, 0],
"limitsRad": [-0.4363, 0.4363]
},
{
"motor": {
"name": "elevon-right",
"joint": "HingeElevonRight",
"model": {
"kind": "servo", "signal": "fc.PD13",
"pulseMinS": 0.001, "pulseMaxS": 0.002,
"angleMinRad": -0.4363, "angleMaxRad": 0.4363,
"deadbandS": 0.00001, "speedRadPerS": 10.47, "stallTorqueNm": 0.1765,
"bandRad": 0.0873, "signalTimeoutS": 0.1
}
},
"inertiaKgm2": 0.0000365,
"axisCad": [-0.3175295, -0.9482484, 0],
"limitsRad": [-0.4363, 0.4363]
},
{
"motor": {
"name": "esc",
"joint": "PropShaft",
"model": {
"kind": "esc_motor", "signal": "fc.PA0",
"pulseMinS": 0.001, "pulseMaxS": 0.002, "signalTimeoutS": 0.1,
"supplyV": 11.1, "keVSPerRad": 0.01038, "windingOhms": 0.142,
"noLoadCurrentA": 0.5, "spinSign": 1.0,
"propeller": {
"diameterM": 0.2286,
"ctTable": [[2333, 0.1096], [4667, 0.1142], [6717, 0.1169]],
"cpTable": [[2333, 0.0541], [4667, 0.0515], [6717, 0.0516]],
"thrustSign": -1.0
}
}
},
"inertiaKgm2": 0.000055,
"axisCad": [-1, 0, 0]
}
],
"sensors": [
{ "device": "fc.imu", "port": "acceleration.x.accel_xout", "quantity": "specific_force",
"positionMm": [-132, 0, 1.6], "axisCad": [1, 0, 0], "samplePeriodNs": 2000000 },
{ "device": "fc.imu", "port": "acceleration.y.accel_yout", "quantity": "specific_force",
"positionMm": [-132, 0, 1.6], "axisCad": [0, 1, 0], "samplePeriodNs": 2000000 },
{ "device": "fc.imu", "port": "acceleration.z.accel_zout", "quantity": "specific_force",
"positionMm": [-132, 0, 1.6], "axisCad": [0, 0, 1], "samplePeriodNs": 2000000 },
{ "device": "fc.imu", "port": "angular_rate.x.gyro_xout", "quantity": "angular_rate",
"positionMm": [-132, 0, 1.6], "axisCad": [1, 0, 0], "samplePeriodNs": 2000000,
"noise": { "sigma": 0.00087, "source": "MPU-6050 datasheet: gyro total RMS noise 0.05 deg/s" } },
{ "device": "fc.imu", "port": "angular_rate.y.gyro_yout", "quantity": "angular_rate",
"positionMm": [-132, 0, 1.6], "axisCad": [0, 1, 0], "samplePeriodNs": 2000000 },
{ "device": "fc.imu", "port": "angular_rate.z.gyro_zout", "quantity": "angular_rate",
"positionMm": [-132, 0, 1.6], "axisCad": [0, 0, 1], "samplePeriodNs": 2000000 },
{ "device": "fc.baro", "port": "pressure.press", "quantity": "static_pressure",
"positionMm": [-140, 8, 1.6], "samplePeriodNs": 10000000 },
{ "device": "fc.baro", "port": "temperature.temp", "quantity": "air_temperature",
"positionMm": [-140, 8, 1.6], "samplePeriodNs": 100000000 }
],
"faults": [
{ "atNs": 20000000000, "kind": { "kind": "freeze_sensor", "device": "fc.baro" } },
{ "atNs": 30000000000, "kind": { "kind": "stuck_actuator", "actuator": "elevon-left" } }
]
},
"until": { "machine": "fc", "marker": "FC MISSION DONE" },
"maxMs": 240000
}The report’s flight section holds the aircraft’s true trace (position, velocity, attitude, rates, airspeed, control deflections, thrust), the actuator values and commands, and the faults as they were applied.