The Connection diagram of the tank, labjack and

The next step was to implement a proportional-integral (PI)
control system using MATLAB program. The code given on Unilearn was used in
implementing the PI controller into the system. First, an excel file was
created containing the controller’s proportional gain (Kp), integral gain (Ki),
derivative gain (Kd), set point (hsp), bias gain (vb) and sampling time (dt) values.
The file was then linked to the MATLAB code by editing the pathways’ in the
code to ‘K:Example for
control system.xlsx’. This allows the tank system to pick up the desired
parameters. The controller algorithm was also included in the code and the PI
controller formula (Kp*er+Ki*Ei) was used as such. The A and B values gotten in
figure 1 were also implemented into the code. This allows the system to
calculate the measured liquid level

Proportional gain (Kp) is very important because it affects the systems
responsiveness greatly. Integral gain (Ki) regulates how much control output is
generated because of position or velocity error.

Each section of the MATLAB code is ran to allow the flow of
liquid into the tank. This method id more of a ‘trial and error’ because the
controller parameters are guessed in order to achieve that accuracy of +/- 2mm
of the set point. This means that theoretically, they are not meant to be
errors (hsp=h) but in real life situations, the error should be as minimal as



Figure 3.
Connection diagram of the tank, labjack and the interfacing circuitry

The trial and error method was used numerous times to
achieve a stable system. The Kp and Kd values were changed continuously to
accommodate the desired hsp = h situation. The test values and diagrams given
below are few evidences of try to get the correct Kp and Ki values in order to
implement a PI control system.

Note: The
hsp value used for all the testing was 100mm. To calculate/confirm the measured
liquid level manually in each test, the formula ; is used. The vh parameter
can be gotten off the MATLAB system after ending the test. The system also
calculates the h and displays it at the result column.

From the MATLAB result shown in tests 1- 3 figures, it is a
clear visual representation of their Vh, h and error tabulated results gotten in
the system. The systems responsiveness is slow/sluggish, therefore  The MATLAB result indicates the clear
difference between the measured liquid level and the set point. Therefore, the
proportional gain has to be increased each time in order to increase the
systems response.

Test 1


I'm Mary!

Would you like to get a custom essay? How about receiving a customized one?

Check it out