pid simulation
Post on 14-Apr-2018
228 Views
Preview:
TRANSCRIPT
7/27/2019 PID Simulation
http://slidepdf.com/reader/full/pid-simulation 1/5
OPOLE UNIVERSITY OF TECHNOLOGY
KATEDRA MECHANIKI I PODSTAW KONSTRUKCJI MASZYN
Department of Mechanics and Machine Design
MECHATRONIKAMECHATRONICS
Instrukcja do ćwiczeń laboratoryjnych
Laboratory manual for students
Symulacja pracy regulatora PID
PID control simulation
PhD. Roland Pawliczek
Opole 2011
7/27/2019 PID Simulation
http://slidepdf.com/reader/full/pid-simulation 2/5
- 1 -
NOTE:
This manual is based on the source:
Experiment 103: Process control simulation using SIMULINK, V.M. Becerra, September 2000.
MATLAB/Simulink code was modified.
1. Introduction
This session studies the use and tuning of proportional (P), proportional-integral (PI) and proportional-
integral-derivative (PID) controllers in a feedback loop. It demonstrates effects of each type of control action
(P, I or D) and the concept of critical stability. It uses practical and industrially proven methods to tune the
controller parameters and shows the response of the closed loop system in the face of setpoint changes and
step disturbances.
2. Description of the control system
2.1 Block diagramThe layout of a typical feedback control system can be illustrated by Fig. l. It consists of a plant whose
output y is to be controlled according to the desired value r, subject to an external disturbance d. Here G(s)
represents the process transfer function and C(s) represents the controller transfer function.
Fig. 1 Feedback control system
2.2. Process plant model
The plant will have relationships and parameters that depend on the underlying physical system. Consider a
process plant with a transfer function of the form:
where T1, T2 and T3 are the time constants of three cascaded lags and K is the static gain of the plant.
The plant is assumed to have values of T1=1, T2=2, T3=5 and K=1.
2.3. Controller structure
The aim of the controller shown in Fig. 1 is to keep the output y as close as possible to the reference r . If this
is attempted by a simple proportional gain, it is found that a large gain is required to make the error small.
However, a large gain can make a third order system unstable. To achieve acceptable transients we may needto set the gain at a low value that may produce unacceptable steady state errors.
7/27/2019 PID Simulation
http://slidepdf.com/reader/full/pid-simulation 3/5
- 2 -
The steady state response can be improved by the addition of an integral term, and the speed of response can
be increased by the addition of a derivative term. A common PID control transfer function is given by
Which can be re-written as:
where the controller gains Ki and Kd
are given by:
2.4 Choosing the controller parameters
We will use the modified Ziegler Nichols method to tune the controller. This method is very simple. The
system is placed under proportional control and taken to the limit of stability by increasing the gain until
permanent oscillations are achieved. The gain at which this occurs is called the ultimate gain (Ku), and the
period of this oscillation is known as the ultimate period (T u). With these two parameters, the controller
parameters KP, Ti and Td can be calculated as:
Table 1. Controller gains
3. MATLAB/Simulink program
The program for the investigated model is presented on Fig. 2.
Fig. 2. MATLAB/Simulink code for PID simulation
7/27/2019 PID Simulation
http://slidepdf.com/reader/full/pid-simulation 4/5
- 3 -
Use MATLAB Command Window to input the values of the parameters of the system. Type command:
T1=1,T2=2,T3=5,K=1;
and confirm with ENTER key.
Switch to PID_Simulation window.
Start the simulation by clicking on the start () button and double click on the scope block to view theresults (See Fig.3 – you may like to auto-scale the plot by clicking on the binoculars button).
Fig. 3 . Results of the simulation
Additionally, the data are stored in memory. Type command:
plot(time, step, time, data);
to generate a figure with results comparing to input signal (Fig. 4.). Using zoom option on the figure window
it is possible to perform more detailed investigations.
Fig. 4. Output signal versus step input signal.
The results present step response of the system within 100 seconds, then the disturbance signal is activated
and the period between 100 sec. up to 200 sec. represents the answer of the system for disturbances.
NOTE: if necessary save additional figures with zoomed parts of the investigated diagrams.
ZOOM
7/27/2019 PID Simulation
http://slidepdf.com/reader/full/pid-simulation 5/5
- 4 -
4. Critical stability
It can be shown theoretically that when KP=12.6 the closed loop will be critically stable. This gain is the
ultimate gain (KU=KP). To verify, double click on the PID Controller block in the PID_Simulation window
and set the following values for the parameters:
Proportional 12.6, Integral 0, Derivative 0.
Start the simulation by clicking on the start () button. See the results on the scope. Use command
plot(time, step, time, data); to generate the figure and make investigations. Save the figure for further report.
Estimate the period of the oscillation by measuring the distance (in seconds) between two adjacent peaks.
This is the ultimate period (TU).
5. System Response with P Controller
Using the modified Ziegler Nichols rules for proportional control given in Table 1 control, set the
proportional gain to one-third of the critical value found above. Carry out the simulation with
KP = 0.33*12.6 = 4.158
To verify, double click on the PID Controller block in the PID_Simulation window and set the following
values for the parameters:
Proportional 4.158, Integral 0, Derivative 0.
Start the simulation by clicking on the start () button. Generate the figure and observe the response.
Save the response. Note the effects of the step disturbance at 100 s. Confirm that steady state levels are
reasonable, taking into account the static gains in the blocks.
6. System Response with PI Controller
Using the formulas given in Table 1, calculate the integral time constant T i for a PI controller. Calculate the
corresponding integral gain as Ki=KP /Ti Double click on the PID Controller block in the PID_Simulation
window and update the Integral field with the value of K i that you have calculated.
Start the simulation by clicking on the start () button. Generate the figure and observe the response.
Save the response. Note the effects of the step disturbance at 100 s.
7. System Responses with PID Control
Using the formulas given in Table 1, calculate the controller gain KP, the integral time constant Ti and the
derivative time constant Td
for a PID controller. Calculate the corresponding integral gain as K i=KP /Ti and
the derivative gain as Kd=KPTd. Double click on the PID Controller block in the PID_Simulation window
and update the Proportional field with the new value of KP, the Integral field with the value of Ki and the
Derivative field with the new value of Kd.
Start the simulation by clicking on the start () button. Generate the figure and observe the response.
Save the response. Note the effects of the step disturbance at 100 s.
8. Discussion of Results and Conclusions
Tabulate the controller parameters and the relevant steady state values for each of the three controllers used
(both before and after the disturbance). Explain the relative advantages of the different controllers studied in
this experiment.
Draw a report with figures, compare the results for all analyzed controllers then describe your
observations and write the necessary explanation.
top related