Inputs

JSON Inputs

Node Inputs

Node External Supply Inputs

check_and_convert_supply!

MacroEnergy.check_and_convert_supply!Function
check_and_convert_supply!(data)

Normalize user inputs related to supply into OrderedDict{Symbol,SupplySegment}. This function serves as a wrapper that dispatches to either the legacy or typed parser based on the presence of certain keys in the input data dictionary.

source

check_and_convert_supply_typed!

MacroEnergy.check_and_convert_supply_typed!Function
check_and_convert_supply_typed!(data)

Normalize the preferred node supply input into OrderedDict{Symbol,SupplySegment}.

Expected input shape:

supply = OrderedDict(
    :cheap => Dict(:price => [1.0, 1.5], :min => [0.0], :max => [15.0]),
    :firm => Dict(:price => [4.0], :max => [5.0]),
)

Rules:

  • each segment must define price
  • missing min defaults to [0.0]
  • missing max defaults to [Inf]
source

check_and_convert_supply_legacy!

MacroEnergy.check_and_convert_supply_legacy!Function
check_and_convert_supply_legacy!(data)

Normalize legacy node supply inputs into the older segmented representation:

price_supply::OrderedDict{Symbol,Vector{Float64}} min_supply::OrderedDict{Symbol,Vector{Float64}} max_supply::OrderedDict{Symbol,Vector{Float64}} supply_segment_names::Vector{Symbol}

Ideally, users should provide the inputs as dictionaries with segment names and single values or time series of values. For example:

price_supply = OrderedDict(:cheap => [1.0, 1.5], :expensive => [4.0, 6.0])
max_supply = OrderedDict(:cheap => 15.0, :expensive => 5.0)
supply_segment_names = [:cheap, :expensive]

However, MacroEnergy will support a variety of alternative formats for user convenience. These include:

  1. Two vectors:
price_supply = [1.0, 4.0]
max_supply = [15.0, 5.0]
supply_segment_names = [:cheap, :expensive] # optional, will default to segment1, segment2, etc. if not provided

This will be converted to:

price_supply = OrderedDict(:cheap => [1.0], :expensive => [4.0])
max_supply = OrderedDict(:cheap => [15.0], :expensive => [5.0])
supply_segment_names = [:cheap, :expensive]
  1. A vector or single-segment dictionary for pricesupply with no maxsupply:
price_supply = [1.0, 1.5] # or price_supply = OrderedDict(:gas => [1.0, 1.5])

This will be converted to:

price_supply = OrderedDict(:segment1 => [1.0, 1.5]) 
max_supply = OrderedDict(:segment1 => [Inf])
supply_segment_names = [:segment1] # or [:gas] if the original price_supply was a single-segment dictionary with the name "gas"
  1. A mix of vector and dictionary inputs:
price_supply = [1.0, 1.5]
max_supply = OrderedDict(:cheap => 15.0, :expensive => 5.0)
supply_segment_names = [:cheap, :expensive]

This will be converted to:

price_supply = OrderedDict(:cheap => [1.0], :expensive => [1.5])
max_supply = OrderedDict(:cheap => [15.0], :expensive => [5.0])
supply_segment_names = [:cheap, :expensive]

Alternatively, the maxsupply may be a vector and pricesupply a dictionary:

price_supply = OrderedDict(:cheap => [1.0], :expensive => [1.5])
max_supply = [15.0, 5.0]
supply_segment_names = [:cheap, :expensive]

This will be converted to:

price_supply = OrderedDict(:cheap => [1.0], :expensive => [1.5])
max_supply = OrderedDict(:cheap => [15.0], :expensive => [5.0])
supply_segment_names = [:cheap, :expensive]
  1. Just a pricesupply vector with no maxsupply:
price_supply = [1.0, 1.5]

This will be converted to:

price_supply = OrderedDict(:segment1 => [1.0, 1.5])
max_supply = OrderedDict(:segment1 => [Inf])
supply_segment_names = [:segment1]

The function will throw errors for unsupported formats, such as mismatched lengths of vectors, or if there are multiple price segments but no max_supply provided.

source

CSV Inputs