diff --git a/Project.toml b/Project.toml index 1d1b4455bf..3956e7510d 100644 --- a/Project.toml +++ b/Project.toml @@ -47,7 +47,7 @@ Logging = "1" MathOptInterface = "1" PowerModels = "^0.20" PowerNetworkMatrices = "^0.10" -PowerSystems = "^3" +PowerSystems = "^3.3" PrettyTables = "2" ProgressMeter = "^1.5" SHA = "0.7" diff --git a/src/devices_models/devices/thermal_generation.jl b/src/devices_models/devices/thermal_generation.jl index 79ace79bed..8dc84dcfc6 100644 --- a/src/devices_models/devices/thermal_generation.jl +++ b/src/devices_models/devices/thermal_generation.jl @@ -116,10 +116,10 @@ function no_load_cost(cost::Union{PSY.ThreePartCost, PSY.TwoPartCost}, S::OnVari end no_load_cost(cost::PSY.VariableCost{Vector{NTuple{2, Float64}}}, ::OnVariable, ::PSY.ThermalGen, ::AbstractThermalFormulation) = first(PSY.get_cost(cost))[1] -no_load_cost(cost::PSY.VariableCost{Float64}, ::OnVariable, d::PSY.ThermalGen, ::AbstractThermalFormulation) = PSY.get_cost(cost) * PSY.get_active_power_limits(d).min * PSY.get_base_power(d) +no_load_cost(cost::PSY.VariableCost{Float64}, ::OnVariable, d::PSY.ThermalGen, ::AbstractThermalFormulation) = PSY.get_cost(cost) * PSY.get_active_power_limits(d).min * PSY.get_system_base_power(d) function no_load_cost(cost::PSY.VariableCost{Tuple{Float64, Float64}}, ::OnVariable, d::PSY.ThermalGen, ::AbstractThermalFormulation) - return (PSY.get_cost(cost)[1] * (PSY.get_active_power_limits(d).min)^2 + PSY.get_cost(cost)[2] * PSY.get_active_power_limits(d).min)* PSY.get_base_power(d) + return (PSY.get_cost(cost)[1] * (PSY.get_active_power_limits(d).min)^2 + PSY.get_cost(cost)[2] * PSY.get_active_power_limits(d).min)* PSY.get_system_base_power(d) end #! format: on diff --git a/test/test_device_thermal_generation_constructors.jl b/test/test_device_thermal_generation_constructors.jl index 4f9f1f931d..75b1b1d3ea 100644 --- a/test/test_device_thermal_generation_constructors.jl +++ b/test/test_device_thermal_generation_constructors.jl @@ -816,3 +816,30 @@ end on_sundance = on[!, "Sundance"] @test all(isapprox.(on_sundance, 1.0)) end + +# NOTE not a comprehensive test, should expand as part of the cost refactor +@testset "Test no_load_cost" begin + sys = build_system(PSITestSystems, "c_sys5_uc") + comp = get_component(ThermalStandard, sys, "Sundance") + sys_base_power = get_base_power(sys) + set_base_power!(comp, 123.4) + min_limit = PSY.get_active_power_limits(comp).min + @test isapprox( + PSI.no_load_cost( + VariableCost(5.0), + OnVariable(), + comp, + ThermalBasicUnitCommitment(), + ), + 5.0 * min_limit * sys_base_power, + ) + @test isapprox( + PSI.no_load_cost( + VariableCost((3.0, 5.0)), + OnVariable(), + comp, + ThermalBasicUnitCommitment(), + ), + (3.0 * min_limit^2 + 5.0 * min_limit) * sys_base_power, + ) +end