Skip to content

Commit b58b98d

Browse files
saketadhauJulStraus
authored andcommitted
Fixed bugs in 0.8 branch (based on #88)
* Fix undefined variable in check_scenario_profile * Fix trailing commas in fix() calls
1 parent b70f6a1 commit b58b98d

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.8.7 (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.8.6 (2025-11-26)
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.6"
4+
version = "0.8.7"
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
@@ -493,28 +493,28 @@ scenario indexing.
493493
"""
494494
function check_scenario_profile(time_profile::TimeProfile, message::String)
495495
# Check on the highest level
496-
bool_osc = check_osc_sub_profile(time_profile, message, true)
496+
bool_scp = check_osc_sub_profile(time_profile, message, true)
497497

498498
# Iterate through the strategic profiles, if existing
499499
if isa(time_profile, StrategicProfile)
500500
for l1_profile time_profile.vals
501501
sub_msg = "in strategic profiles " * message
502-
bool_osc = check_osc_sub_profile(l1_profile, sub_msg, bool_osc)
502+
bool_scp = check_osc_sub_profile(l1_profile, sub_msg, bool_scp)
503503
if isa(l1_profile, RepresentativeProfile)
504504
for l2_profile l1_profile.vals
505505
sub_msg = "in representative profiles in strategic profiles " * message
506-
bool_osc = check_osc_sub_profile(l2_profile, sub_msg, bool_osc)
506+
bool_scp = check_osc_sub_profile(l2_profile, sub_msg, bool_scp)
507507
if isa(l2_profile, ScenarioProfile)
508508
for l3_profile l2_profile.vals
509509
sub_msg = "in scenario profiles in representative profiles in strategic profiles " * message
510-
bool_osc = check_osc_sub_profile(l3_profile, sub_msg, bool_osc)
510+
bool_scp = check_osc_sub_profile(l3_profile, sub_msg, bool_scp)
511511
end
512512
end
513513
end
514514
elseif isa(l1_profile, ScenarioProfile)
515515
for l2_profile l1_profile.vals
516516
sub_msg = "in scenario profiles in strategic profiles " * message
517-
bool_osc = check_osc_sub_profile(l2_profile, sub_msg, bool_osc)
517+
bool_scp = check_osc_sub_profile(l2_profile, sub_msg, bool_scp)
518518
end
519519
end
520520
end
@@ -524,11 +524,11 @@ function check_scenario_profile(time_profile::TimeProfile, message::String)
524524
if isa(time_profile, RepresentativeProfile)
525525
for l1_profile time_profile.vals
526526
sub_msg = "in representative profiles " * message
527-
bool_osc = check_osc_sub_profile(l1_profile, sub_msg, bool_osc)
527+
bool_scp = check_osc_sub_profile(l1_profile, sub_msg, bool_scp)
528528
if isa(l1_profile, ScenarioProfile)
529529
for l2_profile l1_profile.vals
530530
sub_msg = "in scenario profiles in representative profiles " * message
531-
bool_osc = check_osc_sub_profile(l2_profile, sub_msg, bool_osc)
531+
bool_scp = check_osc_sub_profile(l2_profile, sub_msg, bool_scp)
532532
end
533533
end
534534
end
@@ -538,7 +538,7 @@ function check_scenario_profile(time_profile::TimeProfile, message::String)
538538
if isa(time_profile, ScenarioProfile)
539539
for l1_profile time_profile.vals
540540
sub_msg = "in scenario profiles " * message
541-
bool_osc = check_osc_sub_profile(l1_profile, sub_msg, bool_osc)
541+
bool_scp = check_osc_sub_profile(l1_profile, sub_msg, bool_scp)
542542
end
543543
end
544544
return bool_scp

src/constraint_functions.jl

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

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

src/data_functions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function constraints_data(m, n::Node, 𝒯, 𝒫, modeltype::EnergyModel, data::
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_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
@@ -368,6 +368,17 @@ end
368368
@test_throws AssertionError EMB.check_scenario_profile(tp, "")
369369
end
370370

371+
# Check that valid profiles pass check_scenario_profile without error
372+
valid_profiles = [
373+
FixedProfile(5),
374+
StrategicProfile([FixedProfile(5)]),
375+
StrategicProfile([RepresentativeProfile([FixedProfile(5)])]),
376+
RepresentativeProfile([ScenarioProfile([FixedProfile(5)])]),
377+
]
378+
for tp valid_profiles
379+
@test EMB.check_scenario_profile(tp, "")
380+
end
381+
371382
# Reactivate logging
372383
EMB.ASSERTS_AS_LOG = true
373384
end

0 commit comments

Comments
 (0)