@@ -366,17 +366,14 @@ function generate_derivative_variables!(ts::TearingState, neweqs, var_eq_matchin
366
366
eq_var_matching = invview (var_eq_matching)
367
367
diff_to_var = invview (var_to_diff)
368
368
is_discrete = is_only_discrete (structure)
369
+ toterm = is_discrete ? shift2term_with_unit : diff2term_with_unit
369
370
linear_eqs = mm === nothing ? Dict {Int, Int} () :
370
371
Dict (reverse (en) for en in enumerate (mm. nzrows))
371
372
372
373
# For variable x, make dummy derivative x_t if the
373
374
# derivative is in the system
374
375
for v in 1 : length (var_to_diff)
375
376
dv = var_to_diff[v]
376
- # For discrete systems, directly substitute lowest-order shift
377
- # if is_discrete && diff_to_var[v] == nothing
378
- # operation(fullvars[v]) isa Shift && (fullvars[v] = lower_shift_varname_with_unit(fullvars[v], iv))
379
- # end
380
377
dv isa Int || continue
381
378
solved = var_eq_matching[dv] isa Int
382
379
solved && continue
@@ -394,8 +391,7 @@ function generate_derivative_variables!(ts::TearingState, neweqs, var_eq_matchin
394
391
395
392
dx = fullvars[dv]
396
393
order, lv = var_order (dv, diff_to_var)
397
- x_t = is_discrete ? lower_shift_varname_with_unit (fullvars[dv], iv) :
398
- Symbolics. diff2term (fullvars[dv])
394
+ x_t = toterm (fullvars[dv])
399
395
400
396
# Add `x_t` to the graph
401
397
v_t = add_dd_variable! (structure, fullvars, x_t, dv)
@@ -470,7 +466,7 @@ function generate_system_equations!(state::TearingState, neweqs, var_eq_matching
470
466
for (i, v) in enumerate (fullvars)
471
467
op = operation (v)
472
468
op isa Shift && (op. steps < 0 ) && begin
473
- lowered = lower_shift_varname_with_unit (v, iv )
469
+ lowered = shift2term_with_unit (v )
474
470
total_sub[v] = lowered
475
471
fullvars[i] = lowered
476
472
end
0 commit comments