Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
TimeStruct = "f9ed5ce0-9f41-4eaa-96da-f38ab8df101c"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"

[weakdeps]
EnergyModelsInvestments = "fca3f8eb-b383-437d-8e7b-aac76bb2004f"

[extensions]
EMIExt = "EnergyModelsInvestments"

[compat]
Dates = "1.10"
EnergyModelsBase = "0.9.0"
EnergyModelsHeat = "0.1.1"
EnergyModelsInvestments = "0.8.1"
EnergyModelsRenewableProducers = "0.6.5"
JuMP = "1.23"
Libdl = "1.10"
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ This is exemplified with multiple new nodal descriptions from different models.

## Usage

The usage of the package is best illustrated through the commented examples.
The usage of the package is best illustrated through the commented examples in the documentation.
The examples are minimum working examples highlighting how to use the receding horizon framework.
In addition, they provide a user with an overview regarding potential adjustments to their elements.

> [!CAUTION]
> The node `MultipleBuildingTypes` is currently under development.
> It may contain incorrect implementations with respect to the calculation of the variable OPEX.
> We hence recommendto not use this node in its current stage.

> [!WARNING]
> The package is not yet registered.
> It is hence necessary to first clone the package and manually add the package to the example environment through:
Expand Down
26 changes: 4 additions & 22 deletions ext/EMGUIExt/descriptive_names.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
# This file contains description of EMX-structures and variables
# with fields of type TimeStruct.TimeProfile
structures:
WindPower:
cap: "Installed capacity"
profile: "Power production in each operational period as a ratio of the installed capacity at that time"
opex_var: "Relative variable operating expense per energy unit produced"
opex_fixed: "Relative fixed operating expense per installed capacity"

MultipleBuildingTypes:
cap: "Demand"
penalty_surplus: "Penalty for surplus"
penalty_deficit: "Penalty for deficits"

CSPandPV:
cap: "Installed capacity"
profile: "Power production profile as a ratio of installed capacity"
opex_var: "Relative variable operating expense per energy unit produced"
opex_fixed: "Relative fixed operating expense per installed capacity"

variables:
buildings_surplus: "Surplus delivered to a sink, i.e., oversatisfied demand"
buildings_deficit: "Deficit in a sink, i.e., not satisfied demand"
solar_curtailment: "Curtailment of a solar energy source"
solar_cap_use: "Absolute capacity utilization"
EnergyModelsLanguageInterfaces:
MultipleBuildingTypes:
penalty_surplus: "Penalty for surplus"
penalty_deficit: "Penalty for deficits"
114 changes: 114 additions & 0 deletions ext/EMIExt/EMIExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
module EMIExt

using TimeStruct
using EnergyModelsBase
using EnergyModelsInvestments
using EnergyModelsHeat
using EnergyModelsLanguageInterfaces

const TS = TimeStruct
const EMB = EnergyModelsBase
const EMI = EnergyModelsInvestments
const EMH = EnergyModelsHeat
const EMLI = EnergyModelsLanguageInterfaces

"""
EMLI.BioCHP(
id::Any,
cap::TimeProfile,
cap_init::TimeProfile,
cap_max_installed::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`](@ref) 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 `ResourceHeat`s at different temperature levels).

# Arguments
- **`id`** is the name or identifier of the node.
- **`cap`** is the installed electric capacity used in the CHP submodule for the calculations.
- **`cap_init`** is the initial capacity for the node.
- **`cap_max_installed`** is the maximum installed capacity.
- **`mass_fractions`** is the mass fractions of each input `ResourceBio`.
- **`heat_output_ratios`** is the output heat `ResourceHeat`s 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). The field `data`
is conditional through usage of a constructor.
- **`libpath`** is the absolute path of the `CHP_modelling` library file.

!!! note ""EmissionsEnergy"
If `EmissionsEnergy` is not included in the `data` field, it is automatically added.
"""
function EMLI.BioCHP(
id::Any,
cap::TimeProfile,
cap_init::TimeProfile,
cap_max_installed::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",
),
)
cap_updated, opex_var, opex_fixed, input_updated, output, data, capex = EMLI.BioCHP(
cap,
mass_fractions,
heat_output_ratios,
electricity_resource,
data,
libpath,
)

if !any(isa(d, Investment) for d ∈ data)
push!(data,
SingleInvData(
FixedProfile(capex), # Capex in EUR/MW
cap_max_installed, # Max installed capacity [MW]
cap_init,
ContinuousInvestment(FixedProfile(0), cap_updated),
# Line above: Investment mode with the following arguments:
# 1. argument: min added capacity per sp [MW]
# 2. argument: max added capacity per sp [MW]
),
)
end

return EMLI.BioCHP(
id,
cap_updated,
electricity_resource,
opex_var,
opex_fixed,
input_updated,
output,
data,
)
end

end
Loading