Electronics > Beginners
PID regulator for speed
awallin:
FWIW I played around with EMC (now LinuxCNC) in 2008 with DC-servos that had encoders (position feedback) and simple PWM-input servodrives (e.g. voltage control/mode).
In LinuxCNC it's quite easy to set up different control schemes and play around with the gains etc - if that is what you want to do.
Some notes from a long time ago...
http://www.anderswallin.net/2008/04/pid-tunig/
and
http://www.anderswallin.net/2008/04/x-axis-test/
IIRC there were (at least) two lessons
- the mechanical bandwidth of anything (like a cnc machine) with a bit of mass is quite low, probably much below 100 Hz
- various forms of feed-forward really help - the cnc trajectory-controller knows where we want to go and at what speed/acceleration, so make use of that!
PsychoBoy:
--- Quote from: nForce on June 26, 2019, 06:59:54 pm ---Yansi, if I understand you correctly. We get the error by "w - w_ref", then we apply integral multiplied with constant for Integral part, and for the proportional part we multiply just with a constant. Then we sum the signals, and connect directly with output which is I_ref?
How do we know that we get electrical current (I) or torque (T) on the output? This part I don't understand, on the output we can get any physical quantity.
--- End quote ---
Are you talking about motor or PID controller? If about PID controller then you are the one who sets the relationship between the input and output variable.
You already have definied what is the input variable, it's an error of the variable you are controlling, and you know the output, this is what you want to control.
So let's say you want to control DC motor speed, so the input is speed error and the output is motor supply voltage.
The transfer function is T = Output/Input
What is the input? Speed error, let's say in RPM.
What is the output? Motor supply voltage, in Volts.
Now you construct your PID controller which units of transfer function are in Volts per RPM.
Any transfer function is: T = Output/Input (in Laplace domain)
Specifically, transfer function of one of variants of (there are several, check on wikipedia) PID controller is: T = Kp + Ki/s + Kd*s
Set it side by side: Kp + Ki/s + Kd*s = Output/Input = Voltage/Speed [V/RPM]
So by tuning PID controller (Kp, Ki, Kd gains in PID controller equation) you basically telling PID controller how many volts it has to put per 1 RPM of error signal.
Example:
Let's say that you set Ki = 0, Kd = 0, and Kp = 2, so you have only Proportional controller. Equation is now: Voltage = Kp*Speed = 2*Speed.
So if you have 10 RPM error at some instant, then you will output 20 volts to motor.
Now, if you are asking about plant/process, in this example DC motor, how do we know what is it's transfer function, what is the input and how it is coupled to output, everything comes from analysis.
Check this out: http://ctms.engin.umich.edu/CTMS/index.php?example=MotorSpeed§ion=SystemModeling
As you see, DC motor consists of electrical part and mechanical part.
--- Quote ---In general, the torque generated by a DC motor is proportional to the armature current and the strength of the magnetic field. In this example we will assume that the magnetic field is constant and, therefore, that the motor torque is proportional to only the armature current i by a constant factor Kt as shown in the equation below. This is referred to as an armature-controlled motor.
--- End quote ---
Personally I dunno much about motors but take a look at this analysis: https://www.precisionmicrodrives.com/content/dc-motor-speed-voltage-and-torque-relationships/
It states that:
--- Quote ---In summary, we can highlight the two main variables which affect the speed of the motor in our final equation:
Input Voltage: For a fixed load, the speed of the motor is affected by applied voltage. Increase in voltage = increase in speed
Load Torque: For a fixed voltage, the speed of the motor is inversely affected by the load. Increase in load torque = decrease in speed
--- End quote ---
Now you asked about speed control, @Yansi showed earlier a cascade PI controller which controls both, speed and torque.
Perhaps it is possible to ignore torque part and just construct one PI controller in case if you want to control speed for fixed load?
I think that cascade control shown by @Yansi is the universal, common way of doing it in servomechanisms?
From what I recall from control theory classes cascaded PID doesn't guarantee stability right (you mentioned earlier the problem with double integrators etc)
Yet they still are cascade PID's without a problem? Or modern servos and drives use modern control theory? Please answer if you know :)
Also keep in mind practical issues: Integral windup and physical limitations. Found a series of videos shining some light about PID theory, DC motor model, controlling it and practical considerations:
ArthurWozniak:
As PsychoBoy said, windup is a thing to consider. I from my point of view, dead-time too.
Maybe your system cannot be control by a simple PID or just one PID. I run to this problem once, I used a "cascate" PID.
--- Quote from: nForce on June 25, 2019, 09:38:54 am ---Hello,
I would like to create a PID regulator where the input is speed and the output is torque. I know how a PID regulator looks like, I just want to know what kind of block (physical relation) I add such that I adequate convert from speed to torque.
Thank you.
--- End quote ---
How do you plan to measure torque?
Best regards,
L_Euler:
I understand your question, but don't understand the application. Speed is generally never maintained by torque but by feedback from an encoder or other possibly back emf. I have done torque (current) control in applications where multiple drives are implemented to share load, such as long automotive assembly conveyors or baggage claim carousels, but never in single drive applications. Single motor speed cannot be maintained in changing load conditions by torque control. Typically, for multi-drive systems, there would be a master drive with speed control and one or more drives sharing load through torque control.
Navigation
[0] Message Index
[*] Previous page
Go to full version