-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor MBC/IEC for PSY static/time-series type split #74
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d969b85
refactor MBC/IEC for PSY static/time-series type split
luke-kiernan cc2f88d
add _shutdown_cost_value for LinearCurve shutdown field
luke-kiernan 8a9b33f
refactor startup/shutdown costs: trait-based dispatch, split mock cos…
luke-kiernan b5595e8
format, cleanup: remove POM test utils, type and compile-time fixes
luke-kiernan 4d1d69c
fix latent bugs surfaced by POM unit tests
luke-kiernan ed5e7bb
update for `TupleTimeSeries`
luke-kiernan 0ce9382
handle TupleTimeSeries in apply_maybe_across_time_series
luke-kiernan 7fc9465
Merge remote-tracking branch 'origin/main' into lk/mbc_iec_refactor
luke-kiernan ce498b6
replace isa with dispatch
luke-kiernan f7830af
copilot comments
luke-kiernan 7df716e
light refactor of `powersystems_utils.jl`
luke-kiernan 2cee375
fix NDMT typing
jd-lara 6d1e755
fix time variant logic
jd-lara 528215b
clean up value curve cost
jd-lara 5b4af9b
remove PSY references
jd-lara 8464f7f
POM testing: call on sys.data, adjust mocks. format too
luke-kiernan 83e523b
`is_time_variant_proportional` rename, fix
luke-kiernan a187d24
remove special case, still fails
luke-kiernan 6b42ecd
Merge remote-tracking branch 'origin/main' into lk/mbc_iec_refactor
jd-lara 2f3741d
be smarted about the settings
jd-lara c67dddf
CoPilot code review
luke-kiernan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| # Device model | ||
| function add_constraint_dual!( | ||
| container::OptimizationContainer, | ||
| sys::PSY.System, | ||
| sys::IS.InfrastructureSystemsContainer, | ||
| model::DeviceModel{T, D}, | ||
| ) where {T <: PSY.Component, D <: AbstractDeviceFormulation} | ||
| ) where {T <: IS.InfrastructureSystemsComponent, D <: AbstractDeviceFormulation} | ||
| if !isempty(get_duals(model)) | ||
| devices = get_available_components(model, sys) | ||
| for constraint_type in get_duals(model) | ||
|
|
@@ -16,11 +16,11 @@ end | |
| # Network model | ||
| function add_constraint_dual!( | ||
| container::OptimizationContainer, | ||
| sys::PSY.System, | ||
| sys::IS.InfrastructureSystemsContainer, | ||
| model::NetworkModel{T}, | ||
| ) where {T <: AbstractPowerModel} | ||
| if !isempty(get_duals(model)) | ||
| devices = get_available_components(model, PSY.ACBus, sys) | ||
| devices = get_available_components(model, IS.InfrastructureSystemsComponent, sys) | ||
| for constraint_type in get_duals(model) | ||
| assign_dual_variable!(container, constraint_type, devices, model) | ||
| end | ||
|
|
@@ -31,9 +31,9 @@ end | |
| # Service model | ||
| function add_constraint_dual!( | ||
| container::OptimizationContainer, | ||
| sys::PSY.System, | ||
| sys::IS.InfrastructureSystemsContainer, | ||
| model::ServiceModel{T, D}, | ||
| ) where {T <: PSY.Service, D <: AbstractServiceFormulation} | ||
| ) where {T <: IS.InfrastructureSystemsComponent, D <: AbstractServiceFormulation} | ||
| if !isempty(get_duals(model)) | ||
| service = get_available_components(model, sys) | ||
| for constraint_type in get_duals(model) | ||
|
|
@@ -49,9 +49,9 @@ function assign_dual_variable!( | |
| constraint_type::Type{<:ConstraintType}, | ||
| service::D, | ||
| ::Type{<:AbstractServiceFormulation}, | ||
| ) where {D <: PSY.Service} | ||
| ) where {D <: IS.InfrastructureSystemsComponent} | ||
| time_steps = get_time_steps(container) | ||
| service_name = PSY.get_name(service) | ||
| service_name = IS.get_name(service) | ||
| add_dual_container!( | ||
| container, | ||
| constraint_type, | ||
|
|
@@ -69,18 +69,20 @@ function assign_dual_variable!( | |
| constraint_type::Type{<:ConstraintType}, | ||
| devices::U, | ||
| ::Type{<:AbstractDeviceFormulation}, | ||
| ) where {U <: Union{Vector{D}, IS.FlattenIteratorWrapper{D}}} where {D <: PSY.Device} | ||
| ) where { | ||
| U <: Union{Vector{D}, IS.FlattenIteratorWrapper{D}}, | ||
| } where {D <: IS.InfrastructureSystemsComponent} | ||
| @assert !isempty(devices) | ||
| time_steps = get_time_steps(container) | ||
| metas = _existing_constraint_metas(container, constraint_type, D) | ||
| if isempty(metas) | ||
| device_names = PSY.get_name.(devices) | ||
| device_names = IS.get_name.(devices) | ||
| add_dual_container!(container, constraint_type, D, device_names, time_steps) | ||
| else | ||
| # Reuse the existing constraint container's row axis so the dual axis | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have tests for this somewhere (probably need to go in POM)? If not, open an issue to add them.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue opened: POM #93 |
||
| # matches the constraint exactly. Network reductions (radial / | ||
| # degree-two) drop branches that pass the device-model filter, so the | ||
| # constraint axis is a strict subset of PSY.get_name.(devices). Sizing | ||
| # constraint axis is a strict subset of IS.get_name.(devices). Sizing | ||
| # the dual from the device list would leave the dual broadcast in | ||
| # process_duals incompatible with the constraint matrix. | ||
| for meta in metas | ||
|
|
@@ -121,14 +123,16 @@ function assign_dual_variable!( | |
| constraint_type::Type{<:ConstraintType}, | ||
| devices::U, | ||
| ::NetworkModel{<:AbstractPowerModel}, | ||
| ) where {U <: Union{Vector{D}, IS.FlattenIteratorWrapper{D}}} where {D <: PSY.ACBus} | ||
| ) where { | ||
| U <: Union{Vector{D}, IS.FlattenIteratorWrapper{D}}, | ||
| } where {D <: IS.InfrastructureSystemsComponent} | ||
| @assert !isempty(devices) | ||
| time_steps = get_time_steps(container) | ||
| add_dual_container!( | ||
| container, | ||
| constraint_type, | ||
| D, | ||
| PSY.get_name.(devices), | ||
| IS.get_name.(devices), | ||
| time_steps, | ||
| ) | ||
| return | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.