From 0437c6e76e3efbd82f7152f5f2403c83b549dbc6 Mon Sep 17 00:00:00 2001 From: linuswck Date: Wed, 16 Oct 2024 16:14:58 +0800 Subject: [PATCH] thermostat, gui: Relax the max settable TEC Current Limit - Improper settings can cause PoE power failure and over heating - See hardware repo Issue #51 --- pykirdy/driver/kirdy.py | 12 ++++++------ pykirdy/kirdy_qt.py | 6 +++--- src/thermostat/thermostat.rs | 10 +++------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/pykirdy/driver/kirdy.py b/pykirdy/driver/kirdy.py index e479c2d..007e48b 100644 --- a/pykirdy/driver/kirdy.py +++ b/pykirdy/driver/kirdy.py @@ -309,7 +309,7 @@ class Device: 'tec_settings': { 'i_set': { # Current TEC Current Set by PID Controller/User (A) '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) 'value': 4.990857, # Value Set @@ -317,11 +317,11 @@ class Device: }, 'max_i_pos': { # Max Cooling Current Across Tec Terminals (A) '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) 'value': 0.99628574, # Value Set - 'max': 1.0 # Max Value Settable + 'max': 3.0 # Max Value Settable } }, 'pid_params': { # PID Controller Parameters @@ -493,21 +493,21 @@ class Thermostat: 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 """ 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): """ - 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 """ return await self._send_cmd(self._cmd._target, self._cmd.SetTecMaxINeg, max_i_neg) 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 or your newly set value will be overwritten by PID Controller Output - i_out: A diff --git a/pykirdy/kirdy_qt.py b/pykirdy/kirdy_qt.py index 0b8f579..7c32408 100644 --- a/pykirdy/kirdy_qt.py +++ b/pykirdy/kirdy_qt.py @@ -444,15 +444,15 @@ class MainWindow(QtWidgets.QMainWindow): {'name': 'Output Config', 'expanded': True, 'type': 'group', 'children': [ {'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': [ - {'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}, {'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}, ]}, {'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}, - {'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}, {'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}, diff --git a/src/thermostat/thermostat.rs b/src/thermostat/thermostat.rs index 819cc00..5df8068 100644 --- a/src/thermostat/thermostat.rs +++ b/src/thermostat/thermostat.rs @@ -57,14 +57,10 @@ impl TecSettings { units: PhantomData, value: 1.65, }; - - // Kirdy Design Specs: - // MaxV = 5.0V - // MAX Current = +- 1.0A const MAX_I_SET: ElectricCurrent = ElectricCurrent { dimension: PhantomData, units: PhantomData, - value: 1.0, + value: 3.0, }; const MAX_V_DUTY_TO_VOLTAGE_RATE: ElectricPotential = ElectricPotential { dimension: PhantomData, @@ -86,12 +82,12 @@ impl TecSettings { pub const MAX_I_POS_CURRENT: ElectricCurrent = ElectricCurrent { dimension: PhantomData, units: PhantomData, - value: 1.0, + value: 3.0, }; pub const MAX_I_NEG_CURRENT: ElectricCurrent = ElectricCurrent { dimension: PhantomData, units: PhantomData, - value: 1.0, + value: 3.0, }; // .get::() is not implemented for const const MAX_I_POS_DUTY_MAX: f64 =