You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
S3 — simulator shares the single O1 nominal_metrics; close the planner/sim divergence #284
Slice S3 of #136 — make the simulator share the single O1 motion model, closing the planner/simulator time divergence.
Problem
After S-bnd (#282) the simulator consumes the Motion IR but still runs its own hand-rolled time/tow pass that is deliberately G92-blind (if SET_POSITION: continue, marked minimal:). So PlanResultOut.timeSeconds (planner, via nominal_metrics) and SimulationResultOut.estimatedTimeSeconds (simulator) still disagree by construction across G92 (zero_axes) boundaries.
Approach
Replace the simulator's motion pass with a single call to nominal_metrics(program.moves, program.meta.mandrel_diameter) — the same G92-aware O1 model the planner uses. Motion math then lives in exactly one place; the simulator only counts (commands, moves) and derives the (now-degenerate) average_feed_rate_mmpm = distance/time*60.
Extend NominalMetrics with move_count (motion-producing moves, distance>0) so the simulator gets its moves count without re-deriving distance.
Drop the unused default_feed_rate/DEFAULT_FEED_RATE (a feed-before-set program now raises SimulationError, wrapped from nominal_metrics).
commands_executed = 1 + len(program.moves) (header + one per Move) — unchanged.
Acceptance
Simulator computes time/distance/tow solely via nominal_metrics; no motion math in simulator.py (grep).
NEW test: plan_wind(def).total_time_s == simulate_program(read_program(plan.commands)).estimated_time_sexactly for a G92-bearing golden (divergence closed by construction). Same for tow.
Regenerate the sim half of tests/sim_plot_snapshot.json (deliberate G92-aware delta: time/distance/tow shift to match the planner; commands_executed/moves stable; plot half unchanged — S4 owns the plotter G92 frame). Reviewed JSON diff.
Activity