|
FhSim
3.1.0
Marine systems simulation
|
| ID | 0060 |
| Class | BUG |
| Severity | 2 |
| Status | ready |
| Models | Auv/CTD |
| Found | 2026-09-25, while working FISH-0051 |
| Decision needed | Model owner: wait for FHSIM-0025 (shared resources published before InitialConditionSetup, which fixes this with no change here), or work around it locally now (for example seed the lag states in FinalSetup, which is not allowed to set initial conditions, or leave them unset until a later pass, which the host does not offer once the environment is missing). Recommendation: wait for FHSIM-0025 and correct the misleading comment now. |
SensorCtd::InitialConditionSetup (src/auv/SensorCtd.cpp:238-263) resolves the environment and seeds the three lag states from the field at the sensor:
FhSim publishes shared resources only after every InitialConditionSetup has run (FHSIM-0025: fhsim/src/simobject/SimObjectOrganizer.cpp:47-54, called at fhsim/src/engine/model/ModelAssemblyService.cpp:103), so GetSharedResource("Environment") returns null here. FieldValuesAt then returns the defaults of FieldValues (src/auv/SensorCtd.h:387-391), 0 degC and 0 PSU, and those become the initial conditions of LagT and LagS. Checked at HEAD 2026-09-25: the log of Auv_CtdStatic says "CtdOrigin
tried to access a shared resource Environment which is unset or set to a null pointer", and its CtdOrigin.LagT_0 and LagS_0 are 0 at every output time while Temperature_0 is 8.975 degC and Salinity_0 34.34 PSU.
With a non-zero time constant (the defaults are 0.07 s, 0.06 s and 0.02 s) the measured temperature and salinity start at 0 and relax towards the field over a few time constants, so the first samples of every CTD record are wrong: the default thermistor reads 0 degC at t = 0 and is still about 1 % short after 0.3 s. The regression fixtures hide it: Auv_CtdStatic uses zero time constants, where the lag state is not read, and the field of Auv_CtdRamp is 0 at the start position. LagD is seeded from the position, not the environment, and is right.
InitialConditionSetup; the existing code then works as its comment says, with no change here.:244-246, which states the opposite of what happens.In tests/AuvCtd_Test.cpp, a fixture with the default time constants and a field that is not zero at the start position: at t = 0, LagT_0 and Temperature_0 must equal the field there. Fails today (both 0).
None for option 2. Option 1 changes the first seconds of every CTD result with a non-zero time constant; baselines that record them move.
Karl-Johan Reite: wait for FHSIM-0025 for the real fix; correct the misleading code comment in SensorCtd now, and record in this issue that it stays open until FHSIM-0025 lands. Do not resolve it.
The comment in SensorCtd::InitialConditionSetup (src/auv/SensorCtd.cpp:244-249) is corrected: it now says that GetSharedResource returns null there until FHSIM-0025 lands, so LagT and LagS open at 0. Comment only; no behaviour change. The issue stays open until FHSIM-0025 lands.