I’m trying to access data for generator cost in the UnitCommitment.jl. I was wondering, in matpower/case2383wp/2017-02-01, why do some of the generators (such as generators 12 and 39) have an empty cost_segments, while other generators’ cost_segments have a length of 4?
Below is the error that is thrown by my code followed by a minimal working example.
ERROR: BoundsError: attempt to access 0-element Vector{UnitCommitment.CostSegment} at index [1]
Stacktrace:
[1] getindex(A::Vector{UnitCommitment.CostSegment}, i1::Int64)
@ Base .\array.jl:805
[2] top-level scope
@ c:\Users\Guest\MWE.jl:8
Minimal working example:
using CSV, DataFrames
using UnitCommitment
instance = UnitCommitment.read_benchmark(“matpower/case2383wp/2017-02-01”,)
cost = Dict()
for g in 1:length(instance.units)
unit = instance.units[g]
cost[g] = unit.cost_segments[1].cost[1]
end