We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4fd028f commit 5d341abCopy full SHA for 5d341ab
src/solutions/ode_solutions.jl
@@ -287,8 +287,7 @@ function (sol::AbstractODESolution)(t::Number, ::Type{deriv}, idxs,
287
ps = parameter_values(discs)
288
for ts_idx in eachindex(discs)
289
partition = discs[ts_idx]
290
- interp_val = ConstantInterpolation(partition.t, partition.u)(
291
- t, nothing, deriv, nothing, continuity)
+ interp_val = _hold_discrete(partition.u, partition.t, t)
292
ps = with_updated_parameter_timeseries_values(sol, ps, ts_idx => interp_val)
293
end
294
@@ -312,8 +311,7 @@ function (sol::AbstractODESolution)(t::Number, ::Type{deriv}, idxs::AbstractVect
312
311
313
314
315
316
317
318
319
test/downstream/solution_interface.jl
@@ -341,3 +341,12 @@ end
341
@test _ss isa SciMLBase.SavedSubsystem
342
343
344
+
345
+@testset "Interpolation after final discrete save" begin
346
+ @variables x(t) y(t)
347
+ @parameters start
348
+ @mtkbuild sys=ODESystem([D(x) ~ y, y ~ ifelse(t < start, 1.0, 2.0)], t) additional_passes=[ModelingToolkit.IfLifting]
349
+ prob = ODEProblem(sys, [x => 0.0], (0.0, 1.0), [start => 0.5])
350
+ sol = solve(prob)
351
+ @test sol(0.6, idxs = y) ≈ 2.0
352
+end
0 commit comments