Example H4.5

MATLAB code for example 4.5 from the book "Regeltechniek voor het HBO"

Integrated effect in practice

Copyright (c) 2022, Studieboeken Specialist Permission is granted to copy, modify and redistribute this file, provided that this header message is retained.
Table of Contents

Example of an integrator: flow in a container

The incoming flow of water in a cilindrical container is , while the outgoing flow equals . The diameter of the container is 0.8 meter. What is the level going to be in the container?
The block diagram of this system is displayed in figure 4.12a. The (positive) difference between in- and outgoing flow is integrated (summed up) to the volume . Dividing this volume by the surface of the container () provides the height of the container. Figure 4.12b shows the progression of the level over time.
In case that and/or would change, the height and thus the level would change and not be a straight line as shown in this case.

Two other examples of an integrator

Two other examples of an integrator are these:
The result of an integrating action is not always positive: with a negative input the result will decrease. And at the start of an integration, the output does not always have to be zero. This is the so called initial value of an integrator.

MATLAB code solution 1

% clear all variables from Workspace and close all figures
clear variables;
close all;
 
Flow_in=0.2; % Flow in [mˆ3/s]
Flow_out=0.1; % Flow out [mˆ3/s]
Surface_cyl=0.16*pi; % [mˆ2]
 
 
Tsim1=1.2; % Simulation time in seconds
t1 = 0:Tsim1/100:Tsim1; % Make time array
e1 = (Flow_in-Flow_out)*ones(size(t1)); %
 
% Simulate the response of system H to the input x1
s=tf('s');
H=(1/Surface_cyl)*(1/s);
figure(101);
lsimplot(H,e1,t1);
grid on;
title('outputsignal level');
xlabel('t [s]');
ylabel('level [m]');

MATLAB code solution 2 (with Symbolic Math Toolbox)

% create symbolic functions
syms t phi_i(t) phi_o(t) level(t);
flow_in=0.2; % Flow in [mˆ3/s]
flow_out=0.1; % Flow out [mˆ3/s]
surface_cyl=0.16*pi; % [mˆ2]
 
 
volume(t)=int(flow_in-flow_out,sym(t))
volume(t) = 
level(t)=volume(t)/surface_cyl
level(t) = 
 
% Plot the output signal level(t)
t_interval = [0 1.2];
fplot(level(t),t_interval);
grid on;
title('outputsignal level');
xlabel('t [s]');
ylabel('level [m]');
xlim(t_interval);