@@ -241,6 +241,7 @@ function substitute_lower_order!(state::TearingState)
241
241
242
242
end
243
243
244
+ import ModelingToolkit: Shift
244
245
function tearing_reassemble (state:: TearingState , var_eq_matching,
245
246
full_var_eq_matching = nothing ; simplify = false , mm = nothing , cse_hack = true , array_hack = true )
246
247
@unpack fullvars, sys, structure = state
@@ -255,6 +256,8 @@ function tearing_reassemble(state::TearingState, var_eq_matching,
255
256
end
256
257
257
258
neweqs = collect (equations (state))
259
+ lower_name = is_only_discrete (state. structure) ? lower_varname_withshift : lower_varname_with_unit
260
+
258
261
# Terminology and Definition:
259
262
#
260
263
# A general DAE is in the form of `F(u'(t), u(t), p, t) == 0`. We can
@@ -350,7 +353,6 @@ function tearing_reassemble(state::TearingState, var_eq_matching,
350
353
order, dv
351
354
end
352
355
end
353
- lower_name = is_only_discrete (state. structure) ? lower_varname_withshift : lower_varname_with_unit
354
356
355
357
# There are three cases where we want to generate new variables to convert
356
358
# the system into first order (semi-implicit) ODEs.
@@ -464,7 +466,6 @@ function tearing_reassemble(state::TearingState, var_eq_matching,
464
466
add_edge! (solvable_graph, dummy_eq, dv)
465
467
@assert nsrcs (graph) == nsrcs (solvable_graph) == dummy_eq
466
468
@label FOUND_DUMMY_EQ
467
- # If var = x with no shift, then
468
469
is_only_discrete (state. structure) && (idx_to_lowest_shift[v_t] = idx_to_lowest_shift[dv])
469
470
var_to_diff[v_t] = var_to_diff[dv]
470
471
var_eq_matching[dv] = unassigned
0 commit comments