NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

PostUIMessageEx to send array from Labview

Hi dear forum,

 

I'm adding 8 indicators to the Labview version of the Simple Operator Interface, and they will display data from an action engine which is used by my test case modules. I've figured out that PostUIMessageEx is a good way to make the data available to the OI, but I just can't figure out how to send an array from Labview.

 

I have seen examples and forum threads describing how to send arrays from TestStand to the OI using this method, but I don't understand how to "format" an array to make it possible to send it in the activeXDataParam field in a VI. This picture shows what I'm trying to do:

 

 

PostUIMessageEx_Array.png

 

This way, the PostUIMessageEx doesn't do anything, so I suppose it doesn't like my attempt to send the array... Smiley Embarassed

 

Is it even possible to send an array from Labview? 🙂 Or is my best bet to simply put the PostUIMessageEx inside the for loop and send each of the numbers as a separate message?

 

Help is greatly appreciated! 🙂

 

 

 

0 Kudos
Message 1 of 8
(4,453 Views)

I think you have a misunderstanding about UIMessages.

They are ALWAYS sent by TestStand to the User Interface. Not the other direction.

 

They are used to transfer data from your TestStand dataset to the UI in the first instance.

The second instance is to provide the UI the possibility to reply. In order to do so, you send an UIMessage FROM the TS execution to the UI containing access to the current execution's dataset in form of "ThisContext".

The callback function in the UI for the UIMessage event can then access the Context to write data back to TS using "SetVal<datatype>" functions.

 

The code in your screenshot "works in the wrong direction".

 

Norbert

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

Thanks for your reply, I'm not sure if we are on the same page here 🙂 I'm not actually trying to send data to TestStand. If anything, I'm trying to cut the middle man (by which I mean TestStand) and continuously send data to the UI from a code module during the execution of my automatic test.

 

This seems like perfectly legitimate use in this white paper: Using TestStand User Interface Messages (UI Messages) But maybe I'm missing something obvious? I have provided the "ThisContext" to the code module, and it can send numbers and strings to the UI without any problems, the Callback is working fine.

 

But if this approach is wrong, then I'd appreciate any other suggestions on how to solve my problem. To rephrase the question: How can I add indicators to the Simple Operator Interface that display data from an Action Engine used by my test case modules and their hardware communication handlers (that run asynchronously in the background during the test)? The thing is that the OI can't read data directly from the Action Engine since the AE is in a different Application Instance (or execution or whichever is which). So if I put the AE in the Simple OI VI, it will be a different instance of the AE than the one that is used by my Test Case VI modules.

0 Kudos
Message 3 of 8
(4,443 Views)

Perhaps I should have added that the screenshot is not from the SimpleOI block diagram! Smiley Tongue It's from a communication handler VI that runs in the background during the test (started asynchronously by TestStand). These communication handlers get data from the hardware (cDAQ) and stores it in Action Engines that are used in my test cases. Sorry about that 🙂

0 Kudos
Message 4 of 8
(4,442 Views)

Data is acquired by a continuously running VI concurrent to the sequence execution and the UI. Correct?

 

There are several possible solutions for this. I think you should take a look into this discussion, as it touches most of the information you need.

 

That being said, using TS UIMessages to transfer data between parallel running VIs is not the way it works....

 

Norbert

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

If you convert the array to a TestStand array and pass that as the activeX data parameter that would work. There are many ways to do things though, so I'm not sure what the best approach for you would be.

 

-Doug

0 Kudos
Message 6 of 8
(4,425 Views)

Norbert:

Yes, correct. The first step in the sequence is to start the communication handlers asynchronously. I first considered TCP/IP for sending data to the OI from a communication handler, but this company is very strict when it comes to TCP/IP which means that we are always in for a lot of trouble whenever we are looking in that direction...

 

The CVT method looks like a regular Action Engine, but my problem is that they are in different application instances. Would a CVT really do the trick here? I mean, wouldn't I still have the same problem, that the OI and the Test Case Modules use different instances of the CVT?

 

When you say it's not the way it works - do you mean that it will not actually work at all, or that the performance of PostUIMessageEx is too slow to run that often (every 25 or 50ms), or simply that it works but is bad programming practise?

 

 

Doug:

Yes, that was my thought in the first place (red arrow in the screenshot). I'm just clueless on how to do the conversion. Any ideas?

 

Anyone:

Would it be better to use the "TestStand - Set Property Value" in the communication handler, and add a loop in the OI that uses Get Property Value to read this value every 25-50 ms? Like this:

SetPropertyValue.png 

0 Kudos
Message 7 of 8
(4,414 Views)

use seqcontext.Engine.NewPropertyObject() to create the teststand array of numbers

 

Add elements to this with propertyobject.SetValNumberByOffset(i, PropOption_InsertElement, currentElement) (or use helper vis from the TestStand palette for setting/getting arrays)

 

Pass the property object for the ActiveXData parameter.

 

-Doug

Message 8 of 8
(4,396 Views)