UsersGuide package
Requirements.UsersGuide
ยท source
User's Guide
Extends Modelica.Icons.Information
Library Requirements is a Modelica package using temporal logic to formally define requirements and automatically test these requirements when a model is simulated.
What the library does today
The Requirements library is a Modelica package for stating requirements formally and for judging a simulation against them. Its blocks implement a temporal logic over simulated signals: time locators select the periods in which a requirement applies, check blocks evaluate conditions in fixed or sliding windows, and a verdict type records whether a requirement was violated, satisfied or never decided. The structure descends from the Modelica_Requirements library presented in 2015, which in turn follows the FORM-L language developed at EDF, where a requirement has a where, a when, a what and a how well. FORM-L has been superceded by CRML, also developed by EDF, during the same research project in which the original Modelica_Requirements Library was developed. The current Library has been updated to the principles presented in the CRML language, but does not directly interface with it. Beyond conditions on transient signals, the library offers spectral checks (FFT), step-response metrics, requirements checking for steady-state design, eigenvalue checks over a linearization, and violation statistics for long runs, that is, how often, for how long and by how much a requirement was violated.
Verdicts use four values inside the library (Violated, Undecided, Satisfied and Undefined, the last meaning not applicable), leaning on the formalism developed in CRML, and three wherever a person or another tool reads them (violated, untested, satisfied). Every check block also outputs a margin, the distance to its limit in units of the requirement's tolerance. The library can be used on its own, with the requirement blocks wired next to a plant in one model that prints its verdicts at the end of a simulation with Verify.PrintViolations, or as the checking engine of a two-run workflow: the plant is simulated alone, its signals are stored in one MA-HS-CSV file, and the check blocks read that file in a second run through Sources.PartialSignalsFromFile. In that workflow the library produces Types.Property and margin trajectories, and the reported verdicts are taken from them in Python by the Chaperone requirements-verification pipeline. The examples build and simulate in Dymola, OpenModelica and Modelon Impact.
Why a redesign of the Requirements Library?
In the original library (Modelica_Requirements up to version 0.7) a requirement was a hand-written Modelica model. Library blocks were wired next to the plant, the plant and its checks were simulated together as one model in one Modelica tool, and Verify.PrintViolations printed the verdict at the end of the run. The verdict type had three values, and a requirement that was still undecided at the end was reported as untested. This design is compact and gives a short development loop, and its blocks and verdict words are what the redesign keeps. Practice with larger plants and several tools exposed nine limitations.
Four of them concern the independence of the evidence. The when, edge and sample events of the checks change the solver's step sequence and can therefore change the trajectory being verified. The verdict depended on the tool: terminal() evaluates to false in Modelon Impact, a terminate() edge loses the last state, and verdicts were printed twice. Only a tool that compiles the library could take part, which excluded FMUs and SSP systems. Finally, OpenModelica 1.27.1 could not build the sliding-window and FFT examples.
Three concern what a verdict says. Untested was invisible: Undecided was printed without a reason, and a requirement that no example exercised printed nothing. Without a margin, a requirement satisfied by a hair and one satisfied with ten tolerances of headroom printed the same word. Without sets of components, a requirement such as all bearings shall ... needed one block per bearing, and an absent instance looked like a violated one.
The last two concern traceability and reach. The model was the requirement, so a reviewer who does not read Modelica could not confirm that it matched the intended statement. And whole families of requirements, such as steady-state envelopes, step-response metrics and eigenvalue bounds, cannot be decided inside a single transient run.
The redesign inverts the concept and keeps the library. The requirement becomes a sentence in a controlled natural language, stored in a strictdoc project together with its rationale and review trail. Check models are generated from it by a deterministic parser, committed, and never edited by hand. The decisions are recorded as eleven design rules, of which the following carry most of the change.
Simulation and checking are separated. The plant is simulated alone, without any requirement block in it, so that the object being verified is not altered by verifying it. Its named signals are stored in one file and the check model reads that file in a second run. The verdict is computed in Python from the stored Property and margin trajectories, which makes it independent of the Modelica tool and provides the time and the reason of a verdict without extra effort. Any Modelica, FMI or SSP tool can run the plant, because the file is the only interface. Verification inside Modelica remains as an optional layer on the same check model, for the fastest development loop, but it is never a reported verdict. The split has a cost: a threshold crossing is located on the interpolated stored signal, so the first-violation instant can move by up to one recording interval, and the recording interval is therefore a required field of every test case. On the requirements corpus run with OpenModelica and Modelon Impact, 75 pairs of requirement and test case gave no differing verdict between the coupled one-run model and the two-run pipeline; 45 of 48 violated pairs had an identical first-violation instant and the other three shifted by at most one interval.
Requirements are text first, as is the most common industry practice. The controlled language uses an EARS skeleton (while, when, if-then, ubiquitous and complex patterns) over a typed glossary and a closed phrasebook. Every noun phrase must be a glossary signal with a type, a unit and a plant variable, and quantities carry units that are checked for dimensional consistency. The step from text to model is a deterministic parser and not a language model, so the same text yields the same model at any later time, offline and auditable, and a statement that does not parse is rejected instead of interpreted. The parser echoes each requirement as a canonical sentence and draws a timing diagram of its scope, trigger and obligation; the author's confirmation of both is the review step. Language models may help to write text that parses from less formal original requirements text, and to design test cases, but no language model output sits between a requirement and its verdict.
The verdict semantics are stricter. Four values are used inside a check model because composition needs Undefined as the neutral element: a check outside its period drops out of a conjunction instead of holding it Undecided. Wherever a person or another tool reads a verdict there are three values, since a fourth token is what a dashboard may coerce to green. Untested is a first-class verdict that carries its reason (never applicable, applicable but never decided, signal not recorded, run failed, and similar) and the number of attempts, and a satisfied verdict with no attempts is refused. Every verdict is keyed by requirement and component instance, so a requirement over a set of components yields one verdict per instance and an aggregate, and an absent instance is no longer mistaken for a violated one. Margins are normalized by the requirement's tolerance; without a tolerance the number is shown but never ranked, because quantities in different units cannot be compared. Because the four-valued algebra is not a lattice, Property expressions are never simplified.
Requirement families that a single transient run cannot decide are evaluated in Python on the same stored data: steady-state point clouds over parameter sweeps, step responses, eigenvalue and frequency-response properties of a linearization, and spectral checks. Where the library has a corresponding block, it serves as an independent cross-check. One requirement set is run against several test cases, and each test case states the verdict it expects, so that a run also tests the tests. A requirement that no test case exercises is listed as untested, with that reason.
A related decision concerned CRML, the language of EDF that carries the extended temporal logic. Five options were weighed, from full adoption of its toolchain to declining it. The semantics, that is the four-valued tables and the decision events, were adopted and implemented in the library's own Modelica, with matching names so that later convergence stays cheap; export to and import from CRML are held open. The toolchain was not adopted because, at the time of the decision, its runtime had no published license, the language was not governed by a standards body, and the semantics are available in open literature and can be implemented independently.
For users of the library the redesign is evolutionary. Requirements is a derivative of Modelica_Requirements 0.7.1 under the original BSD 3-Clause license, renamed on 2026-09-14, and the changes meant for upstream are kept on a separate branch. From 0.7.1 to the current version no release requires a model conversion, with one exception: code that reads a stored Property result must accept the value 4 (Undefined) from version 0.8.0 on. The release notes and the summary of 2026 in the User's Guide give the details of each step.
Tool support
Every example builds and simulates in Dymola, OpenModelica and Modelon Impact.
| Tool | Examples |
|---|---|
| Dymola 2027x | all |
| OpenModelica 1.27.1 | all, new and old frontend (since version 0.13.2) |
| Modelon Impact | all |
Origin. Requirements is Model Based Innovation LLC's derivative of Modelica_Requirements version 0.7.1 (BSD 3-Clause), renamed on 2026-09-14. Its source, releases and issue tracker are in the public repository https://github.com/MBILLC/Requirements. The license and the copyright notices of the original authors are unchanged; see the Contact page and the LICENSE file. Additions made here (a MA-HS-CSV signal reader and what builds on it) are not part of the upstream library.
Two runs, one file. The additions serve a signal-based, two-run verification: the plant is simulated alone, with no requirement block in it, its glossary signals are stored in one MA-HS-CSV file, and the check blocks of this library run on that file in a second run through Sources.PartialSignalsFromFile. Because the only thing that crosses from the simulation to the checks is a file of named signals, the design transfers to any FMI- or SSP-based tool: whatever simulates the plant -- a Modelica tool, an FMU in any master, an SSP system in a co-simulation platform -- produces the signals, and the checking engine (these blocks, or a monitor FMU built from them, or a Python evaluation of the stored trajectories) is a separate tool that never alters the simulation it judges. Separating the simulation from the checking engine is what opens the library to tools it was never written for.
Self-contained. Everything in the library works in a plain Modelica tool: a check model holds the requirement blocks and one Verify.PrintViolations, and a simulation prints which requirements are violated, untested or satisfied. That holds for transient requirements, for steady-state requirements (Examples.SteadyState.CheckHeatExchanger) and for eigenvalue requirements over a linearization (LinearAnalysis; the linearization itself is done with whichever tool the user has).
Relation to ModCheck. The library is also the Modelica checking engine of
ModCheck, a regression-testing and
requirements-verification framework. ModCheck generates check models from requirement statements, runs the
two-run workflow above, parameter sweeps and linearizations across Modelica tools, and evaluates some
requirement families (step-response metrics, eigenvalue predicates) on the stored trajectories in Python as
well, with this library's blocks as an independent cross-check. The regression baselines of the library's
examples on Dymola, OpenModelica and Modelon Impact were produced with it and are kept in
Resources/ModCheck/. Nothing in the library depends on ModCheck, and the rest of this
documentation does not refer to it.
Contents
| Name | Kind | Description | |
|---|---|---|---|
| ReleaseNotes | package | Release notes | |
| Contact | class | Contact | |
| BuildingsLicense | class | License of the code ported from the Modelica Buildings library |