NREL / SAM

System Advisor Model (SAM)
BSD 3-Clause "New" or "Revised" License
337 stars 139 forks source link

Electricity Purchases for Front-of-Meter Battery Configurations #370

Closed cpaulgilman closed 3 years ago

cpaulgilman commented 4 years ago

For PV Battery / Single Owner and Generic Battery / Single Owner, battery charging power is treated as an operating expense even when the option on the Electricity Rates page is "No Electricity Rates".

https://sam.nrel.gov/forum/forum-general/3108

cf_utility_bill should be an array of zeros when en_electricity_rates = 0 to help communicate that electricity purchases for battery charging are not being treated as an operating expense.

cpaulgilman commented 4 years ago

Also, for Generic Battery / Merchant Plant configuration, there is no Electricity Rates page, so it is not possible to charge the battery at retail rates, but the cash flow table includes the variable for electricity purchases. FIXED

image

cpaulgilman commented 4 years ago
  1. For PV Battery and Generic Battery with PPA Single Owner, when en_electricity_rates = 1, the buy all / sell all metering option (ur_metering_option = 4 ) is the only valid option. FIXED

  2. For the Merchant Plant and other PPA financial models (partnership flip, sale leaseback), we assume en_electricity_rates = 0, so it is not possible to enable retail rates for battery charging power. Cash flow should only display cf_utility_bill for Single Owner model. FIXED

brtietz commented 3 years ago

I think I've fixed this in branch https://github.com/NREL/ssc/tree/sam_370_correct_grid_charge_expenses. One possible issue/source of confusion is that with this approach, the grid charging causes a lower annual energy. Battery annual energy charged and discharged is the same in both cases.

Running the sample SAM file from the forum on the branch without electricity rates:

image

with electricity rates:

image

Is this what we're going for, or should the annual energy be more consistent?

cpaulgilman commented 3 years ago

@brtietz Thanks for the fix so far. Why is annual energy changing with the electricity rates enabled/disabled option? My impression was that this option determines whether the electricity for charging the battery is treated as negative revenue or an operating expense, so would affect dollar amounts in the cash flow but not kWh. The behavior seems to be the same for manual and automated dispatch. For automated dispatch, I would expect battery dispatch to depend on the electricity rate option.

brtietz commented 3 years ago

Charging from the grid (in either case) shows up as a negative number in gen, which is summed for annual energy. There is a function in common_financial: https://github.com/NREL/ssc/blob/c8f6e2e0f7859fc2f30a89162d02c1042ea7aec7/ssc/common_financial.cpp#L3208 which zeroes out these negative numbers by adding grid_to_batt back to gen as a preprocessing step, but only when the utility rate is enabled. The solution on the branch above skips this step for disabled rates, since en_electricity_rates is zero.

Do you know of an existing SSC var that could be used for a negative revenue for this case?

cpaulgilman commented 3 years ago

The inverter night-time loss also results in negative generation for the Detailed PV model with and without storage, and the CSP models have parasitic loads like pumps and heaters can result in negative generation at night or hours of no solar output. I would expect gen to be the kW at the grid interconnection point, regardless of how it is being used for revenue or cost calculations.

@sjanzou might have some thoughts on this.

sjanzou commented 3 years ago

@brtietz So, is gen_with_storage from ssc #383 going to be used to calculate the "negative" revenue? If so, the calculations will need to be tested in the cash flow for all configurations with Single Owner and also in the Send to Excel with Equations @cpaulgilman

brtietz commented 3 years ago

That was my plan, unless you have another idea. Thanks for the notes on testing, this issue got pretty big!

brtietz commented 3 years ago

@sjanzou @cpaulgilman How do you want to handle data table outputs like "Energy produced in Year 1 by month for TOD period n" or "PPA revenue in Year 1 by month for TOD period n"? Initially I was hoping to run some of common_financial::dispatch_factors twice (once with the positive revenue, once with the negative revenue), but it's looking like it might be easier to leave some of those as net outputs and just compute summary metrics for the cash flow table.

cpaulgilman commented 3 years ago

@brtietz The most important thing is to have a way for the user to see how revenue is calculated, so at the very least have time series kW and TOD factors where PPA price ($) TOD factor Power to grid (kW/h) * hour. Breaking down by TOD period is nice, but all of those "by month/year for TOD period n" outputs are probably OK to remove.

brtietz commented 3 years ago

Thanks! Updated plan after some more thought and code review - this and https://github.com/NREL/ssc/issues/383 will take seven variables, 4 of which exist:

Energy

Dollars

I think it'll be easiest if cf_energy_sales and cf_energy_purchases are derived from cf_ppa_price and their respective energy values, rather than computed from running common_financial::dispatch_factors multiple times.

Happy to take input here or at the SAM team meeting.

dguittet commented 3 years ago

@brtietz Thanks for the summary.

system_gen or plant_gen is correct. It can be negative or positive & is equal to gen - batt_power (and battery losses)

PBI works on this vs gen

Am I understanding the expected behavior for the issue here as below?

For any FOM model except single owner, there is no problem since there is no option to use utility rates or not.

For single owner:

brtietz commented 3 years ago

Thanks for the feedback!

I might argue for adding these to all front of meter configurations by calculating them in common_financial. I just ran a few sale-leaseback examples, and the cash flow around grid charging was not clear to me. The generic battery can have negative energy produced over a year with positive PPA revenue in that year.

cpaulgilman commented 3 years ago

I agree that this should be treated the same for all PPA financial models -- we implemented in single owner only because of the extra work required to implement and test in the other models.

As for variable names, I think something like revenue_gen might be better than ppa_gen because the merchant plant or other models we might add in the future might not be power purchase agreement projects.

I hesitate to add this, but we should also consider making a similar changes for the behind-the-meter models -- the meaning of gen is confusing there too, for example: https://sam.nrel.gov/forum/forum-general/3191. Maybe we could postpone that for the next release.

sjanzou commented 3 years ago

@brtietz thanks for the summary; @dguittet and @cpaulgilman thanks for the comments.

Please check for consistency through cmod_grid on the usage and sign conventions.

I agree with @cpaulgilman that we should be consistent with the BOM naming, too.

We have operating costs (expenses) from various sources in both BOM and FOM configurations and several configurations without storage. The revenue in the BOM configurations is from the utility rate savings and from the thermal value in fuel cell configurations. The FOM can have revenue from PPA, from all 5 of the merchant plant streams, from thermal value. So, we need to strive for consistency between costs and revenue streams and align the FOM and BOM as much as possible.

brtietz commented 3 years ago

Decisions from 10/26 meeting:

brtietz commented 3 years ago

Here's what Single owner looks like with the new cash flow sheet:

No electricity rates:

image

Electricity rates:

image

Note that the electricity rate is $0.06/kWh, and the PPA rate is $0.09/kWh, so we expect that "Electricity purchase" in the second image will be less than "negative ppa revenue" in the first.

This required a few more variables than what I highlighted above, but the approach is similar. "gen" now remains the same regardless of the purchase price, but "revenue_gen" is used in the PPA calculations when electricity rates are enabled. I was thinking about removing "Energy produced" since this (necessarily) changes with electricity rates, and that might be confusing.

Especially @cpaulgilman any additional changes before I propagate this to the other financial models?

The O&M updates and gen_without_battery work still needs to be done as well.

brtietz commented 3 years ago

Closed with https://github.com/NREL/SAM/commit/dd650870125da5fdb8d037173422a510c42d261a