Skip to content

Commit

Permalink
update thermal objective function implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed May 1, 2024
1 parent ce7b166 commit e4ab8a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/devices_models/devices/common/objective_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ end
function _add_start_up_cost_to_objective!(
container::OptimizationContainer,
::T,
component::PSY.Component,
op_cost::PSY.OperationalCost,
component::PSY.ThermalGen,
op_cost::PSY.ThermalGenerationCost,
::U,
) where {T <: VariableType, U <: AbstractDeviceFormulation}
cost_term = start_up_cost(op_cost, component, U())
Expand All @@ -272,8 +272,8 @@ const MULTI_START_COST_MAP = Dict{DataType, Int}(
function _add_start_up_cost_to_objective!(
container::OptimizationContainer,
::T,
component::PSY.Component,
op_cost::Union{PSY.ThermalGenerationCost, PSY.MarketBidCost},
component::PSY.ThermalMultiStart,
op_cost::PSY.ThermalGenerationCost,
::U,
) where {T <: VariableType, U <: ThermalMultiStartUnitCommitment}
cost_terms = start_up_cost(op_cost, component, U())
Expand Down
13 changes: 4 additions & 9 deletions src/devices_models/devices/thermal_generation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,8 @@ initial_condition_default(::InitialTimeDurationOff, d::PSY.ThermalGen, ::Abstrac
initial_condition_variable(::InitialTimeDurationOff, d::PSY.ThermalGen, ::AbstractThermalFormulation) = OnVariable()

########################Objective Function##################################################
proportional_cost(cost::PSY.OperationalCost, ::OnVariable, ::PSY.ThermalGen, ::AbstractThermalFormulation)=PSY.get_fixed(cost)
proportional_cost(cost::PSY.OperationalCost, S::OnVariable, T::PSY.ThermalGen, U::AbstractCompactUnitCommitment) = no_load_cost(cost, S, T, U) + PSY.get_fixed(cost)
proportional_cost(cost::PSY.MarketBidCost, ::OnVariable, ::PSY.ThermalGen, ::AbstractThermalFormulation)=PSY.get_no_load(cost)
proportional_cost(cost::PSY.MarketBidCost, ::OnVariable, ::PSY.ThermalGen, ::AbstractCompactUnitCommitment)=PSY.get_no_load(cost)
proportional_cost(cost::PSY.ThermalGenerationCost, ::OnVariable, ::PSY.ThermalMultiStart, ::ThermalMultiStartUnitCommitment)=PSY.get_fixed(cost) + PSY.get_no_load(cost)
proportional_cost(cost::PSY.ThermalGenerationCost, S::OnVariable, T::PSY.ThermalGen, U::AbstractThermalFormulation) = no_load_cost(cost, S, T, U)
proportional_cost(cost::PSY.MarketBidCost, S::OnVariable, T::PSY.ThermalGen, U::AbstractCompactUnitCommitment)=no_load_cost(cost, S, T, U)

has_multistart_variables(::PSY.ThermalGen, ::AbstractThermalFormulation)=false
has_multistart_variables(::PSY.ThermalMultiStart, ::ThermalMultiStartUnitCommitment)=true
Expand All @@ -92,7 +89,7 @@ sos_status(::PSY.ThermalGen, ::AbstractThermalUnitCommitment)=SOSStatusVariable.
sos_status(::PSY.ThermalMultiStart, ::AbstractStandardUnitCommitment)=SOSStatusVariable.VARIABLE
sos_status(::PSY.ThermalMultiStart, ::ThermalMultiStartUnitCommitment)=SOSStatusVariable.VARIABLE

start_up_cost(cost::PSY.ThermalGenerationCost, ::PSY.ThermalGen, ::AbstractThermalFormulation)=PSY.get_start_up(cost)
start_up_cost(cost::PSY.ThermalGenerationCost, ::PSY.ThermalGen, ::AbstractThermalFormulation)=maximum(PSY.get_start_up(cost))
start_up_cost(cost::PSY.ThermalGenerationCost, ::PSY.ThermalMultiStart, ::ThermalMultiStartUnitCommitment)=PSY.get_start_up(cost)
start_up_cost(cost::PSY.MarketBidCost, ::PSY.ThermalGen, ::AbstractThermalFormulation)=maximum(PSY.get_start_up(cost))
start_up_cost(cost::PSY.MarketBidCost, ::PSY.ThermalMultiStart, ::ThermalMultiStartUnitCommitment)=PSY.get_start_up(cost)
Expand All @@ -106,10 +103,8 @@ uses_compact_power(::PSY.ThermalGen, ::ThermalCompactDispatch)=true
variable_cost(cost::PSY.OperationalCost, ::ActivePowerVariable, ::PSY.ThermalGen, ::AbstractThermalFormulation)=PSY.get_variable(cost)
variable_cost(cost::PSY.OperationalCost, ::PowerAboveMinimumVariable, ::PSY.ThermalGen, ::AbstractThermalFormulation)=PSY.get_variable(cost)

no_load_cost(cost::PSY.ThermalGenerationCost, ::OnVariable, ::PSY.ThermalMultiStart, U::AbstractThermalFormulation) = PSY.get_no_load(cost)

function no_load_cost(cost::PSY.ThermalGenerationCost, S::OnVariable, T::PSY.ThermalGen, U::AbstractThermalFormulation)
return no_load_cost(PSY.get_variable(cost), S, T, U)
return no_load_cost(PSY.get_variable(cost), S, T, U) + PSY.get_fixed(cost)
end

# TODO given the old implementations, these functions seem to get the cost at *minimum* load, not *zero* load. Is that correct?
Expand Down

0 comments on commit e4ab8a1

Please sign in to comment.