FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0084 — HydroCable and CablePendulum repeat the node position and velocity lookup in Drag, Spring and StructuralForce
ID 0084
Class ARCHITECTURE
Severity 1
Status ready

Models: —

Found: 2026-10-20 architecture review (dfe6709); owner ruled "default ok" on the whole plan 2026-10-20

Source plan: plans/arch-2026-10-20/not-implemented/f2-segment-chain-base.md (workspace fhsim_workspace)

Kind: Bit for bit refactor. Take when passing; rides with: the next base feature (same as the Cable.cpp item).

Evidence

src/kalman/HydroCable.cpp:215-306 (Drag, Spring, StructuralForce) and src/adaptive/CablePendulum.cpp:504-596 (same three functions) each repeat the same lookup of node position and velocity for segment ends. The shape is the same; end B differs (an input port in HydroCable, the ball's own state in CablePendulum). The rest of the segment physics is already shared (CableSegmentStructuralJacobian.h, CableSegmentDrag.h).

Effect

None for users. About 90 lines per class are copy-paste lookups; a change to the node layout must be made twice per function.

Possible fix

One per-class private helper (not a shared chain module, which F2 rejected) that returns the position and velocity of node k, and use it in the three functions.

Test that would prove it

Existing HydroCable and CablePendulum regressions, byte compared before and after.

Risk

Very low. Keep the end-B difference inside each class's helper.