Diokle docs GitHub Open the workbench

What's new

The most recent additions, newest first. Each links to the page that covers it in full. In plain terms: every entry is a feature or a fix that is now in Diokle, and the link leads to the page that explains it.

Energy ledger

diokle ledger checks that the stored energy of a run changes by the power supplied minus the power dissipated. It reports whether the balance closes, creates energy or loses energy through an unlogged term. The user names the storage, supply and dissipation variables, so the check is only as good as those terms. See Energy ledger.

Validated enclosures (prototype)

The validated module encloses a simulation over a box of initial states and parameters: the result is an interval that must contain the exact end state. Three schemes are in: Euler, a mean-value form and affine arithmetic, which is the narrowest on the test oscillator. It is a library prototype. See Validated enclosures.

Explain a value

diokle explain ranks the parameters by their contribution to an output at a given time, from the local sensitivities, and checks the prediction against a run with all changes applied. See Explaining a value.

Behaviour diff between two model versions

diokle behavior-diff runs two versions of a model and reports, for each output, the largest difference between the two trajectories, when it happens, and the first time it leaves the tolerance. It shows whether a source change moved the behaviour, and where. See Behaviour diff.

Identifiability of parameters

The identifiability module turns the sensitivities of an experiment into the Fisher information, standard errors of the parameters and the pairs that cannot be told apart from the data. It is a library function for now. See Identifiability.

Instant surrogates with a held-out error

The surrogate module fits a quadratic response surface to the points of a sweep or design and reports its root-mean-square error on held-out points. Predictions outside the sampled box are refused, and a prediction whose error is above a set limit is refused too. It is a library function for now. See Instant surrogates.

Since v0.2.0: the Diokle name, editors and a faster translator

Everything below shipped after the 0.2.0 release. The 0.2.0 notes are in the release on GitHub.

The Diokle name

DAEdalus is now Diokle in the workbench, the documentation, the diokle command, the Python diokle package and the Diokle Modelica library. Scripts that call daedalus or import daedalus need the new name (see Command line and Python API).

Editors: language server and VS Code

diokle lsp is a Modelica language server for any editor that speaks the protocol. It gives diagnostics, go to definition, find references, rename, completion, hover, the document outline and formatting, and it finds the libraries that a model names in uses(...). The VS Code extension in editors/vscode runs it, is tested in CI and is built as a .vsix on each release. See Text editor.

Formatting, reports and lint on the command line

  • diokle fmt lays out Modelica source: indentation and line breaks change, the tokens do not. --write rewrites files and --check lists the files that would change. The workbench formats the open class on Ctrl+S. See Formatting.
  • diokle lint checks model quality for CI, with rules for documentation, descriptions, units, experiments and unconnected components. --format github writes GitHub annotations. See Model checks.
  • diokle report simulates a model and writes report.md, with solver statistics, warnings and one SVG plot per group of curves, each plot with one unit.
  • diokle doc writes Markdown reference pages for each class. See Reference pages.
  • test-library --junit writes a JUnit report, and --baseline fails the run when a model that passed in the baseline stops passing. See Testing a whole library.
  • diokle textconv puts a .mo file in a form that git diff can compare statement by statement. See Reviewing Modelica changes.

Diagram and workbench

  • Create block (Ctrl+Shift+B) moves the selected components into a new block in the same package.
  • Paste a class path, such as Diokle.Blocks.Sources.Constant, anywhere outside a text field to open that class.
  • Connections that go right or straight down take an elbow route, and connectors on icon-less boxes are drawn where they are placed.
  • Unit issues show in the inspector, and plots and unit messages write derivative units in canonical form. See Graphical editing and Unit checking.
  • Source control in the workbench stages, unstages, commits and switches branches through the local engine. See Speed and the local engine.
  • Run on server sends a model too big for a browser tab to the hosted engine, which returns the .mat or CSV file. It needs sign-in, and it is off unless the site is built with VITE_RUN_ON_SERVER=1.

Singular models, initialization and restarts

Libraries: versions and conversions

Libraries named in uses(...) are checked for the versions installed, and the index of published versions can be refreshed with diokle lib index --update. Conversion scripts are run with diokle lib convert. See Versions and upgrades.

Python and Dymola results

The Python package has an OMPython-style session, and its tests read two Dymola-written .mat result files and check FMU interop with pyFMI. See Python API.

Events and solvers

  • A relation that crosses its neutral point no longer starts a storm of events, so clutches, brakes and tank overflows stop chattering.
  • A later elsewhen branch fires while an earlier condition stays true. This fixed the Standard Library's SoftStarter example.
  • A loop that fails to solve is retried with damped Newton steps, and the error names its worst residual.
  • Causalisation checks linearity only in the unknowns that occur, which makes translation faster on large models.

Documentation

Library reference pages show their figures and formulas, and math renders wherever the documentation appears. The Modelica Standard Library loads in the browser from its own data, as described in Modelica Standard Library.

Beta terms and privacy

The beta has published terms of use and a privacy notice. Both are beta texts, and a lawyer will review them before the paid launch.

Requirements as signals

diokle falsify checks a signal temporal logic requirement, such as always[0,1](x >= 0.5), over a parameter box and reports the run that breaks it, with its parameter values. A negative robustness means the run falsifies the requirement. The search is random sampling, so a run not found does not prove the requirement holds. See Requirements as signals.

Start from a previous result or a steady state

A run can now begin where an earlier one ended, with its states: diokle simulate --restart FILE takes the states from a saved result, at its last time or at --restart-at T. --steady-start begins at the model's equilibrium. A parameter that is fixed at translation, such as fixed = k > 0, is translated again when you override it with -p. The workbench has the same two options in its setup menu: Continue from the last run and Start from the steady state. See Starting from a previous result or a steady state and Workbench.

Fault injection and FMEA tables

The fault module runs each fault at each operating point and classifies its effect as none, degraded or failed, by how far the outputs move from the nominal run. The result is an FMEA table in Markdown. It is a library function for now. See Fault injection and FMEA.

Library versions, the published index and conversion scripts

The Libraries dialog and diokle lib now read the conversion annotation of a library: noneFromVersion needs no change, and from(version, script) names a conversion script. A missing library or a uses conflict comes with what to do: the index version to install, and the conversion that applies. The index is also fetched from the repository when the page loads (diokle lib index --update in the CLI), so a newer library version needs no release. Several versions of a library can be installed; one is loaded per visit, the one marked In use. diokle lib convert lists the conversion for a model's version, and --run runs its script. See Libraries.

MSL: 513 of 534 examples match the reference results

Up from 488, then 510 after round 2 and 512 after the elsewhen fix, then 513 after the Newton damping fix for multi-tear blocks (a later elsewhen branch fires while an earlier condition stays true). Round 2 fixes: state selection that switches when a state set becomes ill-conditioned, index reduction for integer linear constraints, BDF order promotion only after events, and the blocks, mechanics and electronics fixes (see the commit history). Earlier fixes span the whole library:

  • Events: one event iteration solves the relations together with the equations they switch, at fixed pre(), after the when-clauses fire; relations inside their hysteresis band keep their value, and cycling modes are resolved by a mode search. This ends the chattering of stuck clutches, brakes, lossy gears, bearing friction and tank overflows.
  • Solvers: each state's absolute tolerance is tolerance * |nominal|; a Newton solve that stalls on a fold of a piecewise-linear characteristic searches for a sign change; BDF no longer fails on a first step below the time resolution.
  • State selection: reinit(x, ...) makes x a state (stateSelect = always), alias classes keep the declared stateSelect of their members, and stateSelect = prefer wins over default choices (machine currents, spring-damper states).
  • Language: final modifiers from outer modifications, redeclared records and model modifiers, constraining-clause modifiers, functions nested in functions, records built from arrays of records, event clocks that tick at initialization, run-time index slices in algorithms, and minimum-norm least squares (dgelsy).

See the scoreboard and Modelica Standard Library.

Embedded C code and processor in the loop

diokle codegen-c turns a controller block into portable, allocation-free C99 that steps it at a fixed rate, and diokle hil closes the loop between that code and a plant simulated by Diokle: on your computer, on an Arduino Uno emulated in simavr, on an ESP32 emulated in QEMU, or on a real board over its serial port. CI runs the whole ladder on every change. diokle autotune tunes the controller's gains on the closed loop against a step-response specification first. See Embedded C and processor in the loop.

Scientific machine learning

diokle.sciml finds the physics a model is missing from measured data, turns it into a formula by sparse regression, and learns neural surrogates that export back to Modelica (and from there to embedded C), in NumPy only. See Scientific machine learning.

Linear analysis

diokle linear-analysis and the Linear tab: poles and zeros, Bode and Nyquist plots with margins, step and impulse responses, PID suggestions, balanced truncation and LQR, straight from a Modelica model. See Linear analysis.

Live plots and dashboards

Results stream into the plot while a simulation runs. Dashboards of sliders, gauges and mini plots change parameters mid-run without restarting. Plots gain matrix layouts, expressions, FFTs, statistics and a plot strip under the diagram. See Live plots and dashboards.

Equation and initialization debugger

diokle debug and the Structure tab's Transformation chain and Initialization cards show how a variable is computed and why initialization fails. They find the smallest under- or over-determined set of equations and the components left unconnected. See Equation and initialization debugger.

Unit checking and display units

Every equation's units are checked and missing units are inferred, with no false alarms on the MSL examples. Plots can show any axis in any compatible unit, or switch to Imperial. See Unit checking.

Text editor with go-to-definition, completion and rename

The Text view now uses the compiler's own name lookup: F12 to go to a definition, Shift+F12 for usages, F2 to rename, completion, hover and an outline. See Text editor.

Libraries, packages, diff and parameter data

diokle lib installs open libraries such as Buildings, ThermoSysPro and OpenIPSL by name and checks uses versions. package zips a model with its resources, diff compares classes structurally (with a diagram view in the workbench), and params-from turns CSV or SSV parameter data into modifiers with unit conversion. See Libraries and packages.

FMI 3.0 export, FMU and SSP import

diokle fmu --fmi-version 3 exports FMI 3.0 with exact directional derivatives. FMUs from other tools, FMI 2.0 or 3.0, simulate on their own or as components of a Modelica model, and SSP systems run, import and export. See FMI and SSP.

Adjoint gradients and design of experiments

sensitivity --adjoint gives the gradient of one quantity with respect to many parameters for about the cost of one extra solve, and drives the L-BFGS-B optimizer (optimize --algorithm lbfgsb; Nelder–Mead is the default). calibrate takes Levenberg–Marquardt steps, with its Jacobian from sensitivities; --optimizer lbfgsb switches to adjoint gradients. diokle doe runs full, fractional, central composite, Box–Behnken and Latin hypercube designs and fits response surfaces. See Sensitivity, DOE and calibration.

State machines

The state machines of Modelica 3.6 chapter 17 now translate and simulate: transition, initialState, activeState, ticksInState() and timeInState(), with immediate and delayed transitions, priorities, synchronize, hierarchy, parallel machines and resets. The example from ModelicaReference.StateMachines runs as written. See State machines.

MSL external C functions and exact lookup tables

The C libraries the MSL calls (ModelicaRandom, ModelicaFFT, ModelicaIO, ModelicaInternal and ModelicaStrings) now have native implementations that run in the browser too. Lookup tables follow the C tables exactly, including CombiTable2D and tables read from files. 21 more MSL examples now match their reference results, among them all the Blocks.Examples.Noise models, the FFT examples and Utilities' matrix file examples. See Modelica Standard Library.

Structure explorer and state selection

The new Structure tab and diokle structure show the BLT blocks, the incidence matrix, why each state was chosen, and the state Jacobian's eigenvalues and stiffness. States can be pinned or forbidden there, or with --state NAME=prefer on any command, without editing the model, and a check along the run warns when a static choice breaks down. See Structure and state selection.

The Structure view of TorqueConverter.Launch

Radau, ESDIRK and automatic switching

Two more stiff solvers, Radau IIA (order 5) and ESDIRK (order 4), and auto, which switches between Dopri5 and BDF as the model turns stiff and back. The implicit methods use an exact Jacobian from the compiled model, and the workbench recommends another method when a run's statistics show it is using the wrong kind. See Solvers.

Sensitivity, uncertainty, calibration and optimization

The Analysis mode and diokle sensitivity | montecarlo | gsa | calibrate | optimize: exact sensitivities, Monte Carlo prediction bands, Sobol and Morris indices, fitting parameters to measured data with standard errors, and design optimization. See Sensitivity and calibration.

Sobol indices
Calibration against measured data

Every simulation is kept in the Runs pane to overlay or subtract, Sweep… runs a parameter grid on all cores in the browser, diokle sweep does the same on the command line, and Share link copies an address that reruns the experiment. See Experiments and sweeps.

Performance analyzer

Profile (or --profile) records the step sizes, the states that limit them, the time in each algebraic loop, the event log and chattering relations, with hints in plain language. See Performance analyzer.

Graphical editing

The Diagram view is now an editor for your own models: drag components in, connect them, rotate, flip and set parameters, with undo. Edits change only the text they must. See Workbench.

AI assistant and MCP server

✦ Assistant in the workbench is a chat, via OpenRouter, that can read, write, check and simulate models and read the structure and profile reports, with your own API key. diokle mcp gives Claude Code and other MCP clients the same tools. See AI assistant and MCP.

MSL accuracy scoreboard

The scoreboard compares every MSL 4.1.0 example with the Modelica Association's reference results, signal by signal: 488 of 534 match, 24 run but differ somewhere, 19 fail and 3 hit the time limit. It breaks the results down by package, shows the signals that differ and the error text for each model, and links each example to the workbench.

The MSL accuracy scoreboard

See Modelica Standard Library.

Python API

The diokle Python package (crates/diokle-py, built with maturin) runs the compiler in-process, with no server and no licence: load a model, change parameters, simulate to NumPy arrays or pandas, linearize and export FMUs.

import diokle

m = diokle.Model("library/Diokle", "Diokle.Examples.TorqueConverter.StallTest")
m.set_parameters({"engine.J": 0.3})
r = m.simulate(stop=2.0, vars=["rpm_engine"])
r.time, r["rpm_engine"]

See Python API, which also maps OMPython and Dymola calls onto it.

.mos scripts, steady states and trim

diokle run script.mos runs Dymola and OpenModelica regression scripts: loadModel, simulateModel, simulate, simulateExtendedModel, linearizeModel, val, loops and conditionals. diokle steady finds equilibria with an exact Jacobian and reports their stability, and with --free and --target it trims, for example the input that holds an output at a set value. See Scripts and steady states.

3-D animation for every example

After Simulate, models with shapes open in the new Animation view: a WebGL scene with studio lighting, camera presets, follow and chase cameras, X-ray selection and WebM recording. It draws every Modelica.Mechanics.MultiBody shape in a result, including STL and OBJ meshes, and the bundled examples got their own visuals through Diokle.Visualizers: cars that drive the cycles side by side, the landing gear dropping onto the runway, the aileron turning on its hinge.

Landing gear drop tests at three sink rates
Four electric cars driving the NEDC cycle

See 3-D animation.

Multibody suspensions, rigs and a full car

library/MultiBodyVehicle builds vehicle models on Modelica.Mechanics.MultiBody: double-wishbone, pushrod, multilink and MacPherson corners, an anti-roll bar, a tyre with lift-off, wheel pads and aero loaders, and a 6-DOF car. Nine examples cover suspension kinematics, a K&C rig, a seven-post rig, step steer, lane change and a one-sided bump, and all nine match OpenModelica 1.26.1 to within 0.04 % of each signal's range while running several times faster.

See Multibody vehicles.

Back and forward between classes

Every class you open is a browser history entry with its own address (/#Package.Model), so Back and Forward, Alt+← and Alt+→, mouse side buttons and the arrows next to the class name walk through them, and a link opens a class directly. The workbench colours now follow the light or dark system theme everywhere, diagrams included. See Workbench.

Release binaries

Pushing a version tag builds and publishes a GitHub Release with the CLI, the FMI runtime and the example library for Linux, macOS (Apple Silicon and Intel) and Windows, plus the diokle-casadi Python wheel. See Getting started.

Optimal control, MPC and estimation with CasADi

diokle export-casadi hands the index-reduced DAE to CasADi, and the diokle_casadi Python package solves optimal control problems by direct collocation, runs model predictive control and estimates states and parameters with moving horizon estimation, all referring to model variables by their Modelica names.

Minimum-time aileron move: full-open valve, then a reverse braking pulse, 41.7 ms

See Optimal control.

Modelica Standard Library 4.1.0 in the browser

The workbench loads MSL 4.1.0 (Modelica, ModelicaServices, Complex) out of the box. The package browser lists all of it within seconds, and a class is parsed only when it is opened or simulated. A nightly job compares every MSL example with the Modelica Association's reference results. See Modelica Standard Library.

Linearization

diokle linearize gives the exact state-space matrices A, B, C and D around the initial point or after simulating to a time, as text, JSON or an OpenModelica-style linearized_model. See Linearization.

FMI 2.0 export

diokle fmu writes one FMU with both Model Exchange and Co-Simulation, validated with FMPy in CI. See FMI 2.0 export.

Multibody closed loops

Planar kinematic loops on a free body, driven loops and steady-state initialization now work, which is what the suspension models above are built on.

The longer-term plan is in the Roadmap.

Edit this page on GitHub