LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire mA continuously and average only when the "average" button is pressed.

Solved!
Go to solution

I want to acquire 4-20mA from flow meters continuously and show as "live values" and average the live values for a particular period decided by the press of a button. Every time I press the start/stop averaging buttons, the mean value should update to the new mean value.

I did the program using queue and 2 loops and averaging works fine. But once I stop averaging, start averaging won't work again unless I rerun the whole program.

Can someone look into the vi.

 

0 Kudos
Message 1 of 15
(3,948 Views)

Hi Ayoob,

 

unfortunately you attached your VI in LV2019. Using an older LabVIEW version might get you more audience. (I would like LV2017…)

 

check.png

Basic concept:

  • the producer sends DAQ data into a queue when you want to do averaging.
  • the consumer reads the DAQ data and calculates the average. In case of "TimeOut" (while reading the queue) the average calculation is reset…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 15
(3,933 Views)

Thanks GerdW

Updated the file to LV2016. Can you check now.

0 Kudos
Message 3 of 15
(3,921 Views)
Solution
Accepted by Ayoob

Hi Ayoob,

 

use less DDT wires…

 

check.png

When reading multiple channels with multiple samples you should get a 2D array after the DAQAssistent (instead of your 1D array)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 15
(3,899 Views)

I would always compute the mean, show both in a chart with legend and the operator can select what he wants to see.

(Hint: Make the mean the first channel, looks better 😉 )

 

chartmean.png

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 5 of 15
(3,884 Views)

Thanks GerdW,

I was trying to show the number of samples averaged (or tie of averaging). I implemented it using 2 feedback node. It works.

 

Download All
0 Kudos
Message 6 of 15
(3,815 Views)

Hi Ayoob,

 

again you attached your VI just for LV2019…

 

I implemented it using 2 feedback node.

Wow, that looks complicated!

Why not simply use ArraySize (or MatrixSize) to read the number of samples and add them up using a (read: "one") shift register?

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 15
(3,807 Views)

Hi GerdW,

Sorry i forget to change the version.

I knew there will be a better way, but still i tried to find a solution of my own. I tried the array/matrix method also but did not use shift register. I will try that.

0 Kudos
Message 8 of 15
(3,789 Views)

Hi Ayoob,

 

one shift register is enough:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 15
(3,786 Views)

Hi GerdW,

Im facing a problem using this method. It looks like the mean I am getting is a moving average. But what I need is a single average of all values between pressing start and stop the same like what happens in the attached program. Is there any solution for that. I tried many ways but data flow makes the program freeze at different places.

Attached is the first version I made. averaging in this version is good, but in this one when I press the stop button the live reading also stops.

0 Kudos
Message 10 of 15
(3,714 Views)