Skip to content

Commit

Permalink
Fixed when using investment models (#40)
Browse files Browse the repository at this point in the history
* Moved test of checks to separate file
* Use default function from EMB 0.8.3
* Added error in EMRP checks and extended tests
* Fixed problems when using investment model
  - Extension functions where not working
  - Tests included to check that everything is fine
  • Loading branch information
JulStraus authored Nov 29, 2024
1 parent 02dba0e commit 040e6d1
Show file tree
Hide file tree
Showing 11 changed files with 814 additions and 379 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release notes

## Version 0.6.4 (2024-11-29)

* Fixed errors overseen from the inclusion of batteries and detailed hydropower.
* Extended on tests to avoid errors like these in the future.
* Provided a comprehensive testset for checks.

## Version 0.6.3 (2024-11-27)

### Battery modelling
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "EnergyModelsRenewableProducers"
uuid = "b007c34f-ba52-4995-ba37-fffe79fbde35"
authors = ["Sigmund Eggen Holm, Julian Straus, Per Aaslid, Linn Emelie Schäffer"]
version = "0.6.3"
version = "0.6.4"

[deps]
EnergyModelsBase = "5d7e687e-f956-46f3-9045-6f5a5fd49f50"
Expand All @@ -15,7 +15,7 @@ EnergyModelsInvestments = "fca3f8eb-b383-437d-8e7b-aac76bb2004f"
EMIExt = "EnergyModelsInvestments"

[compat]
EnergyModelsBase = "0.8.1"
EnergyModelsBase = "0.8.3"
EnergyModelsInvestments = "0.8"
JuMP = "1.5"
TimeStruct = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion ext/EMIExt/checks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ utilize investments at the time being, a separate function is required
- No investment data is allowed
"""
function EMB.check_node_data(
n::Union{HydroReservoir,HydroUnit,HydroGate},
n::Union{HydroReservoir,EMRP.HydroUnit,HydroGate},
data::InvestmentData,
𝒯,
modeltype::AbstractInvestmentModel,
Expand Down
8 changes: 4 additions & 4 deletions ext/EMIExt/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ function EMRP.multiplication_variables(
else
# Calculation of the multiplication with the installed capacity of the node
prod = @expression(m, [t_inv 𝒯ᴵⁿᵛ],
capacity(level(n), t_inv) * [:bat_stack_replace_b][n, t_inv]
capacity(level(n), t_inv) * m[:bat_stack_replace_b][n, t_inv]
)
end
return prod
end

function capacity_max(n::AbstractBattery, t_inv, modeltype::AbstractInvestmentModel)
function EMRP.capacity_max(n::AbstractBattery, t_inv, modeltype::AbstractInvestmentModel)
if EMI.has_investment(n, :level)
max_installed = capacity(level(n), t_inv) * cycles(n)
max_installed = EMI.max_installed(EMI.investment_data(n, :level), t_inv) * EMRP.cycles(n)
else
max_installed = EMI.max_installed(EMI.investment_data(n, :level)) * cycles(n)
max_installed = capacity(level(n), t_inv) * EMRP.cycles(n)
end
return max_installed
end
Loading

2 comments on commit 040e6d1

@JulStraus
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/120393

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.4 -m "<description of version>" 040e6d1415ec08b18c7067acc4e3defb0ada4053
git push origin v0.6.4

Please sign in to comment.