I created a basic real time sequence that checks the time it takes for a signal to reach a certain threshold.
On the LV side, I use the API to call this sequence. I make sure all channels and parameters are defined just like in the examples. However I keep getting Error -307650 that says " NI VeriStand: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index".
Any suggestion to help here? Thx. Code is attached.
Solved! Go to Solution.
Are you able to run any stimulous profiles correctly? I would also begin by running one of the examples and modifying it. The error you are seeing in Veristand is a random error so making a new Stimulous profile with the same or similar code may not show the same issue.
Did this stimulous ever run correctly?
There are two issues here:
1. The Stimulus Profile Editor is not indicating that there is an error with this sequence, although there is one. Note that the variable InitialTime is used in an expression, but is not declared as a parameter or local variable.
2. You do get an error at run-time because of this, but it is not terribly helpful (index out of range).
You can fix this by adding an InitialTime local variable to your sequence. I filed CAR 338386 regarding this bug.
After you do that, there is one additional thing you'll need to fix in your VI that runs the sequence to get it to get the results from the sequence correctly. You are not correctly using the Sequence Name value to read the Return Variable of the sequence. You are using the Session Name you used when deploying the sequence. That does not correspond to the sequence name.
To get the sequence name, use the VI Get All Sequence Names on your stimulus profile session to get the array of names for all top-level sequences in that session, and then index out the first item, since you're only running one sequence. Example attached below:
I had missed this missing variable.
I will try this fix in a few days and will post back.
Yes, that is still the case. I would be very interested in hearing what your use-case is, and what you would like to be able to do with multiple outputs. What problem are you trying to solve? What test are you running?
I may well not be doing this the best possible way, but here is what I have in general terms with the basic real-time sequence shown at the beginning of the post:
I wrote a real-time sequence that monitors a given channel: essentially checking if this channel reaches a given level in a given amount of time. I run the rt seq using the LV API, and I was just surprised it could only return one parameter. But like you said in the linked post, many other ouputs can be produced by using channels, such as user channels.
So what I would add on the other outputs would be things like: time it took to reach the targeted level, averaged rate of change of the monitored channel... The key here, is to have a mechanism (the rt-sequence, and the LV API) to expand from, writing new rt sequences that do slightly different things as required.
Finally, the next step would be for instance to figure out what is the best way to look at several channels instead of one. Should I run the same rt sequence in parallell, or should I build the parallelism into the rt sequence...? Ideally one would have an array of time constraints, an array of target levels, and an array of channels to monitor. The results now would have to be passed to several channels, not the rt sequence returned value...The result would be an array of pass/fail, and possibly other things such as actual time taken to reach the required level etc...
As an aside, the result could also be wrapped into a word with each bit in binary representation representing one of the channel tested... but in any case, if there any additional info to generate, one has to use additional channels...
... after looking a little more into this, it looks like I cannot add several channels as arrays into a RT sequence...
so it looks like I cannot have an array of channels here... so I am hooped. Arg.