From 94e481081295ba67063b807cf3a51cf5dc13fb6f Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Tue, 5 Sep 2023 11:10:01 -0600 Subject: [PATCH] add FF slack to objective function --- src/feedforward/feedforward_arguments.jl | 5 +++++ test/test_basic_model_structs.jl | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/feedforward/feedforward_arguments.jl b/src/feedforward/feedforward_arguments.jl index ea85b62627..520fc5f8fb 100644 --- a/src/feedforward/feedforward_arguments.jl +++ b/src/feedforward/feedforward_arguments.jl @@ -79,7 +79,12 @@ function _add_feedforward_slack_variables!(container::OptimizationContainer, base_name = "$(T)_$(U)_{$(name), $(t)}", lower_bound = 0.0 ) + add_to_objective_invariant_expression!( + container, + variable_container[name, t] * BALANCE_SLACK_COST, + ) end + end return end diff --git a/test/test_basic_model_structs.jl b/test/test_basic_model_structs.jl index 6928b5e196..e456761b9f 100644 --- a/test/test_basic_model_structs.jl +++ b/test/test_basic_model_structs.jl @@ -69,12 +69,14 @@ end component_type = RenewableDispatch, source = ActivePowerVariable, affected_values = [OnStatusParameter], + use_slacks = true, ) @test_throws ErrorException LowerBoundFeedforward( component_type = RenewableDispatch, source = ActivePowerVariable, affected_values = [OnStatusParameter], + use_slacks = true, ) @test_throws ErrorException SemiContinuousFeedforward(