@@ -128,16 +128,17 @@ eqs = [connect(torque.flange, inertia1.flange_a)
128
128
connect (inertia2. flange_a, spring. flange_b, damper. flange_b)
129
129
y ~ inertia2. w + torque. tau. u]
130
130
model = ODESystem (eqs, t; systems = [torque, inertia1, inertia2, spring, damper],
131
- name = :name )
131
+ name = :name , guesses = [spring . flange_a . phi => 0.0 ] )
132
132
model_outputs = [inertia1. w, inertia2. w, inertia1. phi, inertia2. phi]
133
133
model_inputs = [torque. tau. u]
134
+ op = Dict (torque. tau. u => 0.0 )
134
135
matrices, ssys = linearize (
135
- model, model_inputs, model_outputs);
136
+ model, model_inputs, model_outputs; op );
136
137
@test length (ModelingToolkit. outputs (ssys)) == 4
137
138
138
139
if VERSION >= v " 1.8" # :opaque_closure not supported before
139
140
let # Just to have a local scope for D
140
- matrices, ssys = linearize (model, model_inputs, [y])
141
+ matrices, ssys = linearize (model, model_inputs, [y]; op )
141
142
A, B, C, D = matrices
142
143
obsf = ModelingToolkit. build_explicit_observed_function (ssys,
143
144
[y],
@@ -321,7 +322,8 @@ function SystemModel(u = nothing; name = :model)
321
322
u
322
323
])
323
324
end
324
- ODESystem (eqs, t; systems = [torque, inertia1, inertia2, spring, damper], name)
325
+ ODESystem (eqs, t; systems = [torque, inertia1, inertia2, spring, damper],
326
+ name, guesses = [spring. flange_a. phi => 0.0 ])
325
327
end
326
328
327
329
model = SystemModel () # Model with load disturbance
@@ -410,7 +412,8 @@ matrices, ssys = linearize(augmented_sys,
410
412
augmented_sys. u,
411
413
augmented_sys. input. u[2 ],
412
414
augmented_sys. d
413
- ], outs)
415
+ ], outs;
416
+ op = [augmented_sys. u => 0.0 , augmented_sys. input. u[2 ] => 0.0 , augmented_sys. d => 0.0 ])
414
417
@test matrices. A ≈ [A [1 ; 0 ]; zeros (1 , 2 ) - 0.001 ]
415
418
@test matrices. B == I
416
419
@test matrices. C == [C zeros (2 )]
0 commit comments