Skip to content

Commit f00328d

Browse files
committed
test: add test for ParametrizedInterpolation
1 parent a80b145 commit f00328d

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

test/Blocks/sources.jl

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using ModelingToolkitStandardLibrary.Blocks: smooth_sin, smooth_cos, smooth_damp
55
smooth_square, smooth_step, smooth_ramp,
66
smooth_triangular, triangular, square
77
using OrdinaryDiffEq: ReturnCode.Success
8+
using DataInterpolations
89

910
@testset "Constant" begin
1011
@named src = Constant(k = 2)
@@ -411,8 +412,6 @@ end
411412
end
412413

413414
@testset "SampledData" begin
414-
using DataInterpolations
415-
416415
dt = 4e-4
417416
t_end = 10.0
418417
time = 0:dt:t_end
@@ -477,3 +476,20 @@ end
477476
@test sol[ddy][end]2 atol=1e-3
478477
end
479478
end
479+
480+
@testset "ParametrizedInterpolation" begin
481+
@variables y(t) = 0
482+
@parameters u[1:15] = rand(15)
483+
@parameters x[1:15] = 0:14
484+
485+
@named i = ParametrizedInterpolation(LinearInterpolation, u, x)
486+
eqs = [D(y) ~ i.output.u]
487+
488+
@named model = ODESystem(eqs, t, systems = [i])
489+
sys = structural_simplify(model)
490+
491+
prob = ODEProblem(sys, [], (0.0, 4))
492+
sol = solve(prob)
493+
494+
@test SciMLBase.successful_retcode(sol)
495+
end

0 commit comments

Comments
 (0)