FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0435 — RigidBarCable engine carries end control and error sum between OdeFcn calls
ID 0435
Class BUG
Severity 2
Status blocked

Models: Cable/RigidBarCable

Found: 2026-10-27, feature me-safety (MARE-0429 fix)

Decision needed: whether to make the end control a pure function of (T, X): the integral term from the EndNodeSum state instead of the member sum. It changes the model's results.

Evidence

src/cable/subroutines/RBCEngine.cpp (CalcAcc, fixed-fixed branch): m_endNodeSum[i] += nodeConstraint[i] (or =, by the sign of a dot product, and reset above maxSum = 10.01) and m_tau1ep[i] += m_kei*m_endNodeSum[i]. The sum is a member that every StateUpdate advances. The model has a state EndNodeSum (RigidBarCable.cpp: AddState("EndNodeSum", 3)), which the engine receives but does not use for the sum; OdeFcn writes the member sum to its derivative.

Effect

OdeFcn is not a function of (T, X): the result depends on how many evaluations ran before (integrator stages, Jacobian checks, rejected steps). Since MARE-0429 a port read saves and restores the history (RBCEngine::SaveHistory/RestoreHistory), so reads do not change the run, but a port read at the state OdeFcn just ran at can differ slightly from the force OdeFcn used. The header says the model "does not work as intended".

Possible fix

Use the EndNodeSum state as the integral of the end constraint (derivative = constraint), drop the member sum, the dot-product switch and the maxSum reset; remove SaveHistory/RestoreHistory.

Test that would prove it

OdeFcn twice at the same (T, X) gives the same derivative; a port read equals the force of OdeFcn at that state.

Risk

All RigidBarCable results move (RigidBarCable_Regression.ref). No input of fhsim_fishery, fhsim_base or fhsim_maritime uses the model (2026-10-27).