diff --git a/components/pid/temp_controller_base.py b/components/pid/temp_controller_base.py index 4233acc..56e2141 100644 --- a/components/pid/temp_controller_base.py +++ b/components/pid/temp_controller_base.py @@ -89,6 +89,12 @@ class TempControllerBase(APid): def post_pid(self): pass + def set_ambient_temperature(self, theta_amb): + pass + + def set_model_plant_params(self, model_params): + pass + def set_model_power(self, power): pass diff --git a/components/sud_forecast.py b/components/sud_forecast.py index 680e7f6..cdb3666 100644 --- a/components/sud_forecast.py +++ b/components/sud_forecast.py @@ -108,8 +108,7 @@ class SudForecastEstimator: pot.initial(start_theta) tc = PidFactory.create(self.pid_type, self.dt) tc.set_params(self.tempctrl_params) - if hasattr(tc, 'set_ambient_temperature'): - tc.set_ambient_temperature(self.theta_amb) + tc.set_ambient_temperature(self.theta_amb) tc.set_enabled(True) tc.set_theta_ist(pot.get_temperature()) # Seed the target at start_theta - this tc is a fresh, throwaway @@ -159,8 +158,7 @@ class SudForecastEstimator: step_starts.setdefault(sud.index, t[-1]) params = sud.derive_plant_params(step.get('grain_mass', 0), step.get('water_mass', 0)) pot.set_plant_params(params) - if hasattr(tc, 'set_model_plant_params'): - tc.set_model_plant_params(params) + tc.set_model_plant_params(params) if sud.state == SudState.RAMPING and step['temperature'] is not None: tc.set_theta_soll(step['temperature']) tc.set_heatrate_soll(step['ramp']['rate']) diff --git a/server/brewpi.py b/server/brewpi.py index a1ba51e..f5b53c3 100755 --- a/server/brewpi.py +++ b/server/brewpi.py @@ -118,8 +118,7 @@ if __name__ == '__main__': # ever coming from a Sud's own doc. tc = PidFactory.create(config['Controller']['pid_type'], DT) tc.set_params(config['TempCtrl']) - if hasattr(tc, 'set_ambient_temperature'): - tc.set_ambient_temperature(theta_amb) + tc.set_ambient_temperature(theta_amb) tc_task = TcTask(tc, DT_TASK, dispatcher.msgio_get("TempCtrl")) taskmgr.add(tc_task) @@ -171,8 +170,7 @@ if __name__ == '__main__': if 'AmbientTemp' in data: theta_amb = data['AmbientTemp'] pot.set_ambient_temperature(theta_amb) - if hasattr(tc, 'set_ambient_temperature'): - tc.set_ambient_temperature(theta_amb) + tc.set_ambient_temperature(theta_amb) forecast_estimator.set_ambient_temperature(theta_amb) await msg_system.send({'AmbientTemp': theta_amb}) msg_system.set_recv_handler(on_system_recv) diff --git a/tasks/sud.py b/tasks/sud.py index d4b1bd7..3e43aca 100644 --- a/tasks/sud.py +++ b/tasks/sud.py @@ -124,8 +124,7 @@ class SudTask(ATask): not just once a run actually starts.""" params = self.sud.derive_plant_params(grain_mass, water_mass) self.pot.set_plant_params(params) - if hasattr(self.tc, 'set_model_plant_params'): - self.tc.set_model_plant_params(params) + self.tc.set_model_plant_params(params) def apply_stirrer(self, phase): stirrer_cfg = phase.get('stirrer', {})