LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Instantaneous Frequency and Relay

I have attached my VI to this post and will explain what I am trying to accomplish with it.  I am using a DAQ assistant express VI to read an input voltage from a velocity probe.  This velocity signal represents impact velocity seen in my test setup.  This signal is characterized by extreme impacts at 20 to 35 Hz with the impact signal being above a threshold of 5 volts.  Also within my setup is a relay switch that I am controlling through a PLC.  I have this programmed to wright to a measurement file with the same time stamp as the DAQ assistant.  The reason for doing this is because when the boolean switch is switched on and off the frequency of my input signal peak velocities will change.  When analyzing the data, I want to be able to see and determine the time it takes from the instant I hit the switch till the frequency changes.  In order to get the instantaneous frequency out of my signal (I need the frequency between every peek impact velocity)  I am feeding my signal into a peak detect VI.  From the peak detect VI I take the location of these peaks and convert this into a time location.  I also save the previous peak location and subtract it from the current peak location then take the inverse in order to give an instantaneous frequency.  The issue I am having with this method is getting my raw signal, the boolean switch response, and my frequency/ peak locations on the same time stamp so that I can see the time between when the switch is changed and when the frequency changes.  If I could just get the peak locations out in the form of a Time that is on the same time stamp as my raw signal and switch then I would have what I need.  There may be a better way to do this then what I am trying or a way to get what I want out of what I have.  Thanks for any help you can provide.
0 Kudos
Message 1 of 13
(3,618 Views)
Any ideas?
0 Kudos
Message 2 of 13
(3,581 Views)

There's going to be an inherit delay from a software trigger due to the OS.

 

Am I correct in understanding you would like at a point of the switch take a time stamp of the peak locations and the rawa data?


Regards,
Glenn
0 Kudos
Message 3 of 13
(3,564 Views)

Ideally I would like to have a continues plot (/data written to my measurement file) of the instantaneous frequency (One divided by current peak time-previous peak time) versus time and switch position versus time as I will be switching several times.  Another option would be to to just have an output of times where the peaks occur (relative time as in time starts at zero when I enable my write to measurement file and increases from there) written to my measurement file along with the switch position at those times.  So it will look something like this...........

 

X time (sec)           Switch (0-on 1-off)                X time (sec)           Frequency (Hz)

   0                               0                                             0                  

 

 .0002                          0                                           .0002

 

     .

     .

     .

Till Two or more peaks pass

 

.066                            0                                            .066                      30

 

 

                                                                      OR

 

 

X time (sec)             Switch Position                     Peak Location (sec)            Frequency (Hz)

     0                                  0                                         .033                               

   .0002                             0                                         .066                               30

   .0004                             0                                         .099                               30

0 Kudos
Message 4 of 13
(3,558 Views)
Can you clarify whether or not you are getting the right data and just having difficulty displaying the data? Is this a hardware issue or a software issue? I suspect hardware is you are unable acquire the correct data, software if you are just having trouble displaying the data.

Regards,
Glenn
0 Kudos
Message 5 of 13
(3,533 Views)

With the program I have attached I am getting exactly the output I need when displayed on the labview VI graph I have attached to my frequency output.  I am getting the time difference between peaks (frequency).  I am even able to write this to my write to measurement file express VI.  The issue is when I write this frequency to the measurement file it gives me  a list as follows

 

 

X value                Unknown (freq)

1                                 29.3

2                                 28.5 

3                                 28.7

4                                 28.6

 

with the correct frequency I am expecting.  What I need though is the time at which these frequencies occur, so the peak location of my raw signal where this frequency was calculated.  So if I have a peak occurring at 0.033s and then another at 0.066s, I want to know that the frequency between the two is 30 (which I am able to get) and that it occurs at 0.066s (which I am not able to write).  Then the next peak at 0.099s, I want to see 30Hz in one column and 0.099sec in another column and so on.  I hope this clears up my issue, thanks for any help.

0 Kudos
Message 6 of 13
(3,524 Views)
I have still been unable to get this to happen.  I have tried creating a waveform with the DAQ assistant time stamp To and dt and a Y of the frequency but this gives some unrelated time stamp.  The time stamp coming out of the for loop from the peak detect appears to be the time that I need but I am unable to write that to the write to measurement file VI without distorting it.
0 Kudos
Message 7 of 13
(3,479 Views)
Can you provide some code, I'm curious to see how the values get stored outside the loop. If we compile the time stamps into an array and then write to the file, it shouldn't distort the values

Regards,
Glenn
0 Kudos
Message 8 of 13
(3,456 Views)
My original post contains the attached code where I am converting the frequency signal and DAQ time stamp to a waveform and writing it to the write to measurement file VI.  Here I have attached code that is just writing the peak freq. straight to the write to measurement file VI.  This gives the expected frequencies but no way of knowing where the frequencies occur in time.  I have also attached code where I am taking the peak time occurrence and am subtracting the original time stamp from that when I first enable the write to measurement file VI.  This is done to try and give me a relative time (from when I enable write to measurement file VI) where my peaks occur which appears to work but does not write times to the measurement file that make sense.
0 Kudos
Message 9 of 13
(3,436 Views)

Can you provide a screenshot of the block diagram or unlocked vis.?  As I previously mentioned I believe we just need to allow the array to build and then put into the write to file vi. 


Regards,
Glenn
0 Kudos
Message 10 of 13
(3,416 Views)