6.2 System Simulation 293
Some of the results from these simulations are shown in Fig. 6.3 and Fig.
6.4. Plots (i) and (ii) in Fig.6.3 show θ(t) and
˙
θ(t), which are are computed
using the model ex3a ide. Plots (iii) through (vi) in Fig 6.3 show q
1
(t), q
2
(t),
˙q
1
(t), ˙q
2
(t), y
5
(t) = λ(t) and y
6
(t), which are are computed using the model
ex3b ide. Recall that y
6
is the multiplier associated with the GGL stabilized
index-2 formulation, and this variable should be zero along the solution to
the equations of motion.
The plots shown in Fig. 6.4 compare the solutions obtained using the
models ex3a ide and ex3b ide. Here, we plot the errors:
e
1
(t) = |l sin θ(t) − q
1
(t)|,
e
2
(t) = |l cos θ(t) − q
2
(t)|, and
e
3
(t) = |q
1
(t)
2
+ q
2
(t)
2
− l
2
|,
where θ(t) is the result from the model ex3a ide, and q
1
(t), q
2
(t) are the
results from the model ex3b ide. The small values obtained for e
1
(t) and
e
2
(t) indicate that both models give essentially the same result. The small
values obtained for e
3
shows that the displacement constraint is satisfied, to
within the desired error tolerance (10
−6
).
Example 6.14.
The power supply filter shown here has
the following model parameters; R
1
= 8
ohm, R
2
= 48 ohm, C = 3900 × 10
−6
farad, and v(t) = 12 sin 120πt. Also, the
current through the diode satisfies ˙q
1
=
I
s
(e
αv
d
−1), where the reverse saturation
current is I
s
= 10
−12
amp.
The thermal voltage is (1/α) = 25 × 10
−3
volt, and v
d
is the voltage across
the diode. Using the charges q
1
, q
2
as generalized displacements, and f
1
=
˙q
1
, f
2
= ˙q
2
as the corresponding flows, Lagrange’s equations of motion for
this system can be written as
0 = ˙q
1
− f
1
,
0 = ˙q
2
− f
2
,
0 = R
1
f
1
+
(q
1
− q
2
)
C
− v + v
d
,
0 = R
2
f
2
−
(q
1
− q
2
)
C
,
0 = f
1
− I
s
(e
αv
d
− 1).
(a)
We solve these equations of motion using the function ride with zero
initial conditions for all the variables, in the time interval 0 ≤ t ≤ 1. The
results of this simulation are shown in Fig. 6.5.