mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 02:39:57 +02:00
Increase power pulled from LEAF. Remove Fronius mention
This commit is contained in:
parent
65b6448b43
commit
2a6544d416
2 changed files with 21 additions and 14 deletions
|
@ -97,8 +97,6 @@ static uint8_t LEAF_Battery_Type = ZE0_BATTERY;
|
|||
#define MIN_CELL_VOLTAGE 2700 //Battery is put into emergency stop if one cell goes below this value
|
||||
#define MAX_CELL_DEVIATION 500 //LED turns yellow on the board if mv delta exceeds this value
|
||||
#define WH_PER_GID 77 //One GID is this amount of Watt hours
|
||||
#define LB_MAX_SOC 1000 //LEAF BMS never goes over this value. We use this info to rescale SOC% sent to Fronius
|
||||
#define LB_MIN_SOC 0 //LEAF BMS never goes below this value. We use this info to rescale SOC% sent to Fronius
|
||||
static uint16_t LB_Discharge_Power_Limit = 0; //Limit in kW
|
||||
static uint16_t LB_Charge_Power_Limit = 0; //Limit in kW
|
||||
static int16_t LB_MAX_POWER_FOR_CHARGER = 0; //Limit in kW
|
||||
|
@ -211,8 +209,8 @@ void update_values_battery() { /* This function maps all the values fetched via
|
|||
}
|
||||
|
||||
// Define power able to be discharged from battery
|
||||
if (LB_Discharge_Power_Limit > 30) { //if >30kW can be pulled from battery
|
||||
system_max_discharge_power_W = 30000; //cap value so we don't go over the Fronius limits
|
||||
if (LB_Discharge_Power_Limit > 60) { //if >60kW can be pulled from battery
|
||||
system_max_discharge_power_W = 60000; //cap value so we don't go over uint16 value
|
||||
} else {
|
||||
system_max_discharge_power_W = (LB_Discharge_Power_Limit * 1000); //kW to W
|
||||
}
|
||||
|
@ -221,8 +219,8 @@ void update_values_battery() { /* This function maps all the values fetched via
|
|||
}
|
||||
|
||||
// Define power able to be put into the battery
|
||||
if (LB_Charge_Power_Limit > 30) { //if >30kW can be put into the battery
|
||||
system_max_charge_power_W = 30000; //cap value so we don't go over the Fronius limits
|
||||
if (LB_Charge_Power_Limit > 60) { //if >60kW can be put into the battery
|
||||
system_max_charge_power_W = 60000; //cap value so we don't go over uint16 value
|
||||
} else {
|
||||
system_max_charge_power_W = (LB_Charge_Power_Limit * 1000); //kW to W
|
||||
}
|
||||
|
|
|
@ -93,10 +93,19 @@ void handle_update_data_modbusp301_byd() {
|
|||
battery_data[5] =
|
||||
system_remaining_capacity_Wh; // Id.: p306 Value.: 13260 Scaled value.: 13,26kWh Comment.: remaining cap: 7.68kWh
|
||||
}
|
||||
if (system_max_discharge_power_W > 30000) {
|
||||
battery_data[6] = 30000;
|
||||
} else {
|
||||
battery_data[6] =
|
||||
system_max_discharge_power_W; // Id.: p307 Value.: 25604 Scaled value.: 25,604kW Comment.: max/target discharge power: 0W (0W > restricts to no discharge)
|
||||
}
|
||||
|
||||
if (system_max_charge_power_W > 30000) {
|
||||
battery_data[7] = 30000;
|
||||
} else {
|
||||
battery_data[7] =
|
||||
system_max_charge_power_W; // Id.: p308 Value.: 25604 Scaled value.: 25,604kW Comment.: max/target charge power: 4.3kW (during charge), both 307&308 can be set (>0) at the same time
|
||||
}
|
||||
//Battery_data[8] set previously in function // Id.: p309 Value.: 3161 Scaled value.: 316,1VDC Comment.: Batt Voltage outer (0 if status !=3, maybe a contactor closes when active): 173.4V
|
||||
battery_data[9] =
|
||||
2000; // Id.: p310 Value.: 64121 Scaled value.: 6412,1W Comment.: Current Power to API: if>32768... -(65535-61760)=3775W
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue