Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release notes

## Unversioned

### Bug fixes

* Fixed a bug in the function `check_scenario_profile` resulting in an error, if utilized.

## Version 0.10.0 (2026-04-09)

### Breaking changes
Expand Down
16 changes: 8 additions & 8 deletions src/checks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -750,28 +750,28 @@ scenario indexing.
"""
function check_scenario_profile(time_profile::TimeProfile, message::String)
# Check on the highest level
bool_osc = check_osc_sub_profile(time_profile, message, true)
bool_scp = check_osc_sub_profile(time_profile, message, true)

# Iterate through the strategic profiles, if existing
if isa(time_profile, StrategicProfile)
for l1_profile ∈ time_profile.vals
sub_msg = "in strategic profiles " * message
bool_osc = check_osc_sub_profile(l1_profile, sub_msg, bool_osc)
bool_scp = check_osc_sub_profile(l1_profile, sub_msg, bool_scp)
if isa(l1_profile, RepresentativeProfile)
for l2_profile ∈ l1_profile.vals
sub_msg = "in representative profiles in strategic profiles " * message
bool_osc = check_osc_sub_profile(l2_profile, sub_msg, bool_osc)
bool_scp = check_osc_sub_profile(l2_profile, sub_msg, bool_scp)
if isa(l2_profile, ScenarioProfile)
for l3_profile ∈ l2_profile.vals
sub_msg = "in scenario profiles in representative profiles in strategic profiles " * message
bool_osc = check_osc_sub_profile(l3_profile, sub_msg, bool_osc)
bool_scp = check_osc_sub_profile(l3_profile, sub_msg, bool_scp)
end
end
end
elseif isa(l1_profile, ScenarioProfile)
for l2_profile ∈ l1_profile.vals
sub_msg = "in scenario profiles in strategic profiles " * message
bool_osc = check_osc_sub_profile(l2_profile, sub_msg, bool_osc)
bool_scp = check_osc_sub_profile(l2_profile, sub_msg, bool_scp)
end
end
end
Expand All @@ -781,11 +781,11 @@ function check_scenario_profile(time_profile::TimeProfile, message::String)
if isa(time_profile, RepresentativeProfile)
for l1_profile ∈ time_profile.vals
sub_msg = "in representative profiles " * message
bool_osc = check_osc_sub_profile(l1_profile, sub_msg, bool_osc)
bool_scp = check_osc_sub_profile(l1_profile, sub_msg, bool_scp)
if isa(l1_profile, ScenarioProfile)
for l2_profile ∈ l1_profile.vals
sub_msg = "in scenario profiles in representative profiles " * message
bool_osc = check_osc_sub_profile(l2_profile, sub_msg, bool_osc)
bool_scp = check_osc_sub_profile(l2_profile, sub_msg, bool_scp)
end
end
end
Expand All @@ -795,7 +795,7 @@ function check_scenario_profile(time_profile::TimeProfile, message::String)
if isa(time_profile, ScenarioProfile)
for l1_profile ∈ time_profile.vals
sub_msg = "in scenario profiles " * message
bool_osc = check_osc_sub_profile(l1_profile, sub_msg, bool_osc)
bool_scp = check_osc_sub_profile(l1_profile, sub_msg, bool_scp)
end
end
return bool_scp
Expand Down
2 changes: 1 addition & 1 deletion src/constraint_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ function constraints_opex_fixed(m, n::Sink, 𝒯ᴵⁿᵛ, modeltype::EnergyMode

# Fix the fixed OPEX
for t_inv ∈ 𝒯ᴵⁿᵛ
fix(m[:opex_fixed][n, t_inv], 0, ; force = true)
fix(m[:opex_fixed][n, t_inv], 0; force = true)
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/data_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function constraints_ext_data(m, n::Node, 𝒯, 𝒫, modeltype::EnergyModel, da

# Fix the other emissions to 0 to avoid problems with unconstrained variables
for t ∈ 𝒯, p_em ∈ 𝒫ᵉᵐ
fix(m[:emissions_node][n, t, p_em], 0, ; force = true)
fix(m[:emissions_node][n, t, p_em], 0; force = true)
end
end
function constraints_ext_data(m, n::Node, 𝒯, 𝒫, modeltype::EnergyModel, data::EmissionsProcess)
Expand Down
11 changes: 11 additions & 0 deletions test/test_checks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,17 @@ end
@test_throws AssertionError EMB.check_scenario_profile(tp, "")
end

# Check that valid profiles pass check_scenario_profile without error
valid_profiles = [
FixedProfile(5),
StrategicProfile([FixedProfile(5)]),
StrategicProfile([RepresentativeProfile([FixedProfile(5)])]),
RepresentativeProfile([ScenarioProfile([FixedProfile(5)])]),
]
for tp ∈ valid_profiles
@test EMB.check_scenario_profile(tp, "")
end

# Reactivate logging
EMB.ASSERTS_AS_LOG = true
end
Expand Down
Loading