Skip to content

Reconcile total site load #456

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

Merged
merged 32 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5df7222
incorporate electrified thermal loads in AnnualEleckWh
zolanaj Nov 19, 2024
685d64f
rm node reference from AnnualEleckWh calculation
zolanaj Nov 19, 2024
86b9fd5
Merge branch 'gridRE-dev' into reconcile-total-site-load
zolanaj Nov 19, 2024
03bc1ad
Merge branch 'gridRE-dev' into reconcile-total-site-load
zolanaj Nov 20, 2024
c0dc1bd
Merge branch 'gridRE-dev' into reconcile-total-site-load
zolanaj Nov 26, 2024
af1c35a
Merge remote-tracking branch 'origin/gridRE-dev' into reconcile-total…
zolanaj Jan 28, 2025
bc1ea5f
rm electric heater and ASHP from surplus calculation
zolanaj Jan 28, 2025
1d257d1
add new electric load result that includes converted thermal loads
zolanaj Jan 28, 2025
a901eb2
update RE fraction tests
zolanaj Jan 28, 2025
94615d0
update new result annual_kwh_with_thermal_conversion
zolanaj Jan 28, 2025
c9a68f0
rm result annual_kwh_with_thermal_conversion
zolanaj Jan 29, 2025
ba03fb1
new result Site.electric_load_converted_from_thermal_kwh
zolanaj Jan 29, 2025
756dd7a
update RE tests
zolanaj Jan 29, 2025
75cbde1
rm supplementary thermal from RE calc (double-counted)
zolanaj Feb 7, 2025
136dbc4
Let AnnualREHeatkWh and AnnualHeatkWh be expressions in all cases
zolanaj Feb 7, 2025
ce694d9
adjust site electric load for cooling
zolanaj Feb 7, 2025
ae5dfd2
update sets of RE Heat to be only fuel-burnign techs
zolanaj Feb 7, 2025
1499d3c
update comments to describe end-use consumed heat
zolanaj Feb 7, 2025
f8d1115
update RE Heat calc to include accounting of storage losses
zolanaj Feb 7, 2025
8bd8c93
include cooling loads in converted values
zolanaj Feb 7, 2025
b16e4ff
make expressions in site results model objects
zolanaj Feb 7, 2025
d89da90
fix storage loss calcs
zolanaj Feb 7, 2025
0bc9ad7
change new results field to annual_electric_load_with_thermal_convers…
zolanaj Feb 10, 2025
efca6e2
use if statements to avoid NaN values when storage loss = 0
zolanaj Feb 10, 2025
067c389
update tests to use new results measure
zolanaj Feb 10, 2025
4fc40d6
rm commented TODO on reconciliation of electrified thermal loads
zolanaj Feb 10, 2025
426c872
Update CHANGELOG.md
zolanaj Feb 10, 2025
be74d5f
Update docstrings in site.jl
zolanaj Feb 11, 2025
3ed47ce
Update docstrings in site.jl
zolanaj Feb 11, 2025
5e527d6
move total elec to ElectricLoad and describe outputs
adfarth Feb 11, 2025
9894d82
Merge branch 'gridRE-dev' into reconcile-total-site-load
adfarth Feb 11, 2025
0d31aa9
no annual_electric_load_with_thermal_conversions_kwh for multinode
adfarth Feb 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/constraints/renewable_energy_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ function add_re_elec_calcs(m,p)
# 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 #TODO: Uncomment and address any double counting with AnnualHeatkWh
# + 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
# tech electric loads from thermal techs
+ sum(m[:dvCoolingProduction][t, ts] / p.cooling_cop[t][ts] for t in setdiff(p.techs.cooling,p.techs.ghp), ts in p.time_steps)
+ sum(m[:dvHeatingProduction][t, q, ts] / p.heating_cop[t][ts] for q in p.heating_loads, t in p.techs.electric_heater, ts in p.time_steps)
+ sum(p.ghp_electric_consumption_kw[g,ts] * m[:binGHP][g] for g in p.ghp_options, ts in p.time_steps)
)
)
nothing
Expand Down
9 changes: 5 additions & 4 deletions src/results/site.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function add_site_results(m::JuMP.AbstractModel, p::REoptInputs, d::Dict; _n="")
r["annual_onsite_renewable_electricity_kwh"] = round(value(m[:AnnualOnsiteREEleckWh]), digits=2)
r["onsite_renewable_electricity_fraction_of_elec_load"] = round(value(m[:AnnualOnsiteREEleckWh])/value(m[:AnnualEleckWh]), digits=4)
r["onsite_and_grid_renewable_electricity_fraction_of_elec_load"] = round((value(m[:AnnualOnsiteREEleckWh]) + value(m[:AnnualGridREEleckWh])) /value(m[:AnnualEleckWh]), digits=4)
r["electric_load_converted_from_thermal_kwh"] = round(value(m[:AnnualEleckWh]) - (sum(p.s.electric_load.loads_kw) * p.hours_per_time_step), digits=2)

# total renewable energy
add_re_tot_calcs(m,p)
Expand Down Expand Up @@ -118,21 +119,21 @@ function add_re_tot_calcs(m::JuMP.AbstractModel, p::REoptInputs)

# Renewable heat (RE steam/hot water heat that is not being used to generate electricity)
AnnualREHeatkWh = @expression(m,p.hours_per_time_step*(
sum(m[:dvHeatingProduction][t,q,ts] * p.tech_renewable_energy_fraction[t] for t in setdiff(union(p.techs.heating, p.techs.chp), p.techs.ghp), q in p.heating_loads, ts in p.time_steps) #total RE heat generation (excl steam turbine, GHP)
sum(m[:dvHeatingProduction][t,q,ts] * p.tech_renewable_energy_fraction[t] for t in setdiff(union(p.techs.heating, p.techs.chp), union(p.techs.ghp, p.techs.electric_heater)), q in p.heating_loads, ts in p.time_steps) #total RE heat generation (excl steam turbine, GHP)
- sum(m[:dvProductionToWaste][t,q,ts]* p.tech_renewable_energy_fraction[t] for t in p.techs.chp, q in p.heating_loads, ts in p.time_steps) #minus CHP waste heat
+ sum(m[:dvSupplementaryThermalProduction][t,ts] * p.tech_renewable_energy_fraction[t] for t in p.techs.chp, ts in p.time_steps) # plus CHP supplemental firing thermal generation
- 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 setdiff(union(p.techs.heating, p.techs.chp), p.techs.ghp), b in p.s.storage.types.thermal, ts in p.time_steps) #minus thermal storage losses, note does not account for p.DecayRate
- 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 setdiff(union(p.techs.heating, p.techs.chp), union(p.techs.ghp, p.techs.electric_heater)), b in p.s.storage.types.thermal, ts in p.time_steps) #minus thermal storage losses, note does not account for p.DecayRate
)
# - AnnualRESteamToSteamTurbine # minus RE steam feeding steam turbine, adjusted by p.hours_per_time_step
# + AnnualSteamTurbineREThermOut #plus steam turbine RE generation, adjusted for storage losses, adjusted by p.hours_per_time_step (not included in first line because p.tech_renewable_energy_fraction for SteamTurbine is 0)
)

# Total heat (steam/hot water heat that is not being used to generate electricity)
AnnualHeatkWh = @expression(m,p.hours_per_time_step*(
sum(m[:dvHeatingProduction][t,q,ts] for t in setdiff(union(p.techs.heating, p.techs.chp), p.techs.ghp), q in p.heating_loads, ts in p.time_steps) #total heat generation (need to see how GHP fits into this)
sum(m[:dvHeatingProduction][t,q,ts] for t in setdiff(union(p.techs.heating, p.techs.chp), union(p.techs.ghp, p.techs.electric_heater)), q in p.heating_loads, ts in p.time_steps) #total heat generation (need to see how GHP fits into this)
- sum(m[:dvProductionToWaste][t,q,ts] for t in p.techs.chp, q in p.heating_loads, ts in p.time_steps) #minus CHP waste heat
+ sum(m[:dvSupplementaryThermalProduction][t,ts] for t in p.techs.chp, ts in p.time_steps) # plus CHP supplemental firing thermal generation
- sum(m[:dvProductionToStorage][b,t,ts]*(1-p.s.storage.attr[b].charge_efficiency*p.s.storage.attr[b].discharge_efficiency) for t in setdiff(union(p.techs.heating, p.techs.chp), p.techs.ghp), b in p.s.storage.types.thermal, ts in p.time_steps) #minus thermal storage losses
- sum(m[:dvProductionToStorage][b,t,ts]*(1-p.s.storage.attr[b].charge_efficiency*p.s.storage.attr[b].discharge_efficiency) for t in setdiff(union(p.techs.heating, p.techs.chp), union(p.techs.ghp, p.techs.electric_heater)), b in p.s.storage.types.thermal, ts in p.time_steps) #minus thermal storage losses
)
# - AnnualSteamToSteamTurbine # minus steam going to SteamTurbine; already adjusted by p.hours_per_time_step
)
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2372,10 +2372,10 @@ else # run HiGHS tests
@test results["Site"]["lifecycle_emissions_tonnes_SO2"] ≈ results["Site"]["lifecycle_emissions_from_fuelburn_tonnes_SO2"] + results["ElectricUtility"]["lifecycle_emissions_tonnes_SO2"] rtol=0.01 # rounding causes difference
@test results["Site"]["lifecycle_emissions_tonnes_PM25"] ≈ results["Site"]["lifecycle_emissions_from_fuelburn_tonnes_PM25"] + results["ElectricUtility"]["lifecycle_emissions_tonnes_PM25"] rtol=0.001
@test results["Site"]["annual_onsite_renewable_electricity_kwh"] ≈ results["PV"]["annual_energy_produced_kwh"] + inputs["CHP"]["fuel_renewable_energy_fraction"] * results["CHP"]["annual_electric_production_kwh"] atol=1
@test results["Site"]["onsite_renewable_electricity_fraction_of_elec_load"] ≈ results["Site"]["annual_onsite_renewable_electricity_kwh"] / results["ElectricLoad"]["annual_calculated_kwh"] rtol=0.001 #0.044285 atol=1e-4
@test results["Site"]["onsite_renewable_electricity_fraction_of_elec_load"] ≈ results["Site"]["annual_onsite_renewable_electricity_kwh"] / (results["ElectricLoad"]["annual_calculated_kwh"] + results["Site"]["electric_load_converted_from_thermal_kwh"]) rtol=0.001 #0.044285 atol=1e-4
annual_RE_kwh = inputs["CHP"]["fuel_renewable_energy_fraction"] * results["CHP"]["annual_thermal_production_mmbtu"] * REopt.KWH_PER_MMBTU + results["Site"]["annual_onsite_renewable_electricity_kwh"]
annual_heat_kwh = (results["CHP"]["annual_thermal_production_mmbtu"] + results["ExistingBoiler"]["annual_thermal_production_mmbtu"]) * REopt.KWH_PER_MMBTU
@test results["Site"]["onsite_renewable_energy_fraction_of_total_load"] ≈ annual_RE_kwh / (annual_heat_kwh + results["ElectricLoad"]["annual_calculated_kwh"]) rtol=0.001
@test results["Site"]["onsite_renewable_energy_fraction_of_total_load"] ≈ annual_RE_kwh / (annual_heat_kwh + results["ElectricLoad"]["annual_calculated_kwh"] + results["Site"]["electric_load_converted_from_thermal_kwh"]) rtol=0.001
end
end
end
Expand Down
Loading