Skip to content

Add support for multiple CHP inputs and outputs in REopt API - #727

Merged
Bill-Becker merged 5 commits into
chp-expandfrom
agents/update-reopt-api-inputs-outputs
Aug 4, 2026
Merged

Add support for multiple CHP inputs and outputs in REopt API#727
Bill-Becker merged 5 commits into
chp-expandfrom
agents/update-reopt-api-inputs-outputs

Conversation

@Bill-Becker

Copy link
Copy Markdown
Collaborator

This pull request implements updates to the REopt API to support new inputs and outputs for Combined Heat and Power (CHP) systems, aligning with recent changes in the REopt.jl package.

Changes made:

  • Models Update (models.py):

    • Changed CHPInputs and CHPOutputs relationships from OneToOneField to ForeignKey to allow multiple CHP instances.
    • Added new input fields for CHP and BAU output fields.
  • Validation Logic (validators.py):

    • Enhanced to handle CHP as a list, similar to PV.
    • Added cross-cleaning for CHP inputs and off-grid handling.
  • Results Processing (process_results.py):

    • Updated to manage CHP outputs as either a single dict or a list.
  • API Response Assembly (views.py):

    • Adjusted to return CHP inputs and outputs consistently as dicts or lists.
  • Database Migration:

    • Created a migration file to apply the necessary changes to the database schema.

These updates ensure that the API can now handle multiple CHP configurations in a manner consistent with existing PV handling, improving the flexibility and functionality of the REopt API.

Bill-Becker and others added 2 commits August 4, 2026 13:14
Align julia_src/Manifest.toml with the uncommitted chp-expand update for REopt.jl PR #608.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Bill-Becker
Bill-Becker changed the base branch from master to chp-expand August 4, 2026 19:28
Bill-Becker and others added 3 commits August 4, 2026 13:48
…updates

- validators.py: Check for duplicate names within CHP list inputs and raise validation error if found. Prevents silent data loss from name collisions. - process_results.py: Remove unsafe fallback to bulk-update all CHP rows when name is missing. Require explicit name for each CHP in list updates to ensure we target the correct database row.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e PVs

http.jl: Include ':name' in inputs_with_defaults_from_julia_chp and inputs_with_defaults_from_julia_pv arrays. This allows the API to identify which CHP/PV each set of defaults belongs to. - For PV: Handle both single PV (dict) and multiple PV (list) cases when extracting defaults from Julia. Previously only pvs[1] was used, causing other PVs to never receive defaults.

process_results.py: Update PV handling to match CHP pattern - support both dict and list formats for PV updates. Each list item must have a 'name' field to identify the target PV row.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Bill-Becker
Bill-Becker merged commit b4238a8 into chp-expand Aug 4, 2026
1 check failed
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.

1 participant