Dear Labjack,
Currently i am testing the stream functionality using python code. I have connected the Labjack T7 via Ethernet port. I am able to succesfully stream about 40 AIN channels at 1000Hz and 1000Scans (40000 values per second). I have set the resolution index to the minimum at 1(For 16-bit) and settling time i have set to 8uS as it was mentioned in https://labjack.com/support/datasheets/t-series/appendix-a-1
But in the case of 64 channels at 1000Hz and for 1000Scanes(64000) values i get the following error message
Streaming with streamBurst ...
LJM library error code 1263 LJME_NO_RESPONSE_BYTES_RECEIVEDProcess finished with exit code 0
I have attached the Python code below - Could you kindly assist in understanding this issue?
"""
Demonstrates how to use the streamBurst function for streaming.
"""
from datetime import datetime
import sys
from labjack import ljm
# Open first found LabJack
handle = ljm.openS("ANY", "ANY", "ANY") # Any device, Any connection, Any identifier
#handle = ljm.openS("T7", "ANY", "ANY") # T7 device, Any connection, Any identifier
#handle = ljm.openS("T4", "ANY", "ANY") # T4 device, Any connection, Any identifier
#handle = ljm.open(ljm.constants.dtANY, ljm.constants.ctANY, "ANY") # Any device, Any connection, Any identifier
info = ljm.getHandleInfo(handle)
print("Opened a LabJack with Device type: %i, Connection type: %i,\n"
"Serial number: %i, IP address: %s, Port: %i,\nMax bytes per MB: %i" %
(info[0], info[1], info[2], ljm.numberToIP(info[3]), info[4], info[5]))
deviceType = info[0]
# Stream Configuration
aScanListNames = ["AIN0", "AIN1","AIN2","AIN3","AIN120","AIN121","AIN122","AIN123","AIN124","AIN125","AIN126","AIN127","AIN48","AIN49",
"AIN50","AIN51",
"AIN52",
"AIN53","AIN54",
"AIN55",
"AIN56",
"AIN57",
"AIN58",
"AIN59",
"AIN60",
"AIN61",
"AIN62",
"AIN63",
"AIN64",
"AIN65",
"AIN66",
"AIN67",
"AIN68",
"AIN69",
"AIN70",
"AIN71",
"AIN72",
"AIN73",
"AIN74",
"AIN75",
"AIN76",
"AIN77",
"AIN78",
"AIN79",
"AIN80",
"AIN81",
"AIN82",
"AIN83",
"AIN84",
"AIN85",
"AIN86",
"AIN87",
"AIN88",
"AIN89",
"AIN90",
"AIN91",
"AIN92",
"AIN93",
"AIN94",
"AIN95",
"AIN96",
"AIN97",
"AIN98",
"AIN99"
] # Scan list names to stream
numAddresses = len(aScanListNames)
aScanList = ljm.namesToAddresses(numAddresses, aScanListNames)[0] # Scan list addresses for streamBurst
scanRate = 1000 # Scans per second
numScans = 1000 # Number of scans to perform
try:
# When streaming, negative channels and ranges can be configured for
# individual analog inputs, but the stream has only one settling time and
# resolution.
if deviceType == ljm.constants.dtT4:
# LabJack T4 configuration
# AIN0 and AIN1 ranges are +/-10 V, stream settling is 0 (default) and
# stream resolution index is 0 (default).
aNames = ["AIN0_RANGE", "AIN1_RANGE", "STREAM_SETTLING_US",
"STREAM_RESOLUTION_INDEX"]
aValues = [10.0, 10.0, 8, 1]
else:
# LabJack T7 and other devices configuration
# Ensure triggered stream is disabled.
ljm.eWriteName(handle, "STREAM_TRIGGER_INDEX", 0)
# Enabling internally-clocked stream.
ljm.eWriteName(handle, "STREAM_CLOCK_SOURCE", 0)
# All negative channels are single-ended, AIN0 and AIN1 ranges are
# +/-10 V, stream settling is 0 (default) and stream resolution index
# is 0 (default).
aNames = ["AIN_ALL_NEGATIVE_CH", "AIN_ALL_RANGE",
"STREAM_SETTLING_US", "STREAM_RESOLUTION_INDEX"]
aValues = [ljm.constants.GND, 10.0, 8, 1]
# Write the analog inputs' negative channels (when applicable), ranges,
# stream settling time and stream resolution configuration.
numFrames = len(aNames)
ljm.eWriteNames(handle, numFrames, aNames, aValues)
print("\nScan list:")
for chan in aScanListNames:
print(" %s" % chan)
print("Scan rate = %s Hz" % scanRate)
print("Sample rate = %s Hz" % (scanRate * numAddresses))
print("Total number of scans: %s" % numScans)
print("Total number of samples: %s" % (numScans * numAddresses))
print("Seconds of samples = %s" % (numScans / scanRate))
print("\nStreaming with streamBurst ...")
start = datetime.now()
scanRate, aData = ljm.streamBurst(handle, numAddresses, aScanList, scanRate, numScans)
end = datetime.now()
print("Done")
skipped = aData.count(-9999.0)
print("\nSkipped scans = %0.0f" % (skipped / numAddresses))
tt = (end - start).seconds + float((end - start).microseconds) / 1000000
print("Time taken = %f seconds" % (tt))
ainStr1 = ""
ainStr2 = ""
lastScanIndex = len(aData) - numAddresses
for j in range(0, numAddresses):
ainStr1 += "%s = %0.5f, " % (aScanListNames[j], aData[j])
ainStr2 += "%s = %0.5f, " % (aScanListNames[j], aData[lastScanIndex + j])
print("\nFirst scan: %s" % ainStr1)
print("Last scan: %s" % ainStr2)
except ljm.LJMError:
ljme = sys.exc_info()[1]
print(ljme)
except Exception:
e = sys.exc_info()[1]
print(e)
# Close handle
ljm.close(handle)
Make sure you are running the latest version of the T7 firmware v1.0242 (release) and LJM library v1.17. The firmware can be updated with our Kipling application and the latest software installers with LJM can be found here:
https://labjack.com/support/software/installers/ljm
If you are running into your problem with the latest firmware and library, what operating system are you running on? I ran your code on a Windows 10 desktop and it ran without issue.
I have done as you have asked. All the software mentioned is at the latest version. And i am currently running the code on Windows 7. The Error still persists. I am unsure as to where the problem is.
Hello. I've reproduced the issue and am currently investigating. It may be a problem with the LJM library. I will update this thread when there is a solution.
Thank you Kindly Dear Labjack Support team. For me it seems to be the same as well. For some reason 1/ out of 25 executions work. But the remaining fail. If you may kindly also assist in sharing a code to locally save the streamed burst of the aforementioned code locally would be highly appreciated. It seems to me that the code executed simulates the transmission and only yields the results of first and last values.
The code in the stream burst example program only outputs the first and last values for demonstration purposes. All of the values (all numScans * numAddresses values) are returned from ljm.streamBurst in the second item of the return tuple, which is named aData. Running the following Python code shows more:
from labjack import ljm
help(ljm.streamBurst)
To save the data locally, you should determine what you need to do with the data. If you simply need to print it out, you can use a for loop to do so. If you need to save it to a file, you can use the Python file API to do so. There are infinite different ways in which data may need to be processed, which is why LabJack cannot provide code for all of them.
Thank you Labjack. Indeed the API helped to save incoming stream of data to an excel file. But the problem of having to stream 64 to 66 channels still persists and i still get the error code 1263. Could you kindly assist on this issue.
A temporary workaround could be to use a USB connection or to use a Windows 10 computer. However, we are working on fixing the root issue and we will update this thread when we have a solution.
There is a temporary LJM updater program available here:
files.labjack.com/temporary/LabJackMUpdate-1.1701.exe
Running that program will install a new version of LJM on your system. That new version of LJM is 1.1701. LJM 1.1701 limits the maximum number of bytes that may be sent, per packet (per call to send) to be 520 by default. This may negatively affect the maximum achievable stream throughput. (The maximum samples per second may be reduced.)
Please try running LabJackMUpdate-1.1701.exe, then see if you can stream as many channels as you need to.
If it still does not work, please open ljm_startup_configs.json and change this line:
{"LJM_MAX_NUM_BYTES_PER_PACKET":"default", "type":"integer"},
...to be:
{"LJM_MAX_NUM_BYTES_PER_PACKET":100, "type":"integer"},
Please let us know if it works, as we may need your help to make a future LJM version or firmware version that fixes this issue in a more efficient way.
The lines I gave for ljm_startup_configs.json were mistakenly the same. I've edited my previous comment.
Hi Labjack Support, There seems to be no change i connected via USB, installed the new updater you provided. I also did the manual fix you mentioned. The error persists.
Please send an LJM debug log by doing the following:
How is this going? Do you need any assistance getting the log recording?
We have an experimental firmware version that you can try that we will make available to you soon.
Hi Labjack Support,
Sorry for the late response. I have done as you have requested. And i have attached the Log file as well. Kindly assist in rectifying the issue. I would like to try this experimental firmware as well.
Another thought,
Will i be able to access 8 Labjack T7s from one gateway. I am trying to build a project that could perhaps split 64 channels across 8 Labjacks. Which means the Gateway CPU would communicate with 8 Labjacks simultaneously to receive data totaling 64 channels?
We found that large Ethernet packets were getting fragmented in a way that was causing the parsing of the modbus packets to fail. This caused the same behavior and errors that you described. Unfortunately, a couple of testes, including the USB test, seem to indicate a different problem.
Try updating your T7's firmware to 1.0249. Please let us know if the new firmware helps. In the meantime we will look through you log for clues to a different culpret.
From looking at your ljm.log, it doesn't seem like firmware 1.0249 will fix the issue. ljm.log doesn't show exactly what the problem is either, except that it shows 874 scans of data arriving from the T7 before the next read times out. We haven't been able to replicate this issue (I previously thought I had, but had found a separate issue).
To help debug this, please collect and send us ljm.logs for the following variations on your program (above):
1. Stream burst with numScans = 1500
2. Stream burst with numScans = 1000 (it would be good to know if it consistently stops at 874 scans or if it varies)
3. Stream burst with numScans = 874
4. Stream burst with numScans = 10
Please run these variations a couple of times and let us know if they always fail or always succeed.
5. Please also try running stream (without stream burst) with the same configurations and let us know how it goes. I've attached a modified version of stream_basic.py that streams with the same configurations.