Skip to content

Commit 83b8713

Browse files
committed
test: new simple tests for ForwardEuler solver
1 parent 7ec4477 commit 83b8713

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/test_sim_model.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ end
200200
Dd = reshape([0], 1, 1)
201201
f3(x, u, d, _) = A*x + Bu*u+ Bd*d
202202
h3(x, d, _) = C*x + Dd*d
203-
solver=RungeKutta()
203+
solver=RungeKutta(4)
204204
@test string(solver) ==
205205
"4th order Runge-Kutta differential equation solver with 1 supersamples."
206206
nonlinmodel5 = NonLinModel(f3, h3, 1.0, 1, 2, 1, 1, solver=solver)
@@ -227,6 +227,13 @@ end
227227
@test xnext zeros(2)
228228
nonlinmodel6.h!(y, [0; 0], [0], nonlinmodel6.p)
229229
@test y zeros(1)
230+
nonlinemodel7 = NonLinModel(f2!, h2!, 1.0, 1, 2, 1, 1, solver=ForwardEuler())
231+
xnext, y = similar(nonlinemodel7.x0), similar(nonlinemodel7.yop)
232+
nonlinemodel7.f!(xnext, [0; 0], [0], [0], nonlinemodel7.p)
233+
@test xnext zeros(2)
234+
nonlinemodel7.h!(y, [0; 0], [0], nonlinemodel7.p)
235+
@test y zeros(1)
236+
230237

231238
@test_throws ErrorException NonLinModel(
232239
(x,u)->linmodel1.A*x + linmodel1.Bu*u,

0 commit comments

Comments
 (0)