## Abstract

This paper deals with real-time control with observer to manipulate desalination plants as well as to monitor system states for smart operations. The controller plays an important role in achieving stabilization of reverse osmosis (RO) systems to guarantee the desired water product and concentration. The super-twisting (STW) sliding mode control (SMC) algorithm guarantees performance while reducing chattering. Supposing that all the state variables are not available by sensors, the observer is implemented to provide state estimation. Since smart operations depend on control algorithm and sensor availability, the proposed strategy provides robustness to ensure the water productivity even under uncertainties or under failure of sensors. The robustness is guaranteed by active controller where 80% of disturbance is eliminated in product water flow and that of product water quality is approximately 95%. As well, the state observer can produce precise predictions of the unmeasured states. Sliding mode control with observer provides the system with stability, while assuring better performances against uncertainties. Finally, the active controller with state estimator can guarantee a robust control strategy and monitoring system to extend the life of the filters and membranes, while ensuring sustainability. This control strategy is highly recommended for smart operations of desalination plants.

## HIGHLIGHTS

Real-time control has been implemented for smart operations of desalination plants against uncertainties.

Super-twisting sliding mode control strategy provides robust performance and stability with state convergences.

Control system utilizes state observer to enhance water treatment performance.

Plant automation can ensure the desired water product and concentration with sustainability.

## NOMENCLATURE

*α*control gain

*β*control gain

_{B}input matrix

_{C}output matrix

*C*_{p}product water concentration (g/L)

uncertainty boundary

*θ*reject valve opening (deg)

_{d1}input disturbance in channel 1

_{d2}input disturbance in channel 2

_{e1}error in channel 1

_{e2}error in channel 2

*F*_{p}product water flow (L/h)

_{k}process gain

DC gain

*L*observer gain

*Ω*motor pump speed (rps)

*P*positive define matrix

_{s}sliding variable

time constant

_{u}input vector

derivative part in switching part of STW SMC

_{V}Lyapunov function

natural frequency (rad/s)

_{w}switching part of STW SMC

_{x}system state vector

_{y}system output vector

damping ratio

## INTRODUCTION

Reverse osmosis (RO) water treatment is one of the most popular and most efficient technologies for the desalination of seawater and brackish water to provide clean and safe water. It is also used widely for purification treatment to remove inorganic minerals, organic compounds and other effluent materials from wastewater. It is well known that desalination processes have ever-present changes in uncertainties and disturbances. The reported industrial RO applications mostly include treatment and recycle of wastewaters generated from diverse processes such as metal finishing and plating operation, printed circuit board, semiconductor manufacturing, automotive, food and beverage. RO systems are spreading widely all over the world. Especially in dry areas, desalination plants are popping up as the main water source for human needs. One of the RO plant problems is that the system parameters change fast because of membrane fouling and contamination. Cleaning will dramatically change system parameters and cleaning time has negative effects on water productivity. Furthermore, membranes are very sensitive to feed water temperature, concentration, fouling and pressure variations (Goosen *et al.* 2005). Real-time control can significantly contribute to sustainable water management (Ashagre *et al.* 2020). Hence, RO systems often operate under many parametric uncertainties and exogenous disturbances that can cause deterioration of system performance in some plant operational stages, if they are controlled by conventional controllers in the RO literature. On the other hand, due to global climate change, the operational condition for desalination plants is getting harsher and harsher (Hartshorn *et al.* 2015). Despite the recent improvement in designing membranes and filters (Bhatti *et al.* 2020; Fazelabdolabadi & Golestan 2020; Hussain & Al-Fatlawi 2020), a modern RO plant still requires a more efficient control system to offer its optimal operation against severe working conditions. Many studies have made great contributions to the desalination literature to control RO systems. The control schemes include conventional (Alatiqi *et al.* 1989; AlDhaifallah *et al.* 2012; Sobana & Panda 2014; Ashagre *et al.* 2020), feedforward (McFall *et al.* 2008), optimal (Gambier *et al.* 2009; Ghobeity & Mitsos 2010), adaptive (Gu *et al.* 2013), model predictive control (MPC) (Robertson *et al.* 1996; Abbas 2006; Bartman *et al.* 2009a, 2009b), neural networks (Madaeni *et al.* 2015), fractional order (Feliu-Batlle *et al.* 2017), and robust control (Al-haj *et al.* 2010; Phuc *et al.* 2015, 2016; Zebbar *et al.* 2019). Among those, the most common types of controllers are based on PID and MPC (Sobana & Panda 2014). PID-based controllers include the classical one (AlDhaifallah *et al.* 2012; Sobana & Panda 2014), or modified PID such as auto-tuned PID (Rathore *et al.* 2013; Chithra *et al.* 2015). Those controllers can work well but with poor robustness even without uncertainty. MPC gave some better performance compared to PID-based controller with a slight increase in robustness characteristics. While some other controllers such as neural networks and robust H∞ controllers have robustness against uncertainty, they are quite complicated in structure with high control orders and increasing computational power and data size for real implementation. For instance, even though the full robust H∞ controller (Phuc *et al.* 2015) or the robust modified PID controller (Phuc *et al.* 2016) is designed for desalination systems, those robust controllers still have high orders. The authors realized the difficulties in the practical implementation of those controllers for desalination processes. Therefore, an active process controller that has not only high robustness but also high applicability should be implemented for new RO desalination systems.

The significant advantages of sliding mode control (SMC) over standard PID and MPC controls are in practical applications with regard to performance and robustness. Typically, SMC is one of the best choices for controlling the perturbed system dynamics under uncertainties and disturbances (Edwards & Spurgeon 1998; Utkin *et al.* 1999) proved through diverse applications. It is also simple to be implemented on the integrated RO hardware. Despite the robustness and applicability of SMC, there are still very few works done that apply it to control RO systems. In this paper, a super-twisting (STW) SMC approach (Levant 1993) is introduced for the RO system. The goal of the controller is to robustly control the product water flow and quality of desalination plants to track the desired setpoints under nominal and perturbed conditions with uncertainties and disturbances. Since the control scheme requires feedback information from all the system states, which is not always available or not practical due to the lack of sensors, the Utkin observer can be utilized to estimate the unavailable states. The precise state observer can be integrated into the process controller and it can also be used in case of sensor failures. There are hardly any published papers related to observer designs for RO plants in the literature. Since the performance of RO systems depends on the controller and the availability of the feedback signals, the novelty of this paper is that it integrates a powerful controller with pertinent state observer to robustly regulate the water product and quality even under system parameter uncertainties and disturbances or even under a failure of a certain sensor. Hence, the membrane cleaning tasks will be decreased and the water production cost will be eventually optimized. The control algorithm has been applied to an RO desalination plant, and it is verified through extensive simulation tests indicating fast response with finite-time convergence and good performance and stability of the designed controller under various uncertainties. Compared to previous works for RO systems (Phuc *et al.* 2015, 2016), the proposed controller has been implemented in the lower order model with higher applicability. Furthermore, the integrated observer provides robustness in the case of a sensor failure for smart plant operations in real-time control. As a result, the proposed method provides attractive benefits, such as insensitivity to parameter variations and external disturbances, making SMC with observer a robust design scheme for real-time process control and system monitoring of desalination plants.

## MATERIALS AND METHODS

### Mathematical model

The general RO model was originally presented by the dynamical system given in Chaaben *et al.* (2011). This is a multi-input–multi-output (MIMO) model that represents a small-scale brackish water desalination unit. As illustrated in Figure 1, the RO unit includes a high-pressure pump, a membrane array, a reject valve, and sensors to measure the product water flow *F*_{p} and the product water concentration *C*_{p}. The feed water is pumped into the membrane module with high pressure. This pressure is in excess of the osmosis pressure and forces part of the feed water to permeate through the membrane array to become fresh water while the remaining part with high concentration is barred through the reject valve. By properly controlling the motor pump speed and the reject valve opening , one can get product water with the desired flow and concentration. The model equation describing the dynamical behaviors of the desalination system is given in Chaaben *et al.* (2011).

*x*is a vector representing the system's state variables,

*u*is a vector representing the control inputs, and

*y*is a vector representing the measurement outputs. The matrices () determine the relationships between the state variables and the inputs and outputs. The detailed constituents in Equation (1) are further given as follows:

Note that in Equation (1), *d* represents all disturbances and uncertainties with condition satisfying , where *s* is the sliding variable vector defined in Equation (6) and is the finite boundary. The state-space representation given in Equation (1) can be used for control synthesis with MIMO.

For numerical simulations, all the system parameters are given in Table 1 (Chaaben *et al.* 2011). When the feed water changes in concentration from 1,000 ppm to 3,000 ppm, these parameters vary in the given (min–max) ranges, which are described as parametric uncertainty or perturbation. The designed controller will be examined under this real uncertainty condition. According to Chaaben *et al.* (2011), the two control inputs have negative actions on the product water concentration. The motor pump speed has a positive action on the product water flow while the reject valve opening has a negative action on the product water flow from a position where the product water flow reaches its maximum value. Based on those dynamical behaviors of the RO system, the active controller needs to produce proper control actions with anti-chattering function to precisely regulate the system states under parameter uncertainties and external disturbances.

Parameters . | Min values . | Max values . |
---|---|---|

k_{11} | 2.60 | 3.20 |

τ_{11} | 1.00 | 1.80 |

k_{22} | −0.20 | −0.10 |

τ_{22} | 1.00 | 1.80 |

k_{12} | −0.28 | −0.25 |

ω_{01} | 1.20 | 1.50 |

ζ_{1} | 0.30 | 0.50 |

k_{21} | −0.2 | −0.17 |

ω_{02} | 1.70 | 2.20 |

ζ_{2} | 0.45 | 0.75 |

Parameters . | Min values . | Max values . |
---|---|---|

k_{11} | 2.60 | 3.20 |

τ_{11} | 1.00 | 1.80 |

k_{22} | −0.20 | −0.10 |

τ_{22} | 1.00 | 1.80 |

k_{12} | −0.28 | −0.25 |

ω_{01} | 1.20 | 1.50 |

ζ_{1} | 0.30 | 0.50 |

k_{21} | −0.2 | −0.17 |

ω_{02} | 1.70 | 2.20 |

ζ_{2} | 0.45 | 0.75 |

### Robust control synthesis with observer

*x*

_{1ref}and

*x*

_{3ref}are the reference or desired values for water product flow and concentration, respectively;

*x*

_{1}and

*x*

_{3}are the system state variables from Equation (2). Then, the state-space representation using the sliding mode variables can be written as follows:where

*w*is based on the STW SMC proposed by Levant (1993) as follows:where and are the control gains with positive constants of the SMC control actions.

*et al.*2010), written for the first sliding variable:where and

*P*is positive define matrix with the following form:

Then, the time derivative of the Lyapunov function is negative definite, and the reach to the sliding surface is also guaranteed under Lyapunov stability theory. The same process can be applied for the second sliding variable to show the closed-loop stability.

*F*

_{p}and product water concentration

*C*

_{p}are measured via suitable sensors. In reality, the product flow and concentration rates can be available for feedback signals but the corresponding sensors should guarantee cost-effectiveness for the RO system in practical implementation. Meanwhile, the control scheme requires the feedback signals of all four variables. In this case, an observer can be utilized to provide precisely estimated states for the proposed controller. The observer design was introduced by Utkin (1992) and is summarized as follows. Let

*X*

_{1}be the vector containing measured variables and

*X*

_{2}including the unavailable ones such as:

Since the pair (*A*, *C*) in Equation (1) is observable then the pair (*A*_{22}, *A*_{21}) is also observable. Hence, if the observer gain matrix *L*_{2} is properly chosen so that satisfying , then the linear homogeneous equation in Equation (34) will have a stable solution, which is an exponential decay over time. It means that the estimated error *e*_{2} is guaranteed to converge to zero in finite time.

## RESULTS AND DISCUSSION

The numerical simulation is carried out to verify the effectiveness of the presented control scheme when implementing control systems as well as monitoring desalination plants. Since this is a small-scale system, the desired product water flow is set at 3 L/min. The desired product water concentration is 0.3 g/L, which is safe for drinkable water. To explain in more detail, the proposed controller should drive the outputs to the desired values in less than 1 s and regulate them in the face of system uncertainties and external disturbances. The control activity signals should be implemented as minimum chattering as possible to protect the system actuators and components.

By some trials with optimization scheme for different gains, the presented control parameter set gives the best performance. The large gains could result in the dramatic surge of the control signals which are detrimental for control actuators in real implementation. Sometimes, they lead to the undesired chattering while the control synthesis is in the sliding mode control. The transient responses due to step inputs are plotted in Figure 2. It can be observed that the product water flow and concentration can reach the references in less than 0.5 s with almost no overshoot. In addition, there is no error in their steady states. For comparison, a simulation on the same desalination system controlled by a conventional first-order SMC is also carried out. It can be observed from Figure 2(a) that the response of product water flow of the first^{t}-order SMC is slower than the one of the STW SMC. Furthermore, the desired concentration is not guaranteed by the first-order SMC as in Figure 2(b) where the product water concentration is obviously not pure enough for drinking. The state response of the proposed STW SMC is also faster than the other controllers in RO literature such as MPC (Sobana & Panda 2014) and fuzzy (Vrkalovic *et al.* 2018).

The control signals corresponding to the transient responses are shown in Figure 3. The first is the pump speed and the second is the opening angle of the reject valve in the desalination plants. It can be seen that the control activity signals of the STW SMC have only slight chattering in transient time and quickly become smooth in steady states, while those of the first-order SMC have chattering problems with very high frequency and amplitude occurring in both channels. The presence of chattering generates unsuitable control laws for actuators and thus it is very harmful to switching devices such as the valves and motor drivers. Therefore, the STW SMC with almost no chattering offers appropriate process control laws for high-quality water production with the efficiency of the desalination plants.

The robust performance will be checked in the condition with external disturbances. In this simulation, a disturbance caused by a sudden change in the feed concentration is introduced into the control system assessments. The external disturbances are of short duration and have the tendency to reduce the product water flow and increase the product water concentration. To examine the robust performance in each channel separately, the external disturbances are introduced into the first and the second channel at 4 and 7 s, respectively, for practical applications. It can be observed from Figure 4 that the disturbances have some effect on the outputs, which tend to drive them away from the desired values. However, the active STW SMC immediately provides appropriate actions to drive the outputs back to track the references and regulate them effectively. The effects of the disturbances on the system performance are eliminated in a very short time. Specifically, the disturbance elimination is 80 and 95% in the first and the second channel, respectively. The disturbance rejection in the first channel by the first-order SMC is also plotted for comparison. It can be seen in Figure 4(a) that the first-order SMC can only eliminate 55% of external disturbances.

Note that other disturbances such as fouling also have similar effects on water product flow and concentration but in a slightly slower manner. Hence, the controller can also easily cope with those kinds of disturbances. As mentioned before, the frequent cleaning tasks will reduce the productivity of RO systems. By dealing with the disturbances, the active controller in the monitoring system can help reduce the component cleaning tasks and increase RO productivity with efficiency. Thus, the active control system will be a reasonable alternative to cost-intensive replacements for desalination plants.

In addition, the robust characteristics for the control synthesis are examined under parameter variations. In this simulation, the system parameters are randomly varied or perturbed in the ranges given in Table 1. As shown in Figure 5, it can be seen that the outputs controlled by STW SMC have somewhat slight deviations; nonetheless, they still keep their values near the desired references. It means the proposed controller can effectively regulate the outputs of the RO system under parametric uncertainty. The comparison in Figure 5(a) shows that under the same uncertainty, the product water flow controlled by the first-order SMC has more severe fluctuations.

Finally, the state estimation of the observers is illustrated in Figure 6. Providing that the initial values of the measured variables are (0,0,0.9,0) and those of the estimated values are (1,1,1,1), it can be easy to see that all the states are estimated precisely within 2 s. There exist no estimation errors afterwards. Note that due to the disturbances at 4 and 7 s, the estimations of *x*_{1} and *x*_{3} have somewhat slight errors before rejoining the corresponding measured signals. It clearly proves the effectiveness and robustness of the proposed observer. These observers can be used as a sensor replacement in the case of failures or some sensors not being available to provide precise feedback signals for the active controller even against uncertainties. As a result, the proposed method provides advantages, such as insensitivity to parameter variations and external disturbances, making SMC with observer an appropriate scheme for robust process control.

In summary, the proposed scheme guarantees more robust control system with respect to parametric uncertainties and external disturbances than conventional controllers while keeping low-order structure than some advanced H∞ robust controllers. For smart plant operations, the STW SMC strategy is easy to implement and applicable in reality. The control method exhibits small overshoots and short settling times in time-domain response. The ability to estimate the system states is also highly noticeable due to the integrated state observer for real-time operations. The control system still survives even though malfunctions due to sensor failure can occur, therefore guaranteeing the robustness of the proposed scheme. By realizing the novel STW scheme, chattering has been dramatically suppressed in control actions. This control method is highly recommended for better regulating RO plants without challenges and limitations to implementation in reality.

## CONCLUSIONS

The real-time process control synthesis implemented by the novel STW SMC algorithm with state estimator has been realized to robustly manage the desalination plants under uncertainties for water productivity and efficiency. The overall design goal is to provide optimal plant operation and maintenance strategies for water quality and capacity against harsh environmental conditions, consequently improving plant sustainability and reducing the cleaning tasks. Typically, the STW scheme is intended to guarantee reference tracking while the state observer is to estimate unavailable states for feedback control for smart operations. The simulation results show that the proposed control scheme provides robust performance where 80% of disturbance is eliminated in product water flow and that of product water quality is approximately 95%. The effect of parametric uncertainties on system performance is significantly removed as well. The control activity signals are smoothened to prolong the lifetime of system components by removing chattering. For the real-time process control, the proposed STW SMC strategy outperforms the conventional SMC and the other controllers in the RO literature. Moreover, the system states are precisely estimated by the designed observer, which can be used to provide feedback signals without knowledge of all system states when there are some sensor failures or state measurement with sensors is inherently not available. Sliding mode control with the estimator is a powerful process control scheme that can offer a robust closed-loop system against plant uncertainties and exogenous disturbances. When the desalination plant has been running with the novel automated system, operational efficiency and performance are significant for ensuring resilient and sustainable water infrastructure in reality. Based on the obtained results and the capability of the controller, the proposed observer-based STW SMC is highly recommended for the real-time process control strategy of desalination plants.

## DATA AVAILABILITY STATEMENT

All relevant data are included in the paper or its Supplementary Information.