A block-diagram simulation workbench; open source, agent-drivable, built in pure Rust.
Typed signals, algebraic-loop detection, adaptive solvers — with a
MatCraft session underneath, the way Simulink interlocks with MATLAB.
macOS · Windows · Linux · the web
pendulum.simcraft run headless — the angle_scope figure is a real matplot figure, produced by the same pipeline as MatCraft's.
Quick start · Highlights · Why · MatCraft · Inside · What's next · FAQ · Siblings · License
SimCraft follows the conventions of the ArtCraft family of clean-room Rust apps. Come say hello, get help and follow development:
- Source: github.com/NibrasAz7/simcraft
- The workspace it lives in: github.com/NibrasAz7/matcraft
cargo run -p simcraft-cli -- run examples/pendulum.simcraft # simulate a model headless
# ran 10000 steps (rk4, dt=0.001) · angle_scope: 10001 samples over [0, 10]
cargo run -p simcraft-cli -- control 7979 # JSON-lines TCP channel
cargo run -p simcraft-cli -- mcp # MCP server on stdio
cargo run -p simcraft-studio # the diagram editor|
Typed directed graphs, continuous + discrete states, fixed-step |
One linked M-code session is the model's compute context: callbacks, parameter sweeps, From/To Workspace — |
Every UI action is a command id reachable from the headless CLI, the TCP control channel and MCP — automation-first, no account, no telemetry. |
There is no open-source Simulink-class tool. Octave covers the language side (GPL); the modeling/simulation side has nothing a student or indie developer can reach without a MathWorks license. SimCraft fills that gap — a dynamic-systems modeler with the same MIT/Apache licensing, the same automation-first design, and the same "everything is a command" architecture as its sibling apps.
Status: cargo test green — simcore graph/solver, 25 blocks, .simcraft JSON models, engine + MCP + Studio. Honest scope: Simulink-compatible-in-spirit block-diagram simulation for teaching and indie control work — pendulums, control loops, filters, discrete controllers — not a certified code-generation tool (see the FAQ). Not first-release goals: full Simulink parity, state machines, masked libraries, code generation, hardware-in-the-loop.
Simulink is useful because MATLAB can drive it; SimCraft is designed the same way. One linked MatCraft session is the model's compute context.
out = sim('pendulum.simcraft') % run, get logged outputs
set_param('pendulum/Integrator', 'x0', 0.2) % set a block parameter
g = get_param('pendulum/Gain', 'K') % read a parameter
add_block('simcraft/Sources/Sine', 'pendulum/w1') % edit the model
add_line('pendulum', 'w1/1', 'Gain/1') % wire itsim returns a struct: out.t (time vector), out.y/out.scope1 (logged signals), out.x (final states), out.stoptime, out.stats. Sinks can also write values straight into the workspace.
| Concern | Shared from |
|---|---|
| Matrices, linalg | matcore (Matrix, CMatrix, SparseMat) |
| Values, M-code | matlang (Session, Value) |
| Scopes, plots | matplot (a Scope block is a streaming Figure) |
| Command registry | engine conventions (sim.run, model.set_param, …) |
| Automation | mcp protocol + TCP control channel, same JSON-lines framing |
| File exchange | .mat v5 (load/save for logged data), .simcraft model files |
| UI chrome | ui-egui patterns: docked panes, ribbon, control server, themes |
simcore (L1) graph, ports, solver, scheduler — pure Rust, no egui
simblocks (L2) the block library (built on simcore traits)
simmodel (L2) .simcraft file format, load/save/validate
engine (L5) command registry: sim.run, model.*, block.*, wire.*, scope.*
ui-egui (L6) diagram canvas, palette, scope panes, console (matlang)
mcp (L6) MCP server for agents
apps/simcraft desktop Studio (eframe)
apps/simcraft-cli headless run/export: simcraft run model.simcraft
- simcore — typed ports (
double,complex, integer widths,bool), topological execution each step, algebraic-loop detection (error or Newton iterate), flatxvector owned by the solver, multirateTsscheduling, zero-crossing bracketing. .simcraftformat — UTF-8 JSON, diff-friendly; blocks keyed by hierarchical path, wires as{src, dst}port pairs, solver/settings/callbacks inline;model.checkreports unreachable blocks, unconnected ports, width/rate mismatches.- The block library (~25) — step, ramp, sine, constant, clock · scope, to-workspace · gain, sum, product, abs, saturation, dead-zone, switch · relational and logical operators · integrator, derivative, transfer-fcn, PID, transport-delay · unit-delay, zero-order-hold · mux, demux.
- Studio — family chrome (ribbon, docks): palette left, hit-tested canvas center, inspector right, MatCraft console bottom; scopes pop out as matplot figure tabs.
ROADMAP.md tracks milestones — multirate/zero-crossing rigor, subsystems, M-function blocks, WASM, stiff solvers (ode15s-style BDF), S-function API.
Is SimCraft a certified code-generation tool?
No — and it doesn't need to be. Simulink's moat is its pre-qualified code-generation toolchains (ISO 26262, DO-178C); replicating that certification is out of scope for an open-source project. But a free .slx-compatible editor and simulator needs no certification at all: you design and simulate in SimCraft, then open the model in Simulink for the certified codegen step. The missing free tool was never the codegen — it is the modeling and simulation in front of it. .slx import/export is a long-term aspiration; the native format is diff-friendly .simcraft JSON.
SimCraft is built in the ArtCraft tradition — original, clean-room, Rust-native. It runs inside MatCraft, its numerical-computing sibling.
MIT OR Apache-2.0. Clean-room: public Simulink documentation and published solver literature only; no MathWorks code, assets, icons, file formats, or observed-behaviour capture from MathWorks software. Block names and documented semantics are public knowledge; every implementation here is our own. Non-code assets are tracked in ASSETS.md.