Next Article in Journal
Ensemble Hindcasting of Coastal Wave Heights
Previous Article in Journal
GIT: A Transformer-Based Deep Learning Model for Geoacoustic Inversion
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Improving Aquaculture Water Quality Using Dual-Input Fuzzy Logic Control for Ammonia Nitrogen Management

1
Ph.D. Program of Maritime Science and Technology, National Kaohsiung University of Science and Technology, Kaohsiung 811, Taiwan
2
Department of Marine Engineering, National Kaohsiung University of Science and Technology, Kaohsiung 811, Taiwan
3
Department of Marine Environmental Engineering, National Kaohsiung University of Science and Technology, Kaohsiung 811, Taiwan
4
Research and Development Centre, Vel Tech University, Chennai 600062, India
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
J. Mar. Sci. Eng. 2023, 11(6), 1109; https://doi.org/10.3390/jmse11061109
Submission received: 20 April 2023 / Revised: 15 May 2023 / Accepted: 22 May 2023 / Published: 24 May 2023

Abstract

:
In this paper, a closed-loop control system using dual-input fuzzy logic theory is proposed to improve the water quality of aquaculture. The new closed-loop control system is implemented on a Raspberry-Pi-embedded platform using Python programming. The proposed closed-loop control system integrates an RS485 function, a database transfer module, a simulating variable group function, and a trigger function import to achieve savings in human resources, power, and water consumption. The proposed closed-loop control system is equipped with an ammonia nitrogen sensor and solenoid valves for the water exchange. The experimental results demonstrate that the intelligent controller can rapidly eliminate ammonia nitrogen within the range of 2.0 ppm and maintain robust control in response to changes in ammonia nitrogen excretion from a school of fish. The experimental results provide insights into the relationship between tank capacity, water exchange solenoid valves, and ammonia nitrogen degradation time, which can be used to optimize aquaculture density and improve industrialization. The experimental results demonstrate that the savings for power and water can be achieved above 95%.

1. Introduction

Aquaculture is one of the fastest-growing sectors of agriculture, with an increasing demand for fish and seafood. However, aquaculture production is subject to water quality problems that can affect the survival and growth of fish. One of the most important water quality parameters for aquaculture is ammonia, which is toxic to fish at high concentrations. Therefore, controlling ammonia levels is critical for successful aquaculture production.
Traditional methods for monitoring and controlling water quality in aquaculture involve manual labor and periodic sampling, which are time-consuming, expensive, and often lead to delayed responses to water quality problems. Therefore, an intelligent control system that can automatically monitor and adjust water quality parameters, such as ammonia, is necessary to optimize aquaculture production and reduce costs.
In recent years, fuzzy logic control has been widely used in industrial control systems due to its ability to deal with uncertainty and nonlinear systems. In this paper, we propose a closed-loop control system based on two-dimensional fuzzy logic theory to control ammonia levels in aquaculture. The proposed closed-loop control system is implemented on a Raspberry-Pi-embedded platform using Python programming. The proposed closed-loop control system integrates an RS485 function, a database transfer module, a simulating variable group function, and a trigger function import to achieve savings in human resources, power, and water consumption.
In this paper, we provide an experiment to validate our proposed approach with an ammonia nitrogen sensor and solenoid valves for the water exchange. The experimental results demonstrate that the intelligent controller can rapidly eliminate ammonia nitrogen within the range of 2.0 ppm and maintain robust control in response to changes in ammonia nitrogen excretion from a school of fish. The results provide insights into the relationship between tank capacity, water exchange solenoid valves, and ammonia nitrogen removal time, which can be used to optimize aquaculture density and industrialization.
Various approaches have been proposed for monitoring and controlling water quality in aquaculture. Machine-learning-based models have been widely used for predicting water quality parameters, such as dissolved oxygen, temperature, pH, and turbidity. For example, Chen et al. [1] proposed a prediction model based on artificial neural networks (ANNs) to predict the water quality of shrimp ponds. However, these models did not consider ammonia levels, a critical parameter for aquaculture production.
Other approaches for controlling ammonia levels in aquaculture involve using chemical treatments, such as nitrification inhibitors and ammonia-binding resins. However, these methods can be expensive, and chemicals can negatively affect the environment.
Fuzzy logic control has recently been proposed for regulating aquaculture water quality parameters. For example, Zhou et al. [2] proposed a fuzzy logic controller for controlling dissolved oxygen levels in recirculating aquaculture systems. However, these approaches need to consider the two-dimensional nature of the problem, which involves both ammonia levels and aquaculture density.
Recirculating Aquaculture Systems (RASs) have been widely used in aquaculture to improve water quality and reduce environmental impacts [3]. However, controlling water quality in RASs can be challenging due to the complexity of the system and the dynamic nature of water quality parameters.
Nagothu proposed a fuzzy logic control system for water quality control in RASs that considers multiple parameters, including dissolved oxygen, temperature, pH, and ammonia [4]. The results showed that the fuzzy logic controller could maintain stable water quality within the desired range.
Hu et al. [5] proposed an intelligent decision support system for water quality assessment in aquaculture ponds. This system uses a combination of fuzzy logic and artificial neural networks to predict water quality parameters, including ammonia, and provide recommendations for water quality management.
Timmons and Ebeling provided a comprehensive overview of RASs, including system design and operation, water quality management, and environmental sustainability [6]. Their book offers practical guidance for the design and operation of RASs and emphasizes the importance of water quality management for successful aquaculture production.
Boyd offered a comprehensive guide for bottom soils, sediment, and pond aquaculture [7]. The book covers various aspects of pond aquaculture, including water quality management, nutrient cycling, and sediment dynamics.
Martins et al. [8] reviewed the new developments in RASs in Europe and provided a broad perspective on environmental sustainability. The authors discussed the benefits and challenges of RASs and provided recommendations for sustainable aquaculture production.
Minggong et al. [9] proposed an intelligent water quality monitoring and controlling system for aquaculture. Their system uses sensors and fuzzy logic control to monitor and adjust water quality parameters, including ammonia. The results showed the system could maintain stable water quality within the desired range.
Nouraki et al. [10] reviewed the use of machine learning models for predicting water quality variables in aquaculture. The authors discussed the advantages and limitations of different machine-learning algorithms and provided recommendations for future research.
The major novelty and research motivation are provided as follows:
(1)
In our past reviews about the applications of aquaculture management, we found that few results can be implemented and validated successfully. In this paper, an intelligent control system is proposed which can automatically monitor and adjust water quality to optimize aquaculture production and reduce costs.
(2)
Fuzzy logic control has been proposed as a promising approach for water quality control in aquaculture. The proposed results using nonlinear fuzzy logic control can be applied directly rather than the trial-and-error method in the traditional PID control.
(3)
In this paper, we use the Mamdani method for the fuzzy inference system (FIS). The Mamdani fuzzy inference method is presented by some linguistic variables and fuzzy sets, which makes them very similar to the natural language descriptions and easier to understand and implement.
(4)
For more reliable results, multiprogramming, and networked applications, the Raspberry Pi is used instead of a controller with lower power consumption. The RS485 function is a reliable protocol which is used by the developer of ammonia nitrogen sensors.
This paper will be organized as follows. The theoretical foundations and problem formulation are provided in Section 2. The methods and experiments are developed in Section 3. Some results are illustrated to show the main proposed results in Section 4. A conclusion is provided in Section 5.

2. Theoretical Foundations and Problem Formulation

This section introduces the concept of ammonia nitrogen, its impact on fish, the idea of a fuzzy controller, and its modularization and application.

2.1. Total Ammonia Nitrogen

Ammonia exists in two chemical forms in aquaculture water: un-ionized ammonia (NH3) and ammonium ions (NH4+). The combination of these two forms is called total ammonia or total ammonia nitrogen (TAN) [11]. According to the relationship of NH3, NH4+, temperature, and pH values given in a table in [11], NH3 accounts for 0.0080 of the total ammonia nitrogen value at a water temperature of 30 °C and a pH of 7.0. The converted NH4+ value is 0.9920. In other words, if the NH4+ value detected by the ammonia nitrogen sensor is 0.124 ppm, the NH3 value is calculated as 0.01 ppm.

2.2. Effects of NH3 on Fish Health and Survival Rate

The fraction of un-ionized ammonia increases with pH and temperature but decreases slightly with increasing salinity [11]. Knowing the fraction of ammonia in its un-ionized form (NH3) is essential because it is about 100 times more toxic to fish than that of the ionized form (NH4+). NH3 levels above 0.05 ppm can damage fish, and concentrations above 2.0 ppm can quickly cause fish to die [11].
NH3 is toxic to fish because after it enters the blood, it oxidizes the Fe2+ contained in hemoglobin molecules into Fe3+, which inhibits the oxygen-carrying capacity of the blood and can cause the suffocation and death of the fish in severe cases. Ammonia nitrogen mainly enters through the fish gill epidermis and intestinal mucosa, followed by the nervous system, causing damage to the liver and kidneys of fish, causing hyperemia on the body surface and viscera, muscle hyperplasia and tumors, and even hepatic coma and death. Even at low concentrations of ammonia, long-term exposure can damage gill tissue, causing the bending, adhesion, or fusion of gill filaments [11].
The amount of NH3 a fish produces after feeding can be estimated [12]. The total ammonia nitrogen emission per unit feeding intake of a 50 g grouper is 3.59 mg TAN/g feed [12], and fish consume an amount of food that is about 4% of the body weight per feeding [13]. For example, feeding a 50 g spotted grouper 2 g of food will lead to the excretion of about 3.59 mg/g of TAN within the next 6–10 h. At a water temperature of 30 °C and a pH of 7, NH3 accounts for 0.8% of this TAN. Assuming the tank holds 20 L of water, the concentration of NH3 is estimated to be 0.003 ppm.
The fishery water quality standards of China (GB11607-1989) stipulate that when the concentration of NH3 is less than 0.02 ppm, it will not affect fishes’ biological life activities such as fish growth and reproduction. The maximum concentration allowed for NH3 is 0.1 ppm. Above this level, different fish are affected differently but all are affected negatively. For example, when it reaches 0.289 ppm, all carp will die. At 0.46 ppm, it will poison all tilapia. A concentration of 0.97 ppm will damage the gills, liver, and kidneys of grass carp, and their growth will be restricted [14]. With regard to the above international standards, this article sets the maximum allowable value of NH3 concentration in aquaculture water to 0.1 ppm, and the maximum is not more than 0.2 ppm.

2.3. The Closed-Loop Control System with Disturbance Term

Figure 1 shows a closed-loop control system with a sensor [15]. The NH3 value and the rate of change, d/dt, of the NH3 are the dual inputs to the fuzzy logic operation of the fuzzy controller. The number of solenoid valves in the drainpipe is deduced. The valves are used to increase or decrease the displacement, and the concentration of NH3 in the water is thereby changed. Some blocks are explained as follows: d/dt denotes the rate of change for NH3, fuzzy controller denotes the use of fuzzy rule to calculate the number of pipes, solenoid valve denotes the execution of switch of valve, water tank denotes the process of the experiment tank, and sensor denotes the detection of NH3.
In the event of a disturbance, the stability and robustness of the control system are crucial for maintaining the total ammonia nitrogen value within the fish tank using the closed-loop control system. Figure 2 simulates the random uncertainty of the fish’s excretion after feeding and how its impact on the robustness of the fuzzy controller is evaluated. The block of TAN of fish denotes some disturbance of the fish’s excretion. Here, the total ammonia nitrogen value in the fish tank is observed and the time it takes to reduce NH3 to zero is evaluated. These values are used to calculate the concentration of ammonia nitrogen in the aquaculture system and maintain the maximum level under the upper limit of 2.0 ppm for fish survival (the reference for aquaculture industries).

2.4. Fuzzy Theory

According to Zadeh’s proposed fuzzy theory [16] and Mamdani’s commentary on fuzzy logic control (FLC) [17], FLC is an easy-to-control nonlinear controller with advantages of adaptation, robustness, and fault tolerance, making it suitable for systems with nonlinear, time-varying, and uncertain modes.
Qiao et al. [18] used nonisometric triangular membership functions and local linearization techniques to approximate FLC as a traditional PID controller. Lewis et al. [19] adopted a nonisometric triangular membership function to analyze the relationship between input and output, allowing FLC to provide some nonlinearity.
The advantage of using fuzzy control theory is that the mathematical model of the controlled system is based on expert knowledge and operator experience. This knowledge is then transformed into “IF-THEN” semantic control rules. FLC generates an output that brings the controlled system to a stable state by applying fuzzy inference rules to these control rules.

2.4.1. Establishing the Structure of the Fuzzy System

The architecture of the fuzzy system can be defined through the following variables [20]:
(1)
Input values
<1>
NH3, with the units of ppm;
<2>
d(NH3)/dt, with the units of ppm/sec.
(2)
Output variable change water (CW): The amount of water that can be changed is proportional to the number of fresh water inlet pipes. The more water pipes that are available, the greater the amount of water change that can be provided.

2.4.2. Defining the Fuzzy Sets of Input and Output

The defined fuzzy sets of input and output variables are as follows [20]:
  • Input 1: (NH3), NH3 = {High, Medium, Low};
  • Input 2: (d(NH3)/dt), NH3 rate of change = {up, no change, down};
  • Output: (CW), the number of water pipes = {4 p, 3 p, 2 p, 1 p, 0 p}.

2.4.3. Setting the Membership Function

According to the practical and expert operational experiences, we formulated the membership function as follows [20]:
(1)
The membership function of NH3 is shown in Figure 3.
(2)
The membership function of d(NH3)/dt is shown in Figure 4.
(3)
The membership function of CW is shown in Figure 5.

2.4.4. Establishing the Fuzzy Rules

The fuzzy data inference, the decision-making rules, the field personnel’s operating experience, and the expert experience given in the literature can be formulated into the following fuzzy laws [20].
(1)
If (NH3 is low)   and (d(NH3)/dt is down)     then (CW is P0).
(2)
If (NH3 is low)   and (d(NH3)/dt is no)     then (CW is P1).
(3)
If (NH3 is low)   and (d(NH3)/dt is up)     then (CW is P2).
(4)
If (NH3 is med)  and (d(NH3)/dt is down)     then (CW is P1).
(5)
If (NH3 is med)  and (d(NH3)/dt is no)     then (CW is P2).
(6)
If (NH3 is med)  and (d(NH3)/dt is up)     then (CW is P3).
(7)
If (NH3 is high)  and (d(NH3)/dt is down)     then (CW is P2).
(8)
If (NH3 is high)  and (d(NH3)/dt is no)     then (CW is P3).
(9)
If (NH3 is high)  and (d(NH3)/dt is up)     then (CW is P4).

2.4.5. The Fuzzy Rule Table

The contents of the laws are provided in the rule table (Table 1) and are based on the fuzzy rules given in [20].

2.4.6. Defuzzification, Calculating the Number of CW Water Change Pipes (Pip) [20]

The CW water pipe changes are calculated according to the following rules.
(1)
Defuzzification results in −5.00 ≦ OUTPUT < −3.50,
triggering 0 sets of water pipe changes (P0);
(2)
Defuzzification results in −3.50 ≦ OUTPUT < −0.33,
triggering a group of water pipe changes (P1);
(3)
Defuzzification results in −0.33 ≦ OUTPUT < 0.66,
triggering two sets of water pipe changes (P2);
(4)
Defuzzification results in 0.66 ≦ OUTPUT < 3.50,
triggering three sets of water pipe changes (P3);
(5)
Defuzzification results in 3.50 ≦ OUTPUT ≦ 5.00,
triggering four sets of water pipe changes (P4);
After defuzzification using the Fuzzy tool function in the Matlab software, NH3 = 0.15 is set as input 1, d(NH3)/dt = 0.03 as input 2, the inferred water exchange amount = 2.00, and the fuzzy trigger rules are selected as R2, R5, R7, R8, and R9. The output is P3, as shown in Figure 6 [20].

2.5. Embedded Systems

According to Marwedel’s principles of design [21], the embedded system is organized to integrate the various elements of the information processing and computing system with the controlled environment. The information processing system is embedded in a closed product, and its main features are immediacy, reliability, and efficiency. These features were adapted in the present design as follows.

2.5.1. Adapting the Raspberry Pi Platform

(1)
The experiment utilized a Raspberry Pi 4B with a 4GB LPDDR4-3200 SDRAM, an external 128 GB SSD, and installed with Berry Boot v2.0 multi-boot. We also used the built-in Raspberry Pi OS operating system to protect the Raspberry Pi from power failure, accidents, or other disturbances during operation. It is crucial to note that the Pi OS operating system was necessary for the experiment to run smoothly, avoid unnecessary troubles, and protect the research results from destruction or loss.
(2)
To avoid errors caused by network interruptions, rather than setting up a judgment program in the cloud, we directly connected the Raspberry Pi to relays for real-time situation processing.

2.5.2. Adapting Python

(1)
The Python programming language was installed in the Raspberry Pi OS operating system and the Visual Studio Code editing software was used to write the program codes. This enabled easy modification and error reminders while writing the program codes.
(2)
The following modules and functions were imported and set up to execute the main code:
<1>
Mamdani fuzzy logic module;
<2>
RS485 reading module;
<3>
Database upload function;
<4>
Relay driver function;
<5>
Time function;
<6>
Random number module.

2.5.3. Database

We built a database on Google Sheets connecting to the Google Cloud Plat via IFTTT. This database can record the test data uploaded by the fuzzy controller and draw a statistical chart of the three variables, NH3, d(NH3)/dt, and the number of pipes.

3. Methods and Experiments

3.1. Research Methods

This study adopted two research methods: (1) actual sensor experiments and (2) simulation tests.

3.1.1. Ammonia Nitrogen Sensor Experiment

To evaluate the fuzzy logic controller’s (FLC) efficacy in controlling the ammonia nitrogen content, the following experiments were conducted.
(1)
1.89 ppm NH3 was added to the experimental tank and the FLC’s removal performance was observed and recorded.
(2)
NH3 was randomly dropped into the experimental tank to simulate fish excretion and the FLC’s removal performance was observed and recorded.

3.1.2. Simulation Test

A simulation program was developed using Python and the following variables were added to observe the FLC’s efficacy in controlling the ammonia nitrogen content:
(1)
The water tank’s capacity was set at 20 L, 40 L, 60 L, 80 L, and 100 L.
(2)
Data was collected from the sensors at different time intervals: one, two, three, five, and seven minutes.
(3)
The maximum number of fish that the tank can accommodate without exceeding the NH3 concentration limit was explored (i.e., the maximum allowable population density).

3.1.3. Discussion on Power and Water Consumption

The discussion on power and water consumption was divided into two sections:
(1)
Power Consumption: Different fish species, body sizes, weights, and other factors will affect ammonia nitrogen excretion. This study used spotted groupers, each weighing 50 g, as an example. The experimental conditions of the water and power consumption between FLC and ordinary pumps were compared:
<1>
A general control pump with only an electrical switch and no ammonia nitrogen was defined as the test control.
<2>
The general control pumps used a set of in-water and out-water pumps. These two sets were used to change the water at the rate of about 400 L/h for 24 h.
<3>
The water and power consumption using FLC was recorded after each fish feeding. Subsequent research can use this model to set up different parameters to obtain the desired information.
(2)
Water Consumption: The water consumption was measured during the experiment, and the water use of the FLC was compared with the results using ordinary pumps.

3.2. Experimental Equipment

Figure 7 and Figure 8 show the ammonia nitrogen sensor and the ion controller used in the experiment, respectively. First, the ammonia sensors’ data were transmitted to the ion controller, which sends the data to the Raspberry Pi via the RS485 communication device. After analyzing the FLC program in the Raspberry Pi, the number of pipe sets required was calculated, and the solenoid valve relays were triggered to change the water (Figure 9). The experimental equipment consisted of three water tanks arranged in a tiered stack. The upper tank was a clean water reservoir, the middle tank was the experimental tank with ammonia nitrogen, and the lower tank was a wastewater receptacle. The sets of water inlet and outlet pipes were oriented on opposite sides of the experimental tank in order to remove NH3 effectively. The water tank level was maintained using solenoid valves with the same flow rate (Figure 10). The flow chart for the controller program design is illustrated in Figure 11. The specifications of all parts in our experiment are provided in Table 2. The selections are based on the accuracy and cost of our research. In this paper, the sensors of ammonia nitrogen were put into the center of tank to ensure the average concentration of NH3. For large fish ponds, some sensors should be put into suitable locations (corner and center) to obtain the available concentration of NH3. In this experiment, the independent variable was the number of water pipes and the dependent variable was the size of water pipes.

4. Results

4.1. Ammonia Nitrogen Sensor Experiment

The primary purpose of this experiment was to observe the efficacy of the fuzzy logic controller in combination with the ammonia nitrogen sensor for controlling the concentration of NH3 in water. In this experiment, we assumed that the transport delay could be neglected based on the short-distance environment. The time for a real-time response should be selected as 2 min with the refresh time of the sensor.

4.1.1. Standard FLC Test with a Concentration of 1.89 ppm NH3

The initial concentration the solution used was 1.89 ppm, slightly under the previously defined limit of 2.00 ppm. (It was difficult to control the concentration to be exactly 2.00 ppm.) The solenoid valve’s flow rate was 40.0 mL/s, and the sensor was set to collect data every two seconds. The experimental procedure of reducing the NH3 concentration of 1.89 ppm to 0 ppm lasted 20 min and 38 s. The NH3, d(NH3)/dt, and relevant pipe statistics are shown in Figure 12. The figure is explained as follows:
(1)
In the beginning of the experiment when the initial NH3 concentration was high, the FLC used four sets of solenoid valves to change the water. As the concentration decreased, the water flow necessary to continue reducing the concentration decreased, so the number of solenoid valves that were used decreased until the NH3 concentration reached 0.
(2)
In the sixth cycle (from left to right), the concentration of NH3 was 0.04 ppm, which is below the critical concentration of 0.05 ppm at which harm to fish occurs. At this point, only one solenoid valve remained open and the amount of water flow was relatively low. From then on, the water exchange continued at a slower rate until the contamination was completely cleared, thus allowing water to be conserved.

4.1.2. Randomly Adding Ammonia Nitrogen Solution to Imitate the Excretion of Fish

Once it was established that the FLC could effectively control the NH3 concentration, the question of whether the FLC could respond appropriately by adjusting to varying levels of NH3 similar to random fish excretions was explored. During this experiment, different doses of ammonia nitrogen solutions were randomly added into the tank, thereby presenting a disturbance variable. The response of the FLC was observed, especially to see whether this would cause any unexpected or unfavorable responses.
As shown in Figure 13, randomly dropping different doses of ammonia nitrogen solution into the bath caused the measured values to fluctuate, with the blue line of NH3, the red line of d(NH3)/dt, and the yellow bar indicating the pipe implementation rising and falling one after another. However, these values eventually returned to zero without any bugs or failures, thereby confirming the robustness and stability of the FLC and the solenoid valve operation.

4.2. Simulation Test

Replacing actual experiments with simulation programs will obtain approximate results for different variables, such as the tank capacity, the sensor data acquisition rate, and the aquaculture density.

4.2.1. Performance Using a Varying Water Tank Capacity

To observe the FLC’s efficacy in relation to the volume of water in the tank, different amounts of water were used in the test: 20 L, 40 L, 60 L, 80 L, and 100 L. In this experiment, the initial NH3 concentration was 1.89 ppm, the water flow rate was 40.0 mL/s, and the sensor data acquisition intervals were 2 min.
(1)
For the 20 L water tank, it took 20 min and 38 s to reduce the concentration of NH3 from 1.89 ppm to 0.0 ppm, which was exactly the same time as the previous experiment’s 20 min and 38 s, indicating that the simulation program’s parameters have a certain reliability. The relationship of NH3, d(NH3)/dt, and the number of pipe sets is shown in Figure 14.
(2)
For the 40 L water tank, it took 52 min and 59 s to reduce the concentration of NH3 from 1.89 ppm to 0.0 ppm. The relationship of NH3, d(NH3)/dt, and the number of pipe sets is shown in Figure 15.
(3)
For the 60 L water tank, it took 83 min and 35 s to reduce the concentration of NH3 from 1.89 ppm to 0.0 ppm. The relationship of NH3, d(NH3)/dt, and the number of pipe sets is shown in Figure 16.
(4)
For the 80 L water tank, it took 111 min and 59 s to reduce the concentration of NH3 from 1.89 ppm to 0.0 ppm. The relationship of NH3, d(NH3)/dt, and the number of pipe sets is shown in Figure 17.
(5)
For the 100 L water tank, it took 139 min and 51 s to reduce the concentration of NH3 from 1.89 ppm to 0.0 ppm. The relationship of NH3, d(NH3)/dt, and the number of pipe sets is shown in Figure 18.
A statistical chart of the capacity of the water tank and the time required to lower the NH3 concentration is shown in Figure 19. As can be seen, the larger the water tank, the longer it takes to remove NH3. Implementing another solenoid valve should increase the water exchange rate and shorten the removal time. However, changing all the water in the tank with new water within 2 min (data catch time) did not help save water and power, and the FLC became useless. The actual usefulness of the FLC was in reducing the concentration of NH3 to a specified limit (from 2.0 ppm to 0.04 ppm) within a controlled time frame, where the time may be specified as 2 min, 30 min, 1 h, or even a few days, depending on the tolerance to NH3 exhibited by the specific species of fish.

4.2.2. Observing the Efficacy of FLC Using Different Data Acquisition Intervals

In this experiment, the following test conditions were selected: 0.86 ppm NH3 concentration (close to the 0.9 ppm tolerance of groupers), a 100 L water tank, and a 40.0 mL/s water flow rate. Five different data acquisition intervals were tested: one min, two min, three min, five min, and seven min, and the time required to reduce the NH3 concentration to 0 ppm was recorded. As shown in Table 3 and Figure 20, the longer the data acquisition interval, the faster the removal of NH3. Using a longer acquisition interval appeared to be more efficient in terms of the time required; however, using a longer interval resulted in continually changing the water even after the NH3 had already been removed, leading to more water consumption and waste.

4.2.3. Aquaculture Density

Aquaculture density refers to the number of fish in a certain volume of water. The maximum aquaculture density is that which can accommodate the greatest number of fish in a certain size of tank while maintaining a safe NH3 concentration. The maximum aquaculture density is relative to the species of fish in question, as different kinds of fish have different tolerances to ammonia nitrogen.
If the highest NH3 concentration that can be tolerated by the fish and the volume of the water tank is known, the FLC can calculate the maximum number of fish allowable under these conditions and clean out the NH3 within two hours.
For this example, a 50 g grouper in a 20 L water tank is considered. The water flow rate is 40.0 mL/s and the feeding is about 2 g per fish. (1 feeding = 50 g fish weight × 4% = 2 g.) At 30 °C, pH = 7, and NH3 accounts for TAN 0.8%. When converted into weight, this is 0.05744 mg at a concentration of 0.00287 ppm. The safe concentration is 0.9 ppm, so the maximum aquaculture quantity is 0.9/0.00287 = 313 fish. Given the relevant information, a simulation test demonstrated that FLC could quickly reduce the NH3 concentration below the safe value, as shown in Figure 21.

4.3. Power and Water Consumption Comparison

According to Section 4.1.2, randomly dripping ammonia nitrogen solution into the fish tank was carried out to simulate fish excretion and compare the power and water consumption of the FLC with non-FLC pumps, and this required 24 h to change the water.
Table 4 shows the statistical data for the power and water consumed after one feeding time. The FLC only consumed 3.6 w per hour for each solenoid valve (12 V, 0.30 A), and each non-FLC pump (pump) consumed 3 w per hour. Comparing the consumption of power and water of the FLC and pump, it was 4.9% and 4.4%, respectively, so the power-saving rate was 95.1%, and the water-saving rate was 95.6%.
If the number of feeding times are increased to two, four, or six times daily, then the power-saving and water-saving rates will steadily decrease, as shown in Table 5 and Figure 22.

5. Discussion

The experimental results demonstrated the strength, novelty, advancement, and industrial applicability of the FLC’s ability to control the ammonia nitrogen content of a reservoir of fish. Certain aspects of these results are discussed as follows.

5.1. Tests with No Disturbance Variable

In practical sensor measurements, the FLC successfully removed NH3 in a short time when tested with a concentration of 1.89 ppm NH3. In simulated experiments using the same concentration, the FLC required a similar time to remove NH3, demonstrating the correctness of the formula used to derive the FLC model.

5.2. Tests with Disturbance Variables

Whether it was sensor measurement or simulation testing, the FLC showed no system failures or errors in the experiment when randomly introducing NH3 to mimic fish excretion as an interfering variable. NH3 at different doses could be cleared in a short time, demonstrating the robustness, controllability, and novelty of the FLC. It is also the world’s first successful experiment applying an FLC to reduce ammonia nitrogen levels in aquaculture.

5.3. Aquaculture Density Estimation

We analyzed the relationship among the tank capacity, valve water flow rate, and NH3 removal time using simulated test data. According to the scale of farming and fish survival, the parameters of these factors can be adjusted appropriately. For example, a modest increase in the valve water flow rate in larger tanks can shorten the NH3 removal time. The water flow increase in the valve is based on the following formula (obtained through multiple simulation experiments) as a reference:
V—P × S × t must be greater than 0. Otherwise, the FLC will not operate.
  • where
    • V = The water tank capacity (in L);
    • P = The number of irrigation pipes and solenoid valve sets (calculated by four sets);
    • S = The water flow rate of the valves (in mL/sec);
    • t = The sensor data acquisition time (in seconds).

5.3.1. Determination of Aquaculture Density Based on a Known Fish Excretion Rate

High-density aquaculture with high survival rates can be maintained because the NH3 concentration can be controlled under the limit and rapidly reduced when necessary. Aquaculture density (an integer value) in a water tank can be determined based on the tolerance of fish to NH3 (in ppm), the conversion factor of the fish excretion rate to NH3 (in ppm), and the water tank capacity (in liters). The formula for calculating aquaculture density is as follows.
  • The deduced breeding density formula can be written as:
  • T × V = f NH3 × F.
  • The variables for the above equations are defined as:
  • T = The tolerance of fish to NH3 (in ppm).
  • V = The capacity of the water tank (in L).
  • f NH3 = The value of fish excretion converted into NH3 (in ppm).
  • F = The number of fish (an integer).
When estimating the number of fish by total weight, the number of fish can be obtained by rounding down to the nearest integer.

5.3.2. Determination of Aquaculture Density Based on an Unknown Fish Excretion Rate

When adopting an extensive aquaculture system in which the NH3 levels of separate batches of fish are monitored with sensors, it is possible to determine a suitable stocking density for each batch, such that the NH3 concentration remains within the fish’s tolerance level or does not exceed 2.0 ppm. In this case, adopting a FLC system can effectively remove NH3 within a short time, enabling optimal aquaculture density.

5.4. Assessment of Electric Power Consumption and Water Consumption

According to Table 3, it is evident that the power and water consumption of the FLC are significantly lower compared to the traditional method of continuously changing the water for 24 h a day using a water pump. The FLC system consumes minimal power due to using solenoid valves without pumps, resulting in a 97% reduction in power consumption and a 99% reduction in water consumption. Although wastewater recycling after purification is possible, this study does not address this issue.

6. Conclusions

This study presents a practical and effective method for determining the stocking density of fish in aquaculture. The proposed formulas and culture systems can be widely applied in aquaculture to ensure the optimal stocking density, survival rate, and NH3 removal. The experimentation proved that the fuzzy logic theory can be used to control the ammonia nitrogen concentration. Overall, the results show that the proposed FLC system can effectively remove NH3 and save power and water consumption compared to traditional non-FLC pumps. The simulation tests and random disturbance experiments confirm the system’s robustness and stability. The ammonia nitrogen intelligent controller that was developed using the closed-loop control system and two-dimensional fuzzy theory can effectively and quickly remove NH3 in the water. Within the range of 2.0 ppm NH3 concentration, the intelligent controller exhibits a strong control ability when simulating changes in ammonia nitrogen excretion by fish schools. The simulated results suggest that FLC can significantly reduce manual labor and the consumption of power and water. These results may be a useful reference for the future industrialization of aquaculture. The correlation between water tank size and the number and placement of sensors will be considered an important coefficient to design the experiment. After suitable settling, the ammonia concentration can be distributed evenly. It is expected that similar methods can be used in subsequent studies to control other water quality parameters. The state-of-the-art control technologies, such as adaptive control, an adaptive-network-based fuzzy inference system (ANFIS), neural networks, and machine learning, can be applied to this control issue in our future work. The memory of embedded hardware, the accuracy and reliability of sensors and devices, and generalizability are our limitations in our developed approach and results. Some relevant issues for water quality management and testing can be considered in our future work about this article [22,23].

7. Patents

The results of this research partially validate the recently published patent: “A method of intelligent control of ammonia nitrogen value in aquaculture water and its equipment”. Taiwan Patent TWI785737 B, filed on 13 August 2021 and issued on 1 December 2022.

Author Contributions

Conceptualization, C.-H.L. and H.-C.L.; methodology, K.-W.Y. and H.-C.L.; software, H.-C.L.; validation, H.-C.L.; formal analysis, C.-H.L. and C.L.; investigation, H.-C.L.; resources, K.-W.Y.; data curation, H.-C.L. and S.V.; writing—original draft preparation, C.-H.L. and H.-C.L.; writing—review and editing, C.-H.L.; visualization, H.-C.L. and C.-R.Y.; supervision, C.-H.L. and C.L.; project administration, C.-H.L.; funding acquisition, C.-H.L. and K.-W.Y. The authors declare that the study was realized in collaboration with the same responsibility. All authors have read and agreed to the published version of the manuscript.

Funding

The above research was supported by the Ministry of Science and Technology of Taiwan, under grant number MOST 111-2221-E-992-080.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Chen, Y.; Song, L.; Liu, Y.; Yang, L.; Li, D. A Review of the Artificial Neural Network Models for Water Quality Prediction. Appl. Sci. 2020, 10, 5776. [Google Scholar] [CrossRef]
  2. Zhou, X.; Wang, J.; Huang, L.; Li, D.; Duan, Q. Modelling and controlling dissolved oxygen in recirculating aquaculture systems based on mechanism analysis and an adaptive PID controller. Comput. Electron. Agric. 2022, 192, 106583. [Google Scholar] [CrossRef]
  3. Lawson, T.B. Recirculating Aquaculture Systems. In Fundamentals of Aquacultural Engineering; Springer: Boston, MA, USA, 1995; pp. 192–247. [Google Scholar]
  4. Nagothu, S.K. Intelligent Control of Aerator and Water Pump in Aquaculture Using Fuzzy Logic; Springer: Singapore, 2021; pp. 160–171. [Google Scholar]
  5. Hu, Z.; Li, R.; Xia, X.; Yu, C.; Fan, X.; Zhao, Y. A method overview in smart aquaculture. Environ. Monit. Assess. 2020, 192, 493. [Google Scholar] [CrossRef] [PubMed]
  6. Ebeling, J.M.; Timmons, M.B. Recirculating Aquaculture; Ithaca Publishing Company, LLC: Ithaca, NY, USA, 2013. [Google Scholar]
  7. Boyd, C.E. Bottom Soils, Sediment, and Pond Aquaculture; Springer: Berlin/Heidelberg, Germany, 1995. [Google Scholar]
  8. Martins, C.I.M.; Eding, E.H.; Verdegem, M.C.J.; Heinsbroek, L.T.N.; Schneider, O.; Blancheton, J.P.; d’Orbcastel, E.R.; Verreth, J.A.J. New developments in recirculating aquaculture systems in Europe: A perspective on environmental sustainability. Aquac. Eng. 2010, 43, 83–93. [Google Scholar] [CrossRef]
  9. Hua, M.; Zhao, D.; Xia, W.; Zhu, Y.; Liu, X. The Design of Intelligent Monitor and Control System of Aquaculture Based on Wireless Sensor Networks. In Proceedings of the 2010 3rd International Conference on Computer Science and Information Technology, Wuxi, China, 9–11 July 2010; pp. 9–12. [Google Scholar]
  10. Nouraki, A.; Alavi, M.; Golabi, M.; Albaji, M. Prediction of water quality parameters using machine learning models: A case study of the Karun River, Iran. Environ. Sci. Pollut. Res. 2021, 28, 57060–57072. [Google Scholar] [CrossRef] [PubMed]
  11. Francis-Floyd, R.; Watson, C.; Petty, D.; Pouder, D.B. Ammonia in aquatic systems. Inst. Food Agric. Sci. IFAS FA 2009, 16, 1–4. [Google Scholar] [CrossRef]
  12. Cai, Z.J. Study on Nitrogen Emission Rate of Grouper and Gentian Grouper; National Taiwan University: Taipei, Taiwan, 2013. [Google Scholar]
  13. Wu, F.C.; Ye, S.L. Feed vitamin E requirement and immune response of juvenile gentian grouper. J. Taiwan Fish. Res. 2008, 16, 77–85. [Google Scholar]
  14. Zhang, W.Q.; Zhu, Y. Advances on the Research of the Hazard of Ammonia Nitrogen in Aquaculture Water and its Determination Method. J. Environ. Hyg. 2012, 2, 324–327. [Google Scholar]
  15. Golnaraghi, M.F.; Kuo, B.C. Automatic Control Systems; Wiley: Hoboken, NJ, USA, 2010; p. 7. [Google Scholar]
  16. Zadeh, L.A. Fuzzy Sets. Inf. Control. 1965, 8, 338–353. [Google Scholar] [CrossRef]
  17. Mamdani, E.H. Advances in the linguistic synthesis of fuzzy controllers. Int. J. Man-Mach. Stud. 1976, 8, 669–678. [Google Scholar] [CrossRef]
  18. Qiao, W.Z.; Masaharu, M. PID type fuzzy controller and parameters adaptive method. Fuzzy Sets Syst. 1996, 78, 23–35. [Google Scholar] [CrossRef]
  19. Lewis, F.L.; Liu, K.; Selmic, R.; Wang, L.-X. Adaptive fuzzy logic compensation of actuator deadzones. J. Robot. Syst. 1997, 14, 501–511. [Google Scholar] [CrossRef]
  20. Lien, C.H.; Li, H.C.; Lin, C. A Method of Intelligent Control of Ammonia Nitrogen Value in Aquaculture Water and Its Equipment. Taiwan Patent TWI785737 B, 1 December 2022. [Google Scholar]
  21. Marwedel, P. Embedded System Design; Springer: Cham, Switzerland, 2021. [Google Scholar]
  22. Xiong, Y.; Zhu, H.; Pan, L.; Wang, J. Research on intelligent trajectory control method of water quality testing unmanned surface vessel. J. Mar. Sci. Eng. 2022, 10, 1252. [Google Scholar] [CrossRef]
  23. Wang, S.W.; Fan, C. Challenges of water quality management for agricultural development. Water 2023, 15, 1816. [Google Scholar] [CrossRef]
Figure 1. Ammonia nitrogen single-closed-loop control system.
Figure 1. Ammonia nitrogen single-closed-loop control system.
Jmse 11 01109 g001
Figure 2. Ammonia nitrogen closed-loop control system with disturbance.
Figure 2. Ammonia nitrogen closed-loop control system with disturbance.
Jmse 11 01109 g002
Figure 3. The membership function of NH3 [20].
Figure 3. The membership function of NH3 [20].
Jmse 11 01109 g003
Figure 4. The membership function of d(NH3)/dt [20].
Figure 4. The membership function of d(NH3)/dt [20].
Jmse 11 01109 g004
Figure 5. The membership function of CW [20].
Figure 5. The membership function of CW [20].
Jmse 11 01109 g005
Figure 6. Fuzzy inference [20].
Figure 6. Fuzzy inference [20].
Jmse 11 01109 g006
Figure 7. The appearance and dimensions of the ammonia nitrogen (NH4+) sensor used in this study.
Figure 7. The appearance and dimensions of the ammonia nitrogen (NH4+) sensor used in this study.
Jmse 11 01109 g007
Figure 8. The appearance and size of the ammonia nitrogen (NH4+) controller used in this study.
Figure 8. The appearance and size of the ammonia nitrogen (NH4+) controller used in this study.
Jmse 11 01109 g008
Figure 9. RS485, Raspberry Pi, SSD (125 G), and 4-gate relay.
Figure 9. RS485, Raspberry Pi, SSD (125 G), and 4-gate relay.
Jmse 11 01109 g009
Figure 10. Connection diagram of this experiment.
Figure 10. Connection diagram of this experiment.
Jmse 11 01109 g010
Figure 11. Flow chart of controller program.
Figure 11. Flow chart of controller program.
Jmse 11 01109 g011
Figure 12. The relationship between NH3, d(NH3)/dt, and the number of pipes utilized. The initial concentration of NH3 = 1.89 ppm, and the flow rate is 40.0 mL/s.
Figure 12. The relationship between NH3, d(NH3)/dt, and the number of pipes utilized. The initial concentration of NH3 = 1.89 ppm, and the flow rate is 40.0 mL/s.
Jmse 11 01109 g012
Figure 13. The relationship between NH3, d(NH3)/dt, and the number of pipes utilized under conditions of randomly disturbing the NH3 concentration.
Figure 13. The relationship between NH3, d(NH3)/dt, and the number of pipes utilized under conditions of randomly disturbing the NH3 concentration.
Jmse 11 01109 g013
Figure 14. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 20 L water tank.
Figure 14. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 20 L water tank.
Jmse 11 01109 g014
Figure 15. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 40 L water tank.
Figure 15. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 40 L water tank.
Jmse 11 01109 g015
Figure 16. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 60 L water tank.
Figure 16. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 60 L water tank.
Jmse 11 01109 g016
Figure 17. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 80 L water tank.
Figure 17. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 80 L water tank.
Jmse 11 01109 g017
Figure 18. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 100 L water tank.
Figure 18. The chart of removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 100 L water tank.
Jmse 11 01109 g018
Figure 19. The relationship between the capacity of the water tank and the time required to remove NH3.
Figure 19. The relationship between the capacity of the water tank and the time required to remove NH3.
Jmse 11 01109 g019
Figure 20. The relationship between different data acquisition intervals and the NH3 cleaning time.
Figure 20. The relationship between different data acquisition intervals and the NH3 cleaning time.
Jmse 11 01109 g020
Figure 21. The chart of FLC-aided removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 20 L water tank with the maximum aquaculture density for the simulated random excretion of a school of groupers.
Figure 21. The chart of FLC-aided removal time, NH3, d(NH3)/dt, and the number of pipes utilized for the 20 L water tank with the maximum aquaculture density for the simulated random excretion of a school of groupers.
Jmse 11 01109 g021
Figure 22. The relationship between the number of feeding times per day, the power savings, and the water savings.
Figure 22. The relationship between the number of feeding times per day, the power savings, and the water savings.
Jmse 11 01109 g022
Table 1. The contents of the rules.
Table 1. The contents of the rules.
CWNH3
LowMedHigh
d(NH3)/dtdownP0P1P2
noP1P2P3
upP2P3P4
Table 2. Specification of parts in this experiment.
Table 2. Specification of parts in this experiment.
ItemNameModelMain SpecificationsMakerFunction
1Raspberry Pi 4Raspberry Pi 4
Model B
ARM v8, 64-bit SoC @ 1.5 GHz, 2 GB, 4 GB LPDDR4-3200 SDRAM, full-throughput gigabit ethernet, dual-band 802.11 ac wireless networking, Bluetooth 5.0, BLE, 2 × USB 3.0 ports, 2 × USB 2.0 ports, and 2 × micro-HDMI portsRaspberry Pi FoundationController
2Ammonia Sensor setN18Smart
NH3/NH4+
Sensor—range: 0~20,000 mg/L, temp. range: 0~80 °C, pressure: 0~3 bar, Pt1000ATC, PPT main liquid, liquid connector: PTFE.Sensor controller—measuring range: 014~14,000 ppm, Compensation range,
refresh time: 2 min
−10.0~130.0 °C, resolution: 0.1 degrees C, measurement accuracy: ±0.2 °C, current signal output.
Signal output: 4~20 mA, current accuracy: ±0.05 mA
REMOND AOTODetect the concentration of NH3
3Relay set4-way/5 V5 mA is needed to drive the relay, 10 A to pull iniCshopSwitch the solenoid valve
4SSDmsata-128 G128 GB, mSATA, Dimensions: 50 × 30 × 3 mm, Read speed: 455 MB/s, Write speed: 407 MB/sKingstoneData storage
5Solenoid ValveZero pressure/NC A05 12 VWorking pressure: 0~0.006 MPa
Working voltage: 12 V
Water pressure: 0~0.06 kg
YISHEN
ELECTRICS
Switch valve
6Pipe1/2 inchPVC, pressure 450 psiNAN TA Plastics CorporationTranspose the water
7TankKT-24LH 235 mm, UID: 406 × 285 mm,
UOD: 460 × 340 mm, LOD: 390 × 270 mm
Tianying PlasticExperiment plant
Table 3. Different sensor data acquisition intervals and the NH3 cleaning time.
Table 3. Different sensor data acquisition intervals and the NH3 cleaning time.
No.Data Collection
Interval
Cleaning TimeTotal Time (s)
12 min1 h48 min11 s6491
24 min1 h39 min37 s5977
36 min1 h26 min39 s5199
48 min0 h48 min47 s2927
Table 4. The comparison of power and water consumption between FLC and pump.
Table 4. The comparison of power and water consumption between FLC and pump.
FLCPump
Power
Consumption
10.6W/day216.0W/day
FLC: Pump Ratio = 4.9%
Power Savings = 95.1%
Water
Consumption
211.2L/day4800.0L/day
FLC: Pump Ratio = 4.4%
Water Savings = 95.6%
Table 5. The relationship between feeding times, power savings, and water savings.
Table 5. The relationship between feeding times, power savings, and water savings.
Feeding Times/DayPower SavingsWater Savings
195.10%95.60%
290.20%91.20%
480.40%82.40%
670.70%73.60%
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

Li, H.-C.; Yu, K.-W.; Lien, C.-H.; Lin, C.; Yu, C.-R.; Vaidyanathan, S. Improving Aquaculture Water Quality Using Dual-Input Fuzzy Logic Control for Ammonia Nitrogen Management. J. Mar. Sci. Eng. 2023, 11, 1109. https://doi.org/10.3390/jmse11061109

AMA Style

Li H-C, Yu K-W, Lien C-H, Lin C, Yu C-R, Vaidyanathan S. Improving Aquaculture Water Quality Using Dual-Input Fuzzy Logic Control for Ammonia Nitrogen Management. Journal of Marine Science and Engineering. 2023; 11(6):1109. https://doi.org/10.3390/jmse11061109

Chicago/Turabian Style

Li, Hung-Chih, Ker-Wei Yu, Chang-Hua Lien, Chitsan Lin, Cheng-Ruei Yu, and Sundarapandian Vaidyanathan. 2023. "Improving Aquaculture Water Quality Using Dual-Input Fuzzy Logic Control for Ammonia Nitrogen Management" Journal of Marine Science and Engineering 11, no. 6: 1109. https://doi.org/10.3390/jmse11061109

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