From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Default value of sequence context of a VI!!

I have a HAL library which I am using in conjunction with teststand. There are specific driver classes for instruments and also corresponding simulation classes. within the simulation class method, I use the sequence context of a test step to read the type of test and limit values set(should they exist), to simulate a pass/fail condition.

 

The sequence context input of the VI has to be changed to "ThisContext" as it is "Nothing" by default. SInce there are 100's of such measurement steps, I was wondering if there was a way to change the default value to be "ThisContext" if it's possible at all. Or If I choose to simulate, can the default-checkbox be unchecked programmatically

0 Kudos
Message 1 of 3
(2,161 Views)

Hi roshanmayapur, there is a way to uncheck the default value in a LabVIEW Parameter using the TestStand API and then use another expression to set the new value. All this can be done at the pre-expressions of the step. 

 

Example:

Step.TS.SData.ViCall.Parms["A"].UseDefaultValue=False, Step.TS.SData.ViCall.Parms["A"].ValueExpr=Locals.A,
Step.TS.SData.ViCall.Parms["B"].UseDefaultValue=False, Step.TS.SData.ViCall.Parms["B"].ValueExpr=Locals.B

 

I attach a simple example to demonstrate the concept.

0 Kudos
Message 2 of 3
(2,118 Views)

If you are willing to change your code, I would suggest that you create a custom step type using whatever step type that you think might be the most used (see www.ni.com/product-documentation/8300/en/#toc3).

 

In the properties of that new step type, select a default LabVIEW module, it can be either a dummy module (like the one I provide in attachment) or the VI you think is the most likely you'll be using.

 

Put the property Step.Context as the default value of the module. That property needs to be created as an Object Reference field of the Custom Step Type.

 

In the pre-expression field of the custom step type, put:

 

Step.Context = FileGlobals.Simulation ? Nothing : ThisContext

 

Where FileGlobals.Simulation would need to be created as a boolean. You could also use a StationGlobals instead of a FileGlobals as it would be a hardware parameter of the station I suppose.

 

After inserting the custom step type in a sequence, you can load a different module and if the Sequence Context parameter has the same name, Step.Context should automatically populate.

 

Before running your test, changing the default value of FileGlobals.Simulation from true to false, would make all the custom step type use ThisContext instead of Nothing, and vice-versa...

 

Good luck

Marc Dubois
Download All
Message 3 of 3
(2,106 Views)