1
0
forked from M-Labs/kirdy

thermostat, gui: Relax the max settable TEC Current Limit

- Improper settings can cause PoE power failure and over heating
- See hardware repo Issue #51
This commit is contained in:
linuswck 2024-10-16 16:14:58 +08:00
parent bad21806f8
commit 0437c6e76e
3 changed files with 12 additions and 16 deletions

View File

@ -309,7 +309,7 @@ class Device:
'tec_settings': { 'tec_settings': {
'i_set': { # Current TEC Current Set by PID Controller/User (A) 'i_set': { # Current TEC Current Set by PID Controller/User (A)
'value': 0.04330516, # Value Set 'value': 0.04330516, # Value Set
'max': 1.0 # Max Value Settable 'max': 3.0 # Max Value Settable
}, },
'max_v': { # Max Voltage Across Tec Terminals (V) 'max_v': { # Max Voltage Across Tec Terminals (V)
'value': 4.990857, # Value Set 'value': 4.990857, # Value Set
@ -317,11 +317,11 @@ class Device:
}, },
'max_i_pos': { # Max Cooling Current Across Tec Terminals (A) 'max_i_pos': { # Max Cooling Current Across Tec Terminals (A)
'value': 0.99628574, # Value Set 'value': 0.99628574, # Value Set
'max': 1.0 # Max Value Settable 'max': 3.0 # Max Value Settable
}, },
'max_i_neg': { # Max Heating Current Across Tec Terminals (A) 'max_i_neg': { # Max Heating Current Across Tec Terminals (A)
'value': 0.99628574, # Value Set 'value': 0.99628574, # Value Set
'max': 1.0 # Max Value Settable 'max': 3.0 # Max Value Settable
} }
}, },
'pid_params': { # PID Controller Parameters 'pid_params': { # PID Controller Parameters
@ -493,21 +493,21 @@ class Thermostat:
async def set_tec_max_cooling_i(self, max_i_pos): async def set_tec_max_cooling_i(self, max_i_pos):
""" """
Set Tec maximum cooling current (Settable Range: 0.0 - 1.0) Set Tec maximum cooling current (Settable Range: 0.0 - 3.0)
- max_i_pos: A - max_i_pos: A
""" """
return await self._send_cmd(self._cmd._target, self._cmd.SetTecMaxIPos, max_i_pos) return await self._send_cmd(self._cmd._target, self._cmd.SetTecMaxIPos, max_i_pos)
async def set_tec_max_heating_i(self, max_i_neg): async def set_tec_max_heating_i(self, max_i_neg):
""" """
Set Tec maximum heating current (Settable Range: 0.0 - 1.0) Set Tec maximum heating current (Settable Range: 0.0 - 3.0)
- max_i_neg: A - max_i_neg: A
""" """
return await self._send_cmd(self._cmd._target, self._cmd.SetTecMaxINeg, max_i_neg) return await self._send_cmd(self._cmd._target, self._cmd.SetTecMaxINeg, max_i_neg)
async def set_tec_i_out(self, i_out): async def set_tec_i_out(self, i_out):
""" """
Set Tec Output Current (Settable Range: 0.0 - 1.0) Set Tec Output Current (Settable Range: 0.0 - 3.0)
This cmd is only effective in constant current control mode This cmd is only effective in constant current control mode
or your newly set value will be overwritten by PID Controller Output or your newly set value will be overwritten by PID Controller Output
- i_out: A - i_out: A

View File

@ -444,15 +444,15 @@ class MainWindow(QtWidgets.QMainWindow):
{'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [ {'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [
{'name': 'Control Method', 'type': 'mutex', 'limits': ['Constant Current', 'Temperature PID'], {'name': 'Control Method', 'type': 'mutex', 'limits': ['Constant Current', 'Temperature PID'],
'target_action_pair': [['thermostat', 'set_constant_current_control_mode'], ['thermostat', 'set_pid_control_mode']], 'children': [ 'target_action_pair': [['thermostat', 'set_constant_current_control_mode'], ['thermostat', 'set_pid_control_mode']], 'children': [
{'name': 'Set Current', 'type': 'float', 'value': 0, 'step': 1, 'limits': (-1000, 1000), 'triggerOnShow': True, 'decimals': 6, {'name': 'Set Current', 'type': 'float', 'value': 0, 'step': 1, 'limits': (-3000, 3000), 'triggerOnShow': True, 'decimals': 6,
'unit': 'mA', 'lock': False, 'target': 'thermostat', 'action': 'set_tec_i_out', "compactHeight": False}, 'unit': 'mA', 'lock': False, 'target': 'thermostat', 'action': 'set_tec_i_out', "compactHeight": False},
{'name': 'Set Temperature', 'type': 'float', 'value': 25, 'step': 0.0001, 'limits': (-273, 300), 'format': '{value:.4f}', {'name': 'Set Temperature', 'type': 'float', 'value': 25, 'step': 0.0001, 'limits': (-273, 300), 'format': '{value:.4f}',
'unit': '', 'lock': False, 'target': 'thermostat', 'action': 'set_temperature_setpoint', "compactHeight": False}, 'unit': '', 'lock': False, 'target': 'thermostat', 'action': 'set_temperature_setpoint', "compactHeight": False},
]}, ]},
{'name': 'Limits', 'expanded': False, 'type': 'group', 'children': [ {'name': 'Limits', 'expanded': False, 'type': 'group', 'children': [
{'name': 'Max Cooling Current', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (0, 1000), {'name': 'Max Cooling Current', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (0, 3000),
'unit': 'mA', 'lock': False, 'target': 'thermostat', 'action': 'set_tec_max_cooling_i', "compactHeight": False}, 'unit': 'mA', 'lock': False, 'target': 'thermostat', 'action': 'set_tec_max_cooling_i', "compactHeight": False},
{'name': 'Max Heating Current', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (0, 1000), {'name': 'Max Heating Current', 'type': 'float', 'value': 0, 'step': 1, 'decimals': 6, 'limits': (0, 3000),
'unit': 'mA', 'lock': False, 'target': 'thermostat', 'action': 'set_tec_max_heating_i', "compactHeight": False}, 'unit': 'mA', 'lock': False, 'target': 'thermostat', 'action': 'set_tec_max_heating_i', "compactHeight": False},
{'name': 'Max Voltage Difference', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (0, 4), {'name': 'Max Voltage Difference', 'type': 'float', 'value': 0, 'step': 0.1, 'limits': (0, 4),
'unit': 'V', 'lock': False, 'target': 'thermostat', 'action': 'set_tec_max_v', "compactHeight": False}, 'unit': 'V', 'lock': False, 'target': 'thermostat', 'action': 'set_tec_max_v', "compactHeight": False},

View File

@ -57,14 +57,10 @@ impl TecSettings {
units: PhantomData, units: PhantomData,
value: 1.65, value: 1.65,
}; };
// Kirdy Design Specs:
// MaxV = 5.0V
// MAX Current = +- 1.0A
const MAX_I_SET: ElectricCurrent = ElectricCurrent { const MAX_I_SET: ElectricCurrent = ElectricCurrent {
dimension: PhantomData, dimension: PhantomData,
units: PhantomData, units: PhantomData,
value: 1.0, value: 3.0,
}; };
const MAX_V_DUTY_TO_VOLTAGE_RATE: ElectricPotential = ElectricPotential { const MAX_V_DUTY_TO_VOLTAGE_RATE: ElectricPotential = ElectricPotential {
dimension: PhantomData, dimension: PhantomData,
@ -86,12 +82,12 @@ impl TecSettings {
pub const MAX_I_POS_CURRENT: ElectricCurrent = ElectricCurrent { pub const MAX_I_POS_CURRENT: ElectricCurrent = ElectricCurrent {
dimension: PhantomData, dimension: PhantomData,
units: PhantomData, units: PhantomData,
value: 1.0, value: 3.0,
}; };
pub const MAX_I_NEG_CURRENT: ElectricCurrent = ElectricCurrent { pub const MAX_I_NEG_CURRENT: ElectricCurrent = ElectricCurrent {
dimension: PhantomData, dimension: PhantomData,
units: PhantomData, units: PhantomData,
value: 1.0, value: 3.0,
}; };
// .get::<ratio>() is not implemented for const // .get::<ratio>() is not implemented for const
const MAX_I_POS_DUTY_MAX: f64 = const MAX_I_POS_DUTY_MAX: f64 =