392
392
end
393
393
394
394
@testset " NonLinMPC moves and getinfo" begin
395
- linmodel = setop! (LinModel (tf (5 , [200 , 1 ]), 300 .0 ), yop= [10 ])
395
+ linmodel = setop! (LinModel (tf (5 , [2000 , 1 ]), 3000 .0 ), yop= [10 ])
396
396
nmpc_lin = NonLinMPC (linmodel, Nwt= [0 ], Hp= 1000 , Hc= 1 )
397
397
r = [15 ]
398
398
u = moveinput! (nmpc_lin, r)
@@ -410,10 +410,10 @@ end
410
410
@test u ≈ [1 ] atol= 5e-2
411
411
# ensure that the current estimated output is updated for correct JE values:
412
412
@test nmpc. ŷ ≈ ModelPredictiveControl. evalŷ (nmpc. estim, nothing , Float64[])
413
- linmodel2 = LinModel ([tf (5 , [200 , 1 ]) tf (7 , [800 ,1 ])], 300 .0 , i_d= [2 ])
413
+ linmodel2 = LinModel ([tf (5 , [2000 , 1 ]) tf (7 , [8000 ,1 ])], 3000 .0 , i_d= [2 ])
414
414
f (x,u,d) = linmodel2. A* x + linmodel2. Bu* u + linmodel2. Bd* d
415
415
h (x,d) = linmodel2. C* x + linmodel2. Dd* d
416
- nonlinmodel = NonLinModel (f, h, 300 .0 , 1 , 2 , 1 , 1 )
416
+ nonlinmodel = NonLinModel (f, h, 3000 .0 , 1 , 2 , 1 , 1 )
417
417
nmpc2 = NonLinMPC (nonlinmodel, Nwt= [0 ], Hp= 1000 , Hc= 1 )
418
418
d = [0.1 ]
419
419
u = moveinput! (nmpc2, 7 d, d)
@@ -437,14 +437,14 @@ end
437
437
linmodel3 = LinModel {Float32} (0.5 * ones (1 ,1 ), ones (1 ,1 ), ones (1 ,1 ), zeros (1 ,0 ), zeros (1 ,0 ), 1.0 )
438
438
nmpc6 = NonLinMPC (linmodel3, Hp= 10 )
439
439
moveinput! (nmpc6, [0 ]) ≈ [0.0 ]
440
- nonlinmodel2 = NonLinModel {Float32} (f, h, 300 .0 , 1 , 2 , 1 , 1 )
440
+ nonlinmodel2 = NonLinModel {Float32} (f, h, 3000 .0 , 1 , 2 , 1 , 1 )
441
441
nmpc7 = NonLinMPC (nonlinmodel2, Hp= 10 )
442
442
nonlinmodel2. h (Float32[0 ,0 ], Float32[0 ])
443
443
moveinput! (nmpc7, [0 ], [0 ]) ≈ [0.0 ]
444
444
end
445
445
446
446
@testset " NonLinMPC step disturbance rejection" begin
447
- linmodel = setop! (LinModel (tf (5 , [200 , 1 ]), 300 .0 ), yop= [10 ])
447
+ linmodel = setop! (LinModel (tf (5 , [2000 , 1 ]), 3000 .0 ), yop= [10 ])
448
448
r = [15 ]
449
449
outdist = [5 ]
450
450
nmpc_im = NonLinMPC (InternalModel (linmodel))
532
532
end
533
533
534
534
@testset " NonLinMPC constraint violation" begin
535
- linmodel = LinModel (tf ([2 ], [1000 , 1 ]), 300 .0 )
535
+ linmodel = LinModel (tf ([2 ], [10000 , 1 ]), 3000 .0 )
536
536
nmpc_lin = NonLinMPC (linmodel, Hp= 50 , Hc= 5 )
537
537
538
538
setconstraint! (nmpc_lin, x̂min= [- 1e3 ,- Inf ], x̂max= [1e3 ,+ Inf ])
0 commit comments