[BUG] BMW I3 , charge/discharge limitation from BMS not pass
Describe the bug "Max discharge power" probably has a different meaning in the CAN message. To Reproduce rescale SOC do 11% and try deep discharge
Screenshots My testing 120Ah battery and deep discharginh: Scaled SOC: 11.11% (real: 0.00%) SOH: 90.00% Voltage: 322.7 V Current: -30.6 A Power: -9.8 kW Scaled total capacity: 41.8 kWh (real: 41.8 kWh) Scaled remaining capacity: 0 Wh (real: 0 Wh) Max discharge power: 75.6 kW Max charge power: 80.7 kW Max discharge current: 30.0 A (Manual) Max charge current: 30.0 A (Manual) Cell min/max: 3329 mV / 3398 mV Cell delta: 69 mV Temperature min/max: 30.0 °C / 31.0 °C System status: OK Battery discharging! (Settings limiting) Battery allows contactor closing: ✓ Inverter allows contactor closing: ✓ Power status: RUNNING
Scaled SOC: 11.11% (real: 0.00%) SOH: 90.00% Voltage: 300.2 V Current: -30.7 A Power: -9.2 kW Scaled total capacity: 41.8 kWh (real: 41.8 kWh) Scaled remaining capacity: 0 Wh (real: 0 Wh) Max discharge power: 79.1 kW Max charge power: 78.9 kW Max discharge current: 30.0 A (Manual) Max charge current: 30.0 A (Manual) Cell min/max: 2986 mV / 3260 mV Cell delta: 274 mV Temperature min/max: 30.0 °C / 32.0 °C System status: OK Battery discharging! (Settings limiting) Battery allows contactor closing: ✓ Inverter allows contactor closing: ✓ Power status: RUNNING SOC raw: 1050 SOC dash: 0 SOC OBD2: 0 You will see that the more discharged the battery is, the more it can discharge.
Diferent (MQTT) 60Ah battery and discharge test: Parameter Value bms_status ACTIVE pause_status RUNNING SOC 9.09 SOC_real 0 state_of_health 82 temperature_min 21 temperature_max 23 cpu_temp 70.55556 stat_batt_power 0 battery_current 0 battery_voltage 331.7 cell_max_voltage 3.517 cell_min_voltage 3.402 cell_voltage_delta 115 total_capacity 22040 remaining_capacity_real 0 remaining_capacity 0 max_discharge_power 196596 max_charge_power 0 settings_soc_scaling_active true settings_soc_scaling_max_percentage 10000 settings_soc_scaling_min_percentage -1000 settings_voltage_limits_active true settings_target_discharge_dv 3300 settings_target_charge_dv 3940 settings_max_charge_da 300 settings_max_discharge_da 300 last_update 1753404216977
The battery is discharged, but the discharge is maximum, the charge is 0.
Version and settings (please complete the following information):
- Software version: 8.15.dev
- Battery used: [BMW I3]
- Hardware used for Battery-Emulator: [HW_LILYGO/HW_STARK/HW_DEVKIT]
- CONTACTOR_CONTROL: [yes]
- MQTT: [yes]
I see that negative SOC scaling can create these overdischarged scenarios. Bit of improvement in this PR https://github.com/dalathegreat/Battery-Emulator/pull/1364
But the i3 value allowing very many kW even at 0% is strange. This needs to be investigated
I was not completely understood, although you are also right. I deliberately discharged the battery completely. I will deliberately charge the battery completely again.
What I want to show is this: remaining_capacity 0 max_discharge_power 196596 max_charge_power 0
The CAN message from the BMS containing the message about the maximum and minimum discharge/charge power may be misinterpreted.
Or maybe the BMS is not telling the truth, but in a discharged state, 60Ah and 120Ah behave the same.
I will fully charge next week.
We have several ways to terminate discharge and charge. All of them should be functional, as they increase safety in case one fails.
The BMS behavior is relatively complex, and it's difficult for me to translate it clearly.
Each parameter, each variable, is calculated by its own separate algorithm — none of them are derived from others by a shared formula. The algorithms are so well-crafted that in the mathematical model, their outputs match — for example: SOC = 100% Max charging current = 0 Max charging power = 0 Max voltage = 392 V Energy in battery = X Wh …but each of those values comes from a different algorithm.
In certain conditions, these different algorithms become unsynchronized. Example: Voltage = 395 V SOC = 100% Max charging current = 2 A Max charging power = 2 kW Energy = not matching SOC One thing that helps synchronize these algorithms is a smooth, continuously flowing time signal. If there’s a jump in time, especially a time shift backward, the algorithms go haywire.
I’ve been trying to verify whether the BMS algorithms correctly report power limitations at the extremes, independent of the reported SOC — because SOC isn’t always correct at startup, and the battery sometimes needs to be forced to fully charge or discharge and then reset (power cycle).
I discovered that during discharge, the CAN message we interpret as “max charging power” drops to zero, while “max discharging power” jumps to a high value — this is the opposite of what you’d expect.
Now I need to re-test the full charge condition to verify if the reverse happens. Please give me another week to confirm.
Here it is tested whether the termination of charging by the BMS works, assuming that the SOC state is not being looked at. The status of the battery counters is slightly scattered.
Scaled SOC: 95.21% (real: 99.50%) <---- SOH: 90.00% Voltage: 400.6 V Current: 5.3 A Power: 2.1 kW Scaled total capacity: 48.0 kWh (real: 41.8 kWh) Scaled remaining capacity: 45.7 kWh (real: 35.8 kWh) Max discharge power: 42.8 kW <---- Max charge power: 18.5 kW <---- Max discharge current: 30.0 A (Manual) Max charge current: 30.0 A (Manual) Cell min/max: 4144 mV / 4179 mV Cell delta: 35 mV Temperature min/max: 28.0 °C / 30.0 °C System status: OK Battery charging! (Inverter limiting) Battery allows contactor closing: ✓ Inverter allows contactor closing: ✓ Power status: RUNNING
// example SOC 100%, voltage 400V not 403V, charging progress..... SOC stop, Energy stop, voltage up... charging progress. Scaled SOC: 95.65% (real: 100.00%) <---- SOH: 90.00% Voltage: 400.8 V Current: 4.5 A Power: 1.8 kW Scaled total capacity: 48.0 kWh (real: 41.8 kWh) Scaled remaining capacity: 46.0 kWh (real: 35.9 kWh) Max discharge power: 42.8 kW <---- Max charge power: 16.9 kW <---- Max discharge current: 30.0 A (Manual) Max charge current: 30.0 A (Manual) Cell min/max: 4148 mV / 4183 mV Cell delta: 35 mV Temperature min/max: 28.0 °C / 30.0 °C System status: OK Battery charging! (Inverter limiting) Battery allows contactor closing: ✓ Inverter allows contactor closing: ✓ Power status: RUNNING
//switch charger to grid (sun is down) caled SOC: 95.65% (real: 100.00%) <---- SOH: 90.00% Voltage: 403.2 V Current: 30.1 A Power: 12.0 kW Scaled total capacity: 48.0 kWh (real: 41.8 kWh) Scaled remaining capacity: 46.0 kWh (real: 35.9 kWh) Max discharge power: 42.7 kW <---- Max charge power: 13.6 kW <---- Max discharge current: 30.0 A (Manual) Max charge current: 30.0 A (Manual) Cell min/max: 4153 mV / 4188 mV Cell delta: 35 mV Temperature min/max: 28.0 °C / 30.0 °C System status: OK Temperature min/max: 28.0 °C / 30.0 °C System status: OK Battery charging! (Battery limiting) Battery allows contactor closing: ✓ Inverter allows contactor closing: ✓ Power status: RUNNING
Scaled SOC: 95.65% (real: 100.00%) <---- SOH: 90.00% Voltage: 403.5 V Current: 13.8 A Power: 5.5 kW Scaled total capacity: 48.0 kWh (real: 41.8 kWh) Scaled remaining capacity: 46.0 kWh (real: 35.9 kWh) Max discharge power: 42.7 kW <---- Max charge power: 5.6 kW <---- Max discharge current: 30.0 A (Manual) Max charge current: 13.9 A (BMS) Cell min/max: 4173 mV / 4210 mV Cell delta: 37 mV Temperature min/max: 28.0 °C / 30.0 °C System status: OK Battery charging! (Inverter limiting) Battery allows contactor closing: ✓ Inverter allows contactor closing: ✓ Power status: RUNNING
caled SOC: 95.65% (real: 100.00%) <---- SOH: 90.00% Voltage: 403.4 V Current: 0.0 A Power: 0 W Scaled total capacity: 48.0 kWh (real: 41.8 kWh) Scaled remaining capacity: 46.0 kWh (real: 35.9 kWh) Max discharge power: 42.7 kW <---- Max charge power: 0 W <---- Max discharge current: 30.0 A (Manual) Max charge current: 0.0 A (BMS) Cell min/max: 4175 mV / 4212 mV Cell delta: 37 mV Temperature min/max: 28.0 °C / 30.0 °C System status: OK Battery idle Battery allows contactor closing: ✓ Inverter allows contactor closing: ✓ Power status: RUNNING "charge.txt" 168L, 5209C uložen
So the CAN message about maximum charging power is correct, but it is interesting that it is also used for discharging....