Implementation of Simple Fuzzy PI Controller for Liquid Level Cascade Control

ABSTRACT


INTRODUCTION
A very effective and reliable device is the programmable logic controller (PLC).It is interesting for applications in the industrial automation systems.The ISO/IEC61131 (2001) standard defines programming languages for PLC; such as the LD is the standard programming language, which is greatly used by PLCs programmers.Furthermore, the availability of programmable controllers with floating-point mathematical functions, new approaches to the implementation of complex, advanced control algorithms have been created using advanced functional instructions and improved graphical user interfaces (GUIs) for programming these controllers [1,2].Currently, the industrial PLC can receive and send out several analogs and digital inputs/outputs.In other words, the programmable controller can trait simultaneously various programs in order to realize a complex control procedure [3].This modern performance of PLCs has enabled much research into implementing new, more complex control algorithms for industrial applications.
An interesting work using the LabJack U3 acquisition card and a platform MATLAB Guide.In this study, a various control techniques are applied to the Level/Flow control unit PUL-2/EV [4].Furthermore, they shown different combinations of three controllers in order to realize the cascade control strategy.After that, they have demonstrated the benefits of combinations.The conventional PID controller integrated inside the programmable logic controllers are not well suited for complex nonlinear and time delayed systems.For those systems, fuzzy logic based controllers have a good control strategy that provides better dynamic performance.
In the specialized literature, many works present the mathematical modelling of the simplified fuzzy controller which involve a reduced number of inputs and outputs signals using the approach based on the approximation of membership functions which are chosen as singletons on the interval [X, Y] of the controlled application [5].An interesting study on oneand two-dimensional fuzzy controller mathematical models and properties are proposed [6].A new mathematical approach to simplified fuzzy PI/PD controllers using identical discourse universe for the two scaling inputs [7].In the work cited above, L-type, П-type and Γ-type membership functions are used for the displayed scaled output variable.The output control signal is calculated applying Larsen product inference with three linear fuzzy control rules.
A small gain theorem under sufficient closed loop control stability conditions for bounded input and bounded output (BIBO) to synthesize a fuzzy PI controller [8].Analytical structure of the simplest Mamdani type fuzzy PI or PD for twoinput, two-output (TITO) controller was developed using Mamdani minimal inference method [9].Very interesting calculus approach for mathematical models of the simplest fuzzy controllers applied for single-input single-output (SISO) is presented in the study [10].This new approach extends to the TITO case [11].In addition, a good analytical modeling of the simplest nonlinear fuzzy two input and two output PI-PD controllers for both Mamdani minimum Inference and height defuzzification [12,13].These works present interesting mathematical models of fuzzy controllers, providing information on how a fuzzy controller works and allowing its implementation in an industrial PLC.
Moreover, the implementation of fuzzy controller in Siemens S7-300 PLC has been denoted in the study [14].Nikolić et al. [15] used the automaton as an integrated element of a SCADA system, where the fuzzy controller program is not implemented directly in the programmable controller but as a subprogram application of the SCADA systems.A version of the fuzzy controller is implemented using the Siemens S7-300 controller, programmed under ladder logic language applied to a wastewater system [16].This technical paper deals with the implementation of simplest fuzzy PI-PD controller using Siemens S7-300 PLC with analog I/O unit.The real implementation of this controller uses two analog inputs for data acquisition and two analog outputs to control the actuators, triangular membership functions and a rule base of 81 cells, each cell denoted by a pair of numbers (p, q), where p and q come from the scaled input plane partitioning.
After the introduction, this document is structured as follows: The second part describes mathematically and structurally the proposed simplified nonlinear fuzzy controller TITO PI-PD.Then, a description of the experimental level/flow control unit, its various components and their mathematical identification model is given in Section 3. The implementation of the simplest non-linear fuzzy PI controller under Siemens S7-300 PLC and the Cascade Control strategy are briefly presented in Sections 4 and 5. Section 6 presents and discusses simulation tests and experimental results.Conclusions are given in the final Section 7.

SIMPLEST NONLINEAR FUZZY TITO PI/PD CONTROLLER STRUCTURE
The control based on Fuzzy strategies was first proposed by Lotfi A. Zadeh in 1965.Since then, fuzzy logic has emerged as a powerful technique for complex industrial process control due to non linearities or time-varying responses, where it is difficult to model their dynamic behavior.Conventional PID controllers do not work well for these systems.
In such cases, fuzzy controllers, which are intrinsically nonlinear, offer better performance.However, the traditional fuzzy controller uses many fuzzy sets for the input and output blocks, which increases the time taken to calculate the control value and limits their implementation on an industrial PLC.The simplest fuzzy controller, on the other hand, is one that uses a minimum number of fuzzy sets for the input and the output.The input-output relations of linear discrete-time tow input and tow output PI controller in speed form which are given by the study [11]: Equivalently, the linear discrete-time of proportional derivative controller in position form formulas are given by: where, e q r q y q e q e q e q e q r q y q e q e q e q with   1 and   2 are proportional factors;   1 and   2 are integral factors; r1 and r2 are reference commands; y1 and y2 are outputs of TITO process; u1 and u2 are outputs of TITO controller; s12 and s21 (-or +) signs depend on the loops interactions.e1s(q), Δe1s(q), e2s(q), and Δe2s are scaled input; Δu1s(q) and Δu2s(q) are scaled outputs for PI; u1s(q) and u2s(q) are scaled outputs for PD.
It must be noted that the interaction between the two loops determines the signs of S12 and S21.Proposed in the study [17] and finalised in the study [11], the type of input-output relationships of the simplest nonlinear fuzzy PI/PD controller is based on L-type and Γ-type member ship function to calculate the scaled input variables in the fuzzification part.The control contains five rules, obtained via Larsen product.

Figure 1. TITO fuzzy controller block diagram
The fuzzification part of this controller use L-type and Γtype membership functions, as scaled input variables and the membership functions for the scaled outputs Δujs(q) for j=1, 2 are shown in Figure 2.  then ( ) and ( ) where I1, I2, I3 and I4 are the indices of the input fuzzy sets with values -1 or +1, J1 and J2 are the indices of the output fuzzy sets having value (-2, -1, 0, +1 or +2) with membership functionsµ µΔUj Jn for j, n=1 and 2. The inference engine uses the membership functions of the modified fuzzy sets ΔŨj -2 , ΔŨj -1 , ΔŨj 0 , ΔŨj +1 and ΔŨj +2 , obtained using Larsen product, which are represented by the hatched areas in Figure 3.

Figure 3. Modified output membership function
The region of scaled input plan detailed in the study [11] and given in Figure 4 shows the top view of the threedimension plot with the axes es(q), ∆es(q) and µ.In this scaled input plan, all combinations of input variables are represented.The appropriate control law in each region of the scaled input plan is shown in Figure 3.
The calculation of the scaled output value in the defuzzification part uses the CoS method based on the study [18].This scaled output value is given by: where, A(µRl) and C(µRl) are the area and centroid, respectively, of the l th lth derived output membership function of the j th output.The valve opening is proportional to the control voltage applied.The level and flow vary between 0 to 500 mm and 0 to 5 l/min respectively.The level and flow vary between 0 to 500 mm and 0 to 5 l/min respectively.The measuring signals are adjusted to vary between 0 and 10 V. A bounded deterministic disturbance step is generated by the solenoid valve (3).The identified model is never perfect due to various factors such as component reliability and measurement noise, so the choice of identification method is important.A first order system response was used to model the step response shown in Figure 6.
According to the level step response, we can identify that: Static GAN 4.7 4.48 0.44 4.5 4.0 Constant time:  ≈ .
The transfer function can be expressed by: ( ) And according to the flow step response, the transfer function can be expressed by: ( )

PLC IMPLEMENTATION OF THE SIMPLEST NONLINEAR FUZZY PI CONTROLLER
In this study, the PLC installed for control system is a highly modular Siemens S7-300 PLC (shown in Figure 3) programmed to monitor, control and analyse the sequential mode for safety operating.The implementation of the fuzzy system described in section 2 is by the using of STEP 7 ladder programming.
This PLC is fitted with 24V, 2A power supply, 314-2DP CPU module, an MPI/DP communication processor used to load the program in the programming station into PLC and HMI panel, 24 digital input channel, 16 digital output channel, analog I/O module which allows us to use 5 analog Input channel and 2 Output analog ones, 12-bit ADC and DAC converters with ±10V maximum input/output range.As input variables of the fuzzy block program, two bipolar voltages are considered on the PIW752 and the PIW752.The resulting outputs voltage is applied on analog Output module part at the address PQW752 and PQW754.In the main program, a simplified method of the fuzzy controller is developed, where at each acquisition cycle, the voltages are adapted by applying scaling gains, and then determine their membership degree to corresponding fuzzy sets.At the end, after the application of inference and defuzzification block, the output voltage is determined and transferred to the analog outputs addressed more exactly at PQW752, PQW754.The HMI virtual sliders are used as set-point variables.The level and flow responses measured respectively by level and flow sensors are set to the controller using two lanes of PLC's analog input module.As detailed in Arnu and Mohan (2016), the mathematical relations between the inputs and outputs of the fuzzy logic regulator are obtained by means of the algebraic product as AND operator, bound sum for OR, feedback product for the inference and the CoS method for defuzzification according the study [5], the crisp value of the scaled output is expressed by the Eq. ( 8) previously presented.
The expression of the surfaces and centers of the inferred belonging functions of the outputs are: 3( ) with Aj, Bj are the linguistic outputs values of the modified output membership function shown in Figure 3.The S7-SCL (Structured Control List) language is used to ensure a degree of flexibility in the implementation program.FB and FC blocks are programmed to perform the various calculations required.The first step in the controller implementation process is to calculate its input variables, consisting of four inputs: the first error e1, the derivative of this error ∆e1, the second error e2 and the derivative of this error ∆e2, which are programmed in block FB20.Depending on the value of each error and its derivative, the corresponding cell can take on an integer value between 1 and 9 based on the subspaces shown previously in Figure 4.
The assembly of the previously determined cells is programmed in function block FC22.This block merges the result of the two cells found from block FC21 to give an integer expressing the global cell ranging from 11 to 99.The FC23 block calculates the controller outputs, which are the control variations as a function of the global cell.
The numeric value of the output will be transformed to integer value (0-27648) using an unscale function block FC106 and loaded into the PQW752/ PQW754 output address device.The biggest advantage of this technique is its simplicity of implementation in a PLC's environment.

CASCADE CONTROL SYSTEM
The combination of two controllers is known as cascade control.where the master controller output signal is the set point of the slave controller generally using for processes that have a long response time as presented in Figure 7.
A single feedback controller forms both the inner and outer control loops.The controller in the outer loop is the master controller (C1), and the inner loop controller is slave controller (C2).The main advantage of cascade control is that any disturbance is rejected by the slave controller before it occurs on the master controlled output.

Figure 7. Cascade control block diagram
In this control strategy using the simplified fuzzy controller which is made up of two distinct blocks, the liquid level represents the variable of the external loop to be controlled by the first block of the proposed fuzzy compensator, and the flow rate that of the fast dynamic internal loop controlled by the second block of the controller where its set point represents the output signal of the first controller in order to reject any disturbance before it reaches the main controlled output.
Despite the wealth of sophisticated tools, including advanced controllers, the PID controller is still the most widely used in modern industrial processes [19].Several works have described the PID structure, such as series or interacting form, standard or non-interacting form and parallel form.Various methods (Ziegler and Nichols, Broida, etc.) were applied for determining PID parameters for parallel PI controllers, the control signal is given by: ( ) ( ) ( ) By imposing the closed loop transfer function (reference model): ( ) The transfer function of controller is: Parallel PI controller: By similitude of ( 4) and ( 5), the parameters of PI are: 1 and .
The proposed method gives for the level and flow controller parameters respectively:   = 10 ,   = 70 and   = 0.57 ,   = 1.2.
The analogue output module used has a physical saturation of the output voltages between 0 and 10 V, so all the control signals are adapted to this saturation.

SIMULATION AND EXPERIMENTAL RESULTS
This section presents PLC-based experimental results for the simplest classical PID controller and non-linear fuzzy PI controller.The experiments were done on an experimental Level/Flow control unit level for several level set-point and disturbance rejection.The total programme memory required for this simplest fuzzy controller implementation on the PLC, by choosing the design described above is 312 Bytes.The execution time of the algorithm developed is between 14 and 21 ms, achievable through the use of the OB35 timer interrupts or other dedicated PLC resources.The experimental results are as shown in Figure 8.The central unit of our PLC begins by analysing the main programming block, called organisation block 1 (OB1), in which all the sub-programs used to process inputs/outputs, data conversions and normalisations are programmed in LD.
The control algorithms developed are programmed in 3 different Function Blocks.Firstly, the FB30 contain the fuzzy program controllers.Secondly, the function block FB20 is used for input calculation.Third, the FB21 has the role of controlling calculations using the instance data block (DB30, DB20, DB21).These blocks associated four Function (FC) where FC20 is used for input normalization, and FC21 and FC22 for cell calculation and assembly.The calculation of output signal control is realized by the FC23 block.The measurement input and output signals are normalized by Scale/Unscale preprogrammed function respectively FC105 and FC106.Finally, both the SCL and LAD are used for programming the control algorithm.The structure of the controller is shown in Figure 10.In the experimental tests we applied several set-point tracking.The results show that the simplest non-linear fuzzy PI controller we have implemented provides a good margin of stability, the steady-state error is zero, the rise time is 12 seconds and the disturbance rejection time is 7 seconds without overshoot during the tracking test which validates our implementation approach.However, the hysteresis effect of the proportional valve on the control is more apparent in this mode.
According to Figure 11   The supervisory control and data acquisition (SCADA) system of process developed (for real-time monitoring and control) using the SIMATIC HMI panel is composed of several windows.The HMI process window shown in Figure 12 allows us to interact with the control unit, navigate to other process windows, graphically display the data provided by the I/O server.

Figure 12. Controller HMI process window
The parameters of the simplest TISO PI fuzzy controller are obtained by the minimisation of the integral of the absolute error (IAE) criteria and are shown in Table 1.

CONCLUSIONS
A simple fuzzy controller for an experimental liquid level and flow system in the laboratory has been developed and implemented on an industrial PLC for a cascade control strategy which improves the dynamic performance of the system as well as its stability compared to the single controller strategy which has performance limitations.In this control strategy, the liquid level is the variable in the outer loop to be controlled, and the flow rate is the variable in the inner loop.
The device used for the implementation was a Siemens 314-2DP CPU with an analogue I/O module.The implementation of this simplified fuzzy controller relied heavily on the PLC's ability to perform structural programming and indirect addressing.Experimental results have shown that, overall, this controller outperforms a conventional PID-PLC controller.In addition, this simplest fuzzy controller developed also showed better set point tracking dynamic performances and attenuates the external disturbance, allowing the static errors to converge rapidly to zero.This project opens a window for further research in the PLC environment for the implementation of advanced control algorithms that can be used as technical support.In summary, the simplest fuzzy controller used in this cascade liquid level control strategy has given satisfactory results and revealed the efficiency of the proposed control schemes, which constitute a very interesting strategy that can be integrated on oil industry control systems, namely distillation columns and large reservoir processes using industrial PLCs.The optimisation of the parameters of the proposed fuzzy controller requires the development and incorporation of simplified optimisation and adaptation algorithms for real time industrial control, which represents an interesting perspective for this implementation work.

Figure 1
Figure 1 indicates the typical block diagram of the TITO fuzzy PI-PD controller with: Se1, SΔe1, Se2, and SΔe2 are input scaling factors;   1 −1 and   2 −1 are output scaling factors for PI;   1 −1 and   2 −1 are output scaling factors for PD;

Figure 2 .
Figure 2. Input and output membership function The control rule base consists of five rules in the following form:

Figure 5 .
Figure 5. Experimental test unit The controller operates the proportional level valve.The valve is closed at zero control voltage and fully open at 10 V.The valve opening is proportional to the control voltage applied.The level and flow vary between 0 to 500 mm and 0 to 5 l/min respectively.The level and flow vary between 0 to 500 mm and 0 to 5 l/min respectively.The measuring signals are adjusted to vary between 0 and 10 V. A bounded deterministic disturbance step is generated by the solenoid valve (3).The identified model is never perfect due to various factors such as component reliability and measurement noise, so the choice of identification method is important.A first order system response was used to model the step response shown in Figure6.According to the level step response, we can identify that: Static GAN

Figure 6 .
Figure 6.Level and flow step response

Figure 8 .
Figure 8. PID-PLC based cascade control tracking responseFirst experiment which has been done on the control system was oriented to test the PID mode controller, note that the static error is zero, rise time (Tr) of 16 seconds and disturbance rejection time is 9 seconds with a small overshoot during the tracking test, this overshoot being the result of the constraints imposed on the speed of the dynamic response.

Figure 9 .
Figure 9. Simulation resultsThe simplest fuzzy PI controller algorithm developed was originally implemented in MATLAB/Simulink where the simulation results are shown in Figure9.The simulation

Figure 10 .
Figure 10.PLC's program structure for simplest nonlinear fuzzy PI controller control signal have oscillation because the control law has different cells.In other words, the value is calculated based on the position of different input signals for each cell includes inside the called scaled input plan presented in Figure 4.The program memory capacity required to implement this simplest non-linear fuzzy controller on the PLC is 33206 bytes.

Figure 11 .
Figure 11.Simplest nonlinear fuzzy PI experimental results

Table 1 .
Parameters of TISO PI fuzzy controller