Public interface

New resource types

EnergyModelsLanguageInterfaces.ResourceBioType
ResourceBio{T<:Real} <: Resource

Resources 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

  • id is the name/identifyer of the resource.
  • bio_type::String is the type of biomass, e.g., "sprucestem", "sprucebark", "spruceT&B", or "birchstem".
  • moisture::Float64 is the moisture content of the biomass resource as a mass fraction.
  • co2_int::T is the CO₂ intensity, e.g., t/MWh.
source

New nodal types

EnergyModelsLanguageInterfaces.WindPowerType
WindPower <: AbstractNonDisRES

A wind power source. It extends the existing AbstractNonDisRES node through allowing for sampling the profile from a Python code through a constructor.

Fields

  • id is the name/identifyer of the node.
  • cap::TimeProfile is the installed capacity.
  • profile::TimeProfile is the power production in each operational period as a ratio of the installed capacity at that time.
  • opex_var::TimeProfile is the variable operating expense per energy unit produced.
  • opex_fixed::TimeProfile is the fixed operating expense.
  • output::Dict{Resource, Real} are the generated Resources, normally Power.
  • data::Vector{<:Data} is the additional data (e.g. for investments). The field data is conditional through usage of a constructor.
source
EnergyModelsLanguageInterfaces.CSPandPVType
CSPandPV <: AbstractNonDisRES

A 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

  • id is 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 generated Resources, normally Power.
  • data::Vector{<:Data} is the additional data (e.g. for investments). The field data is conditional through usage of a constructor.
Danger

Investments are not available for this node.

source
EnergyModelsLanguageInterfaces.MultipleBuildingTypesType
struct MultipleBuildingTypes <: EMB.Sink

A 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

  • id is 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 input Resources with conversion value Real.
  • data::Vector{<:Data} is the additional data (e.g., for investments). The field data is conditional through usage of a constructor.
Danger

Investments are not available for this node.

source
EnergyModelsLanguageInterfaces.BioCHPType
BioCHP <: NetworkNode

A BioCHP node that samples the CHP model at https://github.com/iDesignRES/CHP_modelling.git.

CHP_modelling version

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

  • id is the name/identifier of the node.
  • cap::TimeProfile is the installed capacity.
  • electricity_resource::Resource is the electric power resource.
  • opex_var::TimeProfile is the variable operating expense per per capacity usage through the variable :cap_use.
  • opex_fixed::TimeProfile is the fixed operating expense per installed capacity through the variable :cap_inst.
  • input::Dict{<:Resource,<:Real} are the input Resources with conversion value Real.
  • output::Dict{<:Resource,<:Real} are the generated Resources with conversion value Real.
  • data::Vector{<:Data} is the additional data (e.g., for investments). The field data is conditional through usage of a constructor.
source

Sampling constructors

EnergyModelsLanguageInterfaces.WindPowerMethod
WindPower(
    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

  • id is the name or identifier of the node.

  • cap is the installed capacity.

  • windfarm is 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_start is the starting time (as a string) for the wind power time series sampling. The format is "YYYY-MM-DD".

  • time_end is the end time (as a string) for the wind power time series sampling. The format is "YYYY-MM-DD".

  • opex_var is the variable operating expense per energy unit produced.

  • opex_fixed is the fixed operating expense.

  • output are the generated Resources, normally Power, with conversion value Real.

Keyword arguments

  • data is the additional data (e.g., for investments). The default value is no data.
  • method is 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_path is an optional file path for already downloaded data. The default value is an empty datapath.
  • source is the data source for wind data. The user can choose between the strings "NORA3" and "ERA5". The default value is "NORA3".
Usage of the ERA5 data source in wind_power_timeseries

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
source
EnergyModelsLanguageInterfaces.CSPandPVMethod
CSPandPV(
    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

  • id is the name or identifier of the node in EMX.

  • process_pay_load is the process dictionary for the Python function.

  • time_start is the start time for the sampling.

  • time_end is the end time for the sampling.

  • resources_map is a map of resource keys to EMB.Resources, e.g., the dictionary

    Power = 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

  • data is the additional data (e.g., for investments). The default value is no data.
  • data_location is the location where the data is saved. The default value is in the temporary directory.
  • overwrite_saved_data is a boolean that determines if the stored data should be overwritten (in which case the buildingenergyprocess is called). The default value is false.
Note

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)
source
EnergyModelsLanguageInterfaces.MultipleBuildingTypesMethod
MultipleBuildingTypes(
    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

  • id is the name or identifier of the node.

  • process_pay_load is the process dictionary for the Python function.

  • time_start is the starting time for the sampling.

  • time_end is the ending time for the sampling.

  • buildings is 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_map is a map of resource keys to EMB.Resources, e.g., the dictionary

    Coal = 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,
    )
  • T is 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

  • data is the additional data (e.g., for investments). The default value is no data.
  • data_location is the location where the data is saved. The default value is in the temporary directory.
  • overwrite_saved_data is a boolean that determines if the stored data should be overwritten (in which case the buildingenergyprocess is called). The default value is false.
Note

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.

Note

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)
Note

If you want to incorporate unique penalities for each building type, you must create A MultipleBuildingTypes node for each building type.

source
EnergyModelsLanguageInterfaces.BioCHPMethod
BioCHP(
    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

  • id is the name or identifier of the node.
  • cap is the installed electric capacity.
  • mass_fractions is the mass fractions of each input ResourceBio.
  • heat_output_ratios is the output heat ResourceHeats with the ratio of installed capacity of heat to that of the electricity.
  • electricity_resource is the Resource for the electricity.

Keyword arguments

  • data::Vector{<:Data} is the additional data (e.g., for investments).
  • libpath is the absolute path of the CHP_modelling library file.
EmissionsEnergy

If EmissionsEnergy is not included in the data field, it is automatically added.

Running on windows

Adjust the libpath to point to the correct .dll file when running on Windows.

source

Utility functions

EnergyModelsLanguageInterfaces.call_python_functionFunction
call_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.

Arguments

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.

Environments

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.

Arguments

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.

source