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: 

Count instances of a value in an changing array

Solved!
Go to solution

Hello,

 

I am encountering an issue that i can't efficiently handle. I am using a cDAQ chassis with a group of 9221 Voltage monitoring modules and a 9474 as a Digital source to run a high volume lab test. I am reading in a 1D Double array of values from the 9221 and comparing that value to a control value to indicator whether the value is as it should be and thus being capable of determining if a part passes or fails. I then read those failures as a boolean array and using a searching loop determine all the indexes of failure so that they can be logged into a file with other serializing information that is determined at the beginning of the application. The tests conducted are at a reasonable frequency say 60 Hz. and are conducted for large cycles say upwards of millions of cycles, the DAQ analysis programming must be capable of keeping up with those requirements. 

 

The problem I'm encountering is that the failure detection indication system has an unintelligent output in the sense that if a part fails and continues to fail the failure can be logged for hundred of thousands of cycles which is just unnecessary information. I am looking to try to set-up a failure limitation in that if a particular part i.e. a particular index in our input array fails more that a user defined failure limit then that index be ignored by the file writing loop say by being set to be a constant false value. I have tried to figure out an efficent way to do that inside my Search_Array_Index.vi but I can't think of a method that won't require me to create a second boolean array and have to index search that array inside the first index search. Any help or advice will be greatly appreciated.

 

I have attached all my code for the project. The main vi is the TestCode rev1 but the workhorse is the Voltage Monitor (excuse the messy design) and the Search_Array_Index is where i have attempted to create the smart output but haven't had any luck.

 

Thank you,

Zack

0 Kudos
Message 1 of 3
(2,252 Views)
Solution
Accepted by topic author zdoughty

You could make your VI a FGV of sorts to keep track of how many times that index has failed.  If the value is greater than X, you don't add it to the array.  You will want to change the VI execution properties to be Preallocated Clone for reentrant execution so that each call keeps its own count.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 3
(2,235 Views)

It works like a charm. Thanks for the assistance.

0 Kudos
Message 3 of 3
(2,215 Views)