Skip to content

Commit

Permalink
first attempt at bringing in PV charging constraints. Doesn't work we…
Browse files Browse the repository at this point in the history
…ll yet
  • Loading branch information
brtietz committed Oct 11, 2023
1 parent 25572cc commit 2e5f987
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions shared/lib_battery_dispatch_pvsmoothing_fom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ void dispatch_pvsmoothing_front_of_meter_t::update_dispatch(size_t year, size_t
// calculate desired(unconstrained) battery power
battery_power_terminal = out_power - pv_power; // positive is power leaving battery(discharging)

// If grid charging is not allowed, restrict charging to PV output power
if (!m_batteryPower->canGridCharge && battery_power_terminal < 0) {
if (std::abs(battery_power_terminal) > std::abs(pv_power)) {
battery_power_terminal = -1.0 * pv_power;
}
}

// adjust battery power to factor in battery constraints
// check SOC limit - reduce battery power if either soc exceeds either soc_min or soc_max
// check full
Expand Down

0 comments on commit 2e5f987

Please sign in to comment.