Skip to content

Commit c2bd586

Browse files
committed
Replaced Base.@kwdef with @kwdef and added import Base: @kwdef in src/PowerSystems.jl for downward compatibility with Julia v1.8.x and below
1 parent 68d2289 commit c2bd586

File tree

9 files changed

+12
-11
lines changed

9 files changed

+12
-11
lines changed

src/PowerSystems.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ export generate_struct_files
474474
#################################################################################
475475
# Imports
476476

477+
import Base: @kwdef
477478
import LinearAlgebra
478479
import Unicode: normalize
479480
import Logging

src/models/cost_functions/HydroGenerationCost.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fuel curves to model specific water intake.
1212
1313
The `variable` cost is a required parameter, but `zero(CostCurve)` can be used to set it to 0.
1414
"""
15-
Base.@kwdef mutable struct HydroGenerationCost <: OperationalCost
15+
@kwdef mutable struct HydroGenerationCost <: OperationalCost
1616
"Production variable cost represented by a `FuelCurve`, where the fuel is water,
1717
or a `CostCurve` in currency."
1818
variable::ProductionVariableCostCurve

src/models/cost_functions/LoadCost.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fixed and variable cost components.
1010
1111
The `variable` cost is a required parameter, but `zero(CostCurve)` can be used to set it to 0.
1212
"""
13-
Base.@kwdef mutable struct LoadCost <: OperationalCost
13+
@kwdef mutable struct LoadCost <: OperationalCost
1414
"Variable cost represented as a [`CostCurve`](@ref)"
1515
variable::CostCurve
1616
"(default: 0) Fixed cost. For some cost represenations this field can be

src/models/cost_functions/MarketBidCost.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $(TYPEDFIELDS)
99
An operating cost for market bids of energy and ancilliary services for any asset.
1010
Compatible with most US Market bidding mechanisms that support demand and generation side.
1111
"""
12-
Base.@kwdef mutable struct MarketBidCost <: OperationalCost
12+
@kwdef mutable struct MarketBidCost <: OperationalCost
1313
"No load cost"
1414
no_load_cost::Union{TimeSeriesKey, Float64}
1515
"Start-up cost at different stages of the thermal cycle as the unit cools after a

src/models/cost_functions/RenewableGenerationCost.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ can be used to represent the loss of tax incentives.
1212
1313
The `variable` cost is a required parameter, but `zero(CostCurve)` can be used to set it to 0.
1414
"""
15-
Base.@kwdef mutable struct RenewableGenerationCost <: OperationalCost
15+
@kwdef mutable struct RenewableGenerationCost <: OperationalCost
1616
"Variable cost represented as a [`CostCurve`](@ref)"
1717
variable::CostCurve
1818
"(default of 0) Cost of curtailing power represented as a [`CostCurve`](@ref)"

src/models/cost_functions/StorageCost.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ or discharge.
1313
This data structure is not intended to represent market storage systems market operations
1414
like the submission of buy/sell bids -- see [`MarketBidCost`](@ref) instead.
1515
"""
16-
Base.@kwdef mutable struct StorageCost <: OperationalCost
16+
@kwdef mutable struct StorageCost <: OperationalCost
1717
"(default of 0) Variable cost of charging represented as a [`CostCurve`](@ref)"
1818
charge_variable_cost::CostCurve = zero(CostCurve)
1919
"(default of 0) Variable cost of discharging represented as a [`CostCurve`](@ref)"

src/models/cost_functions/ThermalGenerationCost.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ $(TYPEDFIELDS)
88
An operational cost for thermal generators which includes fixed cost, variable cost, shut-down
99
cost, and multiple options for start up costs.
1010
"""
11-
Base.@kwdef mutable struct ThermalGenerationCost <: OperationalCost
11+
@kwdef mutable struct ThermalGenerationCost <: OperationalCost
1212
"Variable production cost. Can take a [`CostCurve`](@ref) or [`FuelCurve`](@ref)"
1313
variable::ProductionVariableCostCurve
1414
"Fixed cost of keeping the unit online. For some cost represenations this field can be

src/models/cost_functions/ValueCurves.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Can be used, for instance, in the representation of a [`CostCurve`](@ref) where
2121
and `y` is currency/hr, or in the representation of a [`FuelCurve`](@ref) where `x` is MW
2222
and `y` is fuel/hr.
2323
"""
24-
Base.@kwdef struct InputOutputCurve{
24+
@kwdef struct InputOutputCurve{
2525
T <: Union{QuadraticFunctionData, LinearFunctionData, PiecewiseLinearData},
2626
} <: ValueCurve{T}
2727
"The underlying `FunctionData` representation of this `ValueCurve`"
@@ -42,7 +42,7 @@ cost: `y = f'(x)`. Can be used, for instance, in the representation of a [`CostC
4242
where `x` is MW and `y` is currency/MWh, or in the representation of a [`FuelCurve`](@ref)
4343
where `x` is MW and `y` is fuel/MWh.
4444
"""
45-
Base.@kwdef struct IncrementalCurve{T <: Union{LinearFunctionData, PiecewiseStepData}} <:
45+
@kwdef struct IncrementalCurve{T <: Union{LinearFunctionData, PiecewiseStepData}} <:
4646
ValueCurve{T}
4747
"The underlying `FunctionData` representation of this `ValueCurve`"
4848
function_data::T
@@ -67,7 +67,7 @@ origin: `y = f(x)/x`. Can be used, for instance, in the representation of a
6767
[`FuelCurve`](@ref) where `x` is MW and `y` is fuel/MWh. Typically calculated by dividing
6868
absolute values of cost rate or fuel input rate by absolute values of electric power.
6969
"""
70-
Base.@kwdef struct AverageRateCurve{T <: Union{LinearFunctionData, PiecewiseStepData}} <:
70+
@kwdef struct AverageRateCurve{T <: Union{LinearFunctionData, PiecewiseStepData}} <:
7171
ValueCurve{T}
7272
"The underlying `FunctionData` representation of this `ValueCurve`, in the case of `AverageRateCurve{LinearFunctionData}` representing only the oblique asymptote"
7373
function_data::T

src/models/cost_functions/variable_cost.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ of a [`ValueCurve`](@ref) that may represent input-output, incremental, or avera
3939
data. The default units for the x-axis are MW and can be specified with
4040
`power_units`.
4141
"""
42-
Base.@kwdef struct CostCurve{T <: ValueCurve} <: ProductionVariableCostCurve{T}
42+
@kwdef struct CostCurve{T <: ValueCurve} <: ProductionVariableCostCurve{T}
4343
"The underlying `ValueCurve` representation of this `ProductionVariableCostCurve`"
4444
value_curve::T
4545
"(default: natural units (MW)) The units for the x-axis of the curve"
@@ -78,7 +78,7 @@ liters, m^3, etc.), coupled with a conversion factor between fuel and currency.
7878
a [`ValueCurve`](@ref) that may represent input-output, incremental, or average rate data.
7979
The default units for the x-axis are MW and can be specified with `power_units`.
8080
"""
81-
Base.@kwdef struct FuelCurve{T <: ValueCurve} <: ProductionVariableCostCurve{T}
81+
@kwdef struct FuelCurve{T <: ValueCurve} <: ProductionVariableCostCurve{T}
8282
"The underlying `ValueCurve` representation of this `ProductionVariableCostCurve`"
8383
value_curve::T
8484
"(default: natural units (MW)) The units for the x-axis of the curve"

0 commit comments

Comments
 (0)