Skip to content

Commit

Permalink
Incorperate inverter losses into grid limits code
Browse files Browse the repository at this point in the history
  • Loading branch information
brtietz committed Feb 14, 2025
1 parent 305298d commit d13dc07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion shared/lib_battery_powerflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ void BatteryPowerFlow::calculateACConnected()
P_grid_ac = P_gen_ac - P_load_ac;

if (P_grid_ac > P_grid_limit_ac) {
double grid_diff = P_grid_ac - P_grid_limit_ac;
double grid_diff = P_grid_ac - P_grid_limit_ac - P_inverter_draw_ac;
// Update grid variables first
P_grid_ac -= grid_diff;
P_interconnection_loss_ac += grid_diff;
Expand Down Expand Up @@ -1036,6 +1036,9 @@ void BatteryPowerFlow::calculateDCConnected()
if (std::abs(P_interconnection_loss_ac) < m_BatteryPower->tolerance) {
P_interconnection_loss_ac = 0;
}
if (std::abs(P_batt_to_grid_ac) < m_BatteryPower->tolerance) {
P_batt_to_grid_ac = 0;
}

// assign outputs
m_BatteryPower->singlePointEfficiencyDCToAC = efficiencyDCAC;
Expand Down

0 comments on commit d13dc07

Please sign in to comment.