- reworked

git-svn-id: http://moon:8086/svn/projects/HendiControl@113 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2019-03-20 21:11:09 +00:00
parent 9af007906a
commit 69a175beac
8 changed files with 386 additions and 39 deletions
+35
View File
@@ -0,0 +1,35 @@
import numpy as np
import json
from aplant import APlant
class Mass(APlant):
def __init__(self, params):
print(json.dumps({'Mass': params}, indent=4, sort_keys=True))
self.e = 0
self.x = 0
self.gain = 0.8
self.C = params['C']
self.M = params['M']
self.L = params['L']
self.Td = params['Td']
self.theta_amb = params['theta_amb']
self.theta = 0
self.P = 0
def process(self, dt):
alpha = 1.0
if self.Td > 0:
alpha = dt/self.Td
self.e = self.e*(1 - ((self.L*self.theta)*dt)/(self.M*self.C))
self.x = (1-alpha)*self.x + self.gain*alpha*self.P*dt
self.e += self.x
self.theta = self.e/(self.M*self.C)
def setPower(self, power_w):
self.P = power_w
def getTemperature(self):
return self.theta + self.theta_amb