Skip to content

Commit

Permalink
Update models.py
Browse files Browse the repository at this point in the history
  • Loading branch information
adfarth committed Dec 11, 2024
1 parent 20d9bfb commit a478813
Showing 1 changed file with 76 additions and 12 deletions.
88 changes: 76 additions & 12 deletions reoptjl/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,13 @@ class SiteInputs(BaseModel, models.Model):
null=True, blank=True,
help_text="Maximum allowed percentage of site electric consumption met by renewable energy on an annual basis."
)

include_grid_renewable_fraction_in_RE_constraints = models.BooleanField(
default=True,
blank=True,
help_text=("If True, then the renewable energy content of energy from the grid is included in any min or max renewable energy requirements.")
)

include_exported_elec_emissions_in_total = models.BooleanField(
default=True,
blank=True,
Expand Down Expand Up @@ -437,32 +444,47 @@ class SiteOutputs(BaseModel, models.Model):
primary_key=True
)

annual_renewable_electricity_kwh = models.FloatField(
annual_onsite_renewable_electricity_kwh = models.FloatField(
null=True, blank=True,
help_text=(
"Electricity consumption (incl. electric heating/cooling loads) that is derived from on-site renewable resource generation."
"Calculated as total annual RE electric generation, minus storage losses and curtailment, with the user selecting whether exported renewable generation is included). "
)
)
renewable_electricity_fraction = models.FloatField(
# TODO: I think "incl. electric heating/cooling loads" is not currently true
onsite_renewable_electricity_fraction_of_elec_load = models.FloatField(
null=True, blank=True,
help_text=(
"Portion of electricity consumption (incl. electric heating/cooling loads) that is derived from on-site renewable resource generation."
"Calculated as total annual RE electric generation, minus storage losses and curtailment, with the user selecting whether exported renewable generation is included, "
"divided by total annual electric consumption."
)
)
total_renewable_energy_fraction = models.FloatField(
onsite_renewable_energy_fraction_of_elec_and_thermal_load = models.FloatField(
null=True, blank=True,
help_text=(
"Portion of annual total energy consumption that is derived from on-site renewable resource generation."
"The numerator is calculated as total annual RE electricity consumption (calculation described for annual_renewable_electricity_kwh output),"
"The numerator is calculated as total annual RE electricity consumption (calculation described for annual_onsite_renewable_electricity_kwh output),"
"plus total annual thermal energy content of steam/hot water generated from renewable fuels (non-electrified heat loads)."
"The thermal energy content is calculated as total energy content of steam/hot water generation from renewable fuels,"
"minus waste heat generated by renewable fuels, minus any applicable hot water thermal energy storage efficiency losses."
"The denominator is calculated as total annual electricity consumption plus total annual thermal steam/hot water load."
)
)
onsite_and_grid_renewable_electricity_fraction_of_elec_load = models.FloatField(
null=True, blank=True,
help_text=(
"Calculation is the same as onsite_renewable_electricity_fraction_of_elec_load, but additionally includes the renewable energy"
"content of grid-purchased electricity, accounting for any battery efficiency losses."
)
)
onsite_and_grid_renewable_energy_fraction_of_elec_and_thermal_load = models.FloatField(
null=True, blank=True,
help_text=(
"Calculation is the same as onsite_renewable_energy_fraction_of_elec_and_thermal_load, but additionally includes the renewable energy"
"content of grid-purchased electricity, accounting for any battery efficiency losses."
)
)
annual_emissions_tonnes_CO2 = models.FloatField(
null=True, blank=True,
help_text="Average annual total tons of emissions associated with the site's grid-purchased electricity and on-site fuel consumption."
Expand Down Expand Up @@ -527,32 +549,46 @@ class SiteOutputs(BaseModel, models.Model):
null=True, blank=True,
help_text="Total tons of PM2.5 emissions associated with the site's onsite fuel burn over the analysis period."
)
annual_renewable_electricity_kwh_bau = models.FloatField(
annual_onsite_renewable_electricity_kwh_bau = models.FloatField(
null=True, blank=True,
help_text=(
"Electricity consumption (incl. electric heating/cooling loads) that is derived from on-site renewable resource generation in the BAU case."
"Calculated as total RE electric generation in the BAU case, minus storage losses and curtailment, with the user selecting whether exported renewable generation is included). "
)
)
renewable_electricity_fraction_bau = models.FloatField(
onsite_renewable_electricity_fraction_of_elec_load_bau = models.FloatField(
null=True, blank=True,
help_text=(
"Electricity consumption (incl. electric heating/cooling loads) that is derived from on-site renewable resource generation in the BAU case."
"Calculated as total annual RE electric generation in the BAU case, minus storage losses and curtailment, with the user selecting whether exported renewable generation is included, "
"divided by total annual electric consumption."
)
)
total_renewable_energy_fraction_bau = models.FloatField(
onsite_renewable_energy_fraction_of_elec_and_thermal_load_bau = models.FloatField(
null=True, blank=True,
help_text=(
"Portion of annual total energy consumption that is derived from on-site renewable resource generation in the BAU case."
"The numerator is calculated as total annual RE electricity consumption (calculation described for annual_renewable_electricity_kwh_bau output),"
"The numerator is calculated as total annual RE electricity consumption (calculation described for annual_onsite_renewable_electricity_kwh_bau output),"
"plus total annual thermal energy content of steam/hot water generated from renewable fuels (non-electrified heat loads)."
"The thermal energy content is calculated as total energy content of steam/hot water generation from renewable fuels,"
"minus waste heat generated by renewable fuels, minus any applicable hot water thermal energy storage efficiency losses."
"The denominator is calculated as total annual electricity consumption plus total annual thermal steam/hot water load."
)
)
onsite_and_grid_renewable_electricity_fraction_of_elec_load_bau = models.FloatField(
null=True, blank=True,
help_text=(
"Calculation is the same as onsite_renewable_electricity_fraction_of_elec_load, but additionally includes the renewable energy"
"content of grid-purchased electricity, accounting for any battery efficiency losses."
)
)
onsite_and_grid_renewable_energy_fraction_of_elec_and_thermal_load_bau = models.FloatField(
null=True, blank=True,
help_text=(
"Calculation is the same as onsite_renewable_energy_fraction_of_elec_and_thermal_load, but additionally includes the renewable energy"
"content of grid-purchased electricity, accounting for any battery efficiency losses."
)
)
annual_emissions_tonnes_CO2_bau = models.FloatField(
null=True, blank=True,
help_text="Total tons of CO2e emissions associated with the site's energy consumption in an average year in the BAU case."
Expand Down Expand Up @@ -1741,17 +1777,17 @@ class ElectricUtilityInputs(BaseModel, models.Model):
cambium_location_type = models.TextField(
blank=True,
default = "GEA Regions",
help_text=("Geographic boundary at which emissions are calculated. Options: ['Nations', 'GEA Regions', 'States'].")
help_text=("Geographic boundary at which emissions and clean energy fraction are calculated. Options: ['Nations', 'GEA Regions'].")
)
cambium_co2_metric = models.TextField(
blank=True,
default = "lrmer_co2e",
help_text=("Emissions metric used. Default is Long-run marginal emissions rate for CO2-equivalant, combined combustion and pre-combustion emissions rates. Options: See metric definitions and names in the Cambium documentation.")
)
cambium_start_year = models.IntegerField(
default=2024,
default=2025,
validators=[
MinValueValidator(2023),
MinValueValidator(2025),
MaxValueValidator(2050)
],
blank=True,
Expand All @@ -1765,7 +1801,7 @@ class ElectricUtilityInputs(BaseModel, models.Model):
blank=True,
null=True,
help_text=("Expected lifetime or analysis period of the intervention being studied. "
"Emissions will be averaged over this period. Default: analysis_years (from Financial struct)")
"Emissions and clean energy fraction will be averaged over this period. Default: analysis_years (from Financial struct)")
)
cambium_grid_level = models.TextField(
blank=True,
Expand Down Expand Up @@ -1848,6 +1884,20 @@ class ElectricUtilityInputs(BaseModel, models.Model):
help_text="Annual percent decrease in the total annual PM2.5 marginal emissions rate of the grid. A negative value indicates an annual increase."
)

cambium_cef_metric = models.TextField(
blank=True,
default = "cef_load",
help_text=("Options = ['cef_load', 'cef_gen']. cef_load is the fraction of generation that is clean, for the generation that is allocated to a region’s end-use load; cef_gen is the fraction of generation that is clean within a region.")
)

renewable_energy_fraction_series = ArrayField(
models.FloatField(
blank=True,
),
default=list, blank=True,
help_text=("Fraction of energy supplied by the grid that is renewable. Can be scalar or timeseries (aligned with time_steps_per_hour).")
)

def clean(self):
error_messages = {}

Expand Down Expand Up @@ -1928,6 +1978,14 @@ class ElectricUtilityOutputs(BaseModel, models.Model):
null=True, blank=True,
help_text=("Average annual energy supplied from grid to load")
)
annual_renewable_electricity_supplied_kwh = models.FloatField(
null=True, blank=True,
help_text=("Total renewable electricity supplied from the grid in an average year.")
)
annual_renewable_electricity_supplied_kwh_bau = models.FloatField(
null=True, blank=True,
help_text=("Total renewable electricity supplied from the grid in an average year.")
)
annual_emissions_tonnes_CO2 = models.FloatField(
null=True, blank=True,
help_text=("Total tons of CO2 emissions associated with the site's grid-purchased electricity in an average year. "
Expand Down Expand Up @@ -3446,6 +3504,12 @@ class ElectricStorageInputs(BaseModel, models.Model):
help_text="Rebate based on installed energy capacity"
)

optimize_soc_init_fraction = models.BooleanField(
default=False,
blank=True,
help_text="If true, soc_init_fraction will not apply. Model will optimize initial SOC and constrain initial SOC = final SOC."
)


class ElectricStorageOutputs(BaseModel, models.Model):
key = "ElectricStorageOutputs"
Expand Down

0 comments on commit a478813

Please sign in to comment.