Skip to content

Commit fdfa6df

Browse files
committed
tests: fix linearize tests with default values
1 parent ae94153 commit fdfa6df

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

test/input_output_handling.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ eqs = [connect(torque.flange, inertia1.flange_a)
128128
connect(inertia2.flange_a, spring.flange_b, damper.flange_b)
129129
y ~ inertia2.w + torque.tau.u]
130130
model = ODESystem(eqs, t; systems = [torque, inertia1, inertia2, spring, damper],
131-
name = :name)
131+
name = :name, defaults = Dict(
132+
[torque.tau.u, inertia1.w, inertia2.w, inertia1.phi, inertia2.phi] .=> 0.0
133+
))
132134
model_outputs = [inertia1.w, inertia2.w, inertia1.phi, inertia2.phi]
133135
model_inputs = [torque.tau.u]
134136
matrices, ssys = linearize(model, model_inputs, model_outputs);

test/split_parameters.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,15 @@ function SystemModel(u = nothing; name = :model)
154154
push!(eqs, connect(torque.tau, u.output))
155155
return @named model = ODESystem(eqs,
156156
t;
157-
systems = [torque, inertia1, inertia2, spring, damper, u])
157+
systems = [torque, inertia1, inertia2, spring, damper, u],
158+
defaults = Dict(
159+
[torque.tau.u, inertia1.w, inertia2.w, inertia1.phi, inertia2.phi] .=> 0.0
160+
))
158161
end
159-
ODESystem(eqs, t; systems = [torque, inertia1, inertia2, spring, damper], name)
162+
ODESystem(eqs, t; systems = [torque, inertia1, inertia2, spring, damper], name,
163+
defaults = Dict(
164+
[torque.tau.u, inertia1.w, inertia2.w, inertia1.phi, inertia2.phi] .=> 0.0
165+
))
160166
end
161167

162168
model = SystemModel() # Model with load disturbance

0 commit comments

Comments
 (0)