LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loops

hi people,

I am working on an experiment in which I will be able to control the position of the motor using labview. I was successful doing it using methods like PID control and Velocity feedback control. My next step was to integrate camera to the VI. I created a while loop for the camera using Vision acquisition ( only when i use the while loop, the framerate is good). I also added another while loop for the motor VI so that both could run parallely and the results were good for some experiments. But, I face a problem in this particular method - Velocity feedback control. Here, when I use two while loops (1 for camera and another for the motor), Somehow the motor is uncontrollable. The camera is working fine, but i loose control over the motor, which is more important. To avoid this problem, i tried sequencing the loops with fake error inputs to the loops, I tried working with Sub VIs, and i still have the same problem. When I remove the camera off the VI, the motor works just fine. Can anyone help me out with this ?

I have attached three files. The Position control vi and the Camera_PID vi works fine, but am facing problem with the Camera_position with VF vi.

 

Thanks in advance. 

0 Kudos
Message 1 of 2
(2,201 Views)

First, you might want to avoid using Express VIs. THey are not written very well and are generally not the most efficient performance wise. They tend to do lots of setup calls which in reality only need to be done once. Secondly, you have greedy loops. That is they run as fast as possible and don't allow the scheduler to enable other code to execute. At a minimum you should put a Wait 0 in each loop. Each loop should have some mechanism to allow the scheduler to run. THe Wait 0 allows this. Other things like event structures, queues and notifiers also allow the scheduler to run. I suspect your performance issues are due to greedy loops and the Express VIs.

 

Another thing to consider is to separate your processing from your data collection. This can also improve performance. However you may not always be able to do this. It depends on your application. One thing you can do though is to separate your UI from your processing. UI updates can be a real performance killer.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 2
(2,193 Views)