SD Lab Report
SD Lab Report
D km
ẋ(t) + x(t) = u0 (3)
J J
It is possible to solve (3) with a trial solution shown in (4). Fig. 1. Simulink block diagram for the simulated plant
−D
x(t) = c1 e J t + c2 (4)
(t−1)
x(t) = Ku(1 − e− τ ) (11)
K K u
Now that the steady state response would be KmmKpp+D 0
. If the
disturbance is now added into the system, the steady state
K K u0
response would be KmmKpp+D + Km Kdp +D , where d is the
disturbance. If the value of Kp is large enough, the value of
d
Km Kp +D will become negligible and the steady state value
would be close to u0 , or reference value r. This proves
analytically why closed loop response can eliminate the effects
of disturbance with the right controller gain.
Fig. 13. Trajectory of 50Hz sine-wave input u(t) and output x(t)
Fig 11, 12 and 13 show the trajectories of the output x(t) The output amplitude Aout , gain G, and approximate phase
with 0.5Hz, 5Hz, and 50Hz sine-wave inputs respectively. shift ϕ for each input frequency fin are summarized in Table
I.
TABLE I
O PEN L OOP F REQUENCY R ESPONSE
Fig. 11. Trajectory of 0.5Hz sine-wave input u(t) and output x(t)
xss (t) = AM cos (ωt + ϕ) (14)
Where the magnitude and phase are given by (15) and (16)
respectively.
s
1
M = |G(jω)| = (15)
(ωn2 − ω 2 )2 + (2ζωn ω)2
2ζωn ω
ϕ = ∠G(jω) = arctan − (16)
ωn2 − ω 2
It can be observed from considering (16) that as ω → ∞,
ϕ → 180◦ ; explaining why the values for ψ in Table I increase
with increasing fin .
Fig. 12. Trajectory of 5Hz sine-wave input u(t) and output x(t)
III. L AB 3 P OSITION C ONTROL
Fig. 15. Trajectory of angular position with P controller, and ’naughty hand’
We can also write (17) as a closed-loop system with a engaged.
proportional-derivative (PD) controller in the form ẋ(t) =
ACL x(t) + BCL r(t) by defining u(t) = Ke(t) = K(r(t) − Despite having the ’naughty hand’ engaged, which sim-
x(t)); where r(t) = [r0 0]′ , K = [kP kD ], and ACL and ulates turning the disk with an external force, the steady-
BCL are given by (20) and (21) respectively. state output still converges to the reference value of r0 = π.
Consequently, the spring constant k must equal 0 to facilitate
0 1 the steady-state response observed, even when the system is
ACL = (20)
− k+kJm kP − d+kJm kD subjected to an external disturbance.
To compute the poles of the closed-loop system, we let
|sI − ACL | = 0, and evaluate the poles as s = −4.26 + 13.39i
0 0 and s = −4.26 − 13.39i.
BCL = km kP km kD (21)
J J C. Proportional-Derivative (PD) Control
The PD controller is connected in Simulink as shown in fig
For a proportional (P), or derivative (D) controller we let
16.
kD = 0, or kD = 0 respectively.
For a proportional-integral-derivative (PID) controller we
redefine e(t) as a scalar signal, and so a PID controller has
the form expressed by (22):
Z τ
de
u = kP e + kD + kI e(t) dt (22)
dt 0
Fig. 19. Trajectory of angular position with PID controller, with and without
integrator windup.
Fig. 17. Trajectory of angular position with PD controller. Integrator windup is a phenomenon that can be demon-
strated by simulating holding the disk in the first 1.5 seconds.
It can be observed that with integrator windup implemented,
the PID controller acts in an open-loop as the feedback loop
To compute the poles of the closed-loop system, we let has been broken. kI , and the output with it, will continue to
|sI − ACL | = 0, and evaluate the poles as s = −12.66 and increase until it becomes saturated wherein it will return to
s = −15.59. acting in a closed-loop.
Since the poles have negative real parts with no imaginary Integrator windup can be avoided by back calculating kI
parts, the system can be considered stable as shown in fig 17, to constrain the output within reasonable bounds [1]. Alter-
with considerably less oscillatory behaviour than that which natively, the method of condition integration allows integrator
was observed in fig 15. windup to be avoided by disabling the integrator component
of the controller until the output has stabilized somewhat [1].
The trajectory of the angular position when kD and kI are
kept constant with varying kP is shown in fig 20.
Fig. 20. Trajectory of angular position with PID controller, with varying kP .
Fig. 18. PID controller connection in Simulink.
1 1
θ̈ = (−(Jp + mp L2p )(Dr θ̇ + kθ)+
JT 4 (23)
1 1 1
mp Lp Lr Dp α̇ + m2p L2p Lr gα + (Jp + mp L2p )τ )
2 4 4
Fig. 21. Trajectory of angular position with PID controller, with varying kD .
1 1
By considering fig 20 it can be observed that higher values α̈ = ( mp Lp Lr (Dr θ̇ + kθ) − (Jr + mp L2r )Dp α̇
JT 2 (24)
of kD correspond to increased settling times. 1 1
− mp Lp g(Jr + mp L2r )α − mp Lp Lr τ )
2 2
In (23) and (24), JT and τ are calculated using (25) and
(26).
1
JT = Jp mp L2r + Jr Jp + Jr mp L2p (25)
4
Kt
τ= u (26)
Rm
TABLE II
VALUES OF P HYSICAL PARAMETERS
θ̈ = Aθ̇ + Bθ + C α̇ + Dα + Eu (27)
α̈ = F θ̇ + Gθ + H α̇ + Iα + Ju (28)
TABLE III an estimation of the crane’s rotational speed is made based
VALUES OF COEFFICIENTS IN THE PHYSICAL SYSTEM EQUATIONS on research. The rotation speed of the crane is assumed to be
Coefficients Values around 0.6 RPM [2]. Since the four reference points are given,
A -14.9889 the maximum turning angle is 90◦ . With this RPM, the crane
B -7.9941 should be able to complete the turn the maximum angle in
C 3.9590
D 150.3005 25s. The settling time is set to be 40s to account for errors
E 49.9631 and instability. Considering the fact that the rotational arm
F 14.8461 of the crane is quite long, even a moderate overshoot may
G 7.9179
H -6.9322 still cause the arm to travel a considerable distance before
I -263.1801 stopping at the reference value, and this could potentially be
J -49.4869 dangerous. Therefore, the overshoot is set to be 2% to ensure
that the rotation is safe. With the settling time and rotational
The state of the system can be written into a vector form: speed determined. The dominant poles can be calculated.
T
x = θ α θ̇ α̇ . The system can be written as ẋ(t) =
4 4
Ax(t) + Bu(t), as shown in (29), σ= = = 0.1 rad/s (33)
ts 40
θ̇ 0 0 1 0 θ 0 s s
α̇ 0 0 0 1 α 0 ln Mp 2 ln 0.022
=
θ̈ B D A C θ̇ + E u (29) ζ= = = 0.7797 (34)
ln Mp 2 + π 2 ln 0.022 + π 2
α̈ G I F H α̇ J
B. Controller Design σ 0.1
ωn = = = 0.1283 rad/s (35)
Now that the physical system is determined, the controller ζ 0.7797
design can be done by following general procedure. First, the p p
ωd = ωn2 − σ 2 = 0.12832 − 0.12 = 0.0803 rad/s (36)
system should be checked for reachability. The W matrix can
be obtained from A and B as shown in (30). With σ and ωd determined, the first two poles can be written
W = B AB A2 B A3 B as: P1 = −σ + ωd i = −0.1 + 0.0803i, P2 = −σ − ωd i =
0 49.96 −944.8 1.062e4
−0.1 − 0.0803i. The remaining poles are less dominant and
0 −49.49 1.085e3 −8.127e3 (30) their settling time has been set to be 10 times the settling time
= 49.96 −944.8 1.062e4 −2.074e4
of the dominant poles. The damping ratio of the remaining
−49.49 1.085e3 −8.127e3 −7.899e4 poles has been set to 0.9 so that they have very low overshoot.
With similar calculations, the less dominant poles are deter-
W has full rank and the system is reachable. The next step mined: P3 = −1 + 0.4843i, P4 = −1 − 0.4843i. These poles
is to find the reachable canonical form z = Ãz + B̃u. Ã can now represent the eigenvalues of the system after the controller
be found by calculating the eigenvalues of the A. Ã should is applied. Therefore, similar method can be used as shown in
have the same eigenvalues as A. The eigenvalues of A are: (31). The new characteristic equation can be written as (37),
λ1 = −6.7244 + 12.3501i, λ2 = −6.7244 − 12.3501i, λ3 = where p1 = 2.2, p2 = 1.651, p3 = 0.2798, p4 = 0.0203,
−7.8863, λ4 = −0.5860. With the eigenvalues determined, it
is possible to write det(SI − Ã) as (31). p(s) = (s − P1 )(s − P2 )(s − P3 )(s − P4 )
(37)
= s4 + p1 s3 + p2 s2 + p3 s + p4
det(SI−Ã) = (s − λ1 )(s − λ2 )(s − λ3 )(s − λ4 )
(31)
= s4 + a1 s3 + a2 s2 + a3 s + a4 With the new characteristic equation determined, K̃ can be
The values of a1 , a2 , a3 and a4 can be determined by the calculated as shown in (38).
eigenvalues. Since à is in canonical form, it can be directly K̃ = k˜4 k˜3 k˜2 k˜1
written as (32), where a1 = 21.9211, a2 = 316.3059, a3 =
1737.5, a4 = 913.8196. = p4 − a4 p3 − a3 p2 − a2 p1 − a1 (38)
= −913.80 −1.74e3 −314.65 −19.72
0 1 0 0
0 0 1 0 With K̃ determined, the last step is to transform K̃ back to
à = (32)
0 0 0 1 K. The transformation matrix T can be calculated with W
−a4 −a3 −a2 −a1 and W̃ , as shown in (39) and (40).
B̃ can be directly written basedT on the definition of W̃ = B̃ ÃB̃ Ã2 B̃ Ã3 B̃
canonical form. B̃ = 0 0 0 1 . The next step is to
0 0 0 1
calculate the poles. To determine the dominant poles , the 0 0 1 −21.9211 (39)
estimated system specifications need to be determined. Since =
0 1 −21.9211 164.2309
no information is provided on the specifications of the crane, 1 −21.9211 164.2309 1.5962e3
T = W̃ W −1
1.75e-4 1.63e-4 −4.61e-6 −4.66e-6
−4.34e-19 5.32e-4 1.75e-4 1.77e-4 (40)
=
−6.94e-18 −0.0202 2.60e-18 2.71e-18
1.11e-16 1.67e-16 −2.26e-17 −0.0202
u = −Kx + kr r (44)
Now the controller is set and how the controller affects the
input is known, it is now possible to test the system. The
controller is connected in the Simulink as shown in Fig. 22.