FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0049 — CNorrbinTanker does not report an unknown `ModelType` and silently uses the `bernica` data
ID 0049
Class BUG
Severity 2
Status blocked
Models Vessels/Tanker
Found 2026-09-26 OpenWiki pass, confirmed at 3882e45
Decision needed Should an unknown ModelType be reported as an error, like an unknown DataSet or RudderType, or is the fallback to bernica intended?

Evidence

src/vessel/CNorrbinTanker.cpp:37 sets m_tankerType = 8 (the bernica column) before any parameter is read. Lines 41-76 read ModelType, lower-case it and branch on lb-series, geosim-series and bernica; the chain ends at line 74-76 with } else if (modelType == "bernica") { m_tankerType = 8; } and has no final else. Any other value leaves m_tankerType at 8 with no message. The sibling parameters do report: an unknown DataSet reaches pCreator->ReportError("Unknown <DataSet> variable for ...") at lines 58 and 72, and an unknown RudderType reaches pCreator->ReportError("Unknown parameter for <RudderType>, ...") at line 90.

A missing ModelType is reported: the one-argument GetStringParam calls ReportParameterError(parameter, "requested but not found") (fhsim, src/simobject/SimObjectOrganizer.cpp:275-284). Only a present but unrecognised value is silent. The header already documents the fallback (src/vessel/CNorrbinTanker.h:104: "Any other value is not reported and selects the `bernica` data"), so the code matches its own documentation; it does not match its siblings.

Code trace only; no test sets an unknown ModelType.

Effect

A misspelt series, for example ModelType="lb_series" or "LB series" with DataSet="20000dwt", runs the Esso Bernicia coefficients instead of the 20,000 dwt tanker, and ignores DataSet altogether, with nothing in the log. The simulated vessel is a different ship.

Possible fix

Add else pCreator->ReportError("Unknown <ModelType> ...: allowed values lb-series|geosim-series|bernica") after line 76, and change the header's ModelType row to say that other values are errors. Alternatively keep the fallback and log a warning naming the value.

Test that would prove it

A SimObj-NorrbinTanker variant with ModelType="lb_series" expects the model setup to fail (or, for the warning option, the log to name the value).

Risk

An input file that relies on the fallback, for instance one with an empty or misspelt ModelType that has always run as bernica, would stop loading. No shipped input or test in this repository sets ModelType to anything other than the three accepted values.