Skip to content

Commit

Permalink
migrations and name updates
Browse files Browse the repository at this point in the history
  • Loading branch information
adfarth committed Jan 24, 2025
1 parent 8c3a606 commit 2f9edd6
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 5 deletions.
4 changes: 2 additions & 2 deletions reoptjl/custom_table_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@
{
"label" : "Annual % Renewable Electricity (%)",
"key" : "annual_renewable_electricity",
"bau_value" : lambda df: safe_get(df, "outputs.Site.renewable_electricity_fraction_bau"),
"scenario_value": lambda df: safe_get(df, "outputs.Site.renewable_electricity_fraction")
"bau_value" : lambda df: safe_get(df, "outputs.Site.onsite_renewable_electricity_fraction_of_elec_load_bau"),
"scenario_value": lambda df: safe_get(df, "outputs.Site.onsite_renewable_electricity_fraction_of_elec_load")
},
{
"label" : "Annual CO2 Emissions (tonnes)",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Generated by Django 4.0.7 on 2025-01-24 22:02

import django.contrib.postgres.fields
import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('reoptjl', '0076_ashpspaceheaterinputs_force_dispatch_and_more'),
]

operations = [
migrations.RenameField(
model_name='electricutilityinputs',
old_name='cambium_metric_col',
new_name='cambium_co2_metric',
),
migrations.RenameField(
model_name='electricutilityoutputs',
old_name='cambium_emissions_region',
new_name='cambium_region',
),
migrations.RenameField(
model_name='siteoutputs',
old_name='annual_renewable_electricity_kwh',
new_name='annual_onsite_renewable_electricity_kwh',
),
migrations.RenameField(
model_name='siteoutputs',
old_name='annual_renewable_electricity_kwh_bau',
new_name='annual_onsite_renewable_electricity_kwh_bau',
),
migrations.RenameField(
model_name='siteoutputs',
old_name='renewable_electricity_fraction',
new_name='onsite_renewable_electricity_fraction_of_elec_load',
),
migrations.RenameField(
model_name='siteoutputs',
old_name='renewable_electricity_fraction_bau',
new_name='onsite_renewable_electricity_fraction_of_elec_load_bau',
),
migrations.RemoveField(
model_name='siteoutputs',
name='total_renewable_energy_fraction',
),
migrations.RemoveField(
model_name='siteoutputs',
name='total_renewable_energy_fraction_bau',
),
migrations.AddField(
model_name='electricstorageinputs',
name='optimize_soc_init_fraction',
field=models.BooleanField(blank=True, default=False, help_text='If true, soc_init_fraction will not apply. Model will optimize initial SOC and constrain initial SOC = final SOC.'),
),
migrations.AddField(
model_name='electricutilityinputs',
name='cambium_cef_metric',
field=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."),
),
migrations.AddField(
model_name='electricutilityinputs',
name='renewable_energy_fraction_series',
field=django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True), blank=True, default=list, help_text='Fraction of energy supplied by the grid that is renewable. Can be scalar or timeseries (aligned with time_steps_per_hour).', size=None),
),
migrations.AddField(
model_name='electricutilityoutputs',
name='annual_renewable_electricity_supplied_kwh',
field=models.FloatField(blank=True, help_text='Total renewable electricity supplied from the grid in an average year.', null=True),
),
migrations.AddField(
model_name='electricutilityoutputs',
name='annual_renewable_electricity_supplied_kwh_bau',
field=models.FloatField(blank=True, help_text='Total renewable electricity supplied from the grid in an average year.', null=True),
),
migrations.AddField(
model_name='siteinputs',
name='include_grid_renewable_fraction_in_RE_constraints',
field=models.BooleanField(blank=True, default=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.'),
),
migrations.AddField(
model_name='siteoutputs',
name='onsite_and_grid_renewable_electricity_fraction_of_elec_load',
field=models.FloatField(blank=True, help_text='Calculation is the same as onsite_renewable_electricity_fraction_of_elec_load, but additionally includes the renewable energycontent of grid-purchased electricity, accounting for any battery efficiency losses.', null=True),
),
migrations.AddField(
model_name='siteoutputs',
name='onsite_and_grid_renewable_electricity_fraction_of_elec_load_bau',
field=models.FloatField(blank=True, help_text='Calculation is the same as onsite_renewable_electricity_fraction_of_elec_load, but additionally includes the renewable energycontent of grid-purchased electricity, accounting for any battery efficiency losses.', null=True),
),
migrations.AddField(
model_name='siteoutputs',
name='onsite_and_grid_renewable_energy_fraction_of_total_load',
field=models.FloatField(blank=True, help_text='Calculation is the same as onsite_renewable_energy_fraction_of_total_load, but additionally includes the renewable energycontent of grid-purchased electricity, accounting for any battery efficiency losses.', null=True),
),
migrations.AddField(
model_name='siteoutputs',
name='onsite_and_grid_renewable_energy_fraction_of_total_load_bau',
field=models.FloatField(blank=True, help_text='Calculation is the same as onsite_renewable_energy_fraction_of_total_load, but additionally includes the renewable energycontent of grid-purchased electricity, accounting for any battery efficiency losses.', null=True),
),
migrations.AddField(
model_name='siteoutputs',
name='onsite_renewable_energy_fraction_of_total_load',
field=models.FloatField(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_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.', null=True),
),
migrations.AddField(
model_name='siteoutputs',
name='onsite_renewable_energy_fraction_of_total_load_bau',
field=models.FloatField(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_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.', null=True),
),
migrations.AlterField(
model_name='electricutilityinputs',
name='cambium_levelization_years',
field=models.IntegerField(blank=True, help_text='Expected lifetime or analysis period of the intervention being studied. Emissions and clean energy fraction will be averaged over this period. Default: analysis_years (from Financial struct)', null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)]),
),
migrations.AlterField(
model_name='electricutilityinputs',
name='cambium_location_type',
field=models.TextField(blank=True, default='GEA Regions 2023', help_text="Geographic boundary at which emissions and clean energy fraction are calculated. Options: ['Nations', 'GEA Regions 2023']."),
),
migrations.AlterField(
model_name='electricutilityinputs',
name='cambium_scenario',
field=models.TextField(blank=True, default='Mid-case', help_text="Cambium Scenario for evolution of electricity sector (see Cambium documentation for descriptions).Options: ['Mid-case', 'Low renewable energy cost', 'High renewable energy cost', 'High demand growth', 'Low natural gas prices', 'High natural gas prices', 'Mid-case with 95% decarbonization by 2050', 'Mid-case with 100% decarbonization by 2035']"),
),
migrations.AlterField(
model_name='electricutilityinputs',
name='cambium_start_year',
field=models.IntegerField(blank=True, default=2025, help_text='First year of operation of system. Emissions will be levelized starting in this year for the duration of cambium_levelization_years.', validators=[django.core.validators.MinValueValidator(2025), django.core.validators.MaxValueValidator(2050)]),
),
]
3 changes: 2 additions & 1 deletion reoptjl/test/posts/all_inputs_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
"emissions_factor_CO2_decrease_fraction": 0.01174,
"emissions_factor_NOx_decrease_fraction": 0.01174,
"emissions_factor_SO2_decrease_fraction": 0.01174,
"emissions_factor_PM25_decrease_fraction": 0.01174
"emissions_factor_PM25_decrease_fraction": 0.01174,
"cambium_co2_metric": "lrmer_co2e"
},
"ElectricStorage": {
"min_kw": 100.0,
Expand Down
2 changes: 1 addition & 1 deletion reoptjl/test/posts/ashp_defaults_update.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"ElectricUtility": {
"cambium_location_type": "GEA Regions 2023",
"cambium_metric_col": "lrmer_co2e",
"cambium_co2_metric": "lrmer_co2e",
"cambium_scenario": "Mid-case",
"cambium_grid_level": "enduse"
},
Expand Down
2 changes: 1 addition & 1 deletion reoptjl/test/test_job_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_pv_battery_and_emissions_defaults_from_julia(self):
self.assertAlmostEqual(results["ElectricStorage"]["size_kw"], 49.05, places=1)
self.assertAlmostEqual(results["ElectricStorage"]["size_kwh"], 83.32, places=1)

self.assertIsNotNone(results["Site"]["total_renewable_energy_fraction"])
self.assertIsNotNone(results["Site"]["onsite_renewable_energy_fraction_of_total_load"])
self.assertIsNotNone(results["Site"]["annual_emissions_tonnes_CO2"])
self.assertIsNotNone(results["Site"]["lifecycle_emissions_tonnes_NOx"])

Expand Down

0 comments on commit 2f9edd6

Please sign in to comment.