Constant-gain feedback control is the simplest form of control. This is the kind of control that we use in root-locus analysis. Open and run the following MATLAB Simulink file.

constant_gain_2022a.slx

Fig. 1 The Simulink diagram of a constant gain feedback controller

Fig. 1 The Simulink diagram of a constant gain feedback controller

Running the Simulink file above gives us a MAT file that we can load into MATLAB’s workspace. The first row is the time stamp. The second and the third rows are the applied input to heater-1 and heater-2, respectively. The fourth and the fifth rows are the heater-1 and heater-2 temperatures, respectively. The sixth row is the targeted temperature.

We provide the following MAT file as an example.

datalog.mat

Use he following MATLAB script to present the results in a more meaningful manner. This MATLAB file will load the datalog.mat.

clc
clear 
close all

load datalog.mat
datalog = datalog(:, 1:floor(end/2)); % Our data is too long, remove half of it!

t  = datalog(1, :);
u1 = datalog(2, :);
u2 = datalog(3, :);
T1 = datalog(4, :);
T2 = datalog(5, :);
T1_target = datalog(6, :);

figure

subplot(2,1,1)
hold on 
plot(t, T1_target, 'g')
plot(t, T1)
ylabel('Output')
xlabel('Time')
xlim([0 t(end)])

subplot(2,1,2)
hold on
plot(t, u1,'-.', 'LineWidth', 2)
plot(t, repmat(0, 1, length(t)), '--r')
plot(t, repmat(1, 1, length(t)), '--r')
xlabel('Time (s)')
ylabel('Input')
xlim([0 t(end)])

Fig. 2 The output (top) and the control action (bottom)

Fig. 2 The output (top) and the control action (bottom)

From Fig. 2. we can see that the input to the heater, generated by the constant-gain controller, goes beyond the allowable value (from 0 to 1). On the other hand, the actual temperature is less than the target temperature, even after steady-state.

Can you explain why there is steady-state error in Fig. 2? What do you think would happen if we keep increasing the gain? Try it!