Derive Pot's L/Td from the Sud doc instead of a fixed server default
Sud now parses top-level L/Td fields from sude/*.json (defaulting to 0.2/30, matching the old hardcoded server constants), and derive_plant_params() returns them alongside M/C - constant for the whole brew, unlike M/C which vary per step with grain/water mass. All sude/*.json docs gain explicit L/Td fields. Callers (tasks/sud.py, SudForecastEstimator, demo_sud.py) switch from the narrow set_thermal_params(M, C)/set_model_params(M, C) to the full set_plant_params(params)/set_model_plant_params(params), since derive_plant_params() now always returns all four keys; both narrow setters are removed as dead code. Caught along the way: Pot.set_plant_params() unconditionally rebuilt the Delay ring buffer, which was harmless when only ever called once at construction - but now running on every Sud step change, it was wiping in-flight delayed power at each step boundary. Fixed to only rebuild when Td actually changes; verified this restores the exact original forecast result for sud_0010.json. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DkkuG48uHFCGKe6dPSERFk
This commit is contained in:
@@ -42,11 +42,7 @@ if __name__ == '__main__':
|
||||
sud.load(json.load(f))
|
||||
|
||||
first_step = sud.schedule[0]
|
||||
plant_params = {
|
||||
**sud.derive_plant_params(first_step['grain_mass'], first_step['water_mass']),
|
||||
"L" : 0.2,
|
||||
"Td" : 60
|
||||
}
|
||||
plant_params = sud.derive_plant_params(first_step['grain_mass'], first_step['water_mass'])
|
||||
|
||||
ctrl = TempController(dt)
|
||||
ctrl.set_params(ctrl_params)
|
||||
@@ -79,8 +75,8 @@ if __name__ == '__main__':
|
||||
|
||||
def apply_plant_params(step):
|
||||
params = sud.derive_plant_params(step['grain_mass'], step['water_mass'])
|
||||
plant.set_thermal_params(params['M'], params['C'])
|
||||
ctrl.set_model_params(params['M'], params['C'])
|
||||
plant.set_plant_params(params)
|
||||
ctrl.set_model_plant_params(params)
|
||||
|
||||
def on_step_changed(step):
|
||||
# A step may carry both 'ramp' and 'hold' (ramp to temp, then hold);
|
||||
|
||||
Reference in New Issue
Block a user