NREL-Sienna / InfrastructureSystems.jl

Utility package for Sienna's simulation infrastructure
https://nrel-sienna.github.io/InfrastructureSystems.jl/stable/
BSD 3-Clause "New" or "Revised" License
39 stars 21 forks source link

`System` display broken #156

Closed claytonpbarrows closed 4 years ago

claytonpbarrows commented 4 years ago

I think there is something wrong with the System display. This line results in the following error:

julia> c_sys14 = build_system("c_sys14")
[ Info: Deserializing with InMemoryTimeSeriesStorage is currently not supported. Using HDF
[ Info: Loaded time series from storage file existing=sys_time_series_storage.h5 new=/var/folders/27/2jr8c7gn4j72fvrg4qt81zrw8w_711/T/jl_7tpaXk
┌ Warning: Invalid range
│   valid_info.struct_name = "Bus"
│   field_name = "magnitude"
│   field_value = 1.07
│   valid_range = "voltage_limits"
│   valid_info.ist_struct =
│    Bus 6 (Bus):
│       number: 6
│       name: Bus 6
│       bustype: PV
│       angle: -0.24818581963359368
│       magnitude: 1.07
│       voltage_limits: (min = 0.94, max = 1.06)
│       base_voltage: 13.8
│       area: nothing
│       load_zone: nothing
│       ext: Dict{String,Any}()
└ @ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/flYfH/src/validation.jl:217
┌ Warning: Invalid range
│   valid_info.struct_name = "Bus"
│   field_name = "magnitude"
│   field_value = 1.062
│   valid_range = "voltage_limits"
│   valid_info.ist_struct =
│    Bus 7 (Bus):
│       number: 7
│       name: Bus 7
│       bustype: PQ
│       angle: -0.23335052099164186
│       magnitude: 1.062
│       voltage_limits: (min = 0.94, max = 1.06)
│       base_voltage: 13.8
│       area: nothing
│       load_zone: nothing
│       ext: Dict{String,Any}()
└ @ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/flYfH/src/validation.jl:217
┌ Warning: Invalid range
│   valid_info.struct_name = "Bus"
│   field_name = "magnitude"
│   field_value = 1.09
│   valid_range = "voltage_limits"
│   valid_info.ist_struct =
│    Bus 8 (Bus):
│       number: 8
│       name: Bus 8
│       bustype: PV
│       angle: -0.2331759880664424
│       magnitude: 1.09
│       voltage_limits: (min = 0.94, max = 1.06)
│       base_voltage: 18.0
│       area: nothing
│       load_zone: nothing
│       ext: Dict{String,Any}()
└ @ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/flYfH/src/validation.jl:217
┌ Warning: Invalid range
│   valid_info.struct_name = "ThermalStandard"
│   field_name = "reactive_power"
│   field_value = -0.169
│   valid_range = "reactive_power_limits"
│   valid_info.ist_struct =
│    Bus1 (ThermalStandard):
│       name: Bus1
│       available: true
│       status: true
│       bus: Bus 1 (Bus)
│       active_power: 2.0
│       reactive_power: -0.169
│       rating: 2.324
│       active_power_limits: (min = 0.0, max = 3.332)
│       reactive_power_limits: (min = 0.0, max = 0.1)
│       ramp_limits: nothing
│       operation_cost: ThreePartCost
│       base_power: 100.0
│       time_limits: nothing
│       prime_mover: ST
│       fuel: COAL
│       services: 0-element Array{Service,1}
│       time_at_status: 1.0e6
│       dynamic_injector: nothing
│       ext: Dict{String,Any}()
│       time_series_container: InfrastructureSystems.TimeSeriesContainer: 0
└ @ InfrastructureSystems ~/.julia/packages/InfrastructureSystems/flYfH/src/validation.jl:217
System
======
System Units Base: SYSTEM_BASE
Base Power: 100.0
Base Frequency: 60.0

Components
==========
Num components: 70

7×3 DataFrame. Omitted printing of 2 columns
│ Row │ ConcreteType    │
│     │ String          │
├─────┼─────────────────┤
│ 1   │ Arc             │
│ 2   │ Bus             │
│ 3   │ Line            │
│ 4   │ PowerLoad       │
│ 5   │ TapTransformer  │
│ 6   │ ThermalStandard │
│ 7   │ Transformer2W   │

TimeSeriesContainer
===================
Components with time series data: 11
Total StaticTimeSeries: 0
Total Forecasts: 11
Resolution: 60 minutes
Error showing value of type System:
ERROR: AssertionError: initial_timestamp=2024-01-01T00:00:00 interval=0 seconds count=1
Stacktrace:
 [1] get_initial_times(::DateTime, ::Int64, ::Second) at /Users/cbarrows/.julia/packages/InfrastructureSystems/flYfH/src/utils/utils.jl:373
 [2] get_forecast_initial_times(::InfrastructureSystems.ForecastParameters) at /Users/cbarrows/.julia/packages/InfrastructureSystems/flYfH/src/time_series_parameters.jl:36
 [3] get_forecast_initial_times at /Users/cbarrows/.julia/packages/InfrastructureSystems/flYfH/src/time_series_parameters.jl:185 [inlined]
 [4] get_forecast_initial_times at /Users/cbarrows/.julia/packages/InfrastructureSystems/flYfH/src/system_data.jl:536 [inlined]
 [5] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::InfrastructureSystems.SystemData) at /Users/cbarrows/.julia/packages/InfrastructureSystems/flYfH/src/utils/print.jl:86
 [6] show(::IOContext{REPL.Terminals.TTYTerminal}, ::MIME{Symbol("text/plain")}, ::System) at /Users/cbarrows/.julia/packages/PowerSystems/OGkfl/src/utils/print.jl:18
 [7] display(::REPL.REPLDisplay, ::MIME{Symbol("text/plain")}, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:137
 [8] display(::REPL.REPLDisplay, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:141
 [9] display(::Any) at ./multimedia.jl:323
 [10] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [11] invokelatest at ./essentials.jl:711 [inlined]
 [12] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:161
 [13] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:146
 [14] (::REPL.var"#do_respond#38"{Bool,REPL.var"#48#57"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:729
 [15] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [16] invokelatest at ./essentials.jl:711 [inlined]
 [17] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
 [18] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
 [19] run_repl(::REPL.AbstractREPL, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
 [20] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
 [21] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [22] invokelatest at ./essentials.jl:711 [inlined]
 [23] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
 [24] exec_options(::Base.JLOptions) at ./client.jl:305
 [25] _start() at ./client.jl:484
jd-lara commented 4 years ago

Is this an issue with the pre-10 branch ?

claytonpbarrows commented 4 years ago

yes

daniel-thom commented 4 years ago

I just pushed a fix to IS/pre-10. We really need a static analysis tool to find bugs like this one.

kdheepak commented 4 years ago

Link to the commit for reference: https://github.com/NREL-SIIP/InfrastructureSystems.jl/commit/9351f19a5c1d62bdf3cdf62152b82364f735e393