Diokle docs GitHub Open the workbench

Diokle

Diokle is a free, open-source tool for simulating physical systems: engines, circuits, vehicles, hydraulics and control loops. You describe a system in Modelica, a language that builds a model from parts and the connections between them. Diokle runs the model on the command line, on a server or in a browser tab, with a Dymola-style workbench, the Modelica Standard Library 4.1.0, 3-D animation, sensitivity and calibration, FMI export and CasADi optimal control.

Diokle is built on the Daedalus codebase. The daedalus command, the Python daedalus package, the Daedalus Modelica library and this repository keep their Daedalus names.

The workbench after simulating TorqueConverter.Launch: two cars launch side by side, one with a static K-factor converter and one with fluid torque build-up

The workbench runs entirely in your browser. The compiler and solvers are compiled to WebAssembly and run in a Web Worker, so there is nothing to install and nothing is sent to a server. Pick a model in the package browser, press Simulate, then plot any variable or watch the 3-D animation.

Features

Linear analysis NewBode and Nyquist plots, step and impulse responses, poles and zeros, simpler model versions and an LQR controller, all from the model's exact linear approximation. Live plots and dashboards NewResults appear while the model runs. Sliders change parameters mid-run. Also: grids of plots, expressions, FFT and statistics. Equation and init debugger NewSee how any variable is computed, from the original equation to the form the solver uses, and why initialization fails. Unit checking NewEvery equation is checked for consistent units. Undeclared variables get units inferred for them, and imperial units can be shown. Text editor NewJump to a definition, autocomplete names, see hover information, find every use of a name and rename it safely. Libraries and packages NewInstall libraries such as Buildings and OpenIPSL by name, pack models into a zip, compare versions and import parameter tables. FMI and SSP NewExport FMUs (FMI 2.0 and 3.0) to use in other tools, import FMUs made elsewhere as components, and run SSP systems. Sensitivity, DOE and calibration NewFast sensitivities for many parameters at once, experiment designs with response-surface fits, Sobol indices and fitting a model to measured data. Embedded C and HIL NewControllers as plain C with no dependencies, for Arduino and ESP32. Test them in software or on hardware, and tune PID gains automatically. Scientific machine learning NewNeural networks that stand in for parts of a model, and finding missing equations in data with sparse regression (SINDy). Built on the Python API. Modelica Standard Library NewMSL 4.1.0 runs in the browser, including its external C functions and exact lookup tables. 488 of its 534 examples match the reference. State machines NewModelica state machines with transitions, nested states, parallel machines and clocks, running natively and in the browser. Browser workbenchPackage browser, icon, diagram, text and documentation views, a variable browser, and plots in the units you choose. Structure and state selectionSee how the equations are grouped, why each state was picked and how stiff the model is. You can choose different states without editing the model. SolversSeveral time-stepping methods, including one that switches automatically between a fast method and a stiff one. You also get a hint when another method would work better. Experiments and sweepsEvery run is kept for overlays and comparisons. Parameter sweeps run in parallel, and each link reopens its run. Performance analyzerShows the step sizes, the states that slow the run down, the time spent in each algebraic loop, the event log, and any chattering. Graphical editingDrag components onto the diagram, connect them, rotate them and set their parameters. The source keeps its comments and layout. AI assistant and MCPAsk the workbench assistant, or Claude Code via MCP, to build, check, simulate and explain models. 3-D animationReplays MultiBody results and every example in 3-D, with camera presets, chase cameras and video recording. Multibody vehiclesDouble-wishbone, pushrod, multilink and MacPherson suspensions, K&C and seven-post rigs, and a full car. Accuracy scoreboardEach MSL example compared with the reference results, signal by signal and package by package. Python APIimport daedalus loads a model, sets parameters, simulates into NumPy arrays, linearizes it and exports FMUs, all inside your Python program. .mos scripts and trimRun the regression scripts from Dymola and OpenModelica, and find steady states with exact derivatives. Example libraryTorque converters, landing gear, an aileron actuator, a hydraulic quarter car and EV efficiency, rebuilt from engineering blog posts. LinearizationThe exact A, B, C and D matrices of a model at any time, as text, JSON or an OpenModelica-style linearized_model. Optimal controlFastest moves, model predictive control (MPC) and moving horizon estimation, built with CasADi straight from Modelica models.

Under the hood

Before any numerical solving, Diokle does the same symbolic work as the commercial tools:

  • It removes duplicate variables (alias elimination), handles equations that constrain each other (Pantelides index reduction with dummy derivatives), sorts the equations into the order they must be solved (BLT sorting and tearing), and derives exact Jacobians symbolically. A Jacobian holds how each equation changes with each variable.
  • It compiles the model into a short register program that runs the same way natively and in WebAssembly.
  • It offers several time-stepping methods: variable-order BDF, Radau IIA and ESDIRK for stiff models, Dopri5 with automatic switching to BDF when the model turns stiff, and RK4 and Euler for simple cases. It also handles events, such as a zero crossing, a when clause and reinit.
  • Results are saved as Dymola-format .mat files, which Dymola, OMEdit and DyMat can read, or as CSV.

It scales close to linearly. A chain of 10,000 masses (130,000 unknowns after alias elimination) translates in 2.5 s and simulates one second of time in 3.9 s. See Architecture for how each stage works.

Where to go next

Diokle is under active development. Modelica is a registered trademark of the Modelica Association; Diokle is not affiliated with or endorsed by it.

Edit this page on GitHub