LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Development of a PLL Loop to estimate the frequency of a waveform

Hi everyone,

 

I am fairy new to LabVIEW and this is my first post.

I am trying to develop a PLL block to estimate the frequency (and phase) of an input signal (sinusoidal). I have already created the same model in MATLAB and trying to convert it to LabVIEW. Even though, the model is working in MATLAB, the LabVIEW model seems to have some problems in estimating the frequency. Since there are no complie errors, it is bit difficult for me to understand the faults with my limited LabVIEW knowledge. Attached herewith is my LabVIEW model (for current and 2012 versions).

Appreciate if anyone could help me.

 

Thanks a lot.

Cheers,

Chathura

Download All
0 Kudos
Message 1 of 6
(2,773 Views)

Hi there. After taking a look at your code, there are a few areas I have noticed that could be causing an issue. First, it was unclear which indicator should be displaying the frequency of the signal. Is meter 3 where you want the frequency to appear? Second, it looks like the two meters are being wired with dynamic data. The meter indicators expect an input of double data. This could be why the meters are not updating properly. Third, it appears that you have two matrices being multiplied at one point in your code, but the output from that function is never used. Is this intentional, or should the output of this function be used somewhere?

 

There are some debugging tools in LabVIEW that I think would be very helpful in your case. If you haven’t used it already, highlight execution will allow you to see the data flow of your program to follow along and see if everything is being executed in the proper order. In order to turn on highlight execution, open the block diagram of your VI, and click the lightbulb icon on the top toolbar. When running the code, the block diagram will demonstrate how data flows from one function to another. If there is something that is executing out of order, this will allow you to see those discrepancies.

 

Alex C.

National Instruments

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 6
(2,686 Views)

Hi Alex,

 

Thank you for your response. Yes, meter 3 is used to display the frequency. I converted the dynamic data to double in feeding the meters. However, the meters are still not updating. That matix multiplication is redundent (I was trying to do the cross multiplication in a different way)

 

So as you recommended, I had a look at the debugging tools and they were quite helpful. I could not find out any incosistancy in the executing order (using the light bulb). I also used few probes to minitor the instantanious data values. It seems that I get null values after the integration block. I am guessing something is wrong with my integration block. I have been trying different ways to do the integration (i.e. numeric integration VI : http://zone.ni.com/reference/en-XX/help/371361E-01/gmath/integral_xt/).

Still could not figure out the problem.

Appreciate if anyone could provide some insights here.

 

Cheers,

Chathura

 

 

 

0 Kudos
Message 3 of 6
(2,664 Views)

I tried wiring the simulate signal directly to the integration block and it worked properly as far as I could tell. I think the issue you are seeing exists between the simulate signal and the integration blocks. I would try reproducing this on your side to see if the integration block works properly. If so, take a look at what is occurring between these two points. Do you have data going in to the integration block, and nothing going out, or do you not have anything going into the integration block at all?

 

Alex C.

National Instruments

Applications Engineer

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 6
(2,646 Views)

I examined the execution of the integration block. Actually, the integration block works fine. I  expected the integration of cos( t )dt where as my input signal was cos (2*pi*50*t). Hence, I could not observe the integration (since the output was scaled down by 2*pi*50). So, now the issue with integration is sorted out. Thanks a lot for that.

 

However, now I can not successfully implement the feedback path. My feedback path does not successfully return the required intermediate output signal as a point by point input. I am bit confused whether I have to create an array for that and have a limited idea in implementing the same.

 

I have created a simplified version of my problem (attached VI). Appreciate your help on this.

0 Kudos
Message 5 of 6
(2,623 Views)

When looking at the simplified version you attached, the feedback node does not return the previous value from the integral sum because it only executes once. Since the feedback node is executing before the integral sum, it simply sends out a 0 as an initial value. If you put a while loop around the code you attached, you will see that in the second iteration of the while loop, the feedback node sends out the value that it received from the integral sum in the first iteration.

 

It could be possible that something similar is going on in your main code.

 

Alex C.

National Instruments

Applications Engineering

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 6 of 6
(2,609 Views)