[Pot]
- remove HeatDiffusion - use delay line for heat propagation modeling [Temp Controller] - remove Kalman
This commit is contained in:
@@ -1,25 +1,18 @@
|
||||
from components.pid import Kalman
|
||||
from components.pid.temp_controller_base import TempControllerBase
|
||||
|
||||
|
||||
class TempController(TempControllerBase):
|
||||
def __init__(self, dt, params):
|
||||
TempControllerBase.__init__(self, dt, params)
|
||||
self.kalman = Kalman(dt, params['Kalman'])
|
||||
|
||||
def init_kalman(self, value):
|
||||
self.kalman.initial((value, 0))
|
||||
|
||||
self.dt = dt
|
||||
self.last_theta_ist = 20
|
||||
self.heatrate_ist = 0
|
||||
def process(self):
|
||||
# Process Kalman
|
||||
if self.use_kalman:
|
||||
Z = self.kalman.process_measurement((self.theta_ist_set, 0), 0.0)
|
||||
xp = self.kalman.process(Z)
|
||||
self.theta_ist = xp[0, 0]
|
||||
self.heatrate_ist = xp[1, 0] * 60
|
||||
else:
|
||||
self.theta_ist = self.theta_ist_set
|
||||
self.heatrate_ist = self.heatrate_ist_set
|
||||
self.theta_ist = self.theta_ist_set
|
||||
heatrate = (self.theta_ist - self.last_theta_ist)/self.dt*60
|
||||
self.heatrate_ist = heatrate
|
||||
self.last_theta_ist = self.theta_ist
|
||||
|
||||
# Compensate for max heat rate to reduce overshoot
|
||||
if self.heatrate_soll_set > 0:
|
||||
|
||||
@@ -19,14 +19,10 @@ class TempControllerBase(APid):
|
||||
self.thresholds = {**DEFAULT_THRESHOLDS, **params.get('Thresholds', {})}
|
||||
self.y = -1
|
||||
self.state = States.INIT
|
||||
self.use_kalman = True
|
||||
self.pid_hold.set_params(params['Hold'])
|
||||
self.pid_rate.set_params(params['Heat'])
|
||||
self.is_startup = True
|
||||
|
||||
def init_kalman(self, value):
|
||||
raise NotImplementedError
|
||||
|
||||
def on_state_entered(self, state):
|
||||
pass
|
||||
|
||||
@@ -37,7 +33,6 @@ class TempControllerBase(APid):
|
||||
self.theta_ist_set = value
|
||||
if self.is_startup:
|
||||
self.is_startup = False
|
||||
self.init_kalman(value)
|
||||
|
||||
def get_theta_ist(self):
|
||||
return self.theta_ist
|
||||
|
||||
Reference in New Issue
Block a user