What you can simulate
A requirement is verified by simulation when a test_case names it, says what to simulate (simulate:), and says what must hold in the result (expects:). OpenModelica runs the model; ArcLang reads the result and writes a verdict on the requirement. This page lists what that covers today, with the examples that show it. The mechanics (export, cache, gate, VS Code) are in Simulation as code.
The libraries
| Simulator | OpenModelica 1.27.1 (the version of the online service and of the default Docker image) |
| Library loaded for every run | Modelica Standard Library 4.1.0 (MSL), installed on first use |
| Your physics | Modelica packages you write, or the assistant writes, listed in sources: |
| Other libraries | Not loaded. A package that needs one (Buildings, ThermoSysPro, a vendor library) does not load: copy the classes you use into your own package |
Everything the MSL holds can be used in your packages: electrical (analog, machines, batteries through your own equations), mechanics (translational, rotational, multibody), heat transfer, blocks and state graphs, media for fluid properties, mathematical and table functions.
The physics a port carries
A physical port of the architecture says what it carries with physics:. The Modelica export then gives it the MSL connector, and a physical_link between two ports becomes a connect(...):
physics: |
MSL connector |
|---|---|
signal |
Modelica.Blocks.Interfaces.RealInput / RealOutput |
electrical |
Modelica.Electrical.Analog.Interfaces.PositivePin / NegativePin |
mechanical_translational |
Modelica.Mechanics.Translational.Interfaces.Flange_a / Flange_b |
mechanical_rotational |
Modelica.Mechanics.Rotational.Interfaces.Flange_a / Flange_b |
thermal |
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a / HeatPort_b |
fluid |
not exported yet: a fluid connector needs a medium, which ArcLang does not model |
A model does not need physical ports to be simulated: a self-contained package that sources: names is enough. Fluid systems are simulated that way today, with the flow as a variable of your package (the data-center example below does so for its coolant loops).
What an expects: line checks
Each line compares one value of the result with a bound. A variable is a time series, read through one of six functions:
| Function | Reads | Example |
|---|---|---|
max(v) |
the largest value over the run | max(pack.T) <= 55 °C |
min(v) |
the smallest value | min(battery.soc) >= 0.2 |
final(v) |
the value at the end | final(car.distance) >= 300 km |
initial(v) |
the value at the start | initial(tank.level) >= 0.9 |
mean(v) |
the mean over time | mean(drive.power) < 25 kW |
at(t, v) |
the value at a time, interpolated | at(40 min, bus.drawn) <= 1 W |
The comparisons are <, <=, >, >=, == and !=. Bounds carry units (55 °C, 300 km, 35 min, 25 kW); values are compared in SI units, and a bound in a unit that does not fit the variable's unit is an error, not a verdict. A line may start with the requirement it judges (REQ-CELL-TEMP: max(...) <= 55 °C) when a test case verifies several.
A variable is named by its path in the simulated model (pack.cell.T). Its first segment may be the id of an element in quotes ("PN-BATT".soc) when the package extends the structure ArcLang exports.
Several runs from one test case
- Sweeps:
sweep:runs the case at each point of a grid of parameters, and each point gets its own verdict. - Monte Carlo:
uncertain:draws parameters from distributions (normal,uniform),samples:sets the number of runs, andprobability:the share of runs that must pass. The verdict is probabilistic, with its confidence. - Configurations:
configuration:simulates one variant of the product line (for example one pump or two). - Digital twins: the same physics replayed against measured data (CSV or Parquet files, or live sources), so that the model is checked against the real system.
From the battery example, a grid of ambient temperatures and charger powers:
$ grep -o 'sweep: \[.*\]' examples/automotive/battery-fast-charge/battery_fast_charge.arc
sweep: ["\"PN-CELLS\".ambient = 25 °C .. 40 °C step 5 °C", "\"PN-CHARGER\".max_power = 100 kW, 150 kW"]From the data-center example, an outdoor temperature and a rack power drawn at random, 60 runs, 95 % of them must pass:
$ grep -o 'uncertain: \[.*\]' examples/datacenter/ai-liquid-cooling/ai_liquid_cooling.arc
uncertain: ["\"PN-OUTDOOR\".design_temperature ~ normal(308.15 K, 3 K)", "\"PN-RACKS\".rack_power ~ uniform(110 kW, 132 kW)"]
$ grep -o 'samples: .* }' examples/datacenter/ai-liquid-cooling/ai_liquid_cooling.arc
samples: 60 seed: 11 probability: 0.95 }Six worked examples
Each one is in the playground (Explorer, examples/) and in the examples/ folder of the compiler repository, with its Modelica package in physics/. All six compile when this page is built:
$ arclang check examples/automotive/ev-range/ev_range_simulation.arc
$ arclang check examples/automotive/battery-fast-charge/battery_fast_charge.arc
$ arclang check examples/aerospace/drone-endurance/drone_endurance.arc
$ arclang check examples/aerospace/electrical-network/aircraft_electrical_network.arc
$ arclang check examples/building/heat-pump/heat_pump_heating.arc
$ arclang check examples/datacenter/ai-liquid-cooling/ai_liquid_cooling.arc| Example | Physics | What is verified |
|---|---|---|
Electric car range (automotive/ev-range) |
Battery, drivetrain, vehicle on a driving cycle | At −10 °C and 100 km/h, 300 km with 10 % of charge in reserve: the long-range pack meets it, the standard pack does not |
Battery fast charge (automotive/battery-fast-charge) |
Cell heating and two cooling designs, charger power | Cell temperature under 55 °C and 80 % charge within 35 min, over a grid of ambient temperatures |
Drone endurance (aerospace/drone-endurance) |
Battery, propulsion, altitude hold with a 2 kg sensor | Survey time and altitude hold for two battery packs |
Aircraft electrical network (aerospace/electrical-network) |
28 V DC bus, generator, battery, load shedding | After the generator is lost, the essential bus stays at 24 V or more for 30 min on the battery alone, and the non-essential loads are shed |
Heat pump heating (building/heat-pump) |
House, weather, two heat pump sizes | On the −7 °C design day, the living space stays between 20 °C and 22 °C and the heat pump uses at most 45 kWh; a twin replays measured data |
AI hall liquid cooling (datacenter/ai-liquid-cooling) |
Racks, CDU, facility water, dry coolers, pumps | GPU temperature and cooling capacity on a summer day, a grid outage and with uncertain inputs (10 scenarios) |
The expects: of the electrical network, for instance:
$ grep -m1 -o 'expects: \["REQ-ESS-30MIN.*\]' examples/aerospace/electrical-network/aircraft_electrical_network.arc
expects: ["REQ-ESS-30MIN: min(\"PN-ESS\".voltage) >= 24 V", "REQ-SHED: at(40 min, \"PN-NESS\".drawn) <= 1 W"]Where it runs
- On arclang.fr, signed in (free, a link by e-mail): the Simulate button under the diagram sends the model's folder to OpenModelica on the server. 20 runs a day per account, 15 minutes per run, up to 200 files and 2 MB. The verdicts go to the requirement coverage table, and the report exports to PDF or PowerPoint.
- On your computer, with the VS Code extension or
arclang verify: OpenModelica installed locally or in Docker, no limit but your machine. - In CI, with the same command: the verdicts are cached, so a run that did not change is not simulated again (CI/CD).
Writing the physics with the assistant
In the playground or in VS Code, ask the AI chat for it: "add the simulation so that the requirement gets a verdict". It writes the test case and the Modelica package, and before the change is shown, ArcLang checks that each expects: reads a variable the package declares, with a bound in that variable's unit. You keep or undo the change, then click Simulate.