Repository navigation
Reject Modelica runtime overrides that cannot take effect - #153
Merged
Merged
Conversation
The Modelica runner dropped an override name that was not in the init XML, or that had no start value. It logged nothing. The executable also ignores a calculated parameter and writes only a run.log warning. The runner now plans every case against the init XML before any process starts. One OverrideError lists every rejection, with the reasons unknown_name, no_start_value, not_changeable, conflicting_aliases and missing_init_xml. After each run, it scans run.log. A refusal or a readback that differs fails the run with not_applied and keeps the run directory. A rejection is never a per-case failed status. The runner always adds LOG_SOLVER to -lv, so the executable echoes each applied override. The manifest records argv and an overrides block with requested, written, already_compiled, rejected, readback and file_sha256. The public API is in simulations/response/mbd/modelica_overrides.py and is re-exported from _modelica_runner.py. OptSim load_init_parameters now reuses load_init_variables and keeps its signature. The OptSim pipeline hash includes the new module.
Each step-steer case wrote stepDuration as an override. BobLib StandardVCU binds stepDuration = frRampSteerDuration, so OpenModelica marks it a calculatedParameter with isValueChangeable=false and no start value. The old runner dropped it without a message. The new runner rejects it as not_changeable, which stopped make standard-eval-transient and the step-steer config before any case ran. The case still sets frRampSteerDuration to the same value, so the executed ramp duration does not change. The report metadata keeps stepDuration.
- Reject a value that does not fit the variable's kind in the init XML with reason invalid_value. The executable can read "fast" for a Real as 0 and still exit 0. Write an Integer as a whole number and a Boolean as true or false. - Fail the run with not_applied when run.log has no readback line for a written override. - Merge a -lv= entry in simulation.extra_args into the forced -lv. A second -lv replaced the first and switched the readback off. - Reject every variable that is not changeable, also when its value equals the compiled start. Only changeable names are already_compiled. - Raise OverrideError(missing_init_xml), not FileNotFoundError, when the runner is made for a build with no init XML.
The maneuver mapping test read stepDuration from the runner case. BobLib StandardVCU binds stepDuration = frRampSteerDuration, so the runner now rejects stepDuration as an override and the case no longer sends it. The test now checks frRampSteerDuration, which sets the executed duration, and the stepDuration in the report metadata.
rhorvath02
approved these changes
Oct 29, 2026
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.
What
Any BobSim user hits this with the default car:
simulation.init_parametersgave a run that looked valid.run.logwarning, and exits 0.stepDuration. StandardVCU binds it tofrRampSteerDuration, so that override was a silent no-op.Changes
OverrideErrorlists every rejection:unknown_name,not_changeable,no_start_value,invalid_value,conflicting_aliases,missing_init_xml.LOG_SOLVER, reads back each applied override fromrun.log, and fails withnot_appliedon a refusal, a mismatch or a missing readback line.requested,written,already_compiled,rejected,readbackand the override file hash.stepDuration. The maneuver mapping test checksfrRampSteerDuration, the parameter that sets the executed duration.How to check
tests/test_modelica_runner_overrides.py.tests/test_maneuver.pypasses.matchfor every written override.Notes
Stack
2 of 7. On the BobLib-root guard.
Overlap
Conflicts with #151. #151 calls
_init_parameter_defaults(), which this PR removes, and passes a dict to_write_override_file, which now takes a plan. Fix: adduseRuntimeDamperTablesanddamperTableFileto the case before planning, and useinit_variables()for the "executable predates" check. Still unverified: whetherLOG_SOLVERechoes a String override such asdamperTableFile.