Analog vs Digital PID

Discussions relating to motion control theory and algorithms used in the OpenServo.

Moderators: jharvey, Secondary Admin, Admins

Post Reply
JohnP
Posts: 1
Joined: Wed Feb 04, 2009 12:44 am

Analog vs Digital PID

Post by JohnP » Wed Feb 04, 2009 1:19 am

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.

guru
Posts: 128
Joined: Tue Jan 03, 2006 5:54 pm
Location: St Pete Beach, FL
Contact:

Post by guru » Thu Mar 19, 2009 3:54 pm

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! :)

combug
Posts: 1
Joined: Tue Dec 15, 2009 6:43 am

Post by combug » Tue Dec 15, 2009 7:04 am

good idea!
I think analog controller is better than digital controller. :-)
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 !

DavidCary
Posts: 12
Joined: Wed Oct 24, 2007 11:10 pm
Location: Oklahoma and Kansas

Re: Analog vs Digital PID

Post by DavidCary » Tue Apr 13, 2010 9:32 pm

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.asp ... nyhow-6131

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests