LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Y Relative Time out of range error

Hi, I'm having an issue with the Get Y Value VI.  I have the VI set to relative time, and I'm feeding it a waveform and an index/seconds value between 0 and 3.  The VI performs as expected the first time (its in a loop) but for the second and successive runs it increments the "actual index/time value" value by the "index/seconds" value rather than just reading at the newly input time.  I'm sure this is the behavior I'm getting (although its unexpected) because I've monitored the index/seconds and actual index/time value through repeated runs.  Of course, I get an error of "waveform x axis value requested is out of range" because after one or two increments the actual index/time value is outside of the 0 to 3 range of the input waveform.

I've got a hunch that this is a result of the VI being in a loop, but I have no idea how to correct the problem; this is a data processing program and the purpose of the loop is to perform the desired calculations on each data set as they are fed into the loop.

Thanks in advance,
YoungTurk
0 Kudos
Message 1 of 7
(3,040 Views)
I'm not sure I understand. What kind of loop do you have it in and how is the index/seconds value passed to it? Is the actual index value wired to a shift register that you're feeding back to the index input or is just wired out of the loop? If the only values that you're passing to the index input are 0,1,2,3 and you have three or more samples, you won't get an error. Can you post the VI or an example (prefrable) or an image (no bmp files, please)?
0 Kudos
Message 2 of 7
(3,036 Views)
Its in a simple for loop.  The index/seconds value is passed to the VI as a double calculated from the data set, which changes each time the loop executes.  I'll post an image here, but be kind, I haven't been keeping up on my housekeeping on this work in progress.  There's a lot going on here, but direct your attention to the Get Y Vi.  Nothing fancy whatsoever, but the requested time and actual time don't jive after the first run, like I say.  The actual time increments by the requested time if I "OK" throught the errors. (o_0)
0 Kudos
Message 3 of 7
(3,032 Views)
And here's an example exhibiting the same behavior.
0 Kudos
Message 4 of 7
(3,030 Views)
The Basic Function Generator VI produces an output waveform with t0 = 8:00:09.000PM12/31/03 (may vary with your Time Zone setting). When it is converted to Double, it becomes 9.000. The Requested Time value is compared to the converted t0 inside the Get Y Value VI. If you set Requested Time to something >= 9 the error does not occur. I did not investigate why the Function Generator produces that value of t0.

Lynn
0 Kudos
Message 5 of 7
(3,026 Views)
I can't say I agree with you there.  If you set requested time to 10, for example, shouldn't it provide the value at time ten and output a value near 10 for the actual time?  I think 9 is the magic number because I arbitrarily set that example loop to run ten times.  Set the loop to 20 iterations and then try the your hypothesis, you'll get the same error as soon as you hit the tenth loop. 

Still my question was, why does the actual time value increment and not just match the requested time? I've figured how to solve the problem now, even though i don't know what was causing it.  i needed to reset the Average DC/RMS function which was generating the waveform being fed to the Get Y VI.  It seems the apparent incrementing behavior was a result of succesive times being assigned each time the Average DC/RMS Vi was run in the loop. 

To see a similar behavior, do this with the example VI I posted.  Set the sampling info to, for example, 1000,3000.  With the signal generator in the loop, the signal is regenerated with successive time ranges each time the Vi is run.  First loop time range:  0-3 seconds, Second loop 3-6 seconds, etc.  In order to prevent the error you have to request a value within the time range of each loop.  In other words requested time has to be incremented along with the time stamps.  (Interestingly, if you set requested time to greater than the time range, it will coerce to the largest value, but if you set the requested time to less than the time range, you get the out of range error.)  Now move the waveform generator outside of the loop, so it is only generated once.  Now the time range is always 0 to 3 and you can request any value in that range on each succesive loop without seeing any odd behavior.

So, why does LabView add successive time ranges to waveforms generated in a function within a loop?  And why doesn't relative time work from the beginning of the waveform time range rather than as an absolute time?  Is this a bug?

Thanks for the inputs.  Though you didn't answer the question, you got me thinking in a way that made it possible for me to solve the problem.  Still wondering what the developers intent is with the time ranges, though.  Seems very counterintuitive. 
0 Kudos
Message 6 of 7
(3,023 Views)
In the example you posted, you can't set a relative time of 1 or greater because you've got 1000 samples at a dt of .001 sec. so the highest relative time you can enter is .999. Also, if you set the function generator to reset with every run, no errors are created. I think there's something weird going on when the waveform has a non-zero start time but I can't figure out what right now.
0 Kudos
Message 7 of 7
(3,012 Views)