Streaming UE9 and Data Not Being Logged


Recommended Posts


I wonder if anyone can answer a couple of questions I have regarding the use of the LabJack UE9 and DaqFactory.

Is it possible to use the LabJack in streaming mode across a network? I have tried the USB streaming example and that works fine. I am wondering if I have a configuration problem when using the example code to access a networked device. I have added a new LabJack device (#1) in DaqFactory and set the IP address accordingly, I then modified the example code to call device #1. No data is being acquired on any channel when I view the channel lists.

Secondly, I have a issue with DaqFactory dropping the occasional bit of data from the data log. I am logging 5 channels of data. Four are being sampled at 1Hz and one at 10Hz. The 10Hz channel has been set to average 10 samples and thus give the same effectivesample rate as the others. In the log object I have set it to log a snapshot once every second. Every now and then in the log file I get a line of data which contains the timestamp and the averaged channel data but no value from the four channels which are being sampled at 1Hz.

Thanks in advance


Link to comment
Share on other sites

Yes you can certainly stream the UE9 over Ethernet. In fact, it is slightly faster over Ethernet. As to your problem, I would first make sure you can communicate with the device at all by simply polling the device once a second instead of streaming. If you get that and the stream still doesn't work, please email your document and any error messages.

Also, one thing that comes to mind: did you remember to change the D# on the channels that receive the data? This must match the D# you assigned your UE9 too.

As for your logging problem, if you are looking to simply log once a second snapshots, you might want to use an export set instead and then use a sequence to trigger it. The export set would have [0] in all the expressions to log only the most recent value, then the sequence would simply start the export set once a minute:

while (1)

The big advantage of this method is that you can start and stop at will, and you can easily switch it to event driven logging, where the logging set is really designed for continuous logging.

Link to comment
Share on other sites


Thanks for your reply.

I will try the streaming example again tomorrow and will let you know if I get it working.

With regard to the logging, the application has to log data all the time. On further investigation I have found the following happens with one channel set to acquire at 10Hz (and averaging 10 samples) and four channels set to acquire at 1Hz:

If I set the logging object to log all data points with the alignment parameter set to 0.05s there is a difference in time stamps on the data of 0.7s between successive lines in the log. Data from the four 1Hz channels appears on one line with the first channels data empty and the second line contains the data from the 10Hz averaged channel appearing 0.7 seconds later. Ideally I would like to average the 10Hz channel so on the tenth sample the data is averaged then the four 1Hz channels sampled so that the data is timestamped with same time.

If I set all five channels to sample at 1Hz the data is timestamped with the same time as would be expected, and if I sample all channels at 10Hz and do ten sample averaging on the channels the data appears to be timestamped with the same timestamp too.

How does the averaging of channel data work? I am assuming that if you set one channel to 10Hz sampling

and other channels to 1Hz sampling that they are synchronised and the 11th sample on the 10Hz channel will coincide with the second sample from the 1Hz channels.

Thanks for your help


Link to comment
Share on other sites

No, not quite. Anytime you create a group of channels with different Timing / Offset parameters, they run in a different thread. These threads are synced in time, but the averaging point (i.e. where in the second it decides to take 10 points) is pretty much determined by when the document is loaded and is not predictable. I'd bet if you quit and restarted it would land on a different time than the 0.7 point in the second. You have a couple choices:

1) Unless you have a reason not to, I would just sample all the channels at 10hz and average them all. With the UE9 you are well within the bandwidth, so the only reason why not would be if you need an instantaneous reading every second instead of the average

2) You can sync up the average with the 1 second reads using an event in one of the 1 second channels and a new averaged channel. To do this:

a) create a new channel, lets say you call it datafinal. Make it just like your raw 10 hz channel, but give it a channel number in the thousands (one that doesn't really exist) and set the Timing to 0. This is the channel you will want to log instead of the raw 10 hz

:) Turn averaging off on the 10hz channel and set the history to something small like 20.

c) in the event for one of 1 second channels put:

private average = mean(rawdata[0,9])
average.time[0] = mychannel.time[0]

The first line calcs the average of our 10hz data (which I assumed you called rawdata). By doing [0,9] you are taking the mean of the last 10 data points.

The next line simply injects the time of this channel into our average so it lines up. I'm assuming your 1 hz channel that holds this event is called mychannel.

The final line takes that data and injects it into the datafinal channel. Now this channel will hold the 10 point average of 10 hz data lined up to mychannel. The average is calced every time mychannel gets a new value.

Link to comment
Share on other sites


I have retried the UE9 streaming example and it now works fine over ethernet.

For this application it will be ok to sample everything at 10Hz and then average the data. Should I need to revert to the 1Hz sampling I will sync up the data using the method you have outlined.

Thank you very much for your help.


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.