NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to share notification step with LabView (Execute "Set" operation from LabView)

Hi Paul,

I know what is wrong.
If you loop the GetNot.vi (in the PreUUT), you will see that the ref change every time you read. That is what I ment when I told you that the refs are changing continuously.
So when you try to set the notification, the ref has changed.
But I don't know how to solve this 😞

Regards
Richard
0 Kudos
Message 11 of 17
(2,240 Views)

Richard,

I have duplicated your example in TS 3.0 and I do see the references changing.  I also created a simpler example that exhibits the same problem.  I'll attach it so other can see the problem because I honestly don't know how it is happening.  It is almost as if the reference changes after the VI returns to teststand.  I created a LV global that passes the reference instead of the function global that you are using.  Once you store it in the global and then call the one that sets it they don't match anymore. (have the VI front panel open so you can see the references change)

The only solution I can think of at this moment is to not use the functional global to store the references but get them from TS directly when the start button is pressed.  Not exactly sure how to do this yet but it should be possible.

Any one else have some ideas?

Paul

0 Kudos
Message 12 of 17
(2,225 Views)

Richard,

I was able to set a notification to kick of a parallel testsocket by modifying your example.  It actually will simplify it a bit.  Don't bother with storing the references in an LV array.  Just access the references from teststand when you need them.  What I did was to modify your example and you only need the PreUUT callback and a modified version of StatusWindow.vi.  Call the sequence that contains the StatusWindow.vi with it set to run in a separate thread as before but call it from the PreUUT sequence before the wait.  Set the sequence call with a precondition for testsocket index of zero so it only runs once.  Also, modify the sequence to have a parameter for the modelData container, same parameter as the PreUUT (copy and paste it from the PreUUT parameter).  Then you can get the notification references from the sequence context in that sequence.  If this is set up correctly you can modify the VI as shown in the picture and be able to set the notification.

I'll see if I can clean up my files so you can get those...

Paul

Message Edited by paulmw on 09-13-2007 01:51 PM

0 Kudos
Message 13 of 17
(2,224 Views)

Here is my example code.

I deleted the last close reference that is shown in the picture in my last post...

Also, the VI needs to be open, it is not set to open the front panel on its own.

Issues: I don't know what will happen when TS 0's PreUUT runs again, nothing is preventing it from running the new-thread-sequence.  I don't check to see how many testsockets are initialized. Plus I am sure there are other things that aren't being considered.

0 Kudos
Message 14 of 17
(2,214 Views)
Hi Paul,

Very nice! Thanks

regards
Richard


0 Kudos
Message 15 of 17
(2,192 Views)

Anyone who can give an answer to message 12 in this thread? NI?

http://forums.ni.com/ni/board/message?board.id=330&thread.id=16135&view=by_date_ascending&page=2

Thanks

Regards
Tom Andres Lomsdalen, CTD
0 Kudos
Message 16 of 17
(1,849 Views)

Tom -

In general, when code is passed a COM reference and the code wants to hold onto the reference in a global even after returning from the call, the code must add a reference to the object so that the server of the object knows that the object must be not destroyed. It is also the responsibility of the code that is holding onto the reference in the global to release the reference to the object when it is no longer needed.  LabVIEW is no different.

 

So here is more details. When TestStand asks LabVIEW to run the VI, TestStand passes the reference as a paramater to LabVIEW server method to run the VI. COM creates a proxy to the reference and gives the proxy reference to the server. Your Vi then stores the value of the proxy reference in the global. When you VI completes and returns to TestStand, COM releases the proxy reference, so the value in the global is no longer valid.

 

The Using TestStand with LabVIEW does not explicitly discuss this case, and it should, so I will look at adding more documentation for the future. Basically you need to add or duplicate the reference to object passed into LabVIEW by calling the VariantToData function. Pass in the existing reference, set the type input to the same type of the reference, and the output will be the duplicate reference. You can assign the duplicate reference to the global.

 

Note that you must later read the value from the global, explicitly call the Close Reference function with that reference, and then assign a Not A Refnum Constant to the global to invalidate it.

Scott Richardson
https://testeract.com
0 Kudos
Message 17 of 17
(1,728 Views)