- added Temp controller
- use AttributeChange for Processing objects
This commit is contained in:
@@ -3,12 +3,13 @@ from components.aheater import AHeater
|
||||
|
||||
class Heater(AHeater):
|
||||
def __init__(self):
|
||||
AHeater.__init__(self)
|
||||
self.power_set = self.get_power_min()
|
||||
self.is_active = False
|
||||
self.power_eff = 0
|
||||
|
||||
def get_power_min(self):
|
||||
return 500
|
||||
return 0
|
||||
|
||||
def get_power_max(self):
|
||||
return 3500
|
||||
|
||||
@@ -3,6 +3,9 @@ from utils.value import AttributeChange
|
||||
|
||||
|
||||
class AHeater(AttributeChange):
|
||||
def __init__(self):
|
||||
AttributeChange.__init__(self)
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_power_min(self):
|
||||
pass
|
||||
|
||||
@@ -3,6 +3,9 @@ from utils.value import AttributeChange
|
||||
|
||||
|
||||
class APlant(AttributeChange):
|
||||
def __init__(self):
|
||||
AttributeChange.__init__(self)
|
||||
|
||||
@abc.abstractmethod
|
||||
def activate(self, enable):
|
||||
return None
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
from components.pid.pid import Pid
|
||||
from matplotlib.pyplot import plot, figure, subplot, title, xlabel, ylabel, grid, show
|
||||
import numpy as np
|
||||
from utils.value import AttributeChange
|
||||
|
||||
|
||||
class TempController:
|
||||
class TempController(AttributeChange):
|
||||
def __init__(self, params):
|
||||
AttributeChange.__init__(self)
|
||||
|
||||
self.dt = params['dt']
|
||||
self.pid_hold = Pid()
|
||||
self.pid_rate = Pid()
|
||||
@@ -13,6 +16,8 @@ class TempController:
|
||||
self.heatrate_ist = 0
|
||||
self.heatrate_soll = 0
|
||||
self.params = params
|
||||
self.y_hold = 0
|
||||
self.y_heat = 0
|
||||
|
||||
def set_theta_ist(self, value):
|
||||
self.theta_ist = value
|
||||
@@ -33,11 +38,14 @@ class TempController:
|
||||
self.pid_hold.process(self.dt, self.params['Hold']['Pid'], theta_err)
|
||||
self.pid_rate.process(self.dt, self.params['Heat']['Pid'], heatrate_err)
|
||||
|
||||
self.y_hold = self.pid_hold.get_y()
|
||||
self.y_heat = self.pid_rate.get_y()
|
||||
|
||||
def get_power_hold(self):
|
||||
return self.pid_hold.get_y()
|
||||
return self.y_hold
|
||||
|
||||
def get_power_heat(self):
|
||||
return self.pid_rate.get_y()
|
||||
return self.y_heat
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -4,6 +4,7 @@ from components.aplant import APlant
|
||||
|
||||
class Pot(APlant):
|
||||
def __init__(self, params):
|
||||
APlant.__init__(self)
|
||||
self.dt = params['dt']
|
||||
self.alpha = 1.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user