- 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
+11 -3
View File
@@ -74,11 +74,13 @@ if __name__ == '__main__':
ctrl = TempController(params)
_temp_ist = np.empty(0)
_temp_soll = np.empty(0)
_y = np.empty(0)
_fb = np.empty(0)
_t = np.empty(0)
a = 0.5
fb = 0
rho = 0.001
temps = [{'Temp': 20, 'Duration': 100}, {'Temp': 40, 'Duration': 100}, {'Temp': 30, 'Duration': 100}]
rho = 0.02
temps = [{'Temp': 20, 'Duration': 100}, {'Temp': 40, 'Duration': 100}, {'Temp': 35, 'Duration': 100}]
t = 0
for temp in temps:
@@ -93,7 +95,7 @@ if __name__ == '__main__':
break
hold_counter -= 1
ctrl.process()
y = ctrl.get_power_hold()
y = max(0, ctrl.get_power_hold())
fb = (1-a)*fb + a*round(y, 2)
temp_ist += fb
ctrl.set_theta_ist(temp_ist)
@@ -103,12 +105,18 @@ if __name__ == '__main__':
temp_ist -= rho
_temp_ist = np.append(_temp_ist, temp_ist)
_temp_soll = np.append(_temp_soll, temp_soll)
_y = np.append(_y, y)
_fb = np.append(_fb, fb)
_t = np.append(_t, t)
t += 1
figure(1)
subplot(2, 1, 1)
plot(_t, _temp_ist, _t, _temp_soll, 'r-', linewidth=1)
grid(True)
subplot(2, 1, 2)
plot(_t, _y, 'bx', _t, _fb, '-r', linewidth=1)
grid(True)
show()
print("End of program")