diff --git a/brewpi.py b/brewpi.py index 67caa74..b82d7d6 100644 --- a/brewpi.py +++ b/brewpi.py @@ -9,8 +9,6 @@ from components.plant import Pot from components.actor import HeaterFactory, StirrerFactory from tasks import TaskManager, TempSensorTask, HeaterTask, PotTask, TcTask, StirrerTask, TracerTask -DT_TASK = 0.1 - if __name__ == '__main__': config = json.load(open("config.json")) dispatcher = MessageDispatcher() diff --git a/components/pid/temp_controller_smith.py b/components/pid/temp_controller_smith.py index 0776932..8fd8f43 100644 --- a/components/pid/temp_controller_smith.py +++ b/components/pid/temp_controller_smith.py @@ -13,7 +13,7 @@ class States(Enum): class TempController(AttributeChange): - def __init__(self, dt, params, model_params): + def __init__(self, dt, params): AttributeChange.__init__(self) self.pid_hold = Pid(dt) self.pid_rate = Pid(dt) @@ -34,9 +34,9 @@ class TempController(AttributeChange): self.kalman_plant.initial((self.theta_ist_set, 0)) self.pid_hold.set_params(params['Hold']) self.pid_rate.set_params(params['Heat']) - self.model = Pot(dt, model_params) - self.theta_ist_delay_model = Delay(dt, model_params['Td']) - self.dtheta_ist_delay_model = Delay(dt, model_params['Td']) + self.model = Pot(dt, params['Model']) + self.theta_ist_delay_model = Delay(dt, params['Model']['Td']) + self.dtheta_ist_delay_model = Delay(dt, params['Model']['Td']) def set_theta_ist(self, value): self.theta_ist_set = value @@ -125,6 +125,14 @@ if __name__ == '__main__': dt = 1.0 tc_params = { + "Model": { + "theta" : 20, + "C" : 4190, + "M" : 20, + "L" : 0.05, + "Td" : 30, + "kn" : 0.2 + }, "Kalman": { "var_P" : 1.0, "var_Q" : 0.0001, @@ -144,15 +152,6 @@ if __name__ == '__main__': } } - model_params = { - "theta" : 20, - "C" : 4190, - "M" : 20, - "L" : 0.05, - "Td" : 30, - "kn" : 0.2 - } - pot_params = { "dt" : 1.0, "theta" : 20, @@ -165,7 +164,7 @@ if __name__ == '__main__': temp_ist = 0 temp_soll = 20 - ctrl = TempController(dt, tc_params, model_params) + ctrl = TempController(dt, tc_params) plant = Pot(dt, pot_params) _temp_ist = np.empty(0) _temp_soll = np.empty(0)