Skip to content

Conversation

@brtietz
Copy link
Collaborator

@brtietz brtietz commented Sep 27, 2021

Adds crit_load_escalation to the relevant cmods. Brings the variables from the vartables into battery->advance such that the powerflow variables can use the outage code.

Needs to be paired with a SAM PR based on critical-load-ui branch, @cpaulgilman to create.

A future PR (ssc branch dispatch_for_grid_outage) will implement the outage behavior in dispatch, and clean up edge cases like the inverter night time loads.

Via email we had proposed making grid_outage and crit_load SSC outputs - should that happen on this PR or a different PR? If this one, which cmods are responsible for the output?

@sjanzou
Copy link
Collaborator

sjanzou commented Sep 28, 2021

Adds crit_load_escalation to the relevant cmods. Brings the variables from the vartables into battery->advance such that the powerflow variables can use the outage code.

Needs to be paired with a SAM PR based on critical-load-ui branch, @cpaulgilman to create.

A future PR (ssc branch dispatch_for_grid_outage) will implement the outage behavior in dispatch, and clean up edge cases like the inverter night time loads.

Via email we had proposed making grid_outage and crit_load SSC outputs - should that happen on this PR or a different PR? If this one, which cmods are responsible for the output?

I am branching off of your branch and Paul's SAM branch and including the monthly outputs for the Puerto Rico project

sjanzou
sjanzou previously approved these changes Sep 28, 2021
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.

Looks good, I am running into a hanging case at 67.8% file attached to this pull request
image

SAM project file case "PV Com grid out hanging"
Test_Case.zip

if (resilience) {
resilience->add_battery_at_outage_timestep(*batt->dispatch_model, lifetime_idx);
resilience->run_surviving_batteries(p_crit_load[lifetime_idx % n_rec_single_year], power_input_lifetime[lifetime_idx]);
resilience->run_surviving_batteries(p_crit_load_full[lifetime_idx], power_input_lifetime[lifetime_idx]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is p_crit_load_full the percentage (or timeseries) entered by the user?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

p_crit_load_full is a timeseries extended to lifetime by the compute module. p_crit_load is the year 1 timeseries. The GUI converts percentages into a kW timeseries in the "$MIMO$ elecload" equations on the Electric Load Crit page.

}
}
if (!crit_load_specified && batt->analyze_outage) {
throw exec_error("battery", "If grid_outage is specified in any time step, crit_load must have length > 0 and values > 0");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding this!

if (resilience) {
resilience->add_battery_at_outage_timestep(*batt->dispatch_model, idx);
resilience->run_surviving_batteries(p_crit_load_in[idx % nrec], sharedInverter->powerAC_kW, dcPower_kW,
resilience->run_surviving_batteries(p_crit_load_full[idx], sharedInverter->powerAC_kW, dcPower_kW,
Copy link
Collaborator

Choose a reason for hiding this comment

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

All are full lifetime now, yeah!

@sjanzou
Copy link
Collaborator

sjanzou commented Sep 28, 2021

Looks good, I am running into a hanging case at 67.8% file attached to this pull request
image

SAM project file case "PV Com grid out hanging"
Test_Case.zip

The issue is with peak shaving dispatch and not the grid outage. With either case in the above SAM file, the peak dispatch option will hang in SAM at 67/8% and debugging in the SDKTool, after the fixes in the Fix_issues branches of ssc and SAM to generate the lk script and match the grid targets dispatch option results, the issue is a stack overflow in the BatteryPowerFlow::calculateACConnected:
image

@sjanzou sjanzou self-requested a review September 28, 2021 08:38
@sjanzou sjanzou dismissed their stale review September 28, 2021 08:39

Failing for peak shaving dispatch per comment above

@sjanzou
Copy link
Collaborator

sjanzou commented Sep 28, 2021

Next issue is hanging for grid power targets and timestep resilency
image
image

Same issue as above with Test_Case.sam second case with time step resilency
image

image

Trace issue to possible incorrect sign - above cases run fine when sign is changed per pull request 619
image

@sjanzou
Copy link
Collaborator

sjanzou commented Sep 28, 2021

#620 merge still fails for case 3 of attached file per comment
Test_Case.zip

@sjanzou
Copy link
Collaborator

sjanzou commented Sep 29, 2021

Can we drop #618 and just use 620 and the fix you do in dispatch_for_grid_outage?

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.

Can we drop #618 and just use 620 and the fix you do in dispatch_for_grid_outage? Or, merge both in and then start a new branch to fix the resilency runner issue?

// Error checking trying to charge from grid when not allowed
if (!m_BatteryPower->canGridCharge && P_battery_ac < -tolerance) {
if ((fabs(P_grid_ac - P_grid_to_load_ac) > tolerance) && (-P_grid_ac > P_grid_to_load_ac)) {
if ((fabs(P_grid_ac - P_grid_to_load_ac) > tolerance) && (-P_grid_ac > P_grid_to_load_ac + tolerance)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this in 620, too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I merged 620 into this branch, so yes.

@cpaulgilman
Copy link
Collaborator

This SAM pull request should be ready to merge with this when ready: NREL/SAM#707

@brtietz
Copy link
Collaborator Author

brtietz commented Sep 29, 2021

@sjanzou In the interest of getting this merged sooner, I brought over a few key lines from dispatch_for_grid_outages that I think solve the stack overflow problems on this branch. The third test case works for me, let me know if anything else breaks.

dispatch_for_grid_outage is still broken as of this writing, since that code introduced some new problems. I'll try to get those problems fixed this week.

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.

All Test_case.sam cases running now with this branch (dispatch_for_grid_outages still broken as noted), this looks good to merge along with corresponding SAM pull request from Paul. Thanks!

@brtietz brtietz merged commit d07368a into develop Sep 30, 2021
@brtietz brtietz deleted the connect_outage_vars_to_powerflow branch December 7, 2021 16:50
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.

4 participants