Matlab PLL implementation

P

Peter Rinder

Guest
Does anyone have a complete implementation of a PLL in Matlab (not
Simulink)?
It should include phase discriminator, loop filter and an NCO.

/Peter
 
"Peter Rinder" <prin00@kom.auc.dk> wrote in message
news:409fb9c4$0$21984$ba624c82@nntp04.dk.telia.net...
| Does anyone have a complete implementation of a PLL in Matlab (not
| Simulink)?
| It should include phase discriminator, loop filter and an NCO.
|
| /Peter
|
|

No

DNA
 
"Genome" <Genome@nothere.com> wrote in message
news:akPnc.71$go6.31@newsfe1-win...
"Peter Rinder" <prin00@kom.auc.dk> wrote in message
news:409fb9c4$0$21984$ba624c82@nntp04.dk.telia.net...
| Does anyone have a complete implementation of a PLL in Matlab (not
| Simulink)?
| It should include phase discriminator, loop filter and an NCO.
|
| /Peter
|
|

No

DNA
Yes

Terry

PS: I'd give it to you, but then you wouldnt learn anything (besides, its a
3-phase "PLL" implementation using Parke & Clarke transforms, which is
probably not what you want, but ultimately fits your description ;)
 
Hi Terry

I would really appreciate it, if you would email your code.
I am sure I would learn a lot from looking at your code :)
I already have implemented it myself, it just doesn't work :)

/Peter

Yes

Terry

PS: I'd give it to you, but then you wouldnt learn anything (besides, its
a
3-phase "PLL" implementation using Parke & Clarke transforms, which is
probably not what you want, but ultimately fits your description ;)
 
"Peter Rinder" <prin00@kom.auc.dk> wrote in message
news:40a0af6b$0$28856$ba624c82@nntp04.dk.telia.net...
Hi Terry

I would really appreciate it, if you would email your code.
I am sure I would learn a lot from looking at your code :)
I already have implemented it myself, it just doesn't work :)

/Peter

Yes

Terry

PS: I'd give it to you, but then you wouldnt learn anything (besides,
its
a
3-phase "PLL" implementation using Parke & Clarke transforms, which is
probably not what you want, but ultimately fits your description ;)
Sorry dude, I got paid to do it so its "confidential", as well as being
completely different from what you seem to want - I take a 3-phase voltage
set, convert from rotating to stationary and 3- to 2-phases, then use a PI
controller to force Vq=0 by controlling f (and hence theta), thereby
phase-locking onto the input AC voltage. A bit of torturous math shows it is
exactly analagous to a PLL, just done differently.

What I can say though, is if your PLL doesnt work, then you are going to
have to look at debugging it. For each piece of code you have (eg phase
detector) you will need to devise a means of testing it, to verify it is
working correctly. It is quite important to do this with the individual
pieces BEFORE you put them together, because you are building a closed
feedback loop. This means a problem anywhere, turns up everywhere -
debugging the whole thing can be very tricky (this is true of pretty much
all software). An integrator, for example, can be tested by its step
response, which really ought to be a ramp. If you can, use simulink to do
your testing, it makes looking at whats happening a lot easier.

A closed feedback loop is a real pain, in that it attempts to compensate for
"disturbances" be they load changes, setpoint changes, or "noise" which
could be bugs in the feedback loop code itself. If your buggy code isnt too
bad, the thing may well work, but with much poorer performance than you
expect. thats why its important to check each bit separately. Besides, they
all are just mathematical equations, so it should be straightforward to
prove they work correctly.

Cheers
Terry
 
Thanks for your answer Terry.
I totally understand that you can't give away your "confedential" code, and
you might be right that it is totally different from what I need.

I hope I'll figure things out anyway.

Peter
 
On Tue, 11 May 2004 12:48:20 +0200, Peter Rinder wrote:

Hi Terry

I would really appreciate it, if you would email your code.
I am sure I would learn a lot from looking at your code :)
I already have implemented it myself, it just doesn't work :)
Maybe the thing you should do is post _your_ code. The people in this group
have plenty of experience with PLLs, although I'd bet that posting code to
the DSP newsgroup might produce even better results.

The other thing I'd suggest is debugging. Code is vastly easier to debug
than a circuit, since you can see every state as it happens. Use simple
test cases that should produce predictable results, think about what you
expect to happen, then see if it happens.

The last thing I'd suggest is a block diagram, if you don't already have
one. It might seem tedious, but it provides a link between your code and a
symbolic representation that makes it easy to convey what you've tried to
do. For someone trying to debug your code, it will make it much easier to
compare what you were trying to implement with what you actually
implemented.

-- Mike --
 

Welcome to EDABoard.com

Sponsor

Back
Top