VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -307650 when running real time sequence with LV API

Solved!
Go to solution

I created a basic real time sequence that checks the time it takes for a signal to reach a certain threshold.

 

RTSequence.PNG

 

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.

0 Kudos
Message 1 of 11
(7,880 Views)

Two additional files needed. Any system definition file should work.

Download All
0 Kudos
Message 2 of 11
(7,877 Views)

BSI,

 

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? 

 

Sam S
Applications Engineer
National Instruments
0 Kudos
Message 3 of 11
(7,865 Views)
Solution
Accepted by topic author LDBM

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:

 

GetSeqName.PNG

 

 

Jarrod S.
National Instruments
Message 4 of 11
(7,854 Views)

Thx Jarrod,

I had missed this missing variable.

I will try this fix in a few days and will post back.

Regards,

Laurent

0 Kudos
Message 5 of 11
(7,849 Views)

Ok It works. Thx Jarrod.

0 Kudos
Message 6 of 11
(7,819 Views)

I suppose we are still bound to one only output variable from the sequence as was discussed back in the fall, with the work around of using other channels as defined in the sys def file?

Cheers,

L.

0 Kudos
Message 7 of 11
(7,814 Views)

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?

Jarrod S.
National Instruments
0 Kudos
Message 8 of 11
(7,802 Views)

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...

 

L.

 

0 Kudos
Message 9 of 11
(7,797 Views)

...Smiley Sad after looking a little more into this, it looks like I cannot add several channels as arrays into a RT sequence...

sequence.PNG

 

so it looks like I cannot have an array of channels here... so I am hooped. Arg.

 

L.`

0 Kudos
Message 10 of 11
(7,785 Views)