- fixed water model

This commit is contained in:
jens
2020-11-29 19:12:17 +01:00
parent 4a87f361dd
commit 5102ad935c
6 changed files with 30 additions and 34 deletions
+8 -8
View File
@@ -30,10 +30,10 @@ class TempSensorTask(ATask):
def on_temp_changed(self, value):
print("Sensor temp {}".format(value))
asyncio.create_task(self.send({'Temp': value}))
def on_temp_changed_kalman(self, value):
print("Kalman temp {}".format(value))
asyncio.create_task(self.send({'Temp': value}))
async def recv(self, data):
print(data)
@@ -87,7 +87,7 @@ class HeaterTask(ATask):
power = Value()
while True:
self.power_soll = 200 + self.heater.get_power_max()*self.y
self.power_soll = max(0, 200 + self.heater.get_power_max()*self.y)
self.heater.setPower(self.power_soll)
self.heater.process()
power.set(round(self.heater.getPower()))
@@ -151,7 +151,7 @@ class TcTask(ATask):
async def on_process(self):
print("{}: Started with interval {} s".format(self.msg_handler.get_key(), self.interval))
self.tc.set_theta_soll(20)
self.tc.set_theta_soll(30)
while True:
self.tc.process()
await asyncio.sleep(self.interval)
@@ -203,14 +203,14 @@ if __name__ == '__main__':
# Plant
pot_params = {
"dt" : 1.0,
"theta_amb" : 15,
"theta" : 20,
"C" : 4190,
"M" : 20,
"M" : 10,
"L" : 0.1,
"Td" : 12,
"kn" : 0.2
}
pot = Pot(pot_params)
pot = Pot(pot_params, 20)
pot.set_on_changed("temp", ValueChanged(sensor.set_fake_temp, prec=1).set)
taskmgr.add(PotTask(pot, 1.0, dispatcher.msgio_get("Pot")))
@@ -225,9 +225,9 @@ if __name__ == '__main__':
"dt": 1.0,
"Hold": {
"Pid": {
"kp": 0.5,
"kp": 0.4,
"ki": 0.0,
"kd": 0.5,
"kd": 0.0,
"rho": 1.0
}
},