Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Outline – Modeling II Hybrid Control Systems

• Sampled Data Systems Analog Control Control Analog Control


Analog
SystemControl
1 Control1
Computer Analog
SystemControl
2
– Properties System 1 Computer 1 System 2

– Examples
• Approximation Techniques Control
Control2
Computer
– Forward Difference Computer 2

– Backward Difference
• In practice, several analog controllers and a number of micro-
– Trapezoidal Rule
controllers / control computers (which are synchronized by the same
• First-Order Hold (FOH) clock) may be utilized as a part of a complex control scheme.
• Modeling Tools in Matlab • From the stand-point of control engineering, it is highly desirable to
develop equivalent (discrete-time) transfer functions representing
– Example the essential features of such control systems.

Chapter 2b ME 534 2 Chapter 2b ME 534 3

Properties of Sampled Data Properties (Cont’d)


Systems Property 3: (summation of sampled signals)
Property 1: (sampled signal) Y1(s) Y1*(s)
Y1(s)
T
Y(s) Y*(s)
Y ( z ) = Z {Y * ( s)} Y2(s) Y2*(s) Y*(s) Y(s) Y*(s)
T + Y2(s) +
T T

Property 2: (re-sampled signal)


Yn(s) Yn*(s)

[ ]
Yn(s)
* * *
Y(s) Y*(s) Y*(s) Y ( s) = Y ( s) T

* Y * ( s) = Y1* ( s) ± Y2* ( s) ± L ± Yn* ( s)


T T Y ( z ) = Z {Y ( s)}
Y ( z ) = Z {Y1* ( s)} ± Z {Y2* ( s)} ± L ± Z {Yn* ( s)}
Y ( z ) = Y1 ( z ) ± Y2 ( z ) ± L ± Yn ( z )
Chapter 2b ME 534 4 Chapter 2b ME 534 5
Properties (Cont’d) Properties (Cont’d)
Property 6: (cascaded impulse responses)
Property 4: (sampled response) X(s) Y*(s)
Y ( s ) = G( s ) X ( s ) G 1(s)
G 1(s) T
G 2(s)
G 2(s)
G n(s)
G n(s) T
X(s) Y(s) Y*(s) T T
G(s) Y * ( s) = [G( s) X ( s)] *
G(s) T Y ( s) = G ( s)...G ( s) G ( s) X * ( s)
* * * *
Y ( z ) =ˆ Z {G( s) X ( s)} n 2 1

Y ( z ) =ˆ Gn ( z )...G2 (z ) G1 ( z ) X ( z )
Notice that Y * ( s) ≠ G * ( s) X * ( s)
Property 7: (sampled impulse response of a cascaded system)
Property 5: (sampled impulse response)
X(s) Y*(s)
Y ( s ) = G( s ) X * ( s ) G 1(s) G 2(s) G n(s)
X(s) X*(s) Y(s) Y*(s) G 1(s) G 2(s) G n(s) T
G(s) Y * ( s) = [G( s) X * ( s)]* T
G(s)
T T
Y * ( s) = [G( s)]* X * ( s) = G * ( s) X * ( s) Y * ( s) = [Gn ( s) ... G2 ( s)G1 ( s) X * ( s)]*
X ( z ) =ˆ Z { X * ( s)} G( z ) =ˆ Z {G * ( s)} Y * ( s) = [Gn ( s) ... G2 ( s)G1 ( s)]* X * ( s)
∴Y ( z ) = G ( z ) X ( z ) Y ( z ) =ˆ Z {Gn ( s) ... G2 ( s)G1 ( s)} X ( z )
Chapter 2b ME 534 6 Chapter 2b ME 534 7

Example 1 Solution – Part (a)


Using the Property 3:
R(s) + E*(s) M*(s) Y(s)
G c(s) G zoh(s) G p(s)
T _ G c(s) T Gzoh(s) G p(s) E * ( s) = R * ( s) − B * ( s) ⇒ E ( z ) = R( z ) − B( z ) (1)
From Property 5:
B*(s) M * ( s) = [Gc ( s)E * ( s)]* = Gc* ( s)E * ( s) ⇒ M ( z ) = Gc ( z )E ( z ) (2)
H(s)
T H(s)
where Gc ( z ) =ˆ Z {Gc* ( s)} = Z {Gc ( s)}

• Consider the block diagram of the illustrated Similarly, the Property 7 yields
system. Obtain the following transfer functions: B * ( s) = [ H ( s)G p ( s)Gzoh ( s) M * ( s)]*
a) B(z)/R(z) B * ( s) = [ H ( s)G p ( s)Gzoh ( s)]* M * ( s) ⇒ B( z ) = G( z ) M ( z ) (3)
b) Y(z)/R(z)
where G( z ) =ˆ Z { H ( s)G p ( s)Gzoh ( s)}
Chapter 2b Next Slide ME 534 8 Chapter 2b Diagram ME 534 9
Solution – Part (a) (Cont’d) Solution – Part (b)
Combining Eqns. (1), (2), and (3) gives
R(s) + E*(s) M*(s) Y*(s)
G c(s) G zoh(s) G p(s)
[1 + G( z )Gc ( z )]B( z ) = G( z )Gc ( z )R( z ) T _ G c(s) T Gzoh(s) G p(s) T
Fictitious
Sampler
Thus,
B*(s)
B( z ) G( z )Gc ( z ) H(s)
H(s)
= T
R( z ) 1 + G( z )Gc ( z )
where To obtain the desired transfer function Y(z)/R(z), a fictitious
sampler must be added to the system.
Gc ( z ) =ˆ Z {Gc ( s)}
G( z ) =ˆ Z { H ( s)G p ( s)Gzoh ( s)}

Chapter 2b ME 534 10 Chapter 2b Next Slide ME 534 11

Solution – Part (b) Solution – Part (b) (Cont’d)


Using the Property 3:
Finally, the Property 7 gives
E * ( s) = R * ( s) − B * ( s) ⇒ E ( z ) = R( z ) − B( z ) (4)
B * ( s) = [ H ( s)G p ( s)Gzoh ( s) M * ( s)]*
From Property 5:
B * ( s) = [ H ( s)G p ( s)Gzoh ( s)]* M * ( s) ⇒ B( z ) = G( z ) M ( z ) (7)
* * * *
M ( s) = [Gc ( s)E ( s)] = G ( s)E ( s) ⇒
c
*
M ( z ) = Gc ( z )E ( z ) (5)
where G( z ) =ˆ Z { H ( s)G p ( s)Gzoh ( s)}
where Gc ( z ) =ˆ Z {Gc* ( s)}

Similarly, the Property 7 yields Dividing Eqn. (7) by (6) leads to

Y * ( s) = [G p ( s)Gzoh ( s) M * ( s)]* B( z ) G ( z )
= =ˆ G2 ( z ) (8)
* *
Y ( s) = [G p ( s)Gzoh ( s)] M ( s) ⇒ *
Y ( z ) = G1 ( z ) M ( z ) (6) Y ( z ) G1 ( z )
where G1 ( z ) =ˆ Z {G p ( s)Gzoh ( s)}
Chapter 2b Diagram ME 534 12 Chapter 2b ME 534 13
Solution – Part (b) (Cont’d) Example 2
X*(s) V(s)
Combining Eqns. (4), (5), (6), and (8) gives G3(s) G4(s)
G3(s) T G4(s)
Y ( z ) = G1 ( z )Gc ( z )[ R( z ) − G2 ( z )Y ( z )] _
+ E*(s) U(s) Y*(s)
R(s) G1(s) G2(s)
Thus, Y ( z )[1 + G1 ( z )G2 ( z )Gc ( z )] = G1 ( z )Gc ( z )R( z ) T _ G1(s) G2(s) + T
14243
G( z )

Y (z) G1 ( z )Gc ( z )
= B*(s)
H(s)
R( z ) 1 + G( z )Gc ( z ) T H(s)

where Gc ( z ) =ˆ Z {Gc ( s)} • Obtain the transfer function Y(z)/R(z) for the
G1 ( z ) =ˆ Z {G p ( s)Gzoh ( s)} system shown.
G( z ) =ˆ Z { H ( s)G p ( s)Gzoh ( s)}
Chapter 2b ME 534 14 Chapter 2b Next Slide ME 534 15

Solution Solution (Cont’d)


E * ( s) = R * ( s) − B * ( s) ⇒ E ( z ) = R( z ) − B( z ) (1)
Combining Eqns. (1), (2), (3), and (4) yields
X * ( s) = [G3 ( s)R * ( s)]* = G3* ( s)R * ( s) ⇒ X ( z ) = G3 ( z )R( z ) (2)
Y ( z ) = G12 ( z )[ R( z ) − H ( z )Y ( z )] − G4 ( z )G3 ( z )R( z )
B * ( s) = [ H ( s)Y * ( s)]* = H * ( s)Y * ( s) ⇒ B( z ) = H ( z )Y ( z ) (3)

Y * ( s) = [U ( s) − V ( s)]* = U * ( s) − V * ( s) Hence,
* * * * *
Y ( s) = [G1 ( s)G2 ( s)E ( s)] − [G4 ( s) X ( s)] Y ( z )[1 + G12 ( z )H ( z )] = [G12 ( z ) − G3 ( z )G4 ( z )]R( z )
14442444 3 144244 3
U * (s) V * (s)

Y * ( s) = [G1 ( s)G2 ( s)]* E * ( s) − G4* ( s) X * ( s) ⇒ Y ( z ) G12 ( z ) − G3 ( z )G4 ( z )


=
R( z ) 1 + G12 ( z )H ( z )
Y ( z ) = G12 ( z )E ( z ) − G4 ( z ) X ( z ) (4)

where G12 ( z ) =ˆ Z {G1 ( s)G2 ( s)} where G12 ( z ) =ˆ Z {G1 ( s)G2 ( s)}
Chapter 2b Diagram ME 534 16 Chapter 2b ME 534 17
Discretization Methods Discretization Methods (Cont’d)
• The design of control system consists of two • In control literature, there exist various approximation
main steps: techniques to convert such equations conveniently into
– The mathematical model of the plant is obtained to discrete-time forms without utilizing z-transforms.
analyze its behaviour. • The methods discussed here approximate the time
– Using the model, an appropriate controller is derivative (d/dt) in ODE using a corresponding
designed to get the desired response from the difference equation:
controlled system.
1. Forward difference (Euler’s rule)
• In continuous-time domain, the dynamics of the 2. Backward difference
plant are represented by a set of differential 3. Trapezoidal (integration) rule
equations. • Also known as Tustin or bilinear transformation

Chapter 2b ME 534 18 Chapter 2b ME 534 19

1) Forward Difference 2) Backward Difference


Utilizing the definition of derivative, we have Utilizing the definition of derivative, we get
dx x (( k + 1)T ) − x ( kT ) x ( k + 1) − x ( k ) dx x ( kT ) − x (( k − 1)T ) x ( k ) − x ( k − 1)
≅ = ≅ =
dt ( k + 1)T − kT T dt kT − ( k − 1)T T

In terms of forward time-shift operator q: In terms of backward time-shift operator q-1:


dx q − 1 d q −1 dx 1 − q −1 d 1 − q −1
≅ x(k) ⇒ ≅ ≅ x (k) ⇒ ≅
dt T dt T dt T dt T
Since d/dt corresponds to s variable while q operator is equivalent to z As d/dt corresponds to s variable while q-1 operator is equivalent to z-1
variable, one can write variable, we have
z −1 z −1
s≅ s≅
T Tz
The s-variable in the transfer function is conveniently replaced by The s-variable in the transfer function is to be replaced by this
this expression leading to a new transfer function of z: expression leading to a new transfer function of z:

G ′( z ) ≅ G( s = z −1
T
) G ′( z ) ≅ G( s = z −1
Tz
)
Chapter 2b ME 534 20 Chapter 2b ME 534 21
3) Trapezoidal (Tustin) Rule Alternative Derivation for Tustin
Let u(t) = dx/dt. The trapezoidal integration rule leads to
(Bilinear) Transformation
e sT / 2 xx x2
x (( k + 1)T ) = x ( kT ) + [u(( k + 1)T ) + u( kT )]
T
2 Since z =ˆ e sT
= −sT / 2 Recall that e =1+ + + ...
u(t) e 1! 2!
x (( k + 1)T ) − x ( kT ) = [u(( k + 1)T ) + u( kT )]
T
2 2
1 ⎛ sT ⎞ 1 ⎛ sT ⎞
u(kT) u((k+1)T) In terms of q: 1+ ⎜ ⎟+ ⎜ ⎟ + ...
1! ⎝ 2 ⎠ 2! ⎝ 2 ⎠
Then z≅
(q − 1)x ( k ) = T2 (q + 1)u( k ) 1 ⎛ − sT ⎞ 1 ⎛ − sT ⎞
2

1+ ⎜ ⎟+ ⎜ ⎟ + ...
dx 2 q − 1 d 2 q −1 1! ⎝ 2 ⎠ 2! ⎝ 2 ⎠
t u( k ) = ≅ ⋅ ⋅ x(k) ⇒ ≅ ⋅
kT (k+1)T
dt T q + 1 dt T q + 1
If T is small, the higher order terms of the Taylor Series can be neglected:
As d/dt corresponds to s variable while q 2 z −1 sT
s≅ ⋅ 1+
operator is equivalent to z variable, we have T z +1 2 2 z −1
z≅
sT
Solving for s leads to s≅ ⋅
Therefore, G ′( z ) ≅ G( s = 2
T
⋅ zz +−11 ) 1− T z +1
2
Chapter 2b ME 534 22 Chapter 2b ME 534 23

Notes on Discretization Methods Example


• The discretization techniques discussed here
Consider the ODE representing the dynamics of a plant:
approximate the dynamics of a continuous plant better
when the sampling intervals are kept short.
d2 y dy
– Forward- and backward difference methods are quite 2
+3 + 2 y(t ) = x (t )
vulnerable to long sampling periods. dt dt
– Despite its complexity, the Tustin transformation yields the
best results in most cases. If T = 0.01 s, obtain the discrete-time models for this system using
the following techniques:
• Since short sampling periods are essential for the a) Forward difference
successful application of these techniques, the b) Backward difference
dynamics of output interfaces (like ZOH) could be c) Tustin transformation
neglected under such circumstances. d) Z-transform with ZOH

Chapter 2b ME 534 24 Chapter 2b ME 534 25


Solution Solution (Cont’d)
Let us first develop the transfer function of this plant in s-domain:
c) Tustin Transformation:
2 Y ( s) 1
( s + 3s + 2)Y ( s) = X ( s) ⇒ = 2
X ( s) s + 3s + 2 1 1
( z + 1)2
G ′( z ) ≅ = 40601

a) Forward Difference:
4
T2
( zz +−11 )2 + T6 ( zz +−11 ) + 2 z 2 − 1.9700 z + 0.9704

1 1
G ′( z ) ≅ = 10000

( )
z −1 2
T + 3( zT−1 ) + 2
2
z − 1.9700 z + 0.9702 Be careful when rounding numbers in these transfer
functions. Since we are dealing with relatively small
b) Backward Difference:
numbers, make sure to perform all calculations to the
1 z21
highest precision and then display at least 4 digits after
G ′( z ) ≅ = 10302

( )
z −1 2
Tz + 3( zTz−1 ) + 2
2
z − 1.9705z + 0.9707 decimal point!

Chapter 2b ME 534 26 Chapter 2b ME 534 27

Solution (Cont’d)
Solution (Cont’d)
d) ZOH: Hence,

⎛ 1 ⎞1 − e
− sT
⎛ 1 1 ⎞ 1 − e − sT B1 z −1 + B2 z −2
G( s ) = ⎜ 2 ⎟ =⎜ − ⎟ G ′( z ) =
⎝ s + 3s + 2 ⎠ s ⎝ s +1 s + 2 ⎠ s 1 − z −1 ( e −T + e −2T ) + z −2 e −3T
where
⎧⎛ 1 1 ⎞1 − e − sT
⎫ ⎧⎛ 1 1 ⎞1⎫ B1 =ˆ (1 − e −T ) − 12 (1 − e −2T )
G ′( z ) = Z ⎨⎜ − ⎟
−1
⎬ = (1 − z )Z ⎨⎜ − ⎟ ⎬
⎩⎝ s + 1 s + 2 ⎠ s ⎭ ⎩⎝ s + 1 s + 2 ⎠ s ⎭ B2 =ˆ 12 e −T (1 − e −2T ) − e −2T (1 − e −T )
From Z-transform tables:
In terms of numerical values, we have
−1 −T −1 −2T
z (1 − e ) z (1 − e ) 1
G ′( z ) = − 2
(4.9503 × 10 −5 )z + 4.9010 × 10 −5
−1 −T
1−z e 1 − z −1e −2T G ′( z ) =
z 2 − 1.9702z + 0.9704

Chapter 2b ME 534 28 Chapter 2b ME 534 29


Why Bother to Use Z-transforms? Zero-Order Hold
• Zero-order-hold (ZOH) is the interface
• If compared to the discretization techniques discussed between the digital and analog world.
here, the model development efforts in the previous m(t) – Consists of a latch and a D/A converter:
• Latch unit holds the binary signals for one
chapter appear to be tedious! m((k+1)T) sampling period (T),
m(kT) • D/A unit converts the binary
• However, notice that the discrete-time models (with representation into a corresponding
output voltage.
ZOH) developed via z-transform techniques are NOT – Very simple and easy to implement!
approximations. • If the sampling rate is too slow, the
t output of a ZOH looks like a sequence of
• Independent of sampling rate, the outputs of such kT (k+1)T boxcars.
models exactly match to those of their continuous-time – Some information is lost during the
process,
counterparts at sampling instances. – A delay of (T/2) is introduced.

Chapter 2b ME 534 30 Chapter 2b ME 534 31

First-Order Hold (FOH) Transfer Function of FOH


The FOH performs interpolation between sampling instances:
• First-order-hold (FOH) and other
higher-order methods are t − kT
m(t) developed to overcome the m(t ) = m( k ) + [m
14 2+4
(k 1) − m( k )]
3
T future value
representation difficulties
m(kT) m((k+1)T)
associated with ZOH. where kT < t < (k+1)T. Without further elaboration, the transfer
• FOH (or so called ramp-invariant function of a FOH can be simply given as
hold) does a simple linear
(1 − e − sT )2 1 (1 − z −1 )2 1
kT (k+1)T
t interpolation between m(k) and GFOH ( s) = ⋅ 2 = ⋅ 2
m(k+1). Te −sT s Tz −1 s
– It generates a corresponding output
Since it requires the future (one-step ahead) value of its input m(k),
voltage m(t) when kT < t < (k+1)T.
it is very difficult to implement it in practice.

Chapter 2b ME 534 32 Chapter 2b ME 534 33


Practical Implementation of FOH System Modeling with MATLAB
• Industry-standard “casual” • Matlab provides excellent toolbox functions to
m(t) realization of a FOH interface model / design control systems.
extrapolated
employs “extrapolation” • The following Matlab functions are commonly
techniques.
used for this purpose:
• When kT < t < (k+1)T, the
– tf: to create the transfer functions of both
slope of the output waveform
is [m(k) - m(k-1)] / T. continuous-time and discrete-time systems.
– c2d: to convert continuous-time models into discrete-
• The corresponding transfer
function of this practical time ones.
kT
t implementation differs from – impulse/step: to simulate the response of a
the one given previously. system to impulse/step inputs.

Chapter 2b ME 534 34 Chapter 2b ME 534 35

Matlab Functions Matlab Functions (Cont’d)


To illustrate the use of these functions, let us revisit our previous One can define a transfer function in z-domain as well:
example:
>> G = tf([0.1 0],[1 -0.9],0.01)
>> Gpc = tf([1],[1 3 2])
Name of T.F. Coefficients of Coefficients of the Sampling time:T
Coefficients of the the numerator denominator: 1z – 0.9
Name of T.F. Coefficients of
the numerator denominator: 1s2 + 3s + 2
Matlab’s Output:
Matlab’s Output: Transfer function:
0.1 z
Transfer function: -------
1 z - 0.9
-------------
s^2 + 3 s + 2 Sampling time: 0.01

Chapter 2b ME 534 36 Chapter 2b ME 534 37


Matlab Functions (Cont’d) Matlab Functions (Cont’d)
To convert the continuous-time model into a discrete-time one: Step Response
0.2
To simulate the response
0.18
>> Gpd = c2d(Gpc,0.01,’zoh’) Conversion method: of this system to a step-input:
0.16
‘zoh’, ‘tustin’, ...
>> step(Gpd,1) 0.14

Name of T.F. cont.-time T.F. Sampling time: T 0.12

Amplitude
0.1
Name of T.F. Final time
Matlab’s Output: 0.08

0.06
Transfer function:
0.04
4.95e-005 z + 4.901e-005 Other Matlab functions that might
0.02
------------------------ interest you at this point:
z^2 - 1.97 z + 0.9704 poly, roots, residue. 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (sec)

Sampling time: 0.01

Chapter 2b ME 534 38 Chapter 2b ME 534 39

Example Solution
%
M(z) M(s) U(s) 1 Ω(s) 1 Θ(s) % Sample Matlab code >> G
ZOH 10 %
ZOH 10 s + 12 s G1 = tf(10,[1 12]); Transfer function:
Ideal Torque
G2 = tf(1,[1 0]); 10
Modulator
H = tf(1,[1 5]); -------------------
G = G1*G2*H; s^3 + 17 s^2 + 60 s
B(z) T B(s) 1 Gd = c2d(G,0.01,'zoh')
s+5
Output:
Position
Sensor
Transfer function:
1.598e-006 z^2 + 6.126e-006 z + 1.468e-006
• If T = 0.01 s, obtain the transfer function ------------------------------------------
z^3 - 2.838 z^2 + 2.682 z - 0.8437
B(z)/M(z) for the given system using MATLAB.
Sampling time: 0.01

Chapter 2b ME 534 40 Chapter 2b ME 534 41

You might also like