HW#702 - University of Colorado Boulder

advertisement
CU Boulder
ECE Dept.
10-28-2002
Communication Theory
ECEN 4242
Homework #7
(Due Wednesday, November 6, 2002)
Problem 1
5.4-2 (From Text book)
Problem 2
5.4-3 (From Textbook)
Problem 3
Computer Experiment on Phase-Locked Loop (PLL)
A phase-locked loop (PLL) circuit, as shown by Figure 1, is a closed-loop system and consists of
three main components: (1) a phase comparator, (2) a loop filter, and (3) a voltage-controlled oscillator (VCO). A PLL circuit is usually used in coherent detection and in frequency (FM) demodulation
(or frequency tracking).
The phase comparator is simply a multiplier, which takes as inputs, two sinusoids and produces a
signal with two components (one is high frequency and the other one is low frequency) as follows
e(t )  Ai cos( c t   i (t )).A0 cos( c t   0 (t )   / 2)

Ai A0
cos(2c t   i (t )   0 (t )   / 2)  cos( i (t )   0 (t )   / 2)
2
(1)
where
t

 i (t )  k f m()d
(2)
0
and
t

 0 (t )  k 0 e0 ()d
(3)
0
The loop filter is a low-pass filter that is used to suppress the high frequency component of e(t).
Thus the loop filter output will be
e0 (t )  K sin(  i (t )   0 (t ))
 Kh(t ) * sin(  e (t ))
,
(4)
where K is a proportionality factor, h(t) is the impulse response of the loop filter, and * denotes the
convolution operation.
The VCO is an oscillator whose output frequency is proportional to its input signal, which is in
fact the signal e0(t). This means that if there is any non-zero phase error e(t) its effect will appear at
the loop filter output and thus it will change the phase of the VCO output 0(t) so that the latter becomes much closer to i(t).
1
If the PLL is operating near the optimum, then we can make the following approximation: sin(  e (t ))   e (t ) . In this case the PLL behaves as a linear system and can be modeled as shown
in Figure 2.
In the case of Figure 2, three transfer functions are important to study:
1. The open-loop transfer function L(s)=KH(s)/s, where H(s) is the transfer function of the loop filter, given in general by a first-order form, K is a constant, and s is the Laplace operator given by s
= j.
2. The closed-loop transfer function given by
G( s) 
 0 ( s)
L( s )

 i ( s ) 1  L( s )
(5)
where  i (s ) and  0 ( s ) are, respectively, Laplace transforms of i(t) and 0(t).
3. The phase error transfer function
F (s) 

 e ( s)
 i (s)
 i (s)   0 (s)
 i (s)
(6)
 1  H (s)

1
1  L( s )
where  e (s ) is the Laplace transform of e(t).
The transfer function H(s) of the loop filter has a first-order form
H ( s) 
1  1 s
1  2 s
(7)
where 12. Another commonly used form of H(s) is given by
H (s)  1 
a
s
(8)
The simulation of a PLL, in general, consists of studying the behavior of the phase error e(t) and the
behavior of the VCO output phase 0(t) for a given input phase i(t). This can be done using the
transfer function F(s) and G(s), respectively. When the PLL is properly functioning, the phase error
e(t) should converge to zero and the VCO output phase 0(t) should converge to the input phase i(t)
after a transient period of time.
In general, the transfer function of the loop filter H(s) should be designed to ensure the convergence of e(t) to zero and the convergence of 0(t) to i(t) as t .
2
Questions
1) Show that when H(s) is given by (7), the closed-loop transfer function G(s) can be written in the
following standard form G(s) 
(2n  2n / K ) s  2n
s 2  2n s  2n
, where the parameters n=2fn and ,
called the natural angular frequency and the damping factor, respectively, are to be determined in
terms of K, 1, and 2.
2) Show that when H(s) is given by (7), the phase error transfer function F(s) is given by
(1   2 s) s
.
F ( s) 
K  (1  K1 ) s   2 s 2
3) Find similar expressions for the transfer functions G(s) and F(s) when H(s) takes the form given
by (8).
4) Show (for both cases of H(s)) that for an input phase i(t) given by a unit step function, we have
lim e(t)=0 when t. (Hint: use Laplace transform property given by:
lim  e (t )  lim s e ( s)
t 
s0
).
5) Use and modify (if necessary) the provided MATLAB script to compute and plot the phase error
e(t) and the VCO output phase 0(t) for a unit step input phase i(t), using H(s) given by (7) with
K=1, n=1, and  = 0.3, 0.5, 0.707, 1. What values of 1 and 2 are used for each case?
6) Comment your results. Which value of the damping factor  do you think is a good compromise
between fast response time and an under-damped oscillatory behavior?
7) Repeat Questions 5) and 6) for an input phase i(t) given by a periodic square wave with a period
50 s and amplitude alternating between +2 and –2. For convenience, consider only two periods.
Note
The MATLAB script provided with this homework uses a state-space representation of the transfer
function under analysis. For either transfer functions F(s) or H(s), the state space representation is
given by
d
x(t )  Ax(t )  Bu (t )
,
(9)
dt
y (t )  Cx(t )  Du (t )
where x(t) is the state vector, u(t) is the input, and y(t) is the output. The matrices A, B, C, and D can
be obtained using the MATLAB function tf2ss.m, which converts a transfer function into a statespace representation.
The implementation of this state space representation can be approximated by
x(t  t )  x(t )  Ax(t )t  Bu (t )t
(10)
y (t )  Cx(t )  Du (t )
or by
x(k  1)  x(k )  Ax(k )t  Bu(k )t
y(k )  Cx(k )  Du(k )
In the MATLAB script, the time step size is taken as t=0.01 s.
3
(11)
Equations (11) represent the discrete-time version of (10). The vector x is an intermediate vector
called state space vector and u and y are, respectively, the input and the output of the underlying system. In case we use F(s), the input u will be i(t) and the output y will be the phase error e(t) and in
case we use G(s), the input u will be i(t) and the output y will be 0(t).
MATLAB Script
%
% PLL
% A MATLAB script to simulate the phase model of the PLL.
% xi: damping factor
% theta_i: received phase
% theta_0: VCO phase
% theta_e = theta_i - theta_0: phase error
% dt: sampling time for the state-space representation.
%
It is given in seconds.
% A, B, C, D: state space parameters (matrices)
% x: state-space vector, which is an intermediate vector
% theta_i: input of G(s) and F(s)
% theta_0: output of G(s)
% theta_e: output of F(s)
%
% Date: 10-28-2002
% Course: ECEN 4242
% ECE Dept., CU Boulder
% Instructor: Belkacem Derras
%
xi = input('Enter the value of the damping factor: ');
N = input('Enter the number of data points to be used: ');
wn = 1;
K = 1;
theta_i = ones(1,N); % Input phase theta_i. This can be changed
dt = 0.01;
t = 0:dt:(N-1)*dt;
%
% numerator and denomenator of G(s)=THETA_0(s)/THETA_i(s)
num = [0 2*xi*wn-(wn^2/K) wn^2];
den = [1 2*xi*wn wn^2];
[A,B,C,D] = tf2ss(num,den); % get state space representation of G(s)
x = zeros(2,N);
for k=1:N-1
x(:,k+1) = x(:,k) + dt*A*x(:,k) + dt*B*theta_i(k);
theta_0(k) = C*x(:,k) + D*theta_i(k); % VCO output phase
end
figure(1)
plot(t,theta_i,'k'), grid
hold
4
plot(t(1:N-1),theta_0,'k--')
xlabel('time (s)')
ylabel('Input and VCO output phases: \theta_i(t) and \theta_0(t) (rad)')
%
% numerator and denominator of F(s)=THETA_e(s)/THETA_i(s)
num = [1 wn^2/K 0];
den = [1 2*xi*wn wn^2];
[A,B,C,D] = tf2ss(num,den); % get state space representation of F(s)
x = zeros(2,N);
for k=1:N-1
x(:,k+1) = x(:,k) + dt*A*x(:,k) + dt*B*theta_i(k);
theta_e(k) = C*x(:,k) + D*theta_i(k); % Phase error signal
end
figure(2)
plot(t(1:N-1),theta_e,'k'), grid
xlabel('time (s)')
ylabel('Phase error \theta_e(t) (rad)')
FM signal
FM(t)=Aicos(ct + i(t))
Output (demodulated) signal
Loop
Filter
X
e0(t)
VoltageControlled
Oscillator
(VCO)
Feedback signal
A0sin(ct + 0(t))
Figure 1. Phase-Locked Loop (PLL) block diagram
K
i(t)
e(t)
+
H(s)
X
0(t)
t
 d

Figure 2. Linear phase model of the PLL
5
e0(t)
Download