FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0073 — SeineOperation header derives L2 with a factor 2 the code does not use, and calls the isosceles path equilateral
ID 0073
Class DOCUMENTATION
Severity 1
Status blocked
Models Seine/Operation
Found 2026-09-26, OpenWiki pass
Decision needed Confirm that the code's leg lengths (L2 = L sin(α/2) / (1 + sin(α/2))) are the intended set path, so that the header, not the code, is corrected.

Evidence

src/seine/SeineOperation.h:53-62:

  • line 53: "L1 and L2 are the sides of the equilateral triangle that forms the path";
  • line 58: \(2\sin(\alpha/2) = (L_2/2)/L_1\);
  • line 61: \(L_2 = L / (1 + 1/(2\sin(\alpha/2)))\);
  • line 62: \(L_1 = L_2 / (4\sin(\alpha/2)) = (L - L_2)/2\).

src/seine/SeineOperation.cpp:78-81:

double totalTrackLength = m_setWarpLength * 2.0 + m_addedTrackLength;
// double dL2 = totalTrackLength / (1.0 + 0.5 / (sin(m_spreadAngle*0.5)));
double dL2 = totalTrackLength * sin(m_spreadAngle * 0.5) / (1.0 + sin(m_spreadAngle * 0.5));
double dL1 = 0.5 * (totalTrackLength - dL2);

i.e. \(L_2 = L / (1 + 1/\sin(\alpha/2))\). The commented-out line is the header's formula; the live line differs by the factor 2. dL1 and dL2 set the phase start times (SeineOperation.cpp:85-88), so the code's formula is what runs.

Which one the geometry supports, derived from the headings the same constructor sets (SeineOperation.cpp:69-72), with the tow heading \(\psi\) as reference: the first leg runs at \(\psi + \pi - \alpha/2\), the net leg at \(\psi + 3\pi/2\) (square to the tow line), the second leg at \(\psi + \alpha/2\). The lateral components are \(L_1\sin(\alpha/2)\), \(-L_2\) and \(L_1\sin(\alpha/2)\), and the along-tow components of the two legs cancel. The path closes when \(L_2 = 2L_1\sin(\alpha/2)\), i.e. \(\sin(\alpha/2) = (L_2/2)/L_1\): an isosceles triangle with apex angle \(\alpha\) at the start, equilateral only for \(\alpha = 60°\). With \(L = 2L_1 + L_2\) this gives \(L_2 = L/(1 + 1/\sin(\alpha/2))\) and \(L_1 = L_2/(2\sin(\alpha/2))\), which is the code. The header's line 58 has a spurious factor 2 on the left, and lines 61-62 follow from it consistently. With the header's lengths ( \(L_2 = 4L_1\sin(\alpha/2)\)) the path would not close: the lateral sum would be \(-2L_1\sin(\alpha/2)\).

Effect

Readers only, if the code is the intent: the documented formulas and "equilateral" do not describe the run. If the owner instead intends the header's lengths, the net leg and the phase start times of every seine run are wrong (severity 3), which is why this is blocked.

Possible fix

If the code is confirmed: correct SeineOperation.h:53,58,61,62 to "isosceles triangle with apex angle α", \(\sin(\alpha/2) = (L_2/2)/L_1\), \(L_2 = L/(1 + 1/\sin(\alpha/2))\), \(L_1 = L_2/(2\sin(\alpha/2))\), and delete the stale commented-out line at SeineOperation.cpp:79. Check that doc/images/SeineOperation.jpg agrees.

Test that would prove it

A test that runs the set phases with the vessel's own heading and speed and asserts that the vessel is back at its start point, laterally, at Phase_Towing's start time.

Risk

None for the documentation change. Changing the code instead would move every seine regression baseline.