From a3a3f256243b853ab6c35a54b3b6770667c6aab0 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Sat, 28 Sep 2024 16:34:10 -0600 Subject: [PATCH] fix incorrect no load cost --- .../devices/common/objective_function/common.jl | 3 ++- src/devices_models/devices/thermal_generation.jl | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/devices_models/devices/common/objective_function/common.jl b/src/devices_models/devices/common/objective_function/common.jl index 3d665d35e..9a8b65ce8 100644 --- a/src/devices_models/devices/common/objective_function/common.jl +++ b/src/devices_models/devices/common/objective_function/common.jl @@ -54,7 +54,8 @@ function add_proportional_cost!( cost_term = proportional_cost(op_cost_data, U(), d, V()) iszero(cost_term) && continue for t in get_time_steps(container) - _add_proportional_term!(container, U(), d, cost_term * multiplier, t) + exp = _add_proportional_term!(container, U(), d, cost_term * multiplier, t) + add_to_expression!(container, ProductionCostExpression, exp, d, t) end end return diff --git a/src/devices_models/devices/thermal_generation.jl b/src/devices_models/devices/thermal_generation.jl index bfd514ca8..633de9b9b 100644 --- a/src/devices_models/devices/thermal_generation.jl +++ b/src/devices_models/devices/thermal_generation.jl @@ -75,8 +75,10 @@ initial_condition_variable(::InitialTimeDurationOff, d::PSY.ThermalGen, ::Abstra ########################Objective Function################################################## # TODO: Decide what is the cost for OnVariable, if fixed or constant term in variable -#proportional_cost(cost::PSY.ThermalGenerationCost, S::OnVariable, T::PSY.ThermalGen, U::AbstractThermalFormulation) = no_load_cost(cost, S, T, U) -proportional_cost(cost::PSY.ThermalGenerationCost, S::OnVariable, T::PSY.ThermalGen, U::AbstractThermalFormulation) = PSY.get_fixed(cost) +function proportional_cost(cost::PSY.ThermalGenerationCost, S::OnVariable, T::PSY.ThermalGen, U::AbstractThermalFormulation) + return no_load_cost(cost, S, T, U) + PSY.get_constant_term(PSY.get_vom_cost(PSY.get_variable(cost))) +end + proportional_cost(cost::PSY.MarketBidCost, ::OnVariable, ::PSY.ThermalGen, ::AbstractThermalFormulation) = PSY.get_no_load_cost(cost) has_multistart_variables(::PSY.ThermalGen, ::AbstractThermalFormulation)=false