Skip to content

Commit

Permalink
adjust reference values for GMF test to account for improved accuracy…
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed May 15, 2024
1 parent 346f850 commit 08e5e99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/glover_mcfarlane.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))

Expand Down
5 changes: 3 additions & 2 deletions test/test_reduction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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;;]
Expand All @@ -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

Expand All @@ -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)

Expand Down

0 comments on commit 08e5e99

Please sign in to comment.