FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0004 — The shipped CoriboCable.xml example stops before the first step: cableStates initial conditions are incomplete
ID 0004
Class BUG
Severity 3
Status blocked
Models WinchableCable
Found 2026-09-24 issue-resolution pass at 6921106 (local Release/Vis build against fhsim 3.2.0, Linux/WSL2)
Decision needed Model owner (WinchableCable author or maintainer): is WinchableCable expected to run on FhSim 3.x at all, and if so, which states is SupergridWinchCable::InitialConditionSetup meant to leave to the engine?

Evidence

Reproduction, from a scratch working directory that contains a copy of data/winch_init_states.dat and a SimObjectLibraries link to the build's playpen:

FhSim -i examples/input/CoriboCable.xml -o out.csv -c 2
[Info] Registered the output port WinchForce with size 6
[Info] Registered the state cableStates with size 15600
[ERROR] One or more initial conditions are not specified.
SimObject: CoriboCable States: cableStates
FhSim caught an exception: One or more initial conditions are not specified.

Exit code 1, no output file. The result is the same with the file named winch_init_states.data, with no init-states file at all, and when run from playpen/bin. The example XML has an empty <InitialConditions />, so every one of the 15600 cableStates entries must come from WinchableCable::InitialConditionSetup (src/SimObjects/WinchableCable.cpp:104-112). That function calls SupergridWinchCable::InitialConditionSetup (src/Structures/SupergridWinchCable.cpp:184-232), which returns bool. WinchableCable throws the return value away. The function can return false early without writing anything to updatedIC (lines 187-190, and 213-215 after the winch geometry has already been loaded and the elements allocated), and even when it returns true it writes only what InitializeFreespanCurve fills in. The engine reports any state that is still NaN after the InitialConditionSetup passes (fhsim/src/engine/model/ModelAssemblyInitialConditions.cpp:320).

The class comment already warns that the model "may not work (at least not on Linux)" (include/fhsim_coribo/WinchableCable.h:37-42). The init-states file is a raw fstream::read of Winch::AttachedElement (src/Structures/Winch.cpp:1246-1256), a struct that holds a DiscreteElement* and Eigen members (include/fhsim_coribo/Winch.h:75-83). The file therefore depends on the struct layout of whichever compiler wrote it (1951104 bytes).

Effect

The library's only SimObject does not run from its only shipped example. Neither a user nor a regression test (CORIBO-0001) can run it. A green conan create does not show this, because test_package only constructs the object.

Why this was not fixed

To find which states stay unset, you have to instrument or step through the constraint and cable initialisation (InitializeElementAllocation, InitializeFreespanCurve, the winch geometry loader). A fix means choosing initial states for a physical cable: supplying them in the XML, changing what InitialConditionSetup writes, or regenerating winch_init_states.dat for the current struct layout. Any of these sets the model's starting physics, so the owner must decide.

Possible fix

  1. Find out which cableStates indices are still NaN, for example by logging the NaN count in updatedIC after m_cable->InitialConditionSetup returns, and check its bool result.
  2. Depending on the cause: fill the missing states in SupergridWinchCable, or regenerate winch_init_states.dat, or replace it with a portable text format.
  3. After that, add the regression test that CORIBO-0001 asks for.

Test that would prove it

The command above exits 0 and writes out.csv with finite values in WinchForce. This is the scenario that CORIBO-0001 would pin as a test.

Risk

Any fix changes the model's initial state and therefore its results. No baseline exists today, because the model does not run.