Skip to content

Commit 26a545d

Browse files
committed
up
1 parent b1795bd commit 26a545d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/structural_transformation/symbolics_tearing.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ function substitute_lower_order!(state::TearingState)
241241

242242
end
243243

244+
import ModelingToolkit: Shift
244245
function tearing_reassemble(state::TearingState, var_eq_matching,
245246
full_var_eq_matching = nothing; simplify = false, mm = nothing, cse_hack = true, array_hack = true)
246247
@unpack fullvars, sys, structure = state
@@ -255,6 +256,8 @@ function tearing_reassemble(state::TearingState, var_eq_matching,
255256
end
256257

257258
neweqs = collect(equations(state))
259+
lower_name = is_only_discrete(state.structure) ? lower_varname_withshift : lower_varname_with_unit
260+
258261
# Terminology and Definition:
259262
#
260263
# 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,
350353
order, dv
351354
end
352355
end
353-
lower_name = is_only_discrete(state.structure) ? lower_varname_withshift : lower_varname_with_unit
354356

355357
# There are three cases where we want to generate new variables to convert
356358
# the system into first order (semi-implicit) ODEs.
@@ -464,7 +466,6 @@ function tearing_reassemble(state::TearingState, var_eq_matching,
464466
add_edge!(solvable_graph, dummy_eq, dv)
465467
@assert nsrcs(graph) == nsrcs(solvable_graph) == dummy_eq
466468
@label FOUND_DUMMY_EQ
467-
# If var = x with no shift, then
468469
is_only_discrete(state.structure) && (idx_to_lowest_shift[v_t] = idx_to_lowest_shift[dv])
469470
var_to_diff[v_t] = var_to_diff[dv]
470471
var_eq_matching[dv] = unassigned

0 commit comments

Comments
 (0)