1. Introduction
In Uzbekistan, significant efforts are being undertaken to address environmental challenges and improve energy efficiency across various industrial sectors, reflecting the country’s growing commitment to sustainable development. In line with these trends, industrial wastewater management has become a crucial environmental and technological issue due to the increasing use of chemicals and disinfectants containing chlorine compounds [
1,
2]. Moreover, the importance of process modeling and simulation is steadily growing, as these tools allow researchers to predict system behavior, optimize operational regimes, and enhance the overall efficiency of treatment technologies, including wastewater purification processes [
3]. In many industrial plants, large volumes of wastewater are collected in sludge tanks, where residual free chlorine and chloride ions accumulate [
4,
5]. These chlorinated compounds cause corrosion in pipelines and equipment, disrupt biological treatment processes, and pose a significant risk to aquatic ecosystems when discharged without proper treatment. Therefore, the removal of free chlorine ions from sludge collector water is an important step toward ensuring both environmental safety and compliance with international discharge standards [
6,
7].
Conventional methods of dechlorination, such as chemical neutralization and aeration, are often inefficient for highly concentrated or variable-flow wastewater streams. In addition, these techniques require continuous chemical dosing and generate secondary waste, which increases operational costs [
8,
9]. Ion-exchange technology, in contrast, provides a more selective and regenerable approach to removing chloride and free chlorine ions. However, the efficiency of ion-exchange systems strongly depends on process parameters such as influent flow rate, contact time, and resin saturation level. Maintaining the optimal operating regime in real time is a complex control problem, particularly under fluctuating wastewater conditions [
10].
This study provides a novel contribution by developing and applying an ANFIS-based intelligent control system specifically for free chlorine removal in an ion-exchange wastewater treatment process using real pilot-scale experimental data. Unlike many existing studies that rely on simulation or steady-state models, this work is based on 200 real operating samples and includes a systematic comparison of two ANFIS identification strategies (grid partitioning and subtractive clustering). In addition, the proposed intelligent controller is directly compared with a conventional PID controller under identical dynamic conditions, demonstrating its practical advantages for industrial wastewater treatment applications.
Previous studies have primarily focused on improving ion-exchange resin materials or analyzing equilibrium and kinetic parameters, but relatively little research has been devoted to developing intelligent control algorithms for real-time operation of such systems [
11,
12]. The lack of adaptive, data-driven control approaches limits the automation and stability of industrial wastewater treatment units. This creates a clear research gap in the integration of intelligent modeling and control for ion-exchange-based dechlorination processes. To address this gap, the present work develops an intelligent control model for an ion-exchange purification system designed to remove free chlorine ions from industrial sludge collector water [
13,
14].
A pilot-scale installation with a nominal capacity of 500 L/h was conceptually designed, and experimental data representing the relationship between flow rate and outlet chlorine concentration were used to train an Adaptive Neuro-Fuzzy Inference System (ANFIS) model [
15]. The proposed ANFIS controller aims to predict and regulate the chlorine concentration at the outlet by adjusting the process parameters in real time. This intelligent model offers a potential improvement in system adaptability, process stability, and automation efficiency compared to conventional PID-based control approaches [
16].
2. Materials and Methods
A pilot-scale ion-exchange filtration unit (
Figure 1) was designed and fabricated to remove free chlorine ions from the wastewater accumulated in industrial sludge collectors. The system consisted of a vertical pressure column packed with a strong-base anion-exchange resin, serving as the primary medium for adsorption of chloride and residual chlorine ions. The column and piping were made from corrosion-resistant PVC and polyethylene to ensure chemical durability. The unit was designed for a nominal capacity of 500 L h
−1, which allows realistic operation while maintaining laboratory controllability. The main components included [
17]:
Feed and pre-filtration section: a cartridge filter and inlet flow regulator for stabilizing flow and removing suspended solids;
Ion-exchange column: the main adsorption unit containing the resin bed;
Outlet section: sampling ports and a conductivity sensor for quality monitoring;
Instrumentation and control panel: equipped with flow, pressure, and level indicators to enable manual or automatic regulation.
Each experimental run was conducted under steady-state conditions by varying the inlet flow rate (F) between 200 L h−1 and 550 L h−1, while measuring the outlet chlorine concentration (Cl−). A total of 200 experimental samples were obtained to establish the input–output relationship required for model development.
Chlorine concentrations were measured using a portable digital analyzer (precision ± 0.05 mg L−1). All readings were filtered to eliminate outliers and normalized to the [0, 1] range. The experimental data were collected under steady-state operating conditions with a sampling interval of approximately 3 min, ensuring that each recorded data point corresponded to a stable hydraulic and chemical regime. A total of 200 samples were obtained over multiple experimental runs covering the full operating range of the filtration unit.
The dataset was randomly shuffled and divided into two subsets: 80% of the samples were used for training the ANFIS model, while the remaining 20% were reserved for independent testing. This procedure ensured that the testing data were statistically independent from the training data, allowing an unbiased evaluation of model generalization.
The primary input variable of the ANFIS model was the inlet flow rate (F), while the output variable was the outlet free chlorine concentration (Cl−). These variables were selected because the influent flow rate directly determines the contact time between wastewater and the ion-exchange resin, which strongly affects chlorine removal efficiency. All other operational conditions were kept constant during the experiments to isolate the effect of flow rate on chlorine concentration.
To model the nonlinear dependence between the inlet flow rate and the outlet chlorine concentration, an Adaptive Neuro-Fuzzy Inference System (ANFIS) was developed in MATLAB R2014a (Fuzzy Logic Toolbox). The ANFIS structure was a first-order Sugeno-type fuzzy inference system with one input (flow rate F) and one output (predicted chlorine Cl− concentration).
Two hybrid training approaches were applied: Grid Partitioning + Hybrid Optimization—The input was divided into fuzzy subsets using Gaussian membership functions. The hybrid learning algorithm combined least-squares estimation for the consequent parameters with back-propagation for the premise parameters. The model was trained for 200–300 epochs, yielding a gradual reduction in error. Subtractive Clustering + Hybrid Optimization—In this approach, the initial fuzzy structure was automatically generated by subtractive clustering. The hybrid optimization method was again used for parameter adaptation, running for 200–300 epochs with a smoother convergence profile (
Figure 2).
Model performance was evaluated using Root Mean Square Error (RMSE), Mean Absolute Error (MAE), and the coefficient of determination (R2) between predicted and measured chlorine concentrations. The trained ANFIS model was subsequently embedded into a real-time intelligent control loop that regulates the outlet chlorine concentration by adjusting the inlet flow rate. The ANFIS controller dynamically predicts and corrects system behavior under varying loads, ensuring stable operation. For benchmarking, a conventional PID controller was tuned and tested under the same operating conditions. Comparative analysis between ANFIS-based and PID-based control structures was performed in terms of response time, overshoot, and steady-state deviation, demonstrating the potential of intelligent control in enhancing process automation and water-quality consistency.
To evaluate the feasibility of real-time industrial deployment, it should be noted that the computational load of the proposed ANFIS controller is low during online operation. After the offline training stage, the real-time implementation only requires fuzzy inference and weighted summation operations, which can be executed efficiently on standard industrial programmable logic controllers (PLCs) or industrial Personal Computers (PCs) commonly used in wastewater treatment facilities. The ANFIS model employed in this study contains a limited number of membership functions and fuzzy rules, resulting in low memory usage and fast execution time. Therefore, the proposed intelligent control system can be integrated into existing automation architectures without requiring specialized high-performance hardware, making it suitable for continuous real-time control of ion-exchange dechlorination processes.
3. Result and Discussion
Two learning durations (200 and 300 epochs) were evaluated using the Grid Partition + Hybrid optimization approach. The resulting comparisons between actual and predicted chlorine concentrations for both cases are presented in
Figure 3, where the left panel corresponds to 200 epochs and the right panel to 300 epochs.
As shown in
Figure 3 (left), the ANFIS model trained for 200 epochs exhibited satisfactory predictive performance with an RMSE = 0.3216 mg L
−1, MAE = 0.2536 mg L
−1, and R
2 = 0.9669. The predicted chlorine concentrations (red markers) closely followed the experimental data (blue line), indicating that the model successfully captured the nonlinear dynamic behavior of the ion-exchange process. Small deviations observed at higher flow rates were mainly due to short-term fluctuations in hydraulic loading and resin saturation effects. When the training was extended to 300 epochs (
Figure 3 right), the model achieved a slightly improved fit, reducing the error values to RMSE = 0.2921 mg L
−1, MAE = 0.2308 mg L
−1, and increasing R
2 to 0.9727.
The additional training iterations allowed finer adjustment of membership-function parameters, thereby enhancing prediction precision and overall convergence stability. Both training configurations demonstrated strong agreement between measured and simulated chlorine concentrations, confirming the robustness of the Grid + Hybrid learning strategy in representing the process nonlinearity.
In addition to the grid-partition-based approach, the ANFIS model was trained using the Subtractive Clustering + Hybrid optimization method to enable automatic generation of the fuzzy inference structure. This approach identifies data clusters in the input space and establishes membership functions centered around them, leading to an optimized and more compact fuzzy model. Two training configurations were analyzed at 200 and 300 epochs, and the resulting model performances are presented in
Figure 4.
As illustrated in
Figure 4 (left), the ANFIS model trained using the Subtractive + Hybrid algorithm for 200 epochs achieved excellent prediction accuracy. The calculated statistical indices were RMSE = 0.1472 mg L
−1, MAE = 0.1017 mg L
−1, and R
2 = 0.9931, demonstrating a strong correlation between actual and predicted chlorine concentrations.
When the training duration was extended to 300 epochs, the model maintained nearly identical accuracy, with slightly refined metrics of RMSE = 0.1471 mg L
−1, MAE = 0.1015 mg L
−1, and R
2 = 0.9931 (
Figure 4, right). The convergence trend demonstrated that the model had already reached its optimal state by around 200 epochs, and additional training cycles resulted in negligible improvement. Nevertheless, the predictive behavior remained highly consistent, confirming the stability of the subtractive clustering approach under extended learning.
When compared with the results of the Grid + Hybrid method, the Subtractive + Hybrid approach exhibited significantly higher accuracy and convergence efficiency. Specifically, RMSE decreased from approximately 0.29–0.32 mg L−1 (Grid + Hybrid) to 0.147 mg L−1, while R2 increased from 0.97 to 0.993, representing a >50% reduction in prediction error.
To evaluate the dynamic performance of the developed intelligent control system, a closed-loop simulation was implemented in MATLAB/Simulink using the structure shown in
Figure 5. The setup included two parallel control loops: one with a conventional PID controller and the other with the proposed ANFIS-based controller. Both controllers were tested under identical conditions for regulating the outlet chlorine concentration of the ion-exchange filtration process. The reference chlorine set-point was maintained at 3 mg L
−1, and process dynamics were modeled based on the experimental ANFIS response.
To further evaluate the statistical reliability of the developed ANFIS model, an analysis of the prediction errors was performed. The residuals, defined as the difference between the measured and predicted chlorine concentrations, were found to be symmetrically distributed around zero, indicating the absence of systematic bias. Most of the prediction errors were concentrated within a narrow range, confirming that large deviations occurred only rarely.
Moreover, the consistency between training and testing performance, reflected by similar RMSE, MAE, and R2 values, demonstrates that the model is not overfitted and maintains good generalization capability. This error distribution behavior confirms the robustness of the ANFIS model and supports the statistical reliability of the reported performance indicators. The uncertainty associated with the model predictions remains low over the full operating range, making the developed intelligent system suitable for practical wastewater treatment applications.
The transient responses of both controllers are illustrated in
Figure 6, where the PID response is shown in blue and the ANFIS response in red. The figure demonstrates that both control systems successfully achieved the desired chlorine concentration, but with noticeable differences in dynamic behavior. The performance indices rise time, overshoot and settling time were estimated directly from the simulation curves.
As observed, the ANFIS controller reached the target chlorine concentration faster, exhibiting a shorter rise time of approximately 28 s compared to 35 s for the PID controller. The overshoot was significantly reduced from ~18% (PID) to ~6% (ANFIS), indicating smoother transient behavior and better control of chlorine concentration fluctuations. Similarly, the settling time improved from around 120 s with PID to 90 s with ANFIS, confirming faster stabilization around the set point.
The comparative analysis demonstrates the superior performance of the ANFIS-based control strategy over the classical PID approach. The neuro-fuzzy controller adaptively adjusted its output based on nonlinear process characteristics, leading to smoother transitions and reduced steady-state oscillations. While the PID controller provided acceptable regulation, its fixed gain structure resulted in a higher overshoot and longer settling time, especially under variable process conditions. The ANFIS controller, in contrast, leveraged fuzzy inference and neural adaptation to dynamically tune the control surface in response to process variations. These findings validate the effectiveness of the ANFIS controller in achieving faster response, minimal overshoot, and improved steady-state accuracy.
Although direct electrical energy measurements were not available in the present experimental setup, the energy efficiency of the control strategies can be assessed through their dynamic control performance. In particular, lower overshoot, shorter settling time, and smoother actuator response are directly associated with reduced control effort and lower energy consumption in pump- and valve-driven systems. As shown in
Table 1, the ANFIS controller reduced overshoot from approximately 18% (PID) to 6% and shortened the settling time from about 120 s to 90 s. This reduction in oscillations and stabilization time implies fewer corrective control actions and less excessive pumping or valve movement, which in practice leads to lower energy usage and reduced mechanical wear. Therefore, the proposed ANFIS-based intelligent control system provides a more energy-efficient operational regime compared to the conventional PID controller, even without direct power measurement.
The developed ANFIS-based intelligent control system provides a robust and energy-efficient solution for optimizing ion-exchange dechlorination processes. The approach can be extended to other industrial wastewater treatment systems requiring adaptive, precise, and self-learning process control frameworks to ensure environmental sustainability and process reliability.