API
AnyMOD.Node
AnyMOD.OthPart
AnyMOD.ParElement
AnyMOD.TechPart
AnyMOD.Tree
AnyMOD.anyModel
AnyMOD.graInfo
AnyMOD.createOptModel!
AnyMOD.moveNode!
AnyMOD.plotEnergyFlow
AnyMOD.plotTree
AnyMOD.printDuals
AnyMOD.printIIS
AnyMOD.printObject
AnyMOD.reportResults
AnyMOD.reportTimeSeries
AnyMOD.setObjective!
Functions
AnyMOD.createOptModel!
— FunctioncreateOptModel!(model_object::anyModel)
Create all elements of the model's underlying optimization problem except for the objective function.
AnyMOD.setObjective!
— FunctionSet the objective of the model's underlying optimization problem.
setObjective!(obj_dic::Union{Dict{Symbol,Float64},Symbol}, model_object::anyModel)
obj_dic
is a keyword argument that specifies the respective objective. To perform a multi-criteria optimization, it can also be a dictionary with the keywords as keys and weights as values. So far, the only supported key-word is :costs
.
AnyMOD.reportResults
— FunctionreportResults(reportType::Symbol, model_object::anyModel; rtnOpt::Tuple = (:csv,))
Writes results to .csv
file with content depending on reportType
. Available types are :summary
, :exchange
, and :costs
. See Analysed results.
AnyMOD.reportTimeSeries
— FunctionreportTimeSeries(car_sym::Symbol, model_object::anyModel)
Writes elements of energy balance for carrier specified by car_sym
to .csv
file. See Time-series.
AnyMOD.printObject
— FunctionprintObject(print_df::DataFrame, model_object::anyModel)
Writes a DataFrame of parameters, constraints, or variables to a .csv
file in readable format (strings instead of ids). See Individual elements.
AnyMOD.printDuals
— FunctionprintDuals(print_df::DataFrame, model_object::anyModel)
Writes duals of a constraint DataFrame to a .csv
file in readable format (strings instead of ids). See Individual elements.
AnyMOD.printIIS
— FunctionprintIIS(model_object::anyModel)
Uses Gurobi's computeIIS function to determine the constraints of the optimization problem that cause infeasibility.
AnyMOD.plotTree
— FunctionplotTree(tree_sym::Symbol, model_object::anyModel)
Plots the hierarchical tree of nodes for the set specified by tree_sym
. See Node trees.
AnyMOD.plotEnergyFlow
— FunctionplotEnergyFlow(plotType::Symbol, model_object::anyModel)
Plots the energy flow in a model. Set plotType
to :graph
for a qualitative node graph or to :sankey
for a quantitative Sankey diagram. See Energy flow.
AnyMOD.moveNode!
— FunctionmoveNode!(model_object::anyModel, newPos_arr::Union{Array{Tuple{String,Array{Float64,1}},1},Tuple{String,Array{Float64,1}}})
Moves a node within the current layout of the node graph created with plotEnergyFlow
. See Energy flow.
Types
AnyMOD.anyModel
— Typemutable struct anyModel <: AbstractModel
options::modOptions
report::Array{Tuple,1}
optModel::Model
lock::ReentrantLock
supTs::NamedTuple{(:lvl,:step,:sca),Tuple{Int,Tuple{Vararg{Int,N} where N},Dict{Tuple{Int,Int},Float64}}}
cInfo::Dict{Int,NamedTuple{(:tsDis,:tsExp,:rDis,:rExp,:eq),Tuple{Int,Int,Int,Int,Bool}}}
sets::Dict{Symbol,Tree}
parts::NamedTuple{(:tech,:trd,:exc,:bal,:lim,:obj),Tuple{Dict{Symbol,TechPart},OthPart,OthPart,OthPart,OthPart,OthPart}}
graInfo::graInfo
end
The core model object containing all related data and subordinate objects.
Fields
options
: model options provided as keyword arguments to constructorreport
: entries for writing to the reporting file Error handlingoptModel::Model
: the actual JuMP object of the model's underlying optimization problemlock
: lock used for multi-threadingsupTs
: information and mappings for superordinate time-stepscInfo
: information on resolution of energy carrierssets
: sets organized as Tree objects (see Sets and Mappings)parts::NamedTuple
: all part objects of the model (see Parts)graInfo::graInfo
: properties for creation of plots and graphics, can be used to adjust colors and labels (see Styling)
Constructor
anyModel(inDir::Union{String,Array{String,1}},outDir::String; kwargs)
See Model object for a detailed list of arguments.
AnyMOD.TechPart
— Typemutable struct TechPart <: AbstractModelPart
name::Tuple{Vararg{String,N} where N}
par::Dict{Symbol,ParElement}
var::Dict{Symbol,DataFrame}
cns::Dict{Symbol,DataFrame}
carrier::NamedTuple
balLvl::NamedTuple{(:exp,:ref),Tuple{Tuple{Int,Int},Union{Nothing,Tuple{Int,Int}}}}
capaRestr::DataFrame
actSt::Tuple
type::Symbol
disAgg::Bool
modes::Tuple{Vararg{Int,N} where N}
TechPart(name::Tuple{Vararg{String,N} where N}) = new(name,Dict{Symbol,ParElement}(),Dict{Symbol,DataFrame}(),Dict{Symbol,DataFrame}())
TechPart() = new()
end
Type used for technology model parts.
General fields
par
: dictionary of parameters with names as keys (see Parameter list)var
: dictionary of variables with names as keys (see Variables)cns
: dictionary of constraints with names as key (see Constraints)
Technology specific fields
See Technologies for details.
name
: full name of technology as a series of nodes from the technology treecarrier
: ids of energy carriers assigned to technology by groups (e.g. generation, use, ...)balLvl
: temporal and spatial resolution for expansion and conversion balance of the technologycapaRestr
: specification of capacity restrictions required for technologyactSt
: ids of carriers actively stored although they are not leafstype
: type of technology (stock
,mature
, orevolving
)disAgg
: iftrue
, dispatch is modelled at expansion resolution instead of dispatch resolutionmodes
: different operational modes of technology
AnyMOD.OthPart
— Typemutable struct TechPart <: AbstractModelPart
par::Dict{Symbol,ParElement}
var::Dict{Symbol,DataFrame}
cns::Dict{Symbol,DataFrame}
OthPart() = new(Dict{Symbol,ParElement}(),Dict{Symbol,DataFrame}(),Dict{Symbol,DataFrame}(
end
Type used for 'exchange', 'trade', 'balance', 'limits', and 'objective' model parts.
Fields
par
: dictionary of parameters with names as keys (see Parameter list)var
: dictionary of variables with names as keys (see Variables)cns
: dictionary of constraints with names as keys (see Constraints)
AnyMOD.Node
— Typemutable struct Node
idx::Int
val::String
lvl::Int
subIdx::Int
down::Array{Int,1}
end
Type to store nodes of hierarchical trees.
Fields
idx
: internal node idval
: name originally assignedlvl
: level of node within hierarchical treesubIdx
: numbered position among all nodes sharing the same direct ancestordown
: array of children
AnyMOD.Tree
— Typemutable struct Tree
nodes::Dict{Int,Node}
srcTup::Dict{Tuple,Array{Int,1}}
srcStr::Dict{Tuple{String,Int},Array{Int,1}}
up::Dict{Int,Int}
height::Int
Tree() = new(Dict{Int,Node}(),Dict{Tuple,Int}(),Dict{String,Array{Int,1}}(),Dict{Int,Int}(),1)
end
Type to store hierarchical trees.
Fields
nodes
: dictionary of nodes with node ids as keyssrcTup
: assigns a tuple of consecutive node names to the corresponding idsrcStr
: assigns a tuple with a node name and a level to the corresponding idup
: assigns the id of each node to the id of its ancestorheight
: maximum level of tree
AnyMOD.ParElement
— Typemutable struct ParElement
name::Symbol
dim::Tuple
defVal::Union{Nothing,Float64}
herit::Tuple
data::DataFrame
techPre::NamedTuple{(:preset,:mode),Tuple{Symbol,Tuple{Vararg{Symbol,N} where N}}}
end
Type to store parameter data. Includes data and additional information specified in Parameter list.
Fields
name::Symbol
: name of the parameterdim::Tuple
: potential dimensions of parameter datadefVal::Union{Nothing,Float64}
: default valueherit::Tuple
: inheritance rules for parameter, see Parameter overviewdata::DataFrame
: parameter data
AnyMOD.graInfo
— Typemutable struct graInfo
graph::flowGraph
names::Dict{String,String}
colors::Dict{String,Tuple{Float64,Float64,Float64}}
end
Type to store information on styling of graphs. See Styling.
Fields
graph
: saved layout for the qualitative energy flow graphnames
: assigns names of nodes to labels used in plotscolors
: assigns names or label of nodes to RGB color specified as tuple of three numbers between 0 and 1