Skip to content

Datum: time-domain dynamics, jerk, hodograph & export#670

Merged
github-actions[bot] merged 1 commit into
mainfrom
claude/hopeful-keller-r4izrx
Jul 23, 2026
Merged

Datum: time-domain dynamics, jerk, hodograph & export#670
github-actions[bot] merged 1 commit into
mainfrom
claude/hopeful-keller-r4izrx

Conversation

@kkd16

@kkd16 kkd16 commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Session 6 — Datum comes alive

Datum already tells you where a driven mechanism sits and how fast it moves (exact velocity + acceleration off the constraint Jacobian). This session lets go of the crank: give the links mass and the mechanism runs under its own physics — a four-bar falls, swings, overshoots and settles under gravity, no driver.

The physics (the elegant part)

A well-constrained driven mechanism has exactly one degree of freedom, so its whole configuration is an implicit function x(θ) of a single generalized coordinate. The exact first- and second-order kinematic coefficients from Session 5 (x'=J⁺e_driver, x'') are precisely what a one-DOF Lagrangian needs, so the entire dynamics collapse to a single scalar ODE — the classical Eksergian equation of motion:

I(θ) θ̈ + ½ I′(θ) θ̇²  =  τ − c θ̇ − V′(θ)
  I(θ)=Σmᵢ|xᵢ′|²   I′(θ)=Σ2mᵢxᵢ′·xᵢ″   V′(θ)=g Σmᵢyᵢ′

Each RHS eval is one re-solve + one kinematics pass — machinery Datum already owns. Mass is lumped honestly (each link a uniform rod, mass split to its endpoints), making it a bona-fide Lagrangian system whose total energy is conserved exactly.

What's new

  • solver/dynamics.ts — the Eksergian EOM assembler + a substepped RK4 integrator; a live "Release & run" mode and a Dynamics panel (gravity / density / damping / torque sliders, kinetic+potential+total energy read-out and an energy-vs-time plot where T and V trade off while E stays flat — the visual proof of conservation).
  • solver/ad3.ts — a cubic-dual {v,d1,d2,d3} AD backend (a fourth instantiation of the one residual algebra, atan2 carried exactly to third order) giving the jerk field x‴(θ) = J⁺(−3x'ᵀHx″ − x'ᵀTx'x'), the mixed term recovered by polarising three hyper-dual passes; plotted alongside speed/accel for cam smoothness.
  • Hodograph — the tracer's velocity-vector-tip locus over a full cycle, with a min/max velocity-ratio and dead-point (mechanical-advantage → ∞) readout.
  • model/export.ts — the solved sketch to vector SVG (exact Béziers & arcs) and a real DXF (LINE / CIRCLE / ARC entities + sampled-spline LWPOLYLINEs, opens in any CAD), and the motion profile to CSV.

Verification

Self-test suite 32 → 41, each re-deriving a claim from an independent reference:

  • dynamics EOM vs the closed-form simple pendulum θ̈=−(g/L)cosθ — worst 2e-8
  • energy conservation of the free RK4 swing — drift ~3e-9·mgL
  • monotone dissipation under damping; static equilibrium (θ̈≈4e-15); I′(θ) vs finite-diff of I(θ) (~5e-5)
  • jerk vs a finite difference of the acceleration field (~2.7e-5)
  • SVG/DXF/CSV fidelity, with DXF arc angles round-tripped against arcGeom

Verified end-to-end headless in Chromium (four-bar swings under gravity, energy plot live, all three exports download valid files, hodograph + jerk curve render, 0 console errors) plus node scripts/verify-project.mjs datum-cad-9r4k (scope + conformance + lint + build all green).

🤖 Generated with Claude Code

https://claude.ai/code/session_01BzHyorzzwSMikwadDgjdyQ


Generated by Claude Code

Session 6 — release the driver and run the mechanism under its own physics.

- solver/dynamics.ts: single-DOF Eksergian equation of motion
  I(θ)θ̈ + ½I′θ̇² = τ − cθ̇ − V′, with I(θ), I′(θ), V′(θ) built from the exact
  first/second-order kinematic coefficients and lumped rod masses; substepped
  RK4 integrator. A live "Release & run" mode + Dynamics panel (gravity/density/
  damping/torque sliders, kinetic+potential+total energy read-out and plot).
- solver/ad3.ts: cubic-dual {v,d1,d2,d3} AD backend (a 4th instantiation of the
  one residual algebra, atan2 exact to 3rd order) → the jerk field x‴(θ), with
  the mixed term recovered by polarising three hyper-dual passes.
- Hodograph (velocity-vector-tip locus) + velocity-ratio / dead-point readout.
- model/export.ts: solved sketch → vector SVG and real DXF (LINE/CIRCLE/ARC +
  sampled-spline LWPOLYLINE), motion profile → CSV.
- Self-tests 32 → 41: dynamics vs closed-form pendulum θ̈=−(g/L)cosθ (2e-8),
  energy conservation (3e-9·mgL), monotone damped dissipation, I′ vs finite-diff,
  static equilibrium, jerk vs finite-diff of acceleration (2.7e-5), SVG/DXF/CSV
  fidelity. Verified headless in Chromium (0 console errors) + verify-project.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BzHyorzzwSMikwadDgjdyQ

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Scope + lint + build passed.

@github-actions
github-actions Bot merged commit 2b8dd21 into main Jul 23, 2026
2 checks passed
@github-actions
github-actions Bot deleted the claude/hopeful-keller-r4izrx branch July 23, 2026 22:37
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