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: 

LoopIndex seems to be incorrectly coerced to an integer

I think this is a fault report to NI, but if anyone has a workaround then that would be much appreciated.
 
I have a need to query a step's LoopIndex, via the TestStand 3.5 API from LabVIEW 8.2.  This LoopIndex is a property directly from the Sequence Context.  It's an integer data type, which makes sense in most circumstances.
 
However, TestStand allows custom loops to be made where the LoopIndex is something other than an integer.  For example, I could make a loop that increments from 0.25 to 0.28 in steps of 0.01, as shown:
 
 
The problem is that if I query the LoopIndex from the API for each iteration of the loop, its value in each case is zero.  Basically, any fractional part is lost.
 
Is there a way of getting hold of the fractional value that TestStand has, via the API?

Message Edited by Sean on 12-06-2006 10:35 AM

Message Edited by Sean on 12-06-2006 10:35 AM

0 Kudos
Message 1 of 10
(3,713 Views)

Sean,

Confused from your comment "The problem is that if I query the LoopIndex from the API for each iteration of the loop, its value in each case is zero."

You have a step which is using None Adapter and its looping, how are you doing the querying with the API.

Can you post an example.

Regards

Ray Farmer

 
Regards
Ray Farmer
0 Kudos
Message 2 of 10
(3,695 Views)

I didn't want to over-complicate the issue.  But what I'm attempting to do is modify the process model so that, among other things, the looping variable is recorded.

There are valid reasons for using a fractional LoopIndex.  If a step measures the current, and it is run multiple times then the loop could step through (say) 0.5V increments.  This is fully supported by TestStand, and it works perfectly.

The process model gets the reference for each step.  I can then use the API to find out the LoopIndex and this all works perfectly, IF the LoopIndex is an integer.

If the LoopIndex is set to increment through these values:

0, 0.5, 1, 1.5, 2

Then the values read from the API are:

0, 0, 1, 1, 2

I believe this is a fault report, so if anyone from NI wants to log this as a report then please say so.  Otherwise I'll go through whatever official channels there are.

0 Kudos
Message 3 of 10
(3,680 Views)
How are you reading the API? If I put in a step and set it to loop as you have done, when I create a watch expression for RunState.LoopIndex, I see the fractional values that match the increment setting.
0 Kudos
Message 4 of 10
(3,669 Views)
Hi,
 
It might be easier if you throw up your sequence file for me (a simplified version that shows the problem)
and I can either look into and work out what is going on, or report it as a "feature" (we don't have bugs!) ha ha! Smiley Wink
 
Thanx
 
AdamB
Applications Engineering Team Leader | National Instruments | UK & Ireland
Message 5 of 10
(3,662 Views)
Here's a simple demo consisting of a single-step sequence and a VI, together in the attached zip file.  I've also included screenshots of the loop options and one of the iterations that shows the issue.
 
The option to pass it as a variable (as I have done in the demo) isn't an option in our real application, as I'm actually qerying the LoopIndex from the Process Model, not from the step itself.
 
I would be grateful if NI could let me know when this will be fixed.  It just needs the API datatype to be a double instead of an integer...
 
 

Message Edited by Sean on 12-08-2006 11:06 AM

Download All
Message 6 of 10
(3,647 Views)
Here is how to get the loop index as a double via the API:
 
Message 7 of 10
(3,628 Views)

Absolutely brilliant, thanks for the workaround.  That works superbly.

I forgot about the antique LabVIEW/TestStand functions - I don't normally need them these days.

The API itself is still wrong though - is anyone from NI able to log this?

0 Kudos
Message 8 of 10
(3,583 Views)

We can't change the property type without breaking backwards compatibility. However, in a future version of TestStand, the help for that property will note the issue and the work-around.

0 Kudos
Message 9 of 10
(3,563 Views)

I understand.

The only issue remaining is to find out which idiot gave my earlier message a 1* rating.

Thanks again for your help there.

Message 10 of 10
(3,555 Views)