Documentation
To get an introduction into how to use Leelo.jl, refer to the Manual section.
Leelo.run_sim — Functionrun_sim(; config::AbstrConfiguration = SingleObjectiveBasicConfig(), scenario_dir::String = "data/TestScenario/input_data/")This function runs the entire simulation and plotting procedure depending on a given configuration config and the scenario specified by scenario_dir.
Short Procedure Description
Parameter data is read from the input files in the scenario input_data directory. Then, for every benchmark year of the simulation, a new JuMP model is built (build_base_model), populated with variables (add_model_variables), constraints (add_model_constraints) and an objective (add_model_objective) and then run (optimize!). The result from the optimization is saved (write_variables) and lastly the parameters prepared for the next benchmark year (data_transition). After the final year the final parameters are saved together with the yearly optimization results (write_parameters). Lastly, plots are created from the saved data (create_plots).
Arguments
config is the configuration specifying what the optimization objective is.
scenario_dir is the relative path to the chosen scenarios directory. This directory must contain the scenario's parameter files inside an input_data sub-directory.
Leelo.ModelData — TypeModelDataThe ModelData data structure contains all parameters needed by Leelo.
Fields
interest_rate is the interest rate at which money can be borrowed. It is a scalar and unitless.
...
costCapG[g, y] is the capital cost of the conventional power plant g's installation in year y. 2-dimensional: [g, y] in [k Dollar per installed MW]
or (g, y) Capital cost of power plant g's installation in year y [k Dollar per installed MW] costCapG::Array{Float64, 2} ?
Leelo.read_model_parameters — Functionread_model_parameters(; scenario_dir::String = "data/TestScenario")::ModelDataThis function reads all input files and writes the parameter data into a ModelData data structure.
Arguments
scenario_dir is a String containing the relative path to the chosen scenarios directory. The input files must be inside a input_data sub-directory and named as specified below.
Predefined Input File Names
The input files must be inside a input_data sub-directory and named as specified below. Two examples are at data/Chile-Madhura and data/TestScenario. The latter one being drastically reduced in size.
scenario_settings.xlsx contains basic information like the numer and resolution of timesteps, or number of nodes, as well as general model parameters e.g. regarding carbon tax or interest rate.
conventional generators.xlsx contains all parameters regarding carbon emitting conventional generators, i.e. coal and gas. Parameter examples are the capital cost of installing and operating these power plants as well as their emissions.
'conversion_technologies.xlsx' contain all parameters regarding conversion technologies, which convert power into resources or the other way round. These can include chargers for batteries, water pumps for pumped hydro power, electrolyzers for hydrogen production and many more depending on the model. Parameter examples are their in- and output resources, operating costs and efficiencies.
CSP_profiles.xlsx contains the factor of usable concentrated solar power for each timestep, assuming fixed mirrors. It is separate from the regular solar power tracking because there single axis tracking is assumed.
demand_profiles contains the power demand in every timestep of ervery node and year.
hydro_cascades.xlsx contains the existing hydro power plants, their location and interconnectivity. Other parameters include reservoir size, losses and conversion efficiencies and more.
hydro_cascades_profiles.xlsx contains the water inflow into each hydro power reservoir for each timestep.
hydro_run_of_river.xlsx contains the lumped run-of-river hydropower plants for each node.
hydro_run_of_river_profiles.xlsx contains the factor of usable installed river hydro power capacity for each timestep.
preexisting_capacities.xlsx contains the already existing and projected power capacities for every power source (conventional, renewable, etc.) for every node and year.
renewable_generators.xlsx contains all parameters regarding renewable power plants, like solar and wind.
renwable_profiles.xlsx contains the factor of usable power for every renewable generator for every timestep in every node.
storage_technologies.xlsx contains all parameters regarding different storage technologies, e.g. Li-ion-batteries
transmission_lines.xlsx contains all node-connecting power lines of the model, which nodes they connect, as well as their size, lengths, costs, losses and more.
Missing docstring for AbstrConfiguration. Check Documenter's build log for details.
Leelo.build_base_model — Functionbuild_base_model()::JuMP.ModelThis function creates an empty JuMP.Model using the CPLEX optimizer. It also sets some optimizer parameters, e.g. convergence tolerance.
Leelo.add_model_variables — Functionadd_model_variables(model::JuMP.Model, config::AbstrConfiguration, data::ModelData, i_current_year::Int64)TODO: docstring of this function
... right now just all variables independent of actual config...Arguments
Leelo.add_model_constraints — Functionadd_model_constraints(model::JuMP.Model, config::SingleObjectiveBasicConfig, data::ModelData, i_current_year::Int64)TODO
Arguments
add_model_constraints(model::JuMP.Model, config::SingleObjectiveMultiServiceConfig, data::ModelData, i_current_year::Int64)TODO
Arguments
Leelo.add_single_objective_constraints — Functionadd_single_objective_constraints(model::JuMP.Model, data::ModelData, i_current_year::Int64)This is currently the function called to add constraints to the model for the computation for one given year.
Arguments
Leelo.add_multi_service_constraints — Functionadd_multi_service_constraints(model::JuMP.Model, data::ModelData, i_current_year::Int64)TODO
Arguments
Leelo.add_model_objective — Functionadd_model_objective(model::JuMP.Model, config::AbstrConfiguration)TODO
Arguments
Leelo.write_variables — Functionwrite_variables(model::JuMP.Model, data::ModelData, i_current_year::Int64; scenario_dir::String = "data/TestScenario", file_name::String = "model_results.h5")This function writes the values of the models variables into a HDF5 file, after they have been set by the optimization.
Arguments
model is the JuMP model containing all constraints and variables of the current year. For this function to be called, the optimize!() function has to already been called, such that the model variables have values accessible by the value() function.
data is the data structure containing all the parameters of the model and of the type ModelData.
i_current_year is the index of the current year in data.years.
scenario_dir is a String containing the relative path to the chosen scenarios directory. The written output file will be inside a output_data sub-directory.
file_name is the name of the created file. It defaults to model_results.h5.
Leelo.data_transition — Functiondata_transition(model::JuMP.Model, config::AbstrConfiguration, data::ModelData, i_current_year::Int64)This is the function called to transition the data from one year to the next to prepare the next simulation. It updates existing capacities and phase outs.
Arguments
model is the JuMP model containing all constraints and variables of the current year. For this function to be called, the optimize!() function has to already been called, such that the model variables have values accessible by the value() function.
data is the data structure containing all the parameters of the model and of the type ModelData.
i_current_year is the index of the current year in data.years.
Leelo.write_parameters — Functionfunction write_parameters(data::ModelData; scenario_dir::String = "data/TestScenario", file_name::String = "model_results.h5")This function writes selected model parameters into a HDF5 file. Currently only existing capacities are saved. This function should only be called after the simulation of every benchmark year has terminated, such that all parameters are up to date.
Arguments
data is the data structure containing all the parameters of the model and is of the type ModelData.
scenario_dir is a String containing the relative path to the chosen scenarios directory. The written output file will be inside a output_data sub-directory.
file_name is the name of the created file. It defaults to model_results.h5.
Leelo.create_plots — Functioncreate_plots(; scenario_dir::String = "data/TestScenario", file_name::String = "model_results.h5")This function creates plots of the simulation results by calling all individual plot functions. All plots are saved as PDF into the plots sub-directory. This function sets the general theme of the individual plots.
Arguments
scenario_dir is a String containing the relative path to the chosen scenarios directory. The HDF5 file must be inside a output_data sub-directory.
file_name is a String containing the name of HDF5 file. It defaults to model_results.h5.