@@ -1277,9 +1277,18 @@ function linearization_function(sys::AbstractSystem, inputs,
1277
1277
initialize = true ,
1278
1278
op = Dict (),
1279
1279
p = DiffEqBase. NullParameters (),
1280
+ zero_dummy_der = false ,
1280
1281
kwargs... )
1281
- sys, diff_idxs, alge_idxs, input_idxs = io_preprocessing (sys, inputs, outputs; simplify,
1282
+ ssys, diff_idxs, alge_idxs, input_idxs = io_preprocessing (sys, inputs, outputs;
1283
+ simplify,
1282
1284
kwargs... )
1285
+ if zero_dummy_der
1286
+ dummyder = setdiff (states (ssys), states (sys))
1287
+ defs = Dict (x => 0.0 for x in dummyder)
1288
+ @set! ssys. defaults = merge (defs, defaults (ssys))
1289
+ op = merge (defs, op)
1290
+ end
1291
+ sys = ssys
1283
1292
x0 = merge (defaults (sys), op)
1284
1293
u0, p, _ = get_u0_p (sys, x0, p; use_union = false , tofloat = true )
1285
1294
p, split_idxs = split_parameters_by_type (p)
@@ -1612,11 +1621,12 @@ function linearize(sys, inputs, outputs; op = Dict(), t = 0.0,
1612
1621
allow_input_derivatives = false ,
1613
1622
zero_dummy_der = false ,
1614
1623
kwargs... )
1615
- if zero_dummy_der
1616
- dummyder = setdiff (states (ssys), states (sys))
1617
- op = merge (op, Dict (x => 0.0 for x in dummyder))
1618
- end
1619
- lin_fun, ssys = linearization_function (sys, inputs, outputs; op, kwargs... )
1624
+ lin_fun, ssys = linearization_function (sys,
1625
+ inputs,
1626
+ outputs;
1627
+ zero_dummy_der,
1628
+ op,
1629
+ kwargs... )
1620
1630
linearize (ssys, lin_fun; op, t, allow_input_derivatives), ssys
1621
1631
end
1622
1632
0 commit comments