Skip to content

Reject Modelica runtime overrides that cannot take effect - #153

Merged
raorjun merged 4 commits into
fix/generator-boblib-rootfrom
fix/runner-overrides
Oct 29, 2026
Merged

raorjun merged 4 commits into
fix/generator-boblib-rootfrom
fix/runner-overrides

Conversation

@raorjun

@raorjun raorjun commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

What

Any BobSim user hits this with the default car:

  • The runner dropped an override that was not in the init XML, and logged nothing. A typo in simulation.init_parameters gave a run that looked valid.
  • The executable ignores an override of a calculated parameter, writes one run.log warning, and exits 0.
  • TransientEval sent stepDuration. StandardVCU binds it to frRampSteerDuration, so that override was a silent no-op.

Changes

  • The runner plans every case against the init XML before any process starts. One OverrideError lists every rejection: unknown_name, not_changeable, no_start_value, invalid_value, conflicting_aliases, missing_init_xml.
  • It forces LOG_SOLVER, reads back each applied override from run.log, and fails with not_applied on a refusal, a mismatch or a missing readback line.
  • The manifest records requested, written, already_compiled, rejected, readback and the override file hash.
  • TransientEval no longer sends stepDuration. The maneuver mapping test checks frRampSteerDuration, the parameter that sets the executed duration.

How to check

  • tests/test_modelica_runner_overrides.py. tests/test_maneuver.py passes.
  • Real runs before the rebase: FourPost and all 10 VehicleSim transient runs read back match for 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: add useRuntimeDamperTables and damperTableFile to the case before planning, and use init_variables() for the "executable predates" check. Still unverified: whether LOG_SOLVER echoes a String override such as damperTableFile.

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.
@raorjun
raorjun added this pull request to stack #159 October 25, 2026 00:43
@raorjun
raorjun requested a review from rhorvath02 October 25, 2026 02:44
@raorjun
raorjun merged commit fa62abc into main Oct 29, 2026
5 of 6 checks passed
@raorjun
raorjun deleted the fix/runner-overrides branch October 29, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants