08-04-2014 05:57 PM
Hi everyone,
I am using the timed loop to control the DC motor with the PID vi. in the loop and the sampling time is set as 0.01s. However, after I added some other VIs into the loop, for instance, the write to measurement file.vi, to collect the errors between the desired angle and the practical angle of the motor during the time histroty of the motor's motion, it is found that the sampling time changed, not always 0.01s before the vi was added, but 0.01 or 0.02s. the whole program desinged to be fininshed with 7s now it is done at 9.4s, i.e., the time to run the loop is extended.
Another thing is, if the sampling time is set as 0.05s, the sampling time is always 0.05s and the time to run the loop is always 7s as predined, no matter the write to measurement file.vi is added into the loop or not.
Through this, I think if the complexity in the loop is incresead and the set sampling time is small, then the actual sampling time will be changed because of the computational burden of the things in the timed loop. Is this the reason? If so, are there some methods to solve it ?
An important thing is: the collection of the angular error of the motor in the time histrory is quite important, which will be used to demostrate the rightness of the KP, KI and KD parameters.
Some friend suggests to use the queue vi, but I am not quite sure how to use them. Can anyone gives some instrctions?
Thansk very much!
Cheers
Solved! Go to Solution.
08-04-2014 08:12 PM
08-04-2014 08:48 PM
From the sounds of your controls/measurement and file write are all occurring within the same loop and overrunning your desired capture period. If you want to speed up this loop you can always move the File-write to outside of this loop, this should increase performance significantly as File I/O is often the slowest part of a program.
Otherwise it is possible to move the sampling to a second parallel loop that will record the data and then post it to a queue to be processed in the seperate loop. For more information about Queues, Have a look at the "Queue Basics" and "Queued Message Handler" examples available within LabVIEW.
Generally the most effective way of asking for help is to present a simplified version of your VI with an explanation of what you believe is causing the problem, so if you want any more specific help don;t hesitate to ask.
08-06-2014 05:59 PM
GOOD WAY! MAKE IT! THX SO MUCH!
08-06-2014 05:59 PM
GOOD WAY! MAKE IT! THX SO MUCH!
08-06-2014 06:00 PM
GOOD WAY! MAKE IT! THX SO MUCH!