diff --git a/src/glover_mcfarlane.jl b/src/glover_mcfarlane.jl index 002a088..c08bb3d 100644 --- a/src/glover_mcfarlane.jl +++ b/src/glover_mcfarlane.jl @@ -133,7 +133,7 @@ Anti-windup can be added to $W_1$ but putting $W_1$ on Hanus form after the synt ``` Keywords: `nfcsyn`, `coprimeunc` """ -function glover_mcfarlane(G::AbstractStateSpace{Continuous}, γ = 1.1; W1=1, W2=1) +function glover_mcfarlane(G::AbstractStateSpace{Continuous}, γ = 1.1; W1=1, W2=1, kwargs...) γ > 1 || throw(ArgumentError("γ must be greater than 1")) Gs = W2*G*W1 A,B,C,D = ssdata(Gs) @@ -144,8 +144,8 @@ function glover_mcfarlane(G::AbstractStateSpace{Continuous}, γ = 1.1; W1=1, W2= # arec(A, B, R, Q, S) solves A'X + XA - (XB+S)R^(-1)(B'X+S') + Q = 0 Ā = A - B*(S\D'C) - Z,_ = MatrixEquations.arec(Ā', C', R, B*(Sl\B')) - X,_ = MatrixEquations.arec(Ā, B, S, C'*(R\C)) + Z,_ = MatrixEquations.arec(Ā', C', R, B*(Sl\B'); kwargs...) + X,_ = MatrixEquations.arec(Ā, B, S, C'*(R\C); kwargs...) γmin = sqrt(1 + ρ(X*Z)) diff --git a/test/test_reduction.jl b/test/test_reduction.jl index 1ce4a64..7d465af 100644 --- a/test/test_reduction.jl +++ b/test/test_reduction.jl @@ -277,6 +277,7 @@ controller_reduction_plot(P,K) ## Coprime controller reduction tests +using RobustAndOptimalControl, ControlSystemsBase, Test P = let tempA = [-2446.48418 -300000.0 0.0; 0.0 0.0 1.0; -40.0 0.0 0.0] tempB = [100000.0; 0.0; 0.0;;] @@ -286,7 +287,7 @@ P = let end W1 = 3.350*tf([1, 20.890],[1, 0]) K,γ,info = glover_mcfarlane(P, 1.01; W1) -@test γ ≈ 5.155923885290242 rtol=1e-4 +@test γ ≈ 5.157288328386042 rtol=1e-4 e,_ = ncfmargin(info.Gs,info.Ks) @test e ≈ 0.19389475760949448 rtol=1e-4 @@ -295,7 +296,7 @@ n = findlast(RobustAndOptimalControl.error_bound(hs) .> e/2) @test n == 3 Ksr, hs, infor = baltrunc_coprime(info.Ks; n) -@test ncfmargin(info.Gs, Ksr)[1] ≈ 0.193205415557165 rtol=1e-4 +@test ncfmargin(info.Gs, Ksr)[1] ≈ 0.19322670090116284 rtol=1e-4 controller_reduction_plot(info.Gs,info.Ks) controller_reduction_plot(info.Gs,info.Ks, method=:cr)