- added abstarct PID APid

- added PidFactory
- use variable args for factory
This commit is contained in:
jens
2021-10-02 11:10:43 +02:00
parent 7111bfd5e2
commit bf019733b2
15 changed files with 117 additions and 26 deletions
+21 -3
View File
@@ -1,8 +1,8 @@
from components.plant.pot import Pot, Delay
from matplotlib.pyplot import plot, figure, subplot, grid, show, legend
from components.pid import Pid, Kalman
from components import APid
import numpy as np
from utils.value import AttributeChange
from enum import Enum
@@ -12,9 +12,9 @@ class States(Enum):
HOLD = 2
class TempController(AttributeChange):
class TempController(APid):
def __init__(self, dt, params):
AttributeChange.__init__(self)
APid.__init__(self)
self.pid_hold = Pid(dt)
self.pid_rate = Pid(dt)
self.theta_ist_set = 20
@@ -41,15 +41,33 @@ class TempController(AttributeChange):
def set_theta_ist(self, value):
self.theta_ist_set = value
def get_theta_ist(self):
return self.theta_ist
def set_heatrate_ist(self, value):
self.heatrate_ist_set = value
def get_heatrate_ist(self):
return self.heatrate_ist
def set_theta_soll(self, value):
self.theta_soll_set = value
def get_theta_soll(self):
return self.theta_soll
def get_theta_soll_set(self):
return self.theta_soll_set
def set_heatrate_soll(self, value):
self.heatrate_soll_set = value
def get_heatrate_soll(self):
return self.heatrate_soll
def get_heatrate_soll_set(self):
return self.heatrate_soll_set
def process(self):
# Process Kalman of Model
Z_model = self.kalman_model.process_measurement((self.model.get_temperature_intermediate(), 0), 0.0)