09-04-2021 02:08 AM
For a sweep loop step in TestStand 2019,if we use Array strategy and re-assign the array during run-time, is that supposed to work?
I have a reference to the step. and in the pre-step, I re-assign the ArrayExpr property to Locals.EmptyArray where Locals.EmptyArray is an empty array of strings.
My requirement is thus:
The first time the Sweep loop step is run, the ArrayExpr property is set to some array of non-empty values. Now based on some condition during the run, I want this loop to stop, hence writing an EmptyArray to this property. Does not work.
If however, I start with Locals.EmptyArray, it works and does not loop, runtime --> does not work.
Any ideas would help.
Thanks
09-04-2021 09:54 AM
No, sweep loop is an edit time feature and not run-time.
The number of iterations and the iteration combination values are pre-determined when you configure it during edit-time.
09-04-2021 11:58 AM
Hi Santhosh,
Thanks for the reply. Then, is there any other way to terminate a sweep loop?
I can set the steps contained within the sweep loop to be skipped, based on the condition, but I don't think thats the right approach.
Thanks
09-04-2021 12:24 PM
Hi Santhosh
Regarding the values being set at edit time:
These are my step properties at edit time, the ArrayExpr is set to Step.SweepData["CONFIG_DOPT"].Values, where
Step.SweepData["CONFIG_DOPT"].Values is an string array of 5 values.
When I run it the first time, I am able to set the ArrayExpr = Locals.EmptyArray, and it does work. The value Step.SweepData["CONFIG_DOPT"].Values changes to Locals.EmptyArray.
(Normally, the first time, the sweep loop will not be terminated, this was just for testing). It does not work during run-time other than the first time.
Thanks
09-04-2021 02:32 PM
I am not familiar with the internal data structure used by the SweepLoop, you may be able to work around a few things but it would take more effort to poke around to get it working right - because the user was never meant to meddle with the step data structure
If you're willing, TS2021 has a more advanced sweep loop with run-time control
https://forums.ni.com/t5/NI-TestStand/Announcing-TestStand-2021/m-p/4173227
It saves you a lot of time poking around this Sweep Loop to work for your needs