NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

object reference passing

Hi all,

 

I might be missing something basic so let me discribe what I am trying to acheive.

 

1.  I have multiple TestStand sequence files being loading dynamically at run time.

2.  A few of the files rely on calling sequences in other sequence files during execution and do not exist within the same folder / directory structure. 

3.  I dynamically find and add the path to the sequence file and sequence to the run time directory.

4.  These sequences operate on Object Reference parameters that the calling sequence is responsible for populating, therefore I must populate the Object reference parameter associated with the called sequence. 

5.  I obtain obtain the Parameters Property Object from the target sequence / sequence file (if it exists) with the following code.

 

Locals.PropertyObject = RunState.Engine.GetSequenceFileEx(Locals.Path, 107, ConflictHandler_Error).GetSequenceByName("Lock").Parameters,

 

6.  I then parse out the parameter that I am trying to set (Object Referece).

 

Locals.test = Locals.PropertyObject.AsPropertyObject.GetPropertyObject("LockObject", 0),

 

7.  I then try to set the target sequence'sobject reference parameter.  I have been trying the SetPropertyObject to no avail, and errors out on type mis-match which I figured would happen, but I do not see a method for passing ObjectReferences via the API as parameters.  Any insight on this that I am missing.

 

Thanks,

 

Andrew

0 Kudos
Message 1 of 10
(5,330 Views)

Hi Andrew,

 

Thanks for posting! Can you tell me what error specifically you’re seeing with Step 7 that you listed? Also, have you tried using a Parameter instead of a Local in your main sequence, such as using Parameters.PropertyObject and Parameters.test? Lastly, can you attach a screenshot of your sequence file with the variables pane to help us see what you have?

 

Thanks,

Brittany V

Applications Engineer

0 Kudos
Message 2 of 10
(5,309 Views)

Brittany,

 

Here are some more details.

 

Thanks,

 

Andrew

Download All
0 Kudos
Message 3 of 10
(5,307 Views)

And the expressions I am using.

 

-Andrew

0 Kudos
Message 4 of 10
(5,305 Views)

Hi Andrew,

 

Thank you for the screenshots. Based on the error message, you may need to use Locals.LockObject.AsPropertyObject in your expression to access any PropertyObject properties of Locals.LockObject.

 

If I understand your initial question correctly, you want to pass Object References as parameters. You currently have two parameters (InstrumentObject and LockObject) that are designed for such. Can you create the Locals variables that you want to pass as parameters like these two variables?

 

If I am misunderstanding your question, please let me know.

 

Brittany V.

Applications Engineer

0 Kudos
Message 5 of 10
(5,245 Views)

Hi Brittany,

 

Yes I want to pass the Object References as parameters.  In this example one of them happens to be a LockObject.  But this will not always be the case.  I am trying to figure out the correct way of passing any Object Reference as a parameter in a dynamically loaded sequence.  The parameters in this sequence (in the variable screen shot) are currently not being used in the sequence only the locals are. 

 

I am just attempting to pass a local object reference first prior to passing in the acutal sequence's parameters to its intended sequence.  I have success passing strings, numbers this way (have done this from LabView to TestStand already) and am hoping that object references are roughly the same way.  I am just wondering if TestStand's strict type enforcement is just preventing this from occurring.  If so I could encode the object reference in raw binary or a valid ASCII / UNICODE string like I have done in the past with complex hash and data structures.  It would just be unfortunate if TestStand does not support their own Object Reference as a valid parameter at this layer.

 

Thanks,

 

Andrew

0 Kudos
Message 6 of 10
(5,242 Views)

Hi Andrew,

 

I wanted to get some clarification on your situation:

1. When you say you want to pass Object References as parameters, do you mean as input parameters to a function or variable parameters, as can be found on the Variables pane?

2. Can you post an example sequence file of what you are trying to accomplish? This will help us clear up all communication between us.

 

 

Brittany V

Applications Engineer

0 Kudos
Message 7 of 10
(5,202 Views)

Here is a simple version of what I am trying to do.  SequenceA calls SequenceB with no static definition.  I want sequence B to operate on the Lock Object Reference in this case.  However the target sequence should be able to operate on any object passed as an object reference parameter in SequenceB.  I am purely using locks because it is easier to illustrate and initialize compared to a polymorphic data object.

 

-Andrew

Download All
0 Kudos
Message 8 of 10
(5,198 Views)

Hi Andrew,

 

Have you considered using the hidden properties of the step? The below forum post goes into more detail:

http://forums.ni.com/t5/NI-TestStand/How-to-give-parameters-to-a-sequence-when-calling-it-with-quot/...

 

Brittany V

Applications Engineer

Message 9 of 10
(5,166 Views)

Brittany,

 

That helped.  Had to do some minor changes to get it to work and dropped in my code for a dynamic path finder and it appears to be working.  I haven't tested it completely but it looks at the moment to be a winner.  Now if NI had just made that a bit easier.

 

Thanks,

 

-Andrew

0 Kudos
Message 10 of 10
(5,145 Views)