diff --git a/src/models/cost_functions/CostCurves.jl b/src/models/cost_functions/CostCurves.jl index 6e3f453780..5c158d5d1f 100644 --- a/src/models/cost_functions/CostCurves.jl +++ b/src/models/cost_functions/CostCurves.jl @@ -12,6 +12,8 @@ struct InputOutputCostCurve <: CostCurve function_data::FunctionData end +InputOutputCostCurve(; function_data) = InputOutputCostCurve(function_data) + """ First derivative of the Input/Output cost curve. @@ -23,3 +25,6 @@ struct IncrementalCostCurve <: CostCurve function_data::FunctionData no_load_cost::Float64 end + +IncrementalCostCurve(; function_data, no_load_cost) = + InputOutputCostCurve(function_data, no_load_cost) diff --git a/src/models/cost_functions/HydroPowerCost.jl b/src/models/cost_functions/HydroPowerCost.jl index efa0b0954e..50696f62e7 100644 --- a/src/models/cost_functions/HydroPowerCost.jl +++ b/src/models/cost_functions/HydroPowerCost.jl @@ -27,7 +27,7 @@ end # Constructor for demo purposes; non-functional. function HydroGenerationCost(::Nothing) HydroGenerationCost(; - variable = InputOutputCostCurve(LinearProductionVariableCost(0.0)), + variable = InputOutputCostCurve(LinearFunctionData(0.0)), fixed = 0.0, ) end diff --git a/src/models/cost_functions/LoadCost.jl b/src/models/cost_functions/LoadCost.jl index bd7f6b0283..c1e07c6cd4 100644 --- a/src/models/cost_functions/LoadCost.jl +++ b/src/models/cost_functions/LoadCost.jl @@ -30,7 +30,7 @@ end # Constructor for demo purposes; non-functional. function LoadCost(::Nothing) LoadCost(; - variable = InputOutputCostCurve(LinearProductionVariableCost(0.0)), + variable = InputOutputCostCurve(LinearFunctionData(0.0)), fixed = 0.0, ) end diff --git a/src/models/cost_functions/RenewablePowerCost.jl b/src/models/cost_functions/RenewablePowerCost.jl index f46ca83814..eeea276276 100644 --- a/src/models/cost_functions/RenewablePowerCost.jl +++ b/src/models/cost_functions/RenewablePowerCost.jl @@ -10,21 +10,28 @@ curtailment Costs can be used to represent the loss of tax incentives. # Arguments - `variable::InputOutputCostCurve`: Production Variable Cost represented as input/output. +- `curtailment_cost::InputOutputCostCurve`: Input/output cost of curtailing power. """ mutable struct RenewablePowerCost <: OperationalCost "variable cost" + variable::InputOutputCostCurve + "curtailment cost" curtailment_cost::InputOutputCostCurve - variable_cost::InputOutputCostCurve end -function RenewablePowerCost(; variable) - RenewablePowerCost(variable) +RenewablePowerCost(variable) = + RenewablePowerCost(variable, InputOutputCostCurve(LinearFunctionData(0.0))) + +function RenewablePowerCost(; variable, curtailment_cost) + println(variable) + println(curtailment_cost) + RenewablePowerCost(variable, curtailment_cost) end # Constructor for demo purposes; non-functional. function RenewablePowerCost(::Nothing) RenewablePowerCost(; - variable = InputOutputCostCurve(LinearProductionVariableCost(0.0)), + variable = InputOutputCostCurve(LinearFunctionData(0.0)), ) end diff --git a/src/models/cost_functions/StorageCost.jl b/src/models/cost_functions/StorageCost.jl index c24f37b0e8..f22f42c3c0 100644 --- a/src/models/cost_functions/StorageCost.jl +++ b/src/models/cost_functions/StorageCost.jl @@ -11,7 +11,7 @@ const STORAGE_OPERATION_MODES = NamedTuple{(:charge, :discharge), NTuple{2, Floa end Data Structure for Operational Cost Data like variable cost and start - stop costs and energy storage cost. -This data structure is not intented to represent market storage systems market operations like the submission of +This data structure is not intended to represent market storage systems market operations like the submission of buy/sell bids. # Arguments diff --git a/src/models/cost_functions/ThermalGenerationCost.jl b/src/models/cost_functions/ThermalGenerationCost.jl index 4cb88d4b4d..54945f0195 100644 --- a/src/models/cost_functions/ThermalGenerationCost.jl +++ b/src/models/cost_functions/ThermalGenerationCost.jl @@ -32,7 +32,7 @@ end # Constructor for demo purposes; non-functional. function ThermalGenerationCost(::Nothing) ThermalGenerationCost(; - variable = InputOutputCostCurve(LinearProductionVariableCost(0.0)), + variable = InputOutputCostCurve(LinearFunctionData(0.0)), fixed = 0.0, start_up = 0.0, shut_down = 0.0, diff --git a/src/models/cost_functions/variable_cost.jl b/src/models/cost_functions/variable_cost.jl index 96aeb66f41..a92d251a71 100644 --- a/src/models/cost_functions/variable_cost.jl +++ b/src/models/cost_functions/variable_cost.jl @@ -1 +1,4 @@ abstract type ProductionVariableCost end + +IS.serialize(val::ProductionVariableCost) = IS.serialize_struct(val) +IS.deserialize(T::Type{<:ProductionVariableCost}, val::Dict) = IS.deserialize_struct(T, val) diff --git a/src/models/operational_cost.jl b/src/models/operational_cost.jl index 7d2d155ebd..a86e95a786 100644 --- a/src/models/operational_cost.jl +++ b/src/models/operational_cost.jl @@ -1,2 +1,5 @@ """ Super type for operational cost representation in the model""" abstract type OperationalCost <: DeviceParameter end + +IS.serialize(val::OperationalCost) = IS.serialize_struct(val) +IS.deserialize(T::Type{<:OperationalCost}, val::Dict) = IS.deserialize_struct(T, val) diff --git a/src/parsers/power_models_data.jl b/src/parsers/power_models_data.jl index d2843b78bf..9545f5e198 100644 --- a/src/parsers/power_models_data.jl +++ b/src/parsers/power_models_data.jl @@ -349,7 +349,7 @@ function make_hydro_gen(gen_name, d, bus, sys_mbase) end function make_renewable_dispatch(gen_name, d, bus, sys_mbase) - cost = TwoPartCost(LinearFunctionData(0.0), 0.0) + cost = RenewablePowerCost(InputOutputCostCurve(LinearFunctionData(0.0))) base_conversion = sys_mbase / d["mbase"] rating = calculate_rating(d["pmax"], d["qmax"]) @@ -449,6 +449,7 @@ function make_thermal_gen(gen_name::AbstractString, d::Dict, bus::ACBus, sys_mba cost = PolynomialFunctionData(Dict((i, c / sys_mbase^i) for (i, c) in coeffs)) fixed = (d["ncost"] >= 1) ? last(d["cost"]) : 0.0 end + cost = InputOutputCostCurve(cost) startup = d["startup"] shutdn = d["shutdown"] else