From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger data acquisition for a limited set of values using DAQ Assistant?

RavensFan,

 

I've been studying the tutorials and reading up on case structures specifically as well, but I'm having trouble knowing what to input to the case selector for what I'm trying to achieve. If I wanted to have a case structure for the Write to File VI, how would you set up the case selector to only accept data values that are between 10 lbs and the 3 peak values?

 

Thanks

jpartain_0-1581605720163.png

 

0 Kudos
Message 11 of 18
(732 Views)

I'm developing a code for data acquisition from 3 load cells simultaneously. I'm trying to set up my code such that it only saves data points that are within a certain range, but nothing I have tried so far has worked as I intended. It seems like the best way to do it is to use a case structure, but I am open to other solutions as well. I am not receiving any Error notifications, but it still saves data outside of the range that I want. See below for the code and a couple snapshots of the case structure in the True and False case so far. I'm still a beginner in LabVIEW so any tips are appreciated. 

Thanks!

 

jpartain_0-1581694655534.png

jpartain_1-1581694697082.png

 

 

0 Kudos
Message 12 of 18
(747 Views)

Sorry, I don't have drivers installed, so I cannot tell how your express VIs are configured. What's exactly is inside the various dynamic data wires?

 

What do you want to write to your file? From all the data inside the dynamic wire, the case structure only cares about the first element. This is probably not what you want. Do you want to keep all the points in a given range or save all current data if the first point is in a given range? How are you planning to keep the timing information (points are no longer spaced equally)?

 

Mixing scalars and dynamic data like you do here seems like a bad idea. You also have way too much duplicate code. 

 

Can't you operate on array data instead? Most experienced programmers don't use dynamic data and express VIs.

0 Kudos
Message 13 of 18
(730 Views)

I second what Altenbach said. Also, writing to a hard disk every loop iteration is not very common because it can really slow things down. You can collect all of your data and then write it after your loop finishes. To see if a value is within the range you need, you can use "in range and coerce". In a for loop indexing terminal you can right click the terminal and select "conditional" which adds a boolean input to let you filter your data.

0 Kudos
Message 14 of 18
(705 Views)

Something like this would get you started:

 

Example.png

Tim
GHSP
0 Kudos
Message 15 of 18
(696 Views)

I would replace the code in the for loop with min&max (and remove the for loop). Lower sr needs to be initialized with an array of -inf if negative readings are a possibility (and eliminate the first run case structure). I would add an array of three constants, eliminating the build array. Etc...

 

(Posting by phone, cannot look at code and see what's in the other cases/events, so not all comments might apply)

0 Kudos
Message 16 of 18
(690 Views)

Thank you everyone for your help and suggestions. I have a lot to learn! I will study up on everything you all have offered and see if I can make it work. 

0 Kudos
Message 17 of 18
(673 Views)

that's how it could look like with my suggestions added:

 

altenbach_0-1581713363539.png

 

Of course there are serious problems with the ever-growing data structures in the history array. It would be better to keep a fixed sized history, of course. You'll run out of memory otherwise.

 

 

 

0 Kudos
Message 18 of 18
(666 Views)