LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loop slow initially, then normal speed

Without reading every post in detail and without looking into any of your sources:

PID require "warmup iterations" in order to run properly. I can imagine that you are facing this.

 

And i hope that you are running this on a real time system? If not, determinism is not reliable.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 11 of 17
(558 Views)

Hi Norbert_B

 

I am not sure if iteration warm up is my problem or not, I have looked it up and hope its not as I can not see a simple solution. I have however done some further testing and have narrowed down the offending loop to the daq mx write (see attached). It iterates once a second for the first 3 seconds , and then runs at normal speed

 

Has anyone any suggestions at this stage

 

Regards

Greg

0 Kudos
Message 12 of 17
(538 Views)

You don't have any kind of timing in that while loop.  So that loop is trying to run as fast as possible?  Are you sure it is actually running slow?  Running a loop as fast as possible can cause the UI thread that updates the front panel indicators to be starved.  So it may look like it is running slow when it is actually running too fast.

0 Kudos
Message 13 of 17
(533 Views)

Many thanks for your reply, I will not get to test the system again until Tuesday. Which timing function would you recommend to use and how much time delay!

 

Regards

Greg

0 Kudos
Message 14 of 17
(524 Views)

The question is how quickly do you need to update that output?  Putting a wait function in there with a zero wired to it will allow it to update extremely fast, but still allow time for the CPU to handle other tasks.  But I doubt you need to update it that fast.  Perhaps you only need to update it when the value changes, in which case a queue that is setup to pass the data into the loop instead of using the local variable would be the better choice.

 

Look for producer/consumer architecture in the forums and in the LabVIEW templates.

0 Kudos
Message 15 of 17
(519 Views)

Many thanks for your advice Ravens Fan. I only need to update when the PID output value changes. I will use trial and error to find the most suitable delay. I will not get a chance to do this until Tuesday, but will let you know how I get on. I may only be afforded another week or two to get this project working, so here hoping the delay works

 

Thanks again

Greg

0 Kudos
Message 16 of 17
(511 Views)

Hi all

 

Time is up!!! I am afraid my project will be submitted on Wedneday. I have spent some time on the project over the weeekend, but failed to solve the issue. Timing in the loops made no difference. Following some testing, I have it narrowed down to the Daq mx write. It outputs 50% duty cycle for the first 3 seconds no matter what I do. I have elimated all the other code and wired a numeric control to the duty cycle input of the daq mx write. Following the first 3 second, it outputs according to the numeric control value.

 

Thanks everyone for your help on this

 

Kind Regards

Greg

0 Kudos
Message 17 of 17
(497 Views)