Skip to content
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

TransmissionInterface direction type should be Float instead of Int #1203

Closed
mvivienneliu opened this issue Dec 17, 2024 · 1 comment
Closed
Assignees
Labels

Comments

@mvivienneliu
Copy link

If this is a question, something isn't working or an idea please start a Q&A discussion in the Discussion tab
Open a bug report only if you can provide the details below

Describe the bug
A clear and concise description of what the bug is.
I have a problem with PSY TransmissionInterface, the get_direction_mapping would return a Dict(String,Int64)
PSY.get_direction_mapping
get_direction_mapping(
value::TransmissionInterface
) -> Dict{String, Int64}
But in PSI, when we try to _add_to_jump_expression!, the multiplier has to be a Float64 (which is direction here) so it always return an error.
To Reproduce
Steps to reproduce the behavior:
Paste the code we can run to reproduce the error you are seeing

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.
┌ Error: Simulation build failed
│ exception =
│ MethodError: no method matching _add_to_jump_expression!(::AffExpr, ::VariableRef, ::Int64)

│ Closest candidates are:
│ _add_to_jump_expression!(::T, ::VariableRef, ::Float64, ::Float64) where T<:AbstractJuMPScalar
│ @ PowerSimulations ~/.julia/packages/PowerSimulations/2yc8E/src/devices_models/devices/common/add_to_expression.jl:110
│ _add_to_jump_expression!(::T, ::VariableRef, ::Float64) where T<:AbstractJuMPScalar
│ @ PowerSimulations ~/.julia/packages/PowerSimulations/2yc8E/src/devices_models/devices/common/add_to_expression.jl:93
│ _add_to_jump_expression!(::T, ::Float64, ::Float64) where T<:AbstractJuMPScalar
│ @ PowerSimulations ~/.julia/packages/PowerSimulations/2yc8E/src/devices_models/devices/common/add_to_expression.jl:121
│ ...

│ Stacktrace:
│ [1] add_to_expression!(container::PowerSimulations.OptimizationContainer, ::Type{PowerSimulations.InterfaceTotalFlow}, ::Type{FlowActivePowerVariable}, service::TransmissionInterface, model::ServiceModel{TransmissionInterface, ConstantMaxInterfaceFlow})
│ @ PowerSimulations ~/.julia/packages/PowerSimulations/2yc8E/src/devices_models/devices/common/add_to_expression.jl:1301
│ [2] construct_service!(container::PowerSimulations.OptimizationContainer, sys::System, ::InfrastructureSystems.Optimization.ModelConstructStage, model::ServiceModel{TransmissionInterface, ConstantMaxInterfaceFlow}, devices_template::Dict{Symbol, DeviceModel}, incompatible_device_types::Set{DataType}, network_model::NetworkModel{PTDFPowerModel})
│ @ PowerSimulations ~/.julia/packages/PowerSimulations/2yc8E/src/services_models/services_constructor.jl:569
│ [3] construct_services!(container::PowerSimulations.OptimizationContainer, sys::System, stage::InfrastructureSystems.Optimization.ModelConstructStage, services_template::Dict{Tuple{String, Symbol}, ServiceModel}, devices_template::Dict{Symbol, DeviceModel}, network_model::NetworkModel{PTDFPowerModel})
│ @ PowerSimulations ~/.julia/packages/PowerSimulations/2yc8E/src/services_models/services_constructor.jl:74
│ [4] macro expansion
│ @ ~/.julia/packages/PowerSimulations/2yc8E/src/core/optimization_container.jl:739 [inlined]

@jd-lara
Copy link
Member

jd-lara commented Dec 26, 2024

closed via #1205

@jd-lara jd-lara closed this as completed Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants