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: 

Point by point counting within a window

Solved!
Go to solution

Hi I'm a labview 8.5 user working in the field of aerodynamics - namely laminar to turbulent boundary layer transition.

 

I want to take a high pass filtered signal, rectify it, then place a window around the remaining signal (equivalent to 10% of the unfiltered signal mean) and count the number of points inside and outside the window.  I can use a histogram for this as in the attached vi but I need to do a point by point analysis because things transiting through the window faster than a residence time criteria should be deemed as turbulent instead of laminar.

 

To say this more explicitly any points greater than 10%mean get digitally assigned 1, anything less 0, but let's say that at one section of the signal less than 10 consecutive zero points are sandwiched between two 1's then they should be assigned as 1 also.  Where 10 consecutive points at my sampling frequency is equivalent to my critical residence time.

 

I hope I've given an adequate description of what I'm trying to achieve, could someone help direct me to achieve this please?  I'm not too concerned with which filters, frequency settings etc. are used at the moment.

 

Thank you.

---------------------------------------------------

LabVIEW 8.5 User.
0 Kudos
Message 1 of 13
(3,112 Views)

Ok maybe this attachment can help.

 

Anything in the rectified signal which is greater than 0.3 leads to logic high.  However, I want the gap highlighted by the arrow to also be logic high as it's time-span is less than my residence time criteria.  Any suggestions for how to tackle this problem?

 

Thanks.

---------------------------------------------------

LabVIEW 8.5 User.
0 Kudos
Message 2 of 13
(3,087 Views)

I get the feeling I may be the only one interested in this problem ha. Smiley Tongue

 

Example Signal


1

1

1

0    ***

0

0

0

1

0

0

1

 

The logic I wish to implement:

  • Find the next zero in the signal (***).
  • Quantify how many consecutive zeros there are downstream of this point (***) to the next rising edge.
  • If there are fewer consecutive zeros than NRES (the threshold residence time) or an equivalent amount, replace each of those zeros in the street with a one.
  • If the number of consecutive zeros exceeds NRES then move to the next zero downstream of a falling edge.

Let’s say for the above example signal with NRES = 3 then effectively I want to ignore the first street of 0’s but not the second so that the signal ends up as (1 1 1 0 0 0 0 1 1 1 1).

 

So far I have been able to update my dynamic data type signal by using shift registers and adding arrays which have been initialised with 1’s, however being able to automatically establish the size of the substitute array and determine its placement, based on the intended logic, is something I haven’t been able to achieve yet.  This isn't a blog, sorry to keep bumping the post up!

---------------------------------------------------

LabVIEW 8.5 User.
0 Kudos
Message 3 of 13
(3,056 Views)
Solution
Accepted by topic author cevert73

Solved.  Yeeha!

 

I'd like to thank my family, friends (if I have any) and sponsors...

---------------------------------------------------

LabVIEW 8.5 User.
0 Kudos
Message 4 of 13
(3,048 Views)

You are kidding, right? Your code seems way to complicated. (Also, your sequence structure is not necessary because execution order is uniquely determined by dataflow already. Why clutter the diagram?)

 

Here's what I would probably do. Plase check for errors. 😉

 

 

 

Many improvements are still possible...

Download All
Message 5 of 13
(3,040 Views)

Thanks!  My lax use of the word "solved" was somewhat controversial but I wasn't too concerned since I was mostly talking to myself!  I've been looking for a way to achieve it first and then incorporate it in the rest of my code.

 

I'll get back to you soon when I have another chance to look at this in more detail and perhaps talk more about the wider problem.

 

Thanks very much!

---------------------------------------------------

LabVIEW 8.5 User.
0 Kudos
Message 6 of 13
(3,026 Views)

There are also many input arrays that cause your code to run forever without producing a result. (Try e.g. an empty array, an array with only one gap, an array without gaps, etc.). 

 

0 Kudos
Message 7 of 13
(3,024 Views)

Ok, your solution appears to have been successfully implemented in the rest of my code and as you say what I had written was something of a one trick pony. Smiley Happy

 

Now what I need to be able to do, in order to determine my high-pass filter frequency and nres, is to ascertain what's termed the boundary layer thickness, delta, and freestream velocity, U.  The nomenclature is pictorially represented in the attached figure.

 

Source for figure: http://www.cortana.com/Drag_Description.htm

 

I've knocked together a quick (attached) vi which calculates a theoretical local velocity profile (Pohlhausen) through the boundary layer where I wish to seek the y location where u (the local velocity) = 0.99*U, where in this case U = 1 m/s.

 

So from the wall (where y = 0) I need to traverse out until I reach the first point where u > 0.99*U and then perform linear interpolation for 0.99*U with the previous y location.  The reason it has to be this way is because of the experimental scatter that will be involved when not dealing with idealised profiles and infact I may have to use 0.95*U but I can arrive at that decision later.  Now I can use the search 1D array function to find where u > 0.99*U but how do I efficiently obtain y?

 

As for U, that will probably just be a case of using the point furthest from the plate at the end of the traverse.

---------------------------------------------------

LabVIEW 8.5 User.
Download All
0 Kudos
Message 8 of 13
(3,003 Views)

The attached is what I came up with for a linear interpolation algorithm suited to this problem.  It seems to work as planned.

 

Any comments as to how it could be improved?  Thanks.

---------------------------------------------------

LabVIEW 8.5 User.
0 Kudos
Message 9 of 13
(2,994 Views)

You still have way too much garbage code and inefficiencies.

 

  1. FOR loop: controls and indicators belong outside the loop. No need to read/update during the loop. If the y would change during the FOR loop, all bets would be off.
  2. FOR loop: "index array connected to [i] is (basically) the same as autoindexing on an input tunnel.
  3. FOR loop: Build the array using an autoindexing output tunnel
  4. Use of the formula express VI makess the code unreadable, you can sue an expressions node or polynomial evaluation.
  5. While loop: Again, the fraction terminal needs to be outside the loop, because it is not allowed to change during execution of the loop.
  6. While loop: There are many input scenarios where the loop will never stop. Very dangerous!
  7. There is no need to wire the +1 index. Whenever it is left unwired it assumes the "input above+1"
  8. Again using the formula for the final interpolation seems clumsy.

Assuming that the polynomial u is non-descending, all you need is the following code.

 

There are probably even better ways, but this should get you started.

 

Download All
0 Kudos
Message 10 of 13
(2,983 Views)