Introduction
Wastewater generation is an inevitable aspect of human activity. Some of these waters are produced by actions of their nature, while others result from manufacturing processes that supply their needs, thus posing a health risk. Furthermore, wastewater is often deposited in rivers and seas without prior treatment, causing pollution to increase significantly worldwide 1. In Colombia, according to the report on sanitation discharge from the Ministry of Housing, only 54.30% of the urban wastewater generated was treated in 2022, which is a low percentage considering that the report does not include rural wastewater 2, The problem of wastewater management has been widespread in Colombia and other Latin American countries such as Ecuador. In Colombia, for more than a decade, it has been presented due to factors such as coverage and cost. The coverage problem arises because only 48.2% of the country’s municipalities have a Wastewater Treatment Plant - WWTP 3, while the cost problem arises because the implementation of a WWTP ranges from $200,000,000 ($USD 54,000) to $977,000,000 ($USD 264,000) depending on its size and equipment 3-5. In Ecuador, existing WWTPS are not enough to cover the total population demand, and a basic treatment plant can cost around $USD 31,700 6.
Wastewater treatment is developed through different stages: primary treatment, secondary treatment, and tertiary treatment, which can be carried out by means of different types or treatment processes: physical, biological, chemical, advanced, etc. In this paper, the contribution is oriented towards secondary treatment in a prototype waste-water treatment plant (WWTP) using a biological process 1, 5. The most widely used biological process for the treatment of domestic or industrial wastewater is activated sludge, which can be developed in combination with other methods given its characteristics. In 7, a wastewater treatment is performed combining the activated sludge process with activated carbon to optimize the removal of organic pollutants in wastewater generated by chemical pollutants. Another way of wastewater treatment is proposed in 8, where they combine the high rate activated sludge process (HRAS) with a vertical up flow wetland (TVUCW) to perform wastewater treatment with low energy consumption, achieving high energy production from the combination of aerobic and anaerobic processes. Another variation of activated sludge treatment is the addition of algae to the process. The algae contributed to the reduction of membrane clogging in the bioreactors. Furthermore, the application of an intermittent electric field (5 min on and 20 min off) at a current density of in membrane bioreactors improved the removal of organic matter 9. A limitation of the work in 4, 7-11 is that the wastewater treatment plants used are large-scale (for a population of about 1000).
Activated sludge is a living microorganism that requires optimal conditions of temperature, oxygen, and hydrogen potential (pH) to ensure that the organic matter present in wastewater is properly removed 5. Therefore, in biological wastewater treatment systems, real-time control and monitoring systems should be implemented to help maintain process variables within the desired values. One way of controlling temperature is presented in 10, where a mathematical model ASM1 (Activated Sludge Model) is established that has a direct influence on the temperature within the process and highlights the importance of precise control of this variable to ensure proper treatment. In 12, a cooling system was applied to closed photobioreactors (PBR) to maintain the temperature in the range of 20 to 30°C. However, although these systems are robust and work well, they generate cost overruns in the implementation of a WWTP. Another study shows the implementation of a PID controller for temperature within a wastewater treatment plant in the city of Huancayo - Peru. This may be one of the most complete classical controllers that have been implemented in a large-scale WWTP; however, in the work done, other physical variables such as dissolved oxygen (DO) and pH, which are of great importance in wastewater biological processes, were not considered 13. Regarding DO, this must be constant inside the reactors where wastewater treatment is performed so that activated sludge can perform an effective decomposition of the organic matter present in the water to be treated 14. Therefore, a set of DO real-time control and monitoring systems is presented in 14-16. For example, in 16 a simple pi controller is proposed to ensure the DO concentration inside an aeration tank at .
In this work, an electronic instrumentation and real-time control system for a prototype wastewater treatment plant (WWTP) with activated sludge is presented. The proposed methods have previously been evaluated through real-time simulations using real mathematical models of the WWTP to be implemented. The main contributions of this paper to the engineering area are presented from the methodology, theory, and results.
The methodology adopted in the research development contributed to the design and implementation of a real-time temperature control system for a prototype wastewater treatment plant with activated sludge, contributing to the integration of knowledge in basic science (biology) and applied science (Electronic engineering) that allowed the monitoring and control of the physical variables of the process.
Another important contribution to engineering from the methodology employed is the use of real mathematical models for the design, simulation and implementation process of the instrumentation and control system developed, allowing us to understand the behavior of the system and to optimize its operation. Additionally, practical techniques were applied in the tuning of PID controllers and different software tools were integrated for their implementation, which shows that controllers can be designed from experimental processes that have support in classical control theory. The theoretical contribution of the research to engineering is focused on the application of electronic principles oriented to the design and control of biological processes, contributing not only to the development of interdisciplinary applications that generate environmentally friendly solutions but also to allowing the conceptual foundations of biological processes with mathematical models through which insights can be provided on the dynamics and behavior of the implemented system.
At the level of results, the contribution to engineering is evidenced in the validation of control systems applied to experimental prototypes that allow knowing the performance of the system under real operating conditions. Furthermore, the results obtained allow thinking about other alternatives for wastewater treatment, since by improving the efficiency of the proposed system, contamination of water sources can be mitigated, contributing new possibilities to biological processes. However, physicochemical analyses carried out in the Universidad del Quindío Water Laboratory provide relevant information on the condition of the effluent obtained and allow engineering to generate advanced control processes in search of water with higher quality suitable for different uses.
Finally, the paper is organized as follows: in Section II the materials and methods used for the implementation of the PPTAR are presented. In Section III the experimental results for the simulations and the real-time implementations of the control and visualization systems are discussed. Section IV presents the conclusions obtained from the research development.
Materials and Methods
Materials
Wastewater Treatment Plant Prototype
In this paper, a prototype wastewater treatment plant with activated sludge is presented. Since the focus of the process is on secondary treatment of wastewater, the system consists of two storage tanks or reactors, as depicted in Figure 1. These reactors are designed for continuous flow and complete mixing, ensuring that influent particles are rapidly dispersed throughout the reactor, thereby promoting homogeneity in composition and volume, consistent with the effluent 1.
The first Tank, known as the aeration tank, is responsible for receiving and storing the influent water to be treated. The second Tank, referred to as the sedimentation tank, which corresponds to the space where the microorganisms responsible for the treatment stage are deposited, and the effluent of the treated water is obtained. In addition to the aeration and sedimentation tanks, the system has a motor pump for sludge recirculation and mixing with the effluent. The volume of the proposed wastewater treatment plant prototype is approximately 5.1 liters.
Activated Sludge Process
The activated sludge process was developed in 1914 in England by engineers William Lockett and Edward Arden 1, 17, 18. Activated sludges are microorganisms that remove contaminants present in treated water through a highly active surface for the adsorption of suspended materials, breaking down organic matter into simpler elements with a much lower pollutant load. The treatment of wastewater by activated sludge is an aerobic biological process that requires at least one aeration tank to combine the water to be treated with the biological floe and a sedimentation tank with recirculation in which the treated water is separated from the activated sludge 1, 5, 18, 19.
Activated sludge is considered an aquatic world because it is made up of a wide variety of microorganisms including bacteria, fungi, algae, protozoa, metazoa, among others 1, 20, 21. Bacteria represent the most important group of microorganisms within the activated sludge process due to their role in stabilizing organic material and the formation of biological floe 1. To better understand how the different types of microorganisms develop in the activated sludge process, consider the relative dominance diagram in Figure 2.
Figure 2 shows that the development of activated sludge begins at point A after wastewater is introduced into the aeration tank. After an aeration process, we are located at point B, where the saccharomyces reaches their maximum peak. Saccharomyces develops proportionally to the amount of food; if the food is high, there will be a large amount of saccharomyces and if the food decreases, the population of saccharomyces will decrease as well. At point C, the maximum peak of flagellated protozoa is reached, which consume much more food than sacordina because they are much more active microorganisms. Then, at point D, bacteria and free ciliates reach their maximum population level. These microorganisms consume less food than sacordina and protozoa. At this point, the maximum total rate of microorganisms is reached, so the activated sludge process takes place in this zone. Finally, at point E, the maximum population of attached ciliates and rotifers is reached and, because at this point the food or B.O.D is minimal, the microbial mass cannot be sustained, causing cells to die 1, 5, 18.
The treatment carried out focused on the secondary treatment stage, because at this point the wastewater to be treated contains high amounts of organic material. In our case, a conventional activated sludge system was implemented as shown in Figure 3.
The conventional activated sludge system consists of a mixture of recirculated sludge and wastewater that enters the aeration tank, is retained, and aerated for a retention time while the microorganisms stabilize the organic matter, and then passes to the sedimentation tank where the biological floe and wastewater are separated, generating a clear and clean effluent with low organic content 1, 18, 20.
Temperature and DO sensor
The sensor used for the measurement of physical variables in the wastewater treatment process was the EXTECH INSTRUMENTS 407510 industrial meter. We chose this sensor because it allowed for simultaneous measurement of the temperature and oxygen in air and the dissolved oxygen. Units of measurement for DO are mg/1, for oxygen in air, it is, and for temperature, it is °C/°F. As an industrial instrument, the 407510 also has an RS-232 interface, data retention, minimum, maximum, and average data logging and a 16-bit length, which allows the system to be scaled up in the future using industrial protocols. The EXTECH 407510 meter is shown in Figure 4.
Methods
Aeration System
The purpose of the aeration process in wastewater treatment with activated sludge is to supply oxygen to microorganisms, keep the microorganisms in suspension, and maintain direct contact between the waste generated and the activated sludge. In an aerobic process, wastewater retention times range from 0.5 to 24 hours and vary depending on the type of aeration implemented. In aerobic processes, it is essential to maintain oxygen conditions throughout the tank in such a way as to ensure the predominance of the optimal classes of microorganisms and a more stable decomposition of material 1, 5, 18. According to different authors in the literature, there are different aeration processes, among which are:
Conventional system with gradual aeration.
Conventional system with gradual aeration.
Complete mixing process.
Kraus process.
High-rate process.
Stabilization and contact process.
Extended aeration process.
Pure oxygen process.
For our research, we used the extended aeration process, which guarantees complete mixing with long aeration times. Another important factor for using prolonged aeration is that it is applied to compact prefabricated treatment systems with a flow rate of less than 400 m3/d and our system fits these characteristics, since it is an experimental prototype whose flow rate is 0.1224 m3/d 1, 5, 18, 20.
Temperature and DO Measurement
The measurement of temperature and DO in the proposed wastewater treatment system with activated sludge was carried out in tank 2 because that is where the microorganisms are in charge of treatment. The measurement taken by the sensor is stored in a 16-bytes record that is distributed according to the information presented in Table 1.
Byte number | Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | Byte 9 | Byte 10 | Byte 11 | Byte 12 | Byte 13 | Byte 14 | Byte 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Data | ☻ | 2 | 1 | 0 | 7 | 1 | 1 | 0 | 2 | 4 | 5 | 0 | 1 | 8 | 1 |
Source: The authors.
The information presented in Table 2 is interpreted as follows: The second byte indicates the reading for the temperature variable, if this value is 2 the measurement is made at °C and if it is 3 it is made at °F. The fifth byte indicates the oxygen reading, if this value is 6 corresponds to oxygen in air (O 2) and if it is 7 it corresponds to DO (mg/l). Bytes 8,9,10 and 11, indicate the temperature value realized by the equipment (24.5), bytes 12, 13, 14 and 15, indicate the oxygen level realized by the equipment (01.81). Byte 16 corresponds to the end of the data frame and indicates to the system that the buffer is full; depending on the configuration of the measuring equipment, the confirmation of data sending can be given with the number 0X0D (hexadecimal). After having the data in the buffer, it is sent through the RS-232 serial protocol to the computer to be processed and displayed. Figure 5 shows how the temperature and DO variables are measured and sent.
However, it is important to highlight that, although the research work focused on monitoring and controlling variables such as temperature and DO, the wastewater treatment plant prototype also included monitoring of other variables such as pH and level, which were not controlled in this experimental development, but can be controlled in the future through control techniques for multivariable processes.
System identification Toolbox
The System Identification Toolbox is a tool provided by MATLAB for identifying models of dynamical systems from measured data. With System Identification, you can estimate different models, including linear and nonlinear systems. It also allows you to obtain the representation of a model in different forms, such as a transfer function or state space, and to compare the responses of different models. Figure 6 shows the MATLAB System Identification Toolbox user interface 23.
Proposed control system
The control technique used focused on the design and implementation of a classical controller such as a PID. Recall that the objective of the research was to validate whether the experimental design of a prototype wastewater treatment plant is suitable for treatment in isolated areas of urban perimeters or in areas of sparsely populated populations. The PID controller shown in Figure 7 is a classical control technique used in many industrial and academic applications 5, 24. The massification in the use of PID controllers is because it is a control technique that allows on-site tuning while the system is operating, and currently in the literature there are different rules for tuning and multiple internal structures 5. Another important aspect of PID controllers is that they are generally applied in any system, even when their mathematical model is not known 24, 25, 26.
Results
Temperature Estimation Model
As mentioned above, temperature control is an important factor in the development of aerobic processes because this variable directly affects the growth of microorganisms that will carry out wastewater treatment. For this reason and to guarantee the methanogenic activity of microorganisms, it is important to ensure that the temperature inside tank 2 operates in a range of 20°C to 30aC 1, 12. In the development of this research, an experimental wastewater treatment system was used, the mathematical model of which was obtained through the MATLAB Identification Toolbox.
The modeling process started with the collection of temperature data at 2-minute intervals for one week. After data collection, the values obtained for the temperature in the tanks were averaged, generating as a result the response presented in Figure 8.
Figure 8 shows that the temperature in tank 2 has the typical shape of a first-order system with a small dead time. On the other hand, the behavior of the temperature in tank 1 has the form of a second-order system with a small overshoot (18%). The behavior presented in tank 1 was expected since in this tank the heating process of the waste-water that enters the system and falls by gravity to the sedimentation tank takes place. This process is carried out to avoid thermal shock to the microorganisms due to strong temperature changes.
Then we introduce the data of the temperature variable to the MATLAB identification system to obtain a transfer function representation of the system. The result of the procedure is shown in Figure 9.
To perform the identification procedure of the mathematical model shown in Figure 8, 100% of all available data for the temperature variable were used and divided into 70% for work and 30% for validation of the estimated system. When the identification process was carried out, models with a correspondence of 86.49% and 91.31% were obtained. The system with a correspondence of -1055 was discarded because it did not present any correspondence with the data obtained for the system. The result for the identification process is shown in Figure 10.
By choosing the estimated model with an approximation of 91,31%, we obtain the transfer function presented as follows:
Since we wanted to implement a discrete controller that would allow the concentration of all the signals of the proposed system in a central processing unit and a display device, the transfer function was discretized in MATLAB through the instructions presented in Figure 11.
To discretize the system, we chose a sampling frequency (f) 10 times higher than the maximum system frequency (f max) of the system. We did this because we wanted to improve the response speed of the control strategy. The discrete transfer function obtained for a sampling time of 1 second is the following:
The step response for the systems represented in equations (1) and (2) is shown in Figure 12.
A comparison of the time response of the temperature in tank 2 with that of the identified system is shown in Figure 13 shows a comparison of the time response of the temperature in tank 2 with that of the identified system. It can be observed that the identified system has a faster growth than the system represented by the original data in the first two sections of the figure, but both systems have similar settling times and amplitudes. The identified system has a faster growth than the system represented by the original data in the first two sections of the figure, but both systems have similar settling times and amplitudes.
Controller Design
To design a PID controller, there are different tuning techniques, such as those proposed by Ziegler and Nichols, Cohen and Coon, Lopez et al., among others 28, 29. The controller tuning rules are mainly based on the response parameters of the systems to be controlled and their characteristics. In addition to the tuning rules mentioned above, MATLAB offers a set of tools such as SISOTOOL, RLTOOL and the PID Tuner that allow designing and tuning controllers.
In our research, we used MATLAB’S PID Tuner tool because it is an interactive tool, easy to use, and allows tuning of PID, PI, PD and other variations of PID controllers. Figure x shows the response of the controller designed for the previously identified system.
The design of a controller using MATLAB’S PID Tuner starts by executing the PID Tuner in the MATLAB command window. Subsequently, the transfer function of the plant or process to be controlled must be loaded as indicated by number 1 in Figure 14. Then the shape and type of the controller to be made must be chosen as indicated by number 2 in Figure 14. For our case, we choose a standard shape and PID type controller. After this, the controller parameters are adjusted in terms of response time and transient behavior. Finally, the equation of the controller obtained is exported to the MATLAB workspace as indicated by number 3 in Figure 14.
The parameters obtained for the designed PID controller, and its equation are presented in Table 2 and Equation , respectively. There, the controller design was focused on improving the response speed of the system, considering a settling time seconds.
Tuned | |
---|---|
Kp | 9.2726 |
Ki | 97.3322 |
Kd | 0.0055997 |
Performance and Robustness | |
Rise time | 114 seconds |
Settñing time | 180 seconds |
Overshoot | 0.762% |
Peak | 1.01 |
Closed-loop stability | Stable |
Source: The authors.
Obtaining the discrete transfer function for Cs, we obtain:
Performance Test
To implement the PID controller in the wastewater system, a virtual instrument in LabVIEW was used to concentrate the variables and parameters required to adjust the process conditions. The reasons why we chose LabVIEW for the final implementation of the visualization and temperature control system in the wastewater treatment plant prototype are the following:
The DAQ used to take the data in the system was manufactured by National Instruments, the same manufacturers of LabVIEW 30.
The sensor used to measure temperature inside the system has an RS-232 interface to send data that offers easy integration with LabVIEW due to its drivers and VISA toolkits for serial communication.
LabVIEW offers an interactive and easy-to-use front panel or graphical user interface through which you can adjust the different parameters of the controller when required.
The implementation of the PID controller in LabVIEW through 4 is presented in Figure 15.
After the implementation of the PID controller, the graphical user interface presented in Figure 16 was developed. Through this interface, the user can continuously monitor the wastewater treatment process and can adjust operating parameters when necessary to ensure optimal conditions for the microorganisms.
Subsequently, the control system was integrated with the WWTPP as shown in Figure 17 to monitor the wastewater treatment and cleaning cycles.
With the visualization and control system for the prototype plant in operation, water treatment was performed on an influent with the characteristics presented in Table 3.
Source: The authors.
After treating the wastewater presented in Table 3, with retention times of 12 to 36 hours for two weeks, treated effluent water with the characteristics presented in Table 4 was obtained.
Source: The authors.
In relation to the results presented in Table 4 for treated wastewater, it was found that the treatment efficiency obtained of 67% was obtained from the effluent values prior to treatment Table 3. Furthermore, it was found that the effluent obtained does not meet the sanitary characteristics established in 31-33 for human consumption.
Conclusions
The results obtained for wastewater treatment show that the implemented secondary treatment does not provide an effluent suitable for human consumption. However, the results obtained show that treated water can be used in other secondary human activities in sectors such as agriculture or industry, which is relevant for regions where water shortages may occur or where water reuse can mitigate environmental impacts.
One of the reasons why treated water is possibly not suitable for use in primary human activities is the small size of the implemented prototype, since it is an experimental plant with an area of less than 1 m2 (commercial plants require a minimum area of 30 m2), the retention times of the process had to be varied without the possibility of increasing the flow rates of sludge, preventing an increase in the amount of microorganisms during the treatment period. However, the control system implemented in the prototype wastewater treatment plant achieved the appropriate conditions for the methanogenic activity of the microorganisms responsible for the treatment. This is reflected in the good results obtained despite the operational restrictions where, using a prototype of non-conventional dimensions, a yield of more than was achieved.
The biological results achieved for the treated effluent under established operating conditions showed a reduction in B.O.D close to This reduction is significant because it indicates the amount of oxygen that the microorganisms responsible for the treatment need to decompose the organic matter present in the effluent. The reduced C.O.D was, indicating that the total amount of organic and inorganic matter in the water decreased; therefore, its reduction indicates that the overall pollutant load of the effluent is lower. The reduction in suspended solids was and of settleable solids was, indicating an improvement in water tone and minimizing possible obstructions in receiving water bodies and treatment facilities. Finally, a pH of was achieved, which is beneficial for most aquatic ecosystems, as it helps to reduce the corrosiveness of the water.
Given the characteristics of the system and the fact that the PID controller was designed to improve the response speed of the system, it was not possible to obtain a settlement time of more than 180 seconds. If we reduced the settling time much further, the response of the system would start to overshoot, causing the microorganisms to be subjected to higher temperature variations, resulting in thermal shock. However, the actual response of the PID controller during the wastewater treatment stages was 215 seconds, because the controller obtained with the MATLAB PID Tuner tool generated an overshoot of 0.76\% that could raise the temperature outside the allowed values when approaching the boundary values.
Experimental developments such as the one carried out in this research show alternatives for low-cost wastewater treatment in rural areas and areas far from urban perimeters where there is no treatment plant. This would allow more than of the wastewater generated to be treated for emerging activities or, why not, for human consumption.