carsim-guide
VerifiedOperate and automate CarSim simulations from an agent, including safe output and parameter discovery, named Run Control execution contexts, structured overrides, isolated batch sweeps, dataset dependency inspection, control-mode selection, result validation, diagnostics, and version-aware CLI/Simulink/VS API routing. Use for executing, configuring, exploring, or debugging CarSim. Do not use for vehicle-dynamics theory alone, generic dataframe work, or unrelated simulators.
references/scenarios.md
View on GitHub# Generic scenarios (YAML → compile → run → manifest)
A generic scenario describes one ordinary CarSim run: base, timing, road
friction, maneuver profiles, vehicle parameters, extra scalar overrides and
requested output channels. Every registered channel, including tire forces,
is a legal output.
## Define
Start from an example in `examples/scenarios/` (bind the base name first —
see below). Full contract: `schemas/scenario.schema.json`.
```yaml
schema_version: 1
scenario:
id: double_lane_change_mu08 # also the output directory name
base:
name: distributed_ev # resolved via the base registry, never "newest"
simulation:
dt: 0.001 # default 0.001 s; any value with integral steps
duration: 30.0 # seconds
road:
friction: 0.8 # uniform MU_ROAD_CARPET override
maneuver:
speed_kmh: [[0.0, 50.0], [30.0, 50.0]] # closed-loop target table
steering_deg: [[0.0, 0.0], [5.0, 20.0], [6.0, -20.0], [30.0, 0.0]] # open-loop SW angle
vehicle: # typed VehicleOverrides fields (SI)
sprung_mass_kg: 1250.0
parameters: [] # ScalarOverride list: [{keyword: M_SU, value: 1250.0}]
outputs:
channels: [Vx, Vy, AVz, Fx_L1, Fy_L1] # exact CSV names; Time is automatic
validation:
minimum_speed_mps: 1.0 # optional movement acceptance
```
Semantic rules enforced by `scenario_schema.validate_scenario`: dt/duration
positive, finite, integral step count (dt is a default, not a hard limit);
maneuver times start at 0, strictly increase, stay within duration; outputs
must be registered channel names (unknown units fail closed); scalar override
keywords are upper-case tokens with finite values and may not duplicate a
typed vehicle field or touch protected run keywords (TSTEP, TSTOP, ...).
## Bind the base once
```bash
python scripts/base_registry.py --registry bases.local.json --name distributed_ev \
--base "C:/work/Run_all.par" --version 2024.0 --run-control "<id>" --vehicle "<name>"
```
Resolving re-verifies the SHA256 on every run; a changed base fails instead of
silently switching vehicles.
## Compile and run
```bash
python scripts/scenario_runner.py examples/scenarios/basic_cruise.yaml \
--registry bases.local.json --out runs # compile only
python scripts/scenario_runner.py ... --out runs --run # + solver + validation
```
Compile writes the scenario directory (`base_Run_all.par` snapshot,
`override.par`, `simfile.sim`) and runs compile-time checks: TSTEP equals
EXT_MODEL_STEP, 64-bit DLLFILE pinned, PRODUCT_VER matches the pinned base
version, WRT list non-empty, base hash unchanged. `--run` then calls the
solver, validates the results (see run-validation.md) and finalizes
`run_manifest.json`.
## Artifacts
One directory per scenario: `run_manifest.json`, `base_Run_all.par`,
`override.par`, `simfile.sim`, then after `--run`: `run.csv` (native CarSim
units, 1 kHz), `run_echo.par`, `run_log.txt`, `solver_stdout.txt`. The
manifest records run status/timestamps, CarSim version + solver/DLL hashes,
base name + SHA256, the exact scenario config, artifact paths and input/output
hashes. `input_sha256["scenario.yaml"]` is the portable hash of the saved
scenario snapshot. Absolute PROG, DATADIR, solver, DLL, base, and artifact
paths record machine provenance; they are not portable identity.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |