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.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Comparisons on Single Data Source: NaN vs. Large Number

Solved!
Go to solution

Hello All,

 

  Working in TestStand 2013, and came across a situation with DMM measurements, in which several values would be acceptable for the limit comparison.  For example, if I am making a resistance measurement, and I expect it to be a very high value, say greater than 1M, I would insert that as the lower limit.  However, there are also certain situations when I may see the result of "NaN" at the meter.  For the purposes of the test, any number greater that 1M would be acceptable, but a result of NaN would also be acceptable.  In an effort to keep the code modular and reusable for many instances, I am curious if there is a way in TestStand to compare the test result against two values at the same time, (i.e. >1M  OR  =NaN).  Please advise.  Thanks.

 

GSinMN  

0 Kudos
Message 1 of 7
(5,296 Views)
Solution
Accepted by topic author GSinMN

put this as your low limit:

 

Step.Result.Numeric == NAN ? NAN : 1000000

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 7
(5,291 Views)

Excellent.  Never used the "Conditional" operator before.  Now I know how.  Thanks.

 

GSinMN

0 Kudos
Message 3 of 7
(5,287 Views)

Hello Again,

 

  Tried the conditional operator by manually setting the limits (hard coding), and it appeared to work properly.  However, my objective test application is a little more complicated.  I actually read the limits from a configuration file, and inject them into the test step by use of the "TestStand - Set Property Value"  function. 

 

I have tried to inject the expression as a string, but when the step runs, it expects a number in order to set the limit, and an error occurs.  I know of functions that will convert simple decimal strings to numbers, but I am unaware of one that can handle an expression that includes the conditional operator. 

 

Looks like I either need to find a way to convert a complex string into a number, or I need to find a way to make the limit field accept a string from Labview.  I see there is also an option in the "Set Property Fuinction" for an object type, but I am unfamiliar with how that is used.  Any ideas?  Please advise.  Thanks again.

 

GSinMN       

0 Kudos
Message 4 of 7
(5,249 Views)

Probably because you are trying to set the Low limit property.  You need to set the Low Limit Expression property and set the Use Expression flag to true.

 

Consider the screen shot attached.  If UseLowExpr is False then the Low numeric property is used.  If it is True then the LowExpr property is used.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 5 of 7
(5,242 Views)

Yes, that's exactly what I was doing.  Thanks for the correction.  You're awesome, as usual.

 

 GSinMN

0 Kudos
Message 6 of 7
(5,238 Views)

Thank you for the kind words.  I'm glad it is working.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 7 of 7
(5,235 Views)