From ccdd185de959072685f9e33a45d65cb4c01e1d88 Mon Sep 17 00:00:00 2001 From: GabrielKS <23368820+GabrielKS@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:32:03 -0700 Subject: [PATCH] Run formatter, accept suggestions --- src/PowerSystems.jl | 5 +++- src/models/function_data.jl | 2 -- src/parsers/power_system_table_data.jl | 2 +- test/data_14bus_pu.jl | 35 ++++++++++++++++++++++---- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/PowerSystems.jl b/src/PowerSystems.jl index 9c79c2fb1d..31dffdb5da 100644 --- a/src/PowerSystems.jl +++ b/src/PowerSystems.jl @@ -45,7 +45,10 @@ export QuadraticFunctionData export PolynomialFunctionData export PiecewiseLinearPointData export PiecewiseLinearSlopeData -export get_proportional_term, get_quadratic_term, get_constant_term, get_coefficients +export get_proportional_term +export get_quadratic_term +export get_constant_term +export get_coefficients export get_slopes export get_x_lengths export is_convex diff --git a/src/models/function_data.jl b/src/models/function_data.jl index fae33a380d..ec24f34996 100644 --- a/src/models/function_data.jl +++ b/src/models/function_data.jl @@ -56,8 +56,6 @@ function _validate_piecewise_x(x_coords) # (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")) end """ diff --git a/src/parsers/power_system_table_data.jl b/src/parsers/power_system_table_data.jl index 048fbe014e..10bd9c94f1 100644 --- a/src/parsers/power_system_table_data.jl +++ b/src/parsers/power_system_table_data.jl @@ -855,7 +855,7 @@ 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]) + 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 diff --git a/test/data_14bus_pu.jl b/test/data_14bus_pu.jl index 7e64d4b4c4..738d4979bd 100644 --- a/test/data_14bus_pu.jl +++ b/test/data_14bus_pu.jl @@ -654,7 +654,12 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = 0.0, max = 0.1), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost(QuadraticFunctionData(430.292599, 2000.0, 0.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 +676,12 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = -0.4, max = 0.5), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost(QuadraticFunctionData(2500.0, 2000.0, 0.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 +698,12 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = 0.0, max = 0.4), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost(QuadraticFunctionData(100.0, 4000.0, 0.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 +720,12 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = -0.06, max = 0.24), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost(QuadraticFunctionData(100.0, 4000.0, 0.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 +742,12 @@ thermal_generators14(nodes14) = [ reactive_power_limits = (min = -0.06, max = 0.24), time_limits = nothing, ramp_limits = nothing, - operation_cost = ThreePartCost(QuadraticFunctionData(100.0, 4000.0, 0.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, ), ]