DSPRelated.com
Forums

Digital PLLs: State Space or Classic?

Started by Randy Yates July 3, 2006
Hi Folks,

I have to implement a couple of digital PLLs and I'm wondering
which method would be better. By state space, I mean the
type where

  x[k+1] = A*x[k] + B*u[k]
  y[k] = C*x[k] + D*u[k],

where x[k] is a "state vector", u[k] is the
input vector and y[k] is the output vector.

By "classic" I mean the type where you simply have a phase
detector and loop filter where the loop filter is a digital filter.

I have no idea how to evaluate whether one approach is
"better" than the other, or even what the criteria should be.
Any ideas/comments would be appreciated.

--Randy

On 3 Jul 2006 15:26:33 -0700, "Randy Yates" <yates@ieee.org> wrote:

>Hi Folks, > >I have to implement a couple of digital PLLs and I'm wondering >which method would be better. By state space, I mean the >type where > > x[k+1] = A*x[k] + B*u[k] > y[k] = C*x[k] + D*u[k], > >where x[k] is a "state vector", u[k] is the >input vector and y[k] is the output vector. > >By "classic" I mean the type where you simply have a phase >detector and loop filter where the loop filter is a digital filter. > >I have no idea how to evaluate whether one approach is >"better" than the other, or even what the criteria should be. >Any ideas/comments would be appreciated. > >--Randy
I don't think they are any different actually. If you take the phase of a signal as the state vector I am pretty sure you can re-write the equations of a classic digital PLL as discrete time state space equations. Actually the fact that a PLL is equivalent to an extended Kalman filter has already been shown.
mk wrote:
> On 3 Jul 2006 15:26:33 -0700, "Randy Yates" <yates@ieee.org> wrote: > > >Hi Folks, > > > >I have to implement a couple of digital PLLs and I'm wondering > >which method would be better. By state space, I mean the > >type where > > > > x[k+1] = A*x[k] + B*u[k] > > y[k] = C*x[k] + D*u[k], > > > >where x[k] is a "state vector", u[k] is the > >input vector and y[k] is the output vector. > > > >By "classic" I mean the type where you simply have a phase > >detector and loop filter where the loop filter is a digital filter. > > > >I have no idea how to evaluate whether one approach is > >"better" than the other, or even what the criteria should be. > >Any ideas/comments would be appreciated. > > > >--Randy > > I don't think they are any different actually. If you take the phase > of a signal as the state vector I am pretty sure you can re-write the > equations of a classic digital PLL as discrete time state space > equations.
Hi mk, I knew they would yield equivalent transfer functions. I suppose I'm asking if there's any advantage from an implementation point-of-view. --Randy
Randy Yates wrote:
> mk wrote: > >>On 3 Jul 2006 15:26:33 -0700, "Randy Yates" <yates@ieee.org> wrote: >> >> >>>Hi Folks, >>> >>>I have to implement a couple of digital PLLs and I'm wondering >>>which method would be better. By state space, I mean the >>>type where >>> >>> x[k+1] = A*x[k] + B*u[k] >>> y[k] = C*x[k] + D*u[k], >>> >>>where x[k] is a "state vector", u[k] is the >>>input vector and y[k] is the output vector. >>> >>>By "classic" I mean the type where you simply have a phase >>>detector and loop filter where the loop filter is a digital filter. >>> >>>I have no idea how to evaluate whether one approach is >>>"better" than the other, or even what the criteria should be. >>>Any ideas/comments would be appreciated. >>> >>>--Randy >> >>I don't think they are any different actually. If you take the phase >>of a signal as the state vector I am pretty sure you can re-write the >>equations of a classic digital PLL as discrete time state space >>equations. > > > Hi mk, > > I knew they would yield equivalent transfer functions. I suppose I'm > asking if there's any advantage from an implementation point-of-view. > > --Randy >
Whenever I implement a digital PLL I always end up expending much more sweat over the phase detector's peculiarities than I ever do over the details of the filter. If it's a simple PLL, and if you have to ask, then you should probably implement the filter in the classic form. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Tim Wescott wrote:
> [...] > If it's a simple PLL, and if you have to ask, then you should probably > implement the filter in the classic form.
Thanks for responding, Tim. If anyone can intelligently and informatively discuss the pro's and con's of each approach, I would appreciate the chance to interact and learn. --Randy
"mk" <kal*@dspia.*comdelete> wrote in message
news:fs7ja2h3t1jrrquhh6jk7j21ejj4hnaaa8@4ax.com...
> On 3 Jul 2006 15:26:33 -0700, "Randy Yates" <yates@ieee.org> wrote: > > >Hi Folks, > > > >I have to implement a couple of digital PLLs and I'm wondering > >which method would be better. By state space, I mean the > >type where > > > > x[k+1] = A*x[k] + B*u[k] > > y[k] = C*x[k] + D*u[k], > > > >where x[k] is a "state vector", u[k] is the > >input vector and y[k] is the output vector. > > > >By "classic" I mean the type where you simply have a phase > >detector and loop filter where the loop filter is a digital filter. > > > >I have no idea how to evaluate whether one approach is > >"better" than the other, or even what the criteria should be. > >Any ideas/comments would be appreciated. > > > >--Randy > > I don't think they are any different actually. If you take the phase > of a signal as the state vector I am pretty sure you can re-write the > equations of a classic digital PLL as discrete time state space > equations. Actually the fact that a PLL is equivalent to an extended > Kalman filter has already been shown.
That should be the other way around - the PLL came first! M.P -- Posted via a free Usenet account from http://www.teranews.com
On 3 Jul 2006 20:23:25 -0700, "Randy Yates" <yates@ieee.org> wrote:

>Tim Wescott wrote: >> [...] >> If it's a simple PLL, and if you have to ask, then you should probably >> implement the filter in the classic form. > >Thanks for responding, Tim. > >If anyone can intelligently and informatively discuss the pro's and >con's of each approach, I would appreciate the chance to interact and >learn.
Not sure how much I can add, but I've always used a classic approach that's consistent with Gardner's PLL analysis. That being said, there's more than one way to do that, and they're not quite the same. Gardner's classic analysis was done for continuous, analog loops and when converting the analysis via LaPlace transforms one must elect which method to use, e.g., step-invariant, impulse-invariant, etc. The resulting loops overall behaviors will be quite similar but will differ in some details. And I agree with Tim, getting the detector gain sorted out accurately is pretty important and can be problematic at times. Once you get a methodology down the loop filter design is trivial, but only if you get the detector gain right. Eric Jacobsen Minister of Algorithms, Intel Corp. My opinions may not be Intel's opinions. http://www.ericjacobsen.org
Randy Yates wrote:
> Tim Wescott wrote: > >>[...] >>If it's a simple PLL, and if you have to ask, then you should probably >>implement the filter in the classic form. > > > Thanks for responding, Tim. > > If anyone can intelligently and informatively discuss the pro's and > con's of each approach, I would appreciate the chance to interact and > learn. > > --Randy >
Oh, but I'm lazy. The 'classic' approach is easier to code, and easier for someone else to read. I give the classic approach at least a 4x greater chance to be read and understood by someone else who has to maintain my code than state space. The state space approach can have advantages if you are modeling the actual physical process with an observer and controlling it with straight gains. Not only are your process variables available as real honest to gosh plant state estimates (phase and frequency in this case), but should you need nonlinearities to make the loop behave better they can often be applied as simple memoryless ones right at the observer. The state space approach can also have advantages if you are implementing a number of controllers on a DSP. I like to architect my software so I have a library of control routines. On DSP chips the actual control can happen faster if the core routine that's executed at run time is a matrix operation, which points to a state-space formulation. The alternative of calling a bunch of routines, one for each filter, is a wash on a conventional processor but much slower on a DSP (and yes, if you're doing one big application with one little control loop an in-line controller _is_ the way to go, but you lose readability). Not so much for PLLs, but sometimes you deal with problems that just inherently cry out for state-space implementations. Two salient examples of this are _really_ complex or obscure systems (like a two-joint inverted pendulum) and resonant filters (where you can get distinct gains in the required precision by using a state-space formulation). -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
Eric Jacobsen wrote:
> On 3 Jul 2006 20:23:25 -0700, "Randy Yates" <yates@ieee.org> wrote: > > >Tim Wescott wrote: > >> [...] > >> If it's a simple PLL, and if you have to ask, then you should probably > >> implement the filter in the classic form. > > > >Thanks for responding, Tim. > > > >If anyone can intelligently and informatively discuss the pro's and > >con's of each approach, I would appreciate the chance to interact and > >learn. > > Not sure how much I can add, but I've always used a classic approach > that's consistent with Gardner's PLL analysis. That being said, > there's more than one way to do that, and they're not quite the same. > > Gardner's classic analysis was done for continuous, analog loops and > when converting the analysis via LaPlace transforms one must elect > which method to use, e.g., step-invariant, impulse-invariant, etc. The > resulting loops overall behaviors will be quite similar but will > differ in some details. > > And I agree with Tim, getting the detector gain sorted out accurately > is pretty important and can be problematic at times. Once you get a > methodology down the loop filter design is trivial, but only if you > get the detector gain right. > Eric Jacobsen > Minister of Algorithms, Intel Corp. > My opinions may not be Intel's opinions. > http://www.ericjacobsen.org
Thanks Eric. I don't disagree that the hardest part is the phase detector, but I was wondering if there were some numerical or compuational advantage to performing the entire system in a state-space approach. In my application we've got I/Q data coming in to a 5502 DSP (running at 300 MHz) at 5.12 MHz so things are pretty busy. I also was wondering if techniques like ML baud frequency offset estimation could be efficiently implemented using state-space. I've read something about needing a band-edge filter as well as a matched filter in Proakis. This is all pretty hazy - I'm tring to bring it into focus. --Randy
Tim Wescott wrote:
> Randy Yates wrote: > > Tim Wescott wrote: > > > >>[...] > >>If it's a simple PLL, and if you have to ask, then you should probably > >>implement the filter in the classic form. > > > > > > Thanks for responding, Tim. > > > > If anyone can intelligently and informatively discuss the pro's and > > con's of each approach, I would appreciate the chance to interact and > > learn. > > > > --Randy > > > Oh, but I'm lazy. > > The 'classic' approach is easier to code, and easier for someone else to > read. I give the classic approach at least a 4x greater chance to be > read and understood by someone else who has to maintain my code than > state space.
I see your point. I'm most interested in what will be optimal-performing, not optimal-reading, though.
> The state space approach can have advantages if you are modeling the > actual physical process with an observer and controlling it with > straight gains. Not only are your process variables available as real > honest to gosh plant state estimates (phase and frequency in this case), > but should you need nonlinearities to make the loop behave better they > can often be applied as simple memoryless ones right at the observer.
Hmmm. At the observer - don't know what that means. Do you mean at the state variable matrix?
> The state space approach can also have advantages if you are > implementing a number of controllers on a DSP. I like to architect my > software so I have a library of control routines. On DSP chips the > actual control can happen faster if the core routine that's executed at > run time is a matrix operation, which points to a state-space > formulation. The alternative of calling a bunch of routines, one for > each filter, is a wash on a conventional processor but much slower on a > DSP (and yes, if you're doing one big application with one little > control loop an in-line controller _is_ the way to go, but you lose > readability).
I agree - this could be a significant advantage in my case.
> Not so much for PLLs, but sometimes you deal with problems that just > inherently cry out for state-space implementations. Two salient > examples of this are _really_ complex or obscure systems (like a > two-joint inverted pendulum) and resonant filters (where you can get > distinct gains in the required precision by using a state-space > formulation).
This is more along the lines of what I was asking. I'm contemplating using this for a BLL, and perhaps the ML form of the loop would be more amenable using SS. --Randy