Skip to content

Commit 0a90b1b

Browse files
authored
Fixed a potential problem for Storage with investment models (#74)
1 parent a479760 commit 0a90b1b

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release notes
22

3+
## Version 0.8.5 (2025-10-23)
4+
5+
## Bugfixes
6+
7+
* Fix a bug in which field names for the capacities of a `Storage` node resulted in unconstrained capacities.
8+
39
## Version 0.8.4 (2025-07-03)
410

511
### Bugfixes

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.4"
4+
version = "0.8.5"
55

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

ext/EMIExt/constraints.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ function EMB.constraints_capacity_installed(
4444
disc_rate = discount_rate(modeltype)
4545
𝒯ᴵⁿᵛ = strategic_periods(𝒯)
4646

47-
cap_fields = [:charge, :level, :discharge]
47+
cap_map = Dict(:charge => charge, :level => level, :discharge => discharge)
4848

49-
for cap cap_fields
50-
if !hasfield(typeof(n), cap)
49+
for (cap, cap_fun) cap_map
50+
if isnothing(cap_fun(n))
5151
continue
5252
end
53-
stor_par = getfield(n, cap)
53+
stor_par = cap_fun(n)
5454
prefix = Symbol(:stor_, cap)
5555
var_inst = EMI.get_var_inst(m, prefix, n)
5656
if has_investment(n, cap)

0 commit comments

Comments
 (0)