Skip to content

Commit b2e980f

Browse files
committed
test(Interpolation): add tests for Interpolation inside model macro
1 parent 30e341b commit b2e980f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/Blocks/sources.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,32 @@ end
500500
@test SciMLBase.successful_retcode(sol)
501501
end
502502

503+
@testset "Interpolation in model macro" begin
504+
itp = LinearInterpolation([1.0, 2.0, 3.0], [0.0, 0.5, 1.0])
505+
@mtkmodel model_with_lut begin
506+
@parameters begin
507+
table_data[1:3] = [1.0, 2.0, 3.0]
508+
table_bkp[1:3] = [0.0, 0.5, 1.0]
509+
end
510+
511+
@components begin
512+
src = Interpolation(itp)
513+
clk = ContinuousClock()
514+
model = MassSpringDamper()
515+
end
516+
@equations begin
517+
connect(src.input, clk.output)
518+
connect(src.output, model.input)
519+
end
520+
end;
521+
@mtkbuild sys = model_with_lut()
522+
523+
prob = ODEProblem(sys, [], (0.0, 4))
524+
sol = solve(prob, Tsit5())
525+
526+
@test SciMLBase.successful_retcode(sol)
527+
end
528+
503529
@testset "ParametrizedInterpolation" begin
504530
@variables y(t) = 0
505531
u = rand(15)

0 commit comments

Comments
 (0)