LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to count number true in last minute?

Hey Everyone!

 

I am new to the LabVIEW. I am acquiring the data from daq device (Potiometere) and calibrate it to angular position (which is already provided along with QNET Mechatronic sensor board). Now I want it to modify to revolution per minute. For which I need to count some true values over the interval of 1 minute. 

 

All the components are inside the control and simulation loop. The calibrated angular position is displayed in a waveform named Potentiometer (deg). I want to count how many time the potentiometer angle becomes 90 degrees in last 60 seconds only.

 

QNET_Drivers.llb and Quanser_DAQ.....llb are liberary file.

0 Kudos
Message 1 of 14
(4,016 Views)

Could you make a more punctual question? do you get an error or are you getting an unexpected result? 

0 Kudos
Message 2 of 14
(3,947 Views)


@ARVega wrote:

Could you make a more punctual question? do you get an error or are you getting an unexpected result? 


Thanks for your response.

 

In the block diagram below, I want to get Potentiometer (deg) chart data (x and y) instantly rather than at the end of control and simulation loop. But the attached block Collector is giving me the data at the end of the control and simulation loop.

0 Kudos
Message 3 of 14
(3,938 Views)

Hi Gazing,

 

I want to get Potentiometer (deg) chart data (x and y) instantly rather than at the end of control and simulation loop.

Why do you need a CS loop at all? You should use a "normal" while loop here…

When you want to plot "y vs x" data you should use a XY graph…

Which sample rate are you using? Are you sure you should read just one sample per iteration?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 14
(3,932 Views)

@GerdW wrote:

Hi Gazing,

 

I want to get Potentiometer (deg) chart data (x and y) instantly rather than at the end of control and simulation loop.

Why do you need a CS loop at all? You should use a "normal" while loop here…

When you want to plot "y vs x" data you should use a XY graph…

Which sample rate are you using? Are you sure you should read just one sample per iteration?


I want a sample rate of 100. I am using the CS loop because I need the data in real time. I will give it a try, of course.

0 Kudos
Message 5 of 14
(3,929 Views)

Hi Gazing,

 

I am using the CS loop because I need the data in real time.

And why do you need a CS loop to read data in "real time"???

The sample will be read when it becomes available according to your sample rate - regardless of the loop around the DAQmxRead function!

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 14
(3,924 Views)

I have enclosed all the stuff in "Time Loop", that's work fine, but still I can't get x and y data array so that I add it and find the summation of last 60 seconds for revolution per minute. Here I attache the VI and the library. Please have a look at it.

Download All
0 Kudos
Message 7 of 14
(3,920 Views)

Hi Gazing,

 

why do you use a timed while loop? The timing is enforced by your DAQmx task!

check.png

You only read one sample per iteration: where does your X and y information come into play?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 14
(3,915 Views)

@GerdW wrote:

Hi Gazing,

 

why do you use a timed while loop? The timing is enforced by your DAQmx task!

check.png

You only read one sample per iteration: where does your X and y information come into play?


So that I would be able to convert the iteration number to time (seconds) by multiplying with sample rate.

0 Kudos
Message 9 of 14
(3,905 Views)

Thanks for your cooperation and help. I have almost achieved my task.

 

I am comparing the "Y data" with two thresholds, i.e. 9.9 > and <10.1 to detect if the value has crossed 10 or not because it is very rare to the DAQ will collect the sample exactly at 10 (degrees) position despite I have selected 100 as the sampling rate. aaa.JPG

 

But sometimes it collects more than one sample in the said range, which increment the counter multiple times and unexpected.

0 Kudos
Message 10 of 14
(3,903 Views)