-
Notifications
You must be signed in to change notification settings - Fork 75
Jd/area balance fixes #1340
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
Jd/area balance fixes #1340
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9f7ae59
update model
jd-lara 76e4707
add fixes to interchanges and interfaces
jd-lara 64e4d70
update model
jd-lara 51752e0
add fixes to interchanges and interfaces
jd-lara c9ccd37
Merge branch 'jd/area_balance_fixes' of https://github.com/NREL-SIIP/…
jd-lara fe16e00
Merge remote-tracking branch 'origin/psy5' into jd/area_balance_fixes
jd-lara 2fed51a
fix reduction object name
jd-lara 1c8a81a
add missing exports
jd-lara 9bea087
catch better empty time series
jd-lara 5df5062
fixes for PNM
jd-lara 9b93dae
services mapping upgrades
jd-lara fa38628
WIP add testing
jd-lara 5af4677
WIP fix constructor and test
jd-lara f783029
change test to use just 2 interchanges
jd-lara 0f8b62e
add fix for missing type
jd-lara 3ce66b8
add missing export
jd-lara 2f85a79
update testing
jd-lara 9a998ad
improve testing
jd-lara 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: julia-formatter | ||
name: Run Julia formatter | ||
entry: julia scripts/formatter/formatter_code.jl | ||
language: system | ||
types: [file] | ||
pass_filenames: false |
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
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 |
---|---|---|
|
@@ -553,52 +553,46 @@ function construct_service!( | |
return | ||
end | ||
|
||
# Repeated Methods to avoid ambiguity between ConstantMaxInterfaceFlow and VariableMaxInterfaceFlow | ||
function construct_service!( | ||
container::OptimizationContainer, | ||
sys::PSY.System, | ||
::ModelConstructStage, | ||
model::ServiceModel{T, ConstantMaxInterfaceFlow}, | ||
devices_template::Dict{Symbol, DeviceModel}, | ||
incompatible_device_types::Set{<:DataType}, | ||
network_model::NetworkModel{AreaBalancePowerModel}, | ||
) where {T <: PSY.TransmissionInterface} | ||
throw( | ||
IS.ConflictingInputsError( | ||
"AreaBalancePowerModel doesn't model individual line flows and it is not compatible with the addition of TransmissionInterface models", | ||
), | ||
) | ||
return | ||
end | ||
|
||
function construct_service!( | ||
container::OptimizationContainer, | ||
sys::PSY.System, | ||
::ModelConstructStage, | ||
model::ServiceModel{T, VariableMaxInterfaceFlow}, | ||
::ArgumentConstructStage, | ||
model::ServiceModel{PSY.TransmissionInterface, ConstantMaxInterfaceFlow}, | ||
devices_template::Dict{Symbol, DeviceModel}, | ||
incompatible_device_types::Set{<:DataType}, | ||
network_model::NetworkModel{AreaBalancePowerModel}, | ||
) where {T <: PSY.TransmissionInterface} | ||
throw( | ||
IS.ConflictingInputsError( | ||
"AreaBalancePowerModel doesn't model individual line flows and it is not compatible with the addition of TransmissionInterface models", | ||
), | ||
) | ||
interfaces = get_available_components(model, sys) | ||
interface = PSY.get_component(PSY.TransmissionInterface, sys, get_service_name(model)) | ||
if get_use_slacks(model) | ||
# Adding the slacks can be done in a cleaner fashion | ||
@assert PSY.get_available(interface) | ||
transmission_interface_slacks!(container, interface) | ||
end | ||
# Lazy container addition for the expressions. | ||
lazy_container_addition!( | ||
container, | ||
InterfaceTotalFlow(), | ||
PSY.TransmissionInterface, | ||
PSY.get_name.(interfaces), | ||
get_time_steps(container), | ||
) | ||
@warn "AreaBalancePowerModel doesn't model individual line flows and it ignores the flows on AC Transmission Devices" | ||
add_feedforward_arguments!(container, model, interface) | ||
return | ||
end | ||
|
||
function construct_service!( | ||
container::OptimizationContainer, | ||
sys::PSY.System, | ||
::ModelConstructStage, | ||
model::ServiceModel{T, ConstantMaxInterfaceFlow}, | ||
model::ServiceModel{PSY.TransmissionInterface, ConstantMaxInterfaceFlow}, | ||
devices_template::Dict{Symbol, DeviceModel}, | ||
incompatible_device_types::Set{<:DataType}, | ||
network_model::NetworkModel{<:PM.AbstractActivePowerModel}, | ||
) where {T <: PSY.TransmissionInterface} | ||
) | ||
name = get_service_name(model) | ||
service = PSY.get_component(T, sys, name) | ||
service = PSY.get_component(PSY.TransmissionInterface, sys, name) | ||
!PSY.get_available(service) && return | ||
|
||
add_to_expression!( | ||
|
@@ -637,23 +631,24 @@ function construct_service!( | |
container::OptimizationContainer, | ||
sys::PSY.System, | ||
::ArgumentConstructStage, | ||
model::ServiceModel{T, VariableMaxInterfaceFlow}, | ||
model::ServiceModel{PSY.TransmissionInterface, VariableMaxInterfaceFlow}, | ||
devices_template::Dict{Symbol, DeviceModel}, | ||
incompatible_device_types::Set{<:DataType}, | ||
network_model::NetworkModel{<:PM.AbstractPowerModel}, | ||
) where {T <: PSY.TransmissionInterface} | ||
) | ||
interfaces = get_available_components(model, sys) | ||
if get_use_slacks(model) | ||
# Adding the slacks can be done in a cleaner fashion | ||
interface = PSY.get_component(T, sys, get_service_name(model)) | ||
interface = | ||
PSY.get_component(PSY.TransmissionInterface, sys, get_service_name(model)) | ||
@assert PSY.get_available(interface) | ||
transmission_interface_slacks!(container, interface) | ||
end | ||
# Lazy container addition for the expressions. | ||
lazy_container_addition!( | ||
container, | ||
InterfaceTotalFlow(), | ||
T, | ||
PSY.TransmissionInterface, | ||
PSY.get_name.(interfaces), | ||
get_time_steps(container), | ||
) | ||
|
@@ -676,7 +671,7 @@ function construct_service!( | |
add_parameters!(container, MaxInterfaceFlowLimitParameter, device, model) | ||
end | ||
end | ||
interface = PSY.get_component(T, sys, get_service_name(model)) | ||
interface = PSY.get_component(PSY.TransmissionInterface, sys, get_service_name(model)) | ||
add_feedforward_arguments!(container, model, interface) | ||
return | ||
end | ||
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. Dispatch on |
||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dispatch on
PSY.TransmissionInterface
and notT
in line 531?