Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Issue when streaming more than 8 channels


  • Please log in to reply
12 replies to this topic

#1 Lucas Pereira

Lucas Pereira
  • Members
  • 8 posts

Posted 09 July 2012 - 08:14 AM

Hi, I am using the LabJack U6 with the Java UD for windows to stream 50 Hz Voltage and Current waveforms. Everything works just fine when streaming less than 9 channels, however after I set the system to stream 9 or more after a while the samples that should be in the interleaved sample with index 0 starts showing in a different index and also with other sample... simply but... the interleaved array gets all messed up!! what do you think is going on? I'm using 3200 scans per channel, but I even reduced it to 1000 because I thought this might be an issue with the internal buffer... however I never get a BackLog bigger than 2 which I guess invalidates this option. Also I thought this could be an issue with the auto recovery mode, but I never the the error codes 59m or 60 which will indicate that! What to you guys think might be happening here? I'm attaching some screenshots to better illustrate my problem: Attached File  how_it_should_be.tiff   135.73KB   722 downloads this image shows how things should work (and work for a while). channels 0, 2 and 4 are scaning 6 voltage waveforms... and 8 to 13 are scanning 6 Current waveforms. so, after a while we get this: Attached File  problem_1.tiff   137.34KB   718 downloads interleaved sample 0 no longer holds the voltage... this voltage is now on interleaved sample 3!!! a little bit after we get: Attached File  problem_2.tiff   137.25KB   699 downloads interleaved sample 1 no longer holds the voltage... and so on... Attached File  problem_3.tiff   137.68KB   705 downloads really wired... I have tried all I could and this forum is my last resource!! Any help will be much appreciated... again... if i'm streaming less than 9 channels it will work the way it should!!

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 09 July 2012 - 10:26 AM

Before we look too close, the first things to do:

1. Update to UD driver V3.25 if you have not already, and then update to the latest beta driver:

http://labjack.com/support/ud/ud-setup

http://labjack.com/s...dows-ud/beta-ud

2. Update to the latest U6 firmware:

http://labjack.com/s...irmware/u6/beta

3. See if you can cause the same problem with LJStreamUD, or just in your program.

#3 Lucas Pereira

Lucas Pereira
  • Members
  • 8 posts

Posted 09 July 2012 - 10:45 AM

Hi, thanks for the quick reply. I am using the latest version of the driver (V 3.25) and the firmware is also updated. I've tried to use the Beta version of the new driver but found the sames issues reported in the beta version page, so I turned back to the last stable version. Regarding the LJStreamUD everything seems to work fine there... with 14 channels at 3200 scans.

#4 Lucas Pereira

Lucas Pereira
  • Members
  • 8 posts

Posted 10 July 2012 - 10:55 AM

Still experimenting this issue and to make sure I reduce to a minimum the chances of being a problem of my own code, i've coded a very application that scans and plots directly the data from each channel (just like to LJStreamUD does). The results are the same... for less than 9 channels it works just fine, more than that and things go pretty bad after a while. Like in the previous post, I'm attaching some screenshots: (Scan rate, number of channels and version are on the screenshots as wel) At this stage everything is OK. Attached File  14_channels_3200_scans_OK.tiff   150.15KB   715 downloads After a while this is what we get... Attached File  14_channels_3200_scans_FAIL.tiff   137.58KB   709 downloads Do you think this might be something related to the java driver? I've also done the same thing for 1000 scans, and results were the same, the difference is that it worked fine for a longer period of time... Did anybody have this problem before? thanks

#5 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 10 July 2012 - 11:27 AM

Can you provide your Java code that produces the problem? Seeing your UD calls will help us reproduce the problem.

#6 Lucas Pereira

Lucas Pereira
  • Members
  • 8 posts

Posted 10 July 2012 - 08:00 PM

Hi. I've uploaded two source files. LabJackU6Streamer.java which is used to get the data from the LabJack. This is based on the streaming examples provided for the U6 in the website. This will scan the signals and store the interleaved arrays in a queue that will then be consumed by others. ScanAndPlot.java is a simple thread the will get the interleaved arrays from the LabJackU6Streamer.Java queue and plot the points in the channels we are interested... in this case, 0, 2 and 4. Thanks.

Attached Files



#7 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 11 July 2012 - 04:36 PM

Looking through your code, in your get stream loop I recommend setting "numScansRequested[0] = numScans" at the beginning of your loop. The LJUD.LJ_ioGET_STREAM_DATA eGet call sets numScansRequested, so the next loop iteration may have another value other that numScans unless you set it. I do see that your "while(rawChannelSamples.offer(adblData) == false) {" code may cause some invalid data issues in your queue. In cases where "numScansRequested[0] < numScans" you do not want to queue the entire array but only the first "numScansRequested[0]*channels.length" elements of it. Higher elements will have previous data readings which are invalid. This may be the cause of your "messed up" interleave arrays.

#8 Lucas Pereira

Lucas Pereira
  • Members
  • 8 posts

Posted 11 July 2012 - 05:24 PM

Thanks for the feedback... it makes sense what you say, but it doesn't solve my problem. I'm constantly looking to see if I get numScansRequested[0] < numScans, and even when I get all the scans I end up having the same problem! What I find really wired is the fact that this works well for 8 or less channels and not with more than that..

#9 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 13 July 2012 - 04:25 PM

I ran some tests based on the run function in your LabJackU6Streamer class with a scan rate of 3200 and 14 channels, and I have not been able to reproduce your issue of seemingly missing or displaced readings. The longest test I ran was for about 1 and a half hours, and the inputs were connected to a steady voltage to easily detect a change. About how long does it take for you to detect the error? Can you try reproducing the error without using ArrayBlockingQueues? I didn't use them in my tests, and I am curious if the problem lies with passing data between multiple queues and arrays, and having multiple threads.

#10 Lucas Pereira

Lucas Pereira
  • Members
  • 8 posts

Posted 22 July 2012 - 04:12 PM

I haven't tried to do this without the Java Collections framework, however I found out that one of my U6 (with firmware 1.26) would run my program without any problems... it has been running flawless for at least 3 days now. I've downgraded the firmware of the other two U6 I own and it is working... Any ideas of what may be leading to this problems? I must say this leaves me even more confused..

#11 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 25 July 2012 - 04:02 PM

At the moment we're not sure why downgrading worked for you, though we could not reproduce the problem with current firmware and Java. If you want to continue this, can you provide all of your Java code in your project? I didn't see in the code you provided how stream data gets from one class to the other, and we'll need all of this to try to reproduce it the problem with your program's timings.

#12 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 25 July 2012 - 04:03 PM

Also, if you don't want to post all of your code on the forums, you can email to use at [email protected] .

#13 Baxi

Baxi
  • Members
  • 1 posts

Posted 06 August 2012 - 11:05 AM

Hi,
Was the root cause for this issue ever found?

I am facing issue which sound quite similar to this...

However, I am using C# instead of java. But have faced similar issue... if I add more than 9 channels to stream it will start to get messy.
I have situation where I need to stream different amount of timers ( 1..4 ) and rest of the streamed channels are analog inputs. I am using 32 bit falling edges or rising edges timer( tried both just to see if that makes any difference ), this seems to be against the instruction mentioned here http://labjack.com/s...ers-guide/3.2.1, but in my tests it seems to work without any issues as long as you have less than 9 or 10 channels ). If I remember correctly I had more issues with earlier firmwares, but with 1.35 this seems to be working ok ( with less than 9 or 10 channels ).

Tried with 1.26 and 1.37 beta firmware as well. For me 1.26 caused other issues with timers and 1.37 performed similar to 1.35 that I am using normally.
Specifically this situation appears when I input square wave for timer with higher frequency ( above 1kHZ ). Could this have something to do with edge detection interruption taking extra time? Scan rate I have used has typically been 2000/sec

However, what I've found is that when I change timer clock to 12MHZ ( from 48MHZ ) this issue does not seem to happen. Could that bring some light why this is happening?
I would like to get extra resolution for timers and use 48M instead of 12M.

I tried to create some test app for reproducing this but cannot get that to fail... so this issue most likely has something to do with my primary app ( Unfortunately, I cannot share that app).
Anyway I am performing streaming in separate thread from UI thread... Streaming thread is defined to be running with high priority, and as said it works ok if timer clock is 12MHZ
I am running in Windows 7 64 bit
UD driver is 3.25 ( tried beta as well but that was not helping )


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users