Public interface
New resource types
EnergyModelsLanguageInterfaces.ResourceBio — TypeResourceBio{T<:Real} <: ResourceResources that can be transported and converted. These resources cannot be included as resources that are emitted, e.g, in the variable emissions_strategic. Compared to a ResourceCarrier, the ResourceBio Resource includes additionally the fuel definition (a string identifier of the biomass) and the moisture content of the biomass (as a mass fraction).
Fields
idis the name/identifyer of the resource.bio_type::Stringis the type of biomass, e.g., "sprucestem", "sprucebark", "spruceT&B", or "birchstem".moisture::Float64is the moisture content of the biomass resource as a mass fraction.co2_int::Tis the CO₂ intensity, e.g., t/MWh.
New nodal types
EnergyModelsLanguageInterfaces.WindPower — TypeWindPower <: AbstractNonDisRESA wind power source. It extends the existing AbstractNonDisRES node through allowing for sampling the profile from a Python code through a constructor.
Fields
idis the name/identifyer of the node.cap::TimeProfileis the installed capacity.profile::TimeProfileis the power production in each operational period as a ratio of the installed capacity at that time.opex_var::TimeProfileis the variable operating expense per energy unit produced.opex_fixed::TimeProfileis the fixed operating expense.output::Dict{Resource, Real}are the generatedResources, normally Power.data::Vector{<:Data}is the additional data (e.g. for investments). The fielddatais conditional through usage of a constructor.
EnergyModelsLanguageInterfaces.CSPandPV — TypeCSPandPV <: AbstractNonDisRESA combined CSP and PV source producing both power and heat. It extends the existing AbstractNonDisRES to multiple production profiles. The profiles can have variations on the strategic level.
Fields
idis the name/identifyer of the node.cap::Dict{<:Resource,<:TimeProfile}is the installed capacity (for all resources in a Dict).profile::Dict{<:Resource,<:TimeProfile}is the production profile in each operational period as a ratio of the installed capacity at that time (for all resources in a Dict).opex_var::Dict{<:Resource,<:TimeProfile}is the variable operating expense per energy unit produced (for all resources in a Dict).opex_fixed::Dict{<:Resource,<:TimeProfile}is the fixed operating expense (for all resources in a Dict).output::Dict{Resource, Real}are the generatedResources, normally Power.data::Vector{<:Data}is the additional data (e.g. for investments). The fielddatais conditional through usage of a constructor.
Investments are not available for this node.
EnergyModelsLanguageInterfaces.MultipleBuildingTypes — Typestruct MultipleBuildingTypes <: EMB.SinkA MultipleBuildingTypes node that creates sinks for all demand resources. The demand for each resources has a penalty for both surplus and deficit. The penalties introduced in the field penalty affect the variable OPEX for both a surplus and deficit.
Fields
idis the name/identifier of the node.cap::Dict{<:Resource,<:TimeProfile}is the demand.penalty_surplus::Dict{<:Resource,<:TimeProfile}are the penalties for surplus.penalty_deficit::Dict{<:Resource,<:TimeProfile}are the penalties for deficit.input::Dict{<:Resource,<:Real}are the inputResources with conversion valueReal.data::Vector{<:Data}is the additional data (e.g., for investments). The fielddatais conditional through usage of a constructor.
Investments are not available for this node.
EnergyModelsLanguageInterfaces.BioCHP — TypeBioCHP <: NetworkNodeA BioCHP node that samples the CHP model at https://github.com/iDesignRES/CHP_modelling.git.
The current implementation supports v0.4.0 (can be achieved with git checkout v0.4.0).
The BioCHP utilizes a linear, time independent conversion rate of the input Resources to the output Resources, subject to the available capacity. The capacity is hereby normalized to a conversion value of 1 in the fields input and output.
Fields
idis the name/identifier of the node.cap::TimeProfileis the installed capacity.electricity_resource::Resourceis the electric power resource.opex_var::TimeProfileis the variable operating expense per per capacity usage through the variable:cap_use.opex_fixed::TimeProfileis the fixed operating expense per installed capacity through the variable:cap_inst.input::Dict{<:Resource,<:Real}are the inputResources with conversion valueReal.output::Dict{<:Resource,<:Real}are the generatedResources with conversion valueReal.data::Vector{<:Data}is the additional data (e.g., for investments). The fielddatais conditional through usage of a constructor.
Sampling constructors
EnergyModelsLanguageInterfaces.WindPower — MethodWindPower(
id::Any,
cap::TimeProfile,
windfarm::Dict,
time_start::String,
time_end::String,
opex_var::TimeProfile,
opex_fixed::TimeProfile,
output::Dict{<:Resource,<:Real};
data::Vector{<:Data} = Data[],
method::String = "Ninja",
data_path::String = "",
source::String = "NORA3",
)Constructs a WindPower instance where the power production profile is sampled from a Python function.
Arguments
idis the name or identifier of the node.capis the installed capacity.windfarmis a dictionary containing the wind farm parameters. An example dictionary is given by:windfarm = Dict( "id" => "windfarm_1", # The identifier of the windfarm "lat" => 56.8233, # The latitude coordinates of the windfarm "lon" => 4.3467, # The longitude of the wind farm "orientation" => missing, # The orientation "shape" => missing, "turbine_height" => 150, # The turbine height )time_startis the starting time (as a string) for the wind power time series sampling. The format is "YYYY-MM-DD".time_endis the end time (as a string) for the wind power time series sampling. The format is "YYYY-MM-DD".opex_varis the variable operating expense per energy unit produced.opex_fixedis the fixed operating expense.outputare the generatedResources, normally Power, with conversion valueReal.
Keyword arguments
datais the additional data (e.g., for investments). The default value is nodata.methodis the chosen method for data retrieval. The user can choose between the strings "Ninja", "Tradewindoffshore", "Tradewindupland", and "Tradewind_lowland". The default value is "Ninja".data_pathis an optional file path for already downloaded data. The default value is an empty datapath.sourceis the data source for wind data. The user can choose between the strings "NORA3" and "ERA5". The default value is "NORA3".
For use of the "ERA5" data source, the user needs to register and obtain a CDS API key.
- Perform step 1: https://cds.climate.copernicus.eu/how-to-api
EnergyModelsLanguageInterfaces.CSPandPV — MethodCSPandPV(
id::Any,
process_pay_load::Dict,
time_start::DateTime,
time_end::DateTime,
resources_map::Dict{String,<:Resource};
data::Vector{<:Data} = Data[],
data_location::String = joinpath(tempdir(), "CSPandPV"),
overwrite_saved_data::Bool = false,
)Constructs a CSPandPV instance where the power and heat production profiles are sampled from the executeSolarEnergyModelProcess function in the solar_power_plants python project.
Arguments
idis the name or identifier of the node in EMX.process_pay_loadis the process dictionary for the Python function.time_startis the start time for the sampling.time_endis the end time for the sampling.resources_mapis a map of resource keys toEMB.Resources, e.g., the dictionaryPower = ResourceCarrier("Power", 0.0) Heat = ResourceCarrier("Heat", 0.0) resources_map = Dict( "Ppv" => Power, "Pthermal" => Heat, )It must contain the keys "Ppv" and "Pthermal" with their equivalent in EMX as values.
Keyword arguments
datais the additional data (e.g., for investments). The default value is nodata.data_locationis the location where the data is saved. The default value is in the temporary directory.overwrite_saved_datais a boolean that determines if the stored data should be overwritten (in which case the buildingenergyprocess is called). The default value isfalse.
The argument process_pay_load is a dictionary that contains the process information for the Python function. The defaults can be achieved through
using JSON
process_pay_load = JSON.parsefile(path_to_pv_power_plants/input.json)EnergyModelsLanguageInterfaces.MultipleBuildingTypes — MethodMultipleBuildingTypes(
id::Any,
process_pay_load::Dict,
time_start::DateTime,
time_end::DateTime,
buildings::Vector{String},
resources_map::Dict{String,<:Resource},
T::TimeStructure,
penalty_surplus::Dict{<:Resource,<:TimeProfile},
penalty_deficit::Dict{<:Resource,<:TimeProfile};
data::Vector{<:Data} = Data[],
data_location::String = joinpath(tempdir(), "buildings"),
overwrite_saved_data::Bool = false,
)Constructs a MultipleBuildingTypes instance where the demand profiles are sampled from the executeBuildingEnergySimulationProcess function in the building_energy_process python project.
Arguments
idis the name or identifier of the node.process_pay_loadis the process dictionary for the Python function.time_startis the starting time for the sampling.time_endis the ending time for the sampling.buildingsis a vector of the buildings to be considered. Any combination of the following building types are allowed:- "Apartment Block"
- "Single family- Terraced houses"
- "Hotels and Restaurants"
- "Health"
- "Education"
- "Offices"
- "Trade"
- "Other non-residential buildings"
- "Sport"
resources_mapis a map of resource keys toEMB.Resources, e.g., the dictionaryCoal = ResourceCarrier("Coal", 0.35) LNG = ResourceCarrier("LNG", 0.2) Oil = ResourceCarrier("Oil", 0.3) NG = ResourceCarrier("NG", 0.2) SolidBiomass = ResourceCarrier("SolidBiomass", 0.1) Power = ResourceCarrier("Power", 0.0) Heat = ResourceCarrier("Heat", 0.0) LiquidBiomass = ResourceCarrier("LiquidBiomass", 0.15) Biogas = ResourceCarrier("Biogas", 0.05) Hydrogen = ResourceCarrier("Hydrogen", 0.0) SolarHeat = ResourceCarrier("SolarHeat", 0.0) resources_map = Dict( "Solids|Coal" => Coal, "Liquids|Gas" => LNG, "Liquids|Oil" => Oil, "Gases|Gas" => NG, "Solids|Biomass" => SolidBiomass, "Electricity" => Power, "Heat" => Heat, "Liquids|Biomass" => LiquidBiomass, "Gases|Biomass" => Biogas, "Hydrogen" => Hydrogen, "Heat|Solar" => SolarHeat, )Tis the TimeStructure used in the model.penalty_surplus::Dict{<:Resource,<:TimeProfile}is the penalties for surplus.penalty_deficit::Dict{<:Resource,<:TimeProfile}is the penalties for deficit.
Keyword arguments
datais the additional data (e.g., for investments). The default value is nodata.data_locationis the location where the data is saved. The default value is in the temporary directory.overwrite_saved_datais a boolean that determines if the stored data should be overwritten (in which case the buildingenergyprocess is called). The default value isfalse.
The "Variable cost [€/KWh]" and "Emissions [KgCO2/KWh]" from the building_energy_process model is currently not used. Both of these are incorporated indirectly through the usage of the energy carriers.
The argument process_pay_load is a dictionary that contains the process information for the Python function. The defaults can be achieved through
using JSON
process_pay_load = JSON.parsefile(path_to_building_energy_process/input.json)If you want to incorporate unique penalities for each building type, you must create A MultipleBuildingTypes node for each building type.
EnergyModelsLanguageInterfaces.BioCHP — MethodBioCHP(
id::Any,
cap::TimeProfile,
mass_fractions::Dict{<:ResourceBio,<:Real},
heat_output_ratios::Dict{<:ResourceHeat,<:Real},
electricity_resource::Resource;
data::Vector{<:Data} = Data[],
libpath::String = joinpath(
@__DIR__,
"..",
"..",
"CHP_modelling",
"build",
"lib",
"libbioCHP_wrapper.so",
),
)Constructs a BioCHP instance where the power and heat production profiles are sampled from the bioCHP_plant_c function in the C++ library CHP_modelling with shared library file located at libpath. The BioCHP has electricity production of the resource electricity_resource and heat production of the resources in heat_output_ratios (which can be different ResourceHeats at different temperature levels).
Arguments
idis the name or identifier of the node.capis the installed electric capacity.mass_fractionsis the mass fractions of each inputResourceBio.heat_output_ratiosis the output heatResourceHeats with the ratio of installed capacity of heat to that of the electricity.electricity_resourceis theResourcefor the electricity.
Keyword arguments
data::Vector{<:Data}is the additional data (e.g., for investments).libpathis the absolute path of theCHP_modellinglibrary file.
If EmissionsEnergy is not included in the data field, it is automatically added.
Adjust the libpath to point to the correct .dll file when running on Windows.
Utility functions
EnergyModelsLanguageInterfaces.call_python_function — Functioncall_python_function(module_name::String, function_name::String; kwargs...)
call_python_function(module_name::String, function_name::String, args::Vector)Call an external Python function.
Arguments
module_name- the name of the Python module to be used.function_name- the name of the function to be called. Nested names (e.g., due to sub modules) must be separated by ".".
This function enables a vector of arguments (args) or keyword arguments (kwargs) as the input to the python function to be called.
The function can be called with either a vector of arguments or keyword arguments, but not both. A combination of both arguments and keyword arguments is not possible as Julia does not distinguish methods solely based on the presence of keyword arguments.
It is assumed that the required packages of the python module is installed in the root environment.
If a specific python environment is required, one can use conda to create the environment and then set ENV["PYTHON"] to the path of the python executable in that environment. This requires a rebuild of PyCall with Pkg.build("PyCall") followed by a restart of Julia.
If kwargs is not used and the function requires arguments, the function will assume all arguments are collected in the Vector args. That is, if you only have one argument to the python function which is a Vector, it must be passed as a Vector of the Vector.
EnergyModelsLanguageInterfaces.fetch_element — Functionfetch_element(elements, id)Fetch the element with the given id from the elements array.