Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

problem with motor control using external clock

Hi everyone, 

i have a problem with my project, i try to control a motor but too many oscillations occur. I was suggested to post here, i have already recieved some help and info. Here's the link where i posted first time : http://forums.ni.com/ni/board/message?board.id=40&thread.id=7887&view=by_date_ascending&page=1

and some progress i've made. At the last post is where i'm stucked.

 

 

If someone can help i'd be grateful... 

0 Kudos
Message 1 of 8
(4,495 Views)

Hi,

 

Are you using the LabVIEW PID Toolkit?

 

Assuming yes, what is your level of understanding of how the P, I, and D terms affect the response of your system? Too high of P can cause greater oscillations. D can help you control the overshoot, but slows down the transient response.

Jeff | LabVIEW Software Engineer
0 Kudos
Message 2 of 8
(4,486 Views)

Hi Jeff, thanks for responding,

I understand how the PID works, but the gains can be changed easily (i mean if the controller doesn't work i can try easily other gains) so don't take the gains i have in the vi for granted . Firstly i designed my controller from matlab, where i have the model of my real system, and i found the gains i need. Also i found that if the sample rate is low i will have oscillations so i added the external clock. Anyway if you take a look at the link at the last post i have a vi attached where i use the pid.vi . But i'm not sure that the problem is there at the pid..

0 Kudos
Message 3 of 8
(4,481 Views)

Hi fil.pagono,

 

So, by external clock, you mean the clock on the DAQ device, right?

 

See, I don't think you're quite understanding what's happening here. You're doing a buffered acquisition instead of a software-timed on-demand acquisition. You're introducing all sorts of time delay this way and it will affect your effective model, which is why your particular gains aren't actually working. Did you develop your model in the continuous space or the discrete space?

Jeff | LabVIEW Software Engineer
0 Kudos
Message 4 of 8
(4,465 Views)

Hi JeffL, 

i developed my model in the discrete space, from the equations there i designed the gains of my controller. All these using matlab. At the older model (because lately i changed the mass attached on the motor) the gains were Kp=20, Kd=0.382, Ki=0. Now, using labview always an error occured that said that an external clock is needed. So i used the second counter of the usb-6221 for pulse generation which i used for sampling,and is triggered by the other counter that i use to measure the encoder. At my first vi i did not have an external clock, to take samples from the encoder. Since i wanted to change that frequency (which i think is the software-timed, i'm not sure i understand it well) it asked for an external clock. Using the external clock i have continuous samples.

I noticed that in labview Kd and Ki are measured in min (actually Td and Ti), does this have to do something in my case? Also should i adjust the sampe clock in some other way? in case you haven't seen it i attach my vi?

Actually i don't understand why i'm introducing all sorts of time delay as you mention, is my vi too complicated for the control i want to achieve? 

0 Kudos
Message 5 of 8
(4,462 Views)

Hi fil.pagono,

 

These difficulties are why we highly recommend not using DAQ for motion control. We have dedicated Motion Products that do this all on the hardware for this very reason.

 

But let's see what we can do.

 

I'm not sure why you need the external clock. Check out Measure Angular Position.vi in the shipping examples. Can you wire up your encoder in that way?

 

Right now it looks like you're reading a 1D array of doubles for some reason (multiple samples) then taking just the first position in the array. Why not just get the single double reading?

 

 

Jeff | LabVIEW Software Engineer
0 Kudos
Message 6 of 8
(4,448 Views)

Hi Jeff,

unfortunataly i don't have the budget, to buy motion products, but i think it's possible to achieve such control with daqmx :smileyhappy:.

 

I have checked all these examples. I can wire the encoder that way but i get the same result: oscillations. According to my model if the sample rate is higher i'll recieve better response. That's why i use the external clock. I try to send an array to analog output accordingly to the array i recieve from the encoder, but for some reason "write" doesn't work and i don't get any analog voltage output. I also tried to use the "generate mult volt updates-sw timed.vi" exampe but didn't work. I'm not sure if i did something wrong. The example when run single works, but in my vi it doesn't. I think that if i can produce more frequent analog output i will have solved the problem. Right now i know that i use only the first value, but it's the only way it produces analog output.

0 Kudos
Message 7 of 8
(4,446 Views)

Hi fil.pagono,

 

Well, earlier you said that you designed the controller in discrete space. Did you take the delay into account when designing your controller? Because the motion products can get around 62.5 microseconds of loop time...but with DAQmx and software timing you might be able to get 1 kHz rate at most. If you're not taking the delay factor into your math then that's likely where the problem is cropping in.

 

I'm also not sure why you put the Wait Until Multiple in there. I'd take that out to help reduce delays.

Jeff | LabVIEW Software Engineer
0 Kudos
Message 8 of 8
(4,410 Views)