05-25-2010 03:26 PM
I am looking to create a "Run VI Asynchronously Step" using the TestStand API in LabVIEW.
Upon browsing the step details and object properties, it seems this is a "special" step type that is actually a SequenceCall. However, I do not see how to access the data contained within this step type. I have attached my current VI used to "browse" the associated data for reference.
Please advise on how to create this step.
Thanks
Solved! Go to Solution.
05-26-2010 05:22 PM
Hi LVB,
The more robust and recomended way to run a code module asynchronously is through creating a new sequence that contains that code module and then use a sequence call step and select to run it in a new thread. This should have less restrictions than the "special" step type. Let us know if you run into issues implementing this programmatically.
05-27-2010 11:52 AM - edited 05-27-2010 11:52 AM
Ryan,
Thanks for the reply. During the creation of this step type, I ran into a slightly off-topic issue. It seems that the API does not throw an error when a duplicate SubSequence is created. Please see the attached VI. This VI will create two SubSequences with the same name (which should not be possible). If I attempt to do this within the TestStand Sequence Editor, I get an error.
I realize that it would be best to check for an existing SubSequence via the SequenceNameExists method of the SequenceFile object. However, it seems there should be an error thrown from the API. Is there a way to obtain an error when a duplicate sequence is created using the API?
Thanks
05-27-2010 03:07 PM
Yeah, look what happens when the Sequence File is loaded into the SeqEditor
The second DupSequence has no Groups.
Bit of a mess.
Regards
Ray
05-28-2010 12:51 PM - edited 05-28-2010 12:52 PM
Ryan T wrote:Hi LVB,
The more robust and recomended way to run a code module asynchronously is through creating a new sequence that contains that code module and then use a sequence call step and select to run it in a new thread. This should have less restrictions than the "special" step type. Let us know if you run into issues implementing this programmatically.
Ryan,
I have run into an issue creating the SubSequence call. What is the proper method for adding a SubSequence Call with the "Use Prototype of Sequence" enabled?
No parameters are created if I use the Module.LoadPrototype method.
Parameters are created if I use the SequenceCallModule.PrototypeFromSequence, but this returns an error when I do not disable UseSequenceParameterPrototype:
Error -17300 occurred at SequenceCallModule.LoadParametersFromSequence cannot load parameters from a sequence. Please set SequenceCallModule.UseSequenceParameterPrototype equal to False first. in Load SequenceCall Prototype.vi->Create TS Sequence File (Single Async Step).vi
This error code is undefined. No one has provided a description for this code, or you might have wired a number that is not an error code to the error code input.
06-01-2010 05:03 PM - edited 06-01-2010 05:06 PM
Hi LVB,
You will want to either set the UseSequenceParameterPrototype to true or use the LoadPrototypeFromSequence, but not both. In fact it will not allow you to use both:
SequenceCallModule.LoadPrototypeFromSequence ( sequence, options)
Returns whether the step was modified.
Sets the prototype of the module to the prototype specified by a sequence.
Use this method to set the parameters of the SequenceCallModule when the UseSequenceParameterPrototype property is False or if the SpecifyByExpression property is True.
sequence As Sequence
[In] Specifies the sequence with the prototype to use.
options As Long
[In] Pass one or more LoadPrototypeOptions constants. Use the bitwise-OR operator to specify multiple flags.
If you look in the TestStand Sequence Editor we can explore the difference between the two methods. Place a SequenceCall Step into a sequence. In the Module tab for this step you will see a check box for "Use Prototype of Sequence". If it is checked (True) then you can not use the button with an arrow directly to the right (this is the LoadPrototypeFromSequence method). If the box is not checked, you can select the button with an arrow on it. I would try both of these options out in the TestStand Sequence Editor to see the functionality of each in order to see which one you want to use.
06-02-2010 08:38 AM
Ryan,
Thank you for the response. I am aware the LoadPrototypeFromSequence Method will not allow UseSequenceParameterPrototype to be true.
What is the proper method for adding a SubSequence Call with the "Use Prototype of Sequence" enabled? No parameters are created if I use the Module.LoadPrototype method.
Error -17500 occurred at Operation Failed. in SequenceCall Load Prototype.vi->Create TS Sequence File (Single Ramp Step).vi
This error code is undefined. No one has provided a description for this code, or you might have wired a number that is not an error code to the error code input.
06-03-2010 05:23 PM
Hi LVB,
Using the LoadPrototypeFromSequence method was the correct method to use. Are you still using this method or are you now using the Module.LoadPrototype? Also, what are you using as the sequence reference that you are passing into the LoadPrototypeFromSequence method? Is it located in the same sequence file?
06-04-2010 08:57 AM
Ryan,
My use case is to wrap a LabVIEW VI in a New Thread SubSequence as originally stated. Thus, I create a SubSequence with parameters that map to the LabVIEW VI. I need to be able to create this through the TestStand API and I would like to create the SubSequence Call with the "Use Prototype of Sequence" enabled/checked.
LoadPrototypeFromSequence method
Using the LoadPrototypeFromSequence method, I can create and load parameters a SubSequence call with no errors. However, the SubSequence call does not have the "Use Prototype of Sequence" checkbox enabled. From the documentation and our previous discussions, this method should not be used when SequenceCallModule.UseSequenceParameterPrototype is True.
Module.LoadPrototype
Purpose
This property affects the behavior of the Module.LoadPrototype method. When this property is True, Module.LoadPrototype loads the module's parameters from the sequence specified by the SequenceCallModule.UseCurrentFile, SequenceCallModule.SequenceFilePath, and SequenceCallModule.SequenceName properties
Using the LoadPrototypeFromSequence method was the correct method to use.
Are you still using this method or are you now using the Module.LoadPrototype?
I started to explore Module.LoadPrototype because it seemed like the proper method when SequenceCallModule.UseSequenceParameterPrototype = True. I can load parameters from a SubSequence using the LoadPrototypeFromSequence method, but the SequenceCallModule.UseSequenceParameterPrototype must be False. I would like to create a SubSequence Call with the "Use Prototype of Sequence" enabled when I open the sequence file in TestStand.
Also, what are you using as the sequence reference that you are passing into the LoadPrototypeFromSequence method? Is it located in the same sequence file?
The sequence reference is created from the IEngine.NewSequence method. I also insert into the current SequenceFile.
If you look in the TestStand Sequence Editor we can explore the difference between the two methods. Place a SequenceCall Step into a sequence. In the Module tab for this step you will see a check box for "Use Prototype of Sequence". If it is checked (True) then you can not use the button with an arrow directly to the right (this is the LoadPrototypeFromSequence method). If the box is not checked, you can select the button with an arrow on it. I would try both of these options out in the TestStand Sequence Editor to see the functionality of each in order to see which one you want to use.
I would like to use the same method that the TestStand editor is when the "Use Prototype of Sequence" box is checked. I have not identified what method this is (my assumption is the Module.LoadPrototype).
Thanks for the assistance
06-09-2010 09:59 AM
Hi LVB,
I appologize, I did not realize that you still wanted to use the "Use Prototype of Sequence" checkbox option. In that case the attached code should demonstrate how this can be accomplished.
Thanks