main content

tune phase-凯发k8网页登录

this example shows how to tune the components of a passive loop filter to improve the loop bandwidth of a phase-locked loop (pll) system. to obtain a desired loop frequency response, this example computes the loop filter parameters using the fixed-structure tuning methods provided in the control system toolbox™ software. the pll system is modeled using a reference architecture block from the mixed-signal blockset™ library.

introduction

a pll is a closed-loop system that produces an output signal whose phase depends on the phase of its input signal. the following diagram shows a simple model with a pll reference architecture block () and a block.

simplepllmodel.png

the closed-loop architecture inside the pll block consists of a phase-frequency detector (pfd), charge pump, loop filter, voltage controlled oscillator (vco), and prescaler.

pll_internal2.png

the mixed-signal blockset library provides multiple reference architecture blocks to design and simulate pll systems in simulink®. you can tune the components of the block, which is a passive filter, to get the desired open-loop bandwidth and phase margin.

using the control system toolbox software, you can specify the shape of the desired loop response and tune the parameters of a fixed-structure controller to approximate that loop shape. for more information on specifying a desired loop shape, see (control system toolbox). in the preceding pll architecture model, the loop filter is defined as a fixed-order, fixed-structure controller. to achieve the target loop shape, the values of the resistances and capacitances of the loop filter are tuned. doing so improves the open-loop bandwidth of the system and, as a result, reduces the measured lock time.

set up phase-locked loop model

open the model.

model = 'pll_tuneloopfilter';
open_system(model)

the pll block uses the configuration specified in design and evaluate simple pll model for the pfd, charge pump, vco, and prescalar tabs in the block parameters. the loop filter tab specifies the type as a fourth-order filter, and sets the loop bandwidth to 100 khz and phase margin to 60 degrees. the values for the resistances and capacitances are automatically computed.

to observe the current loop dynamics of the pll, in the block parameters, on the analysis tab, select open loop analysis and closed loop analysis. the unity gain frequency is 100 khz. the closed-loop system is stable and the 3-db bandwidth is 128.94 khz.

openloopanalysis_initial.png

closedloopanalysis_initial.png

simulate the model. the pll testbench block displays the pll lock time and phase noise metrics. to plot and analyze the phase noise profile, in the pll testbench block parameters, on the stimulus tab, select plot phase noise. the measured lock time is 2.30 microseconds.

open_system([model,'/scope'])
sim(model);

modelsimulation_initial.png

loopfilteroutput_initial.png

phasenoiseplot_initial.png

define the pll parameters needed to build the closed-loop system in matlab®.

pllkphi = 5e-3;     % charge pump output current
pllkvco = 1e8;      % vco sensitivity
plln    = 70;       % prescaler ratio
pllr2   = 88.3;     % loop filter resistance for second-order response (ohms)
pllr3   = 253;      % loop filter resistance for third-order response (ohms)
pllr4   = 642;      % loop filter resistance for fourth-order response (ohms)
pllc1   = 8.13e-10; % loop filter direct capacitance (f)
pllc2   = 1.48e-7;  % loop filter capacitance for second-order response (f)
pllc3   = 1.59e-10; % loop filter capacitance for third-order response (f)
pllc4   = 9.21e-11; % loop filter capacitance for fourth-order response (f)

build custom tunable system

to model the loop filter as a tunable element, first create tunable scalar real parameters (see (control system toolbox)) to represent each filter component. for each parameter, define the initial value and bounds. also, specify whether the parameter is free to be tuned.

use the current loop filter resistance and capacitance values as the initial numeric value of the tunable parameters.

% resistances
r2 = realp('r2',pllr2);
r2.minimum = 50;
r2.maximum = 2000;
r2.free = true;
r3 = realp('r3',pllr3);
r3.minimum = 50;
r3.maximum = 2000;
r3.free = true;
r4 = realp('r4',pllr4);
r4.minimum = 50;
r4.maximum = 2000;
r4.free = true;
% capacitances
c1 = realp('c1',pllc1);
c1.minimum = 1e-12;
c1.maximum = 1e-7;
c1.free = true;
c2 = realp('c2',pllc2);
c2.minimum = 1e-12;
c2.maximum = 1e-7;
c2.free = true;
c3 = realp('c3',pllc3);
c3.minimum = 1e-12;
c3.maximum = 1e-7;
c3.free = true;
c4 = realp('c4',pllc4);
c4.minimum = 1e-12;
c4.maximum = 1e-7;
c4.free = true;

using these tunable parameters, create a custom tunable model based on the loop filter transfer function equation specified in the more about section of the block reference page. loopfiltersys is a (control system toolbox) model parameterized by r2, r3, r4, c1, c2, c3, and c4.

z(s)=r2c2s 1s(a4s3 a3s2 a2s a1)a4=c1c2c3c4r2r3r4a3=c1c2r2r3(c3 c4) c4r4(c2c3r3 c1c3r3 c1c2r2 c2c3r2)a2=c2r2(c1 c3 c4) r3(c1 c2)(c3 c4) c4r4(c1 c2 c3)a1=c1 c2 c3 c4

a4 = c1*c2*c3*c4*r2*r3*r4;
a3 = c1*c2*r2*r3*(c3 c4) c4*r4*(c2*c3*r3 c1*c3*r3 c1*c2*r2 c2*c3*r2);
a2 = c2*r2*(c1 c3 c4) r3*(c1 c2)*(c3 c4) c4*r4*(c1 c2 c3);
a1 = c1 c2 c3 c4;
loopfiltersys = tf([r2*c2, 1],[a4, a3, a2, a1, 0]);

use the transfer function representations to define the fixed blocks in the architecture (charge pump, vco, and prescaler), based on their respective frequency response characteristics [1].

chargepumpsys   = tf(pllkphi,1);       % linearized as a static gain
vcosys          = tf(pllkvco,[1 0]);   % linearized as an integrator
prescalersys    = tf(1/plln,1);        % linearized as a static gain

define input and output names for each block. connect the elements based on signal names (see (control system toolbox)) to create a tunable closed-loop system (see genss) representing the pll architecture as shown.

pllexampleblkdgm.png

chargepumpsys.inputname = 'pfd_out';                % charge pump (fixed block)
chargepumpsys.outputname = 'cp_out';
loopfiltersys.inputname = 'cp_out';                 % loop filter (tunable block)
loopfiltersys.outputname = 'lf_x';
ap = analysispoint('x');                            % analysis point does not change the architecture of closed-loop system
ap.inputname = 'lf_x';
ap.outputname = 'lf_out';
vcosys.inputname = 'lf_out';                        % vco (fixed block)
vcosys.outputname = 'vco_out';
prescalersys.inputname = 'vco_out';                 % prescaler (fixed block)
prescalersys.outputname = 'prescaler_out';
pfd = sumblk('pfd_out = ref - prescaler_out');      % phase-frequency detector (sum block)    
% create a genss model for the closed-loop architecture
cl0 = connect(chargepumpsys,loopfiltersys,ap,vcosys,prescalersys,pfd,'ref','vco_out');

loop-shaping design

define the loop gain as a frequency-response data model by providing target gains for at least two decades below and two decades above the desired open-loop bandwidth. the desired roll-off is typically higher, which results in a higher attenuation of phase noise.

specifying the appropriate target loop shape is the critical aspect of this design. the tunable compensator is a fourth-order system with a single integrator and a single zero, and the plant represents an integrator. the loop gains must be a feasible target for the open-loop structure.

for tuning the loop filter, create a tuning goal based on a target loop shape specifying the integral action, a 3 mhz crossover, and a roll-off requirement of 40 db/decade. the goal is enforced for three decades below and above the desired open-loop bandwidth.

loopgain = frd([100,10,1,1e-2,1e-4],2*pi*[1e4,1e5,3e6,3e7,3e8]);    % frd uses response data and corresponding frequencies in rad/s     
loopshapegoal = tuninggoal.loopshape('x',loopgain);                 % use analysispoint as location where open-loop response shape is measured  
loopshapegoal.focus = 2*pi*[1e3, 1e9];                              % enforce goal in frequency range (use rad/s)
loopshapegoal.name = 'loop shape goal';                             % tuning goal name
marginsgoal = tuninggoal.margins('x',7.6,60);
marginsgoal.focus = [0 inf];
marginsgoal.openings = {'x'};
marginsgoal.name = 'margins goal';

observe the current open-loop shape of the pll system with reference to the target loop shape. s represents the inverse sensitivity function and t represents the complementary sensitivity function. by default, control system toolbox plots use rad/s as the frequency unit. for more information on how to change the frequency unit to hz, see (control system toolbox).

figure 
viewgoal(loopshapegoal,cl0)

use systune to tune the fixed-structure feedback loop. doing so computes the resistance and capacitance values to meet the soft design goal based on the target loop shape. run the tuning algorithm with five different initial value sets in addition to the initial values defined during the creation of the tunable scalar real parameters.

options = systuneoptions();
options.softtol = 1e-5;      % relative tolerance for termination
options.mindecay = 1e-12;    % minimum decay rate for closed-loop poles
options.maxradius = 1e12;    % maximum spectral radius for stabilized dynamics
options.randomstart = 5;     % number of different random starting points     
[cl,fsoft,ghard,info] = systune(cl0,[loopshapegoal; marginsgoal],[],options);
final: soft = 3.16, hard = -inf, iterations = 79
final: failed to enforce closed-loop stability (max re(s) = 3.1e 04)
final: failed to enforce closed-loop stability (max re(s) = 6.7e 04)
final: failed to enforce closed-loop stability (max re(s) = 6.3e 04)
final: failed to enforce closed-loop stability (max re(s) = 7.5e 04)
final: failed to enforce closed-loop stability (max re(s) = 4.9e 04)

systune returns the tuned closed-loop system cl in generalized state-space form.

the algorithm fails to converge for the random initial values, and provides a feasible solution only when the current loop filter component values are chosen as the initial conditions. for tuning problems that are less complex, such as a third-order loop filter, the algorithm is less sensitive to initial conditions and randomized starts are an effective technique for exploring the parameter space and converging to a feasible solution.

examine the tuned open-loop shape with reference to the target loop shape. observe that while the tuned loop shape does not meet the target, the open-loop bandwidth increases while the loop keeps the same high-frequency attenuation.

figure 
viewgoal(loopshapegoal,cl)

export results to simulink model

extract the tuned loop filter component values.

rtuned = [getblockvalue(cl,'r2'),...
          getblockvalue(cl,'r3'),...
          getblockvalue(cl,'r4')];
ctuned = [getblockvalue(cl,'c1'),...
          getblockvalue(cl,'c2'),...
          getblockvalue(cl,'c3'),...
          getblockvalue(cl,'c4')];     

write the tuned loop filter component values to the pll block using the setloopfiltervalue helper function provided with the example.

blk = [model,'/integer n pll with single modulus prescaler'];
setloopfiltervalue(blk,rtuned,ctuned);

observe the open loop analysis and closed loop analysis plots from the analysis tab in the integer n pll with single modulus prescaler block parameters. the unity gain frequency and the 3-db bandwidth show improvement and are now 341.4 khz and 511.72 khz, respectively, while the loop keeps the same phase noise profile.

openloopanalysis_tuned.png

closedloopanalysis_tuned.png

simulate the model and get the pll testbench measurements and loop filter output with the tuned components.

sim(model);

modelsimulation_tuned.png

loopfilteroutput_tuned.png

phasenoiseplot_tuned.png

references

[1] banerjee, dean. pll performance, simulation and design. indianapolis, in: dog ear publishing, 2006.

网站地图