diff --git a/src/services_models/agc.jl b/src/services_models/agc.jl index 0bce62e5ce..cbabbc3f45 100644 --- a/src/services_models/agc.jl +++ b/src/services_models/agc.jl @@ -56,7 +56,7 @@ function get_default_attributes( ::Type{PSY.AGC}, ::Type{<:AbstractAGCFormulation}, ) - return Dict{String, Any}() + return Dict{String, Any}("aggregated_service_model" => false) end """ @@ -174,10 +174,10 @@ function add_constraints!( ::Type{T}, ::Type{SteadyStateFrequencyDeviation}, agcs::IS.FlattenIteratorWrapper{U}, - ::ServiceModel{PSY.AGC, V}, + model::ServiceModel{PSY.AGC, V}, sys::PSY.System, ) where {T <: SACEPIDAreaConstraint, U <: PSY.AGC, V <: PIDSmoothACE} - services = get_available_components(PSY.AGC, sys) + services = get_available_components(model, sys) time_steps = get_time_steps(container) agc_names = PSY.get_name.(services) area_names = [PSY.get_name(PSY.get_area(s)) for s in services] @@ -196,7 +196,7 @@ function add_constraints!( kp = PSY.get_K_p(service) ki = PSY.get_K_i(service) kd = PSY.get_K_d(service) - Δt = convert(Dates.Second, container.resolution).value + Δt = convert(Dates.Second, get_resolution(container)).value a = PSY.get_name(service) for t in time_steps if t == 1 diff --git a/src/services_models/services_constructor.jl b/src/services_models/services_constructor.jl index 8602cb9dd5..2d93183bbf 100644 --- a/src/services_models/services_constructor.jl +++ b/src/services_models/services_constructor.jl @@ -260,7 +260,7 @@ function construct_service!( ::Set{<:DataType}, ::NetworkModel{<:PM.AbstractPowerModel}, ) where {S <: PSY.AGC, T <: AbstractAGCFormulation} - services = get_available_components(S, sys) + services = get_available_components(model, sys) agc_areas = PSY.get_area.(services) areas = PSY.get_components(PSY.Area, sys) if !isempty(setdiff(areas, agc_areas)) @@ -315,7 +315,7 @@ function construct_service!( ::NetworkModel{<:PM.AbstractPowerModel}, ) where {S <: PSY.AGC, T <: AbstractAGCFormulation} areas = PSY.get_components(PSY.Area, sys) - services = get_available_components(S, sys) + services = get_available_components(model, sys) add_constraints!(container, AbsoluteValueConstraint, LiftVariable, services, model) add_constraints!( @@ -519,7 +519,7 @@ function construct_service!( incompatible_device_types::Set{<:DataType}, network_model::NetworkModel{<:PM.AbstractPowerModel}, ) where {T <: PSY.TransmissionInterface} - interfaces = get_available_components(T, sys) + interfaces = get_available_components(model, sys) if get_use_slacks(model) # Adding the slacks can be done in a cleaner fashion interface = PSY.get_component(T, sys, get_service_name(model)) diff --git a/test/test_services_constructor.jl b/test/test_services_constructor.jl index 347d991371..55aa97232e 100644 --- a/test/test_services_constructor.jl +++ b/test/test_services_constructor.jl @@ -422,7 +422,8 @@ end ) model = DecisionModel(template, c_sys5_uc) - @test build!(model; output_dir = mktempdir(; cleanup = true)) == PSI.BuildStatus.BUILT + @test build!(model; output_dir = mktempdir(; cleanup = true)) == + PSI.ModelBuildStatus.BUILT moi_tests(model, 432, 144, 288, 288, 288, false) template = get_thermal_dispatch_template_network(PTDFPowerModel) @@ -431,7 +432,8 @@ end ServiceModel(TransmissionInterface, ConstantMaxInterfaceFlow; use_slacks = true), ) model = DecisionModel(template, c_sys5_uc) - @test build!(model; output_dir = mktempdir(; cleanup = true)) == PSI.BuildStatus.BUILT + @test build!(model; output_dir = mktempdir(; cleanup = true)) == + PSI.ModelBuildStatus.BUILT moi_tests(model, 312, 0, 288, 288, 168, false) #= TODO: Fix this test