Skip to content

Commit a98fd7b

Browse files
saketadhauJulStraus
authored andcommitted
Fixed bugs in 0.9 branch (based on #88)
* Fix undefined variable in check_scenario_profile * Fix trailing commas in fix() calls
1 parent 98f6951 commit a98fd7b

6 files changed

Lines changed: 28 additions & 11 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.9.6 (2026-04-15)
4+
5+
### Bug fixes
6+
7+
* Fixed a bug in the function `check_scenario_profile` resulting in an error, if utilized.
8+
39
## Version 0.9.5 (2026-03-25)
410

511
### Minor updates

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

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

src/checks.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -647,28 +647,28 @@ scenario indexing.
647647
"""
648648
function check_scenario_profile(time_profile::TimeProfile, message::String)
649649
# Check on the highest level
650-
bool_osc = check_osc_sub_profile(time_profile, message, true)
650+
bool_scp = check_osc_sub_profile(time_profile, message, true)
651651

652652
# Iterate through the strategic profiles, if existing
653653
if isa(time_profile, StrategicProfile)
654654
for l1_profile time_profile.vals
655655
sub_msg = "in strategic profiles " * message
656-
bool_osc = check_osc_sub_profile(l1_profile, sub_msg, bool_osc)
656+
bool_scp = check_osc_sub_profile(l1_profile, sub_msg, bool_scp)
657657
if isa(l1_profile, RepresentativeProfile)
658658
for l2_profile l1_profile.vals
659659
sub_msg = "in representative profiles in strategic profiles " * message
660-
bool_osc = check_osc_sub_profile(l2_profile, sub_msg, bool_osc)
660+
bool_scp = check_osc_sub_profile(l2_profile, sub_msg, bool_scp)
661661
if isa(l2_profile, ScenarioProfile)
662662
for l3_profile l2_profile.vals
663663
sub_msg = "in scenario profiles in representative profiles in strategic profiles " * message
664-
bool_osc = check_osc_sub_profile(l3_profile, sub_msg, bool_osc)
664+
bool_scp = check_osc_sub_profile(l3_profile, sub_msg, bool_scp)
665665
end
666666
end
667667
end
668668
elseif isa(l1_profile, ScenarioProfile)
669669
for l2_profile l1_profile.vals
670670
sub_msg = "in scenario profiles in strategic profiles " * message
671-
bool_osc = check_osc_sub_profile(l2_profile, sub_msg, bool_osc)
671+
bool_scp = check_osc_sub_profile(l2_profile, sub_msg, bool_scp)
672672
end
673673
end
674674
end
@@ -678,11 +678,11 @@ function check_scenario_profile(time_profile::TimeProfile, message::String)
678678
if isa(time_profile, RepresentativeProfile)
679679
for l1_profile time_profile.vals
680680
sub_msg = "in representative profiles " * message
681-
bool_osc = check_osc_sub_profile(l1_profile, sub_msg, bool_osc)
681+
bool_scp = check_osc_sub_profile(l1_profile, sub_msg, bool_scp)
682682
if isa(l1_profile, ScenarioProfile)
683683
for l2_profile l1_profile.vals
684684
sub_msg = "in scenario profiles in representative profiles " * message
685-
bool_osc = check_osc_sub_profile(l2_profile, sub_msg, bool_osc)
685+
bool_scp = check_osc_sub_profile(l2_profile, sub_msg, bool_scp)
686686
end
687687
end
688688
end
@@ -692,7 +692,7 @@ function check_scenario_profile(time_profile::TimeProfile, message::String)
692692
if isa(time_profile, ScenarioProfile)
693693
for l1_profile time_profile.vals
694694
sub_msg = "in scenario profiles " * message
695-
bool_osc = check_osc_sub_profile(l1_profile, sub_msg, bool_osc)
695+
bool_scp = check_osc_sub_profile(l1_profile, sub_msg, bool_scp)
696696
end
697697
end
698698
return bool_scp

src/constraint_functions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ function constraints_opex_fixed(m, n::Sink, 𝒯ᴵⁿᵛ, modeltype::EnergyMode
638638

639639
# Fix the fixed OPEX
640640
for t_inv 𝒯ᴵⁿᵛ
641-
fix(m[:opex_fixed][n, t_inv], 0, ; force = true)
641+
fix(m[:opex_fixed][n, t_inv], 0; force = true)
642642
end
643643
end
644644

src/data_functions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function constraints_ext_data(m, n::Node, 𝒯, 𝒫, modeltype::EnergyModel, da
3333

3434
# Fix the other emissions to 0 to avoid problems with unconstrained variables
3535
for t 𝒯, p_em 𝒫ᵉᵐ
36-
fix(m[:emissions_node][n, t, p_em], 0, ; force = true)
36+
fix(m[:emissions_node][n, t, p_em], 0; force = true)
3737
end
3838
end
3939
function constraints_ext_data(m, n::Node, 𝒯, 𝒫, modeltype::EnergyModel, data::EmissionsProcess)

test/test_checks.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,17 @@ end
437437
@test_throws AssertionError EMB.check_scenario_profile(tp, "")
438438
end
439439

440+
# Check that valid profiles pass check_scenario_profile without error
441+
valid_profiles = [
442+
FixedProfile(5),
443+
StrategicProfile([FixedProfile(5)]),
444+
StrategicProfile([RepresentativeProfile([FixedProfile(5)])]),
445+
RepresentativeProfile([ScenarioProfile([FixedProfile(5)])]),
446+
]
447+
for tp valid_profiles
448+
@test EMB.check_scenario_profile(tp, "")
449+
end
450+
440451
# Reactivate logging
441452
EMB.ASSERTS_AS_LOG = true
442453
end

0 commit comments

Comments
 (0)