LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error 20312 with Amplitude and Levels vi

Hello,
 
       I have been having a frequent error with a VI in a program I am using. The specific error is:
 
Error-20312 occurred at "ma_ptmFetch.vi" when called from "Amplitude and Levels N chan.vi"(waveform index 0 of 4)
 
Possible reasons: The input waveform is zero.
 
 
I am using the amplitude and Levels vi to measure the amplitude of 4 current waveforms that are being read into the DAQ card. The error message occurs usually right when the program begins to run, but does not always occur. The DAQ card that is being used for this measurement is a PCI-6071E, and it initially measures many curents and voltages, and then splits them up before sending them to the amplitude and levels vi. When the error does not come up the vi works properly and measures the correct current, so I am not sure what the problem is. If anyone could give me any insight as to what may be the cause of this error, or how to troubleshoot it it would be greatly appreciated.
 
Thanks,
Steve
0 Kudos
Message 1 of 12
(4,112 Views)
Hello Steve,

I have seen this error previously on rare occasions. Normally it occurs when a VI has been transported to a different PC or an express VI is not correctly configured. Basically what appears to happen is that the input signal to the Levels VI is not a valid input. I assume that the signals are coming in from your DAQ device through the DAQ Assistant express VI? If this is the case, then I might suggest reconfiguring this express VI to be sure that it is set up as you expect. If this does not resolve the problem, then I would attempt to use simulated data to see if the problem is related to the DAQ task at all. If you can reproduce this with simulated data, you can then post a VI that displays this behavior. I hope this information is useful for you!

Mike D.
0 Kudos
Message 2 of 12
(4,096 Views)
Hello Duffman,
 
    Thanks for the response, currently I am not using the express VI to read from this DAQ device. I am using the DAQmx Read vi to read several voltages and currents from the same device. The array of information that is read from the device is then passed into a subvi. The array is split up inside of this subvi, and the 4 current waveforms are passed to the Amp and levels vi there, and this is where the errors occur. I have tried probing the line, and it seems like when the error occurs the singal line coming in has no information at all in it. Is it at all possible that the device does not initialize and start reading fast enough before the program tries to run this vi? The Task is being properly started and cleared as far as I can tell as well.
 
As for the simulation you mentioned, could you explain a little more how I could go about doing this? I am still new to Labview, so anythign that would help me learn would be greatly appreciated.
 
Thanks,
Steve  
0 Kudos
Message 3 of 12
(4,091 Views)
Hello Steve,

Your situation does sound similar to the scenario I spoke of previously; the data going into the Amplitude and Levels VI is not valid because it is an empty data set. If this is the case, then I would not assume that you would get the same result by using simulated data. You can try this out by going to the Express pallet on the block diagram. From the Input sub-pallet you can select the Simulate Signal express VI. You can then use this VI in place of your DAQmx read to generate signals that will then go into the Amplitude and Levels VI.

To further simplify the setup that does use a DAQ read, you might try reading only a single channel of input. From there you can feed the data read from the DAQ task directly into the express VI to determine when the error shows up. This would eliminate the possibility that the array is being incorrectly indexed to select an empty data set.

Please post back with the results of this testing. If the error is not made apparent, then please also let us know the details of your data acquisition task. Namely, is this a continuous or finite acquisition? What are your acquisition rates and how many samples are you reading at a time? Thanks,

Mike D.
0 Kudos
Message 4 of 12
(4,076 Views)
Hello Mike,
 
       I believe you are right, and that this error occurs because the vi is receiving an empty set. When using the generate signal vi, I receive no errors at all, its only when trying to take input from the DAQmx read. I am reading continuous samples from multiple channels in a waveform, and then splitting it up into different sets. I made a small program to bar out any other factors from the large program it is in, and the problem still persists. Also, I tried changing to read only 1 channel. The problem still occurs at this setting, but less frequently than when using multiple channels.
 
       I believe I have found a workaround for this problem, but I'm not sure if there is a better way to go about doing this. I made a sequence with the Start Task vi in the first frame, and the while loop and clear task in the 2nd frame. The while loop contains the DAQmx read vi and the amplitude and levels vi. If I place a Wait vi in the first frame for a short amount of time, say 50ms, the problem disappears. Is it possible the Amplitude and Levels vi is trying to read values before the DAQ is finished starting the task and reading?
 
       I can attach a copy of the small test program I made if you want to see for yourself as well.
 
Thanks,
Steve
0 Kudos
Message 5 of 12
(4,071 Views)
Steve,

You should not need to include a wait; the dataflow model of LabVIEW will not allow the Amplitude and Levels VI to execute until it receives its data from the DAQmx task. What may happen is that this read operation returns an empty array of data. Did you mention that you are repeatedly calling the start and clear task VIs? You would ideally start your task, perform the read operation in the loop, then clear your task at the end of the program. I can not be sure if this is contributing to this problem, but it is the best programming practice for DAQ. I might suggest trying one of the DAQmx example programs that reads voltage to determine if this problem persists with an example known to work.

You may also want to post to the DAQ discussion forum as these are frequented by many more users of LabVIEW that are doing DAQ programming. Thanks,

Mike D.
0 Kudos
Message 6 of 12
(4,056 Views)
Hello,
 
    A little update to this problem. I have found that putting a is task done?.vi after the start task vi also remedies this error. I am not continuously calling the start and clear vi's, I call the start task, and the lines pass to the is task done vi, which then passes into a while loop containing the DAQmx read vi, which then passes thelines out of the while loop to the clear task vi. So far this has remedied the problem, but I agree that a workaround shouldnt be needed to get this to work.
 
Thanks,
Steve
0 Kudos
Message 7 of 12
(4,051 Views)
Steve,

Again I am thinking that the read operation might be returning empty data for some reason. After testing out the Amplitude and Level Measurements VI with a continuous acquisition example from the Example Finder, I cannot produce this error. Have you been able to experiment with these examples to see if they give the same result?  

When using the Is Task Done VI, do you wait until the output is true? I am having some trouble picturing when the code works and when it does not. Do you think you might be able to post a screenshot or two so that I have a better feel for when the error arises? Thanks,

Mike D.
0 Kudos
Message 8 of 12
(4,037 Views)

Hello,

As I said before I was not able to reproduce this error through simulation, but only using the DAQ card to try to read values. I have included a screenshot of a smal program I used to reproduce the error. The sequence does not need to be in this code actually, but if I put a delay int he first frame it remedies the error. ALso, when using the task done vi, the output of the vi is not connected to anything. The start vi simply passes the task name and error line to it, and it passes these on to the read vi. I'm not sure if this should even do anthing, but it also remedies the error.

Thanks,

Steve

0 Kudos
Message 9 of 12
(4,025 Views)
Steve,

This is quite interesting that these actions will resolve the error that you have been receiveing. Again, I feel that there may be some reason why we are getting an empty array. What I might try is to include a case structure around the Amplitude and Measurements VI such that you can only run this VI when the array is not empty.

Unfortunately from the screenshot, I cannot see the configuration of the task (presumably done in MAX). What I might suggest would be to try including this analysis into an example program that is set up to create and configure a task. This will allow me to try to reproduce the same error. Thanks,

Mike D. 
0 Kudos
Message 10 of 12
(4,014 Views)