- remove HeatDiffusion
- use delay line for heat propagation modeling

[Temp Controller]
- remove Kalman
This commit is contained in:
2026-06-19 14:21:23 +02:00
parent 81e66dbcd1
commit 5c7cffa3a7
4 changed files with 84 additions and 49 deletions
+36 -12
View File
@@ -2,23 +2,48 @@ import numpy as np
from matplotlib.pyplot import plot, figure, subplot, grid, show, legend
from components.plant.pot import Pot
from components.pid.temp_controller import TempController
from components.pid.tc_constants import Test
if __name__ == '__main__':
ctrl_params = {
"Hold": {
"kp": 0.4,
"ki": 0.0,
"kd": 0.0,
"kt": 0.0
},
"Heat": {
"kp": 0.08,
"ki": 0.008,
"kd": 0.0,
"kt": 1.5
}
}
plant_params = {
"theta" : 20,
"C" : 4190,
"M" : 20,
"L" : 0.2,
"Td" : 30,
"kn" : 0.2,
"gain" : 1.0
}
dt = 1.0
k_noise = 0.001
temp_ist = 0
temp_soll = 20
ctrl = TempController(dt, Test.tc_ctrl_params)
plant = Pot(dt, Test.tc_pot_params)
_temp_ist = np.empty(0)
_temp_soll = np.empty(0)
heatrate_soll = 1.25
ctrl = TempController(dt, ctrl_params)
plant = Pot(dt, plant_params)
_y = np.empty(0)
_fb = np.empty(0)
_t = np.empty(0)
_heatrate_ist_kalman = np.empty(0)
_temp_ist_kalman = np.empty(0)
_temp_soll = np.empty(0)
_heatrate_ist = np.empty(0)
_temp_ist = np.empty(0)
a = 0.5
fb = 0
rho = 0.02
@@ -30,7 +55,7 @@ if __name__ == '__main__':
hold_counter = temp['Duration']
hold = False
ctrl.set_theta_soll(temp_soll)
ctrl.set_heatrate_soll(1.0)
ctrl.set_heatrate_soll(heatrate_soll)
while True:
if hold:
@@ -38,7 +63,7 @@ if __name__ == '__main__':
break
hold_counter -= 1
plant.process()
temp_ist = plant.get_temperature() + 0.0 * np.random.randn()
temp_ist = plant.get_temperature() + k_noise * np.random.randn()
ctrl.set_theta_ist(temp_ist)
ctrl.process()
@@ -55,8 +80,7 @@ if __name__ == '__main__':
_y = np.append(_y, y)
_fb = np.append(_fb, fb)
_t = np.append(_t, t)
_heatrate_ist_kalman = np.append(_heatrate_ist_kalman, max(-1, min(3, ctrl.heatrate_ist)))
_temp_ist_kalman = np.append(_temp_ist, ctrl.theta_ist)
_heatrate_ist = np.append(_heatrate_ist, max(-1, min(3, ctrl.heatrate_ist)))
t += 1
figure(1)
@@ -69,7 +93,7 @@ if __name__ == '__main__':
legend(["y", "pot"])
grid(True)
subplot(3, 1, 3)
plot(_t, _heatrate_ist_kalman, '-b', linewidth=1)
plot(_t, _heatrate_ist, '-b', linewidth=1)
legend(["heatrate"])
grid(True)
show()