Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Clint1000

Active Participant

12-15-2017 08:08 AM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

Labels:

I have a Moog Servo. Attached is a synchro for feedback voltage to my circuit that is proportional ( PID?) to a wing position attached to the servo. The servo is fully on when commanded (threw a DAQ 6229 Analog out) to an angle/position or off once its at the commanded position ( PWM?) . Everything I've read indicates this ..to me..is a hybrid PID/PWM controller. ON_OFF_ON..etc.. would be the PWM and a PID to determine when it got to the commanded position. The problem w the PID is it looks like it keeps looking at the process variable ( my synchro ) compares it to my setpoint ( my commanded angle) and tries to set the output to a voltage to get the wing position to its commanded position. In my case I want to give the servo say 10 vdc and by measuring the synchro voltage take away servo voltage when the two are equal..

This is a "general" example but this is graphically what I envision..

The 2nd plot is what I think the PID does..it outputs a voltage or whatever constantly after you have adj the P, I and D.

Thanks..

Download All

Virus scan in progress. Please wait to download attachments.

- Tags:
- PID PWM

arteitle

Active Participant

12-15-2017 09:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

natasftw

Active Participant

12-16-2017 03:19 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

If you want to set to 10V (not exactly how PWM works) and go until you reach your desired setpoint, you don't need PID. You can eliminate that piece all together.

But, why do you want to? The purpose of the PID is to move to your setpoint and then maintain that point. Yes, there are little oscillations. But, that's likely preferable to the alternative. Is your motor supporting any weight? If so, turning it off is likely to send it back towards the starting point. Do you have code in place to move it back if it overshoots your setpoint or will it just stay at the further point?

12-18-2017 08:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

So I did up this plot to help better understand if I need a PID Controller or not as most of the NI explanations and the Web use a graph of some sort.

This is just a general graph of my situation. I am using a NI DAQ board to generate and read the analog voltages. The example in he whitepapers #3782 was used.

The user sets the setpoint (SP) to the desired angle that they want the fins to go to..say 80 degrees. Time zero in my graph. Because the process variable (PV) is measured in volts the SP is converted to voltage thru a formula. In this case 8 vdc. The PV is measured via a synchro which is also measure and converted to a DC voltage. When the system is turned on the daq AI looks at the voltage (PV) and compares it to the SP. If they are not equal it applies 10 vdc..say.. to an AO which is connected to a servo. This "DO WHILE" loops continues until the PV=SP at which time the 10 vdc is removed from the output. Time =9 in my graph. My question is does this sound like a good use for a PID?? I'm trying to relate this to a temperature control that is given in a lot of examples for PIDs . But once I remove the 10 vdc the fin stops moving..not immediately but nothing like a heating element where you remove the voltage and it still has residual heat on it that affects the other parameters in the PID..does it? I'm trying to figure out how to implement the output of the PID. Put it in a case statement. If the PV=SP then the output=0 otherwise = 10 vdc? I guess I'm a little confused on what the value actually is on the output of the PID. No currently I hadn't thought of moving it back..till your post..if it overshot SP.

Thanks..

Kevin_Price

Proven Zealot

12-18-2017 09:44 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

Honestly, it sounds like you haven't grasped some key concepts about feedback control and dynamic systems that PID algorithms are meant to help solve.

It starts with your error signal, defined as (SP - PV) expressed in the same units. Then the amount of control effort you exert in a PID algorithm depends on:

P - a Proportional part that's based on the actual error size

I - an Integral part that's based on an accumulation of error over time

D - a Derivative part that's based on the rate at which the error is changing

The type of control you're proposing was called "Bang Bang" control in my coursework. It guarantees that you will oscillate about your setpoint forever.

PWM stands for "Pulse Width Modulation". It's common for motor drives to use fast switching digital electronics as a *mechanism* for delivering the "control effort" voltage to the motor. PWM often operates just above human hearing range (20 kHz+), and the effective voltage delivered to the motor depends on the duty cycle of the PWM waveform.

So summing up, SP and PV lead to an Error signal. The PID algorithm turns Error into "control effort". PWM is a cost-effective method for delivering that control effort using digital electronics instead of analog.

-Kevin P

(Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).

12-18-2017 09:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

Then I guess I need more education in control theory before I ask anymore questions..

Kevin_Price

Proven Zealot

12-18-2017 10:46 AM - edited 12-18-2017 10:53 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

It'll be worthwhile to get some grounding, but it's a deep, deep rabbit hole that you shouldn't wander too far into all at once.

First try using only Proportional control. The control effort will be proportional to how far away you are from the setpoint. You can do hand calcs based on your motor & drive specs to get a reasonable starting point for your Proportional control gain value.

An implication of PID control is that you only exert effort when there's an error signal, i.e., when you are *not* exactly at your setpoint. If your setpoint for desired speed requires 8 Volts, then you're going to end up at a place where Kp * (SP - PV) must give you a result of 8 volts. Therefore, you *must* inevitably have a non-zero error. The larger you make your proportional gain Kp, the smaller the error will be. However, in a dynamic system a large value of Kp may also make you unstable. With a big actuator, you could be violently unstable and cause damage, so be careful. Start small with Kp, and increase gradually.

Typically Integral gain Ki is added next. It adds in some extra control effort based on the integral of the error. A small error for a long time integrates to be appreciable, so the Integral gain works to drive the system to a 0 steady-state error. Again, the system can easily become unstable if you make Ki too large, so start small and change slowly.

Many times, it can be helpful to use something known as "gain scheduling" to decide if and when to apply Integral control. It can often be easier to get a good and stable response if the Integral control only "kicks in" when the error is small-ish. That way you don't accumulate error during the very beginning of a large step response.

The final component is Kd, the Derivative gain. It acts on the derivative of the error. It'll end up *subtracting* control effort when the error is decreasing, i.e., when you are getting closer to the setpoint. It tends to add back some of the stability that Kp and Ki threaten.

I've seen many real-world systems perform adequately with Derivative gain of Kd=0. Not optimally, but adequately.

-Kevin P

P.S. PID control isn't the only method and often isn't really the best method. Better methods tend to depend on a good mathematical model of the system's dynamic behavior. PID is popular because it's an effective general-purpose method for implementing feedback control of a system without a good mathematical model.

(Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).

arteitle

Active Participant

12-18-2017 10:54 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

@Kevin_Price wrote:

An implication of PID control is that you only exert effort when there's an error signal, i.e., when you are *not* exactly at your setpoint. If your setpoint for desired speed requires 8 Volts, then you're going to end up at a place where Kp * (SP - PV) must give you a result of 8 volts. Therefore, you *must* inevitably have a non-zero error. The larger you make your proportional gain Kp, the smaller the error will be.

This is true if instead of "PID control" you meant "proportional control", because in PID control of course the integral term **will **provide continuous output if necessary, even when the error is zero. It's essential in things like temperature controllers, where some continuous heater output is required to make up for heat leaking out of the system and keep the error at zero.

Aaron T.

Kevin_Price

Proven Zealot

12-18-2017 11:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report to a Moderator

@arteitle wrote:

@Kevin_Price wrote:

An implication of PID control is that you only exert effort when there's an error signal, i.e., when you are *not* exactly at your setpoint. If your setpoint for desired speed requires 8 Volts, then you're going to end up at a place where Kp * (SP - PV) must give you a result of 8 volts. Therefore, you *must* inevitably have a non-zero error. The larger you make your proportional gain Kp, the smaller the error will be.

This is true if instead of "PID control" you meant "proportional control", because in PID control of course the integral term

willprovide continuous output if necessary, even when the error is zero. It's essential in things like temperature controllers, where some continuous heater output is required to make up for heat leaking out of the system and keep the error at zero.

Aaron T.

Absolutely right, thanks for the correction! In my mind I was still in the context of proportional-only, but I had a "brain-o"* and typed PID.

-Kevin P

* a "brain-o" is like a typo, but it's a carelessness of the brain instead of the fingers

(Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).