NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence Context Functional Global

Hi,

 

I would like to be able to call a LabVIEW Functional Global Variable to write the Sequence Context to it in an initial step of a sequence.

 

In later steps I would like to call the functional global to read from it, in order to use the reference to write to Station Globals.

 

See the attached example to clarify what I'm trying to do.

 

If I probe the two sequence Contexts in my "main.vi", they appear to differ.  I'm assuming this is due to the fact that they refer to different steps of the same sequence.

 

Is there any way of achieving what I'm trying to do?  I.e. is it possible to pass a generic "ThisSequence" reference that does not differ from one step of a given sequence sequence to the next?

 

Thanks,

 

Dan

 

 

Dan
CLD
Download All
0 Kudos
Message 1 of 13
(5,565 Views)

@DanB1983 wrote:
[...]I.e. is it possible to pass a generic "ThisSequence" reference that does not differ from one step of a given sequence sequence to the next?

 

Thanks,

 

Dan

 

 


No, it is not possible. As each little function in TestStand might modify the context, it will change even during step execution. You have to pass a context each time from TS.

Btw: It is NOT recommended to write/read parameters of a code module by passing the SequenceContext and using Set/Get Property Value methods. You should pass these parameters as what they are: Parameter.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 13
(5,527 Views)

Hi Dan,

 

I tested your sample files and here is what i found:

 

The reference stored in the functional global is invalid the next time the VI is executed and the value read out. I am not sure why this happens but that is the behavior i am seeing. I tried accessing TS subproperties from the sequence reference read from the functional global in LabVIEW and the operation failed with some error.

Also, i passed the value read from the functional global back to TestStand and it was Null. So clearly, the value stored in the Functional Global is invalid when read later.

 

This method is unlikely to work.

 

However, from what i have understood, you want to access StationGlobals.<Somevalue> from LabVIEW and update the value at some point in your sequence execution. Please correct me if i am wrong.

 

If this is the case, why can't you simply pass in "ThisContext" to the VI that needs to update the StationGlobal sub-property? Why store the reference beforehand? ThisContext is the "generic sequence reference" that you are looking for and any updates you make using this reference from LabVIEW code will be reflected back in TestStand.

 

Tinu

 

 

0 Kudos
Message 3 of 13
(5,522 Views)

Thanks,

 

My reason for wanting to do this is to avoid having to add a TestStand Context control to the front panel of every single top level VI to be called (more than 100 in total).  I would rather have written to the FGV once, then just read this at a lower level.

 

But, it sounds like this is not a viable approach.

 

Dan

 

 

Dan
CLD
0 Kudos
Message 4 of 13
(5,515 Views)

Dan,

 

your FGV approach does not work. Passing the context to read/write variable values is also not recommended. Please use simple parameters.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 13
(5,511 Views)

As Norbert was saying, using the sequence context to get values is a sign of a bad architecture.  You should pass in exactly what is needed to a module using its connector pane.  Use clusters if necessary.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 13
(5,510 Views)

I know, that it's quite old thread, but now I'm facing the similar issue.
I don't agree, that the problem described by the thread author - is sign of bad architecture. If I want to get dynamically for all my top-level VIs called from TestStand, step name from which they are called - I don't want to put one more input parameter to VI. It's not good - the better is to have some reference, from which I can retreive it; and I can have this reference internally in my code modules, in FGV.
This is better architecture decision, then to add additionaal inputs to, let's say, over 200+ code modules; isn't it?
I'm curious, whether it is solvable now, or still not...

0 Kudos
Message 7 of 13
(3,462 Views)

Passing and using the SequenceContext is not generally "wrong", although it might usually be a less clear and maintainable option than passing separate parameters.

 

I don't know anything about LV functional globals, but one issue with using a global in general is that...it is global. What if you have multiple threads calling from different contexts? Also, depending on how you set and perhaps restore the global, sub-sequences that use the same scheme could also be an issue.

0 Kudos
Message 8 of 13
(3,458 Views)

@James_Grey wrote:

Passing and using the SequenceContext is not generally "wrong", although it might usually be a less clear and maintainable option than passing separate parameters.


 I agree, that it can be less clear, but I don't think, that this is less maintainable. Moreover, it'll give for you the opportunity to change code module (to retreive by SeqCont reference) any additional parameters without changing of connector pane of code module. Thus - without modification of sequence.

 


@James_Grey wrote:

I don't know anything about LV functional globals, but one issue with using a global in general is that...it is global. What if you have multiple threads calling from different contexts? Also, depending on how you set and perhaps restore the global, sub-sequences that use the same scheme could also be an issue.


 With multiply threads situation is clear. For me, it's not a problem if FGV can be blocked while called between different threads - it's a matter of couple milliseconds, I can live with it. Windows OS is not deterministic system by itself, so who cares about milliseconds jitters there? Smiley Wink

But by idea FGV will not help with parallel threads - b/c both threads will use the same reference. Yes, we can store there array of them, and retreive by socket number - but then we need to add input of socket number to this code module. And, that's why we don't need then FGV - then we can directly pass parameter inside of the code module.

But if I have single-thread sequence, I want to make my life easier. Imagine, that I'm using custom tracing code module, to store trace messages to file. I can use Call Chain function in LV to find out full chain of every LV code module, but it shows just chain of subVIs. And, I'd like to know, from which step in TS my code module is called.

And here is the case, when some reference, stored to FGV, can help. I will init this reference (in the beginning, or every time in PreUUT), and read it inside of code module, and retreive from it name of step what is executing.

And it's more comfortable. B/c if I'd like to add some tracing to code modules, I don't need to change its connector pane and pass from TS input of step name, and setup expression to get this step name. It's a problem for sequences, which are already used on testers, in the production. I don't want each time to update sequence - I'd like to modify code module, send it to customer and tell - "please, just copy this code module to folder, and we will have additional debug info". Because all the magic is done inside.

But, unfortunatelly, it's not possible to use it like that. To get some poor step name, I need to have additional input in code module... 

And again the issue - if I want to reuse this code module for my LV application; I can not have there SequenceContext reference input. I need to have just string. So, from TS I need not to forget - for all steps - to add expression as input to this control. Yes, I can use TS API for it, but it's again additional efforts.

 So, if there will be easy way of how to get - not any, but at least most common - parameter from TS by some reference, what can stored to some global, or FGV inside of code module without affecting code module's connector pane; I'll be completely happy...

0 Kudos
Message 9 of 13
(3,454 Views)

The sequence context is different for every instance of every sequence that runs. If you cache it in PreUUT, you have the sequence context for PreUUT, not MainSequence. If you cache it for MainSequence, then you don't have it for SubsequenceA. Of course, that doesn't stop you from explicitly caching it at the start of any sequence that needs it, though you might need to restore a previously cached value at the end if you have nested sequences that rely on this.

 

If it was me, I'd consider biting the bullet and adding a context parameter to all my modules that might need it. At least when the next requirement comes along, I'd already have the context handy.

 

I'd code a module to be tolerant of a null value for the context if I wanted the module to be able to run standalone.

0 Kudos
Message 10 of 13
(3,452 Views)