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: 

Execution of TestStand-Sequence in LabVIEW via TS-API: Different Execution times for same sequence

Solved!
Go to solution

Hello Forum-Members,

 

I have a problem concerning the execution of an TestStand-Sequence in LabVIEW. I have created a VI that offers the ability to choose a TestStand-Sequence-File and then executes the sequence using the TestStand-API. The implementation is based on an example in C++-Application found following this link:

http://forums.ni.com/t5/NI-TestStand/Unreleased-references-using-engine-API-in-C/m-p/2927314#M46034

 

The implementation works quite solid in case the VI is executed the first time. The VI processes the chosen sequence in a acceptable duration.

But in case the execution is started a second time, the execution of the sequence takes ca. 30sec more than in the first case.

 

Until now I have not found a solution and hope someones got a hint concerning this problem...

I am using LabVIEW 2013 and TestStand 2013.

I have attached my own VI, a sample sequence with a small sample VI, so you can reproduce the problem.

 

Kind regards,

TobiKi

 

 

Download All
0 Kudos
Message 1 of 13
(6,401 Views)

Tobi,

 

you shouldn't use "WaitForEndEx" in your UI. Please refer to the help of this function:

This method is not meant to be used by a user interface or sequence editor, as it does not process UIMessages. Instead, use this method from a step to synchronize with another execution.

 

Also: What is taking longer? The whole UI? The sequence itself?

Do you get any dialog popups while the TS engine is shutting down? If not, do you have the Debug Options configured to show reference leaks?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 13
(6,341 Views)

Hi Norbert,

 

first thanks for your answer.

 

What would be a reasonable way to replace the "Execution.WaitForEndEx"? My first idea is to get the respective thread of the execution and use the "Thread.WaitForEnd".

 

To clarify my problem:

The execution of the sequence itself takes longer time and so the execution of the calling VI. I have attached pictures of the log file of the first and second execution.

Further I don't get any dialog popups during the shutdown of TestStand. (I have activated the "ReportObjectLeaks" using the "DebugOptions") While developing the attached VI I've gotten several popups. But these popups disappeared after closing all references.

 

Maybe you have another hint how to locate the problem.

 

TobiKi

Download All
0 Kudos
Message 3 of 13
(6,217 Views)

Tobi,

 

the best way to get information about "Execution has finished" is directly accessible as "User Interface Message". So you should extend your calling VI to handle UIMsg'es. You would wait for the UIMsg with code 'EndExecution'.

A potential stumbling block is that the EndExecution is sent for EVERY execution which finishes. As for instance LoginLogout is a sequence, you will get an EndExecution for that as well. So you have to take care to watch out for the correct (expected) EndExecution rather than all of them.

 

Closing a reference is one way to release objects. But there are objects which have specific cleanup/shutdown/release methods. If so, you should call them rather than simply killing the reference (hence the object behind it).

Best example is the Sequence object where you already use the correct method: ReleaseSequenceFileEx.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 13
(6,205 Views)

Hi Norbert,

 

I wanted to follow your advice and implement the TS UI messages in my calling VI.

 

To get into the topic "UI messages in TestStand" I searched for a simple example thats a bit similar to my target application and found the following on the NI-Website:

 

https://decibel.ni.com/content/docs/DOC-38982

 

I've started the Top-Level VI (" BasicUIwithNativeControls.vi") of this project, loaded a sequence file and executed it. The VI was executed as expected (about 6 seconds). After the designated end of the execution I've stopped the Top-Level-VI using the X-Button of the application-window. The appropriate Project left open. Afterwards I've started the Top-Level-VI again and repeated the loading/execution procedure. The second execution took a longer time (about 30).

In case I shut down LabVIEW between the two executions of the sequence, both executions take the same duration (about 6 seconds).

 

Now I'm asking myself if I'm on the wrong track with my debugging attempt, because the example shows the same behavior as my own created VI.

 

Thanking you in anticipation

0 Kudos
Message 5 of 13
(6,118 Views)

Tobi,

 

i followed your description on how you reproduced the issue with the example. I use TS 2014 and LV 2014, both 32bits running on Win7 64bits.

I cannot reproduce the issue. Do you use 32bits LV as well?

 

Therefore, i request you to try a different machine.

Also, you might check if configuration of the "LabVIEW Adapter" to "Runtime Engine" changes the performance.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 13
(6,115 Views)

I have already tried to use another machine. On both machines the following software versions are installed:

- Win7 (64bit)

- LabVIEW 2013 (32bit)

- TestStand 2013 (32bit)

 

A difference occured during the execution of the example on the second machine (lower performance system). The second execution takes more time (about 70seconds) as on the more powerful system (30 seconds).

 

Further I tested the setting of "Always Run VI on LabVIEW Run-time Engine" for the VI in the TestStand-Sequence. There were no major differences between the execution duration of the first and the second execution of the sequence. (The first execution has been executed a little bit faster)

 

That the reproduction on your system did not lead to the same (erroneous) result is a ray of hope for me. 🙂

Have my instructions been comprehensible or is further description necessary to resolve all doubt?

0 Kudos
Message 7 of 13
(6,113 Views)

Does running the sequence show the same behavior when using the NI Sequence Editor as UI?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 8 of 13
(6,109 Views)

No. In case the sequence is executed in the TestStand sequence editor UI the execution time is about the same for several "Single Pass" Tests.

 

Best Regards

TobiKi 

0 Kudos
Message 9 of 13
(6,077 Views)

Tobi,

 

so i understand that the issue does NOT occur if you use any default NI UIs (including the provided UI examples/"templates") but in your adopted UI, it occurs.

Is that correct?

 

If so, can you provide the source code?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 10 of 13
(6,073 Views)