From ed334f4461f741f2b00bdba4bf323d17f987daaa Mon Sep 17 00:00:00 2001 From: Julian Straus Date: Wed, 26 Nov 2025 09:39:51 +0100 Subject: [PATCH] Fixed bug related to InvestmentData check for Storage * The bug is only present when the Storage fieldnames are changed * In the EMX repositories, this only affected HydroReservoir --- NEWS.md | 8 +++++++- Project.toml | 2 +- ext/EMIExt/checks.jl | 10 ++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 3d1d851e..f7663139 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,14 @@ # Release notes +## Version 0.8.6 (2025-11-26) + +### Bugfixes + +* Fix a bug in which field names for the capacities of a `Storage` node resulted in error message for the investment data checks. + ## Version 0.8.5 (2025-10-23) -## Bugfixes +### Bugfixes * Fix a bug in which field names for the capacities of a `Storage` node resulted in unconstrained capacities. diff --git a/Project.toml b/Project.toml index ff02bab5..3cf39729 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "EnergyModelsBase" uuid = "5d7e687e-f956-46f3-9045-6f5a5fd49f50" authors = ["Lars Hellemo , Julian Straus "] -version = "0.8.5" +version = "0.8.6" [deps] JuMP = "4076af6c-e467-56ae-b986-b466b2749572" diff --git a/ext/EMIExt/checks.jl b/ext/EMIExt/checks.jl index c02f0584..963ebba5 100644 --- a/ext/EMIExt/checks.jl +++ b/ext/EMIExt/checks.jl @@ -53,14 +53,16 @@ function EMB.check_node_data( return end - for cap_fields ∈ fieldnames(typeof(data)) - sub_data = getfield(data, cap_fields) + cap_map = Dict(:charge => charge, :level => level, :discharge => discharge) + + for (cap, cap_fun) ∈ cap_map + sub_data = getfield(data, cap) isnothing(sub_data) && continue check_inv_data( sub_data, - EMB.capacity(getproperty(n, cap_fields)), + EMB.capacity(cap_fun(n)), 𝒯, - " of field `" * String(cap_fields) * "`", + " of field `" * String(cap) * "`", check_timeprofiles, ) end