From cac43e02db01531239145faab6f22e0796a67527 Mon Sep 17 00:00:00 2001 From: GabrielKS <23368820+GabrielKS@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:24:59 -0700 Subject: [PATCH] Accommodate VariableCost to FunctionData refactor --- src/library/psi_library.jl | 125 ++++++++++++++++++++++----------- src/library/psitest_library.jl | 98 +++++++++++++++++--------- test/test_psisystems.jl | 4 +- 3 files changed, 151 insertions(+), 76 deletions(-) diff --git a/src/library/psi_library.jl b/src/library/psi_library.jl index 4ddbdca..fbf03f0 100644 --- a/src/library/psi_library.jl +++ b/src/library/psi_library.jl @@ -19,7 +19,7 @@ function build_c_sys5_pjm(; kwargs...) PrimeMovers.PVe, (min = 0.0, max = 0.0), 1.0, - TwoPartCost(0.0, 0.0), + TwoPartCost(LinearFunctionData(0.0), 0.0), 100.0, ) wind_device = PSY.RenewableDispatch( @@ -32,7 +32,7 @@ function build_c_sys5_pjm(; kwargs...) PrimeMovers.WT, (min = 0.0, max = 0.0), 1.0, - TwoPartCost(0.0, 0.0), + TwoPartCost(LinearFunctionData(0.0), 0.0), 100.0, ) PSY.add_component!(c_sys5, pv_device) @@ -135,7 +135,7 @@ function build_c_sys5_pjm_rt(; kwargs...) PrimeMovers.PVe, (min = 0.0, max = 0.0), 1.0, - TwoPartCost(0.0, 0.0), + TwoPartCost(LinearFunctionData(0.0), 0.0), 100.0, ) wind_device = PSY.RenewableDispatch( @@ -148,7 +148,7 @@ function build_c_sys5_pjm_rt(; kwargs...) PrimeMovers.WT, (min = 0.0, max = 0.0), 1.0, - TwoPartCost(0.0, 0.0), + TwoPartCost(LinearFunctionData(0.0), 0.0), 100.0, ) PSY.add_component!(c_sys5, pv_device) @@ -291,7 +291,7 @@ function build_5_bus_hydro_uc_sys_targets(; kwargs...) c_sys5_hy_uc = PSY.System(rawsys; sys_kwargs...) end cost = PSY.StorageManagementCost(; - variable = VariableCost(0.15), + variable = LinearFunctionData(0.15), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -350,7 +350,7 @@ function build_5_bus_hydro_ed_sys_targets(; kwargs...) sys_kwargs..., ) cost = PSY.StorageManagementCost(; - variable = VariableCost(0.15), + variable = LinearFunctionData(0.15), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -411,7 +411,7 @@ function build_5_bus_hydro_wk_sys_targets(; kwargs...) sys_kwargs..., ) cost = PSY.StorageManagementCost(; - variable = VariableCost(0.15), + variable = LinearFunctionData(0.15), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -861,7 +861,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -0.30, max = 0.30), ramp_limits = nothing, time_limits = nothing, - operation_cost = ThreePartCost((0.0, 14.0), 0.0, 4.0, 2.0), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 14.0, 0.0), + 0.0, + 4.0, + 2.0, + ), base_power = 100.0, ), ThermalStandard(; @@ -878,7 +883,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -1.275, max = 1.275), ramp_limits = (up = 0.02 * 2.2125, down = 0.02 * 2.2125), time_limits = (up = 2.0, down = 1.0), - operation_cost = ThreePartCost((0.0, 15.0), 0.0, 1.5, 0.75), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 15.0, 0.0), + 0.0, + 1.5, + 0.75, + ), base_power = 100.0, ), ThermalStandard(; @@ -895,7 +905,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -3.90, max = 3.90), ramp_limits = (up = 0.012 * 5.2, down = 0.012 * 5.2), time_limits = (up = 3.0, down = 2.0), - operation_cost = ThreePartCost((0.0, 30.0), 0.0, 3.0, 1.5), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 30.0, 0.0), + 0.0, + 3.0, + 1.5, + ), base_power = 100.0, ), ThermalStandard(; @@ -912,7 +927,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -1.5, max = 1.5), ramp_limits = (up = 0.015 * 2.5, down = 0.015 * 2.5), time_limits = (up = 2.0, down = 1.0), - operation_cost = ThreePartCost((0.0, 40.0), 0.0, 4.0, 2.0), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 40.0, 0.0), + 0.0, + 4.0, + 2.0, + ), base_power = 100.0, ), ThermalStandard(; @@ -929,7 +949,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -4.50, max = 4.50), ramp_limits = (up = 0.015 * 7.5, down = 0.015 * 7.5), time_limits = (up = 5.0, down = 3.0), - operation_cost = ThreePartCost((0.0, 10.0), 0.0, 1.5, 0.75), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 10.0, 0.0), + 0.0, + 1.5, + 0.75, + ), base_power = 100.0, ), ThermalStandard(; @@ -946,7 +971,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -0.30, max = 0.30), ramp_limits = nothing, time_limits = nothing, - operation_cost = ThreePartCost((0.0, 14.0), 0.0, 4.0, 2.0), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 14.0, 0.0), + 0.0, + 4.0, + 2.0, + ), base_power = 100.0, ), ThermalStandard(; @@ -963,7 +993,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -1.275, max = 1.275), ramp_limits = (up = 0.02 * 2.2125, down = 0.02 * 2.2125), time_limits = (up = 2.0, down = 1.0), - operation_cost = ThreePartCost((0.0, 15.0), 0.0, 1.5, 0.75), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 15.0, 0.0), + 0.0, + 1.5, + 0.75, + ), base_power = 100.0, ), ThermalStandard(; @@ -980,7 +1015,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -3.90, max = 3.90), ramp_limits = (up = 0.012 * 5.2, down = 0.012 * 5.2), time_limits = (up = 3.0, down = 2.0), - operation_cost = ThreePartCost((0.0, 30.0), 0.0, 3.0, 1.5), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 30.0, 0.0), + 0.0, + 3.0, + 1.5, + ), base_power = 100.0, ), ThermalStandard(; @@ -997,7 +1037,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -1.5, max = 1.5), ramp_limits = (up = 0.015 * 2.5, down = 0.015 * 2.5), time_limits = (up = 2.0, down = 1.0), - operation_cost = ThreePartCost((0.0, 40.0), 0.0, 4.0, 2.0), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 40.0, 0.0), + 0.0, + 4.0, + 2.0, + ), base_power = 100.0, ), ThermalStandard(; @@ -1014,7 +1059,12 @@ function build_two_zone_5_bus(; kwargs...) reactive_power_limits = (min = -4.50, max = 4.50), ramp_limits = (up = 0.015 * 7.5, down = 0.015 * 7.5), time_limits = (up = 5.0, down = 3.0), - operation_cost = ThreePartCost((0.0, 10.0), 0.0, 1.5, 0.75), + operation_cost = ThreePartCost( + QuadraticFunctionData(0.0, 10.0, 0.0), + 0.0, + 1.5, + 0.75, + ), base_power = 100.0, ), ] @@ -1195,11 +1245,11 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line name_ = PSY.get_name(b) main_comp = PSY.get_component(component_type, main_sys, name_) + IS.assign_new_uuid!(twin_sys.data, b) PSY.remove_component!(twin_sys, b) # change name PSY.set_name!(b, name_ * "_twin") # define time series container - IS.assign_new_uuid!(b) # add component to the new sys (main) PSY.add_component!(main_sys, b) # check if it has timeseries @@ -1214,6 +1264,7 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line name_ = PSY.get_name(b) main_comp = PSY.get_component(PSY.ACBus, main_sys, name_) + IS.assign_new_uuid!(twin_sys.data, b) PSY.remove_component!(twin_sys, b) # change name PSY.set_name!(b, name_ * "_twin") @@ -1229,16 +1280,16 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line # change number PSY.set_number!(b, PSY.get_number(b) + 10000) # add component to the new sys (main) - IS.assign_new_uuid!(b) PSY.add_component!(main_sys, b) end - # now add the Lines + # now add the ACBranches from_to_list = [] - for b in PSY.get_components(PSY.Line, twin_sys) + for b in PSY.get_components(PSY.ACBranch, twin_sys) name_ = PSY.get_name(b) - main_comp = PSY.get_component(PSY.Line, main_sys, name_) + main_comp = PSY.get_component(typeof(b), main_sys, name_) + IS.assign_new_uuid!(twin_sys.data, b) PSY.remove_component!(twin_sys, b) b.time_series_container = IS.TimeSeriesContainer() # change name @@ -1264,7 +1315,6 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line end PSY.set_arc!(b, new_arc) # add component to the new sys (main) - IS.assign_new_uuid!(b) PSY.add_component!(main_sys, b) end @@ -1273,11 +1323,11 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line name_ = PSY.get_name(srvc) main_comp = PSY.get_component(PSY.Service, main_sys, name_) + IS.assign_new_uuid!(twin_sys.data, srvc) PSY.remove_component!(twin_sys, srvc) # change name PSY.set_name!(srvc, name_ * "_twin") # define time series container - IS.assign_new_uuid!(srvc) # add component to the new sys (main) PSY.add_component!(main_sys, srvc) # check if it has timeseries @@ -1286,28 +1336,21 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line end end - # finally add the remaining devices (lines are not present since removed before) + # finally add the remaining devices (ACBranches are not present since removed before) for b in PSY.get_components(Device, twin_sys) name_ = PSY.get_name(b) main_comp = PSY.get_component(typeof(b), main_sys, name_) PSY.clear_services!(b) + IS.assign_new_uuid!(twin_sys.data, b) PSY.remove_component!(twin_sys, b) # change name PSY.set_name!(b, name_ * "_twin") # change bus (already changed) # check if it has services @assert !PSY.has_service(b, PSY.VariableReserve) - #check if component has time_series - if !PSY.has_time_series(b) - # define time series container - IS.assign_new_uuid!(b) - # add component to the new sys (main) - PSY.add_component!(main_sys, b) - PSY.copy_time_series!(b, main_comp) - else - IS.assign_new_uuid!(b) - PSY.add_component!(main_sys, b) - end + PSY.add_component!(main_sys, b) + PSY.has_time_series(b) && PSY.copy_time_series!(b, main_comp) + # add service to the device to be added to main_sys if length(PSY.get_services(main_comp)) > 0 PSY.get_name(b) @@ -1416,13 +1459,13 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line main_sys, ) noise_values = rand(MersenneTwister(COST_PERTURBATION_NOISE_SEED), 1_000_000) - old_pwl_array = get_variable(get_operation_cost(g)) |> get_cost + old_pwl_array = get_variable(get_operation_cost(g)) |> get_points new_pwl_array = similar(old_pwl_array) - for (ix, (y, x)) in enumerate(old_pwl_array) + for (ix, (x, y)) in enumerate(old_pwl_array) if ix ∈ [1, length(old_pwl_array)] noise_val, rand_ix = iterate(noise_values, rand_ix) cost_noise = 50.0 * noise_val - new_pwl_array[ix] = ((y + cost_noise), x) + new_pwl_array[ix] = (x, (y + cost_noise)) else try_again = true while try_again @@ -1436,7 +1479,7 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line slope_next = (-(y + cost_noise) + old_pwl_array[ix + 1][1]) / (-(x - power_noise) + old_pwl_array[ix + 1][2]) - new_pwl_array[ix] = ((y + cost_noise), (x - power_noise)) + new_pwl_array[ix] = ((x - power_noise), (y + cost_noise)) try_again = slope_previous > slope_next if rand_ix == length(noise_values) break @@ -1444,7 +1487,7 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line end end end - get_variable(get_operation_cost(g)).cost = new_pwl_array + set_variable!(get_operation_cost(g), PiecewiseLinearPointData(new_pwl_array)) end # set service participation diff --git a/src/library/psitest_library.jl b/src/library/psitest_library.jl index 70c7bdc..3a389de 100644 --- a/src/library/psitest_library.jl +++ b/src/library/psitest_library.jl @@ -994,7 +994,12 @@ function build_sys_ramp_testing(; kwargs...) reactive_power_limits = nothing, ramp_limits = nothing, time_limits = nothing, - operation_cost = PSY.ThreePartCost((0.0, 14.0), 0.0, 4.0, 2.0), + operation_cost = PSY.ThreePartCost( + QuadraticFunctionData(0.0, 14.0, 0.0), + 0.0, + 4.0, + 2.0, + ), base_power = 100.0, ), PSY.ThermalStandard(; @@ -1011,7 +1016,12 @@ function build_sys_ramp_testing(; kwargs...) reactive_power_limits = nothing, ramp_limits = (up = 0.010625 * 2.0, down = 0.010625 * 2.0), time_limits = nothing, - operation_cost = PSY.ThreePartCost((0.0, 15.0), 0.0, 1.5, 0.75), + operation_cost = PSY.ThreePartCost( + QuadraticFunctionData(0.0, 15.0, 0.0), + 0.0, + 1.5, + 0.75, + ), base_power = 100.0, ), ] @@ -2294,7 +2304,8 @@ function build_sos_test_sys(; kwargs...) time_limits = nothing, ramp_limits = nothing, operation_cost = PSY.ThreePartCost( - [(1122.43, 22.0), (1617.43, 33.0), (1742.48, 44.0), (2075.88, 55.0)], + PiecewiseLinearPointData( + [(22.0, 1122.43), (33.0, 1617.43), (44.0, 1742.48), (55.0, 2075.88)]), 0.0, 5665.23, 0.0, @@ -2316,7 +2327,13 @@ function build_sos_test_sys(; kwargs...) time_limits = nothing, ramp_limits = nothing, operation_cost = PSY.ThreePartCost( - [(1500.19, 62.0), (2132.59, 92.9), (2829.875, 124.0), (2831.444, 155.0)], + PiecewiseLinearPointData( + [ + (62.0, 1500.19), + (92.9, 2132.59), + (124.0, 2829.875), + (155.0, 2831.444), + ]), 0.0, 5665.23, 0.0, @@ -2336,16 +2353,11 @@ function build_sos_test_sys(; kwargs...) return flag end - function pwlparamcheck(cost_) - slopes = PSY.get_slopes(cost_) - # First element of the return is the average cost at P_min. - # Shouldn't be passed for convexity check - return slope_convexity_check(slopes[2:end]) - end + pwlparamcheck(cost_) = slope_convexity_check(PSY.get_slopes(cost_)) #Checks the data remains non-convex for g in gens_cost_sos - @assert pwlparamcheck(PSY.get_operation_cost(g).variable) == false + @assert !is_convex(PSY.get_variable(PSY.get_operation_cost(g))) end DA_load_forecast = SortedDict{Dates.DateTime, TimeSeries.TimeArray}() @@ -2387,7 +2399,12 @@ function build_pwl_test_sys(; kwargs...) time_limits = nothing, ramp_limits = nothing, operation_cost = PSY.ThreePartCost( - [(589.99, 22.0), (884.99, 33.0), (1210.04, 44.0), (1543.44, 55.0)], + PiecewiseLinearPointData([ + (22.0, 589.99), + (33.0, 884.99), + (44.0, 1210.04), + (55.0, 1543.44), + ]), 532.44, 5665.23, 0.0, @@ -2409,7 +2426,12 @@ function build_pwl_test_sys(; kwargs...) time_limits = nothing, ramp_limits = nothing, operation_cost = PSY.ThreePartCost( - [(1264.80, 62.0), (1897.20, 93.0), (2594.4787, 124.0), (3433.04, 155.0)], + PiecewiseLinearPointData([ + (62.0, 1264.80), + (93.0, 1897.20), + (124.0, 2594.4787), + (155.0, 3433.04), + ]), 235.397, 5665.23, 0.0, @@ -2461,7 +2483,12 @@ function build_duration_test_sys(; kwargs...) reactive_power_limits = nothing, ramp_limits = nothing, time_limits = (up = 4, down = 2), - operation_cost = PSY.ThreePartCost((0.0, 14.0), 0.0, 4.0, 2.0), + operation_cost = PSY.ThreePartCost( + QuadraticFunctionData(0.0, 14.0, 0.0), + 0.0, + 4.0, + 2.0, + ), base_power = 100.0, time_at_status = 2.0, ), @@ -2479,7 +2506,12 @@ function build_duration_test_sys(; kwargs...) reactive_power_limits = nothing, ramp_limits = nothing, time_limits = (up = 6, down = 4), - operation_cost = PSY.ThreePartCost((0.0, 15.0), 0.0, 1.5, 0.75), + operation_cost = PSY.ThreePartCost( + QuadraticFunctionData(0.0, 15.0, 0.0), + 0.0, + 1.5, + 0.75, + ), base_power = 100.0, time_at_status = 3.0, ), @@ -2893,7 +2925,7 @@ function build_c_sys5_hybrid(; kwargs...) base_power = 100.0, storage_target = 0.2, operation_cost = PSY.StorageManagementCost(; - variable = PSY.VariableCost(0.0), + variable = PSY.LinearFunctionData(0.0), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3075,7 +3107,7 @@ function build_c_sys5_hybrid_uc(; kwargs...) base_power = 100.0, storage_target = 0.2, operation_cost = PSY.StorageManagementCost(; - variable = PSY.VariableCost(0.0), + variable = PSY.LinearFunctionData(0.0), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3202,7 +3234,7 @@ function build_c_sys5_hybrid_ed(; kwargs...) base_power = 100.0, storage_target = 0.2, operation_cost = PSY.StorageManagementCost(; - variable = PSY.VariableCost(0.0), + variable = PSY.LinearFunctionData(0.0), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3346,7 +3378,7 @@ function build_hydro_test_case_b_sys(; kwargs...) ramp_limits = (up = 7.0, down = 7.0), time_limits = nothing, operation_cost = PSY.StorageManagementCost(; - variable = VariableCost(0.15), + variable = LinearFunctionData(0.15), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3408,7 +3440,7 @@ function build_hydro_test_case_c_sys(; kwargs...) ramp_limits = (up = 7.0, down = 7.0), time_limits = nothing, operation_cost = PSY.StorageManagementCost(; - variable = VariableCost(0.15), + variable = LinearFunctionData(0.15), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3470,7 +3502,7 @@ function build_hydro_test_case_d_sys(; kwargs...) ramp_limits = (up = 7.0, down = 7.0), time_limits = nothing, operation_cost = PSY.StorageManagementCost(; - variable = VariableCost(0.15), + variable = LinearFunctionData(0.15), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3532,7 +3564,7 @@ function build_hydro_test_case_e_sys(; kwargs...) ramp_limits = (up = 7.0, down = 7.0), time_limits = nothing, operation_cost = PSY.StorageManagementCost(; - variable = VariableCost(0.15), + variable = LinearFunctionData(0.15), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3594,7 +3626,7 @@ function build_hydro_test_case_f_sys(; kwargs...) ramp_limits = (up = 7.0, down = 7.0), time_limits = nothing, operation_cost = PSY.StorageManagementCost(; - variable = VariableCost(0.15), + variable = LinearFunctionData(0.15), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3653,7 +3685,7 @@ function build_batt_test_case_b_sys(; kwargs...) PrimeMovers.WT, (min = -0.800, max = 0.800), 1.0, - TwoPartCost(0.220, 0.0), + TwoPartCost(LinearFunctionData(0.220), 0.0), 100.0, ) @@ -3674,7 +3706,7 @@ function build_batt_test_case_b_sys(; kwargs...) base_power = 100.0, storage_target = 0.2, operation_cost = PSY.StorageManagementCost(; - variable = PSY.VariableCost(0.0), + variable = PSY.LinearFunctionData(0.0), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3728,7 +3760,7 @@ function build_batt_test_case_c_sys(; kwargs...) PrimeMovers.WT, (min = -0.800, max = 0.800), 1.0, - TwoPartCost(0.220, 0.0), + TwoPartCost(LinearFunctionData(0.220), 0.0), 100.0, ) @@ -3749,7 +3781,7 @@ function build_batt_test_case_c_sys(; kwargs...) base_power = 100.0, storage_target = 0.2, operation_cost = PSY.StorageManagementCost(; - variable = PSY.VariableCost(0.0), + variable = PSY.LinearFunctionData(0.0), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3803,7 +3835,7 @@ function build_batt_test_case_d_sys(; kwargs...) PrimeMovers.WT, (min = -0.800, max = 0.800), 1.0, - TwoPartCost(0.220, 0.0), + TwoPartCost(LinearFunctionData(0.220), 0.0), 100.0, ) @@ -3824,7 +3856,7 @@ function build_batt_test_case_d_sys(; kwargs...) base_power = 100.0, storage_target = 0.2, operation_cost = PSY.StorageManagementCost(; - variable = PSY.VariableCost(0.0), + variable = PSY.LinearFunctionData(0.0), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3878,7 +3910,7 @@ function build_batt_test_case_e_sys(; kwargs...) PrimeMovers.WT, (min = -0.800, max = 0.800), 1.0, - TwoPartCost(0.220, 0.0), + TwoPartCost(LinearFunctionData(0.220), 0.0), 100.0, ) @@ -3899,7 +3931,7 @@ function build_batt_test_case_e_sys(; kwargs...) base_power = 100.0, storage_target = 0.2, operation_cost = PSY.StorageManagementCost(; - variable = PSY.VariableCost(0.0), + variable = PSY.LinearFunctionData(0.0), fixed = 0.0, start_up = 0.0, shut_down = 0.0, @@ -3953,7 +3985,7 @@ function build_batt_test_case_f_sys(; kwargs...) PrimeMovers.WT, (min = -0.800, max = 0.800), 1.0, - TwoPartCost(0.220, 0.0), + TwoPartCost(LinearFunctionData(0.220), 0.0), 100.0, ) @@ -3974,7 +4006,7 @@ function build_batt_test_case_f_sys(; kwargs...) base_power = 100.0, storage_target = 0.2, operation_cost = PSY.StorageManagementCost(; - variable = PSY.VariableCost(0.0), + variable = PSY.LinearFunctionData(0.0), fixed = 0.0, start_up = 0.0, shut_down = 0.0, diff --git a/test/test_psisystems.jl b/test/test_psisystems.jl index b5350af..854196b 100644 --- a/test/test_psisystems.jl +++ b/test/test_psisystems.jl @@ -34,7 +34,7 @@ end sys_twin_rts_HA = build_system(PSISystems, "AC_TWO_RTO_RTS_5min_sys") for g in get_components(ThermalStandard, sys_twin_rts_DA) component_RT = get_component(ThermalStandard, sys_twin_rts_HA, get_name(g)) - @test get_variable(get_operation_cost(g)).cost == - get_variable(get_operation_cost(component_RT)).cost + @test get_variable(get_operation_cost(g)) == + get_variable(get_operation_cost(component_RT)) end end