Update dispatch for grid outages#632
Conversation
…t and construct one. set up outage framework including outage manager in dispatch functions for automated btm and manual
… way, fix an efficiency declaration issue in battwatts, and a constructor issue in the powerflow code
…ns to the resiliency runner. Update the tests in cmod_battery_test to reflect the decreased reslience due to these restrictions. Make the restrictions more explicit in the resiliency code to save on iterations
…or_grid_outage
…veral bugfixes to both the outage dispatch and btm dispatch constraints, including appropriate test updates. custom dispatch is now further constrianed from discharging to the grid
…e critical load met
…use during outage
…or_grid_outage
…or_grid_outage
…ariables to set up new tests, still need to update powerflow code
…osses when grid is down and battery is fully discharged
…/NREL/ssc into dispatch_for_grid_outage
…or_grid_outage
…eet critical load. Add efficiency into interative loop for charging such that there isn't critical load unmet during charging steps
…or_grid_outage
…or_grid_outage
…increase discharging or decrease charging to compensate
|
It looks like I had to solve #614 to get one of the outage tests passing on Linux, so add that to the pile of issues this PR will fix. |
…or_grid_outage
…s only updated once. Fix sign errors in DC charging that allow it to converge
…le and to/from grid
|
The file I've been using to test this is attached here: |
sjanzou
left a comment
There was a problem hiding this comment.
I tested with your file posted and went through some other cases and found some interesting plots and the annoying desired duration in hours bug in the parametrics, kWh can be used with additional calculations

with some results that @n8blair might be interested in

@cpaulgilman may have an issue with the limits on the Battery page in the fuel cell and the dispatch page in the battery configuration (I do not see a way around that)

Hmmm.... Fuel cell is failing with an 8760 weather file and an 8760 load:

File for testing with failing fuel cell configuration
test_grid_outage_2_fuelcell.zip
| bool chargeOnlySystemExceedLoad, | ||
| bool dischargeOnlyLoadExceedSystem | ||
| bool dischargeOnlyLoadExceedSystem, | ||
| double SOC_min_outage |
There was a problem hiding this comment.
at some point we should stick with one naming convention and c++ instead of java structure. Just a comment and nothing specific to this pull request
| powerTempLoss_kW = tempLoss * m_numInverters * util::watt_to_kilowatt; | ||
| powerLossTotal_kW = powerDC_kW - powerAC_kW; | ||
| if (powerDC_kW < 0.0) | ||
| powerLossTotal_kW = fabs(powerDC_kW) - fabs(powerAC_kW); // DC connected grid charging |
There was a problem hiding this comment.
Are the charging and discharging losses all accounted for in the difference here?
There was a problem hiding this comment.
This is the fix for #631
The more detailed loss accounting is in lib_battery_power_dispatch.cpp, scattered throughout the calculation functions. There's also code in cmod_battery that does updates for the actual AC losses in pvsamv1. Many of the changes in those three files are related to loss computation.
|
|
||
| // Power converters and topology | ||
| batt_vars->batt_topology = ChargeController::AC_CONNECTED; | ||
| batt_vars->batt_ac_dc_efficiency = 96; |
There was a problem hiding this comment.
Is this really stating that changing and discharging efficiency is the same?
There was a problem hiding this comment.
Sort of - this variable might be better named batt_ac_to_dc_efficiency. Since battwatts doesn't allow customization of these in the GUI, they are hardcoded to the detailed battery defaults.
Note that these lines have been moved to fix a big in the batt_power_charge/discharge kw (lines 209 and 210 in this PR), they haven't been changed.
… overwrites crit load in vartable
|
The issue with fuel cell and generic system was that battstor was overwriting the values of crit_load before cmod_battery had a chance to read them. I've fixed that issue, but a few others have cropped up in the ssc tests. I'll fix those tomorrow, and it'll hopefully be ready for another round of review in the afternoon. |
Thanks for adding. When I opened this, there were no critical loads specified or outage time periods (the 8760 was all 0), is that expected? |
…or_grid_outage
…or_grid_outage
…ge value that said energy to power to match units. Set p_battery_ac to zero when it's less than tolerance in the powerflow code
|
@dguittet Great catch on all of the above. Those should be fixed in the latest commit. |
dguittet
left a comment
There was a problem hiding this comment.
Really well done on this large piece of work! And thanks for splitting up the grid outage work into separate PRs.
| if (pv_kwac > crit_load_kwac){ | ||
| double remaining_kwdc = -(pv_kwac - crit_load_kwac) * m_batteryPower->singlePointEfficiencyACToDC; | ||
| remaining_kwdc = fmax(remaining_kwdc, max_charge_kwdc); | ||
| dispatch_kw(remaining_kwdc); |
There was a problem hiding this comment.
looks like dispatch_kw is no longer used. would it be ok to delete?
| else if (h > 16) { | ||
| load_prediction.push_back(700); | ||
| } | ||
| else if (h > 18) { |
There was a problem hiding this comment.
this h>18 condition never comes on because anything > 18 is > 16 so will be set to 700
There was a problem hiding this comment.
Right, thanks. Removing this doesn't change the test result, and these tests still show what I want them to show (ability to resume normal dispatch after an outage), so I've just removed this else if block.
|
Merged in 9cf27a1 |



Brings the grid outage code into the mainline battery dispatch. Allows the resiliency runner and the outage dispatch to use the same code. Pairs with SAM pull request NatLabRockies/SAM#722, please pull dispatch_for_grid_outage branch to test.
Solves #631 and #590
Recommended tests: