Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I run multiple identical control programs all using a differnt motion axis

How can I run multiple identical control programs all using a differnt motion axis wihtout getting time delay problems.  If I just rename the executable utilizing one motion axis the second execututable is running ok as long as it utilized another axis.  However, the first executiable seam to slow down when the 2nd one is running, causing unpredictable stops in the first executable motion program.  The executable move through a series of different 1D move of changing direction, velocity and acceleration and occationally between on motion step and another it writes to a PLC to cause some action.  The problem is the timing of the PLC and the pause between each motion step is no predictable with more than one executable concurrently running.  What am I doing wrong?

 

0 Kudos
Message 1 of 4
(3,408 Views)
Hi Karlheinzs,
There are a couple of things that you can do.  I am assuming that you are running this .exe on a windows OS and that it is a LabVIEW .exe.  Please advise if my assumptions are incorrect.  I think you are seeing thread starvation.  The second .exe is using too much of the processor time and is not allowing the first .exe any time to execute.  You can try one of two things.

1. You can write an .exe that will control both axis.  In the while loops you will need to include wait functions to ensure that the processor can move between both threads (which will remedy the thread starvation).  With the code to control both axis in the same .exe, you can also synchronize the moves on the two axis (if necessary).

2. Windows operating systems are inherently non-deterministic which means that you will have some amount of software jitter when executing code on this operating systems (i.e. windows could preempt your .exe and run some other application for an extended amount of time which would cause incorrect timing).  If windows is the problem then you will need to go to a real-time operating system which will execute the code in a much more deterministic manner.

Best Regards,
Brooks W.
National Instruments
0 Kudos
Message 2 of 4
(3,388 Views)
Daer Brooks,
 
Yes I use Labview with Window. Are you saying that one big loop with 4 internal smaller loops (individual axis  and PLC control program) is more deterministic than four separate independent, but otherwise identical executables?  There are no other programs running than Window and the 4 identical executables.
 
Please confirm if that is the case before I start rewriting the program.  the individual executable are rather complex combining motion, PLC, and other data acqusitions and control hardware.
0 Kudos
Message 3 of 4
(3,380 Views)
Hi Karlheinzs,
It sounds like you are doing a lot of programming inside these loops.  You might be pushing your computer to it's maximum capacity, which could account for the poor execution behavior of the 1st .exe.  If this is the case then you might need to get a faster computer.  However, before you do this I would suggest putting all 4 smaller loops inside 1 single VI.  This way you will have greater control over timing of the individual loops.  This does not mean that they are going to be determinstic but it does give you the ability to ensure that thread starvation is not occuring.  Don't forget to put wait functions inside the loops to allow the other loops to execute.  I would suggest starting with a small amount of code in each of the loops and then incrementally adding additional code to determine if you are pushing the limits of your PC.

You had mentioned that these are the only 4 programs running on the Windows OS.  This does not necessarily mean that you are going to get deterministic behavior out of your .exe (because Windows runs a lot of programs behind the scenes).  However, you should get more deterministic behavior than if you had lots of other applications running as well.

Hope this helps,
Brooks W.
National Instruments
0 Kudos
Message 4 of 4
(3,367 Views)