Skip to content

Commit b70f6a1

Browse files
authored
Fixed bug related to InvestmentData check for Storage (#79)
* The bug is only present when the Storage fieldnames are changed * In the EMX repositories, this only affected HydroReservoir
1 parent 0a90b1b commit b70f6a1

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

NEWS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# Release notes
22

3+
## Version 0.8.6 (2025-11-26)
4+
5+
### Bugfixes
6+
7+
* Fix a bug in which field names for the capacities of a `Storage` node resulted in error message for the investment data checks.
8+
39
## Version 0.8.5 (2025-10-23)
410

5-
## Bugfixes
11+
### Bugfixes
612

713
* Fix a bug in which field names for the capacities of a `Storage` node resulted in unconstrained capacities.
814

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "EnergyModelsBase"
22
uuid = "5d7e687e-f956-46f3-9045-6f5a5fd49f50"
33
authors = ["Lars Hellemo <Lars.Hellemo@sintef.no>, Julian Straus <Julian.Straus@sintef.no>"]
4-
version = "0.8.5"
4+
version = "0.8.6"
55

66
[deps]
77
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"

ext/EMIExt/checks.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,16 @@ function EMB.check_node_data(
5353
return
5454
end
5555

56-
for cap_fields fieldnames(typeof(data))
57-
sub_data = getfield(data, cap_fields)
56+
cap_map = Dict(:charge => charge, :level => level, :discharge => discharge)
57+
58+
for (cap, cap_fun) cap_map
59+
sub_data = getfield(data, cap)
5860
isnothing(sub_data) && continue
5961
check_inv_data(
6062
sub_data,
61-
EMB.capacity(getproperty(n, cap_fields)),
63+
EMB.capacity(cap_fun(n)),
6264
𝒯,
63-
" of field `" * String(cap_fields) * "`",
65+
" of field `" * String(cap) * "`",
6466
check_timeprofiles,
6567
)
6668
end

0 commit comments

Comments
 (0)