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
62 model = LinModel (sys, Ts, i_d= [3 ])
73 res = sim! (model, 15 )
84 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]);
2117 @test_throws ArgumentError SimResult (model, [res. U_data model. uop], res. Y_data, res. D_data)
2218end
2319
24- @testset " SimModel Plots" begin
20+ @testitem " SimModel Plots" setup = [SetupMPCtests] begin
2521 model = LinModel (sys, Ts, i_d= [3 ])
2622 res = sim! (model, 15 , [1 , 3 ], [- 10 ])
2723 p = plot (res, plotx= true )
4541 @test p[3 ][1 ][:y ] ≈ res. X_data[4 , :]
4642end
4743
48- @testset " StateEstimator quick simulation" begin
44+ @testitem " StateEstimator quick simulation" setup = [SetupMPCtests] begin
4945 estim = SteadyKalmanFilter (LinModel (sys, Ts, i_d= [3 ]))
5046 res = sim! (estim, 15 )
5147 @test isa (res. obj, SteadyKalmanFilter)
6763 @test res_man. X̂_data ≈ res. X̂_data
6864end
6965
70- @testset " StateEstimator Plots" begin
66+ @testitem " StateEstimator Plots" setup = [SetupMPCtests] begin
7167 estim = MovingHorizonEstimator (LinModel (sys, Ts, i_d= [3 ]), He= 5 )
7268 estim = setconstraint! (estim, x̂min= [- 100 ,- 101 ,- 102 ,- 103 ,- Inf ,- Inf ])
7369 estim = setconstraint! (estim, x̂max= [+ 100 ,+ 101 ,+ 102 ,+ 103 ,+ Inf ,+ Inf ])
124120 @test all (p7[end - 2 ][3 ][:y ] .≈ + 103 )
125121end
126122
127- @testset " PredictiveController quick simulation" begin
123+ @testitem " PredictiveController quick simulation" setup = [SetupMPCtests] begin
128124 mpc1 = LinMPC (LinModel (sys, Ts, i_d= [3 ]))
129125 res = sim! (mpc1, 15 )
130126 @test isa (res. obj, LinMPC)
158154 @test res_man. Ry_data ≈ res. Ry_data
159155end
160156
161- @testset " PredictiveController Plots" begin
157+ @testitem " PredictiveController Plots" setup = [SetupMPCtests] begin
162158 estim = MovingHorizonEstimator (LinModel (sys, Ts, i_d= [3 ]), He= 5 )
163159 estim = setconstraint! (estim, x̂min= [- 100 ,- 101 ,- 102 ,- 103 ,- 104 ,- 105 ])
164160 estim = setconstraint! (estim, x̂max= [+ 100 ,+ 101 ,+ 102 ,+ 103 ,+ 104 ,+ 105 ])
0 commit comments