 # Limitations of PLL simulation: hidden oscillations in MatLab and SPICE

Nonlinear analysis of the phase-locked loop (PLL) based circuits is a challenging task, thus in modern engineering literature simplified mathematical models and simulation are widely used for their study. In this work the limitations of numerical approach is discussed and it is shown that, e.g. hidden oscillations may not be found by simulation. Corresponding examples in SPICE and MatLab, which may lead to wrong conclusions concerning the operability of PLL-based circuits, are presented.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## I Introduction

The phase-locked loop based circuits (PLL) are widely used nowadays in various applications. PLL is essentially a nonlinear control system and its rigorous analytical analysis is a challenging task. Thus, in practice, simulation is widely used for the study of PLL-based circuits (see, e.g. [1, 2, 3, 4]). At the same time, simulation of nonlinear control system may lead to wrong conclusions, e.g. recent work  notes that stability in simulations may not imply stability of the physical control system, thus stronger theoretical understanding is required.

In this work the two-phase PLL is studied and corresponding examples, where simulation leads to unreliable results, is demonstrated in SPICE and MatLab.

## Ii PLL operation

Typical analog PLL consists of the following elements: a voltage-controlled oscillator (VCO), a linear low-pass filter (LPF), a reference oscillator (REF), and an analog multiplier used as the phase detector (PD). The phase detector compares the phase of VCO signal against the phase of reference signal; the output of the PD (error voltage) is proportional to the phase difference between its two inputs. Then the error voltage is filtered by the loop filter (LPF). The output of the filter is fed to the control input of the VCO, which adjusts the frequency and phase to synchronize with the reference signal.

Consider a signal space model of the classical analog PLL with a multiplier as a phase detector (see Fig. 1).

Suppose that both waveforms of VCO and the reference oscillator signals are sinusoidal 111 Other waveforms can be similarly considered [6, 7, 8]. (see Fig. 1). The low-pass filter passes low-frequency signal and attenuates high-frequency signal .

The averaging under certain conditions [9, 10, 6, 11, 7] and approximation allow one to proceed from the analysis of the signal space model to the study of PLL model in the signal’s phase space. Rigorous consideration of this point is often omitted (see, e.g. classical books [12, p.12,p15-17], [13, p.7]) while it may lead to unreliable results (see, e.g. [14, 15]).

One of the approaches to avoid this problem is the use of two-phase modifications of PLL, which does not have high-frequency oscillations at the output of the phase detector .

## Iii Two-phase PLL

Consider two-phase PLL model in Fig. 2.

Here a carrier is with as a phase and the output of Hilbert block is . The VCO generates oscillations and with as a phase. Fig. 3 shows the structure of phase detector (complex multiplier).

The phase detector consists of two analog multipliers and analog subtractor. The output of PD is In this case there is no high-frequency component at the output of phase detector. It is reasonable to introduce a phase detector gain (e.g. to consider additional loop filter gain equal to ) to make it the same as a classic PLL phase detector characteristic:

 φ(t)=12sin(θ1(t)−θ2(t)). (1)

Consider a loop filter with the transfer function . The relation between input and output of the loop filter is as follows

 ˙x=Ax+bφ(t),g(t)=c∗x+hφ(t), (2) H(s)=c∗(A−sI)−1b−h.

The control signal is used to adjust the VCO phase to the phase of the input carrier signal:

 θ2(t)=∫t0ω2(τ)dτ=ωfreet+L∫t0g(τ)dτ, (3)

where is the VCO free-running frequency (i.e. for ) and the VCO gain.

Next examples show the importance of analytical methods for investigation of PLL stability. It is shown that the use of default simulation parameters for the study of two-phase PLL in MatLab and SIMULINK can lead to wrong conclusions concerning the operability of the loop, e.g. the pull-in (or capture) range (see discussion of rigorous definitions in [17, 18]).

## Iv Simulation in MatLab

Consider a passive lead-lag loop filter with the transfer function , , and the corresponding parameters , , , . The model of two-phase PLL in MatLab is shown in Fig. 4 (see more detailed description of simulating PLL based circuits in MatLab Simulink in [19, 20, 21]).

For the case of the passive lead-lag filter a recent work [22, p.123] notes that “the determination of the width of the capture range together with the interpretation of the capture effect in the second order type-I loops have always been an attractive theoretical problem. This problem has not yet been provided with a satisfactory solution

”. Below we demonstrate that in this case a numerical simulation may give wrong estimates and should be used very carefully.

In Fig. 4 we use the block Loop filter to take into account the initial filter state ; the initial phase error can be taken into account by the property initial data of the Intergator blocks222 Following the classical consideration [12, p.17, eq.2.20][13, p.41, eq.4-26], where the filter’s initial data is omitted, the filter is often represented in MatLab Simulink as the block Transfer Fcn with zero initial state (see, e.g. [23, 24, 25, 26, 27]). It is also related to the fact that the transfer function (from to ) of system (2) is defined by the Laplace transformation for zero initial data . . Note that the corresponding initial states in SPICE (e.g. capacitor’s initial charge and inductor’s initial currents) are zero by default but can be changed manually.

In Fig. 5 the two-phase PLL model simulated with relative tolerance set to “1e-3” or smaller does not acquire lock (black color), but the PLL model in signal’s phase space simulated in MatLab Simulink with standard parameters (a relative tolerance set to “auto”) acquires lock (red color). Here the input signal frequency is , the VCO free-running frequency , the VCO input gain is , the initial state of loop filter is 333Almost each initial state from the interval gives similar results., and the initial phase difference is . Fig. 5: Simulation of two-phase PLL. Filter output g(t) for the initial data x0=0.1318,θΔ(0)=0 obtained for default “auto” relative tolerance (red) — acquires lock, relative tolerance set to “1e-3”(green) — does not acquire lock.

## V Simulation in SPICE

In this section the previous example is reconstructed in SIMetrix, which is one of the commercial versions of SPICE.

Consider SIMetrix model of two-phase PLL shown in Fig. 6.

The input signal and the output of Hilbert block in Fig. 2 are modeled by sinusoidal voltage sources V1 (a frequency parameter is ) and V2 (a frequency parameter is and a phase is ) (sin_input and cos_input). A complex multiplier in Fig. 3 is modeled as two arbitrary sources ARB1 and ARB2 with definitions set to . To subtract the output signals of multipliers, Voltage Controlled Voltage Source (E3) is used. Phase detector gain (E5) is equal to . Loop Filter in Fig. 2 is modeled as a passive lead-lag filter with resistor R2, capacitor C2, and resistor R1. The input gain of VCO (E6) is equal to . VCO self frequency444Zero input response (ZIR) frequency (DC Voltage Source V3) is set to . Voltage Controlled Voltage Source E2 summarizes a VCO self frequency and a control signal from E6. Resistor R1b1 (), capacitor C1 (), and amplifier E1() form an integrator555The same results could qualitatively be obtained using for the resistor  and Farad for the capacitor (keeping constant). The VCO waveforms are defined by arbitrary blocks ARB3 (with the function ) and ARB4 (with the function )). Netlist for the model, generated by SIMetrix, is as follows:

1*#SIMETRIX
2V1 sin_Input 0 0 Sine(0 1 1.5915494k 0 0)
3V2 cos_input 0 0 Sine(0 1 1.5915494k -157.03518u 0)
4V3 vco_frequency 0 9.8211k
5R1 C2_N 0 1.85k
6R2 filter_out PD_output 4.48k
7X$ARB1 sin_Input vco_cos_output ARB1_OUT $$arbsourceARB1 pinnames: N1 N2 OUT 8.subckt$$arbsourceARB1 N1 N2 OUT 9B1 OUT 0 V=V(N1)*V(N2) 10.ends 11X$ARB2 cos_input vco_sin_output E3_CN $$arbsourceARB2 pinnames: N1 N2 OUT 12.subckt$$arbsourceARB2 N1 N2 OUT
13B1 OUT 0 V=V(N1)*V(N2)
14.ends
15X$ARB3 integrator_out vco_sin_output $$arbsourceARB3 pinnames: N1 OUT 16.subckt$$arbsourceARB3 N1 OUT 17B1 OUT 0 V=sin(V(N1)) 18.ends 19X$ARB4 integrator_out vco_cos_output $$arbsourceARB4 pinnames: N1 OUT 20.subckt$$arbsourceARB4 N1 OUT
21B1 OUT 0 V=cos(V(N1))
22.ends
23E1 integrator_out 0 E1_CP 0 50k
24E2 integrator_in 0 vco_frequency E2_CN 1
25C1 E1_CP 0 5G
26C2 filter_out C2_N 10u IC=185m  BRANCH={IF(ANALYSIS=2,1,0)}
27E3 E3_P 0 ARB1_OUT E3_CN 1
28E5 PD_output 0 E3_P 0 500m
29E6 E2_CN 0 filter_out 0 -500
30R1b1 integrator_in E1_CP 10u
31.GRAPH filter_out curveLabel= filter_out nowarn=true ylog=auto xlog=auto disabled=false
32.TRAN 0 5 0 1m UIC
33.OPTIONS minTimeStep=1m
34+  tnom=27

In Fig. 7 are shown simulation results in SPICE, which are close to the simulation results in MatLab Simulink (see Fig. 5). For default simulation parameters in SIMetrix two-phase PLL synchronizes to the reference signal (red line). However, if we choose smaller simulation step (), the simulation reveals an oscillation (green line).

## Vi Mathematical reasoning

Two-phase PLL is described by (1), (3), and (2), which form the following system of differential equations

 ˙x=Ax+b2sin(θΔ), (4) ˙θΔ=ωΔ−Lc∗x−Lh2sin(θΔ), θΔ(t)=θ1(t)−θ2(t),ωΔ=ω1−ωfree

For a lead-lag filter, described by the transfer function , system (4) takes the form

 ˙x=−1τ1+τ2x+(1−τ2τ1+τ2)12sin(θΔ), (5) ˙θΔ=ωΔ−L1τ1+τ2x −τ2τ1+τ2L2sin(θΔ).

The equilibrium points of (5) are defined by the following relations:

 xeq=τ12sin(θΔ), sin(θeq)=2ωΔL. (6)

For , , and we get

 xeq=0.016, (7) θeq=(−1)k0.7975+πk,k∈N.

Consider now a phase portrait (where the system’s evolving state over time traces a trajectory ), corresponding to signal’s phase model (see Fig. 8). Fig. 8: Phase portrait of the classical PLL with stable and unstable periodic trajectories Fig. 9: Phase portrait of the classical PLL with stable and unstable periodic trajectories

The solid blue line in Fig. 8 corresponds to the trajectory with the loop filter initial state and the VCO phase shift rad. This line tends to the periodic trajectory, therefore it will not acquire lock. All the trajectories under the blue line (see, e.g., a green trajectory with the initial state ) also tend to the same periodic trajectory.

The solid red line corresponds to the trajectory with the loop filter initial state and the VCO initial phase . This trajectory lies above the unstable periodic trajectory and tends to a stable equilibrium. In this case PLL acquires lock.

All the trajectories between stable and unstable periodic trajectories tend to the stable one (see, e.g., a solid green line). Therefore, if the gap between stable and unstable periodic trajectories is smaller than the discretization step, the numerical procedure may slip through the stable trajectory. The case corresponds to the close coexisting attractors and the bifurcation of birth of semistable trajectory [28, 29]. In this case numerical methods are limited by the errors on account of the linear multistep integration methods (see [30, 31]). As noted in , low-order methods introduce a relatively large warping error that, in some cases, could lead to corrupted solutions (i.e., solutions that are wrong even from a qualitative point of view). This example demonstrate also the difficulties of numerical search of so-called hidden oscillations, whose basin of attraction does not overlap with the neighborhood of an equilibrium point, and thus may be difficult to find numerically666 An oscillation in a dynamical system can be easily localized numerically if the initial data from its open neighborhood lead to long-time behavior that approaches the oscillation. From a computational point of view, on account of the simplicity of finding the basin of attraction in the phase space, it is natural to suggest the following classification of attractors [33, 34, 35, 28, 36]: An attractor is called a hidden attractor if its basin of attraction does not intersect small neighborhoods of equilibria, otherwise it is called a self-excited attractor. For a self-excited attractor its basin of attraction is connected with an unstable equilibrium. Therefore, self-excited attractors can be localized numerically by the standard computational procedure in which after a transient process a trajectory, started from a point of unstable manifold in a neighborhood of unstable equilibrium, is attracted to the state of oscillation and traces it. Thus self-excited attractors can be easily visualized. In contrast, for a hidden attractor its basin of attraction is not connected with unstable equilibria. For example, hidden attractors can be attractors in the systems with no equilibria or with only one stable equilibrium (a special case of multistable systems and coexistence of attractors). Recent examples of hidden attractors can be found in The European Physical Journal Special Topics: Multistability: Uncovering Hidden Attractors, 2015 (see [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]). . In this case the observation of one or another stable solution may depend on the initial data and integration step.

## Vii Conclusion

The considered example is a motivation for the use of rigorous analytical methods for the analysis of nonlinear PLL models. Rigorous study of the above effect can be done by Andronov’s point transformation method and phase plane analysis. Corresponding bifurcation diagram were given in  (see, also [28, 11]).

For Costas loop models, similar effect is shown in [20, 19, 50].