Skip to content

cvc::ph: a convoy formation as a power-preserving interconnection, measured - #1242

Merged
transfix merged 1 commit into
feat/ph-composefrom
exp/ph-convoy-formation
Nov 15, 2026
Merged

transfix merged 1 commit into
feat/ph-composefrom
exp/ph-convoy-formation

Conversation

@transfix

Copy link
Copy Markdown
Owner

This PR measures whether a convoy holds its formation better when the formation linkage is a power-preserving port-Hamiltonian interconnection, built on cvc::ph composition (#1227), than when each follower chases its slot. It is a measurement only: no library code changes, just a test and a write-up.

Stacked on #1227 (base feat/ph-compose). It merges only after #1227, and like #1227 only on Joe's OK. The licence note on #1227 applies here too.

The answer: no

The full write-up with every table is docs/roadmap/PH-CONVOY-FORMATION.md. The setup: point masses on a straight road, 5 vehicles in a column and in a wedge tree, a speed step (4 → 8 m/s) and an emergency stop (8 → 0 m/s).

  • The pH formation against slot chasing.
    • It ends on the slot; slot chasing ends 20 m behind it at 8 m/s.
    • It settles more slowly (24 s against 14.5 s on the column's step) and overshoots (38% against 0%).
    • In the stop it comes closer (12.4 m against 21.9 m) and then backs up at 4.4 m/s.
  • The pairing is not what helps. The same link laws pulling only the follower have a smaller peak error, settle faster and keep a larger gap in every scenario. This holds with and without the lead's broadcast speed. What holds the slot is constant spacing and the relative speed.
  • What the pairing does buy is robustness.
    • Disturbances do not grow down the column (spacing-error ratio 0.83, against 1.18 one-way).
    • Errors stay bounded at any length and any gains. The one-way links collide at 20 vehicles, and at 5 vehicles when lightly damped.
    • The cost: settling grows as N² (24 / 102 / 385 s at 5 / 10 / 20 vehicles), and the link off the lead carries the whole column.
  • Energy. There is no saving. The per-link books show where a manoeuvre's energy goes (47% into the link off the lead). That energy is virtual, though, not fuel.
  • Verdict. Convoys are no reason for Phase 5's state-dependent port maps, and a full-simulation trial of the pH linkage is not recommended.

A limit of the split step it found

The lead's speed was first fed to the links off it as a flow input. With that wiring, the split step lets a link's state creep from the geometry even at a steady cruise: 9.45 cm in 90 s with 2 substeps, 2.36 cm with 4. The lead's speed reaches the link in the local step while the follower's reaches it in the coupling half-steps, so each substep leaves a ±v·d/2 elongation that the stiff branch turns into force.

The composite is therefore written in the lead's frame, where it does not creep. PH-COMPOSE-ROADMAP.md's limits now say so.

What is in it

  • src/cvc/tests/ph_convoy_test.cpp builds followers as canonical_law point masses and links as linear_law storage (slot spring plus a Maxwell dashpot branch), wired by connect_incidence over the linkage. Its tests:
    • TheCompositeIsTheFormationItStandsFor: the composite against an independent RK4 of the same equations, within 4 mm over 90 s for every pH law, both wirings and both scenarios. The books close to 3e-3 J/kg per run. check_balance_random on both wirings with the same law objects.
    • AFlowInputOnALinkCreepsUnderTheSplitStep: pins the creep.
    • FollowLawsOnTheStepAndTheStop: the 5-vehicle matrix. It prints the tables and pins the write-up's comparisons.
    • ColumnLength and LinkGains (about 4 min): skipped unless CVC_PH_CONVOY_EXPERIMENTS=1.
  • docs/roadmap/PH-CONVOY-FORMATION.md: the write-up.
  • docs/roadmap/PH-COMPOSE-ROADMAP.md: a line in Phase 5 and one in the limits, both pointing to the write-up.

Checked locally

On Linux Release, GCC 13: ctest -R PhConvoy gives 3 passed and 2 skipped (about 17 s). The experiments also ran with CVC_PH_CONVOY_EXPERIMENTS=1. clang++-18 -std=c++17 -Wall -Wextra is clean, and so is clang-format-18 --dry-run --Werror.

…tion

ph_convoy_test builds a convoy's formation linkage as a cvc::ph composite: followers as
point-mass canonical blocks, links as linear storage blocks wired by connect_incidence. It
compares that formation with slot chasing and with the same links pulling one way, on a speed
step and an emergency stop, for a column and a wedge, and checks the composite against an RK4 of
the same equations.

docs/roadmap/PH-CONVOY-FORMATION.md has the numbers. The pairing keeps errors bounded at any
column length and any gains. It loses on peak error, settling, overshoot and closest approach,
both to slot chasing and to the one-way links with the same information. So convoys are no
reason for Phase 5's state-dependent port maps.

It also records a limit of the split step: a flow source fed to a line through its input lets
the line's state creep from the geometry at a steady state. The composite is therefore written
in the lead's frame.
@transfix
transfix merged commit df8097a into feat/ph-compose Nov 15, 2026
6 checks passed
@transfix
transfix deleted the exp/ph-convoy-formation branch November 15, 2026 05:23
transfix added a commit that referenced this pull request Nov 15, 2026
… Phase 1) (#1227)

Port-Hamiltonian components joined by power-preserving ports (linear_law, canonical_law with MLP pieces), the skew pairing, the composed field, the split transition with Euler or midpoint coupling, per-step books in dyn_ph_books, cvc-ph-law/1 and cvc-ph-system/1 files, cvc ph info|simulate|check and pycvc ph_composite. Parity with CVC-Lab/phast to rounding on four microgrid fixtures; the convoy study (#1242); the C-PHAST plan through Phase 6.

The method is C-PHAST, by Shubham Bhardwaj and Chandrajit Bajaj. Merged on Joe's OK with the authors' LGPL-2.1 permission still pending.
transfix added a commit that referenced this pull request Nov 16, 2026
* cvc::ph composition: composed port-Hamiltonian systems

Port-Hamiltonian components joined by power-preserving ports: block laws with
typed ports (linear_law; canonical_law with optional MLP potential, mass and
damping), the skew pairing from explicit pairs, an incidence matrix or a dense
rule, the composed field and power terms, a split transition (Euler or
midpoint coupling) with whole-field RK4 and implicit-midpoint references,
per-step energy books in dyn_ph_books, cvc-ph-law/1 and cvc-ph-system/1
files, cvc ph info|simulate|check, and pycvc ph_composite.

The method is C-PHAST, by Shubham Bhardwaj and Chandrajit Bajaj.

* cvc::ph composition: parity with CVC-Lab/phast, and the C-PHAST plan

docs/roadmap/PH-COMPOSE-ROADMAP.md maps the composition to the C-PHAST paper
(Shubham Bhardwaj and Chandrajit Bajaj) and plans phases 2-5.
src/cvc/tools/cphast_fixtures.py runs phast's own torch modules in float64
(it imports phast and copies none of it) and writes
tests/data/ph_compose_golden.json; ph_compose_parity_test replays its four
microgrids to rounding (3.1e-15 to 6.7e-15 over 200 steps).

This port of C-PHAST needs Shubham Bhardwaj's and UT CVC-Lab's permission to
license it LGPL-2.1 before it merges.

* PH-COMPOSE roadmap: Phase 6, the C-PHAST lab on MuJoCo (Go2 first)

* cvc::ph microgrids: the C-PHAST DC microgrid study (Phase 2)

Capacitor curves on canonical_law (the reference DGU's q = 2.2 (v + v^3/3)),
storage_from_efforts (physical voltages and currents to charges and fluxes),
assign_state (a candidate's start), law_json / system_json, and
cvc/ph/microgrid.h: DGU and line presets, make_microgrid, trajectory errors.
cvc ph microgrid and simulate --physical; pycvc storage, system_json and
ph_microgrid_json.

The candidate study (four-DGU chain, a fifth DGU at bus 0 or bus 2, 16
episodes) against RK4 at dt/16: midpoint coupling 5.1e-7 V voltage RMSE and
5.7e-8 A peak line-current error, Euler 7.9e-5 V and 2.4e-4 A; both order all
16 candidate pairs.

* ph_microgrid_test: clang-format

* cvc::ph: a convoy formation as a power-preserving interconnection, measured (#1242)

ph_convoy_test builds a convoy's formation linkage as a cvc::ph composite: followers as
point-mass canonical blocks, links as linear storage blocks wired by connect_incidence. It
compares that formation with slot chasing and with the same links pulling one way, on a speed
step and an emergency stop, for a column and a wedge, and checks the composite against an RK4 of
the same equations.

docs/roadmap/PH-CONVOY-FORMATION.md has the numbers. The pairing keeps errors bounded at any
column length and any gains. It loses on peak error, settling, overshoot and closest approach,
both to slot chasing and to the one-way links with the same information. So convoys are no
reason for Phase 5's state-dependent port maps.

It also records a limit of the split step: a flow source fed to a line through its input lets
the line's state creep from the geometry at a steady state. The composite is therefore written
in the lead's frame.
transfix added a commit that referenced this pull request Nov 17, 2026
…ied ranking (Phase 3) (#1287)

* cvc::ph composition: composed port-Hamiltonian systems

Port-Hamiltonian components joined by power-preserving ports: block laws with
typed ports (linear_law; canonical_law with optional MLP potential, mass and
damping), the skew pairing from explicit pairs, an incidence matrix or a dense
rule, the composed field and power terms, a split transition (Euler or
midpoint coupling) with whole-field RK4 and implicit-midpoint references,
per-step energy books in dyn_ph_books, cvc-ph-law/1 and cvc-ph-system/1
files, cvc ph info|simulate|check, and pycvc ph_composite.

The method is C-PHAST, by Shubham Bhardwaj and Chandrajit Bajaj.

* cvc::ph composition: parity with CVC-Lab/phast, and the C-PHAST plan

docs/roadmap/PH-COMPOSE-ROADMAP.md maps the composition to the C-PHAST paper
(Shubham Bhardwaj and Chandrajit Bajaj) and plans phases 2-5.
src/cvc/tools/cphast_fixtures.py runs phast's own torch modules in float64
(it imports phast and copies none of it) and writes
tests/data/ph_compose_golden.json; ph_compose_parity_test replays its four
microgrids to rounding (3.1e-15 to 6.7e-15 over 200 steps).

This port of C-PHAST needs Shubham Bhardwaj's and UT CVC-Lab's permission to
license it LGPL-2.1 before it merges.

* PH-COMPOSE roadmap: Phase 6, the C-PHAST lab on MuJoCo (Go2 first)

* cvc::ph microgrids: the C-PHAST DC microgrid study (Phase 2)

Capacitor curves on canonical_law (the reference DGU's q = 2.2 (v + v^3/3)),
storage_from_efforts (physical voltages and currents to charges and fluxes),
assign_state (a candidate's start), law_json / system_json, and
cvc/ph/microgrid.h: DGU and line presets, make_microgrid, trajectory errors.
cvc ph microgrid and simulate --physical; pycvc storage, system_json and
ph_microgrid_json.

The candidate study (four-DGU chain, a fifth DGU at bus 0 or bus 2, 16
episodes) against RK4 at dt/16: midpoint coupling 5.1e-7 V voltage RMSE and
5.7e-8 A peak line-current error, Euler 7.9e-5 V and 2.4e-4 A; both order all
16 candidate pairs.

* ph_microgrid_test: clang-format

* cvc::ph: a convoy formation as a power-preserving interconnection, measured (#1242)

ph_convoy_test builds a convoy's formation linkage as a cvc::ph composite: followers as
point-mass canonical blocks, links as linear storage blocks wired by connect_incidence. It
compares that formation with slot chasing and with the same links pulling one way, on a speed
step and an emergency stop, for a column and a wedge, and checks the composite against an RK4 of
the same equations.

docs/roadmap/PH-CONVOY-FORMATION.md has the numbers. The pairing keeps errors bounded at any
column length and any gains. It loses on peak error, settling, overshoot and closest approach,
both to slot chasing and to the one-way links with the same information. So convoys are no
reason for Phase 5's state-dependent port maps.

It also records a limit of the split step: a flow source fed to a line through its input lets
the line's state creep from the geometry at a steady state. The composite is therefore written
in the lead's frame.

* cvc::ph queries: the history fit, consequences, action cards and the certified ranking (Phase 3)

fit_history estimates a system's present state from measured channels over a
window (the C-PHAST voltage-history fit: Levenberg-Marquardt over the
prior-scaled physical state at the window start, through the frozen
transition), with success, optimality, data-Jacobian rank and a Laplace
posterior; posterior_states samples it. consequences reads each step's
readout and energy channels; make_card summarizes a candidate; rank_candidates
admits candidates by limits with their bounds and orders them only where the
bounds separate (certified, inconclusive or abstain); sampled_bounds gives
sampled bounds. Microgrid helpers: the readout channels and the studies' prior.

On the four-DGU chain, from clean voltages: forecast RMSE at 0.5 s 0.29 mV,
26 mA (DGU), 22 mA (line), against the paper's 0.36 mV, 26 mA, 25 mA; a
symmetric cycle loses one rank and is not admitted; no certificate is wrong.

* cvc::ph query.h: clang-format

* cvc::ph queries: pycvc fit_history, card and ph_rank; docs
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.

1 participant