Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Example Program
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Passing Arguments to a New Execution in an MFC Operator Interface

2 ratings | 3.00 out of 5
Print

Downloads

Filename: 200564.zip
Requirements: View

These examples demonstrate how to start a new execution and pass arguments to the new execution. For this to work, the called sequence must have defined parameters. This has been implemented in the file, CalledSequence.seq. The parameters of the MainSequence in the CalledSequence.seq file are as follows:
- String
- Number
- Custom container -- Contains a boolean and a number. The custom container type is defined in the CalledSequence.seq file and is named CustomContainer.

The arguments passed to the new execution must be of the same type and in the same order as the parameters defined in the called sequence. In contrast, the name of the passed argument is irrelevant.


There are the following two ways to call a new execution.

- Method 1 -- Using the Sequence Call Step
This capability was added to the Sequence Call step in TestStand 2.0. When you specify the module of the Sequence Call step you can set the value of the Multithreading and Remote Execution control to Run Sequence in a New Execution. Clicking the Settings button allows you to configure the execution to not use a process model. By doing this, passing arguments to the new execution is the same process as passing arguments to a subsequence.

- Method 2 -- Using the NewExecution Method
The more complicated way to call a new execution is to use the NewExecution method of the TestStand API. Using the NewExecution method is more complicated because it does not have menu driven configuration like the Sequence Call step. There is not a good reason to use this method of starting a new execution from within a sequence; however, it is necessary to use this method when you start a new execution from within a code module or from within the code of your operator interface. Whenever you pass arguments using the NewExecution method, you must package the parameters and subproperties within a container. The subproperties must be of the same type and be in the same order as those in the called sequence. This packaging occurs in last three implementations that follow.


There are the following four different ways to pass parameters to a new execution included in this example:

- NewExecutionWithSeqCall.seq -- A new execution is started from within the sequence using a Sequence Call step. This is the easiest means of starting a new execution and passing it parameters; however, this implementation is not available in TestStand 1.0.

- NewExecutionWithTSAPI.seq -- A new execution is started from within the sequence using the NewExecution method, which is called using an ActiveX Automation Adapter step.

- SimpleCVIOperatorInterfacePassingArguments -- A modified version of the simple LabWindows/CVI Operator Interface that passes arguments to the MainSequence of the CalledSequence.seq file, which is executed using the NewExecution method. A new function, CreateSequenceParamPropObj, was added to the operator interface code. This function creates the object containing the parameters, which is then passed to the NewExecution method. For this to work correctly, load the CalledSequence.seq file.

- SimpleLVOperatorInterfacePassingArguments -- Modified components of the simple LabVIEW Operator Interface pass arguments to the CalledSequence.seq file, which is executed using the NewExecution method. Rather than include the entire Simple LabVIEW Operator Interface in this example, you should replace the vi, \Examples\OperatorInterfaces\SimpleLV\TestStand - Start Execution.vi, with the one provided in folder. Also copy CreateSeqParmPropObject.vi to the directory above. This VI creates the object containing the parameters, which is then passed to the NewExecution method. For this to work correctly, load the CalledSequence.seq file.

NOTE: When you load TestStand - Start Execution.vi it may not find the subVI TestStan

Requirements


Filename: 200564.zip

Software Requirements


Application Software: NI TestStand Development System 2.0
Language(s): Visual C++
Additional Software: Visual C++ 9.0

 
2 ratings | 3.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).