-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Grid Renewable Energy Fraction #426
base: develop
Are you sure you want to change the base?
Changes from 62 commits
0d4a787
71acc5e
eca3f12
80d1d3e
c095d48
b67ff48
9a8f09f
379eeab
26f5cec
4cce89e
6500b40
98d22b5
c3c4d90
e3b0300
248481b
1d77ec8
fbf7691
29518dc
132f982
3a4bafd
8a34550
dec6733
3916ba8
37de923
ff29a78
cee8176
8571808
60cdeae
7596768
434f928
3b7a93a
f2bb448
a058fed
c2353fb
42be276
b9b1509
82aaba4
394ffc8
bf72ef7
b57f878
f333311
f2b2871
c357ddf
a26e268
b8a93c2
f09fe6e
9a4dd25
9491bb9
5f6def7
deeb15f
a0c0b77
df4e6f0
9785939
92d067b
599e2e4
d1e9ff7
52b3c0f
f022754
c4d7871
8ec5069
08b0ecb
9c8b6a5
818bedd
74a3c4b
156d035
5fc1160
e90f270
360427b
55ef6fc
c372337
bdb9a45
699abdd
7bde370
8d6fcc6
5610a11
a6bd8b5
f7a2d28
37d32e1
cc70963
210ec72
c9c1aaa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
add_re_elec_constraints(m,p) | ||
|
||
Function to add minimum and/or maximum renewable electricity (as percentage of load) constraints, if specified by user. | ||
Includes renewable energy from grid if specified by user using Site input include_grid_renewable_fraction_in_RE_constraints. | ||
|
||
!!! note | ||
When a single outage is modeled (using outage_start_time_step), renewable electricity calculations account for operations during this outage (e.g., the critical load is used during time_steps_without_grid) | ||
|
@@ -11,14 +12,17 @@ Function to add minimum and/or maximum renewable electricity (as percentage of l | |
#Renewable electricity constraints | ||
function add_re_elec_constraints(m,p) | ||
if !isnothing(p.s.site.renewable_electricity_min_fraction) | ||
@constraint(m, MinREElecCon, m[:AnnualREEleckWh] >= p.s.site.renewable_electricity_min_fraction*m[:AnnualEleckWh]) | ||
@constraint(m, MinREElecCon, m[:AnnualOnsiteREEleckWh] + | ||
p.s.site.include_grid_renewable_fraction_in_RE_constraints * m[:AnnualGridREEleckWh] | ||
>= p.s.site.renewable_electricity_min_fraction*m[:AnnualEleckWh]) | ||
end | ||
if !isnothing(p.s.site.renewable_electricity_max_fraction) | ||
@constraint(m, MaxREElecCon, m[:AnnualREEleckWh] <= p.s.site.renewable_electricity_max_fraction*m[:AnnualEleckWh]) | ||
@constraint(m, MaxREElecCon, m[:AnnualOnsiteREEleckWh] + | ||
p.s.site.include_grid_renewable_fraction_in_RE_constraints * m[:AnnualGridREEleckWh] | ||
<= p.s.site.renewable_electricity_max_fraction*m[:AnnualEleckWh]) | ||
end | ||
end | ||
|
||
|
||
""" | ||
add_re_elec_calcs(m,p) | ||
|
||
|
@@ -50,30 +54,44 @@ function add_re_elec_calcs(m,p) | |
# )) | ||
# end | ||
|
||
m[:AnnualREEleckWh] = @expression(m,p.hours_per_time_step * ( | ||
# Note: when we add capability for battery to discharge to grid, need to make sure only RE that is being consumed | ||
# onsite is counted so battery doesn't become a back door for RE to grid. | ||
m[:AnnualOnsiteREEleckWh] = @expression(m, p.hours_per_time_step * ( | ||
sum(p.production_factor[t,ts] * p.levelization_factor[t] * m[:dvRatedProduction][t,ts] * | ||
p.tech_renewable_energy_fraction[t] for t in p.techs.elec, ts in p.time_steps | ||
) - #total RE elec generation, excl steam turbine | ||
sum(m[:dvProductionToStorage][b,t,ts]*p.tech_renewable_energy_fraction[t]*( | ||
1-p.s.storage.attr[b].charge_efficiency*p.s.storage.attr[b].discharge_efficiency) | ||
for t in p.techs.elec, b in p.s.storage.types.elec, ts in p.time_steps | ||
) - #minus battery efficiency losses | ||
sum(m[:dvCurtail][t,ts]*p.tech_renewable_energy_fraction[t] for t in p.techs.elec, ts in p.time_steps) - # minus curtailment. | ||
sum(m[:dvCurtail][t,ts] * p.tech_renewable_energy_fraction[t] | ||
for t in p.techs.elec, ts in p.time_steps | ||
) - # minus curtailment | ||
(1 - p.s.site.include_exported_renewable_electricity_in_total) * | ||
sum(m[:dvProductionToGrid][t,u,ts]*p.tech_renewable_energy_fraction[t] | ||
for t in p.techs.elec, u in p.export_bins_by_tech[t], ts in p.time_steps | ||
) # minus exported RE, if RE accounting method = 0. | ||
) | ||
# + SteamTurbineAnnualREEleckWh # SteamTurbine RE Elec, already adjusted for p.hours_per_time_step | ||
) | ||
# Note: if battery ends up being allowed to discharge to grid, need to make sure only RE that is being consumed onsite is counted so battery doesn't become a back door for RE to grid. | ||
# Note: calculations currently do not ascribe any renewable energy attribute to grid-purchased electricity | ||
|
||
# Note: when we add capability for battery to discharge to grid, need to subtract out *grid RE* discharged from battery | ||
# back to grid so that loop doesn't become a back door for increasing RE. This will require some careful thought! | ||
m[:AnnualGridREEleckWh] = @expression(m, p.hours_per_time_step * ( | ||
sum(m[:dvGridPurchase][ts, tier] * p.s.electric_utility.renewable_energy_fraction_series[ts] | ||
for ts in p.time_steps, tier in 1:p.s.electric_tariff.n_energy_tiers) # renewable energy from grid | ||
adfarth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- sum(m[:dvGridToStorage][b, ts] * p.s.electric_utility.renewable_energy_fraction_series[ts] * | ||
(1 - p.s.storage.attr[b].charge_efficiency * p.s.storage.attr[b].discharge_efficiency) | ||
for ts in p.time_steps, b in p.s.storage.types.elec | ||
) # minus battery efficiency losses from grid charging storage (assumes all that is charged is discharged) | ||
) | ||
) | ||
|
||
m[:AnnualEleckWh] = @expression(m,p.hours_per_time_step * ( | ||
# input electric load | ||
sum(p.s.electric_load.loads_kw[ts] for ts in p.time_steps_with_grid) | ||
+ sum(p.s.electric_load.critical_loads_kw[ts] for ts in p.time_steps_without_grid) | ||
# tech electric loads | ||
# tech electric loads #TODO: Uncomment and address any double counting with AnnualHeatkWh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this something you wanted to do in this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it, didin't realize this was part of that. it could be a good idea to note in #456 all the places like this that need to be considered/updated. not necessarily going through and finding all of them, cause that's the work of that PR, but just listing the ones that you already identified through this PR. |
||
# + sum(m[:dvCoolingProduction][t,ts] for t in p.ElectricChillers, ts in p.time_steps )/ p.ElectricChillerCOP # electric chiller elec load | ||
# + sum(m[:dvCoolingProduction][t,ts] for t in p.AbsorptionChillers, ts in p.time_steps )/ p.AbsorptionChillerElecCOP # absorportion chiller elec load | ||
# + sum(p.GHPElectricConsumed[g,ts] * m[:binGHP][g] for g in p.GHPOptions, ts in p.time_steps) # GHP elec load | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the plan to merge #456 into this and then merge together or to merge one first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we would merge this one first if possible, because we might not get to that one until mid January. That PR would address an issue that already exists with all of the % RE calculations, whereas this one adds new RE outputs (that do also have the whole total load issue). Do you think that's an okay approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but another thought is that if there is a known issue that we aren't fixing right away I wonder if it makes sense to temporarily remove the affected total load related outputs and/or note it somewhere for users. Mid Jan is pretty soon though especially with the holidays so maybe not worth the time to do that.