Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Phase-locked loop
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Modeling== ===Time domain model of APLL=== The equations governing a phase-locked loop with an analog multiplier as the phase detector and linear filter may be derived as follows. Let the input to the phase detector be <math>f_1(\theta_1(t))</math> and the output of the VCO is <math>f_2(\theta_2(t))</math> with phases <math>\theta_1(t)</math> and <math>\theta_2(t)</math>. The functions <math>f_1(\theta) </math> and <math>f_2(\theta)</math> describe [[waveforms]] of signals. Then the output of the phase detector <math>\varphi(t)</math> is given by :<math>\varphi(t) = f_1(\theta_1(t)) f_2(\theta_2(t))</math> The VCO frequency is usually taken as a function of the VCO input <math>g(t)</math> as :<math>\dot\theta_2(t) = \omega_2(t) = \omega_\text{free} + g_v g(t)\,</math> where <math>g_v</math> is the ''sensitivity'' of the VCO and is expressed in Hz / V; <math>\omega_\text{free}</math> is a free-running frequency of VCO. The loop filter can be described by a system of linear differential equations :<math> \left\{ \begin{array}{rcl} \dot x & = & Ax + b \varphi(t), \\ g(t) & = & c^{*}x, \end{array} \right. \quad x(0) = x_0, </math> where <math>\varphi(t)</math> is an input of the filter, <math>g(t)</math> is an output of the filter, <math>A</math> is <math>n</math>-by-<math>n</math> matrix, <math>x \in \mathbb{C}^n,\quad b \in \mathbb{R}^n, \quad c \in \mathbb{C}^n, \quad</math>. <math>x_0 \in \mathbb{C}^n</math> represents an initial state of the filter. The star symbol is a [[conjugate transpose]]. Hence the following system describes PLL :<math>\left\{ \begin{array}{rcl} \dot x &= &Ax + b f_1(\theta_1(t)) f_2(\theta_2(t)),\\ \dot \theta_2 &= & g_v c^{*}x + \omega_\text{free} \\ \end{array} \right. \quad x(0) = x_0, \quad \theta_2(0) = \theta_0. </math> where <math>\theta_0</math> is an initial phase shift. ===Phase domain model of APLL=== Consider the input of PLL <math>f_1(\theta_1(t))</math> and VCO output <math>f_2(\theta_2(t))</math> are high frequency signals. Then for any piecewise differentiable <math>2\pi</math>-periodic functions <math>f_1(\theta)</math> and <math>f_2(\theta)</math> there is a function <math>\varphi(\theta)</math> such that the output <math>G(t)</math> of Filter :<math> \left\{ \begin{array}{rcl} \dot x &= &Ax + b \varphi(\theta_1(t) - \theta_2(t)), \\ G(t) &= &c^{*}x, \end{array} \right. \quad x(0) = x_0, </math> in phase domain is asymptotically equal (the difference <math>G(t)- g(t)</math> is small with respect to the frequencies) to the output of the Filter in time domain model. <ref>{{cite journal | author = G. A. Leonov, N. V. Kuznetsov, M. V. Yuldashev, R. V. Yuldashev | year = 2012 | title = Analytical method for computation of phase-detector characteristic | journal = IEEE Transactions on Circuits and Systems II: Express Briefs | volume = 59 | issue = 10 | pages = 633β637 |url=http://www.math.spbu.ru/user/nk/PDF/2012-IEEE-TCAS-Phase-detector-characteristic-computation-PLL.pdf |archive-url=https://ghostarchive.org/archive/20221009/http://www.math.spbu.ru/user/nk/PDF/2012-IEEE-TCAS-Phase-detector-characteristic-computation-PLL.pdf |archive-date=2022-10-09 |url-status=live | last2 = Kuznetsov | last3 = Yuldashev | last4 = Yuldashev | doi = 10.1109/TCSII.2012.2213362 | s2cid = 2405056 }}</ref> <ref>{{cite book | author = N.V. Kuznetsov, G.A. Leonov, M.V. Yuldashev, R.V. Yuldashev | year = 2011 | pages = 7β10 | doi = 10.1109/ISSCS.2011.5978639| last2 = Leonov | last3 = Yuldashev | last4 = Yuldashev | title = ISSCS 2011 - International Symposium on Signals, Circuits and Systems | chapter = Analytical methods for computation of phase-detector characteristics and PLL design | isbn = 978-1-61284-944-7 | s2cid = 30208667 | chapter-url = https://zenodo.org/record/889367 }}</ref> Here function <math>\varphi(\theta)</math> is a [[phase detector characteristic]]. Denote by <math>\theta_{\Delta}(t)</math> the phase difference :<math>\theta_{\Delta} = \theta_1(t) - \theta_2(t).</math> Then the following [[dynamical system]] describes PLL behavior :<math> \left\{ \begin{array}{rcl} \dot x &= &Ax + b \varphi(\theta_{\Delta}),\\ \dot \theta_{\Delta} &= & - g_v c^{*}x + \omega_{\Delta}. \\ \end{array} \right. \quad x(0) = x_0, \quad \theta_{\Delta}(0) = \theta_{1}(0) - \theta_2(0). </math> Here <math>\omega_{\Delta} = \omega_1 - \omega_\text{free}</math>; <math>\omega_1</math> is the frequency of a reference oscillator (we assume that <math>\omega_\text{free}</math> is constant). ====Example==== Consider sinusoidal signals :<math>f_1(\theta_1(t)) = A_1 \sin(\theta_1(t)), \quad f_2(\theta_2(t)) = A_2\cos(\theta_2(t))</math> and a simple one-pole [[RC circuit]] as a filter. The time-domain model takes the form :<math> \left\{ \begin{align} \dot x &= -\frac{1}{RC}x + \frac{1}{RC} A_1A_2\sin(\theta_1(t)) \cos(\theta_2(t)),\\[6pt] \dot \theta_2 &= g_v c^{*}x + \omega_\text{free} \end{align} \right. </math> PD characteristics for this signals is equal<ref>A. J. Viterbi, ''Principles of Coherent Communication'', McGraw-Hill, New York, 1966</ref> to :<math> \varphi(\theta_1 - \theta_2) = \frac{A_1 A_2}{2}\sin(\theta_1 - \theta_2) </math> Hence the phase domain model takes the form :<math> \left\{ \begin{align} \dot x &= -\frac{1}{RC}x + \frac{1}{RC}\frac{A_1 A_2}{2}\sin(\theta_{\Delta}),\\[6pt] \dot \theta_{\Delta} &= - g_v c^{*}x + \omega_{\Delta}. \end{align} \right. </math> This system of equations is equivalent to the equation of mathematical pendulum :<math> \begin{align} x & = \frac{\dot\theta_2 - \omega_2}{g_v c^*} = \frac{\omega_1 - \dot\theta_{\Delta} - \omega_2}{g_v c^*},\\[6pt] \dot x & = \frac{\ddot\theta_2}{g_v c^*},\\[6pt] \theta_1 & = \omega_1 t + \Psi,\\[6pt] \theta_{\Delta} & = \theta_1 -\theta_2,\\[6pt] \dot\theta_{\Delta} & = \dot\theta_1 - \dot\theta_2 = \omega_1 - \dot\theta_2,\\[6pt] & \frac{1}{g_v c^*}\ddot\theta_{\Delta} - \frac{1}{g_v c^* RC}\dot\theta_{\Delta} - \frac{A_1A_2}{2RC}\sin\theta_{\Delta} = \frac{\omega_2 - \omega_1}{g_v c^* RC}. \end{align} </math> ===Linearized phase domain model=== Phase locked loops can also be analyzed as control systems by applying the [[Laplace transform]]. The loop response can be written as :<math>\frac{\theta_o}{\theta_i} = \frac{K_p K_v F(s)} {s + K_p K_v F(s)}</math> Where * <math>\theta_o</math> is the output phase in [[radian]]s * <math>\theta_i</math> is the input phase in radians * <math>K_p</math> is the phase detector gain in [[volt]]s per radian * <math>K_v</math> is the VCO gain in radians per volt-[[second]] * <math>F(s)</math> is the loop filter transfer function (dimensionless) The loop characteristics can be controlled by inserting different types of loop filters. The simplest filter is a one-pole [[RC circuit]]. The loop transfer function in this case is :<math>F(s) = \frac{1}{1 + s R C}</math> The loop response becomes: :<math>\frac{\theta_o}{\theta_i} = \frac{\frac{K_p K_v}{R C}}{s^2 + \frac{s}{R C} + \frac{K_p K_v}{R C}}</math> This is the form of a classic [[harmonic oscillator]]. The denominator can be related to that of a second order system: :<math>s^2 + 2 s \zeta \omega_n + \omega_n^2</math> where <math>\zeta</math> is the damping factor and <math>\omega_n</math> is the natural frequency of the loop. For the one-pole RC filter, :<math>\omega_n = \sqrt{\frac{K_p K_v}{R C}}</math> :<math>\zeta = \frac{1}{2 \sqrt{K_p K_v R C}}</math> The loop natural frequency is a measure of the response time of the loop, and the damping factor is a measure of the overshoot and ringing. Ideally, the natural frequency should be high and the damping factor should be near 0.707 (critical damping). With a single pole filter, it is not possible to control the loop frequency and damping factor independently. For the case of critical damping, :<math>R C = \frac{1}{2 K_p K_v}</math> :<math>\omega_c = K_p K_v \sqrt{2}</math> A slightly more effective filter, the lag-lead filter includes one pole and one zero. This can be realized with two resistors and one capacitor. The transfer function for this filter is :<math>F(s) = \frac{1+s C R_2}{1+s C (R_1+R_2)}</math> This filter has two time constants :<math>\tau_1 = C (R_1 + R_2)</math> :<math>\tau_2 = C R_2</math> Substituting above yields the following natural frequency and damping factor :<math>\omega_n = \sqrt{\frac{K_p K_v}{\tau_1}}</math> :<math>\zeta = \frac{1}{2 \omega_n \tau_1} + \frac{\omega_n \tau_2}{2}</math> The loop filter components can be calculated independently for a given natural frequency and damping factor :<math>\tau_1 = \frac{K_p K_v}{\omega_n^2}</math> :<math>\tau_2 = \frac{2 \zeta}{\omega_n} - \frac{1}{K_p K_v}</math> Real world loop filter design can be much more complex e.g. using higher order filters to reduce various types or source of phase noise. (See the D Banerjee ref below) ===Implementing a digital phase-locked loop in software=== Digital phase locked loops can be implemented in hardware, using integrated circuits such as a CMOS 4046. However, with microcontrollers becoming faster, it may make sense to implement a phase locked loop in software for applications that do not require locking onto signals in the MHz range or faster, such as precisely controlling motor speeds. Software implementation has several advantages including easy customization of the feedback loop including changing the multiplication or division ratio between the signal being tracked and the output oscillator. Furthermore, a software implementation is useful to understand and experiment with. As an example of a phase-locked loop implemented using a [[phase frequency detector]] is presented in MATLAB, as this type of phase detector is robust and easy to implement. <syntaxhighlight lang="matlab"> % This example is written in MATLAB % Initialize variables vcofreq = zeros(1, numiterations); ervec = zeros(1, numiterations); % Keep track of last states of reference, signal, and error signal qsig = 0; qref = 0; lref = 0; lsig = 0; lersig = 0; phs = 0; freq = 0; % Loop filter constants (proportional and derivative) % Currently powers of two to facilitate multiplication by shifts prop = 1 / 128; deriv = 64; for it = 1:numiterations % Simulate a local oscillator using a 16-bit counter phs = mod(phs + floor(freq / 2 ^ 16), 2 ^ 16); ref = phs < 32768; % Get the next digital value (0 or 1) of the signal to track sig = tracksig(it); % Implement the phase-frequency detector rst = ~ (qsig & qref); % Reset the "flip-flop" of the phase-frequency % detector when both signal and reference are high qsig = (qsig | (sig & ~ lsig)) & rst; % Trigger signal flip-flop and leading edge of signal qref = (qref | (ref & ~ lref)) & rst; % Trigger reference flip-flop on leading edge of reference lref = ref; lsig = sig; % Store these values for next iteration (for edge detection) ersig = qref - qsig; % Compute the error signal (whether frequency should increase or decrease) % Error signal is given by one or the other flip flop signal % Implement a pole-zero filter by proportional and derivative input to frequency filtered_ersig = ersig + (ersig - lersig) * deriv; % Keep error signal for proportional output lersig = ersig; % Integrate VCO frequency using the error signal freq = freq - 2 ^ 16 * filtered_ersig * prop; % Frequency is tracked as a fixed-point binary fraction % Store the current VCO frequency vcofreq(1, it) = freq / 2 ^ 16; % Store the error signal to show whether signal or reference is higher frequency ervec(1, it) = ersig; end </syntaxhighlight> In this example, an array <code>tracksig</code> is assumed to contain a reference signal to be tracked. The oscillator is implemented by a counter, with the most significant bit of the counter indicating the on/off status of the oscillator. This code simulates the two D-type [[Flip-flop (electronics)|flip-flops]] that comprise a phase-frequency comparator. When either the reference or signal has a positive edge, the corresponding flip-flop switches high. Once both reference and signal is high, both flip-flops are reset. Which flip-flop is high determines at that instant whether the reference or signal leads the other. The error signal is the difference between these two flip-flop values. The pole-zero filter is implemented by adding the error signal and its derivative to the filtered error signal. This in turn is integrated to find the oscillator frequency. In practice, one would likely insert other operations into the feedback of this phase-locked loop. For example, if the phase locked loop were to implement a frequency multiplier, the oscillator signal could be divided in frequency before it is compared to the reference signal.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)