LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real TIme

Solved!
Go to solution

HI everyone,

I am writing here because I have a problem using a Real Time Controller (NI 3100 RT) in my application.

The controller is used to send a TCP/IP packet to a SCARA Robot controller that must receive an update every 8ms (this is the reason why I used the RT controller) and read the packet from the robot. A PC is connected by means of an ethernet cable to the RT controller, so the user can select the final position, the speed, etc. and visualize the position of the controller and the values of some load cells.

So the PC and the RT controller share some global variables (the end effector position, the value of the normal force,...).

The application works fine. The problem is that, after some minutes, the RT controller loses the connection with the robot, and from the robot I get the error message related to a packet delayed; so I guess that the VI had some problem to send the position update in 8 ms. 

If i run just the VI on the RT controller, without launching the VI on the host PC, everything works fine; when the RT communicates with the PC, i get the timing error.

What can I do to solve this problem? In the RT controller vi I made two loops, an high priority one, to send the packets to the robot, and a low priority one for the communication with the PC, but the problem is still there. I also tried to modify the parameters related to the timed while loop (timeout, deadline, discard missed periods, mantain original phases), but without any good result (but if i uncheck the "Discard missed periods" box, the problem occurs less frequenty).

I attach some screenshots related to the target.vi, in particular the options related to the timing of the two loops, and how I implemented the low priority loop.

Another question: are there some options in the global variables section that can help me in solving the problem?

Every suggestion will be great,

Thank you very much to everyone.

 

Carmine

 

0 Kudos
Message 1 of 10
(3,441 Views)

Hello Carmine, 

 

There are some things that you can check in order to be sure that the connection between the robot and the rt controller is deterministic.

First of all, the TCP/IP connection is not a deterministic connection since it uses Ethernet driver. So I hope that you haven't created the tcp connection inside the high priority loop but outside. 

An other thing that you have to pay attention to, is the type of shared variables you use for transfering deterministic data between the RT and the robot. You did well that you used network shared variables inside the low priority loop, but in the high priority loop the shared variables should be network shared variables with the RT FIFO enabled.

When you create a shared variable FIFO, the FIFO is created the first time a variable is read from or writen to, which might result in a small delay. So it would be a good idea to initialize outside the deterministic loop the shared variables you use inside, or allow a delay in the first iteration of your loop as the FIFO is created.

Were these advice of any assistance? 

Would you like to attach you project in your next response?

Regards,

 

Antonios
0 Kudos
Message 2 of 10
(3,371 Views)

Dear Antonios,

thank you very much for your reply.

In my code, I open the TCP connection outside the loop (the only way to connect to the robot controller is through TCP/IP..so with the labview libraries robot for denso that I use I open the connection and then I use that connection) but then I write and read the data throught TCP/IP connection inside the loop. Is it ok, or should I put also the TCP/IP communication between the RT target and the controller outside the loop? 

 

I tried to set my global variables as RT FIFO, but also if the global variables are defined outside the high priority loop, I get an immediate disconnection.

 

Another interesting thing is that if I run just the vi on the real time target, I have no problem (but of course I can't control the robot); if I disable the global variables and i run the target.vi and the host.vi, I get the problem.

 

I attach you the whole project (maybe you don't need most of the file that are here). The project is in the folder Denso_RT. In the project I used some libraries of the ImagingLab for the Denso robots.

 

Thank you very much again,

Carmine

 

0 Kudos
Message 3 of 10
(3,350 Views)

Sorry, the internet connection is my lab is really bad.

As soon I reach home, I upload the project.

Thank you again for your help,

Carmine

0 Kudos
Message 4 of 10
(3,337 Views)

Ok, I hope it works now.

This is the project.

Carmine

0 Kudos
Message 5 of 10
(3,334 Views)

Please do not creat a new thread everytime you try and post on this topic, it makes it very difficult to follow along and assist you.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 6 of 10
(3,314 Views)

I am really sorry,

I was just trying to reply to my precedent post, and I don't know why it considered it as a new thread.

Hope it doesn't happens again.

Thank you,

Carmine

0 Kudos
Message 7 of 10
(3,310 Views)
Solution
Accepted by topic author Carmine84

Hello Carmine,

 

i took a look at your application. There are some things that you can do in order to make your program run faster.

1. Initialize all your shared variables outside the timed loops, give them just a value, whatever. Processin shared variables needs time and by doing this outside from the loop you will save a lot of time.

2. The TCP/IP Connection should be implemented outside from the loop since this connection is not deterministic. I think the best idea would be to implement a Producer Consumer with RT FIFO as you see in the following example.  https://decibel.ni.com/content/docs/DOC-4610

So you will create you time critical loop as you already did, and under the time critical loop you will create the producer consumer implemantation, giving the same priority to the producer and the consumer. You can implement the TCP IP connection in the producer loop and make the reading and casting of the data in the consumer loop. In this way you keep in the time critical loop only the conditions (case structures) that have to be done deterministically.

3. You should avoid converting the data in the time critical loop. When you convert data, the Memory manager is accesed to save the new data type, which needs time.

4. The same things happen with the subvis, and the subvis into the subvis! Especially when inside the subvis you make another conversion . I know that your code would look bigger inside the time critical loop, but it is better than having subvis.

 

I hope the above advice help!

 

 

Antonios
0 Kudos
Message 8 of 10
(3,278 Views)

Dear Antonios,

thank you so much for your help.

Implementing the TCP/IP communication outside the loop solved the problem.

 

Best Regards,

Carmine

0 Kudos
Message 9 of 10
(3,261 Views)

Dear all,

I am getting attached error, How I dont know.

When I run my RT project, this error comes after 10-15 min and whole project get stop and connection between RT system and Host pc get dissconnected. 

0 Kudos
Message 10 of 10
(3,211 Views)