1
- Ts = 400.0
2
- sys = [ tf (1.90 ,[1800.0 ,1 ]) tf (1.90 ,[1800.0 ,1 ]) tf (1.90 ,[1800.0 ,1 ]);
3
- tf (- 0.74 ,[800.0 ,1 ]) tf (0.74 ,[800.0 ,1 ]) tf (- 0.74 ,[800.0 ,1 ]) ]
4
-
5
- @testset " SimModel quick simulation" begin
1
+ @testitem " SimModel quick simulation" setup= [SetupMPCtests] begin
6
2
model = LinModel (sys, Ts, i_d= [3 ])
7
3
res = sim! (model, 15 )
8
4
display (res)
@@ -21,7 +17,7 @@ sys = [ tf(1.90,[1800.0,1]) tf(1.90,[1800.0,1]) tf(1.90,[1800.0,1]);
21
17
@test_throws ArgumentError SimResult (model, [res. U_data model. uop], res. Y_data, res. D_data)
22
18
end
23
19
24
- @testset " SimModel Plots" begin
20
+ @testitem " SimModel Plots" setup = [SetupMPCtests] begin
25
21
model = LinModel (sys, Ts, i_d= [3 ])
26
22
res = sim! (model, 15 , [1 , 3 ], [- 10 ])
27
23
p = plot (res, plotx= true )
45
41
@test p[3 ][1 ][:y ] ≈ res. X_data[4 , :]
46
42
end
47
43
48
- @testset " StateEstimator quick simulation" begin
44
+ @testitem " StateEstimator quick simulation" setup = [SetupMPCtests] begin
49
45
estim = SteadyKalmanFilter (LinModel (sys, Ts, i_d= [3 ]))
50
46
res = sim! (estim, 15 )
51
47
@test isa (res. obj, SteadyKalmanFilter)
67
63
@test res_man. X̂_data ≈ res. X̂_data
68
64
end
69
65
70
- @testset " StateEstimator Plots" begin
66
+ @testitem " StateEstimator Plots" setup = [SetupMPCtests] begin
71
67
estim = MovingHorizonEstimator (LinModel (sys, Ts, i_d= [3 ]), He= 5 )
72
68
estim = setconstraint! (estim, x̂min= [- 100 ,- 101 ,- 102 ,- 103 ,- Inf ,- Inf ])
73
69
estim = setconstraint! (estim, x̂max= [+ 100 ,+ 101 ,+ 102 ,+ 103 ,+ Inf ,+ Inf ])
124
120
@test all (p7[end - 2 ][3 ][:y ] .≈ + 103 )
125
121
end
126
122
127
- @testset " PredictiveController quick simulation" begin
123
+ @testitem " PredictiveController quick simulation" setup = [SetupMPCtests] begin
128
124
mpc1 = LinMPC (LinModel (sys, Ts, i_d= [3 ]))
129
125
res = sim! (mpc1, 15 )
130
126
@test isa (res. obj, LinMPC)
158
154
@test res_man. Ry_data ≈ res. Ry_data
159
155
end
160
156
161
- @testset " PredictiveController Plots" begin
157
+ @testitem " PredictiveController Plots" setup = [SetupMPCtests] begin
162
158
estim = MovingHorizonEstimator (LinModel (sys, Ts, i_d= [3 ]), He= 5 )
163
159
estim = setconstraint! (estim, x̂min= [- 100 ,- 101 ,- 102 ,- 103 ,- 104 ,- 105 ])
164
160
estim = setconstraint! (estim, x̂max= [+ 100 ,+ 101 ,+ 102 ,+ 103 ,+ 104 ,+ 105 ])
0 commit comments