OpenServo.com Forum Index OpenServo.com
Discussion of the OpenServo project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Analog vs Digital PID

 
Post new topic   Reply to topic    OpenServo.com Forum Index -> Theory and Algorithms
View previous topic :: View next topic  
Author Message
JohnP



Joined: 04 Feb 2009
Posts: 1

PostPosted: Wed Feb 04, 2009 1:19 am    Post subject: Analog vs Digital PID Reply with quote

Hi, I made an analog PD controller to drive an industrial proportional solenoid.

I used it as a model to design a digital version in assembly code, running on a 9S12 processor.

The analog version is fairly stable, but the digital one is unstable, and oscillates with a period of about 45msec.

I ran the solenoid off the analog version with a 1 Hz square wave, so I could observe the P and D terms from the digital version open loop.

To observe the waveforms, I write the signal of interest to a port connected to an R2R ladder network.

The D term from the digital version closely resembles that from the analog, but it is delayed 5 to 10msec, which is about 10% of the resonant period.

I can finely adjust the amplitude of the D term, but it doesn't make a difference.

The analog version depends on the D term to work.

The proportional gain of both is three.

The routine runs once per msec, and takes about 50usec.

To reduce noise and get a decent signal for differentiation, I sample the feedback pot every fourth time (dt=4msec).

For the analog version, I have a 0.1uF input cap and a 300k feedback resistor. There is also a 300 ohm resistor in series with the input cap.

I made a screen capture comparing the two derivatives. Send me a pm if you would like to see it.

I will post the link when my forum privileges are upgraded.

Thanks in advance for any help on this.
Back to top
View user's profile Send private message
guru



Joined: 03 Jan 2006
Posts: 128
Location: St Pete Beach, FL

PostPosted: Thu Mar 19, 2009 3:54 pm    Post subject: Reply with quote

Interesting work. I assume you used op-amps in your analog version?

I am no motion control expert and it seems like you have a good handle on things, but it sounds like the typical phase lag due to the closed loop. Could you introduce a sort of digital phase lag compensation? I suppose you could increase the bandwidth of the control loop but probably not necessary if compensation is added to the control loop.

Are you able to generate bode plots of your analog and digital versions?

I can tell you someone who does know a whopping lot about this stuff (besides the experts on here as well) is Mariss Freimanis of Gecko drives. You could post a message in the Gecko forum on cnczone.com and I am sure he'd answer you. I talked to this guy not long ago about motor controllers and he was blowing me away with tech I could barely keep up! Smile
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
combug



Joined: 15 Dec 2009
Posts: 1

PostPosted: Tue Dec 15, 2009 7:04 am    Post subject: Reply with quote

good idea!
I think analog controller is better than digital controller. Smile
I am chinese ,i can read Engilsh but write is poor . i was try to improve my English write ability.
I have a question,why guys use PD controller , I always use PI controller.and what about PID controller?
Is any body know what i mean?
I want make friends with each one of here.
I like robot very much !
Back to top
View user's profile Send private message
DavidCary



Joined: 24 Oct 2007
Posts: 12
Location: Oklahoma and Kansas

PostPosted: Tue Apr 13, 2010 9:32 pm    Post subject: Re: Analog vs Digital PID Reply with quote

JohnP wrote:
... the digital one is unstable, and oscillates with a period of about 45msec.
...
The D term from the digital version closely resembles that from the analog, but it is delayed 5 to 10msec, which is about 10% of the resonant period.
...
The routine runs once per msec, and takes about 50usec.

To reduce noise and get a decent signal for differentiation, I sample the feedback pot every fourth time (dt=4msec).
...
I made a screen capture comparing the two derivatives. Send me a pm if you would like to see it.
...


So, you only update the D term once every 4 ms, and you see that the D term is delayed a little more than 4 ms compared to the analog version.
Have you tried updating the D term every 1 ms?
Perhaps reducing the latency is more important than reducing the noise.

Also: It often works better if I directly measure the velocity (rather than subtract consecutive position readings) -- even if I measure velocity with a separate sensor that doesn't sense absolute values very accurately.

"you may get better results from having two sensors. The one that drives the Differentiator may be located very close to the heater as an aid to stability. But the one that drives the Integrator may live in the "sweet spot"—the exact place where highest precision is needed." -- Bob Pease, "What's All This P-I-D Stuff, Anyhow?"_

.. _"What's All This P-I-D Stuff, Anyhow?" http://electronicdesign.com/content.aspx?topic=what-s-all-this-p-i-d-stuff-anyhow-6131
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenServo.com Forum Index -> Theory and Algorithms All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group