Add set_model_power no-op stub to TempControllerBase
The Normal controller had no set_model_power(), causing callers to guard with hasattr() instead of relying on a stable interface. Adding a no-op stub to the base class means all controllers have the method; TempControllerSmith overrides it to actually update its internal model. Remove the now-redundant hasattr guards at both call sites. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tqxrk8uj4M3w3d3eXm3xK8
This commit is contained in:
@@ -89,6 +89,9 @@ class TempControllerBase(APid):
|
|||||||
def post_pid(self):
|
def post_pid(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_model_power(self, power):
|
||||||
|
pass
|
||||||
|
|
||||||
def set_theta_ist(self, value):
|
def set_theta_ist(self, value):
|
||||||
self.theta_ist_set = value
|
self.theta_ist_set = value
|
||||||
if self.is_startup:
|
if self.is_startup:
|
||||||
|
|||||||
@@ -181,7 +181,6 @@ class SudForecastEstimator:
|
|||||||
tc.process()
|
tc.process()
|
||||||
power = actuate(tc.get_power())
|
power = actuate(tc.get_power())
|
||||||
pot.set_power(power)
|
pot.set_power(power)
|
||||||
if hasattr(tc, 'set_model_power'):
|
|
||||||
tc.set_model_power(power)
|
tc.set_model_power(power)
|
||||||
|
|
||||||
if sud.state == SudState.RAMPING:
|
if sud.state == SudState.RAMPING:
|
||||||
|
|||||||
@@ -148,8 +148,6 @@ if __name__ == '__main__':
|
|||||||
# Assign temp. sensor readings to tc
|
# Assign temp. sensor readings to tc
|
||||||
sensor_task.set_on_changed("temp", ChangedFloat(tc.set_theta_ist, prec=2).set)
|
sensor_task.set_on_changed("temp", ChangedFloat(tc.set_theta_ist, prec=2).set)
|
||||||
|
|
||||||
# Assign heater power set to tc model - "Normal" has no internal model
|
|
||||||
if hasattr(tc, "set_model_power"):
|
|
||||||
heater.set_on_changed("power_set", tc.set_model_power)
|
heater.set_on_changed("power_set", tc.set_model_power)
|
||||||
|
|
||||||
# For simulation - the sim sensor has no real plant to read, so it
|
# For simulation - the sim sensor has no real plant to read, so it
|
||||||
|
|||||||
Reference in New Issue
Block a user