From ca21dae6bad3083e0683aa8871d5caeacc4a7145 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 28 Nov 2023 12:40:24 +0200 Subject: [PATCH] Change inverterAllowsContactorClosing logic to default OFF --- Software/Software.ino | 16 ++++++++++++++-- Software/src/battery/BMW-I3-BATTERY.h | 3 ++- Software/src/battery/CHADEMO-BATTERY.h | 2 ++ Software/src/battery/IMIEV-CZERO-ION-BATTERY.h | 3 ++- Software/src/battery/KIA-HYUNDAI-64-BATTERY.h | 3 ++- Software/src/battery/RENAULT-ZOE-BATTERY.h | 2 ++ Software/src/battery/TEST-FAKE-BATTERY.h | 5 +++-- Software/src/inverter/BYD-CAN.h | 2 ++ Software/src/inverter/BYD-MODBUS.h | 3 ++- Software/src/inverter/LUNA2000-MODBUS.h | 2 ++ Software/src/inverter/PYLON-CAN.h | 2 ++ Software/src/inverter/SMA-CAN.h | 4 +++- Software/src/inverter/SOFAR-CAN.h | 3 ++- Software/src/inverter/SOLAX-CAN.h | 3 ++- 14 files changed, 42 insertions(+), 11 deletions(-) diff --git a/Software/Software.ino b/Software/Software.ino index 16cf5b82..a6e1a7c4 100644 --- a/Software/Software.ino +++ b/Software/Software.ino @@ -104,7 +104,7 @@ unsigned long negativeStartTime = 0; unsigned long timeSpentInFaultedMode = 0; #endif bool batteryAllowsContactorClosing = false; -bool inverterAllowsContactorClosing = true; +bool inverterAllowsContactorClosing = false; // Initialization void setup() { @@ -254,24 +254,36 @@ void inform_user_on_inverter() { // Inform user what Inverter is used #ifdef BYD_CAN Serial.println("BYD CAN protocol selected"); + bool inverterAllowsContactorClosing = + true; // The inverter does not care when contactors are actuated, OK to start with them ON #endif #ifdef BYD_MODBUS Serial.println("BYD Modbus RTU protocol selected"); + bool inverterAllowsContactorClosing = + true; // The inverter does not care when contactors are actuated, OK to start with them ON #endif #ifdef LUNA2000_MODBUS Serial.println("Luna2000 Modbus RTU protocol selected"); + bool inverterAllowsContactorClosing = + true; // The inverter does not care when contactors are actuated, OK to start with them ON #endif #ifdef PYLON_CAN Serial.println("PYLON CAN protocol selected"); + bool inverterAllowsContactorClosing = + true; // The inverter does not care when contactors are actuated, OK to start with them ON #endif #ifdef SMA_CAN Serial.println("SMA CAN protocol selected"); + bool inverterAllowsContactorClosing = + true; // The inverter does not care when contactors are actuated, OK to start with them ON #endif #ifdef SOFAR_CAN Serial.println("SOFAR CAN protocol selected"); + bool inverterAllowsContactorClosing = + true; // The inverter does not care when contactors are actuated, OK to start with them ON #endif #ifdef SOLAX_CAN - inverterAllowsContactorClosing = false; // The inverter needs to allow first on this protocol + inverterAllowsContactorClosing = false; // The inverter needs to allow first on this protocol! intervalUpdateValues = 800; // This protocol also requires the values to be updated faster Serial.println("SOLAX CAN protocol selected"); #endif diff --git a/Software/src/battery/BMW-I3-BATTERY.h b/Software/src/battery/BMW-I3-BATTERY.h index f39537ad..210c1457 100644 --- a/Software/src/battery/BMW-I3-BATTERY.h +++ b/Software/src/battery/BMW-I3-BATTERY.h @@ -23,7 +23,8 @@ extern uint16_t stat_batt_power; extern uint16_t temperature_min; extern uint16_t temperature_max; extern uint16_t CANerror; -extern bool batteryAllowsContactorClosing; +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false // Definitions for BMS status #define STANDBY 0 #define INACTIVE 1 diff --git a/Software/src/battery/CHADEMO-BATTERY.h b/Software/src/battery/CHADEMO-BATTERY.h index e948058b..3a9df30e 100644 --- a/Software/src/battery/CHADEMO-BATTERY.h +++ b/Software/src/battery/CHADEMO-BATTERY.h @@ -23,6 +23,8 @@ extern uint16_t stat_batt_power; extern uint16_t temperature_min; extern uint16_t temperature_max; extern uint16_t CANerror; +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false // Definitions for BMS status #define STANDBY 0 #define INACTIVE 1 diff --git a/Software/src/battery/IMIEV-CZERO-ION-BATTERY.h b/Software/src/battery/IMIEV-CZERO-ION-BATTERY.h index 6f5f6d26..556dd5ce 100644 --- a/Software/src/battery/IMIEV-CZERO-ION-BATTERY.h +++ b/Software/src/battery/IMIEV-CZERO-ION-BATTERY.h @@ -25,7 +25,8 @@ extern uint16_t temperature_max; extern uint16_t CANerror; extern uint16_t cell_max_voltage; extern uint16_t cell_min_voltage; -extern bool batteryAllowsContactorClosing; +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false extern uint8_t LEDcolor; // Definitions for BMS status #define STANDBY 0 diff --git a/Software/src/battery/KIA-HYUNDAI-64-BATTERY.h b/Software/src/battery/KIA-HYUNDAI-64-BATTERY.h index 0080dfa0..a48379df 100644 --- a/Software/src/battery/KIA-HYUNDAI-64-BATTERY.h +++ b/Software/src/battery/KIA-HYUNDAI-64-BATTERY.h @@ -23,7 +23,8 @@ extern uint16_t stat_batt_power; extern uint16_t temperature_min; extern uint16_t temperature_max; extern uint16_t CANerror; -extern bool batteryAllowsContactorClosing; +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false // Definitions for BMS status #define STANDBY 0 #define INACTIVE 1 diff --git a/Software/src/battery/RENAULT-ZOE-BATTERY.h b/Software/src/battery/RENAULT-ZOE-BATTERY.h index 96b6367e..083922f4 100644 --- a/Software/src/battery/RENAULT-ZOE-BATTERY.h +++ b/Software/src/battery/RENAULT-ZOE-BATTERY.h @@ -23,6 +23,8 @@ extern uint16_t stat_batt_power; extern uint16_t temperature_min; extern uint16_t temperature_max; extern uint16_t CANerror; +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false // Definitions for BMS status #define STANDBY 0 #define INACTIVE 1 diff --git a/Software/src/battery/TEST-FAKE-BATTERY.h b/Software/src/battery/TEST-FAKE-BATTERY.h index 0cd3704c..808c9216 100644 --- a/Software/src/battery/TEST-FAKE-BATTERY.h +++ b/Software/src/battery/TEST-FAKE-BATTERY.h @@ -25,8 +25,9 @@ extern uint16_t temperature_min; //C+1, Goes thru convert2unsignedint16 funct extern uint16_t temperature_max; //C+1, Goes thru convert2unsignedint16 function (15.0C = 150, -15.0C = 65385) extern uint16_t cell_max_voltage; //mV, 0-4350 extern uint16_t cell_min_voltage; //mV, 0-4350 -extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false -extern uint8_t LEDcolor; //Enum, 0-10 +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false +extern uint8_t LEDcolor; //Enum, 0-10 // Definitions for bms_status #define STANDBY 0 #define INACTIVE 1 diff --git a/Software/src/inverter/BYD-CAN.h b/Software/src/inverter/BYD-CAN.h index 411506d7..23df0796 100644 --- a/Software/src/inverter/BYD-CAN.h +++ b/Software/src/inverter/BYD-CAN.h @@ -20,6 +20,8 @@ extern uint16_t temperature_max; extern uint16_t CANerror; extern uint16_t min_voltage; extern uint16_t max_voltage; +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false // Definitions for BMS status #define STANDBY 0 #define INACTIVE 1 diff --git a/Software/src/inverter/BYD-MODBUS.h b/Software/src/inverter/BYD-MODBUS.h index 4252ba0e..822b2ed7 100644 --- a/Software/src/inverter/BYD-MODBUS.h +++ b/Software/src/inverter/BYD-MODBUS.h @@ -29,7 +29,8 @@ extern uint16_t capacity_Wh_startup; extern uint16_t max_power; extern uint16_t max_voltage; extern uint16_t min_voltage; - +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false void handle_static_data_modbus_byd(); void handle_update_data_modbusp201_byd(); void handle_update_data_modbusp301_byd(); diff --git a/Software/src/inverter/LUNA2000-MODBUS.h b/Software/src/inverter/LUNA2000-MODBUS.h index b3766b0e..98d521d6 100644 --- a/Software/src/inverter/LUNA2000-MODBUS.h +++ b/Software/src/inverter/LUNA2000-MODBUS.h @@ -29,6 +29,8 @@ extern uint16_t capacity_Wh_startup; extern uint16_t max_power; extern uint16_t max_voltage; extern uint16_t min_voltage; +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false void update_modbus_registers_luna2000(); void handle_update_data_modbus32051(); diff --git a/Software/src/inverter/PYLON-CAN.h b/Software/src/inverter/PYLON-CAN.h index 4a29b22e..3d5266d2 100644 --- a/Software/src/inverter/PYLON-CAN.h +++ b/Software/src/inverter/PYLON-CAN.h @@ -20,6 +20,8 @@ extern uint16_t temperature_max; extern uint16_t CANerror; extern uint16_t min_voltage; extern uint16_t max_voltage; +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false // Definitions for BMS status #define STANDBY 0 #define INACTIVE 1 diff --git a/Software/src/inverter/SMA-CAN.h b/Software/src/inverter/SMA-CAN.h index 5f183be5..b28f3738 100644 --- a/Software/src/inverter/SMA-CAN.h +++ b/Software/src/inverter/SMA-CAN.h @@ -21,7 +21,9 @@ extern uint16_t cell_max_voltage; //mV, 0-4350 extern uint16_t cell_min_voltage; //mV, 0-4350 extern uint16_t min_voltage; extern uint16_t max_voltage; -extern uint8_t LEDcolor; //Enum, 0-10 +extern uint8_t LEDcolor; //Enum, 0-10 +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false // Definitions for BMS status #define STANDBY 0 #define INACTIVE 1 diff --git a/Software/src/inverter/SOFAR-CAN.h b/Software/src/inverter/SOFAR-CAN.h index 046a6e13..29489a0f 100644 --- a/Software/src/inverter/SOFAR-CAN.h +++ b/Software/src/inverter/SOFAR-CAN.h @@ -21,7 +21,8 @@ extern uint16_t temperature_max; //C+1, Goes thru convert2unsignedint16 funct extern uint16_t cell_max_voltage; //mV, 0-4350 extern uint16_t cell_min_voltage; //mV, 0-4350 extern uint8_t LEDcolor; //Enum, 0-10 -extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false extern uint16_t min_voltage; extern uint16_t max_voltage; diff --git a/Software/src/inverter/SOLAX-CAN.h b/Software/src/inverter/SOLAX-CAN.h index 8da7b6c5..4bb6c215 100644 --- a/Software/src/inverter/SOLAX-CAN.h +++ b/Software/src/inverter/SOLAX-CAN.h @@ -26,7 +26,8 @@ extern uint16_t min_voltage; extern uint16_t max_voltage; extern uint16_t cell_max_voltage; extern uint16_t cell_min_voltage; -extern bool inverterAllowsContactorClosing; +extern bool batteryAllowsContactorClosing; //Bool, 1=true, 0=false +extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false // Timeout in milliseconds #define SolaxTimeout 2000