- do data signal wiring at one central place
- fixed initializations
This commit is contained in:
@@ -26,8 +26,6 @@ if __name__ == '__main__':
|
||||
# Plant
|
||||
pot_params = config['Plant']
|
||||
pot = Pot(DT, pot_params, 20)
|
||||
if "sim" in config['Controller']['sensor_name']:
|
||||
pot.set_on_changed("temp", ChangedFloat(sensor.set_fake_temp, prec=3).set)
|
||||
taskmgr.add(PotTask(pot, DT_TASK, dispatcher.msgio_get("Pot")))
|
||||
|
||||
# Heater
|
||||
@@ -39,10 +37,8 @@ if __name__ == '__main__':
|
||||
# Temperature Controller
|
||||
tc_params = config['TempCtrl']
|
||||
tc = PidFactory.create(config['Controller']['pid_type'], DT, tc_params)
|
||||
tc.set_on_changed("y", heater_task.actor)
|
||||
tc_task = TcTask(tc, DT_TASK, dispatcher.msgio_get("TempCtrl"))
|
||||
taskmgr.add(tc_task)
|
||||
sensor.set_on_changed("temp", ChangedFloat(tc.set_theta_ist, prec=2).set)
|
||||
|
||||
# Stirrer
|
||||
stirrer = StirrerFactory.create(config['Controller']['stirrer_name'], DT, config['Stirrer'])
|
||||
@@ -52,6 +48,13 @@ if __name__ == '__main__':
|
||||
# Tracer
|
||||
taskmgr.add(TracerTask(sensor, heater, tc, DT_TASK, dispatcher.msgio_get("Tracer")))
|
||||
|
||||
# Assign data flow
|
||||
tc.set_on_changed("y", heater_task.actor)
|
||||
sensor.set_on_changed("temp", ChangedFloat(tc.set_theta_ist, prec=2).set)
|
||||
if "sim" in config['Controller']['sensor_name']:
|
||||
pot.set_on_changed("temp", ChangedFloat(sensor.set_fake_temp, prec=3).set)
|
||||
sensor.set_fake_temp(pot.temp)
|
||||
|
||||
# Message dispatcher
|
||||
h_dispatcher = taskmgr.start()
|
||||
h_server = server.listen("0.0.0.0", 8765)
|
||||
|
||||
@@ -17,7 +17,7 @@ class TempController(APid):
|
||||
APid.__init__(self)
|
||||
self.pid_hold = Pid(dt)
|
||||
self.pid_rate = Pid(dt)
|
||||
self.theta_ist_set = 20
|
||||
self.theta_ist_set = 0
|
||||
self.theta_soll_set = 0
|
||||
self.heatrate_ist_set = 0
|
||||
self.heatrate_soll_set = 1.0
|
||||
|
||||
@@ -17,7 +17,7 @@ class TempController(APid):
|
||||
APid.__init__(self)
|
||||
self.pid_hold = Pid(dt)
|
||||
self.pid_rate = Pid(dt)
|
||||
self.theta_ist_set = 20
|
||||
self.theta_ist_set = 0
|
||||
self.theta_soll_set = 0
|
||||
self.heatrate_ist_set = 0
|
||||
self.heatrate_soll_set = 1.0
|
||||
|
||||
@@ -16,7 +16,7 @@ class Pot(APlant):
|
||||
self.L = params['L']
|
||||
self.Td = params['Td']
|
||||
self.kn = params['kn']
|
||||
self.temp = 0
|
||||
self.temp = params['theta']
|
||||
self.temp_intermediate = params['theta']
|
||||
|
||||
self.theta_amb = theta_amb
|
||||
|
||||
Reference in New Issue
Block a user