- refactored hendi_ctrl

- fixed hend_heater
- added workaround for typedDict and Python < v3.8
This commit is contained in:
jens
2021-10-19 06:32:45 +01:00
parent 7c6004807d
commit bd63f2648c
4 changed files with 67 additions and 5 deletions
Regular → Executable
+1 -1
View File
@@ -18,7 +18,7 @@ class HeaterHendi(AHeater):
def get_powers(self):
caps = self.hendi.getCapabilties()
return [0].extend(caps['pwr_list'])
return [0] + caps['pwr_list']
def activate(self, enable):
if enable:
Regular → Executable
+6 -3
View File
@@ -22,8 +22,6 @@ class HendiCtrl:
powers = [500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000, 3100, 3200, 3300,3400, 3500]
digits = [4092, 3840, 3700, 3440, 3300, 3060, 3000, 2930, 2860, 2780, 2640, 2510, 2430, 2360, 2190, 2130, 2030, 1980, 1880, 1730, 1630, 1560, 1480, 1400, 1240, 1150, 1150, 1080, 920, 740, 670]
self.caps = {
"sw_id" : self.getSoftwareIdentifier(),
"sw_ver" : self.getSoftwareVersion(),
"pwr_watts_min" : powers[0],
"pwr_watts_max" : powers[-1],
"pwr_list" : powers,
@@ -124,7 +122,8 @@ class HendiCtrl:
def getInfo(self):
result = {
'caps' : self.caps,
"sw_id" : self.getSoftwareIdentifier(),
"sw_ver" : self.getSoftwareVersion(),
'state' : self.getState(),
'pwr_digits' : self.getPowerDigits(),
'Switch_state' : self.getSwitch()
@@ -188,6 +187,10 @@ if __name__ == '__main__':
hendi.getState()
hendi.getSoftwareIdentifier()
hendi.getSoftwareVersion()
caps = hendi.getCapabilties()
print("Caps: ", caps)
info = hendi.getInfo()
print("Info: ", info)
print("Test converters")
for pwr in range(500, 3600, 100):
+55
View File
@@ -0,0 +1,55 @@
{
"Controller" : {
"dt": 0.1,
"sim_warp_factor": 10.0,
"stirrer_name": "sim",
"heater_name": "sim",
"sensor_name": "sim",
"plant_name": "sim",
"pid_type": "Smith"
},
"TempCtrl": {
"Model": {
"theta": 20,
"C": 4190,
"M": 25,
"L": 0.05,
"Td": 80,
"kn": 0.2
},
"Kalman": {
"var_P" : 1.0,
"var_Q" : 0.0001,
"var_R" : 1.0
},
"Hold": {
"kp": 0.25,
"ki": 0.0,
"kd": 0.0,
"kt": 0.0
},
"Heat": {
"kp": 0.05,
"ki": 0.01,
"kd": 0.0,
"kt": 1.5
}
},
"Plant": {
"theta": 20,
"C": 4190,
"M": 22,
"L": 0.05,
"Td": 80,
"kn": 0.2
},
"Heater": {
"port": "/dev/ttyUSB0",
"speed": "115200"
},
"Stirrer": {
"port": "/dev/ttyACM0",
"speed": "115200"
}
}
Regular → Executable
+5 -1
View File
@@ -1,8 +1,12 @@
from typing import TypedDict
import numpy as np
import scipy.io
import os
import sys
import time
if sys.version_info[0] == 3 and sys.version_info[1] >= 8:
from typing import TypedDict
else:
from typing_extensions import TypedDict
class Entry(TypedDict):