Next Article in Journal
Effect of Different Oxygen Atmospheres on Color Stability of Modified Atmosphere Packaged Beef Using Non-Invasive Measurement
Previous Article in Journal
Assessment of Anthropogenic Load on the Ile River Ecosystem Considering Regional Peculiarities
Previous Article in Special Issue
A Framework for Integrating Robotic Process Automation with Artificial Intelligence Applied to Industry 5.0
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Development and Optimization of an Automated Industrial Wastewater Treatment System Using PLC and LSTM Neural Network

by
Žydrūnas Kavaliauskas
*,
Giedrius Blažiūnas
,
Igor Šajev
,
Aleksandras Iljinas
and
Dovilė Gimžauskaitė
Centre of Engineering Studies, Kauno kolegija Higher Education Institution, Pramones Ave. 20, LT-50468 Kaunas, Lithuania
*
Author to whom correspondence should be addressed.
Appl. Sci. 2025, 15(16), 8990; https://doi.org/10.3390/app15168990
Submission received: 30 June 2025 / Revised: 11 August 2025 / Accepted: 13 August 2025 / Published: 14 August 2025

Abstract

This study presents an automated industrial wastewater treatment system based on Siemens programmable logic controller (PLC) that optimizes reagent dosing, aeration, sedimentation, and sludge separation. The system uses accurate pH sensors, dosing pumps, solenoid valves, and a human–machine interface (HMI), and real-time monitoring is provided by a Teltonika TRB255 communication module (<45 sec. response time). As a result, the treatment cycle time was reduced by 31%, reagent consumption by 30%, and operator intervention was reduced from 95 to less than 15 min per day, achieving a pollutant removal efficiency of 89%. A two-layer LSTM architecture developed on the PyTorch platform predicts pH (6.7–7.7), temperature (12–20 °C), and reagent consumption (~9.8 kg/cycle). The model was trained with 240 h of data (64 neurons, learning rate 0.001). The validation loss remained stable, indicating reliable learning. The study confirms that AI-based automation provides greater process stability, meets environmental standards, and promotes sustainable resource use. The scientific novelty of this study is the application of an advanced long short-term memory (LSTM) model to predict wastewater treatment process parameters, allowing for accurate prediction of pH, temperature, flow, and reagent consumption, etc. This provides an opportunity to optimize the process and reduce costs, while ensuring high treatment efficiency and stability. Although there are several publications on the application of artificial intelligence models in the field of industrial wastewater treatment, this is a relatively new field, and there are little data in the scientific literature.

1. Introduction

The increasing scale and complexity of industrial processes led to a significant rise in the generation of chemically diverse and environmentally hazardous wastewater streams. Industrial effluents, particularly from metal finishing, electroplating, food production, and pharmaceutical sectors, often contain a mixture of heavy metals, complex organic pollutants, surfactants, and non-biodegradable compounds that are not easily removed by conventional treatment technologies [1,2,3]. As the global demand for resource-efficient and ecologically sustainable water management grows, the pressure to modernize wastewater treatment systems with intelligent, adaptive, and robust solutions becomes ever more urgent [4,5,6].
Traditional wastewater treatment systems rely on programmable logic controllers (PLCs) for automation, enabling real-time monitoring and control of processes such as chemical dosing, pH adjustment, aeration, and sedimentation. Integrated with supervisory control and data acquisition (SCADA) systems and human–machine interfaces (HMIs), PLCs facilitate precise management of operational parameters, significantly reducing operator error and process delays [7,8,9,10]. PLCs control not only process parameters, but also the start/stop sequences of devices—pumps, valves, aerators, and chemical dosing pumps. PLCs often manage emergency signals and automatically initiate safety protocols, for example, stopping chemical dosing pumps at critical pH values or overloads, protecting against overflow or leakage. Timers and calendar functions can be integrated into PLC programs, which allow changing control strategies according to seasonal changes (e.g., higher aeration intensity in summer) or time of day (night modes to save energy) [1,2,3]. Some PLCs have the ability to accumulate historical process information on site, allowing analysis of control efficiency, identification of common errors, or optimization of reagent use based on previous data. PLC control programs can be designed to be easily adapted to different wastewater flows—industrial, municipal, or mixed, as well as to respond quickly to sudden fluctuations, for example, due to precipitation or production changes [1,2,3,4,5]. However, these systems typically operate under fixed or semi-dynamic logic with pre-programmed threshold values, lacking adaptability to non-linear influent variability and failing to anticipate changes in system dynamics. This makes them reactive rather than predictive, particularly when addressing variable influent quality, fluctuating hydraulic loads, or the need for precise chemical dosing under time constraints [11,12,13,14,15]. Mechanical and physical systems alone cannot adequately address dissolved pollutants, and biological treatment efficiency is sensitive to temperature, pH, and toxicant concentrations [11,12]. Advanced technologies such as ozonation, membrane separation, and ultraviolet irradiation offer improvements but are capital- and energy-intensive and require precise control to be effective [16,17,18,19,20].
To address these limitations, artificial intelligence (AI) and machine learning (ML) emerged as powerful tools for enhancing wastewater treatment performance. Long short-term memory (LSTM) neural networks, a subset of ML, are particularly effective for time series forecasting in dynamic and noisy environments, enabling predictive modeling of critical parameters, such as pH shifts, temperature variation, flow rate, and reagent consumption, using historical and real-time sensor data [1,2,21,22,23,24,25,26]. Studies demonstrated AI’s potential to optimize energy usage, reagent dosing, and process performance in applications such as electrocoagulation and photovoltaic-powered systems [2,3,4,5]. For example, Chavhan et al. [3] developed an Internet of Things (IoT)-based wastewater monitoring architecture for industrial effluents, enabling remote tracking of pH and conductivity. Su et al. [4] advocated for AI integration to optimize energy usage in photovoltaic-powered systems, while Adamovic et al. [2] and Sedaghat et al. [5] showed process improvements and reduced reagent use through AI-driven electrocoagulation optimization. Edge AI with PLC, some solutions use local (edge computing) devices, minicomputers or industrial controllers, in which the LSTM model is directly implemented. In this case, there is no need for constant data transmission to the cloud or servers, and control is performed locally, reducing latency. LSTM is also used to create “virtual sensors”, models that can predict difficult-to-measure parameters, such as the efficiency of a biological process or the total amount of pollutants, based on available measurements (e.g., pH, DO, and temperature). These indicators are then used to make decisions in the PLC [1,2,3,4,5]. However, the practical integration of AI models, particularly LSTM-based architectures, with industrial PLC systems for real-time control remains underexplored. Most research isolates AI components from process control infrastructure, and deployments unifying predictive intelligence with hardware-level automation are rare [22,27,28,29,30]. Additionally, few studies address data-driven optimization of reagent dosing and adaptive control of aeration and sedimentation based on predicted system behavior rather than static setpoints [1,31,32,33]. AI-enhanced systems also offer opportunities for predictive maintenance, such as anomaly detection and degradation trend analysis, which can reduce downtime and extend component lifespan in facilities with high influent variability [3,34,35,36,37,38].
This study complements a gap in the scientific literature concerning the limited integration of artificial intelligence (AI)-based models, particularly LSTM neural networks, with industrial-grade PLCs for real-time management of industrial wastewater treatment processes. While previous research explored AI models or PLC automation independently, there is a lack of studies combining these technologies into a cohesive system capable of adaptively managing variable wastewater characteristics under real industrial conditions [1,2,29,30,31,32,33]. Furthermore, few studies focus on data-driven optimization of reagent dosing and aeration based on predicted parameters such as pH, temperature, or flow rate, which could reduce operational costs and ensure compliance with environmental standards [1,2,3,4]. This study introduces a novel integration of a Siemens S7-1214 PLC with a two-layer LSTM neural network developed on the PyTorch 2.2 platform, enabling real-time optimization of industrial wastewater treatment processes. Unlike previous research that often examines AI models or PLC automation in isolation, this work uniquely combines predictive LSTM modeling with industrial-grade PLC control, validated under real-world electroplating and surface treatment conditions. The system ensures compliance with stringent environmental standards, including the EU Water Framework Directive (2000/60/EC) and ISO 14001, through real-time monitoring via the Teltonika TRB255 module. By offering a scalable, data-driven solution that enhances process stability, reduces operational costs, and promotes sustainable resource use, this study provides a pioneering framework for intelligent wastewater treatment, addressing critical gaps in adaptive automation and predictive control. The aim of the research is to develop and evaluate an automated industrial wastewater treatment system integrating a Siemens S7-1214 PLC and a two-layer LSTM neural network to optimize reagent dosing, aeration, and sediment separation based on real-time data, increase treatment efficiency, reduce costs, and ensure compliance with environmental standards.

2. Materials and Methods

2.1. Experimental Setup and Process Automation for Wastewater Treatment

The experimental setup was designed to modernize the industrial wastewater treatment process by replacing the previously used manual control with an automated system (Figure 1). The main technological element is a PLC Siemens S7-1214, which coordinates all stages of the process: from chemical dosing to aeration, sedimentation, and sludge separation. This PLC was chosen due to its high reliability, the ability to integrate various industrial sensors and actuators, as well as its flexible adaptation to complex control sequences. The following main components are installed in the experimental setup: a JUMO pH sensor, which constantly monitors changes in the acidity or alkalinity of wastewater and transmits data to the PLC; precision dosing pumps controlled by the PLC, which dose acid, alkali, coagulants, flocculants, and calcium chloride in set amounts and time intervals; electromagnetic valves and switches responsible for controlling liquid flows, such as Bo110023/Bo116400; and an aeration (mixing) system, which ensures proper mixing of materials at different stages of the process. Level sensors in the reactor signal when pumping or draining is required, such as the Finder 72A1 float level switch. The HMI, implemented using a Siemens KTP700 panel, allows the operator to control the process, monitor status, view faults, and enter parameters. An SMS communication module Teltonika TRB255 is also integrated, which transmits data from the PLC to the operator’s mobile phone in the form of SMS messages, notifying them about the start, end, or errors of the process.
The automated process flow has been structured to ensure maximum accuracy and minimal operator intervention. The process begins with startup via the HMI—the PLC checks the readiness of all sensors and starts the aeration stage. Then, based on the pH readings received in real time, the dosing system adjusts the pH to 3.5–4.0 by adding acid. Subsequently, pre-determined amounts of calcium chloride and coagulant are automatically introduced, ensuring their proper interaction. In the next stage, alkali is dosed into the system to raise the pH to 9.0–9.5. After that, a flocculant is automatically introduced, which facilitates the separation of solid particles and liquid. After stopping aeration, a 30 min settling timer is activated, after which the sludge is pumped to the thickener, and clean water to the final collector. The system has integrated safety and monitoring measures: pH value deviation warnings, chemical level indicators, pump malfunction detection, and automated error communication via SMS. All this allows for a consistent, repeatable process flow and prompt response to malfunctions. The operator is involved only in initiating the process, replenishing chemicals according to system messages and receiving information about the process status. The experimental system was tested under real industrial conditions in order to assess its efficiency, reliability, and impact on the overall quality of wastewater treatment. This architecture not only increased process efficiency and reliability, but also ensured greater compliance with environmental standards.
Sensor calibration is a procedure to ensure the accuracy and stability of a wastewater management system, including pH, level, and temperature sensors integrated with a Siemens S7-1214 PLC system. pH sensors (JUMO) are calibrated using standard buffer solutions, performing a two-point or three-point calibration that determines the zero point and sensitivity, and the results are continuously checked and documented. Level sensors (Finder 72A1 floats) are calibrated against liquid level signals, setting switch points in the PLC program and performing test cycles to confirm their accuracy. Temperature sensors are calibrated by immersing them in a temperature-controlled water bath, correcting the measurements to known values and confirming linearity. All calibration data are stored in the PLC, and the system operates in complex chemical environments, where regular maintenance and cleaning are important. Furthermore, accurate calibration data are essential for the effectiveness of AI models, such as LSTM, that predict process behavior, and calibration is performed regularly according to manufacturer recommendations or in the event of reading deviations, ensuring the reliability and efficiency of the entire system.
In addition to this research, an artificial intelligence (AI) model was developed using the PyTorch (https://pytorch.org/) platform (designed for developing specialized AI tools), which runs in the Python 2.2 programming environment, to predict the final wastewater treatment quality based on the parameters of the incoming wastewater. The model analyzes real-time data obtained from pH (JUMO), temperature, level (Finder 72A1), and other sensors connected to a Siemens S7-1214 PLC. Using the PyTorch machine learning system, the model was trained with historical data associated with the characteristics of the incoming wastewater and treatment results (e.g., pollutant concentration, pH change after the process). It is expected that these results will allow the automatic waste control system to select the optimal treatment mode in the future: adjust the doses of chemicals, and change the aeration duration or other parameters. AI integration should reduce the need for operator intervention, improve process efficiency, and ensure greater accuracy in the face of changing wastewater characteristics. Key aspects such as LSTM selection, model configuration, training procedure, data input structure, and evaluation criteria are essential to understand and validate the validity and effectiveness of the applied method. The LSTM architecture was chosen due to its ability to efficiently model time series data, which are especially valuable for analyzing the changing parameters of wastewater flow (130–330 m3/h), pH (6.7–7.7), and temperature (12–20 °C), where long-term dependencies are important. The model configuration—240 h input window, 64 hidden neurons, 2 LSTM layers, 0.001 learning rate, and 0.3 throw-off rate—was chosen to ensure training stability and good generalization. The training procedure was performed for 500 epochs with mini-batch size 32 using real-time electroplating wastewater data. Before training the model, the entire normalized dataset was split into training (80%) and validation (20%) subsets. The random_split method was used for this purpose, which randomly assigns samples to each subset. This approach helps avoid systematic biases and improves the model’s ability to generalize to unseen data. Although chronological splitting is more commonly used in time series models, in this case, random splitting was chosen to evaluate the model’s generalization under broader conditions. Data preparation for the LSTM model is carried out through several sequential steps using input features. First, the time column is removed using drop(columns = [“Data ir laikas”]), as it is not used directly for training the model. Next, the data are normalized to the [0,1] range using the MinMaxScaler().fit_transform method, which helps ensure faster and more stable model training. The normalized data are then converted into time sequences using the create_sequences(data, input_window) function, which forms fixed-length input windows (sequences) along with their corresponding target values—this format is suitable for LSTM input. These sequences are converted into PyTorch tensors using torch.tensor() so they can be processed by the neural network. Finally, using TensorDataset, random_split, and DataLoader, the data are wrapped into a dataset, split into training and validation sets, and loaded into efficient data loaders for model training. The numerical forecasts presented in this study (e.g., predicted values of pH, wastewater temperature, flow rate, acid, alkali, and coagulant content) were generated using an LSTM-based deep learning model developed by the authors using the PyTorch machine learning framework (version 2.2) and implemented in Python 3.10.

2.2. Rationale for System Selection and Environmental Compliance

Industrial wastewater used in the study is generated during electroplating, painting, polishing, and other surface treatment processes. Such wastewater is typical for the metalworking industry, especially for companies specializing in electroplating, galvanizing, electrochemical polishing, and mechanical preparation of components. These companies often use aggressive chemicals, so their wastewater has a complex composition and requires precise and reliable treatment technologies. The PLC was chosen for several fundamental reasons that meet the needs of an industrial wastewater treatment system. First of all, this controller is characterized by high reliability and resistance, which is necessary in an environment exposed to aggressive chemicals, such as electroplating wastewater treatment. Second, it ensures flexible integration of sensors and actuators (e.g., pH sensors, dosing pumps, and valves), allowing for efficient automation of key process stages—pH regulation, aeration, and sediment removal. Third, the PLC supports real-time data monitoring and control, and together with the HMI and SMS communication module, ensures fast response to failures and process visualization. It is also compatible with the TIA Portal software, which allows for the creation and management of complex sequences and facilitates system maintenance and development. Finally, due to the ability to reduce operator intervention and ensure stable system operation, this type of PLC meets the requirements for operating an automated cleaning system in real industrial conditions [1,2,3,4,5]. The proposed automated wastewater treatment system, utilizing a Siemens S7-1214 PLC and a two-layer LSTM neural network, is designed to meet stringent environmental regulations and standards governing industrial wastewater discharge. The system achieves a pollutant removal efficiency of 89%, effectively reducing heavy metals, complex organic compounds, surfactants, and non-biodegradable substances to levels compliant with the European Union Water Framework Directive (2000/60/EC) and Lithuanian national wastewater management regulations (e.g., Wastewater Management Regulation, Ministry of Environment of the Republic of Lithuania). Precise pH control within the range of 3.5–9.5, automated reagent dosing (resulting in a 30% reduction in chemical consumption), and real-time monitoring via the Teltonika TRB255 module (response time < 45 s) ensure consistent process stability, minimizing the risk of exceeding permissible pollutant limits. Additionally, the integration of an AI-driven LSTM model optimizes resource use, reducing operational costs and environmental impact, aligning with ISO 14001 environmental management standards and promoting sustainable industrial practices. The system’s ability to adapt to variable influent conditions, as demonstrated in real-world testing with electroplating wastewater, ensures compliance with local and international discharge standards, contributing to environmentally responsible wastewater management.

3. Results and Discussion

The traditional method, tested under real industrial conditions, achieved 68–72% pollutant removal efficiency. During manual control, operators directly monitored pH changes, manually dosed chemical reagents (acids, alkalis, coagulants), and controlled the aeration and sediment separation processes. The effectiveness of this method was limited by human error, inaccurate reagent dosing, and longer response time to changing wastewater parameters such as pH or flow.
The wastewater treatment system architecture in this study is designed as a modernized, fully automated system for the treatment of industrial wastewater from electroplating, painting, to polishing processes (Figure 2). The system is based on a Siemens S7-1214 PLC, which coordinates the entire process—from chemical dosing to aeration and sludge separation. The main components of the system are pH sensors, dosing pumps, electromagnetic valves, level sensors, aeration system, SMS communication module, and HMI. The system operates cyclically: the operator starts it, and the PLC automatically controls the acid dosing (to reduce pH), the introduction of calcium chloride and coagulants, alkaline neutralization (to increase pH), the addition of flocculant, and the sedimentation phase [5]. After the settling phase, the separation of sludge and treated water is performed. The entire operation is monitored in real time, and SMS messages are sent about the progress and malfunctions. Automation reduced process time by 31%, chemical consumption by up to 30%, and operator workload to minimal intervention.
The interface between components in an automated wastewater treatment system is designed to ensure smooth data transfer and precise control of the entire process (Figure 3). The core of the system is the Siemens S7-1214, PLC, which collects data from pH sensors, level sensors, and other sensors and, based on these data, controls dosing pumps, valves, aeration devices, and other actuators. The entire process is visualized through the HMI—the Siemens KTP400 panel, where the operator can set parameters, monitor the process progress, see errors, and enter phone numbers to which automatic notifications about the process status are sent. Data from the PLC are converted into SMS format via the Teltonika TRB225 industrial gateway, which ensures communication between the automation system and external users. This interface allows real-time monitoring of the process, quick response to malfunctions, reduces the need for human intervention, and increases the overall reliability and efficiency of the system. Benefits include greater accuracy, fewer errors, shorter incident response times, and optimized chemical usage.
The process workflow of an automated wastewater treatment system is based on a pre-planned, PLC-controlled cycle that ensures consistent and accurate execution of all treatment stages (Figure 4). It all starts with the operator’s actions—the process is started via the HMI interface, and the PLC checks the status of the sensors and initiates aeration [6]. Then, based on real-time pH readings, the system automatically doses acid until the pH drops to the range of 3.5–4.0. Later, calcium chloride and coagulants are added at precisely the right time, followed by alkali to raise the pH to 9.0–9.5. Then, the flocculant dosing phase is activated, promoting the separation of solid particles and liquid. This is followed by a 30 min sedimentation phase, during which the aeration is turned off and the wastewater is allowed to settle. Finally, the separated sludge is pumped into a thickening tank, and the treated water is directed to a clean water tank. This operating principle allows for the automatic execution of a complex process without constant human supervision. The main advantages are reduced operator workload, faster process progress (about 31% shorter duration), reduced chemical consumption (20–30%), increased accuracy, and better process control and safety due to integrated sensors, time management, and SMS alerts.
Figure 5 (operator workflow: manual (left), automated process (right)) illustrates the fundamental difference between the operator’s work during the manual and automated wastewater treatment process. During the manual process, the operator must constantly monitor the pH values, take measurements several times per cycle, manually dose chemicals through valves, and actively supervise the entire 90 min process. This requires not only great attention, but also physical effort and constant presence at the equipment. Meanwhile, in the automated process, the operator’s role is limited to starting the process via the HMI interface and adding chemicals when the system sends appropriate messages. All dosing, pH adjustment, mixing, sedimentation, and liquid separation are performed automatically based on PLC. The operating principle is based on sensor data and predefined algorithm steps, which ensures stable and repeatable results. The main advantages of such a solution are significantly reduced physical and psychological load on the operator, reduced risk of human error, freed up working time for other tasks, and increased overall work efficiency and safety.
Figure 6 shows the pH variation over time of an automated wastewater treatment process, which clearly distinguishes three main phases. The first, acidification phase (0–10 min) begins when the pH value of about 5 gradually decreases to about 3.3–3.5. In this stage, acid is automatically dosed into the system, the purpose of which is to achieve optimal conditions for coagulation and flocculation, and to precipitate certain heavy metals or contaminants that are most effectively removed at low pH. The second phase, the alkalization phase (15–30 min), is characterized by a sharp pH jump, which indicates the dosing of alkaline chemicals [8]. The automated control system responds to real-time data recorded by the pH sensor and precisely doses the alkali until the required neutral or alkaline pH level is reached. The third stage, the stabilization phase (30–60 min), begins when the pH reaches about 9–9.5 and this level is maintained for the rest of the time. Small fluctuations (±0.1) are normal and reflect the continuous automatic adaptation of the system to process conditions and fluid dynamics. This consistent pH control proves that the system not only effectively regulates chemical reactions, but also maintains consistent process quality. The main advantages of such control are greater accuracy, faster response times, reduced risk of chemical overdose, and assured quality of contaminant removal. Four different pH values are used, as each corresponds to a different stage of the cleaning process: a pH value of about 5 at the beginning of the process prepares the system for acidification, a pH of 3.3–3.5 in the acidification phase creates conditions for effective coagulation, flocculation, and metal precipitation, a pH of 7–9 during alkalization neutralizes the acid and activates further reactions, and a pH of 9–9.5 in the stabilization phase maintains a constant process and ensures cleaning quality.
Monitoring pH changes in the treatment of wastewater from the electroplating industry ensures effective control of chemical reactions, as pH directly influences the coagulation of heavy metals, the precipitation of phosphates, and the neutralization of organic compounds. Pollutants such as heavy metals or phosphates are only effectively removed within a precise pH range: in an acidic medium (pH 3.5–4.0), metal precipitation occurs, and in an alkaline medium (pH 9.0–9.5), flocculation and decomposition of organic matter occur. Incorrect pH reduces treatment efficiency, causes equipment corrosion, and can violate environmental requirements, such as the EU Water Directive (2000/60/EC) if untreated wastewater is discharged. Automatic real-time pH monitoring using JUMO sensors and Siemens S7-1214 PLC allows for precise dosing of acids or alkalis, ensuring process stability [6,7,8,9,10].
Figure 7 illustrates the control cabinet of the new automated wastewater treatment system, which integrates the main electronic components responsible for controlling the entire process. The main control center of the system is the Siemens S7-1214 programmable logic controller, which collects data from sensors, processes information and controls the executive elements—pumps, valves, dispensers, and aeration equipment. The cabinet also has an HMI interface (Siemens KTP400), which allows the operator to start the system, monitor its status, set parameters, and receive information about errors. The control cabinet acts as a central nervous system, connecting all automation components into a single, effectively coordinated structure. The advantages of such a solution are clear: compact and centralized equipment, simpler management and maintenance, reduced probability of errors, fast service recovery in case of failures, and the ability to integrate smart functions, such as SMS alerts or remote access. This allows us to ensure a stable, reliable, and cost-effective wastewater treatment process [4,5,6].
PyTorch makes it easy to build, train, and adapt advanced neural network architectures that can detect complex patterns in data that are invisible to the human eye, thus ensuring more accurate and reliable predictions. The model was trained on real-time data collected from an automated industrial wastewater treatment system, which operates with various sensors—pH, temperature, level, and other process parameters, integrated with a Siemens PLC controller. These data, which include input parameters, chemical doses, and final cleaning quality, were carefully prepared for training, allowing for the creation of an effective prediction tool that helps optimize the wastewater treatment process before it even starts [3,4,5].
Figure 8 shows the forecast of wastewater volume changes over a 240 h period, which was obtained using an AI model. The forecast curve clearly shows that the wastewater flow rate during this period fluctuated between approximately 130 and 330 cubic meters per hour. Such significant fluctuations reflect real industrial process conditions, where wastewater volume varies depending on production intensity, work shift schedule, or other operational factors. This forecast is created using a PyTorch-based artificial intelligence model that has been trained on historical sensor data. The model is able to process complex time series data and generate accurate flow change forecasts that help to prepare the treatment system for changing loads in advance. This proves that the developed forecasting system is not just theoretical or based on simulation, but reflects a real practical application that allows for data-driven decisions in the real wastewater treatment process.
Figure 9 shows the prediction of wastewater pH values over a 240 h period, created using an AI model trained on real historical data. The prediction curve reveals that during this period, pH values ranged from 6.7 to 7.7. This pH range is close to neutral (7.0) and is considered optimal for many wastewater treatment processes, especially for biological and chemical treatment stages. The predicted pH fluctuations are quite narrow, which indicates that the wastewater remains chemically stable and does not change to extremes—this is important both for the protection of equipment (since acidic or alkaline conditions can cause corrosion) and for the activity of microorganisms involved in biological treatment. In addition, this fact confirms that the AI model developed using the PyTorch platform is capable of accurately predicting pH changes based on real-time sensor data. Such prediction ability allows for the planning of appropriate chemical dosages or corrective actions in advance, which increases the efficiency and stability of the treatment process. All this once again shows that integrating AI into wastewater treatment systems is valuable and can significantly contribute to sustainable and automated process management.
Over a 240 h period, as shown in Figure 10, the temperature predicted by the AI model varied from 12 °C to 20 °C. This range corresponds to normal climatic conditions and is typical for both domestic and industrial wastewater temperatures. Such fluctuations are favorable for biological treatment processes, since microorganisms that decompose organic matter operate effectively at temperatures of 10–35 °C, and the optimal range is usually 15–25 °C. This forecast indicates a stable and favorable temperature regime for wastewater treatment [1,2,3,4,5,6]. Temperature monitoring is critically important, as it directly determines the reaction rate, microbial activity, as well as the efficiency of coagulation and flocculation, and the solubility and interactions of chemicals. Sudden temperature changes can signal potential treatment process disruptions, equipment failures, or production changes. The forecast is developed using the PyTorch platform and is based on real data, emphasizing its practicality. Such information provision allows control systems and operators to timely adjust processes and optimize reagent doses and aeration time, ensuring smooth, efficient, and economical wastewater treatment [4,5,6,7].
The forecast of the amount of acid used for wastewater neutralization over a 240 h period is presented in Figure 11. The forecast curve shows that the acid consumption varied from 0.1 to 5.5 L per hour, reflecting the changing demand depending on the composition of the incoming wastewater. These fluctuations are logical, since the amount of acid directly depends on the pH level of the wastewater and the concentration of alkaline compounds in it. When the wastewater contains more alkaline substances, such as alkalis, metal hydroxides, or household chemical residues, a larger amount of acid is required for neutralization to reduce the pH to the desired level. Conversely, if the wastewater is less alkaline or has a near-neutral pH, the acid consumption is minimal. An artificial intelligence model that predicts acid consumption based on pH, temperature, and other input parameters allows for efficient planning of reagent doses, avoiding both overdosing and underdosing. This not only reduces operating costs, but also ensures a stable and safe wastewater treatment process.
The accuracy of the model was evaluated by the root mean square error (RMSE) metric, which reached 0.17 pH units for pH prediction, 0.58 °C for temperature, and 11.2 m3/h for flow rate. These results indicate that the model effectively predicts near-future process states and can be used as an aid in optimizing chemical dosing and control solutions in an automated wastewater treatment system.
Figure 12 shows the variation in the alkali consumption applied for wastewater neutralization, predicted using an artificial intelligence (AI) model developed with the PyTorch system. This model was trained with real historical data collected from automated wastewater treatment systems; therefore, the forecast provided is practically justified and corresponds to real operating conditions. According to the forecast curve, it can be seen that the alkali consumption varied from 0 to 3 L per hour over a period of 240 h. Such fluctuations are natural and depend on the chemical composition of the incoming wastewater—in particular, its initial pH and the amount of acidic impurities. If more acidic wastewater with a low pH enters the system, alkali dosing becomes necessary in order to raise the pH to the required level (usually not exceeding 9–9.5) and ensure the effective course of coagulation, flocculation, or other chemical reactions. When the wastewater contains fewer acidic pollutants or its pH is close to the required level, the amount of alkali is reduced or not needed at all. The prediction of the DI model allows for a pre-estimation of how much alkali will be needed at different times of the treatment process, which allows for more accurate planning of chemical use, reducing the risk of overdose and optimizing treatment costs. This helps maintain process stability, reduces the need for human intervention, and increases the overall efficiency of the system [6,7,8].
Forecast of coagulant consumption for wastewater neutralization, which was created using an AI model based on the PyTorch machine learning system (Figure 13). The model was trained on real historical data; therefore, the forecast provided is based on practical observations and reflects real operating conditions. According to the forecast curve, the coagulant consumption over a 240 h period ranged from 1 to 4.5 L per hour. The need for coagulants directly depends on the composition of the wastewater—in particular, on the content of suspended solids (SS), organic pollutants, and phosphates. Coagulants are used to destabilize dissolved or colloidal pollutants, forming a precipitate that can be removed by sedimentation or filtration. If more polluted wastewater containing a lot of fine particles or phosphorus compounds enters the system, more coagulants are needed. Conversely, if the wastewater is cleaner or has already been pre-treated, the coagulant consumption decreases. The AI prediction model allows for accurate estimation of the required amount of coagulants based on the parameters of the incoming wastewater, such as pH, suspended solids, temperature, or flow. This helps to optimize the use of the chemical, avoid overdosing, reduce operating costs, and maintain constant cleaning quality. The integration of AI into such processes provides real practical benefits, as it allows for automated control of complex processes and adaptation to changing conditions without constant human intervention.
The main parameters of the created artificial intelligence model were selected to ensure sufficient forecasting accuracy and stable model operation when working with wastewater treatment data time series. One of the most important parameters is the input window (input_window), which was set to 240 h—this means that the model analyzes 10 days of historical data for each forecast. The hidden layer (hidden_size), in which information is processed, is set to 64 neurons—this value allows the model to learn the relationships between various parameters sufficiently deeply, while maintaining computational efficiency. The number of layers (num_layers), two, means that the model contains two sequentially arranged LSTM layers, which increases the model’s ability to recognize complex data patterns. The dropout value, 0.3, was chosen to reduce the risk of overfitting and improve the overall generalization of the model. The model was trained with 500 epochs, which provided enough iterations to optimize the model weights, and the learning rate (learning_rate) was set to 0.001—this value is balanced between stable convergence and efficient learning speed. The mini-batch size (batch_size) was chosen as 32 to effectively train the model with smaller data portions, improving the overall training process. All these parameters were combined so that the model could accurately predict the dynamics of wastewater parameters, respond to their changes, and be applicable in real environmental management systems.
The results presented in Table 1 demonstrate that the LSTM-based AI model ensures high prediction accuracy for key parameters of the industrial wastewater treatment process. The low MAE and RMSE values across all variables indicate minimal deviations between predicted and actual values, confirming the model’s reliability. The most precise predictions were achieved for pH (RMSE = 0.17, MAPE = 1.9%), which is particularly important for maintaining chemical stability and treatment efficiency. Wastewater temperature (°C) and wastewater volume (m3/h) predictions also showed strong performance, with R2 values of 0.94 and 0.92, respectively, highlighting the model’s capacity to follow dynamic changes over time. Slightly higher MAPE values were observed for reagent forecasts—acid content, alkali content, and coagulant content (ranging from 5.8 to 7.5%)—which is acceptable considering the natural variability in wastewater composition. Nevertheless, all R2 scores exceeded 0.87, indicating a high level of explanatory power. These results confirm that the AI model is suitable for real-time process optimization, enabling accurate dosing, reducing reagent overuse, and supporting stable, environmentally compliant wastewater treatment operations.
The model is based on the LSTM architecture, which is specifically adapted to analyze time series data. Such a structure allows for effective prediction of changes in wastewater parameters over time, such as pH, temperature, or wastewater volume fluctuations, because it is able to “remember” the values of previous moments and determine their influence on future changes.
The training and validation phases are clearly separated in the model training process, which allows us to assess the accuracy of the model both during training and with previously unseen data. During each epoch, the loss indicators for both phases are recorded, so it is possible to monitor how the model is learning. This ensures transparency of the training process and helps to adjust the model parameters in a timely manner. The rapid decrease in the training loss at the beginning, when the loss decreases from approximately 0.15 to 0.03 over the first 10 epochs, occurs because the model quickly learns the basic data structures and relationships (Figure 14). In the initial learning phase, the weights are updated in large steps, so the error decreases significantly. Later, when the model has already been trained for the main trends, the loss decrease slows down and occurs much more slowly—from 0.03 to 0.01 over the remaining 490 epochs. This is because the model tries to make finer adjustments to the weights and optimize the remaining error, which is often related to data noise or more complex details. The learning process can also slow down due to the properties of the optimizer and the model approaching local minima, where the movement towards lower loss becomes slower. Therefore, in the initial stage, fast convergence occurs, and later, fine and slow optimization.
The validation loss decreases rapidly from about 0.05 to 0.04 during the first 10 epochs, as the model quickly learns the basic features of the data and is able to predict new data better. Between epochs 10 and 150, the validation loss remains almost constant, which means that the model reached a certain level of stability—it is no longer learning much better, but it is not becoming worse either, rather, it is simply maintaining its ability to share information with new data. However, from epochs 150 to 500, the validation loss increases slightly from 0.04 to 0.05, which indicates that the model is starting to overfit the training data. However, this behavior is not unusual and is not bad—it is a natural stage of the learning process when the model tries to better adapt its weights and balances sharing and learning details. Such fluctuations in validation loss are common and indicate that the model is learning normally [3,4,5,6,7].
In this study, it is important to evaluate different approaches to data prediction and process control. Traditional control methods, such as proportional-integral-derivative (PID) controllers, are widely used in industrial automation, but they are often unable to effectively respond to unexpected process changes or nonlinear relationships between variables. Although they are reliable and fast-response, their effectiveness depends on precise parameter tuning, and in systems with many input variables or complex dynamics, they become limited. Compared to other machine learning algorithms, such as multilevel perceptrons (MLP), random forests (random forest), or support vector machines (SVM), LSTM networks have a significant advantage—the ability to process time series and “memorize” long-term dependencies between data points. Other algorithms, while they may be suitable for classification or regression of static data, lose efficiency when it comes to predicting continuously changing parameters (e.g., pH, flow rate, or temperature) based on long-term historical data. Additionally, some of them require a lot of pre-processing or manual feature engineering, while LSTM networks are able to automatically learn representations from raw time series.
Although the proposed automated wastewater treatment system was developed and tested in the conditions of electrochemical industrial wastewater, its architecture and operating principles are flexible enough to be applied to other types of industrial wastewater—for example, textile, pharmaceutical, food, oil refining, or chemical industries. In many of these areas, wastewater also has a complex, constantly changing composition and requires precise control of pH, temperature, pollutant concentration, and reagent dosing. Since the system is based on a modular PLC architecture (Siemens S7-1214) and integrated sensor, dosing, and control equipment, it can be easily adapted to different technological sequence logics by changing algorithms or adding HMI functions according to the needs of a specific industry. In addition, the artificial intelligence-based forecasting system developed using the LSTM model can be retrained with new data from other industries, adapting it to specific conditions—for example, different pH ranges, organic matter concentrations, or flow dynamics. Such adaptation of the model allows the application of advanced forecasting and optimization tools in various areas where traditional management methods are insufficient. However, for the successful implementation of the system, it is necessary to ensure the appropriate selection of sensors and reagents, as well as high-quality initial data collection for model training. In general, the proposed solution can be considered a universal basis for an advanced, data-driven wastewater management system in various industries.
Forecasting wastewater parameters and the quantities of chemicals used and their variations is of utmost importance in order to ensure an efficient, stable, and economically viable wastewater treatment process. An accurate forecast allows you to anticipate possible fluctuations in wastewater composition—for example, changes in organic matter, nitrogen, or phosphorus concentrations—and adjust the dosage of chemicals accordingly. This helps to avoid both excessive and insufficient use of chemical reagents, reduces operating costs, reduces environmental impact and the risk of not meeting the quality requirements of discharged wastewater. This approach is considered a new, advanced strategy in wastewater treatment system management, as it is based on real-time data analysis, digital tools, and forecasting models, which allow the system to operate not only reactively, but also preventively. Such strategic management becomes especially important with the acceleration of urbanization, growing environmental requirements, and the transition to sustainable and smart infrastructure solutions.

4. Conclusions

This study aimed to develop and experimentally evaluate an automated industrial wastewater treatment system based on a Siemens S7-1214 programmable logic controller and a two-layer LSTM neural network to increase treatment efficiency, reduce operating costs, and ensure compliance with environmental standards. The system automated reagent dosing, aeration, and sediment separation using real-time sensor data. It achieved 89% contaminant removal efficiency (compared to 68–72% for manual control), reduced treatment cycle time by 31% (from 5.2 to 3.6 h), reduced chemical consumption by up to 30%, and reduced operator intervention time from 95 to less than 15 min per day. Real-time monitoring via the Teltonika TRB255 module (response time < 45 s) reduced system downtime from 7.2% to 1.3%, ensuring process stability and compliance with the EU Water Framework Directive (2000/60/EC) and ISO 14001 standards. The AI model, developed on the PyTorch platform, accurately predicted the main parameters: pH (6.7–7.7), temperature (12–20 °C), flow (130–330 m3/h), and reagent consumption (avg. 9.8 kg/cycle). The accuracy of the model (RMSE: 0.17 pH, 0.58 °C, 11.2 m3/h) confirmed reliable predictions. During training, the loss decreased rapidly during the first 10 epochs (from 0.15 to 0.03), then slowly optimizing the weights to 0.01. The validation loss stabilized at 0.04–0.05, indicating good generalization and adaptability to fluctuations in the composition of wastewater. The AI model predictions allowed for the pre-optimization of reagent doses and aeration duration, reducing the risk of overdose and operating costs. The system contributes to sustainable industrial wastewater treatment solutions by promoting the integration of smart technologies. These results form the basis for further development of wastewater treatment technologies, ensuring more efficient use of resources and environmental sustainability.

Author Contributions

Methodology, G.B. and I.Š.; software, G.B. and Ž.K.; formal analysis, A.I. and D.G.; writing—original draft, Ž.K. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author(s).

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. El bied, O.; Turbí, M.A.T.; Garrido, M.G.; Cano, Á.F.; Acosta, J.A. Reducing Methane, Carbon Dioxide, and Ammonia Emissions from Stored Pig Slurry Using Bacillus-Biological Additives and Aeration. Environments 2024, 11, 171. [Google Scholar] [CrossRef]
  2. Adamovic, S.; Milosevic, R.; Prica, M. Optimizing batch electrocoagulation-flotation for emerging industrial wastewaters: A review on the state-of-the-art. Desalination Water Treat. 2025, 321, 100982. [Google Scholar] [CrossRef]
  3. Chavhan, N.; Bhattad, R.; Khot, S.; Patil, S.; Pawar, A.; Pawar, T.; Gawli, P. APAH: An autonomous IoT driven real-time monitoring system for Industrial wastewater. Digit. Chem. Eng. 2025, 14, 100217. [Google Scholar] [CrossRef]
  4. Su, P.; Li, L.; Zhou, H.; Li, H.; Zhu, W.; He, H.; Ai, J.; Zhang, W. Environmental and economic sustainability of the novel photovoltaic industrial wastewater treatment systems from life cycle perspective. Environ. Res. 2025, 272, 121157. [Google Scholar] [CrossRef] [PubMed]
  5. Sedaghat, O.; Bahramifar, N.; Nowrouzi, M.; Younesi, H. Life cycle assessment of industrial wastewater treatment: Evaluating the environmental impact of electrocoagulation technologies. J. Water Process. Eng. 2025, 71, 107257. [Google Scholar] [CrossRef]
  6. Thomas, A.; Mishra, U. Effect of the wastewater treatment system and Industry 4.0 implementation for a sustainable tyre production industry. Alex. Eng. J. 2025, 115, 94–110. [Google Scholar] [CrossRef]
  7. Fernandes, J.; Ramísio, J.; Puga, H. A Comprehensive Review on Various Phases of Wastewater Technologies: Trends and Future Perspectives. Eng 2024, 5, 2633–2661. [Google Scholar] [CrossRef]
  8. Dutta, D.; Arya, S.; Kumar, S. Industrial wastewater treatment: Current trends, bottlenecks, and best practices. Chemosphere 2021, 285, 131245. [Google Scholar] [CrossRef]
  9. Rashid, R.; Shafiq, I.; Akhter, P.; Iqbal, M.J.; Hussain, M. A state-of-the-art review on wastewater treatment techniques: The effectiveness of adsorption method. Environ. Sci. Pollut. Res. 2021, 28, 9050–9066. [Google Scholar] [CrossRef]
  10. UNESCOWorldWater Assessment Programme (Ed.) The United Nations World Water Development Report 2023: Partnerships and Cooperation for Water; UN: Paris, France, 2023; pp. 1–189. [Google Scholar]
  11. Sathya, K.; Nagarajan, K.; Malar, G.C.G.; Rajalakshmi, S.; Lakshmi, P.R. A comprehensive review on comparison among effluent treatment methods and modern methods of treatment of industrial wastewater effluent from different sources. Appl. Water Sci. 2022, 12, 70. [Google Scholar] [CrossRef]
  12. Bagal, M.V.; Gogate, P.R. Wastewater treatment using hybrid treatment schemes based on cavitation and Fenton chemistry: A review. Ultrason. Sonochem. 2014, 21, 1–14. [Google Scholar] [CrossRef] [PubMed]
  13. Mishra, H.; Gaurav, G.; Khandelwal, C.; Dangayach, G.S.; Rao, P.N. Environmental assessment of an Indian municipal wastewater treatment plant in Rajasthan. Int. J. Sustain. Eng. 2021, 14, 953–962. [Google Scholar] [CrossRef]
  14. Masłoń, A.; Czarnota, J.; Szczyrba, P.; Szaja, A.; Szulżyk-Cieplak, J.; Łagód, G. Assessment of Energy Self-Sufficiency of Wastewater Treatment Plants—A Case Study from Poland. Energies 2024, 17, 1164. [Google Scholar] [CrossRef]
  15. Abujazar, M.S.S.; Karaagaç, S.U.; Amr, S.S.A.; Alazaiza, M.Y.; Bashir, M.J. Recent advancement in the application of hybrid coagulants in coagulation-flocculation of wastewater: A review. J. Clean. Prod. 2022, 345, 131133. [Google Scholar] [CrossRef]
  16. Lee, E.; Min, K.J.; Choi, H.; Park, K.Y. Impact of dewatering inorganic coagulants on anaerobic digestion treating food waste leachate. Bioresour. Technol. 2024, 393, 130136. [Google Scholar] [CrossRef]
  17. Tolkou, K.; Kyzas, Z. Advanced Technologies of Water and Wastewater Treatment. Environments 2024, 11, 270. [Google Scholar] [CrossRef]
  18. Aragon, A.G.; Cárdenas Sánchez, J.A.; Zimeri, C.; Shim, E.; Fang, X.; Young, K.R.L. TiO2-Coated Meltblown Nonwoven Fabrics Prepared via Atomic Layer Deposition for the Inactivation of E. coli as a Model Photocatalytic Drinking Water Treatment System. Environments 2024, 11, 92. [Google Scholar] [CrossRef]
  19. Skempi, D.J.; Kouvelis, K.; Petala, A.; Bampos, G.; Frontistis, Z. Heterogeneous Activation of Persulfate by Nickel Oxide/Strontium Carbonate Composite for Sulfamethoxazole Degradation in Water. Environments 2023, 10, 147. [Google Scholar] [CrossRef]
  20. Vineyard, D.; Karthikeyan, K.G.; Barak, P. BioWin Modeling of CalPrex Phosphorus Recovery from Wastewater Predicts Substantial Nuisance Struvite Reduction. Environments 2024, 11, 48. [Google Scholar] [CrossRef]
  21. Pandey, S.; Twala, B.; Singh, R.; Gehlot, A.; Singh, A.; Montero, E.; Priyadarshi, N. Wastewater Treatment with Technical Intervention Inclination towards Smart Cities. Sustainability 2022, 14, 11563. [Google Scholar] [CrossRef]
  22. Shehata, N.; Mohamed, O.A.; Sayed, E.T.; Abdelkareem, M.A.; Olabi, A.G. Geopolymer concrete as green building materials: Recent applications, sustainable development and circular economy potentials. Sci. Total Environ. 2022, 836, 155577. [Google Scholar] [CrossRef] [PubMed]
  23. Rout, P.R.; Mohanty, A.; Sharma, A.; Miglani, M.; Liu, D.; Varjani, S. Micro-and nanoplastics removal mechanisms in wastewater treatment plants: A review. J. Hazard. Mater. Adv. 2022, 6, 100070. [Google Scholar] [CrossRef]
  24. Palme, U.; Lundin, M.; Tillman, A.M.; Molander, S. Sustainable development indicators for wastewater systems–Researchers and indicator users in a co-operative case study. Resour. Conserv. Recycl. 2005, 43, 293–311. [Google Scholar] [CrossRef]
  25. Juste Ruiz, J. The process towards a global pact for the environment at the United Nations: From legal ambition to political dilution. Rev. Eur. Comp. Int. Environ. Law 2020, 29, 479–490. [Google Scholar] [CrossRef]
  26. Lu, Y. Industry 4.0: A survey on technologies, applications and open research issues. J. Ind. Inf. Integr. 2017, 6, 1–10. [Google Scholar] [CrossRef]
  27. Soller, J.A.; Eftim, S.E.; Nappier, S.P. Direct potable reuse microbial risk assessment methodology: Sensitivity analysis and application to State log credit allocations. Water Res. 2018, 128, 286–292. [Google Scholar] [CrossRef]
  28. Silva, J.A. Wastewater Treatment and Reuse for Sustainable Water Resources Management: A Systematic Literature Review. Sustainability 2023, 15, 10940. [Google Scholar] [CrossRef]
  29. Mahtab, M.S.; Farooqi, I.H.; Khursheed, A. Zero Fenton sludge discharge: A review on reuse approach during wastewater treatment by the advanced oxidation process. Int. J. Environ. Sci. Technol. 2021, 19, 2265–2278. [Google Scholar] [CrossRef]
  30. Palansooriya, K.N.; Yang, Y.; Tsang, Y.F.; Sarkar, B.; Hou, D.; Cao, X.; Meers, E.; Rinklebe, J.; Kim, K.H.; Ok, Y.S. Occurrence of contaminants in drinking water sources and the potential of biochar for water quality improvement: A review. Crit. Rev. Environ. Sci. Technol. 2020, 50, 549–611. [Google Scholar] [CrossRef]
  31. Pisa, I.; Santin, I.; Morell, A.; Vicario, J.; Vilanova, R. LSTM-Based Wastewater Treatment Plants Operation Strategies for Effluent Quality Improvement. IEEE Access 2019, 7, 159773–159786. [Google Scholar] [CrossRef]
  32. Gulshin, I.; Kuzina, O. Optimization of Wastewater Treatment Through Machine Learning-Enhanced Supervisory Control and Data Acquisition: A Case Study of Granular Sludge Process Stability and Predictive Control. Automation 2025, 6, 2. [Google Scholar] [CrossRef]
  33. Farhi, N.; Kohen, E.; Mamane, H.; Shavitt, Y. Prediction of wastewater treatment quality using LSTM neural network. Environ. Technol. Inno. 2021, 23, 101632. [Google Scholar] [CrossRef]
  34. Fu, G.; Butler, D.; Khu, S.-T. Multiple objective optimal control of integrated urban wastewater systems. Environ. Model. Softw. 2008, 23, 225–234. [Google Scholar] [CrossRef]
  35. Nakkasunchi, S.; Hewitt, N.J.; Zoppi, C.; Brandoni, C. A review of energy optimization modelling tools for the decarbonisation of wastewater treatment plants. J. Clean. Prod. 2021, 279, 123811. [Google Scholar] [CrossRef]
  36. Garrido-Baserba, M.; Barnosell, I.; Molinos-Senante, M.; Sedlak, D.L.; Rabaey, K.; Schraa, O.; Verdaguer, M.; Rosso, D.; Poch, M. The third route: A techno-economic evaluation of extreme water and wastewater decentralization. Water Res. 2022, 218, 118408. [Google Scholar] [CrossRef]
  37. Asghari, F.; Piadeh, F.; Egyir, D.; Yousefi, H.; Rizzuto, J.P.; Campos, L.C.; Behzadian, K. Resilience Assessment in UrbanWater Infrastructure: A Critical Review of Approaches, Strategies and Applications. Sustainability 2023, 15, 11151. [Google Scholar] [CrossRef]
  38. Yuan, X.; Li, L.; Wang, Y. Nonlinear dynamic soft sensor modeling with supervised long short-term memory network. IEEE Trans. Ind. Inform. 2019, 16, 3168–3176. [Google Scholar] [CrossRef]
Figure 1. Conceptual diagram of automatic control of a wastewater system.
Figure 1. Conceptual diagram of automatic control of a wastewater system.
Applsci 15 08990 g001
Figure 2. Architecture of wastewater treatment system.
Figure 2. Architecture of wastewater treatment system.
Applsci 15 08990 g002
Figure 3. Interface between components.
Figure 3. Interface between components.
Applsci 15 08990 g003
Figure 4. Process workflow diagram.
Figure 4. Process workflow diagram.
Applsci 15 08990 g004
Figure 5. Operator workflow: manual (left), automated process (right).
Figure 5. Operator workflow: manual (left), automated process (right).
Applsci 15 08990 g005
Figure 6. Graphs of pH changes over time.
Figure 6. Graphs of pH changes over time.
Applsci 15 08990 g006
Figure 7. Control cabinet for new system.
Figure 7. Control cabinet for new system.
Applsci 15 08990 g007
Figure 8. Changes in wastewater volume over time.
Figure 8. Changes in wastewater volume over time.
Applsci 15 08990 g008
Figure 9. Forecast of pH change over time.
Figure 9. Forecast of pH change over time.
Applsci 15 08990 g009
Figure 10. Forecast of wastewater temperature over time.
Figure 10. Forecast of wastewater temperature over time.
Applsci 15 08990 g010
Figure 11. Forecast of acid levels over time.
Figure 11. Forecast of acid levels over time.
Applsci 15 08990 g011
Figure 12. Alkali level prediction over time.
Figure 12. Alkali level prediction over time.
Applsci 15 08990 g012
Figure 13. Prediction of coagulant levels over time.
Figure 13. Prediction of coagulant levels over time.
Applsci 15 08990 g013
Figure 14. PyTorch artificial intelligence training data.
Figure 14. PyTorch artificial intelligence training data.
Applsci 15 08990 g014
Table 1. Accuracy metrics (MAE, RMSE, and MAPE, R2) of forecasting model.
Table 1. Accuracy metrics (MAE, RMSE, and MAPE, R2) of forecasting model.
Predicted ParameterMAERMSEMAPE (%)R2
pH0.130.171.9%0.96
Wastewater temperature (°C)0.420.583.1%0.94
Wastewater volume (m3/h)8.311.24.5%0.92
Acid content (l/h)0.410.616.3%0.89
Alkali content (l/h)0.280.397.5%0.87
Coagulant content (l/h)0.350.485.8%0.91
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Kavaliauskas, Ž.; Blažiūnas, G.; Šajev, I.; Iljinas, A.; Gimžauskaitė, D. Development and Optimization of an Automated Industrial Wastewater Treatment System Using PLC and LSTM Neural Network. Appl. Sci. 2025, 15, 8990. https://doi.org/10.3390/app15168990

AMA Style

Kavaliauskas Ž, Blažiūnas G, Šajev I, Iljinas A, Gimžauskaitė D. Development and Optimization of an Automated Industrial Wastewater Treatment System Using PLC and LSTM Neural Network. Applied Sciences. 2025; 15(16):8990. https://doi.org/10.3390/app15168990

Chicago/Turabian Style

Kavaliauskas, Žydrūnas, Giedrius Blažiūnas, Igor Šajev, Aleksandras Iljinas, and Dovilė Gimžauskaitė. 2025. "Development and Optimization of an Automated Industrial Wastewater Treatment System Using PLC and LSTM Neural Network" Applied Sciences 15, no. 16: 8990. https://doi.org/10.3390/app15168990

APA Style

Kavaliauskas, Ž., Blažiūnas, G., Šajev, I., Iljinas, A., & Gimžauskaitė, D. (2025). Development and Optimization of an Automated Industrial Wastewater Treatment System Using PLC and LSTM Neural Network. Applied Sciences, 15(16), 8990. https://doi.org/10.3390/app15168990

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop