- use Valuechanged mechanism

This commit is contained in:
jens
2020-11-29 12:37:18 +01:00
parent 135f2b6898
commit d16b6b272a
9 changed files with 1713 additions and 1673 deletions
+3 -11
View File
@@ -1,5 +1,4 @@
import numpy as np
import json
from components.aplant import APlant
@@ -20,17 +19,13 @@ class Pot(APlant):
self.theta_amb = params['theta_amb']
self.theta = 0
self.temp = self.theta_amb
self.alpha = self.dt / 1
self.alpha_delay = self.dt/self.Td
self.theta_changed_callback = None
self.power_set = 0
self.power_actual = 0
def connect_theta_changed(self, func):
self.theta_changed_callback = func
def activate(self, enable):
pass
@@ -41,12 +36,9 @@ class Pot(APlant):
self.e = self.e * (1 - ((self.L * self.theta) * self.dt) / (self.M * self.C))
self.x = (1 - self.alpha) * self.x + self.gain * self.alpha * self.power_actual
self.e += self.x
theta = self.e / (self.M * self.C)
self.theta = self.e / (self.M * self.C)
if self.theta_changed_callback is not None:
self.theta_changed_callback(self.getTemperature())
self.theta = theta
self.temp = self.getTemperature()
def setPower(self, power):
self.power_set = power