09-30-2013 03:52 AM
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:
This way, the PostUIMessageEx doesn't do anything, so I suppose it doesn't like my attempt to send the array...
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! 🙂
09-30-2013 04:08 AM
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
09-30-2013 06:57 AM
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.
09-30-2013 07:06 AM
Perhaps I should have added that the screenshot is not from the SimpleOI block diagram! 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 🙂
09-30-2013 07:12 AM
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
09-30-2013 10:54 AM
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
10-01-2013 02:19 AM
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:
10-01-2013 10:27 AM - edited 10-01-2013 10:28 AM
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