Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow transfert data TCP/IP from host to RT


          Hi,

    First of all, I'm a pure noob in labview RT, so excuse me for my (first) simple question...

     I'm trying to create an application with labview RT to control 4 galvanometers (quick motors, response time ~2-3ms). I would like to control these one with an host computer who send the position informations using a TCP/IP protocol to the PXI (there is a direct connection (with cross cable) between the PXI and the host PC, so no other interaction on the line Smiley Wink).  After some research, I've found a solution on the support of the NI web site (and in the example finder) with two loop, the first one read the data from the TCP/IP connection and store these one in a FIFO. The second one read the data in the FIFO and send the command to the output. These two loop must work at 1KHz of sample frequency.
     To test if my configuration works, I've load the two VI's on the PXI (an 8186-RT) and I try to make these run. In fact all the process seems to work, but not at a good speed, everything works by intermitence with hang up and restart.
      I've attach the PXI VI.
      Can you help me ?

                 Thanks a lot,

                                    Pi-r
0 Kudos
Message 1 of 5
(4,136 Views)

            Hello,

    I've tried an other solution consisting of an adaptation of the example provided with labview RT cith the host PC command and the target sending informations in a less critical loop... It seems that it's doesn't work better (I've joined the library with all the files I've load in the PXI, the loaded file is the PXI_startup.vi)...
     Please can someone help me, I'm in a hurry for my phD !! Thanks again for reading me...

             Pi-r

0 Kudos
Message 2 of 5
(4,131 Views)
Here is what you need, it is in my opinion the best method for transfering data to the host. 
 
 
Let us know what you think. 
 
 
Preston Johnson
Solutions Manager, Industrial IoT: Condition Monitoring and Predictive Analytics
cbt
512 431 2371
preston.johnson@cbtechinc
0 Kudos
Message 3 of 5
(4,128 Views)

            Hello,

   I've tried this method, and even the example alone is not "so" real time, there still a delay between the change of the command, the application and the return of the result (but maybe I've made some errors ??)... I can not permit this delay in my program...

          Thanks,

                 Pi-r

Message Edited by pi-r on 08-19-2005 12:34 AM

0 Kudos
Message 4 of 5
(4,126 Views)

Hi,

So, the PXI_startup VI is the Vi that's running on the PXI system.

So let me try to understand this. In the first structure you Initialize your hardware, so that's ok but the rest doesn't really look like a RT application. After the Initialization step you will use the TCP VIs to wait for a certain operation that has to be sent by the HostVI. So when you receive the commmand "1", you go to your Case 1 in the Case structure. You then start the Coil Test. Suddenly you are using Timed loops, that's no problem but you should use them everywhere then. Ok, so you start your Coil acquisition but in the meanwhile you are not able to accept a new Operation from the Host VI because you acquisition is still in progress and you have to Wait until the loop has finished. When your Coil test loop has finished then you can handle a new command from the Host VI again.

Btw: The TCP/IP listen VI and the Close connection VI have to be outside the While loop otherwise you are reopening the connection all the time which will cause delays.

Where are the two parallel loops? The Time-Critical loop and the Communication loop? The Communication loop with the TCP/IP communication must be able to run seperately from the acquisition loop. That way you can still handle another command from the HostVI while you are doing the acquisition. You really must have a seperate loop that only handles the TCP/IP communication at a lower priority and you must transfer the data between TCL loops and Com loops with RT FIFO's. Just check a simple application created with the RT Communication Wizard.

Maybe all of this was intended but it seems a bit strange.

If you execute the next case with the Read Galvas.vi (This one will have to wait until case 1 has finished) then I cannot find any RT structure. You first loop seems to put the data in the RT FIFO and the second loop sends the data to the host. This first loop is running at full processing speed at the same priority as the second loop which basically means that the first loop doesn't provide any sleep time for the second loop to execute. That's probably the main reason why the AcqData loop doesn't send data fast enough to the HostVI.

Use the RT System Manager (Tools menu) to check the CPU usage of your application. I'm almost sure that you will have a Time consuming loop or action somewhere that uses up all the CPU and that blocks communication.

I cannot rewrite the application but check the tutorials about the RT architecture on our website. I think that the way you have programmed your code now that you don't actually use the RT advantages.

Regards.
 
JV
0 Kudos
Message 5 of 5
(4,119 Views)