Modelica Standard Library
The workbench ships with the Modelica Standard Library 4.1.0: Modelica,
ModelicaServices and Complex appear in the package browser next to the bundled
Daedalus library, with nothing to install. On the command line, pass an MSL checkout as
extra sources (see Command line).
In plain terms: the Modelica Standard Library is the common collection of ready-made model parts, and its examples come with reference results, the official answers published by the Modelica Association. An example "matches" when Diokle gives the same answers.
Coverage
512 of the 534 MSL 4.1.0 example models translate and simulate to the end, and 488 of them match the Modelica Association's reference results (see below). They include:
Mechanics(Rotational, Translational, MultiBody),Electrical(Analog, Digital, Machines, QuasiStatic machines, PowerConverters, Batteries),Thermal,Blocks,StateGraphand clocked synchronous models;Modelica.Media: IF97 water, R134a, ideal-gas mixtures, moist air and reference air, through compiled run-time functions with exact partial derivatives;- most
Modelica.Fluidsystems; ModelicaStandardTableslookups, replaced by native tables with linear, constant, Akima and Fritsch–Butland smoothness, hold, linear and periodic extrapolation, and time events at breakpoints.
The remaining failures, and what is being done about them, are listed in the Roadmap.
Language features
Each row says what the compiler accepts and where it stops. The numbers count the MSL examples of the matching package that match the reference results (the table in Checked against the reference results has the full breakdown). A feature can be fully supported in the simulator and still be missing from the embedded or CasADi backends, so the last column lists those limits.
| Feature | MSL examples that match | Limits |
|---|---|---|
| Variables, records, arrays, enumerations, connectors and flow variables | Electrical.Analog 51 of 55, Rotational 15 of 17, MultiBody 38 of 42 | none found in the MSL sweep |
| Complex numbers | ComplexBlocks 2 of 2 | none found |
when, pre, edges, reinit, zero-crossing events |
Electrical.Digital 23 of 23 | when in functions is rejected; when equations are left out of the CasADi export with a warning |
Synchronous clocks (sample, Clock) |
Clocked 74 of 77 | clocked equations are rejected by the CasADi export |
State machines (MLS chapter 17: initialState, transition, activeState, …) |
not measured by the MSL examples; the tests are listed on State machines | see State machines for the supported operators and limits |
Streams in Modelica.Fluid |
Fluid 15 of 23 | most start-up transients of the bigger systems still fail or differ |
Modelica.Media (IF97, R134a, ideal-gas and moist-air mixtures) |
Media 21 of 21 | none found |
Tables: CombiTable1D, CombiTimeTable, CombiTable2D |
Blocks 29 of 31 | 2-D tables are rejected by the embedded and CasADi backends; usertab C functions and MATLAB v7.3 files are not supported |
| External C functions | Math 4 of 4, Utilities 3 of 3 | impure external functions are rejected in embedded code; string arrays cannot be arguments |
Functions with algorithms and while loops |
counted in the rows above | a break or return under a run-time condition inside a while loop is not supported; while loops are rejected by the CasADi and embedded backends |
delay() |
counted in the rows above | the simulator supports it; the embedded and CasADi backends reject it |
| FMI 2.0 and 3.0 export, FMU import | see FMI and SSP | a model with FMU components cannot be exported as an FMU, and steady states are not computed for it |
The seven StateGraph examples (a block library built from ordinary equations and events, in
Modelica.StateGraph) match the reference, but they do not exercise the chapter 17 operators.
Features with no row, such as expandable connectors and homotopy(), have not been measured
against the MSL yet, so this table does not claim them.
External C functions and lookup tables
Many MSL models call C functions from the MSL's own C libraries. Diokle implements these natively, following the reference C sources, so the same models run in the browser:
ModelicaRandom: the xorshift64*, xorshift128+ and xorshift1024* generators, the impure random generator and automatic seeds, behindModelica.Math.Randomand theBlocks.Noisesources;ModelicaFFT: the real FFT behindModelica.Math.FastFourierTransform;ModelicaIO: reading and writing real matrices in MATLAB v4, v6 and v7 files;ModelicaInternalandModelicaStrings: printing, files, time and string functions used byModelica.Utilities.
The browser bundle holds the .mo sources only, not the library's Resources/Data
files. Models that read those data files therefore stop in the browser:
Utilities.Examples.ReadRealMatrixFromFile reads three .mat files from there and
fails with "function array size must be known". They run on the command line.
Functions with constant arguments are evaluated once at translation. Functions with hidden state, such as the impure random generator, are never folded or cached.
Lookup tables follow the C tables exactly:
CombiTable1DandCombiTimeTablewith every smoothness kind of the C tables, first and second derivatives, and the C time-event intervals;CombiTable2Dwith bilinear, constant and bivariate Akima interpolation;- tables read from text, CSV and MATLAB v4, v6 and v7 files.
Tables supplied through a usertab C function and MATLAB v7.3 (HDF5) files are not
supported. These additions made 21 more examples match their reference results:
- all
Blocks.Examples.Noisemodels; - the FFT examples,
Rectifier6pulseFFTandRectifier12pulseFFT; Math.Random.Examples.GenerateRandomNumbers;Utilities.Examples.ReadRealMatrixFromFileandWriteRealMatrixToFile(on the command line; in the browser onlyWriteRealMatrixToFileruns, see How the browser loads it);- the excited synchronous machines (
SMEE_*) andRollingWheelSetPulling, after a state-selection fix.
Open the uniform noise example
The state machines of chapter 17 are covered in State machines.
Checked against the reference results
Simulating is not enough: the results have to be right. A nightly CI job simulates every
MSL 4.1.0 example and compares its comparison signals with the Modelica Association's
reference results (MAP-LIB_ReferenceResults, generated with Dymola), and fails if a model
that passed in the committed baseline stops passing. Each example runs with the tolerance its
reference was generated with (the experiment tolerance times 0.1, as recorded in the
reference's creation.txt), on the reference's output grid.
| Result | Models |
|---|---|
| Matches the reference results | 488 |
| Simulates, but a signal differs | 24 |
| Hits the time limit | 3 |
| Does not translate or stops | 19 |
| Total | 534 |
The scoreboard lists every example with its status, the signals that differ and the error text, with a link to open it in the workbench.
The baseline is docs/conformance/msl-4.1.0.json, made by tools/refcompare.py.
Examples to try
Each link opens the model in the workbench; press ▶ Simulate.
Rotational mechanics: CoupledClutches
Four inertias coupled by three clutches that open and close at set times: a classic test of friction events, stuck and sliding phases.


Open Modelica.Mechanics.Rotational.Examples.CoupledClutches
Analog electronics: ChuaCircuit
A chaotic oscillator. The second subplot plots C2.v against C1.v to show the double
scroll attractor.


Open Modelica.Electrical.Analog.Examples.ChuaCircuit
Control: PID_Controller
A drive train under a PI speed controller, following a kinematic reference profile while a load step hits it.


Open Modelica.Blocks.Examples.PID_Controller
Heat transfer: TwoMasses
Two masses at different temperatures that equalize through a thermal conductor.


Open Modelica.Thermal.HeatTransfer.Examples.TwoMasses
MultiBody: DoublePendulum
Two bodies on revolute joints, with the 3-D animation that every MultiBody result gets.


Open Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum
For full vehicle models built on MultiBody, see Multibody vehicles.
How the browser loads it
The MSL sources are not in the repository. At build time, web/scripts/fetch-msl.mjs
downloads the v4.1.0 release from GitHub and packs its .mo and package.order files into
one gzip bundle (about 2.6 MB; 14.8 MB unpacked) with a content hash in its name. The
workbench downloads it after the Daedalus library, unpacks it with
DecompressionStream, and registers every file without parsing it. A light token scan
outlines each file so the package browser lists the whole library within seconds, and a
class is parsed only when it is opened, checked or simulated, together with the classes
it needs.

