Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BMW i3 remaining capacity issue for 2nd battery #725

Closed
pmajor021 opened this issue Dec 31, 2024 · 1 comment
Closed

BMW i3 remaining capacity issue for 2nd battery #725

pmajor021 opened this issue Dec 31, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@pmajor021
Copy link
Contributor

pmajor021 commented Dec 31, 2024

Expected Behavior

expected to see the remaining capacity on the webpage like 1st battery

Actual Behavior

it shows the total capacity

Steps to Reproduce the Problem

open the webpage

Settings

  • Software version: 7.9.2
  • Battery used: BMW i3 double
  • Inverter communication protocol: BYD ModBus
  • Hardware used for Battery-Emulator: HW_LILYGO
  • CONTACTOR_CONTROL: no
  • CAN_ADDON: yes
  • WEBSERVER: yes
  • MQTT: yes

A typo occurred while copying from battery1 to battery2:

datalayer.battery.info.total_capacity_Wh = (battery_energy_content_maximum_kWh * 1000); // Convert kWh to Wh
datalayer.battery.status.remaining_capacity_Wh = battery_predicted_energy_charge_condition;

vs.

missing line with datalayer.battery2.info.total_capacity_Wh, hence a wrong calculation for remaining
datalayer.battery2.status.remaining_capacity_Wh = (battery2_energy_content_maximum_kWh * 1000); // Convert kWh to Wh

@lenvm lenvm added the bug Something isn't working label Jan 1, 2025
@pmajor021
Copy link
Contributor Author

pmajor021 commented Jan 3, 2025

BMW-I3-BATTERY.cpp

@ 370

  datalayer.battery2.status.current_dA = battery2_current;

-  datalayer.battery2.status.remaining_capacity_Wh = (battery2_energy_content_maximum_kWh * 1000);  // Convert kWh to Wh
+  datalayer.battery2.info.total_capacity_Wh = (battery2_energy_content_maximum_kWh * 1000);  // Convert kWh to Wh

-  datalayer.battery2.status.soh_pptt = battery2_soh * 100;
+  datalayer.battery2.status.remaining_capacity_Wh = battery2_predicted_energy_charge_condition;

-  if (battery2_BEV_available_power_longterm_discharge > 65000) {
-    datalayer.battery2.status.max_discharge_power_W = 65000;
-  } else {
-    datalayer.battery2.status.max_discharge_power_W = battery2_BEV_available_power_longterm_discharge;
-  }
-  if (battery2_BEV_available_power_longterm_charge > 65000) {
-    datalayer.battery2.status.max_charge_power_W = 65000;
-  } else {
-    datalayer.battery2.status.max_charge_power_W = battery2_BEV_available_power_longterm_charge;
-  }
+  datalayer.battery2.status.soh_pptt = battery2_soh * 100;
+
+  datalayer.battery2.status.max_discharge_power_W = battery2_BEV_available_power_longterm_discharge;
+  
+  datalayer.battery2.status.max_charge_power_W = battery2_BEV_available_power_longterm_charge;
  
  datalayer.battery2.status.temperature_min_dC = battery2_temperature_min * 10;  // Add a decimal

  datalayer.battery2.status.temperature_max_dC = battery2_temperature_max * 10;  // Add a decimal

pmajor021 added a commit to pmajor021/Battery-Emulator that referenced this issue Jan 15, 2025
fix forBMW i3 remaining capacity issue for 2nd battery dalathegreat#725
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants