mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Add freezing temperature overwriting
This commit is contained in:
parent
aba846d136
commit
3d79b094f2
2 changed files with 19 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
void update_modbus_registers_byd() {
|
void update_modbus_registers_byd() {
|
||||||
//Updata for ModbusRTU Server for BYD
|
//Updata for ModbusRTU Server for BYD
|
||||||
|
verify_temperature_modbus();
|
||||||
handle_update_data_modbusp201_byd();
|
handle_update_data_modbusp201_byd();
|
||||||
handle_update_data_modbusp301_byd();
|
handle_update_data_modbusp301_byd();
|
||||||
}
|
}
|
||||||
|
@ -106,3 +107,20 @@ void handle_update_data_modbusp301_byd() {
|
||||||
static uint16_t i = 300;
|
static uint16_t i = 300;
|
||||||
memcpy(&mbPV[i], battery_data, sizeof(battery_data));
|
memcpy(&mbPV[i], battery_data, sizeof(battery_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void verify_temperature_modbus() {
|
||||||
|
// This section checks if the battery temperature is negative, and incase it falls between -9.0 and -20.0C degrees
|
||||||
|
// The Fronius Gen24 (and other Fronius inverters also affected), will stop charge/discharge if the battery gets colder than -10°C.
|
||||||
|
// This is due to the original battery pack (BYD HVM), is a lithium iron phosphate battery, that cannot be charged in cold weather.
|
||||||
|
// When using EV packs with NCM/LMO/NCA chemsitry, this is not a problem, since these chemistries are OK for outdoor cold use.
|
||||||
|
if (temperature_min > 32768) { // Signed value on negative side
|
||||||
|
if (temperature_min < 65445 && temperature_min > 65335) { // Between -9.0 and -20.0C degrees
|
||||||
|
temperature_min = 65445; //Cap value to -9.0C
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (temperature_max > 32768) { // Signed value on negative side
|
||||||
|
if (temperature_max < 65445 && temperature_max > 65335) { // Between -9.0 and -20.0C degrees
|
||||||
|
temperature_max = 65445; //Cap value to -9.0C
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ extern uint16_t max_voltage;
|
||||||
extern uint16_t min_voltage;
|
extern uint16_t min_voltage;
|
||||||
|
|
||||||
void handle_static_data_modbus_byd();
|
void handle_static_data_modbus_byd();
|
||||||
|
void verify_temperature_modbus();
|
||||||
void handle_update_data_modbusp201_byd();
|
void handle_update_data_modbusp201_byd();
|
||||||
void handle_update_data_modbusp301_byd();
|
void handle_update_data_modbusp301_byd();
|
||||||
void update_modbus_registers_byd();
|
void update_modbus_registers_byd();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue