LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Recording Freezes When Value Reaches Zero

Hello,

We are using a cDAQ-9174 with 2 TB-9212 and a NI-9220 input module. We are reading from 8 thermocouples and 5 pressure transducers. The program we are creating is for flow test in a wind tunnel and the various measurements taken go into calculations to find the airflow. There are 2 static pressure transducers, 1 total pressure, 1 barometric and 1 delta pressure transducer. The data records just fine up until the point the delta pressure reading goes to zero, at that point it "freezes" and no more data points are recorded. I'd greatly appreciate any feedback including my overall layout and design of the program, different methods to do something I have done or any other input as well. I've only used LabVIEW for a few weeks now and my coding skills are not very strong yet. I have posted a snippet of the program but if you want snippets of the sub-vi's feel free to let me know. Thanks for your help!

 

JustoFig 15_Phase 3.png

 

0 Kudos
Message 1 of 8
(2,826 Views)

Pressure goes to the mathscript node as a variable pb.

What happens in there?  Rho uses the value pb in the divisor.  So it seems like you are getting a divide by zero error.  Or if not an error, a very large number.

 

I don't see any loop in your code, so I don't know how you are running this.  Attaching a VI rather than a screenshot snippet would help that way we can see the rest of the code and see what is happening in all those express VI's.

Message 2 of 8
(2,816 Views)

Thank for your reply. I missed the while loop around the whole thing in the snippet I will attach the file itself. That pb is barometric in inches mercury and it's usually a value around 29. All other pressures are inches water and they vary from 0-5. After you mentioned that I started going through the equations again and realized it's used in the sub vi titled nozzle coefficient to find a Reynolds number and there is a division by Reynolds for the discharge coefficient. That must be where the problem, is there anything I can do to get by that? Thanks again for your help it is much appreciated!

0 Kudos
Message 3 of 8
(2,764 Views)

I'd put either probes or indicators on all inputs and outputs of the "Q" node on the top right of the diagram.  See if "NaN" is an input or output.

 

One thing that's not obvious about NaN is that literally any comparison to it and another number returns False, and any math operation between it and another number gives you another NaN.  This is true for all things, some of which are really counterintuitive...  For instance, checking to see if NaN equals NaN returns False, and zero times NaN equals NaN.

Message 4 of 8
(2,761 Views)

Forgot to mention that the culprit here is delta pressure, dP. Hmm, okay I will try that and see what I am getting. Would that cause it to stop producing data? I assumed that I would just get a bunch of NaN's repeatedly as long as it was running. Thanks Kyle97330.

0 Kudos
Message 5 of 8
(2,756 Views)

Okay I found where it's getting caught up. It's in the Reynolds calculation sub vi. I use a case structure and need to figure out how to add a 3rd case with another comparison and set a predetermined value to return when it encounters a NaN. I will look into it and keep you updated thanks again for both of your help.

 

This is a snip of the vi while it is running through an infinite loop.Reynolds NaN error.PNG

0 Kudos
Message 6 of 8
(2,748 Views)

Generally the way to look for NaNs that's best is to use the "Not a Number/Path/Refnum" node in the "Comparison" palette.  It's the only operation that returns True for NaN and False for any other number.

 

The other way is that you have to pre-verify any number which could end up as part of a denominator in your calculations to see if it could cause the entire denominator to go to 0.  And (unless you're using complex number data types) also check that any number inside a square root function won't make the root go imaginary.

 

Whichever one makes more logical sense to check for is up to you.

0 Kudos
Message 7 of 8
(2,732 Views)

Awesome, thanks again for all your help. Found the issue and is running fine now. This is the part of the code that was bugging out and inserted an extra node to account for when the delta pressure is zero therefore making Reynolds zero which is later the denominator for the coefficient.

 

Reynolds Calc Phase 3.png

0 Kudos
Message 8 of 8
(2,708 Views)