03-04-2009 02:55 PM
I need to call a subsequence with several parameters in case of RunTimeError of any of my main sequence steps. I would like to override the SequenceFilePostStepRuntimeError callback to do this.
The callback starts ok but no parameters passed to it. I don't see a way to explicitly set those parameters for the callback call (the way we have it for subsequence call) so I just created parameters with the same name in the MainSequence and the SequenceFilePostStepRuntimeError sequence.
I have seen this post but it does not describe how to pass parameters to a callback.
Please see the attached sequence. The SequenceFilePostStep callback is used for demonstration purposes.
Solved! Go to Solution.
03-04-2009 04:52 PM
Hi,
One way you could try.
Instead of having Parameters.Message use a Local variable. Change your Parameters.Message to Locals.Message in both your sequences (MainSequence and SequenceFilePostStep).
In the SequenceFilePostStep set the Locals.Message to 'Allow Propagation from Caller' ( Select the Locals.Message variable and right mouse click, you should see the two options)
In the MainSequence set the Locals.Message to 'Propagate to Subsequence'
Make sure you change the MessagePopup to use Locals>message and set Locals.Message with your message in your expression step.
Now when you run your MainSequence you should see your message in the DialogBox.
Hope this helps.
Regards
Ray Farmer
03-06-2009 02:34 PM
03-06-2009 02:56 PM
Hi,
That's ok.
I would use this method sparingly. Generally Locals should be used only within the scope of the sequence its been declared in. If this method needs to be used then make sure it's well documented.
Regards
Ray Farmer
03-06-2009 04:18 PM
03-06-2009 04:39 PM
Ok, I just tried to modify local in subsequence and calling sequence got this modified value.
So, what the difference than between calling sequence with parameters and locals propagating? Is the only difference what for calling with parameters we may link differently named variables but for locals propagating it must be the same named locals and using of second method is a kind of hidden (that's why it should be well documented) ?
03-09-2009 01:41 AM
Hi,
As you have found out there's no real difference between using Parameters and usings the Locals with propagation. There maybe some memory usage difference but probably not enough to make any difference.
You do have to make sure you have declared the variables lower down and matched the names. I dont thing a error is generated if a sequence calls a sub sequence with an local set to propagate and the local isn't available. (I maybe wrong on this).
The main thing is when someone else picks up your sequences, there will be no obvious link between sequences and how data is getting from one to the other. The normal convention is to expect data to be passed via parameters or some form of global. Therefore doucumenting this approach is very important.
Regards
Ray Farmer
03-10-2009 03:25 PM
Hi Ray,
I found out that local propagation works fine without declaring the same name local in subsequence. Actually, that is what I found in TestStand help:
PropFlags_Propagate–(Value: 0x100) This flag only applies to local variables. If you set the Propagate flag for a sequence local, the variable also appears at run-time as a local variable in subsequences that the sequence calls. The variable continues to propagate as the call chain extends.
So, at run-time everything works fine and even allows to extend the call chain. If the local is passed by reference you can modify it in subsequences and use modified value in futher calls. The only difference there is what the subsequence without locals declared can not be run by itself but only called from some master sequence.
This is exactly the architecture I use in my application, I have a master sequence which reads configuration data and then from this master sequence I call subsecuences which use these data and have the all same structure.
Thank you for your help,
Sergey
03-10-2009 04:10 PM
Hi Sergey,
Thanks for that bit of info.
To add to that, if you have declared the same local in the subsequence and you dont have Allow Propagation to Caller set then that local in the subsequence does not get updated from the caller.
In you subsequence, maybe you should add a step in the setup to check the exists of the Locals and if its not present then display some message and then terminate the execution.
Regards
Ray
10-27-2015 12:28 PM
I'm having issues with this one. I know its an old thread but I believe it should be here.
According to the Best Practices, you should put your instruments in ProcessSetup and ProcessCleanup (full text at end).
So I transfered my VISA open of 2 serial communications from Setup to ProcessSetup and from Cleanup to ProcessCleanup.
I copied the Local.Serial#_Session to the Locals of each process and set them to "Allow Propagation from Caller".
Set the same Locals from MainSequence to Propagate to SubSequence
I keep getting an issue from the Locals in the MainSequence. I attached my code (saved as 2010). You might need to remap the VIs.
Also tried changing the Write and Read of serials to Load dynamically to see if that could be an issue.
From Best Practices:
Instrument initialization routines and calibration routines should be part of the ProcessSetup callback, while instrument communication closure should be part of the ProcessCleanup callback. By placing the initialization and cleanup into these callbacks, the instrument communications code executes once for all UUTs rather than once for each UUT.
Thanks