Skip to content

Conversation

@brtietz
Copy link
Collaborator

@brtietz brtietz commented Jul 19, 2021

Adds new variables to lib battery powerflow and partially connects them to the battery cmods.

New inputs:

  • isOutageStep
  • powerInterconnectionLimit
  • powerCurtailmentLimit
  • powerCritLoad

New outputs:

  • powerInterconnectionLoss
  • powerCritLoadUnmet

powerInterconnectionLoss calculates the power lost due to interconnection limits, curtailment, or a grid outage. It's not currently possible to specify a grid outage in the GUI (only the tests), but the behavior of the variable can be seen by specifying the interconnection limit to zero.

This is the first of several PRs over the next few weeks for the Puerto Rico project. Future PRs will include:

  • Connecting critical load from the cmod level to this code, possibly including a new escalation variable
  • Refactoring the resilience runner such that it uses this code and calculates losses properly (see Battery losses do not affect resilience runner #590)
  • Updating dispatch to respond to an outage (utilizing portions of the resilience runner for simulation steps)

Some of this work builds towards NREL/SAM#181 - since the dispatch classes will now have access towards the numbers they need.

brtietz added 17 commits July 1, 2021 15:24
…n access the lifetime labels"

This reverts commit ad9c316.
…werflow code such that the new variable (powerInterconnecitonLoss) always has the info it needs to report the correct value. Still expect unit test failures for the powerflow code at this stage
…t, then battery, even though it's all the same power at that point
@sjanzou
Copy link
Collaborator

sjanzou commented Jul 20, 2021

"powerInterconnectionLoss calculates the power lost due to interconnection limits, curtailment, or a grid outage. It's not currently possible to specify a grid outage in the GUI (only the tests), but the behavior of the variable can be seen by specifying the interconnection limit to zero."
This statement seems to conflict with the statement on the Grid Limits page
image

I understand that if the grid is down, then no exporting is possible but I think that the text on the UI should be updated for grid outages...
@cpaulgilman, what do you think?

Copy link
Collaborator

@sjanzou sjanzou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything seems okay, I would still like to go through with the tests and merge in the PVSmoothing changes so I do not have to update all the calls to dispatch_t with the additional argument added to the base class ;-)

batt_vars->gridCurtailmentLifetime_MW = curtailment_limit;
batt_vars->grid_interconnection_limit_kW = interconnection_limit;
if (interconnection_limit < 1e+38) {
batt_vars->enable_interconnection_limit = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the interconnection limit be forced on? We have a separate variable to enable the interconnection limit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular chunk of code doesn't have access to the vartable, so it has to interpret the state of the boolean from the double value. The ssc vartable value you're thinking of is checked in cm_battwatts::setup_variables. I thought this was preferable to passing in two inputs to this function, but welcome other opinions (such as passing in the vartable).

batt->update_grid_power(*this, PVSystem->p_systemACPower[idx], p_load_full[idx], idx);
if (en_batt) {
if (batt->is_outage_step(idx % nrec)) {
batt->update_grid_power(*this, PVSystem->p_systemACPower[idx], p_crit_load_in[idx % nrec], idx);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How dows this work? If the grid is out, how is there any grid power to update?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is responsible for updating the interconnection loss variable, given the critical load and the updated PV generation, given the set of AC losses that weren't available when the battery is first run.

@brtietz
Copy link
Collaborator Author

brtietz commented Jul 20, 2021

Everything seems okay, I would still like to go through with the tests and merge in the PVSmoothing changes so I do not have to update all the calls to dispatch_t with the additional argument added to the base class ;-)

I'm fine to hold this until PV smoothing is merged in and take care of the merge conflicts on this branch, if we think we can get PV smoothing merged in within the next week or so.

@cpaulgilman
Copy link
Collaborator

"powerInterconnectionLoss calculates the power lost due to interconnection limits, curtailment, or a grid outage. It's not currently possible to specify a grid outage in the GUI (only the tests), but the behavior of the variable can be seen by specifying the interconnection limit to zero."
This statement seems to conflict with the statement on the Grid Limits page
image

I understand that if the grid is down, then no exporting is possible but I think that the text on the UI should be updated for grid outages...
@cpaulgilman, what do you think?

I can update UI (and Help) descriptions like these after the code is implemented. The "interconnection loss" includes all power "lost" at the interconnection point, i.e., not delivered to the grid because of the interconnection limit, curtailment, or a grid outage.

Copy link
Collaborator

@dguittet dguittet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! LGTM.

I think some updated comments, and updating this PR's info and the things in Help to make clear what power flows are changed and how, by an outage vs grid limits, etc (such as asked by my comments).

P_pv_to_batt_dc = 0.0; // Don't allow losses to drive this negative
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line?

EXPECT_NEAR(m_batteryPower->powerBatteryToLoad, 0, error);
EXPECT_NEAR(m_batteryPower->powerConversionLoss, 0, error);
EXPECT_NEAR(m_batteryPower->powerSystemLoss, 0.5, error);
EXPECT_NEAR(m_batteryPower->powerCritLoadUnmet, 25.5, error);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to remember and make explicit to users that the Critical Unmet load can be higher than original critical load due to system losses

check_net_flows("1st case");

// battery steals all of the energy and leaves critical load unmet - dispatch controller needs to avoid this situation
m_batteryPower->powerBatteryDC = -100;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In an earlier case line 826, the battery charging is reduced because it couldn't be charged from grid during an outage. Here the battery charging is not reduced because it could be charged from the system. While I understand the how this is an intermediate state for the dispatch / power flow code, it's another thing we need to make explicit.

brtietz added 3 commits August 2, 2021 13:49
…ariables that it handles are correct, but these losses need to be recorded somewhere for things to add up
…to show losses in the powerflow calculations. Fix the interconnection losses reported at night. Fix a few typos and copy paste errors throughout the loss code
@brtietz brtietz requested review from dguittet and sjanzou August 4, 2021 21:40
Copy link
Collaborator

@sjanzou sjanzou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the pv smoothing library. Did Paul sign off on the new output names? LGTM and all tests passing!

{ SSC_OUTPUT, SSC_ARRAY, "ac_transmission_loss", "Transmission loss", "kW", "", "Time Series (Transmission)", "", "", "" },

// Post batt AC losses - record so the powerflows from PV and batt to grid add up properly
{ SSC_OUTPUT, SSC_ARRAY, "ac_perf_adj_loss", "AC performance adjustment loss", "kW", "", "Time Series (AC Loss)", "", "", "" },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpaulgilman, do you like the "friendly" names here?

@brtietz brtietz merged commit 0b4dabe into develop Aug 6, 2021
@brtietz brtietz deleted the grid_outage_powerflow branch August 10, 2021 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants