@embedded32/sim
v1.0.1
Published
Vehicle and multi-ECU simulation for Embedded32 learning labs
Maintainers
Readme
@embedded32/sim
Multi-ECU J1939 vehicle simulation for Embedded32 - engine, transmission, brakes, aftertreatment, and profile-based SimulationRunner for classroom labs.
Installation
npm install @embedded32/sim @embedded32/can @embedded32/j1939 @embedded32/coreMinimum runnable example
CLI (no code): from monorepo root after npm run build:
npx embedded32-tools simulate vehicle/basic-truckProgrammatic:
import { SimulationRunner } from '@embedded32/sim';
const runner = new SimulationRunner();
await runner.loadProfile('vehicle/basic-truck');
await runner.start();
// decoded traffic via tools or your CAN hooks
await runner.stop();Public API overview
| Export | Role |
| --------------------------------------------------- | -------------------------------------- |
| SimulationRunner | Load profile, start/stop multi-ECU sim |
| VehicleSimulator | Higher-level vehicle with scenarios |
| EngineSimulator, TransmissionSimulator, … | Individual ECU actors |
| EngineECU, TransmissionECU, DiagnosticToolECU | Profile-oriented ECU classes |
| DeterministicScheduler | Repeatable tick timing for tests |
Runtime requirements
- Node.js 18+
- Built dependencies:
@embedded32/can,@embedded32/j1939,@embedded32/core
Hardware requirements
None - simulation uses virtual/mock CAN. Optional SocketCAN only if you bridge sim output to vcan0.
Browser compatibility
Node.js only in v1.0. The site browser demo at /demo plays prerecorded synthetic traces.
Common errors
| Error | Fix |
| ----------------- | -------------------------------------------------- |
| Profile not found | Use vehicle/basic-truck exactly |
| No traffic | Ensure runner.start() and wait for tick interval |
| Import errors | npm run build at monorepo root |
Related packages
@embedded32/tools-embedded32-tools simulatecommand@embedded32/j1939- decode simulated PGNs@embedded32/can- virtual bus attachment
Version compatibility
Keep @embedded32/[email protected] aligned with j1939 and can 1.0.0.
License
MIT © Mukesh Mani Tripathi
