You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -271,14 +273,16 @@ function shift_u0map_forward(sys::DiscreteSystem, u0map, defs)
271
273
if!((op =operation(k)) isa Shift)
272
274
error("Initial conditions must be for the past state of the unknowns. Instead of providing the condition for $k, provide the condition for $(Shift(iv, -1)(k)).")
273
275
end
274
-
updated[Shift(iv, op.steps +1)(arguments(k)[1])] = v
276
+
k_next =Shift(iv, op.steps +1)(arguments(k)[1])
277
+
operation(k_next) isa Shift ? updated[shift2term(k_next)] = v :
278
+
updated[k_next] = v
275
279
end
276
280
for var inunknowns(sys)
277
281
op =operation(var)
278
282
haskey(updated, var) &&continue
279
283
root =getunshifted(var)
280
284
isnothing(root) &&continue
281
-
haskey(defs, root) ||error("Initial condition for $root not provided.")
285
+
haskey(defs, root) ||error("Initial condition for $var not provided.")
@@ -275,13 +281,13 @@ function shift_u0map_forward(sys::ImplicitDiscreteSystem, u0map, defs)
275
281
if!((op =operation(k)) isa Shift)
276
282
error("Initial conditions must be for the past state of the unknowns. Instead of providing the condition for $k, provide the condition for $(Shift(iv, -1)(k)).")
277
283
end
278
-
updated[Shift(iv, op.steps +1)(arguments(k)[1])] = v
284
+
updated[shift2term(k)] = v
279
285
end
280
286
for var inunknowns(sys)
281
287
op =operation(var)
282
-
op isa Shift ||continue
283
288
haskey(updated, var) &&continue
284
-
root =first(arguments(var))
289
+
root =getunshifted(var)
290
+
isnothing(root) &&continue
285
291
haskey(defs, root) ||error("Initial condition for $var not provided.")
286
292
updated[var] = defs[root]
287
293
end
@@ -301,7 +307,7 @@ function SciMLBase.ImplicitDiscreteProblem(
301
307
kwargs...
302
308
)
303
309
if!iscomplete(sys)
304
-
error("A completed `ImplicitDiscreteSystem` is required. Call `complete` or `structural_simplify` on the system before creating a `ImplicitDiscreteProblem`")
310
+
error("A completed `ImplicitDiscreteSystem` is required. Call `complete` or `structural_simplify` on the system before creating a `ImplicitDiscreteProblem`.")
305
311
end
306
312
dvs =unknowns(sys)
307
313
ps =parameters(sys)
@@ -312,8 +318,7 @@ function SciMLBase.ImplicitDiscreteProblem(
0 commit comments