Skip to content

Commit

Permalink
Add focus value of off-grid
Browse files Browse the repository at this point in the history
Return null for N/A values
  • Loading branch information
Bill-Becker committed Jan 17, 2024
1 parent 027687d commit 5468d26
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions reoptjl/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,17 @@ def queryset_for_summary(api_metas,summary_dict:dict):
summary_dict[str(m.meta.run_uuid)]['focus'] = "Financial"
else:
summary_dict[str(m.meta.run_uuid)]['focus'] = "Resilience"


# Use settings to find out if it is an off-grid evaluation
settings = Settings.objects.filter(meta__run_uuid__in=run_uuids).only(
'meta__run_uuid',
'off_grid_flag'
)
if len(settings) > 0:
for m in settings:
if m.off_grid_flag:
summary_dict[str(m.meta.run_uuid)]['focus'] = "Off-grid"

tariffInputs = ElectricTariffInputs.objects.filter(meta__run_uuid__in=run_uuids).only(
'meta__run_uuid',
'urdb_rate_name'
Expand Down Expand Up @@ -858,7 +868,7 @@ def queryset_for_summary(api_metas,summary_dict:dict):
if (m.year_one_bill_before_tax_bau is not None) and (m.year_one_bill_before_tax is not None):
summary_dict[str(m.meta.run_uuid)]['year_one_savings_us_dollars'] = m.year_one_bill_before_tax_bau - m.year_one_bill_before_tax
else:
summary_dict[str(m.meta.run_uuid)]['year_one_savings_us_dollars'] = 0.0
summary_dict[str(m.meta.run_uuid)]['year_one_savings_us_dollars'] = None

load = ElectricLoadInputs.objects.filter(meta__run_uuid__in=run_uuids).only(
'meta__run_uuid',
Expand All @@ -880,7 +890,10 @@ def queryset_for_summary(api_metas,summary_dict:dict):
)
if len(fin) > 0:
for m in fin:
summary_dict[str(m.meta.run_uuid)]['npv_us_dollars'] = m.npv
if m.npv is not None:
summary_dict[str(m.meta.run_uuid)]['npv_us_dollars'] = m.npv
else:
summary_dict[str(m.meta.run_uuid)]['npv_us_dollars'] = None
summary_dict[str(m.meta.run_uuid)]['net_capital_costs'] = m.initial_capital_costs_after_incentives

batt = ElectricStorageOutputs.objects.filter(meta__run_uuid__in=run_uuids).only(
Expand Down

0 comments on commit 5468d26

Please sign in to comment.