Sei sulla pagina 1di 3

In this demonstration you will see how to quickly tune a PID controller for a plant modeled in

Simulink.

In this particular case we modeled a DC motor.

In this block dialog you see the parameters that define the behavior of the motor: damping,
inertia, back EMF, resistance and inductance. Looking under block mask we see Simscape and
SimElectronics blocks we used to model the motor.

We will now design a digital control system that will control the rotation speed of the motor shaft.
The controller will calculate the error signal between the desired speed and the measured speed
and use this error signal to calculate the voltage request to command to the motor. Notice that we
are modeling sensor noise in the measurement channel and because our control system is digital
we are also modeling an A/D converter with a sampling time of 0.02 seconds using a Zero Order
Hold block.

We now need to add the compensator. To do that we go to the Simulink library browser, Discrete
sub-library, take the Discrete PID Controller block and add it to our model. Lets now connect this
block to the rest of our model and open the block dialog. Here we can specify the type of
controller we want to use: PID, PI, PD, Proportional, or simply Integral. We will stay with PID.

We can specify the sampling time, in this case well use the same one as we used in our A/D
converter. And if we know the gains of the PID controller, we can type them in here. In this case
we dont know what the gains should be yet, so let's apply the sampling time changes and try
running the simulation with default gain values. Lets also add voltage to our scope.

Running the simulation, we see that our control system is not doing all that well. Blue line shows
the desired speed, and red line shows the actual measured speed. As we see, our control system is
not tracking very well. Lets try to improve that performance. To do that well go back to the block
dialog and press the "Tune" button. This launches PID Tuner which linearizes the plant, calculates
PID gains and opens the graphical user interface.

In the graphical user interface we see two lines: dashed line shows the closed loop step response
of our system for the current gain values and solid line shows the same response for calculated
gain values.
So lets simply accept the gains tool calculated for us. When we do that we see that all block
parameters, PID gains, get updated. Lets press "OK", go back to our simulation and rerun it. As we
see, we indeed improved the performance of our control system. It is now tracking very well. With
zero steady state error, its relatively fast and has relatively little overshoot.

If we want to improve the performance of our control system, we can come back to the PID Tuner
graphical user interface and for example try to make the overshoot a little lower if we want that,
or if we want faster response we could try to use a slider here to move it to the right to make the
system response faster. For example, lets try this design. We now go back to our model and rerun
the simulation with this design.

We see that we indeed get much faster response but at the expense of much noisier and much
higher voltage request signal so we are probably sacrificing actuator life to achieve this faster
response. Now this is the trade-off you can decide on as an engineer, but you now have this tool at
your disposal that lets you quickly design and tune PID controllers for plants modeled in Simulink.

This concludes the demo


En esta demostracin ver cmo ajustar rpidamente un controlador PID para una planta modelada en
Simulink.

En este caso particular modelamos un motor de CC.

En este cuadro de dilogo se muestran los parmetros que definen el comportamiento del motor:
amortiguacin, inercia, EMF posterior, resistencia e inductancia. Mirando bajo la mscara de bloque vemos
Simscape y SimElectronics bloques que usamos para modelar el motor.

Ahora disearemos un sistema de control digital que controlar la velocidad de rotacin del eje del motor. El
controlador calcular la seal de error entre la velocidad deseada y la velocidad medida y utilizar esta seal
de error para calcular la peticin de voltaje a ordenar al motor. Tenga en cuenta que estamos modelando el
ruido del sensor en el canal de medicin y debido a que nuestro sistema de control es digital tambin estamos
modelando un convertidor A / D con un tiempo de muestreo de 0.02 segundos usando un bloqueo de
retencin de orden cero.

Ahora tenemos que aadir el compensador. Para ello vamos al navegador de la biblioteca de Simulink, la sub-
biblioteca Discrete, tomamos el bloque Discrete PID Controller y lo aadimos a nuestro modelo. Ahora
vamos a conectar este bloque con el resto de nuestro modelo y abrir el cuadro de dilogo de bloque. Aqu
podemos especificar el tipo de controlador que queremos utilizar: PID, PI, PD, Proporcional o simplemente
Integral. Nos alojaremos con PID.

Podemos especificar el tiempo de muestreo, en este caso usaremos el mismo que utilizamos en nuestro
convertidor A / D. Y si conocemos las ganancias del controlador PID, podemos escribirlas aqu. En este caso,
no sabemos cules deberan ser las ganancias, as que apliquemos los cambios de tiempo de muestreo e
intentemos ejecutar la simulacin con valores de ganancia por defecto. Aada tambin tensin a nuestro
alcance.

Ejecutando la simulacin, vemos que nuestro sistema de control no est haciendo todo eso bien. La lnea azul
muestra la velocidad deseada y la lnea roja muestra la velocidad real medida. Como vemos, nuestro sistema
de control no est siguiendo muy bien. Vamos a tratar de mejorar ese rendimiento. Para ello volveremos al
dilogo de bloque y pulsaremos el botn "Tune". Esto lanza PID Tuner que linealiza la planta, calcula las
ganancias PID y abre la interfaz grfica de usuario.

En la interfaz grfica de usuario vemos dos lneas: lnea discontinua muestra la respuesta de paso de bucle
cerrado de nuestro sistema para los valores de ganancia actuales y la lnea continua muestra la misma
respuesta para valores de ganancia calculados.

As que simplemente aceptemos la herramienta de ganancias calculada para nosotros. Cuando lo hacemos
vemos que todos los parmetros del bloque, ganancias PID, se actualizan. Vamos a pulsar "OK", volver a
nuestra simulacin y volver a ejecutarla. Como vemos, de hecho mejoramos el rendimiento de nuestro sistema
de control. Ahora est siguiendo muy bien. Con cero error de estado estable, es relativamente rpido y tiene
relativamente poco exceso.

.
Si queremos mejorar el rendimiento de nuestro sistema de control, podemos volver a la interfaz grfica de
usuario del sintonizador PID y, por ejemplo, tratar de hacer que el rebasamiento sea un poco menor si
queremos, o si queremos una respuesta ms rpida, podramos tratar de usar Un deslizador aqu para moverlo
a la derecha para hacer la respuesta del sistema ms rpido. Por ejemplo, intentemos este diseo. Ahora
volvemos a nuestro modelo y vuelve a ejecutar la simulacin con este diseo.

Vemos que de hecho obtendremos una respuesta mucho ms rpida, pero a expensas de una seal de peticin
de voltaje mucho ms ruidosa y mucho ms alta, por lo que probablemente estamos sacrificando la vida del
actuador para lograr esta respuesta ms rpida. Ahora este es el trade-off que puede decidir como ingeniero,
pero ahora tiene esta herramienta a su disposicin que le permite disear y ajustar rpidamente los
controladores PID para las plantas modeladas en Simulink.

Esto concluye la demo

Potrebbero piacerti anche