LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need Timestamp from the Array Index

Hi, I am using DAQmx for getting two sensor outputs (voltage) from two different channels (a0 and a1). I displayed the same using XY graph. And found the peak amplitudes for both the channel.

 

Additionally, I displayed the array of peak amplitudes separately with their array index.

 

Now I am stuck at displaying their corresponding TIME as shown in XY plot. How to do this?

My requirement is to display the peak amplitudes with their time index not array index. Pl. help. Thanks a lot in Advance. 

0 Kudos
Message 1 of 17
(400 Views)

@srsannasi wrote:

Hi, I am using DAQmx for getting two sensor outputs (voltage) from two different channels (a0 and a1). I displayed the same using XY graph. And found the peak amplitudes for both the channel.

 

Additionally, I displayed the array of peak amplitudes separately with their array index.

 

Now I am stuck at displaying their corresponding TIME as shown in XY plot. How to do this?

My requirement is to display the peak amplitudes with their time index not array index. Pl. help. Thanks a lot in Advance. 


You know t0, dt, and data if you are getting the waveform data from your DAQ. You did not show any block diagram, but this can be done with DAQmx. Use a waveform plot instead of a XY plot, there you specify t0, dt, and the data in a cluster. 

 

To get the time index is simple math, use t0 and dt to convert your array index to a time index; ie, index 0 is t0 and each index is spaced by dt.

0 Kudos
Message 2 of 17
(367 Views)

Assuming that the points are equally spaced in time (are they?) There is a direct linear relation between array index and time (since you apparently know t0 and dt).For any given index i, the corresponding time will be ti=i*dt + t0

 

If the points are not equally spaced, you must have an array of times that you can index into. Do both channels have the same time base?

 

Once you show us your code, we can give more specific advice. It feels like you are over-complicating things. We have no idea how the raw data looks like (waveform, dynamic, complex, etc.) and the solution will depend on it.

 

0 Kudos
Message 3 of 17
(343 Views)

@mcduff and @altenbach

 

Hi, Thanks for your support. And sorry for not providing the Block Diagram Details. I have attached the entire details.

 

I can't get the t0, dt values here. As in the attached screenshot, got a peak of 4.50127 at 105 index for Channel 1 and  got a peak of 4.71881 at 152 index for Channel 2. How to know the time as displayed in the XY graph? Example: At 4.8 seconds of time, the maximum peak for Channel 1 is 4.5. And at 6.3 seconds of time, the maximum peak for Channel 2 is 4.71.  

 

 

0 Kudos
Message 4 of 17
(308 Views)

@srsannasi wrote:

And sorry for not providing the Block Diagram Details. I have attached the entire details.

.  

 

 


A "picture" of a block diagram is not a block diagram and typically quite useless.

 

For example we cannot even tell if some of the shift registers are not initialize or if their wire is hidden behind the loop. You also seems to be using some foreign VIs (e.g. the one that says "sort" on it. Who wrote it and what does it do?) We also cannot really tell what the loop timing is. Then we have these messy right-to-left wiring for no obvious reason.

 

Apparently, you do software timing of 1 sample/channel  at a time and measure the actual time. Is there a reason you are no using hardware timing? How much jitter is in the timing? In any case, and assuming that ALL shift registers are initialized with an empty array, all you need to get the corresponding time by using the indices to index into the array of times.

0 Kudos
Message 5 of 17
(301 Views)

Simple answer: you already have timestamps in relative seconds. It's the time array you build in the upper part fo the loop. The graph X scale is also in seconds.

The question arises about how accurate is this software timing. Usually the maximum precision is reached performing a continuous measurement (N Chan N Samp), because the frequency is determined by hardware.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 17
(294 Views)

Yes, I have attached the VI now. I got the SORT PEAKS.VI from the Sound and Vibration Add-on. Thank you.

0 Kudos
Message 7 of 17
(289 Views)

@pincpanter

 

Yes, thank you. As you said, I got the time for the entire period from the appended time array. But the problem of mine is knowing the time of the peak amplitude. 

0 Kudos
Message 8 of 17
(284 Views)

@srsannasi  ha scritto:

@pincpanter

 

Yes, thank you. As you said, I got the time for the entire period from the appended time array. But the problem of mine is knowing the time of the peak amplitude. 


I'm quite confused. From what you wrote before (for example: My requirement is to display the peak amplitudes with their time index not array index), I thought you are able to get peak positions in terms of index.

 
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 17
(279 Views)

@pincpanter

 

Yes, I got the array index for the corresponding peak. The thing is to know the timing of that peak. Pl refer to the attachment. Thank you.

0 Kudos
Message 10 of 17
(275 Views)