Skip to content

[OMEdit] Calibrate SSP models against reference data - #17360

Merged
adrpo merged 4 commits into
OpenModelica:masterfrom
adrpo:omedit-ssp-calibration
Oct 20, 2026
Merged

adrpo merged 4 commits into
OpenModelica:masterfrom
adrpo:omedit-ssp-calibration

Conversation

@adrpo

@adrpo adrpo commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Related Issues

Fixes #17359.
Uses OpenModelica/OMSimulator#1675 (OMSimulator --calibrate, OpenModelica/OMSimulator#1674), now merged: this PR bumps the OMSimulator submodule to its merge commit (398baadc).

Purpose

OMSimulator can fit the parameters of an SSP model to reference data, from the Calibration activity of the UQ layered standard file stored in the SSP. OMEdit had no way to run it.

Approach

  • The context menu of a top level SSP model in the Libraries Browser gets Calibrate....
  • OMSCalibrationDialog asks for:
    • the Calibration activity id (empty: the only one in the UQ file)
    • the UQ file inside the SSP (empty: the one referenced by ssc:MetaData of type application/x-uncertainty-quantification)
    • the SSP file the calibrated model is written to (default <working directory>/<model>.calibrated.ssp)
  • Calibrate exports the model like Simulate does and then runs
    OMSimulator --calibrate=<activity> [--uqFile=<file>] --calibrationOutput=<out.ssp> <exported.ssp>,
    started the same way as OMSSimulationOutputWidget (the launcher on Linux/macOS, python -m OMSimulator on Windows). Its output streams into the dialog. The Calibrate button is disabled while it runs, and closing the dialog stops it.
  • The signal/slot connections use the compile-time checked connect() syntax.
  • The web OMEdit has no QProcess, so the dialog is excluded from the wasm build and the menu entry is compiled out there.

Testing

Tested locally on Linux. OMEdit was built from this branch, with OMSimulator's Python package taken from the OpenModelica/OMSimulator#1675 branch. The model was the dc_motor use case of the UQ layered standard: an SSP with 3 model-exchange FMUs, a Calibration activity cal_01 with 6 targets and a CSV of noisy measurements.

  • The SSP opens in OMEdit and Calibrate... appears in its context menu.
  • Run with the activity cal_01, and again with the field empty: both converge in 485 evaluations to the same values as the command line (R = 0.0999684, cost 104041). The written SSP contains the ResultSet with the RMSE values and cal_01_calibrated.ssv.
  • Run with the activity nosuch: one red error: No Calibration activity with id 'nosuch' ... line, "The calibration failed with exit code 1.", and the button is enabled again.
  • Closing the dialog during a run stops the OMSimulator process.

Not tested locally: the Windows python -m OMSimulator path (copied from OMSSimulationOutputWidget) and the wasm build. The Windows CI label is set.

This PR was written with an AI coding agent (Claude Code); all of the testing above was done locally by the agent.


🤖 Generated with Claude Code

OMSimulator fits the parameters of an SSP model to reference data with
`OMSimulator --calibrate`, from the Calibration activity of the UQ
layered standard file in the SSP (OpenModelica/OMSimulator#1674). OMEdit
had no way to run it.

The context menu of a top level SSP model gets "Calibrate...", which
opens OMSCalibrationDialog: the activity id (empty for the only one),
the UQ file inside the SSP (empty for the referenced one) and the SSP
to write the calibrated model to. Calibrate exports the model like
Simulate does and runs OMSimulator on it the same way as
OMSSimulationOutputWidget, streaming its output into the dialog.
Closing the dialog stops a running calibration.

The web OMEdit has no QProcess, so the dialog is not built there.

Assisted-by: Claude Opus 5.5
@adrpo
adrpo requested a review from adeas31 as a code owner October 20, 2026 12:42
@adrpo adrpo self-assigned this Oct 20, 2026
@adrpo adrpo added CI/Build MSYS2-UCRT64 Build pull request with Windows MSYS2 UCRT64 COMP/GUI/OMEdit Issue and pull request related to OMEdit labels Oct 20, 2026
connect(mpCalibrationProcess, SIGNAL(readyReadStandardOutput()), SLOT(readStandardOutput()));
connect(mpCalibrationProcess, SIGNAL(readyReadStandardError()), SLOT(readStandardError()));
connect(mpCalibrationProcess, SIGNAL(errorOccurred(QProcess::ProcessError)), SLOT(calibrationProcessError(QProcess::ProcessError)));
connect(mpCalibrationProcess, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(calibrationProcessFinished(int,QProcess::ExitStatus)));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s better to use the new syntax for connect(), as it checks signal-slot compatibility at compile time. With the old syntax, connection issues may go unnoticed until runtime, when the connection fails or the slot is never invoked.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in abfef88: all connections of the dialog, and its menu action in LibraryTreeView, now use the new syntax (QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished) like OMSProxy).


🤖 Generated with Claude Code

Brings OMSimulator#1675: OMSimulator --calibrate, used by the
Calibrate... dialog of SSP models.

Assisted-by: Claude Opus 5.5
@adrpo
adrpo requested a review from arun3688 as a code owner October 20, 2026 17:11
adrpo added 2 commits October 20, 2026 19:14
Compile-time checked signal/slot connections in the SSP calibration
dialog and its menu action, as asked in the review.

Assisted-by: Claude Opus 5.5
HOST_SHORT, used on Windows only, is in omedit_config.h.

Assisted-by: Claude Opus 5.5
@adrpo
adrpo merged commit d06f4e6 into OpenModelica:master Oct 20, 2026
5 checks passed
@adrpo
adrpo deleted the omedit-ssp-calibration branch October 20, 2026 21:13
adrpo added a commit to adrpo/OpenModelica that referenced this pull request Oct 21, 2026
Documents the Calibrate... dialog OMEdit got in OpenModelica#17360 (OpenModelica#17359) in a new
"Calibrating an SSP Model" section of the OMEdit chapter (OpenModelica#17408).

It links to the Parameter Calibration section of OMSimulator's
documentation, which the guide didn't show: omsimulator.rst still
included OMSimulatorLua.rst, OMSimulatorPython.rst and SSP.rst, which
OMSimulator no longer has, so the page lost its Python API (with the
calibration) and gave three include errors. It now includes the pages
OMSimulator's own guide has: OMSimulatorPython3.rst instead of the three,
plus OMSimulatorGui.rst.

Assisted-by: Claude Opus 5.5
adrpo added a commit that referenced this pull request Oct 21, 2026
…de (#17408) (#17409)

* [Doc] Diagrams and property probes in the guide

Documents in the User's Guide what #16954, #16965, #17188 and #17339
added (#17408):
- umldiagrams.rst: getClassDiagram and getInstanceDiagram, their
  formats and options, with Mermaid examples omc generates while the
  guide is built, and PlantUML renders of a redeclared medium, the PID
  block and the instance diagram of ChuaCircuit.
- propertyprobes.rst: the probe tree, the properties evaluateProbe
  computes and how CodeProber uses them, with examples on
  ProbeCircuit.mo and CodeProber screenshots.
- omedit.rst: the Class Diagram window.

Assisted-by: Claude Opus 5.5

* [Doc] Calibration of SSP models in the guide

Documents the Calibrate... dialog OMEdit got in #17360 (#17359) in a new
"Calibrating an SSP Model" section of the OMEdit chapter (#17408).

It links to the Parameter Calibration section of OMSimulator's
documentation, which the guide didn't show: omsimulator.rst still
included OMSimulatorLua.rst, OMSimulatorPython.rst and SSP.rst, which
OMSimulator no longer has, so the page lost its Python API (with the
calibration) and gave three include errors. It now includes the pages
OMSimulator's own guide has: OMSimulatorPython3.rst instead of the three,
plus OMSimulatorGui.rst.

Assisted-by: Claude Opus 5.5

* [Doc] Screenshots of the OMEdit calibration

The Calibrate... entry of the Libraries Browser menu and the dialog after
calibrating the dc_motor SSP of the UQ layered standard use cases (#17408).

Assisted-by: Claude Opus 5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/Build MSYS2-UCRT64 Build pull request with Windows MSYS2 UCRT64 COMP/GUI/OMEdit Issue and pull request related to OMEdit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OMEdit: calibrate SSP models against reference data

2 participants