03-30-2010 11:19 PM - edited 03-30-2010 11:21 PM
I have a 50Hz sine wave and a pulse signal on a same graph. The phase difference between two is between 0-90 degrees.
Now I need to calculate the time difference between (when the sine wave crosses zero volts) and (when the pulse rises). The frequency will stay approximately same for both signals.
The application is for a three phase generator. In simple words, when the time difference between the zero-crossing of sine wave and the pulse rises increases, that means that the load on the generator has increases.
I am a beginner user of LabView (version 9, 2009), maybe it is a very simple problem but I've been pulling my hair out for the last few days and coudln't figure anything out. Any help would be greatly appreciated. I am using DAQ USB-6008 to measure these voltages and pulse from the generator and a sensor
I have attached a jpg (a graph that i just made with excel to explain). The time 't' is what I am trying to measure
Cheers
Awais
Solved! Go to Solution.
03-31-2010 01:00 PM
awais.h,
For problems like this I recommend starting by writing down the granular steps you would take to solve this problem manually. You can't tell LabVIEW (or any programming language) what to do if you can't concisely describe the solution to your problem.
The way I'd approach this problem is to:
Here's a LabVIEW implementation of that algorithm:
04-01-2010 11:44 PM
Thank you very much Simon.
It wasn't as easy as I thought it would be. This is just one of the building blocks of my system.
You are right. I should get myself familiarized with all the functions first so that I can tell LabView what to do.
Can I please get the *.vi file of the image that you posted. It would be great help for me to understand how you implemented arrays and loops.
Many Thanks,
Awais
04-05-2010 10:24 AM
Hi Awais,
You mentioned that you were using LabVIEW 2009. One of the great, user-friendly features of LabVIEW 2009 is the VI Snippet. You can tell an image is a snippet by the dashed border and icon legend at the top. Drag and drop and you'll be good to go!
04-05-2010 06:35 PM
04-06-2010 11:58 AM
Hi
I am trying to do something similar but with different input signals. The signals come from two different transducers that will show a fast and significant change in pressure rather quickly. I would like to get the time difference 't' in between the two spikes.
can some slight modifications to the code posted do this for me?
thx
04-08-2010 05:43 PM
You can try searching your data arrays for a y-value. I converted the precision to one decimal point for the comparision because the likelihood of both arrays having a value of 1.0000, for example, is slim. If the value is not listed in either array, then the Search 1D Array function will return a -1.
Hopefully this helps!
04-08-2010 07:39 PM
Hi
Thanks for the code but I'm afraid it won't work. Like you said the probability of choosing a value that is on both graphs may not happen. This is something that I would like the code to do automatically.
But I did use the previous code posted and made some modifications to it and it seems to work perfectly. Now the next thing is to be able to get just that one value that tells you the first time difference.
Here is what I get using that code.
As you can see from the t Values. I only need the one that is highlighted. If there is a way to filter out the rest it would be great.
I was thinking of a while loop and as soon as the value is higher than 3E-5 it would store the number and stop the loop, but I'm not too familiar with arrays in labview.
Here is the the code modified.
As you can see, it wasn't that big of a modification and it still is your code.
I will keep trying.
Thanks for the help
04-09-2010 10:58 AM
Hi Oscar,
It looks like in your program you are comparing each point in the plot to .07 and logging the timestamp if it is above. Alternatively you could log the timestamp if the difference from one point to the next is larger than some threshold value. This would indicate a sharp rise in your input signal and should capture your rising edges. Then you can take the difference of those time stamps and get your difference in time between the two rises.
04-09-2010 05:41 PM
Hi
Thanks for the code. I just had a couple of questions about it.
Is the slope threshold the difference in one array element to the next array element?
Second, why are the two for loops different? one uses the slope threshold and the other has a reference?
Thrid, what is the reference?
Thanks