From f2ae132c691ef3b9976918e92066c5caf472c04d Mon Sep 17 00:00:00 2001 From: vanminhpe Date: Tue, 25 Aug 2026 11:06:15 +0800 Subject: [PATCH] change min-max value --- test_modbus_limiter.py | 92 ++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 43 deletions(-) diff --git a/test_modbus_limiter.py b/test_modbus_limiter.py index 05d9fb6..ddbc42d 100644 --- a/test_modbus_limiter.py +++ b/test_modbus_limiter.py @@ -96,11 +96,11 @@ RPU_TESTS = [ ('Cutoff_voltage_Q128', 50, 'uint16', 0, 8320, None, 8321), ('OVP_setting_Q128', 11, 'uint16', 0, 8320, None, 8321), ('Cutoff_over_current_Q128', 10, 'uint16', 0, 4480, None, 4481), - ('Cutoff_minimum_current_Q128', 51, 'uint16', 0, 640, None, 641), + ('Cutoff_minimum_current_Q128', 51, 'uint16', 0, 1280, None, 1281), # ----- Precharge / CV current ----- ('Precharge_current', 6, 'int16', 0, 1280, -1, 1281), - ('CV_current_limit', 7, 'int16', 0, 1280, -1, 1281), + ('CV_current_limit', 7, 'int16', 0, 3840, -1, 3841), # ----- SR control ----- ('SR_limit_lo', 16, 'uint16', 0, 1280, None, 1281), @@ -127,28 +127,31 @@ RPU_TESTS = [ ('RSSI_auto_threshold', 105, 'int16', -120, 0, -121, 1), ('RSSI_max_voltage_Q128', 106, 'uint16', 0, 8320, None, 8321), - # ----- Temperature thresholds — dev ----- - ('Dev_temp_thres_stage_1', 42, 'int16', -40, 150, -41, 151), - ('Dev_temp_thres_stage_2', 43, 'int16', -40, 150, -41, 151), - ('Dev_temp_thres_stage_3', 44, 'int16', -40, 150, -41, 151), + # ----- Temperature thresholds — dev (MOS) ----- + # MODBUS_LIMIT_TEMP_THRES_MIN=0, MODBUS_LIMIT_MOS_TEMP_THRES_MAX=120 + ('Dev_temp_thres_stage_1', 42, 'int16', 0, 120, -1, 121), + ('Dev_temp_thres_stage_2', 43, 'int16', 0, 120, -1, 121), + ('Dev_temp_thres_stage_3', 44, 'int16', 0, 120, -1, 121), # ----- Temperature thresholds — coil ----- - ('Coil_temp_thres_stage_1', 107, 'int16', -40, 150, -41, 151), - ('Coil_temp_thres_stage_2', 108, 'int16', -40, 150, -41, 151), - ('Coil_temp_thres_stage_3', 109, 'int16', -40, 150, -41, 151), + # MODBUS_LIMIT_COIL_TEMP_THRES_MAX=110 + ('Coil_temp_thres_stage_1', 107, 'int16', 0, 110, -1, 111), + ('Coil_temp_thres_stage_2', 108, 'int16', 0, 110, -1, 111), + ('Coil_temp_thres_stage_3', 109, 'int16', 0, 110, -1, 111), # ----- Temperature thresholds — MCU ----- - ('MCU_temp_thres_stage_1', 92, 'int16', -40, 150, -41, 151), - ('MCU_temp_thres_stage_2', 93, 'int16', -40, 150, -41, 151), - ('MCU_temp_thres_stage_3', 94, 'int16', -40, 150, -41, 151), + # MODBUS_LIMIT_MCU_TEMP_THRES_MAX=125 + ('MCU_temp_thres_stage_1', 92, 'int16', 0, 125, -1, 126), + ('MCU_temp_thres_stage_2', 93, 'int16', 0, 125, -1, 126), + ('MCU_temp_thres_stage_3', 94, 'int16', 0, 125, -1, 126), # ----- Current derating (%) ----- ('Current_derating_1', 45, 'uint16', 0, 50, None, 51), ('Current_derating_2', 46, 'uint16', 0, 50, None, 51), # ----- Ramp control ----- - ('Ramp_control_mA_per_sec', 111, 'uint16', 0, 50000, None, 50001), - ('Ramp_slow_mA_per_sec', 136, 'uint16', 0, 50000, None, 50001), + ('Ramp_control_mA_per_sec', 111, 'uint16', 0, 20000, None, 20001), + ('Ramp_slow_mA_per_sec', 136, 'uint16', 0, 20000, None, 20001), ('Ramp_current_dV', 137, 'uint16', 0, 1280, None, 1281), # ----- Discovery / height ----- @@ -186,15 +189,15 @@ TPU_TESTS = [ # ----- Fan control (uint16 / int16) ----- ('Fan_mode', 69, 'uint16', 0, 255, None, 256), ('Fan_duty_set', 70, 'uint16', 0, 100, None, 101), - ('Fan_temp_lo', 71, 'int16', -40, 80, -41, 81), - ('Fan_temp_hi', 72, 'int16', -40, 80, -41, 81), + ('Fan_temp_lo', 71, 'int16', 0, 80, -1, 81), + ('Fan_temp_hi', 72, 'int16', 0, 80, -1, 81), # ----- Moving-away detection (uint16) ----- - ('Moving_away_time_ms', 3, 'uint16', 50, 500, 49, 501), - ('Move_away_iout_thres', 84, 'uint16', 0, 50, None, 51), + ('Moving_away_time_ms', 3, 'uint16', 50, 1000, 49, 1001), + ('Move_away_iout_thres', 84, 'uint16', 0, 100, None, 101), # ----- OVP (uint16) ----- - ('OVP_iinv_pk_threshold', 75, 'uint16', 0, 50, None, 51), + ('OVP_iinv_pk_threshold', 75, 'uint16', 0, 100, None, 101), ('OVP_phase_threshold', 76, 'uint16', 0, 500, None, 501), ('OVP_count_threshold', 77, 'uint16', 0, 10, None, 11), @@ -214,24 +217,25 @@ TPU_TESTS = [ ('Current_derating_2', 108, 'uint16', 0, 50, None, 51), # ----- INV temperature thresholds (int16) ----- - ('INV_temp_thres_1', 60, 'int16', -40, 150, -41, 151), - ('INV_temp_thres_2', 61, 'int16', -40, 150, -41, 151), - ('INV_temp_thres_3', 62, 'int16', -40, 150, -41, 151), + # MODBUS_LIMIT_TEMP_THRES_MIN=0, MODBUS_LIMIT_TEMP_THRES_MAX=110 + ('INV_temp_thres_1', 60, 'int16', 0, 110, -1, 111), + ('INV_temp_thres_2', 61, 'int16', 0, 110, -1, 111), + ('INV_temp_thres_3', 62, 'int16', 0, 110, -1, 111), # ----- PFC temperature thresholds (int16) ----- - ('PFC_temp_thres_1', 63, 'int16', -40, 150, -41, 151), - ('PFC_temp_thres_2', 64, 'int16', -40, 150, -41, 151), - ('PFC_temp_thres_3', 65, 'int16', -40, 150, -41, 151), + ('PFC_temp_thres_1', 63, 'int16', 0, 110, -1, 111), + ('PFC_temp_thres_2', 64, 'int16', 0, 110, -1, 111), + ('PFC_temp_thres_3', 65, 'int16', 0, 110, -1, 111), # ----- Coil temperature thresholds (int16) ----- - ('Coil_temp_thres_1', 66, 'int16', -40, 150, -41, 151), - ('Coil_temp_thres_2', 67, 'int16', -40, 150, -41, 151), - ('Coil_temp_thres_3', 68, 'int16', -40, 150, -41, 151), + ('Coil_temp_thres_1', 66, 'int16', 0, 110, -1, 111), + ('Coil_temp_thres_2', 67, 'int16', 0, 110, -1, 111), + ('Coil_temp_thres_3', 68, 'int16', 0, 110, -1, 111), # ----- MCU temperature thresholds (int16) ----- - ('MCU_temp_thres_1', 104, 'int16', -40, 150, -41, 151), - ('MCU_temp_thres_2', 105, 'int16', -40, 150, -41, 151), - ('MCU_temp_thres_3', 106, 'int16', -40, 150, -41, 151), + ('MCU_temp_thres_1', 104, 'int16', 0, 110, -1, 111), + ('MCU_temp_thres_2', 105, 'int16', 0, 110, -1, 111), + ('MCU_temp_thres_3', 106, 'int16', 0, 110, -1, 111), # ----- Coupling estimation frequencies (float32) ----- # INV_FREQ_MIN = 60.0 Hz, INV_FREQ_MAX = 150.0 Hz (app_inv.h) @@ -244,25 +248,27 @@ TPU_TESTS = [ ('INV_freq_set', 28, 'float32', 60.0, 150.0, 59.0, 151.0), ('INV_freq_min', 30, 'float32', 60.0, 150.0, 59.0, 151.0), ('INV_freq_max', 32, 'float32', 60.0, 150.0, 59.0, 151.0), - ('INV_current_limit', 34, 'float32', 0.0, 40.0, -1.0, 41.0), + ('INV_current_limit', 34, 'float32', 0.0, 50.0, -1.0, 51.0), # ----- PFC voltage / current (float32) ----- - # MODBUS_LIMIT_PFC_DC_BUS_VOLTAGE_MAX_CEIL = 450.0, PFC_CURRENT_MAX_CEIL = 40.0 - ('PFC_vdc_ref', 40, 'float32', 0.0, 450.0, -1.0, 451.0), - ('PFC_voltage_limit', 42, 'float32', 0.0, 450.0, -1.0, 451.0), - ('PFC_current_limit', 44, 'float32', 0.0, 40.0, -1.0, 41.0), + # MODBUS_LIMIT_PFC_DC_BUS_VOLTAGE_MAX_CEIL = 425.0 + # MODBUS_LIMIT_PFC_CURRENT_LIMIT_CEIL = 25.0, MODBUS_LIMIT_PFC_CURRENT_MAX_CEIL = 40.0 + ('PFC_vdc_ref', 40, 'float32', 0.0, 425.0, -1.0, 426.0), + ('PFC_voltage_limit', 42, 'float32', 0.0, 425.0, -1.0, 426.0), + ('PFC_current_limit', 44, 'float32', 0.0, 25.0, -1.0, 26.0), # ----- Protection current / voltage limits (float32) ----- ('PFC_current_max', 48, 'float32', 0.0, 40.0, -1.0, 41.0), - ('INV_current_max', 50, 'float32', 0.0, 40.0, -1.0, 41.0), - ('INV_current_min', 170, 'float32', 0.0, 40.0, -1.0, 41.0), - ('DC_bus_voltage_min', 52, 'float32', 0.0, 450.0, -1.0, 451.0), - ('DC_bus_voltage_max', 54, 'float32', 0.0, 450.0, -1.0, 451.0), - # MODBUS_LIMIT_AC_IN_VOLTAGE_MAX_CEIL = 400.0 - ('AC_in_voltage_min', 56, 'float32', 0.0, 400.0, -1.0, 401.0), - ('AC_in_voltage_max', 58, 'float32', 0.0, 400.0, -1.0, 401.0), + ('INV_current_max', 50, 'float32', 0.0, 50.0, -1.0, 51.0), + ('INV_current_min', 170, 'float32', 0.0, 50.0, -1.0, 51.0), + ('DC_bus_voltage_min', 52, 'float32', 0.0, 425.0, -1.0, 426.0), + ('DC_bus_voltage_max', 54, 'float32', 0.0, 425.0, -1.0, 426.0), + # MODBUS_LIMIT_AC_IN_VOLTAGE_MAX_CEIL = 320.0 + ('AC_in_voltage_min', 56, 'float32', 0.0, 320.0, -1.0, 321.0), + ('AC_in_voltage_max', 58, 'float32', 0.0, 320.0, -1.0, 321.0), # ----- No-batt coupling INV current (float32) ----- + # MODBUS_LIMIT_NO_BATT_COUPLING_INV_CURRENT_MAX = 40.0 (unchanged) ('No_batt_coupling_inv_current', 168, 'float32', 0.0, 40.0, -1.0, 41.0), # ----- ADC calibration gain (A) registers (float32) -----