Skip to content
Open
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
4 changes: 4 additions & 0 deletions src/core/unit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ function _isvalid(unit::Unit)
@critical "Enabled ramps are currently not supported while using representative Snapshots" unit = unit.name
end

if !_isempty(unit.availability_factor) && !_isempty(unit.availability)
@critical "Setting both the `availability` and the `availability_factor` is not allowed" unit = unit.name
end

return true
end

Expand Down
8 changes: 8 additions & 0 deletions test/src/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
# Zero demand results in zero cost.
TestExampleModule.check(; obj=0, components=Dict("demand.enabled" => false))
TestExampleModule.check(; obj=0, components=Dict("demand.disabled" => true))
# We cannot set both the availability and the availability factor.
cfg = String(Assets.get_path("examples", "01_basic_single_node.iesopt.yaml"))
@test_logs (:error, "[generate] Error(s) during model generation") match_mode = :any generate!(
cfg,
# `plant_wind` has an availability factor set in the config.
# So adding an availability here should error.
components=Dict("plant_wind.availability" => 1),
)
end

@testitem "02_advanced_single_node" tags = [:examples] setup = [TestExampleModule] begin
Expand Down