-
Notifications
You must be signed in to change notification settings - Fork 0
Make use of C_inv in bioCHP model #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b5e2fa9
Make use of C_inv in bioCHP model and adjust tests accordingly
96ad554
Fix error from incorrect local setup
66bb19f
Enable CSPandPV-node usage for power_thermal=0 or power_pv=0 from Tec…
356f0d6
Fix test to avoid machine epsilon precision inaccuracies, e.g., 3.552…
93ab8f8
Add suggestion from review
3c68452
Make investments related work in an extension.
9e6c530
Minor update to README.md
JulStraus 7da4216
Add suggestions from review
ec04657
Minor update to the docstrings and `Vector{<:Data}`
JulStraus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.