|
699 | 699 | @test length(nmpc16.Z̃) == nonlinmodel.nu*nmpc16.Hc + nmpc16.estim.nx̂*nmpc16.Hp + nmpc16.nϵ |
700 | 700 | @test nmpc16.con.neq == nmpc16.estim.nx̂*nmpc16.Hp |
701 | 701 | @test nmpc16.con.nc == 10 |
| 702 | + nonlinmodel_c = NonLinModel((ẋ,x,u,_,_)->ẋ .= -0.1x .+ u, (y,x,_,_)->y.=x, 1, 1, 1, 1) |
| 703 | + nmpc16 = NonLinMPC(nonlinmodel_c, Hp=10, transcription=TrapezoidalCollocation(), nc=10, gc=gc!) |
| 704 | + @test nmpc16.transcription == TrapezoidalCollocation() |
| 705 | + @test length(nmpc16.Z̃) == nonlinmodel_c.nu*nmpc16.Hc + nmpc16.estim.nx̂*nmpc16.Hp + nmpc16.nϵ |
| 706 | + @test nmpc16.con.neq == nmpc16.estim.nx̂*nmpc16.Hp |
| 707 | + @test nmpc16.con.nc == 10 |
702 | 708 | nmpc17 = NonLinMPC(linmodel1, Hp=10, transcription=MultipleShooting()) |
703 | 709 | @test nmpc17.transcription == MultipleShooting() |
704 | 710 | @test length(nmpc17.Z̃) == linmodel1.nu*nmpc17.Hc + nmpc17.estim.nx̂*nmpc17.Hp + nmpc17.nϵ |
|
721 | 727 | @test_throws ErrorException NonLinMPC(nonlinmodel, Hp=15, JE = (_,_,_)->0.0) |
722 | 728 | @test_throws ErrorException NonLinMPC(nonlinmodel, Hp=15, gc = (_,_,_,_)->[0.0], nc=1) |
723 | 729 | @test_throws ErrorException NonLinMPC(nonlinmodel, Hp=15, gc! = (_,_,_,_)->[0.0], nc=1) |
| 730 | + @test_throws ArgumentError NonLinMPC(nonlinmodel, transcription=TrapezoidalCollocation()) |
724 | 731 |
|
725 | 732 | @test_logs (:warn, Regex(".*")) NonLinMPC(nonlinmodel, Hp=15, JE=(Ue,_,_,_)->Ue) |
726 | 733 | @test_logs (:warn, Regex(".*")) NonLinMPC(nonlinmodel, Hp=15, gc=(Ue,_,_,_,_)->Ue, nc=0) |
|
0 commit comments