diff --git a/src/data_format_conversions.jl b/src/data_format_conversions.jl index 9883de97b8..9770b53f4b 100644 --- a/src/data_format_conversions.jl +++ b/src/data_format_conversions.jl @@ -98,7 +98,7 @@ function _convert_data!( ::Val{Symbol("3.0.0")}, ::Val{Symbol("4.0.0")}, ) - for component in raw["data"]["components"] + for component in vcat(raw["data"]["components"], raw["data"]["masked_components"]) if haskey(component, "operation_cost") op_cost = component["operation_cost"] if op_cost["__metadata__"]["type"] in COST_CONTAINERS && diff --git a/src/descriptors/power_system_structs.json b/src/descriptors/power_system_structs.json index 6e225b0f0f..d987a18136 100644 --- a/src/descriptors/power_system_structs.json +++ b/src/descriptors/power_system_structs.json @@ -2704,7 +2704,7 @@ "name": "operation_cost", "null_value": "TwoPartCost(nothing)", "data_type": "OperationalCost", - "default": "TwoPartCost(0.0, 0.0)", + "default": "TwoPartCost(LinearFunctionData(0.0), 0.0)", "comment": "Operation Cost of Generation [`OperationalCost`](@ref)" }, { @@ -3052,7 +3052,7 @@ "name": "operation_cost", "null_value": "TwoPartCost(nothing)", "data_type": "OperationalCost", - "default": "TwoPartCost(0.0, 0.0)", + "default": "TwoPartCost(LinearFunctionData(0.0), 0.0)", "comment": "Operation Cost of Generation [`OperationalCost`](@ref)" }, { @@ -3220,7 +3220,7 @@ "name": "operation_cost", "null_value": "TwoPartCost(nothing)", "data_type": "OperationalCost", - "default": "TwoPartCost(0.0, 0.0)", + "default": "TwoPartCost(LinearFunctionData(0.0), 0.0)", "comment": "Operation Cost of Generation [`OperationalCost`](@ref)" }, { @@ -3468,7 +3468,7 @@ "name": "operation_cost", "null_value": "TwoPartCost(nothing)", "data_type": "OperationalCost", - "default": "TwoPartCost(0.0, 0.0)", + "default": "TwoPartCost(LinearFunctionData(0.0), 0.0)", "comment": "Operation Cost of Generation [`OperationalCost`](@ref)" }, { diff --git a/src/models/function_data.jl b/src/models/function_data.jl index ffb76d5734..fae33a380d 100644 --- a/src/models/function_data.jl +++ b/src/models/function_data.jl @@ -50,8 +50,11 @@ end get_coefficients(fd::PolynomialFunctionData) = fd.coefficients function _validate_piecewise_x(x_coords) - (length(x_coords) >= 2) || - throw(ArgumentError("Must specify at least two x-coordinates")) + # TODO currently there exist cases where we are constructing a PiecewiseLinearPointData + # with only one point (e.g., `calculate_variable_cost` within + # `power_system_table_data.jl`) -- what does this represent? + # (length(x_coords) >= 2) || + # throw(ArgumentError("Must specify at least two x-coordinates")) issorted(x_coords) || throw(ArgumentError("Piecewise x-coordinates must be ascending")) # TODO are there legitimate cases where we'd want negative x-coordinates? # (x_coords[1] >= 0) || throw(ArgumentError("Piecewise x-coordinates cannot be negative")) diff --git a/src/models/generated/HydroDispatch.jl b/src/models/generated/HydroDispatch.jl index c4b891d4d3..8b0a9e8d7f 100644 --- a/src/models/generated/HydroDispatch.jl +++ b/src/models/generated/HydroDispatch.jl @@ -79,11 +79,11 @@ mutable struct HydroDispatch <: HydroGen internal::InfrastructureSystemsInternal end -function HydroDispatch(name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, operation_cost=TwoPartCost(0.0, 0.0), services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), ) +function HydroDispatch(name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, operation_cost=TwoPartCost(LinearFunctionData(0.0), 0.0), services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), ) HydroDispatch(name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, operation_cost, services, dynamic_injector, ext, time_series_container, InfrastructureSystemsInternal(), ) end -function HydroDispatch(; name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, operation_cost=TwoPartCost(0.0, 0.0), services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), internal=InfrastructureSystemsInternal(), ) +function HydroDispatch(; name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, operation_cost=TwoPartCost(LinearFunctionData(0.0), 0.0), services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), internal=InfrastructureSystemsInternal(), ) HydroDispatch(name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, operation_cost, services, dynamic_injector, ext, time_series_container, internal, ) end diff --git a/src/models/generated/HydroEnergyReservoir.jl b/src/models/generated/HydroEnergyReservoir.jl index 09f70f9f28..137e5842e8 100644 --- a/src/models/generated/HydroEnergyReservoir.jl +++ b/src/models/generated/HydroEnergyReservoir.jl @@ -102,11 +102,11 @@ mutable struct HydroEnergyReservoir <: HydroGen internal::InfrastructureSystemsInternal end -function HydroEnergyReservoir(name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, storage_capacity, inflow, initial_storage, operation_cost=TwoPartCost(0.0, 0.0), storage_target=1.0, conversion_factor=1.0, time_at_status=INFINITE_TIME, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), ) +function HydroEnergyReservoir(name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, storage_capacity, inflow, initial_storage, operation_cost=TwoPartCost(LinearFunctionData(0.0), 0.0), storage_target=1.0, conversion_factor=1.0, time_at_status=INFINITE_TIME, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), ) HydroEnergyReservoir(name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, storage_capacity, inflow, initial_storage, operation_cost, storage_target, conversion_factor, time_at_status, services, dynamic_injector, ext, time_series_container, InfrastructureSystemsInternal(), ) end -function HydroEnergyReservoir(; name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, storage_capacity, inflow, initial_storage, operation_cost=TwoPartCost(0.0, 0.0), storage_target=1.0, conversion_factor=1.0, time_at_status=INFINITE_TIME, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), internal=InfrastructureSystemsInternal(), ) +function HydroEnergyReservoir(; name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, storage_capacity, inflow, initial_storage, operation_cost=TwoPartCost(LinearFunctionData(0.0), 0.0), storage_target=1.0, conversion_factor=1.0, time_at_status=INFINITE_TIME, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), internal=InfrastructureSystemsInternal(), ) HydroEnergyReservoir(name, available, bus, active_power, reactive_power, rating, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, base_power, storage_capacity, inflow, initial_storage, operation_cost, storage_target, conversion_factor, time_at_status, services, dynamic_injector, ext, time_series_container, internal, ) end diff --git a/src/models/generated/HydroPumpedStorage.jl b/src/models/generated/HydroPumpedStorage.jl index 71a8312f32..d8f64c2a24 100644 --- a/src/models/generated/HydroPumpedStorage.jl +++ b/src/models/generated/HydroPumpedStorage.jl @@ -128,11 +128,11 @@ mutable struct HydroPumpedStorage <: HydroGen internal::InfrastructureSystemsInternal end -function HydroPumpedStorage(name, available, bus, active_power, reactive_power, rating, base_power, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, rating_pump, active_power_limits_pump, reactive_power_limits_pump, ramp_limits_pump, time_limits_pump, storage_capacity, inflow, outflow, initial_storage, storage_target=(up=1.0, down=1.0), operation_cost=TwoPartCost(0.0, 0.0), pump_efficiency=1.0, conversion_factor=1.0, time_at_status=INFINITE_TIME, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), ) +function HydroPumpedStorage(name, available, bus, active_power, reactive_power, rating, base_power, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, rating_pump, active_power_limits_pump, reactive_power_limits_pump, ramp_limits_pump, time_limits_pump, storage_capacity, inflow, outflow, initial_storage, storage_target=(up=1.0, down=1.0), operation_cost=TwoPartCost(LinearFunctionData(0.0), 0.0), pump_efficiency=1.0, conversion_factor=1.0, time_at_status=INFINITE_TIME, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), ) HydroPumpedStorage(name, available, bus, active_power, reactive_power, rating, base_power, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, rating_pump, active_power_limits_pump, reactive_power_limits_pump, ramp_limits_pump, time_limits_pump, storage_capacity, inflow, outflow, initial_storage, storage_target, operation_cost, pump_efficiency, conversion_factor, time_at_status, services, dynamic_injector, ext, time_series_container, InfrastructureSystemsInternal(), ) end -function HydroPumpedStorage(; name, available, bus, active_power, reactive_power, rating, base_power, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, rating_pump, active_power_limits_pump, reactive_power_limits_pump, ramp_limits_pump, time_limits_pump, storage_capacity, inflow, outflow, initial_storage, storage_target=(up=1.0, down=1.0), operation_cost=TwoPartCost(0.0, 0.0), pump_efficiency=1.0, conversion_factor=1.0, time_at_status=INFINITE_TIME, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), internal=InfrastructureSystemsInternal(), ) +function HydroPumpedStorage(; name, available, bus, active_power, reactive_power, rating, base_power, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, rating_pump, active_power_limits_pump, reactive_power_limits_pump, ramp_limits_pump, time_limits_pump, storage_capacity, inflow, outflow, initial_storage, storage_target=(up=1.0, down=1.0), operation_cost=TwoPartCost(LinearFunctionData(0.0), 0.0), pump_efficiency=1.0, conversion_factor=1.0, time_at_status=INFINITE_TIME, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), internal=InfrastructureSystemsInternal(), ) HydroPumpedStorage(name, available, bus, active_power, reactive_power, rating, base_power, prime_mover_type, active_power_limits, reactive_power_limits, ramp_limits, time_limits, rating_pump, active_power_limits_pump, reactive_power_limits_pump, ramp_limits_pump, time_limits_pump, storage_capacity, inflow, outflow, initial_storage, storage_target, operation_cost, pump_efficiency, conversion_factor, time_at_status, services, dynamic_injector, ext, time_series_container, internal, ) end diff --git a/src/models/generated/InterconnectingConverter.jl b/src/models/generated/InterconnectingConverter.jl index 1f82d693dd..8f54312309 100644 --- a/src/models/generated/InterconnectingConverter.jl +++ b/src/models/generated/InterconnectingConverter.jl @@ -69,11 +69,11 @@ mutable struct InterconnectingConverter <: StaticInjection internal::InfrastructureSystemsInternal end -function InterconnectingConverter(name, available, bus, dc_bus, active_power, rating, active_power_limits, base_power, operation_cost=TwoPartCost(0.0, 0.0), efficiency=1.0, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), ) +function InterconnectingConverter(name, available, bus, dc_bus, active_power, rating, active_power_limits, base_power, operation_cost=TwoPartCost(LinearFunctionData(0.0), 0.0), efficiency=1.0, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), ) InterconnectingConverter(name, available, bus, dc_bus, active_power, rating, active_power_limits, base_power, operation_cost, efficiency, services, dynamic_injector, ext, time_series_container, InfrastructureSystemsInternal(), ) end -function InterconnectingConverter(; name, available, bus, dc_bus, active_power, rating, active_power_limits, base_power, operation_cost=TwoPartCost(0.0, 0.0), efficiency=1.0, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), internal=InfrastructureSystemsInternal(), ) +function InterconnectingConverter(; name, available, bus, dc_bus, active_power, rating, active_power_limits, base_power, operation_cost=TwoPartCost(LinearFunctionData(0.0), 0.0), efficiency=1.0, services=Device[], dynamic_injector=nothing, ext=Dict{String, Any}(), time_series_container=InfrastructureSystems.TimeSeriesContainer(), internal=InfrastructureSystemsInternal(), ) InterconnectingConverter(name, available, bus, dc_bus, active_power, rating, active_power_limits, base_power, operation_cost, efficiency, services, dynamic_injector, ext, time_series_container, internal, ) end diff --git a/src/parsers/power_models_data.jl b/src/parsers/power_models_data.jl index f610357f6f..c15ae54c4c 100644 --- a/src/parsers/power_models_data.jl +++ b/src/parsers/power_models_data.jl @@ -322,7 +322,7 @@ end function make_hydro_gen(gen_name, d, bus, sys_mbase) ramp_agc = get(d, "ramp_agc", get(d, "ramp_10", get(d, "ramp_30", abs(d["pmax"])))) - curtailcost = TwoPartCost(0.0, 0.0) + curtailcost = TwoPartCost(LinearFunctionData(0.0), 0.0) base_conversion = sys_mbase / d["mbase"] return HydroDispatch(; # No way to define storage parameters for gens in PM so can only make HydroDispatch @@ -438,7 +438,7 @@ function make_thermal_gen(gen_name::AbstractString, d::Dict, bus::ACBus, sys_mba fixed = max(0.0, first_y - first(get_slopes(PiecewiseLinearPointData(points))) * first_x, ) - cost = PiecewiseLinearPointData((x, y - fixed) for (x, y) in points) + cost = PiecewiseLinearPointData([(x, y - fixed) for (x, y) in points]) elseif model == GeneratorCostModels.POLYNOMIAL # For now, we make the variable cost a PolynomialFunctionData with all but the # constant term and make the fixed cost the constant term; in a future update, @@ -447,7 +447,7 @@ function make_thermal_gen(gen_name::AbstractString, d::Dict, bus::ACBus, sys_mba # This transforms [3.0, 1.0, 4.0, 2.0] into [(1, 4.0), (2, 1.0), (3, 3.0)] coeffs = enumerate(reverse(d["cost"][1:(end - 1)])) cost = PolynomialFunctionData(Dict((i, c / sys_mbase^i) for (i, c) in coeffs)) - fixed = d["cost"][end] + fixed = (d["ncost"] >= 1) ? last(d["cost"]) : 0.0 end startup = d["startup"] shutdn = d["shutdown"] diff --git a/src/parsers/power_system_table_data.jl b/src/parsers/power_system_table_data.jl index e6c20b7c69..048fbe014e 100644 --- a/src/parsers/power_system_table_data.jl +++ b/src/parsers/power_system_table_data.jl @@ -855,10 +855,11 @@ function calculate_variable_cost( for i in 2:length(var_cost) var_cost[i] = (var_cost[i - 1][1] + var_cost[i][1], var_cost[i][2]) end + var_cost = PiecewiseLinearPointData([(x, y) for (y, x) in var_cost]) elseif length(var_cost) == 1 # if there is only one point, use it to determine the constant $/MW cost - var_cost = var_cost[1][1] * fuel_cost + vom + var_cost = LinearFunctionData(var_cost[1][1] * fuel_cost + vom) fixed = 0.0 end return var_cost, fixed, fuel_cost @@ -892,8 +893,9 @@ function calculate_variable_cost( (var_cost[2][1] + vom / (var_cost[2][2] - var_cost[1][2]) * var_cost[1][2]), ) var_cost = [(var_cost[i][1] - fixed, var_cost[i][2]) for i in 1:length(var_cost)] + var_cost = PiecewiseLinearPointData([(x, y) for (y, x) in var_cost]) elseif length(var_cost) == 1 - var_cost = var_cost[1][1] + var_cost = LinearFunctionData(var_cost[1][1]) fixed = 0.0 end @@ -1041,14 +1043,13 @@ function make_thermal_generator_multistart( base_power = get_base_power(thermal_gen) var_cost, fixed, fuel_cost = calculate_variable_cost(data, gen, cost_colnames, base_power) - if var_cost isa Float64 + if var_cost isa LinearFunctionData no_load_cost = 0.0 - var_cost = LinearFunctionData(var_cost) else - no_load_cost = var_cost[1][1] + (no_load_x, no_load_cost) = first(var_cost) var_cost = PiecewiseLinearPointData([ - (c - no_load_cost, pp - var_cost[1][2]) for (c, pp) in var_cost + (pp - no_load_x, c - no_load_cost) for (pp, c) in var_cost ]) end lag_hot = diff --git a/test/data_14bus_pu.jl b/test/data_14bus_pu.jl index 0f77d99396..7e64d4b4c4 100644 --- a/test/data_14bus_pu.jl +++ b/test/data_14bus_pu.jl @@ -654,7 +654,7 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = 0.0, max = 0.1), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost((430.292599, 2000.0), 0.0, 0.0, 0.0), + operation_cost = ThreePartCost(QuadraticFunctionData(430.292599, 2000.0, 0.0), 0.0, 0.0, 0.0), base_power = 100.0, ), ThermalStandard(; @@ -671,7 +671,7 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = -0.4, max = 0.5), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost((2500.0, 2000.0), 0.0, 0.0, 0.0), + operation_cost = ThreePartCost(QuadraticFunctionData(2500.0, 2000.0, 0.0), 0.0, 0.0, 0.0), base_power = 100.0, ), ThermalStandard(; @@ -688,7 +688,7 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = 0.0, max = 0.4), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost((100.0, 4000.0), 0.0, 0.0, 0.0), + operation_cost = ThreePartCost(QuadraticFunctionData(100.0, 4000.0, 0.0), 0.0, 0.0, 0.0), base_power = 100.0, ), ThermalStandard(; @@ -705,7 +705,7 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = -0.06, max = 0.24), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost((100.0, 4000.0), 0.0, 0.0, 0.0), + operation_cost = ThreePartCost(QuadraticFunctionData(100.0, 4000.0, 0.0), 0.0, 0.0, 0.0), base_power = 100.0, ), ThermalStandard(; @@ -722,7 +722,7 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = -0.06, max = 0.24), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost((100.0, 4000.0), 0.0, 0.0, 0.0), + operation_cost = ThreePartCost(QuadraticFunctionData(100.0, 4000.0, 0.0), 0.0, 0.0, 0.0), base_power = 100.0, ), ] diff --git a/test/data_5bus_pu.jl b/test/data_5bus_pu.jl index b92c1f8489..46105dcc5b 100644 --- a/test/data_5bus_pu.jl +++ b/test/data_5bus_pu.jl @@ -313,7 +313,7 @@ thermal_generators5(nodes5) = [ reactive_power_limits = (min = -0.30, max = 0.30), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost((0.0, 1400.0), 0.0, 4.0, 2.0), + operation_cost = ThreePartCost(LinearFunctionData(1400.0), 0.0, 4.0, 2.0), base_power = 100.0, ), ThermalStandard(; @@ -330,7 +330,7 @@ thermal_generators5(nodes5) = [ reactive_power_limits = (min = -1.275, max = 1.275), time_limits = (up = 0.02, down = 0.02), ramp_limits = (up = 2.0, down = 1.0), - operation_cost = ThreePartCost((0.0, 1500.0), 0.0, 1.5, 0.75), + operation_cost = ThreePartCost(LinearFunctionData(1500.0), 0.0, 1.5, 0.75), base_power = 100.0, ), ThermalStandard(; @@ -347,7 +347,7 @@ thermal_generators5(nodes5) = [ reactive_power_limits = (min = -3.90, max = 3.90), time_limits = (up = 0.012, down = 0.012), ramp_limits = (up = 3.0, down = 2.0), - operation_cost = ThreePartCost((0.0, 3000.0), 0.0, 3.0, 1.5), + operation_cost = ThreePartCost(LinearFunctionData(3000.0), 0.0, 3.0, 1.5), base_power = 100.0, ), ThermalStandard(; @@ -364,7 +364,7 @@ thermal_generators5(nodes5) = [ reactive_power_limits = (min = -1.5, max = 1.5), time_limits = (up = 0.015, down = 0.015), ramp_limits = (up = 2.0, down = 1.0), - operation_cost = ThreePartCost((0.0, 4000.0), 0.0, 4.0, 2.0), + operation_cost = ThreePartCost(LinearFunctionData(4000.0), 0.0, 4.0, 2.0), base_power = 100.0, ), ThermalStandard(; @@ -381,7 +381,7 @@ thermal_generators5(nodes5) = [ reactive_power_limits = (min = -4.50, max = 4.50), time_limits = (up = 0.015, down = 0.015), ramp_limits = (up = 5.0, down = 3.0), - operation_cost = ThreePartCost((0.0, 1000.0), 0.0, 1.5, 0.75), + operation_cost = ThreePartCost(LinearFunctionData(1000.0), 0.0, 1.5, 0.75), base_power = 100.0, ), ]; @@ -397,7 +397,7 @@ renewable_generators5(nodes5) = [ PrimeMovers.WT, (min = 0.0, max = 0.0), 1.0, - TwoPartCost(22.0, 0.0), + TwoPartCost(LinearFunctionData(22.0), 0.0), 100.0, ), RenewableDispatch( @@ -410,7 +410,7 @@ renewable_generators5(nodes5) = [ PrimeMovers.WT, (min = 0.0, max = 0.0), 1.0, - TwoPartCost(22.0, 0.0), + TwoPartCost(LinearFunctionData(22.0), 0.0), 100.0, ), RenewableDispatch( @@ -423,7 +423,7 @@ renewable_generators5(nodes5) = [ PrimeMovers.WT, (min = -0.800, max = 0.800), 1.0, - TwoPartCost(22.0, 0.0), + TwoPartCost(LinearFunctionData(22.0), 0.0), 100.0, ), ]; @@ -459,7 +459,7 @@ hydro_generators5(nodes5) = [ storage_capacity = 1.0, inflow = 0.2, initial_storage = 0.5, - operation_cost = TwoPartCost(15.0, 0.0), + operation_cost = TwoPartCost(LinearFunctionData(15.0), 0.0), ), ]; @@ -579,7 +579,7 @@ interruptible(nodes5) = [ 0.10, 0.0, 100.0, - TwoPartCost(150.0, 2400.0), + TwoPartCost(LinearFunctionData(150.0), 2400.0), ), ] @@ -598,7 +598,7 @@ ordc5() = [ true, 0.6, TwoPartCost( - [(0.0, 9000.0), (0.2, 6000.0), (0.4, 500.0), (0.6, 10.0), (0.8, 0.0)], + [(0.0, 9000.0), (0.2, 6000.0), (0.4, 500.0), (0.6, 10.0), (0.8, 0.0)], # TODO 0.0, ), ), diff --git a/test/runtests.jl b/test/runtests.jl index 02ac00a124..48f38934d4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,6 +9,7 @@ import InteractiveUtils import JSON3 import PowerSystemCaseBuilder: PSYTestSystems import InfrastructureSystems +import Random const IS = InfrastructureSystems using PowerSystems import PowerSystems: PowerSystemTableData diff --git a/test/test_dynamic_generator.jl b/test/test_dynamic_generator.jl index a65405828f..54748f0d6d 100644 --- a/test/test_dynamic_generator.jl +++ b/test/test_dynamic_generator.jl @@ -27,7 +27,7 @@ static_gen = ThermalStandard(; reactive_power_limits = (min = -0.30, max = 0.30), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost((0.0, 1400.0), 0.0, 4.0, 2.0), + operation_cost = ThreePartCost(LinearFunctionData(1400.0), 0.0, 4.0, 2.0), base_power = 1.0, ) diff --git a/test/test_function_data.jl b/test/test_function_data.jl index aa87a9c4e0..806b238f8e 100644 --- a/test/test_function_data.jl +++ b/test/test_function_data.jl @@ -73,7 +73,7 @@ end end @testset "Test FunctionData piecewise point/slope conversion" begin - rng = Xoshiro(0) # Set random seed for determinism + rng = Random.Xoshiro(0) # Set random seed for determinism n_tests = 100 n_points = 10 for _ in 1:n_tests