Skip to content

Commit

Permalink
Change inverterAllowsContactorClosing logic to default OFF
Browse files Browse the repository at this point in the history
  • Loading branch information
dalathegreat committed Nov 28, 2023
1 parent 20d00cf commit ca21dae
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 11 deletions.
16 changes: 14 additions & 2 deletions Software/Software.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Software/src/battery/BMW-I3-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Software/src/battery/CHADEMO-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Software/src/battery/IMIEV-CZERO-ION-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Software/src/battery/KIA-HYUNDAI-64-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Software/src/battery/RENAULT-ZOE-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions Software/src/battery/TEST-FAKE-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Software/src/inverter/BYD-CAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Software/src/inverter/BYD-MODBUS.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions Software/src/inverter/LUNA2000-MODBUS.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions Software/src/inverter/PYLON-CAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Software/src/inverter/SMA-CAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Software/src/inverter/SOFAR-CAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion Software/src/inverter/SOLAX-CAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca21dae

Please sign in to comment.