fix: stamp PlantParams with each logger's own elapsed, not Sud.elapsed
log_plant_params() stored whatever elapsed it was handed - always Sud.elapsed - regardless of which logger's own Samples.t timeline it needed to match. SudLogTask._elapsed() is Sud.elapsed, so its PlantParams lined up fine, but ServerLogTask._elapsed() is a separate tick counter since server startup - using Sud.elapsed there put PlantParams.t on a different scale than its own Samples.t entirely, causing utils/replay_sim.py to apply grain/water-mass changes at the wrong point when replaying a server-session log (spotted by comparing its output for log_latest.json vs log_latest_sud.json from the same session). Fixed by dropping the elapsed parameter - log_plant_params(params) now stamps with self._elapsed(), so each logger always uses its own correct timeline. Cascades into SudTask.set_on_plant_params()'s callback signature and its wiring in server/brewpi.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFDeoTKBDkXRhPfnyDEoBt
This commit is contained in:
+10
-2
@@ -32,8 +32,16 @@ class ServerLogTask(ATask):
|
||||
self._run_id = time.strftime("%Y%m%dT%H%M%S", time.localtime())
|
||||
self._last_write = time.monotonic()
|
||||
|
||||
def log_plant_params(self, elapsed, params):
|
||||
self._param_events.append({'t': elapsed, 'params': params})
|
||||
def log_plant_params(self, params):
|
||||
# Stamped with this logger's *own* _elapsed() - not, say, Sud.elapsed
|
||||
# passed in from the caller - so PlantParams' 't' always lines up
|
||||
# with this same log's own Samples' 't'. SudLogTask's _elapsed() IS
|
||||
# Sud.elapsed, but ServerLogTask's is its own independent counter
|
||||
# since server startup, on a completely different timeline (the
|
||||
# server usually starts well before any Sud does) - using the
|
||||
# wrong one made utils/replay_sim.py apply plant-param changes at
|
||||
# the wrong point in ServerLogTask's own Samples entirely.
|
||||
self._param_events.append({'t': self._elapsed(), 'params': params})
|
||||
|
||||
async def on_process(self):
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user