mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 09:49:32 +02:00
Update BYD-MODBUS-2-LEAF-CAN.ino
I think you got this wrong regarding the charge and discharge limits
This commit is contained in:
parent
a84add2d9f
commit
4179ad5f9f
1 changed files with 7 additions and 7 deletions
|
@ -182,11 +182,11 @@ void update_values_leaf_battery()
|
|||
{
|
||||
max_target_discharge_power = (LB_Discharge_Power_Limit * 1000); //kW to W
|
||||
}
|
||||
if(SOC == 10000) //Scaled SOC% value is 100.00%
|
||||
if(SOC == 0) //Scaled SOC% value is 0.00%, we should not discharge battery further
|
||||
{
|
||||
max_target_discharge_power = 0; //No need to charge further, set max power to 0
|
||||
max_target_discharge_power = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Define power able to be put into the battery */
|
||||
if(LB_MAX_POWER_FOR_CHARGER > 30) //if >30kW can be put into the battery
|
||||
{
|
||||
|
@ -200,11 +200,11 @@ void update_values_leaf_battery()
|
|||
{
|
||||
max_target_charge_power = (LB_MAX_POWER_FOR_CHARGER * 1000); //kW to W
|
||||
}
|
||||
if(SOC == 0) //Scaled SOC% value is 0.00%, we should not discharge battery further
|
||||
if(SOC == 10000) //Scaled SOC% value is 100.00%
|
||||
{
|
||||
max_target_charge_power = 0;
|
||||
max_target_charge_power = 0; //No need to charge further, set max power to 0
|
||||
}
|
||||
|
||||
|
||||
LB_Power = LB_Total_Voltage * LB_Current;//P = U * I
|
||||
stat_batt_power = convert2unsignedint16(LB_Power); //add sign if needed
|
||||
|
||||
|
@ -478,4 +478,4 @@ uint16_t convert2unsignedint16(uint16_t signed_value)
|
|||
{
|
||||
return signed_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue