Port hybrid systems#104
Conversation
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
JuliaFormatter
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybrid_systems.jl
Lines 819 to 820 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybrid_systems.jl
Lines 1380 to 1390 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybrid_systems.jl
Lines 1442 to 1443 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybrid_systems.jl
Lines 1483 to 1484 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybrid_systems.jl
Lines 1551 to 1553 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 132 to 134 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 183 to 184 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 191 to 192 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 211 to 214 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 216 to 217 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 223 to 224 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 252 to 253 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 296 to 297 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 303 to 304 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 321 to 324 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 326 to 327 in 4ad672f
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 332 to 333 in 4ad672f
|
Performance Results
|
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
JuliaFormatter
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 143 to 144 in e0d67dc
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 193 to 194 in e0d67dc
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 201 to 202 in e0d67dc
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 221 to 224 in e0d67dc
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 226 to 227 in e0d67dc
[JuliaFormatter] reported by reviewdog 🐶
PowerOperationsModels.jl/src/hybrid_system_models/hybridsystem_constructor.jl
Lines 233 to 234 in e0d67dc
There was a problem hiding this comment.
We need to add a couple of extra tests.
First, we need to test different attributes, that is using reservation = false, and energy target = true. Also, what happened with storage_reservation and regularization attributes?
Also, it would be good to test that the hybrid system builds when there is no thermal, or no storage, or no renewable.
Finally, it would be good to test when the hybrid does not participate in reserves.
Overall, the PR looks good. Once we have the tests, I will QA/QC the model for the different tests to ensure that the constraints are looking good.
| @@ -0,0 +1,1828 @@ | |||
| #! format: off | |||
There was a problem hiding this comment.
I think we can enable format on every line here. The methods are quite large and probably need format anyways
| # Hybrid System Parameters | ||
| ################################################################################# | ||
|
|
||
| "Time-series parameter for the maximum active power available from a hybrid system's |
There was a problem hiding this comment.
@jd-lara This is a change from how things are currently defined in HSS with the time series attached to the hybrid, not the subcomponent, but I guess that works and is simpler for this case?
kdayday
left a comment
There was a problem hiding this comment.
Following Rodrigo's lead on the testing, but in addition, can you port over the updated equivalent of what's in the HybridDispatchWithReserves docstring on the HSS PR and have claude add hyperlinks to exported types and functions referenced in the docstring? It looks like the POM docs are way out of date, but would like to update as we go.
There was a problem hiding this comment.
Pull request overview
This PR ports/introduces PSY.HybridSystem support into PowerOperationsModels.jl by adding a new HybridDispatchWithReserves device formulation, its constructor plumbing, and a basic end-to-end test that builds/solves a hybrid co-optimization on RTS-GMLC.
Changes:
- Adds hybrid formulation types, variables/parameters/expressions/constraints, and objective plumbing for
HybridDispatchWithReserves. - Adds a two-stage
construct_device!implementation for HybridSystems (argument + model stages) and hooks it into the main module includes/exports. - Adds test utilities and a new test that builds and solves a model containing a HybridSystem with reserves.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/PowerOperationsModels.jl |
Includes hybrid model files and exports the new hybrid-related types. |
src/hybrid_system_models/hybrid_systems.jl |
Implements hybrid variable bounds, reserve aggregation, constraints, and objective-cost plumbing. |
src/hybrid_system_models/hybridsystem_constructor.jl |
Adds the two-stage construct_device! pipeline for HybridDispatchWithReserves. |
src/core/variables.jl |
Introduces HybridSystem-specific variable types. |
src/core/parameters.jl |
Introduces HybridSystem time-series parameter types and unit-conversion behavior. |
src/core/expressions.jl |
Adds HybridSystem reserve aggregation/served-reserve expression types. |
src/core/constraints.jl |
Adds HybridSystem constraint type definitions. |
src/core/formulations.jl |
Adds hybrid formulation types and user-facing documentation. |
test/test_utils/hybrid_test_utils.jl |
Adds fixtures for building a test HybridSystem in RTS-GMLC. |
test/test_device_hybrid_constructors.jl |
Adds an integration-style test that builds and solves a hybrid dispatch-with-reserves model. |
test/includes.jl |
Wires hybrid test utilities into the test suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| end | ||
| if load_param_container !== nothing && PSY.get_electric_load(d) !== nothing | ||
| load_ref = get_parameter_column_refs(load_param_container, name)[t] | ||
| JuMP.add_to_expression!(rhs, -load_multiplier[name, t], load_ref) |
|
|
||
| # Disambiguate against the generic ReserveDemandCurve method in services_models/reserves.jl. | ||
| function get_variable_upper_bound(::Type{ActivePowerReserveVariable}, r::PSY.ReserveDemandCurve, d::PSY.HybridSystem, ::Type{<:AbstractReservesFormulation}) | ||
| return PSY.get_output_active_power_limits(d).max + PSY.get_input_active_power_limits(d).max |
| add_variables!(container, ActivePowerOutVariable, devices, D) | ||
| add_variables!(container, ActivePowerInVariable, devices, D) | ||
| _maybe_add_reactive_power_variable!(container, devices, D, S) | ||
| add_variables!(container, ReservationVariable, devices, D) |
| # PCC ↔ subcomponent plumbing | ||
| add_constraints!(container, HybridStatusOutOnConstraint, devices, model, network_model) | ||
| add_constraints!(container, HybridStatusInOnConstraint, devices, model, network_model) | ||
| add_constraints!( |
| """ | ||
| Energy asset balance: the hybrid's PCC injection equals the sum of subcomponent | ||
| injections (thermal + renewable + storage discharge - storage charge - load). | ||
| Reserves contribute through their *served* (deployed-fraction) expressions. |
| time_steps = get_time_steps(container) | ||
| variable = get_variable(container, V, D) | ||
| for d in devices | ||
| sub = accessor(d) | ||
| sub === nothing && continue | ||
| cost_term = PSY.get_fixed(PSY.get_operation_cost(sub)) | ||
| cost_term == 0.0 && continue | ||
| name = PSY.get_name(d) | ||
| for t in time_steps | ||
| add_to_objective_invariant_expression!( | ||
| container, | ||
| cost_term * variable[name, t], | ||
| ) | ||
| end |
| - `"reservation"`: forces the storage subcomponent to operate exclusively on charge or | ||
| discharge mode through the entire operation interval. |
Thanks for opening a PR to PowerOperationsModels.jl, please take note of the following when making a PR:
Check the contributor guidelines