Repository navigation
refactor(simulation): adopt the single O1 nominal_metrics; close the planner/sim divergence (S3) - #285
Merged
Conversation
…divergence The simulator now derives time/tow from `nominal_metrics` — the same G92-aware O1 model the planner uses — instead of its own hand-rolled, G92-blind pass. Motion math lives in exactly one place; the simulator only counts commands and reports the shared metrics, so `PlanResultOut.timeSeconds` and `SimulationResultOut.estimatedTimeSeconds` agree by construction (up to G-code emitted-precision rounding, asserted by a new planner/simulator agreement test). `NominalMetrics` gains `move_count` (motion-producing moves) so the simulator's `moves` count needs no separate distance pass. The unused `default_feed_rate`/ `DEFAULT_FEED_RATE` are dropped (a feed-before-set program now raises SimulationError, wrapped from nominal_metrics). The sim half of `sim_plot_snapshot.json` is regenerated: estimated time / distance / tow drop to the G92-aware values (e.g. multi_layer 1733.98s -> 905.47s, matching the planner total); `commands_executed` and `average_feed_rate_mmpm` are stable and the plot half is untouched (the plotter G92 frame is S4). SimulationResult shape is unchanged (no OpenAPI drift); example G-code stays byte-equal. Closes #284. Part of #136.
15 tasks done
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.
S3 of #136 — closes #284.
The simulator now derives time/tow from
nominal_metrics(the same G92-aware O1 model the planner uses) instead of its own hand-rolled, G92-blind pass. Motion math lives in one place —simulator.pyhas zero motion math now (grep: nosqrt/arc). The historical planner/simulator divergence is closed by construction.The proof
New
test_planner_and_simulator_time_agree_by_construction:plan_wind(def).total_time_s == simulate_program(read_program(plan.commands)).estimated_time_s(rel 1e-7 — the only residual is G-code emitted-precision rounding; the planner reports full-precision floats).Reviewable delta — sim half of
sim_plot_snapshot.jsonregeneratedG92-aware time/distance/tow drop to match the planner (e.g.
multi_layer1733.98s → 905.47s = the planner total).commands_executedandaverage_feed_rate_mmpmare stable; the plot half is untouched (the plotter G92 frame is S4).Other
NominalMetricsgainsmove_countso the simulator'smovesneeds no separate distance pass.default_feed_rate/DEFAULT_FEED_RATE.SimulationResultshape unchanged → no OpenAPI drift; example G-code byte-equal; 153 passed; ruff/format/mypy clean.Part of #136. Follows S-bnd (#282/#283); precedes S4 (plotter geometry) and S5 (cleanup).