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,8 +42,15 @@ class Pot(APlant):
|
||||
# P_loss = L * Mass * (T_plant - T_ambient)
|
||||
self.L = params['L']
|
||||
|
||||
self.Td = params['Td']
|
||||
self.delay = delay.Delay(self.dt, self.Td, 0)
|
||||
# Only rebuilds the delay line if Td actually changed - this now
|
||||
# gets called on every Sud step change (M/C vary with grain/water
|
||||
# mass), not just once at construction, and rebuilding unconditionally
|
||||
# would zero out whatever power was already in flight through the
|
||||
# transport delay at every single step transition.
|
||||
Td = params['Td']
|
||||
if Td != self.Td:
|
||||
self.Td = Td
|
||||
self.delay = delay.Delay(self.dt, self.Td, 0)
|
||||
|
||||
def set_ambient_temperature(self, theta_amb):
|
||||
self.theta_amb = theta_amb
|
||||
@@ -84,10 +91,6 @@ class Pot(APlant):
|
||||
def is_activated(self):
|
||||
return True
|
||||
|
||||
def set_thermal_params(self, M, C):
|
||||
self.M = M
|
||||
self.C = C
|
||||
|
||||
def set_power(self, power):
|
||||
self.p_in = power
|
||||
|
||||
|
||||
Reference in New Issue
Block a user