Skip to content
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

Fix summary endpt #559

Merged
merged 6 commits into from
Jan 10, 2024
Merged

Fix summary endpt #559

merged 6 commits into from
Jan 10, 2024

Conversation

Bill-Becker
Copy link
Collaborator

  • Fixes an error from the /summary endpoint for off-grid evaluations when there is no ElectricTariffInputs
  • Updates REopt.jl for the HiGHS solver environment

ElectricTariff doesn't exist for off-grid, and this was causing an error when trying to add None's together
CHANGELOG.md Show resolved Hide resolved
reoptjl/views.py Outdated
@@ -855,7 +855,10 @@ def queryset_for_summary(api_metas,summary_dict:dict):
)
if len(tariffOuts) > 0:
for m in tariffOuts:
summary_dict[str(m.meta.run_uuid)]['year_one_savings_us_dollars'] = (m.year_one_energy_cost_before_tax_bau + m.year_one_demand_cost_before_tax_bau + m.year_one_fixed_cost_before_tax_bau + m.year_one_min_charge_adder_before_tax_bau) - (m.year_one_energy_cost_before_tax + m.year_one_demand_cost_before_tax + m.year_one_fixed_cost_before_tax + m.year_one_min_charge_adder_before_tax)
if len(tariffInputs) > 0:
summary_dict[str(m.meta.run_uuid)]['year_one_savings_us_dollars'] = (m.year_one_energy_cost_before_tax_bau + m.year_one_demand_cost_before_tax_bau + m.year_one_fixed_cost_before_tax_bau + m.year_one_min_charge_adder_before_tax_bau) - (m.year_one_energy_cost_before_tax + m.year_one_demand_cost_before_tax + m.year_one_fixed_cost_before_tax + m.year_one_min_charge_adder_before_tax)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why we don't just use the outputs year_one_bill_before_tax and year_one_bill_before_tax_bau here, since those are equivalent to the summations done here? I also don't know what exactly year_one_savings_us_dollars is meant to represent but should it include year_one_export_benefit_before_tax?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points. the "us_dollars" thing also seems like legacy v2 naming convention - but maybe we kept it instead of updating the web tool. If we changed it to year_one_bill_before_tax - ..._bau, would that include the export benefit? Or do we still need to account for that separately?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would still need to account for that separately. The year_one_bill_before_tax does not account for the value of exports.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use year_one_bill and included export_benefit

reoptjl/views.py Outdated
@@ -855,7 +855,10 @@ def queryset_for_summary(api_metas,summary_dict:dict):
)
if len(tariffOuts) > 0:
for m in tariffOuts:
summary_dict[str(m.meta.run_uuid)]['year_one_savings_us_dollars'] = (m.year_one_energy_cost_before_tax_bau + m.year_one_demand_cost_before_tax_bau + m.year_one_fixed_cost_before_tax_bau + m.year_one_min_charge_adder_before_tax_bau) - (m.year_one_energy_cost_before_tax + m.year_one_demand_cost_before_tax + m.year_one_fixed_cost_before_tax + m.year_one_min_charge_adder_before_tax)
if len(tariffInputs) > 0:
summary_dict[str(m.meta.run_uuid)]['year_one_savings_us_dollars'] = (m.year_one_bill_before_tax_bau + m.year_one_export_benefit_before_tax_bau) - (m.year_one_bill_before_tax + m.year_one_export_benefit_before_tax)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bill-Becker m.year_one_export_benefit_before_tax is actually a positive value if it's a benefit, so we should subtract this here if we want to account for it. However, I wonder if it makes more sense to just use year_one_bill_before_tax until we confirm how the value is used in the UI?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, and I agree - I updated

Copy link
Collaborator

@adfarth adfarth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving and noting that the REopt version will get updated in the highs folder with later updates

@Bill-Becker Bill-Becker merged commit 184a290 into develop Jan 10, 2024
1 check passed
@Bill-Becker Bill-Becker deleted the fix-summary-endpt branch January 10, 2024 22:19
rathod-b pushed a commit that referenced this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants