Let the model keep supplying the CLI defaults - #1637
Merged
Conversation
The CLI gained the C++ flag names in OpenModelica#1631, but also gained an argparse default for each of them. Those defaults are applied unconditionally, so they override the values the model itself provides: | flag | C++ CLI | after OpenModelica#1631 | | -------------- | ---------------------------- | ------------------- | | `--startTime` | DefaultExperiment | always 0.0 | | `--stopTime` | DefaultExperiment | always 1.0 | | `--tolerance` | DefaultExperiment | always 1e-4 | | `--stepSize` | DefaultExperiment | always 1e-3 | | `--resultFile` | `<modelName>_res.mat` | `default_res.mat` | | `--mode` | the FMU's preference | always `me` | `oms_extractFMIKind` only overrode a DefaultExperiment value when the corresponding flag was `explicitlySet`, and `SimulateSingleFMU` only called `oms_setResultFile` when `--resultFile` was not `<default>`. Restore that: every option whose fallback lives in the model or in Flags.h now defaults to None, and the documented default moves into the help text so `--help` still shows it. Two more flags could not do what they said: * `--clearAllOptions` is `re_void`, so the `=true` the forwarding loop appended made the native parser reject it. * `--suppressPath` was overridden by `FMU.instantiate()`, which set it unconditionally. That also warned "Flag --suppressPath is set multiple times" whenever the flag was passed. Both call sites now go through `Capi.setSuppressPath()`, where the first caller wins. Forwarded arguments are quoted as a whole rather than bare, since the native tokenizer is `std::quoted` and a value with spaces otherwise splits across tokens. Finally, install the launcher 0755. It inherited the 0700 of the `OMSimulatorPython3` helper it replaced, which leaves `bin/OMSimulator` unusable by anyone but the installing user. Assisted-by: Claude Opus 5 (1M context)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1637 +/- ##
=======================================
Coverage 29.24% 29.24%
=======================================
Files 68 68
Lines 12960 12960
Branches 8389 8389
=======================================
Hits 3790 3790
Misses 7979 7979
Partials 1191 1191
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CLI gained the C++ flag names in #1631, but also gained an argparse default for each of them. Those defaults are applied unconditionally, so they override the values the model itself provides:
--startTime--stopTime--tolerance--stepSize--resultFile<modelName>_res.matdefault_res.mat--modemeoms_extractFMIKindonly overrode a DefaultExperiment value when the corresponding flag wasexplicitlySet, andSimulateSingleFMUonly calledoms_setResultFilewhen--resultFilewas not<default>. Restore that: every option whose fallback lives in the model or in Flags.h now defaults to None, and the documented default moves into the help text so--helpstill shows it.Two more flags could not do what they said:
--clearAllOptionsisre_void, so the=truethe forwarding loop appended made the native parser reject it.--suppressPathwas overridden byFMU.instantiate(), which set it unconditionally. That also warned "Flag --suppressPath is set multiple times" whenever the flag was passed. Both call sites now go throughCapi.setSuppressPath(), where the first caller wins.Forwarded arguments are quoted as a whole rather than bare, since the native tokenizer is
std::quotedand a value with spaces otherwise splits across tokens.Finally, install the launcher 0755. It inherited the 0700 of the
OMSimulatorPython3helper it replaced, which leavesbin/OMSimulatorunusable by anyone but the installing user.Assisted-by: Claude Opus 5 (1M context)
Related Issues
Purpose
Approach