LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real-time Data Transfer between two VI

Hi Good People,

Hope everyone is doing well. I am wondering what is the fastest way to transfer data from one VI to another VI? In my case,  One VI is running in the cDAQ another VI is running on the computer. I would like to transfer the data in real-time (1ms to 2ms) from one VI to another VI. Currently, I am using a shared variable and found 10 to 15ms delay in the communication. Could anyone please suggest me the best way to achieve my target?

Thank you.

0 Kudos
Message 1 of 6
(2,764 Views)

Hi Moni,

 


@Moni98ce wrote:

One VI is running in the cDAQ another VI is running on the computer.


It would clarify ambiguities if you would tell the specific type of cDAQ. Usually cDAQs don't run VIs on their own…

 


@Moni98ce wrote:

I would like to transfer the data in real-time (1ms to 2ms) from one VI to another VI. Currently, I am using a shared variable and found 10 to 15ms delay in the communication.


Why don't you use "standard" network protocols like TCP or UDP?

LabVIEW also provides network streams…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,731 Views)

Hi GerdW,

I am using cDAQ9133. I am measuring force using a load cell and collecting it to cDAQ. This load transferred to another VI which is running to in the cDAQ and calculating the displacement by solving the equation of motion. Then this displacement is sending to the VI running in the host PC. Host PC sending this displacement to the controller. Controller communicating with the motor driver and finally motor driver sending it to the linear motor. The connection between host PC and cDAQ is through USB and host PC and controller through Ethernet.

The whole process taking 20~25ms but I would like to do it 1~2ms. 

0 Kudos
Message 3 of 6
(2,715 Views)

@Moni98ce wrote:

Currently, I am using a shared variable and found 10 to 15ms delay in the communication. Could anyone please suggest me the best way to achieve my target?


One of the many reasons I state that Network Published Shared Variables are evil.  Personally, I am a fan of using the STM library with TCP/IP.  Others prefer Network Streams.  If you are just sending the same information each transmission, the Network Stream will probably work better for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(2,711 Views)

@Moni98ce wrote:

Hi GerdW,

I am using cDAQ9133. I am measuring force using a load cell and collecting it to cDAQ. This load transferred to another VI which is running to in the cDAQ and calculating the displacement by solving the equation of motion. Then this displacement is sending to the VI running in the host PC. Host PC sending this displacement to the controller. Controller communicating with the motor driver and finally motor driver sending it to the linear motor. The connection between host PC and cDAQ is through USB and host PC and controller through Ethernet.

The whole process taking 20~25ms but I would like to do it 1~2ms. 


Why even have the PC in the loop?  Just have the cDAQ send the data straight to the controller over Ethernet?  That would eliminate a bunch of your delay.

 

Also note that the data sheet for the cDAQ-9133 states that the USB connection is not recommended for normal operation.  It is recommended for "device configuration, application deployment, debug, and maintenance."  My recommendation is to have a good Ethernet switch to connect your host PC, cDAQ, and controller.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 6
(2,706 Views)

Thank you for your response. Yes, I know if I can communicate the driver from the cDAQ then it would be great. However, there is some limitation of the controller and driver that I am using that's why it is not possible to communicate from the cDAQ directly. Do you think the presence of USB communication between host PC and cDAQ causing some delay? My current looped time is 5ms and I am observing in the first 10 to 15ms there is no data for the linear motor. Which means this time taking for transferring data from cDAQ to host PC to the linear motor. 

0 Kudos
Message 6 of 6
(2,701 Views)