FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0025 — `RbCable/Cable` documents the `RBCABLE_CLASSIC_INTERFACE` branch, but no build defines that macro
ID 0025
Class BUG
Severity 3
Status blocked
Models RbCable/Cable
Found 2026-09-15 fix pass (new finding)
Decision needed Which RbCable/Cable interface is intended for 3.x: the documented classic branch (define RBCABLE_CLASSIC_INTERFACE) or the compiled one (document it and declare the classic branch dead)?

Evidence

src/RMCable/Cable.cpp compiles one of two interfaces, chosen by a preprocessor macro: :30-48 (#ifdef RBCABLE_CLASSIC_INTERFACE) reads Length, numElements, AlphaN, BetaN, EpsilonN, AlphaM, BetaM, EpsilonM, AlphaT, BetaT, EpsilonT, Weight, Radius; :49-94 (#else) reads cableLength, numElements, diameter, cableWeight, E-modulus, G-modulus (default E/2.6), damping (default 1), updateFreq, stabilityFactor (default 1.1) and derives the Baumgarte parameters from them. The same macro selects the port names: :95-101 (forceA/forceB vs ForceA/ForceB) and :120-137 (posA, posB, velA, velB, retractedLengthA/B, retractedSpeedA/B vs PositionA, PositionB, VelocityA, VelocityB, RetractedLengthA/B, RetractedSpeedA/B).

A grep for RBCABLE_CLASSIC_INTERFACE across src/, CMakeLists.txt, cmake/ and conanfile.py finds only the #ifdef lines themselves (and the dead src/RMCable/CoRiBoCable.cpp_). Nothing defines it, so every build compiles the #else branch.

src/RMCable/Cable.h:73-108 documents the classic branch only: input ports posAretractedSpeedB, output ports forceA/forceB, parameters Length, numElements, AlphaNEpsilonT, Weight, Radius. openwiki/simobjects/rigid-body-cables.md:134-150 restates the same. No example under examples/input/ and no test fixture under tests/in/ instantiates RbCable/Cable, so nothing in the repository exercises either branch.

Effect

A user following the documentation for RbCable/Cable fails at model assembly: the compiled branch reads cableLength, diameter, cableWeight, E-modulus and updateFreq with no default, so the first of them that is missing raises a parameter-not-found error, and every documented port name is unknown to the object. Conversely, the parameters and ports that do work — cableLength, E-modulus, PositionA, ForceA, … — are documented nowhere.

Possible fix

  • (a) Document the compiled (#else) branch as the interface of RbCable/Cable and either delete the classic branch or mark it in the documentation as an opt-in build flag.
  • (b) Define RBCABLE_CLASSIC_INTERFACE in src/RMCable/CMakeLists.txt so the documented interface is the one that is built.
  • (c) Delete whichever branch is not wanted.

Owner question, open

which of the two interfaces is the intended one for the 3.x line? The #else branch is the more recent (its comments are dated 2024 and it carries the kelp-rope extension in both branches), which suggests (a); but the documentation, the rmcable1.png figure and the parameter-tuning guidance in the header all describe the classic one. Only the owner can say. Until then, neither the code nor the documentation should be changed — (a) and (b) each make one set of existing input files stop working.

Test that would prove it

A test that instantiates RbCable/Cable from an input written from the header documentation. It fails today at parameter lookup and passes under (b); under (a) the equivalent test is written from the new documentation.

Risk

Option (b) changes which parameters an existing RbCable/Cable input needs and how the Baumgarte constants are derived — a results change for every current user of the object. Option (a) is documentation-only if the classic branch is merely marked opt-in, and a removal of a compiled-out feature if it is deleted.


Why not solved (fix pass 2026-09-15)

New finding, recorded during the fix pass and not fixed. RBCABLE_CLASSIC_INTERFACE is defined nowhere in src/, CMakeLists.txt, cmake/ or conanfile.py, so every build compiles the #else branch of src/RMCable/Cable.cpp:30-137, while Cable.h:73-108 and the OpenWiki page document only the classic branch. Documenting the compiled branch instead is documentation-only, but it declares the classic branch dead; defining the macro so the documented interface is built changes which parameters an existing RbCable/Cable input needs and how the Baumgarte constants are derived. No example or test in the repository instantiates RbCable/Cable, so there is no evidence of which interface users rely on. Only the owner can say which interface is intended for 3.x. This finding is also recorded as item 0025 in the codebase's REVIEW_ISSUES.md.