mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Fix SOC% value
This commit is contained in:
parent
5a0f9ee8e6
commit
79ae74122a
2 changed files with 12 additions and 12 deletions
|
@ -17,7 +17,7 @@
|
||||||
//#define KIA_E_GMP_BATTERY
|
//#define KIA_E_GMP_BATTERY
|
||||||
//#define KIA_HYUNDAI_HYBRID_BATTERY
|
//#define KIA_HYUNDAI_HYBRID_BATTERY
|
||||||
//#define MG_5_BATTERY
|
//#define MG_5_BATTERY
|
||||||
#define NISSAN_LEAF_BATTERY
|
//#define NISSAN_LEAF_BATTERY
|
||||||
//#define PYLON_BATTERY
|
//#define PYLON_BATTERY
|
||||||
//#define RENAULT_KANGOO_BATTERY
|
//#define RENAULT_KANGOO_BATTERY
|
||||||
//#define RENAULT_ZOE_GEN1_BATTERY
|
//#define RENAULT_ZOE_GEN1_BATTERY
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
//#define BYD_CAN //Enable this line to emulate a "BYD Battery-Box Premium HVS" over CAN Bus
|
//#define BYD_CAN //Enable this line to emulate a "BYD Battery-Box Premium HVS" over CAN Bus
|
||||||
//#define BYD_SMA //Enable this line to emulate a SMA compatible "BYD Battery-Box HVS 10.2KW battery" over CAN bus
|
//#define BYD_SMA //Enable this line to emulate a SMA compatible "BYD Battery-Box HVS 10.2KW battery" over CAN bus
|
||||||
//#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU
|
//#define BYD_MODBUS //Enable this line to emulate a "BYD 11kWh HVM battery" over Modbus RTU
|
||||||
#define BYD_KOSTAL_RS485 //Enable this line to emulate a "BYD 11kWh HVM battery" over Kostal RS485
|
//#define BYD_KOSTAL_RS485 //Enable this line to emulate a "BYD 11kWh HVM battery" over Kostal RS485
|
||||||
//#define PYLON_CAN //Enable this line to emulate a "Pylontech battery" over CAN bus
|
//#define PYLON_CAN //Enable this line to emulate a "Pylontech battery" over CAN bus
|
||||||
//#define SMA_CAN //Enable this line to emulate a "BYD Battery-Box H 8.9kWh, 7 mod" over CAN bus
|
//#define SMA_CAN //Enable this line to emulate a "BYD Battery-Box H 8.9kWh, 7 mod" over CAN bus
|
||||||
//#define SMA_TRIPOWER_CAN //Enable this line to emulate a "SMA Home Storage battery" over CAN bus
|
//#define SMA_TRIPOWER_CAN //Enable this line to emulate a "SMA Home Storage battery" over CAN bus
|
||||||
|
|
|
@ -213,26 +213,26 @@ void update_RS485_registers_inverter() {
|
||||||
.max_discharge_amp_dA; //Cap the value to the max allowed Amp. Some inverters cannot handle large values.
|
.max_discharge_amp_dA; //Cap the value to the max allowed Amp. Some inverters cannot handle large values.
|
||||||
}
|
}
|
||||||
|
|
||||||
float2frame(frame2, (float)datalayer.battery.status.voltage_dV / 10, 6);
|
float2frame(frame2, (float)(datalayer.battery.status.voltage_dV / 10), 6);
|
||||||
|
|
||||||
float2frameMSB(frame2, (float)datalayer.battery.info.max_design_voltage_dV / 10, 12);
|
float2frameMSB(frame2, (float)(datalayer.battery.info.max_design_voltage_dV / 10), 12);
|
||||||
float2frameMSB(
|
float2frameMSB(
|
||||||
frame2, (float)(datalayer.battery.status.temperature_max_dC + datalayer.battery.status.temperature_min_dC) / 20,
|
frame2, (float)((datalayer.battery.status.temperature_max_dC + datalayer.battery.status.temperature_min_dC) / 20),
|
||||||
16);
|
16);
|
||||||
|
|
||||||
float2frameMSB(frame2, (float)datalayer.battery.status.current_dA, 20);
|
float2frameMSB(frame2, (float)datalayer.battery.status.current_dA, 20);
|
||||||
float2frameMSB(frame2, (float)datalayer.battery.status.current_dA, 24);
|
float2frameMSB(frame2, (float)datalayer.battery.status.current_dA, 24);
|
||||||
|
|
||||||
float2frameMSB(frame2, (float)discharge_current / 10, 28);
|
float2frameMSB(frame2, (float)(discharge_current / 10), 28);
|
||||||
float2frameMSB(frame2, (float)discharge_current / 10, 32);
|
float2frameMSB(frame2, (float)(discharge_current / 10), 32);
|
||||||
|
|
||||||
float2frameMSB(frame2, (float)datalayer.battery.status.temperature_max_dC / 10, 40);
|
float2frameMSB(frame2, (float)(datalayer.battery.status.temperature_max_dC / 10), 40);
|
||||||
float2frameMSB(frame2, (float)datalayer.battery.status.temperature_min_dC / 10, 44);
|
float2frameMSB(frame2, (float)(datalayer.battery.status.temperature_min_dC / 10), 44);
|
||||||
|
|
||||||
float2frame(frame2, (float)datalayer.battery.status.cell_max_voltage_mV / 1000, 46);
|
float2frame(frame2, (float)(datalayer.battery.status.cell_max_voltage_mV / 1000), 46);
|
||||||
float2frame(frame2, (float)datalayer.battery.status.cell_min_voltage_mV / 1000, 50);
|
float2frame(frame2, (float)(datalayer.battery.status.cell_min_voltage_mV / 1000), 50);
|
||||||
|
|
||||||
frame2[58] = (byte)datalayer.battery.status.reported_soc / 100;
|
frame2[58] = (byte)(datalayer.battery.status.reported_soc / 100);
|
||||||
|
|
||||||
register_content_ok = true;
|
register_content_ok = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue