NREL-Sienna / PowerSystems.jl

Data structures in Julia to enable power systems analysis. Part of the Scalable Integrated Infrastructure Planning Initiative at the National Renewable Energy Lab.
https://www.nrel.gov/analysis/sienna.html
BSD 3-Clause "New" or "Revised" License
306 stars 74 forks source link

parsing non-deterministic forecast from JSON broken #274

Closed jd-lara closed 5 years ago

jd-lara commented 5 years ago

Line https://github.com/NREL/PowerSystems.jl/blob/f5ac685444741cff2b35a94998a296e3dfd36144/src/models/forecasts.jl#L249

Requires issue_time to parse the forecasts. However, when parsing from user defined forecasts issue_time is not defined.

jd-lara commented 5 years ago

Changing to

push!(forecasts.data[key], convert_type(forecast_type))

allows the code to continue but still throws an error.

Stacktrace:
 [1] convert_type!(::PowerSystems.SystemForecasts, ::NamedTuple{(:data, :initial_time, :resolution, :horizon, :interval),Tuple{NamedTuple{(Symbol("PowerSystems.ForecastKey(2019-07-15T17:00:00, Probabilistic{RenewableDispatch})"), Symbol("PowerSystems.ForecastKey(0001-01-01T00:00:00, Deterministic{PowerLoad})")),Tuple{Array{Any,1},Array{Any,1}}},String,NamedTuple{(:value, :unit),Tuple{Int64,String}},Int64,NamedTuple{(:value, :unit),Tuple{Int64,String}}}}, ::PowerSystems.LazyDictFromIterator{Base.UUID,Component}) at /Users/jdlara/.julia/dev/PowerSystems/src/models/forecasts.jl:249
 [2] from_json(::IOStream, ::Type{System}) at /Users/jdlara/.julia/dev/PowerSystems/src/base.jl:256
 [3] #308 at /Users/jdlara/.julia/dev/PowerSystems/src/models/serialization.jl:24 [inlined]
 [4] #open#310(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::getfield(PowerSystems, Symbol("##308#309")){System}, ::String) at ./iostream.jl:375
 [5] open(::Function, ::String) at ./iostream.jl:373
 [6] from_json(::Type{System}, ::String) at /Users/jdlara/.julia/dev/PowerSystems/src/models/serialization.jl:23
 [7] System(::String) at /Users/jdlara/.julia/dev/PowerSystems/src/base.jl:144
 [8] top-level scope at In[23]:1