- added initial for filling Delay line
- added gain parameter for Pot sim - from state change to heat init model temp with plant temp - updated config template
This commit is contained in:
@@ -165,7 +165,8 @@ if __name__ == '__main__':
|
|||||||
"M" : 20,
|
"M" : 20,
|
||||||
"L" : 0.05,
|
"L" : 0.05,
|
||||||
"Td" : 80,
|
"Td" : 80,
|
||||||
"kn" : 0.2
|
"kn" : 0.2,
|
||||||
|
"gain" : 0.8
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_ist = 0
|
temp_ist = 0
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class TempController(APid):
|
|||||||
self.state = state_next
|
self.state = state_next
|
||||||
print("New state = {}".format(state_next))
|
print("New state = {}".format(state_next))
|
||||||
if state_next == States.HEAT:
|
if state_next == States.HEAT:
|
||||||
self.kalman_plant.initial((self.theta_ist, 0))
|
self.model.initial(self.theta_ist)
|
||||||
self.kalman_model.initial((self.theta_ist, 0))
|
self.kalman_model.initial((self.theta_ist, 0))
|
||||||
|
|
||||||
def process_pid(self, theta_err, heatrate_err):
|
def process_pid(self, theta_err, heatrate_err):
|
||||||
@@ -174,7 +174,8 @@ if __name__ == '__main__':
|
|||||||
"M" : 20,
|
"M" : 20,
|
||||||
"L" : 0.05,
|
"L" : 0.05,
|
||||||
"Td" : 80,
|
"Td" : 80,
|
||||||
"kn" : 0.2
|
"kn" : 0.2,
|
||||||
|
"gain" : 0.8
|
||||||
},
|
},
|
||||||
"Kalman": {
|
"Kalman": {
|
||||||
"var_P" : 1.0,
|
"var_P" : 1.0,
|
||||||
@@ -202,7 +203,8 @@ if __name__ == '__main__':
|
|||||||
"M" : 20 + 4,
|
"M" : 20 + 4,
|
||||||
"L" : 0.07,
|
"L" : 0.07,
|
||||||
"Td" : 80 + 5,
|
"Td" : 80 + 5,
|
||||||
"kn" : 0.2
|
"kn" : 0.2,
|
||||||
|
"gain" : 0.8
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_ist = 0
|
temp_ist = 0
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ import numpy as np
|
|||||||
|
|
||||||
class Delay:
|
class Delay:
|
||||||
def __init__(self, dt, delay, ic):
|
def __init__(self, dt, delay, ic):
|
||||||
nd = int(delay/dt + 0.5)
|
self.nd = int(delay/dt + 0.5)
|
||||||
self.delay_line = np.ones(nd+1)*ic
|
self.delay_line = np.ones(self.nd+1)*ic
|
||||||
self.ri = 0
|
self.ri = 0
|
||||||
self.wi = 0
|
self.wi = 0
|
||||||
|
|
||||||
|
def initial(self, ic):
|
||||||
|
self.delay_line = np.ones(self.nd+1)*ic
|
||||||
|
|
||||||
def put(self, data):
|
def put(self, data):
|
||||||
self.delay_line[self.wi] = data
|
self.delay_line[self.wi] = data
|
||||||
self.wi += 1
|
self.wi += 1
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ class Pot(APlant):
|
|||||||
|
|
||||||
self.e = 0
|
self.e = 0
|
||||||
self.x = 0
|
self.x = 0
|
||||||
self.gain = 0.999
|
|
||||||
|
|
||||||
|
self.gain = params['gain']
|
||||||
self.C = params['C']
|
self.C = params['C']
|
||||||
self.M = params['M']
|
self.M = params['M']
|
||||||
self.L = params['L']
|
self.L = params['L']
|
||||||
@@ -24,6 +24,11 @@ class Pot(APlant):
|
|||||||
self.power_set = 0
|
self.power_set = 0
|
||||||
self.delay = Delay(self.dt, self.Td, params['theta'])
|
self.delay = Delay(self.dt, self.Td, params['theta'])
|
||||||
|
|
||||||
|
def initial(self, temp):
|
||||||
|
self.temp_intermediate = temp
|
||||||
|
self.temp = temp
|
||||||
|
self.delay.initial(temp)
|
||||||
|
|
||||||
def activate(self, enable):
|
def activate(self, enable):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
+8
-6
@@ -13,8 +13,9 @@
|
|||||||
"C": 4190,
|
"C": 4190,
|
||||||
"M": 25,
|
"M": 25,
|
||||||
"L": 0.05,
|
"L": 0.05,
|
||||||
"Td": 80,
|
"Td": 15,
|
||||||
"kn": 0.2
|
"kn": 0.2,
|
||||||
|
"gain" : 0.8
|
||||||
},
|
},
|
||||||
"Kalman": {
|
"Kalman": {
|
||||||
"dt": 1.0,
|
"dt": 1.0,
|
||||||
@@ -39,12 +40,13 @@
|
|||||||
},
|
},
|
||||||
"Plant": {
|
"Plant": {
|
||||||
"dt": 1.0,
|
"dt": 1.0,
|
||||||
"theta": 15,
|
"theta": 20,
|
||||||
"C": 4190,
|
"C": 4190,
|
||||||
"M": 20,
|
"M": 25,
|
||||||
"L": 0.1,
|
"L": 0.1,
|
||||||
"Td": 60,
|
"Td": 15,
|
||||||
"kn": 0.2
|
"kn": 0.2,
|
||||||
|
"gain" : 0.8
|
||||||
},
|
},
|
||||||
"Heater": {
|
"Heater": {
|
||||||
"dt": 1.0,
|
"dt": 1.0,
|
||||||
|
|||||||
Reference in New Issue
Block a user