Skip to content

Conversation

@Bill-Becker
Copy link
Collaborator

@Bill-Becker Bill-Becker commented Nov 6, 2025

Combines, updates, and adds to these two PRs:

The addition is mainly this:

  • New downloadable spreadsheet option with custom_table_rates tailored for a rate comparison, in the /generate_results_table endpoint

And the database migrations were squashed into 1-2.

This pull request introduces new capabilities for handling electric load and tariff data, including support for monthly peak loads, expanded tariff outputs, and a new endpoint for load metrics. It also improves data processing and conversion logic, and updates the REopt.jl dependency to a new branch. The most important changes are grouped below:

Electric Load and Tariff Model Enhancements:

  • Added monthly_peaks_kw input to ElectricLoadInputs and corresponding outputs to ElectricLoadOutputs, enabling scaling of load profiles to monthly peaks while preserving monthly energy. [1] [2]
  • Expanded ElectricTariffOutputs with new fields for detailed cost, rate, and demand metrics, including monthly and time-of-use (TOU) breakdowns.
  • Added urdb_metadata field to ElectricTariffInputs to store utility rate metadata from the Utility Rate Database API.

API and Endpoint Improvements:

  • Introduced a new /get_load_metrics endpoint to process a timeseries load_profile and return monthly/annual energy and peak loads. [1] [2]
  • New downloadable spreadsheet option with custom_table_rates tailored for a rate comparison, in the /generate_results_table endpoint
  • Updated input conversion logic to support monthly_peaks_kw and ensure vectors are consistently converted to Float64 for accurate processing.

Data Processing and Helper Functions:

  • Enhanced flatten_dict in custom_table_helpers.py to handle arrays by creating indexed keys, improving downstream data handling.
  • Modified sum_vectors to preserve monthly arrays (e.g., those with monthly_ in the key) rather than summing them, supporting more granular reporting.

Dependency Update:

  • Updated the REopt.jl dependency in Manifest.toml to use the anccr branch, ensuring access to the latest features and fixes.

Logging and Error Handling:

  • Added informative log statements in the Julia HTTP API for successful input processing and optimization runs, aiding debugging and transparency. [1] [2]

Let me know if you want to dive deeper into any specific change or see how to use the new endpoint and model fields!

rathod-b and others added 30 commits September 29, 2025 13:26
Deleted the migration file 0093_electricloadoutputs_annual_peak_kw_and_more.py and added the year_one_billed_energy_rate_series ArrayField to the ElectricTariffOutputs model. This change likely reflects a schema update and migration reset to accommodate the new field.
Introduces multiple new fields to ElectricLoadOutputs and ElectricTariffOutputs models for tracking annual peak kW, monthly energy and peak demand, export series, and various billed rate series. Updates Julia HTTP handler to log processing steps and ensures certain result matrices are converted to vectors before response.
Added multiple new fields to the ElectricTariffOutputs model and migration to store URDB-related metadata, including label, rate name, utility, effective date, voltage level, rate description, peak kW capacity min/max, additional info, energy and demand comments, and URL link. These changes support enhanced storage and retrieval of utility rate information.
Adds custom_table_anccr with a comprehensive configuration including general info, rate analysis, annual and monthly costs, load metrics, URDB rate info, and detailed monthly breakdowns.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces comprehensive support for electric load scaling and tariff analysis, including new monthly peak load handling, expanded tariff outputs with detailed cost breakdowns, and a new endpoint for load metrics calculation. The changes enable more granular analysis of electric loads and utility rates, particularly supporting rate comparison workflows.

Key Changes

  • Added monthly_peaks_kw input to ElectricLoadInputs for scaling load profiles to monthly peaks while preserving monthly energy
  • Expanded ElectricTariffOutputs with ~20 new fields for detailed monthly/TOU cost and rate breakdowns
  • Introduced /get_load_metrics endpoint to calculate monthly/annual energy and peak loads from timeseries data

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
reoptjl/views.py Added get_load_metrics endpoint; updated simulated_load to handle monthly_peaks_kw and support either normalize_and_scale or doe_reference_name; added rounding utility and updated data processing functions
reoptjl/urls.py Registered new /get_load_metrics endpoint
reoptjl/models.py Added monthly_peaks_kw to ElectricLoadInputs; added monthly/peak outputs to ElectricLoadOutputs; added urdb_metadata to ElectricTariffInputs; added 14 new fields to ElectricTariffOutputs for detailed cost/rate data
reoptjl/migrations/0110_electricloadinputs_monthly_peaks_kw_and_more.py Database migration for all new model fields
reoptjl/src/process_results.py Added ElectricTariff to inputs update logic
reoptjl/custom_table_helpers.py Enhanced flatten_dict to handle arrays with indexed keys; updated sum_vectors to preserve monthly arrays
reoptjl/custom_table_config.py Added new custom_table_rates configuration with ~700 lines of tariff comparison metrics
reoptjl/test/test_job_endpoint.py Removed obsolete test exception for SteamTurbine
reoptjl/test/posts/*.json Updated test fixtures with monthly_peaks_kw and simplified sector_defaults test
julia_src/http.jl Added get_load_metrics function; updated simulated_load to handle monthly_peaks_kw; added logging; updated input conversion to Float64; added ElectricTariff to returned inputs
julia_src/Manifest.toml Updated REopt.jl dependency to v0.56.0
CHANGELOG.md Documented all new features

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Bill-Becker and others added 6 commits November 11, 2025 21:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Bill-Becker Bill-Becker mentioned this pull request Nov 12, 2025
4 tasks
@Bill-Becker
Copy link
Collaborator Author

@rathod-b @gellwood this PR has all the new ElectricTariff outputs stuff, the new custom_table_rates (was _anccr), and the peak load scaling features we've developed for the ANCCR project. The peak load scaling stuff was separately reviewed in #680, so this is mainly to look over things that you two have developed with some updates from me.

Clarifies comments and logic for hiding BAU columns in non-rates tables within the Excel workbook generation. No functional changes, only improved code readability.
@Bill-Becker
Copy link
Collaborator Author

@rathod-b @gellwood These updates are for the API only, not the web tool, but I tested the web tool on this API branch to make sure it didn't break anything, and it did not. The results and spreadsheet download in the webtool all behave the same. So that should give us confidence to deploy this publicly, which I'm hoping to do today or Monday at the latest.

Copy link
Collaborator

@gellwood gellwood left a comment

Choose a reason for hiding this comment

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

Reviewed and nothing jumped out as being wrong. When reviewing I updated a couple comments but didn't notice anything else.

@Bill-Becker Bill-Becker merged commit 30a9538 into develop Nov 19, 2025
1 check passed
@Bill-Becker Bill-Becker deleted the anccr branch November 25, 2025 20:02
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.

5 participants