- use heat diffusion for water model instead of delay line

This commit is contained in:
jens
2021-10-12 12:01:40 +02:00
parent 89ac2b8ea8
commit 16cb3d3b3c
3 changed files with 39 additions and 14 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
from components.aplant import APlant
from components.plant.delay import Delay
from components.plant.heat_diffusion import HeatDiffusion
class Pot(APlant):
@@ -22,7 +22,7 @@ class Pot(APlant):
self.theta_amb = theta_amb
self.power_set = 0
self.delay = Delay(self.dt, self.Td, params['theta'])
self.delay = HeatDiffusion(self.dt, self.Td, params['theta'])
def initial(self, temp):
self.temp_intermediate = temp
@@ -33,12 +33,12 @@ class Pot(APlant):
pass
def process(self):
power = self.gain * self.power_set
leak = 1/self.M * self.L * (self.theta_amb - self.temp)/self.theta_amb
self.temp_intermediate += (self.power_set / (self.M * self.C) + leak) * self.dt
self.temp_intermediate += (power / (self.M * self.C) + leak) * self.dt
# Delay
self.delay.put(self.temp_intermediate)
self.temp = self.delay.get()
self.temp = self.delay.process(self.temp_intermediate)
def is_activated(self):
return True