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.
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
mindefaults to[0.0] - missing
maxdefaults to[Inf]
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:
- 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 providedThis 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]- 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"- 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]- 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.