Skip to content

Commit cd58809

Browse files
committed
rearrange tests
1 parent 3c0948a commit cd58809

3 files changed

Lines changed: 41 additions & 38 deletions

File tree

test/test_extendedstatespace.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using RobustAndOptimalControl
22
using ControlSystems
3+
using ControlSystems: balance_statespace
34

45
G = ssrand(3,4,5)
56

test/test_high_precision_hinf.jl

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
1-
using GenericLinearAlgebra
1+
using GenericLinearAlgebra, RobustAndOptimalControl, ControlSystems
22

3-
## Test higher prec hinfsyn
4-
# Example from "A robust numerical method for the γ-iteration in H∞ control"
5-
a = b = d = n = e2 = 1.0
6-
e1 = 0
7-
A = -1.0I(2)
8-
B1 = [e1 0; 0 e2]
9-
B2 = ones(2)
10-
C1 = diagm([a, b])
11-
C2 = [d n]
12-
D11 = diagm([0.5, 0.5])
13-
D12 = [0; 1]
14-
D21 = [0 1]
15-
D22 = [0;;]
16-
P = ss(A,B1,B2,C1,C2,D11,D12,D21,D22)
17-
K, γ = hinfsynthesize(P, γrel=1.01, ftype=BigFloat)[1:2] #
18-
@test_broken hinfnorm2(lft(P, K)) 0.806 atol=1e-2
19-
@test_broken γ 0.806 atol=1e-2 # Not numerically robust enough to pass this test despite highprec
3+
@testset "Numerical difficulties 1" begin
4+
## Test higher prec hinfsyn
5+
# Example from "A robust numerical method for the γ-iteration in H∞ control"
6+
a = b = d = n = e2 = 1.0
7+
e1 = 0
8+
A = -1.0I(2)
9+
B1 = [e1 0; 0 e2]
10+
B2 = ones(2)
11+
C1 = diagm([a, b])
12+
C2 = [d n]
13+
D11 = diagm([0.5, 0.5])
14+
D12 = [0; 1]
15+
D21 = [0 1]
16+
D22 = [0;;]
17+
P = ss(A,B1,B2,C1,C2,D11,D12,D21,D22)
18+
K, γ = hinfsynthesize(P, γrel=1.01, ftype=BigFloat)[1:2] #
19+
@test_broken hinfnorm2(lft(P, K)) 0.806 atol=1e-2
20+
@test_broken γ 0.806 atol=1e-2 # Not numerically robust enough to pass this test despite highprec
21+
end
22+
23+
24+
@testset "Numerical difficulties 2" begin
25+
## Numerically difficult problem instance
26+
Gsyn3A = [0.0 1.0 0.0; -1.2000000000000002e-6 -0.12000999999999999 0.0; -11.2 -0.0 -2.0e-7]
27+
Gsyn3B = [0.0 0.0; 0.0 1.0; 1.0 0.0]
28+
Gsyn3C = [-7.466666666666666 -0.0 19.999999866666666; 0.0 0.0 0.0; -11.2 -0.0 0.0]
29+
Gsyn3D = [0.6666666666666666 0.0; 0.0 1.0; 1.0 -0.0]
30+
Gsyn3 = ss(Gsyn3A, Gsyn3B, Gsyn3C, Gsyn3D)
31+
Gsyn = partition(Gsyn3, 1, 2)
32+
K, γ = hinfsynthesize(Gsyn, ftype=BigFloat, γrel = 1)[1:2]
33+
@test_broken γ 4.4825150 atol=1e-2 # value by slicot
34+
@test γ 4.4825150 atol=2e-2 # slightly less strict test is passed
35+
36+
37+
Gsynb, _ = balance_statespace(Gsyn, false)
38+
K, γ = hinfsynthesize(Gsynb, ftype=BigFloat, γrel = 1)[1:2]
39+
@test_broken γ 4.4825150 atol=1e-2 # value by slicot
40+
@test γ 4.4825150 atol=2e-2 # slightly less strict test is passed
41+
end

test/test_hinf_design.jl

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -850,23 +850,3 @@ end
850850
@test_nowarn include("../examples/hinf_example_tank_discrete.jl")
851851
end
852852
end
853-
854-
855-
@testset "Numerical difficulties" begin
856-
## Numerically difficult problem instance
857-
Gsyn3A = [0.0 1.0 0.0; -1.2000000000000002e-6 -0.12000999999999999 0.0; -11.2 -0.0 -2.0e-7]
858-
Gsyn3B = [0.0 0.0; 0.0 1.0; 1.0 0.0]
859-
Gsyn3C = [-7.466666666666666 -0.0 19.999999866666666; 0.0 0.0 0.0; -11.2 -0.0 0.0]
860-
Gsyn3D = [0.6666666666666666 0.0; 0.0 1.0; 1.0 -0.0]
861-
Gsyn3 = ss(Gsyn3A, Gsyn3B, Gsyn3C, Gsyn3D)
862-
Gsyn = partition(Gsyn3, 1, 2)
863-
K, γ = hinfsynthesize(Gsyn, ftype=BigFloat, γrel = 1)[1:2]
864-
@test_broken γ 4.4825150 atol=1e-2 # value by slicot
865-
@test γ 4.4825150 atol=2e-2 # slightly less strict test is passed
866-
867-
868-
Gsynb, _ = balance_statespace(Gsyn, false)
869-
K, γ = hinfsynthesize(Gsynb, ftype=BigFloat, γrel = 1)[1:2]
870-
@test_broken γ 4.4825150 atol=1e-2 # value by slicot
871-
@test γ 4.4825150 atol=2e-2 # slightly less strict test is passed
872-
end

0 commit comments

Comments
 (0)