Feedback System Simulation
Transfer Function Manipulation
Suppose we have developed mathematical models in the form of transfer functions for the plant, represented by G(s), and the controller, represented by D(s), and possibly many other system components such as sensors and actuators. Our objective is to interconnect these components to form block diagram representation of a feedback control system. MATLAB offers several functions to carry out block diagram manipulations.
Two methods are available:
1. Solution via series, parallel, and feedback commands:
series(G,D) for a cascade connection of G(s) and D(s); parallel(G1,G2) for a parallel connection of G1(s) and G2(s); feedback(G,H, sign) for a closed-loop connection with G(s) in the forward path and H(s) in the feedback path; and sign is -1 for negative feedback or +1 for positive feedback (the sign is optional for negative feedback); and cloop(G,sign) for a unity feedback system with G(s) in the forward path, and sign is -1 for negative feedback or +1 for positive feedback (the sign is optional for negative feedback).
2. Solution via algebraic operations:
G*D for a cascade connection of G(s) and D(s); G1+G2 for a parallel connection of G1(s) and G2(s); G/(1+G*H) for a closed-loop negative feedback connection with G(s) in the forward path and H(s) in the feedback path; and G/(1-G*H) for positive feedback systems.
System Response
The transfer function manipulations give us a transfer function model M(s) between command input R(s) and output Y(s); model Mw(s) between disturbance input W(s) and output Y(s); a model between command input R(s) and control U(s), etc. It is now easy to use some of the control analysis commands available from the Control System Toolbox. impulse(M) and step(M) commands represent common control analysis operations that we meet in this book. Also frequently used in the book are frequency-response plots.
>> %Step response with respect to R(s)
>> s = tf('s');
>> KA = 80;
>> G1 = 5000/(s+1000);
>> G2 = 1/(s*(s+20));
>> M = feedback(series(KA*G1,G2),1)
>> step(M)
and step response plot shown in Fig. M4.2. The grid has been introduced in the plot by right clicking on the plot and selecting Grid option.
>> %Step response with respect to W(s)
>> s = tf('s');
>> KA = 80;
>> G1 = 5000/(s+1000);
>> G2 = 1/(s*(s+20));
>> Mw = (-1) * feedback(G2, KA*G1)
>> step(Mw)
Note that the sensitivity is small for lower frequencies, while the transfer function primarily passes low frequencies.
w = 0.1:0.1:10;
M = abs(0.25./((j*w).^2+j*w+0.25));
SMK = abs((j*w .* (j*w + 1))./((j*w).^2 + j*w +0.25));
plot(w,M,'r',w,SMK,'b');
xlabel('Frequency (rad/sec)');
ylabel('Magnitude');
Of course, the sensitivity S only represents robustness for small changes in gain K. If K changes from 1/4 within the range K = 1/16 to K = 1, the resulting range of step responses, generated by the following MATLAB script, is shown in Fig. M4.5. This system, with an expected wide range of K, may not be considered adequately robust. A robust system would be expected to yield essentially the same (within an agreed-upon variation) response to selected inputs.
s = tf('s');
S = (s*(s+1))/(s^2+s+0.25);
M1 = 0.0625/(s^2+s+0.0625);
M2 = 0.25/(s^2+s+0.25);
M3 = 1/(s^2+s+1);
step(M1);
hold on;
step(M2);
step(M3);
Simulink Simulation
Simulink simulation is an alternative to block diagram manipulation followed by time-response analysis. From the Simulink model of a control system, output y in response to command r, output y in response to disturbance w, control u in response to command r, and all other desired internal variables can be directly obtained.
Example: Control system design methods discussed in this course are based on the assumption of availability of linear time invariant (LTI) models for all the devices in the control loop.
Consider a speed control system. The actuator for the motor is a power amplifier. An amplifier gives a saturating behaviour if the error signal input to the amplifier exceeds linear range value.
MATLAB simulink is a powerful tool to simulate the effects of nonlinearities in a feedback loop. After carrying out a design using LTI models, we must test the design using simulation of the actual control system, which includes the nonlinearities of the devices in the feedback loop.
Figure M4.6 is the simulation diagram of a feedback control system: the amplifier gain is 100 and the transfer function of the motor is 0.2083/(s +1.71). We assume the amplifier of gain 100 saturates at +5 or -5volts. The result of the simulation is shown in Fig. M4.7.
Time and Output response data have been transferred to workspace using To Workspace block from Sinks main block menu. Clock block is available in Sources main menu. These variables are stored in the structure Output and Time in the workspace, along with the information regarding simulink model name. For example,
>> Output
>> Time
Time =
To access output and time values, one needs to access Output.signals.values and Time.signals.values . The step response plot has been generated by the following MATLAB script.
>> plot(Time.signals.values,Output.signals.values)
>> xlabel('Time (sec)');
>> ylabel('Output');
>> title('Step Response');
Example
In this example, we simulate a temperature control system with measurement noise added to the feedback signal. The process transfer function is
The deadtimeminutes. The measurement noise parameters we have used are: mean of 0, variance of 0.5, initial seed of 61233, and sample time of 0. The simulink inputs a step of 30 to the system (Fig. M4.8). Deadtime block in this figure is Transport Delay block from Continuous library, and Random Number block is from Sources library.
The data has been transferred to the workspace using To Workspace block. Generate the step response
>> plot(Time.signals.values,Y.signals.values);
>> ylabel('Output (Y)');
>> xlabel('Time(min)');
>> title('Step Response');
0 comments:
Post a Comment