Accessing cost data in UnitCommitment.jl

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

1 Like

Hi there, welcome to the forum.

I dont know the answer but @axavier is the person who can help.

This may be because some generators have time-dependent costs, while others do not.

See this part of the documentation:
https://anl-ceeesa.github.io/UnitCommitment.jl/0.3/format/#Production-costs-and-limits

1 Like

The issue is resolved here: Accessing cost data in UnitCommitment.jl · Issue #46 · ANL-CEEESA/UnitCommitment.jl · GitHub.

1 Like