NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Executing a sequence using new Execution method

Solved!
Go to solution

Hi ppl,

I am using the Engine.NewExecution method in LabVIEW to execute a sequence using the sequential process model. I was succesful in this attempt.

Now when i tried to pass arguements to the Sequence through this method i couldn do it 

From the help file i found that we have to pass a property object to the sequenceArgsParam in the  Engine.NewExecution. I used the Engine.NewPropertyObject to create a new proprty object. My problem started here. I was not able to set the sequence parameters to the property object i created. when i created a container type property object , newExecuion method returned an error saying expected type is string eventhough the parameter for my sequence was  a container. When i creatd a string type property object  setValString method returned error saying unable to find parameters where the look up string was parameters.x

Please some body help me. I'm stuck up with this.  can some one give me an example program which passes parameters to the sequence while executing through NewExecution method.

Message Edited by lordsathish on 10-12-2008 01:31 AM
0 Kudos
Message 1 of 6
(4,318 Views)
Solution
Accepted by topic author lordsathish

Hi,

 

it is not the method Engine.NewPropertyObject to pass parameters

I used sequence Method before to run sequence

 

try to replace the step Engine.NewExecution  by this VI

the values are in an cluster array : parameter is the name of the parameter in your sequence, value is the value to pass

 

a2

remark 1 : there is only string in this VI, it is possible to change with integer, ....

remark 2 : if you have a  container, the parameter name is "Container Name"."Parameter name"

Message 2 of 6
(4,301 Views)

The New Engine method creates a reference to the Execution, Should this reference be closed ?

Can i be closed immediately or should it be closed only after the Sequence Finishes Execution ? 

0 Kudos
Message 3 of 6
(4,277 Views)

lordsathish,

 

Yes you are correct, the reference should be closed.  To be more specific, the reference should be closed after the sequence has finished executing.  If you prematurely close the reference and something else tries access it, an error will occur.

A_Ryan
AES
National Instruments
0 Kudos
Message 4 of 6
(4,134 Views)

Attached:

TSI Zip file contains :

  1. Learning.py
  2. Test.py
  3. Test.seq
  4. Error.png

My problem:

 

  1. I am getting the error which is attached i.e. Error.png when I run Test.py Which calling methods in Learning ->Teststand
  2. cannot create property objects for sequenceargs in python to pass them as sequence args

 

Expecting solution:

1. sample code to create a property object for sequence args which has args as a string (sequence parameters - 1 string i.e. a)

2. How to stop getting error:1 where am I going wrong.

 

 

 

 

 

 

0 Kudos
Message 5 of 6
(2,741 Views)

How to stop getting error:1 where am I going wrong.

Shutdown the TestStand Engine in two pass as mentioned here. That will solve the issue of having property object leak and hence no dialog will be shown in the end. Also, in your code, you have 'self.Engine.UnLoadAllModules()'. The casing of 'L' is wrong and hence, that will give you error. Replace it with 'self.Engine.UnloadAllModules()'.

 

Note: You need to use UIMessages to do the two pass shutdown of Engine. To get the UIMessages, you might want to use win32com.client.DispatchWithEvents instead of win32com.client.Dispatch and register for UIMessageEvent from Engine.

 

sample code to create a property object for sequence args which has args as a string (sequence parameters - 1 string i.e. a)

As per help, you can pass the sequence arguments as 6th parameter for Engine.NewExecution method.

 

As you mentioned, for the case where a sequence has one parameter of type string and if the name of the variable is 'Parameter', use the following code in your file to create instance of PropertyObject in a variable named 'container' with required structure and use it in Engine.NewExecution as 6th parameter.

 

        container = self.Engine.NewPropertyObject(0, False, "", 0)
        container.NewSubProperty("Parameter", 1, False, "", 0)
        container.SetValString("Parameter", 0, "Test Message")

 

Note: What you are doing will work properly for calling TestStand from Python. However, if you want to call Python from TestStand, check out Python Step Types.

 

-Shashidhar

0 Kudos
Message 6 of 6
(2,679 Views)