PowerSystems.jl
PowerSystems.jl copied to clipboard
Support a system serialization to JSON when MarketBidCost has services
Error description:
compression=CompressionSettings(false, CompressionTypes.DEFLATE = 1, 3, true)
ERROR: LoadError: MethodError: Cannot `convert` an object of type Dict{String, Any} to an object of type Service
Closest candidates are:
convert(::Type{T}, ::T) where T
@ Base Base.jl:64
Stacktrace:
[1] setindex!(A::Vector{Service}, x::Dict{String, Any}, i1::Int64)
@ Base ./array.jl:969
[2] _unsafe_copyto!(dest::Vector{Service}, doffs::Int64, src::Vector{Any}, soffs::Int64, n::Int64)
@ Base ./array.jl:250
[3] unsafe_copyto!
@ ./array.jl:304 [inlined]
[4] _copyto_impl!
@ ./array.jl:327 [inlined]
[5] copyto!
@ ./array.jl:314 [inlined]
[6] copyto!
@ ./array.jl:339 [inlined]
[7] copyto_axcheck!
@ ./abstractarray.jl:1180 [inlined]
[8] Vector{Service}(x::Vector{Any})
@ Base ./array.jl:621
[9] convert
@ ./array.jl:613 [inlined]
[10] MarketBidCost
@ ~/.julia/packages/PowerSystems/mjN6j/src/models/generated/MarketBidCost.jl:27 [inlined]
[11] #MarketBidCost#16
@ ~/.julia/packages/PowerSystems/mjN6j/src/models/generated/MarketBidCost.jl:41 [inlined]
[12] deserialize_struct(#unused#::Type{MarketBidCost}, data::Dict{String, Any})
@ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/9btGb/src/serialization.jl:197
[13] deserialize(#unused#::Type{MarketBidCost}, data::Dict{String, Any})
@ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/9btGb/src/serialization.jl:159
[14] deserialize_uuid_handling(field_type::Type{MarketBidCost}, val::Dict{String, Any}, component_cache::Dict{Base.UUID, Component})
@ PowerSystems ~/.julia/packages/PowerSystems/mjN6j/src/models/serialization.jl:118
[15] deserialize(#unused#::Type{ThermalStandard}, data::Dict{String, Any}, component_cache::Dict{Base.UUID, Component})
@ PowerSystems ~/.julia/packages/PowerSystems/mjN6j/src/models/serialization.jl:73
[16] (::PowerSystems.var"#deserialize_and_add!#215"{PowerSystems.var"#deserialize_and_add!#212#216"{System, PowerSystems.var"#is_matching_type#213", Set{Any}, Dict{Base.UUID, Component}, Dict{Any, Vector{Dict}}}})(; skip_types::Vector{DataType}, include_types::Nothing, post_add_func::Nothing)
@ PowerSystems ~/.julia/packages/PowerSystems/mjN6j/src/base.jl:1514
[17] deserialize_and_add!
@ ~/.julia/packages/PowerSystems/mjN6j/src/base.jl:1500 [inlined]
[18] deserialize_components!(sys::System, raw::Dict{String, Any})
@ PowerSystems ~/.julia/packages/PowerSystems/mjN6j/src/base.jl:1538
[19] deserialize(::Type{System}, filename::String; time_series_read_only::Bool, time_series_directory::Nothing, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:runchecks,), Tuple{Bool}}})
@ PowerSystems ~/.julia/packages/PowerSystems/mjN6j/src/base.jl:1457
[20] deserialize
@ ~/.julia/packages/PowerSystems/mjN6j/src/base.jl:1389 [inlined]
[21] System(file_path::String; assign_new_uuids::Bool, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:time_series_in_memory,), Tuple{Bool}}})
@ PowerSystems ~/.julia/packages/PowerSystems/mjN6j/src/base.jl:204
error: <inline asm>:1:5: invalid character in input
@YG
^
I was able to reproduce this issue by adding a service to the MarketBidCost in this test.
Thanks @amirmm11 for reporting, this is definitely an old bug for a non-tested feature.
@GabrielKS we need to add this test to the cost function work for PowerSystems 4.
@GabrielKS did we test this?
Just tested and the bug remains. I'll get on it, shouldn't take long.
Closing as fixed in PSY4.