Labjack t7 Streaming | LabJack
 

Labjack t7 Streaming

9 posts / 0 new
Last post
knight1504
knight1504's picture
Labjack t7 Streaming

HaLLO , I have a question, I have a frequency converter that controls the motor. The anaLOg output from the frequency converter (outputs the speed of the motor) is connected to the analog input from the Labjack T7.
Now I want to stream all the data from the analog input for 2 to 3 mintuten while the motor is running. 
I have tried until now to program that the engine runs and stream data from Labjack, but I can't change the speed of the engine during the stream, only after the stream I can change it
Thank you very much.   
  

 

LabJack Support
labjack support's picture
I'm afraid I don't understand

I'm afraid I don't understand, but let me take a guess at what you might be asking.

You need to control an analog output on a T7, while at the same time streaming readings from an analog input.  Currently you are using LJStreamM, but it is input only, so you are wondering how to control an analog output while streaming.  Sound right?

Indeed LJStreamM is input only, so the simple answer is that you need to use a different software option:

https://labjack.com/support/t7-software-options

 

knight1504
knight1504's picture
Hi , thank you very much for

Hi , thank you very much for your reply 
I apologize for my bad English , I thank you very much for the support 
I have here a Raspberry pi, motor, and inverter, and Labjack T7
The Rapsberry pi controls the motor via the inverter, the inverter gives the actual speed of the motor via its analog output. 
This analog output is connected to the analog input of the Labjack T7. And I want to stream these values ( the actual speed ) via Labjack T7
I am writing a Python script here to do both tasks at the same time 
1st task : The Raspberry pi starts the engine and controls it according to the desired speed. 
2nd task: to stream the actual speed of the motor via AIN0 (continuously for 2 min, even if the speed is changed in between)   
My problem is : that I start the motor via the Raspberry Pi at speed A , then the Labjack starts to stream , during the stream , I want to change the speed of the motor to B , but the Labjack can not be stopped , only after a scan of 5000 , it stops , then I can only change the speed
I want Labjack to stream only in the background, while I change the speed of the motor and so on. 
Thank you very much 

Translated with www.DeepL.com/Translator

knight1504
knight1504's picture
Here is the python code ,

Here is the python code , which i wrote 

 

File Attachment: 
LabJack Support
labjack support's picture
We can just as equally

We can just as equally apologize for not speaking your language so don't worry about it.  It will just take us a little longer to communicate with each other.

I'm going to mark this for a Python expert to follow up and help more.

knight1504
knight1504's picture
Thank you for understanding. 

Thank you for understanding. 
if I might ask when I might get the answer 
Thank you very much.  

LabJack Support
labjack support's picture
Look into using the stream

Look into using the stream callback functionality. The callback function that performs the stream read has its own dedicated thread, so the stream callback function code with the stream read can run concurrent with your other code, such as the motor control. In our LJM Python examples download, refer to the Examples\More\Stream\stream_callback.py example.

Alternatively, for code concurrency you can use threading or multiprocessing. Run your stream read code in one thread/process, and your other code in another thread/process.

knight1504
knight1504's picture
Thank you very much for your

Thank you very much for your help , that help me a lot 

I have tried the multiprocesscing but i cant change the speed , and the Labjack can only take the data of the 1.st desired Speed

Here is the code which i wrote and some note to describe my problem 

I would like to thank you one more time for your help 

Hope your reply 

File Attachment: 
LabJack Support
labjack support's picture
To confirm, you are only

To confirm, you are only getting stream mode data from your first motor control speed. From what I can tell code wise, it looks like you are only streaming 1 second of data based on your scanRate of 1000 and scans of 1000, and no looping acquireData. By the time you get the user input for the next speed, that 1 second stream finished.

If you want to continuously stream data to see you speed changes, perform multiple stream reads in a loop while you AKD code is running. If needed, you can exchange data between your processes to indicate when to stop your stream read loop. The multiprocessing documentation goes over ways to exchange data and share states.