diff --git a/lib/ControlSystemsBase/src/types/LFTSystem.jl b/lib/ControlSystemsBase/src/types/LFTSystem.jl index 7c3a737f8..1975261f3 100644 --- a/lib/ControlSystemsBase/src/types/LFTSystem.jl +++ b/lib/ControlSystemsBase/src/types/LFTSystem.jl @@ -114,15 +114,15 @@ end function append(systems::LFTT...) where LFTT <: LFTSystem timeevol = common_timeevol(systems...) - A = blockdiag(s.A for s in systems) - B1 = blockdiag(s.B1 for s in systems) - B2 = blockdiag(s.B2 for s in systems) - C1 = blockdiag(s.C1 for s in systems) - C2 = blockdiag(s.C2 for s in systems) - D11 = blockdiag(s.D11 for s in systems) - D12 = blockdiag(s.D12 for s in systems) - D21 = blockdiag(s.D21 for s in systems) - D22 = blockdiag(s.D22 for s in systems) + A = blockdiag(s.P.A for s in systems) + B1 = blockdiag(s.P.B1 for s in systems) + B2 = blockdiag(s.P.B2 for s in systems) + C1 = blockdiag(s.P.C1 for s in systems) + C2 = blockdiag(s.P.C2 for s in systems) + D11 = blockdiag(s.P.D11 for s in systems) + D12 = blockdiag(s.P.D12 for s in systems) + D21 = blockdiag(s.P.D21 for s in systems) + D22 = blockdiag(s.P.D22 for s in systems) LFTT( PartitionedStateSpace(A,B1,B2,C1,C2,D11,D12,D21,D22,timeevol), reduce(vcat, [feedback_channel(s) for s in systems]) diff --git a/lib/ControlSystemsBase/test/test_delayed_systems.jl b/lib/ControlSystemsBase/test/test_delayed_systems.jl index 6828e95fb..b8038d47a 100644 --- a/lib/ControlSystemsBase/test/test_delayed_systems.jl +++ b/lib/ControlSystemsBase/test/test_delayed_systems.jl @@ -56,6 +56,22 @@ P2_fr = (im*ω .+ 1) ./ (im*ω .+ 2) @test freqresp(P2 * delay(1), ω)[:] ≈ P2_fr .* exp.(-im*ω) rtol=1e-15 @test freqresp(delay(1) * P2, ω)[:] ≈ P2_fr .* exp.(-im*ω) rtol=1e-15 +## append +P12 = append(P1, P2) +G12 = [P1 tf(0); tf(0) P2] + +F = freqresp(P12, ω) + +@test freqrespv(P1, ω) ≈ F[1,1,:] +@test freqrespv(P2, ω) ≈ F[2,2,:] +@test all(iszero, F[1,2,:]) +@test all(iszero, F[2,1,:]) + +F = freqresp(G12, ω) +@test freqrespv(P1, ω) ≈ F[1,1,:] +@test freqrespv(P2, ω) ≈ F[2,2,:] +@test all(iszero, F[1,2,:]) +@test all(iszero, F[2,1,:]) # Equality @test P1 == deepcopy(P1) diff --git a/lib/ControlSystemsBase/test/test_hammerstein_wiener.jl b/lib/ControlSystemsBase/test/test_hammerstein_wiener.jl index fdacefa3e..035e74056 100644 --- a/lib/ControlSystemsBase/test/test_hammerstein_wiener.jl +++ b/lib/ControlSystemsBase/test/test_hammerstein_wiener.jl @@ -1,6 +1,7 @@ using ControlSystemsBase using ControlSystemsBase: HammersteinWienerSystem using SparseArrays +using Test # @testset "test_nonlinearity_system" begin