Fuzzy Control of Water Level and Temperature in Fish Eggs Breeding Tank with Different Sensor Inputs

In this paper fuzzy logic principles are used to control the level and temperature of water in fish eggs breading tank. The control task aims to keep the water level and the water temperature in a tank within certain ranges, the temperature due to Newton’s law of cooling would drop down, and to keep it within limits, hot water is added, and cold water is drained. Sensors for temperature and level are used to give fuzzy input to the fuzzy controller which outputs the amount of opening in the two control valves. KeywordsFuzzy Control, Control valve, temperature control, level control.


INTRODUCTION
In nonlinear processes or processes that require fast responses which cannot be achieved using analytical or classical mathematical models, artificial intelligence applications become a good option to consider. Fuzzy control applications are wide spread in engineering [1] [2]. They came to the scene in the 1990s and kept growing and pushing for their place in the control field until they became typical choice in house hold appliances, electrical grid calculations and simulation, automation and industrial instrumentation. In this paper we are presenting a fuzzy control approach to control the level and temperature of water in a tank that is used for fish eggs breading. In the introduction part the physical system requirements and specifications are presented, the second section gives the description of the fuzzy system and it is details, it is followed by an examples and results section and finally we conclude this paper.
A schematic graph of the tank and the valves is shown in figure 1; the requirements are the following; • To keep the temperature of the water between 50 o C and 63 o C degrees. • The amount of water in the tank should be kept between 500 and 600 liters • The water is cooling according to Newton's law for cooling (equation 1) • The water is heated by adding hot water at 90 o C degrees.
• To keep the water level within limits, a drain valve is used to drain out water from the tank The solution for the equation is: Where: The water in the tank would cool down according to equation 2, and to keep it within the range of accepted temperature; hot water at 90 o C is added through valve number one, and to keep water level at accepted values water is drained through valve number two.

CONTROL VALVES
Process plants consist of hundreds, or even thousands, of control loops all networked together to produce the final product. Each of these control loops is designed to keep some important process variable such as pressure, flow, level, temperature, etc. within a required operating range to ensure the quality of the end product.
The most common final control element in the process control industries is the control valve. The control valve shown in figure 2 manipulates a flowing fluid, such as gas, steam, water, or chemical compounds, to compensate for the load disturbance and keep the regulated process variable as close as possible to the desired set point.

Fi. 2. Control valve
One important part of the control valve assembly is the positioner of the control valve shown in figure 3, the positioner gives feedback to the controller and allow for precise positioning accuracy and faster response to process upsets when used with a conventional digital control system. They practically tell the controller what is the valves condition at a certain moment in percentage of the valves.

Inputs
Each input take 5 membership functions as shown in figures 5 and 6. The temperature is defined to be very low, low, optimal, high and very high, same goes for amount; it has the five membership functions very low, low, optimal, high and very high.

Outputs
The outputs which refer to the amount of valve opening in percentages are given for both valves as follows:

Fuzzy rules
Since we have 5 inputs for both temperature and amount, and there are 5 outputs for each valve, that gives us a total of 25 IF -THEN rules for each output. To save space i will list only two examples for each output and the rest of rules are summarized in the two FAM tables shown in tables 1 and 2.   Table 2 Fuzzy associative memory for drain valve

Inference and defuzzification
The two popular inference systems that are used for translating the fuzzy information to the output are the Mamdani and Sugeno inferences, others might be applied too. Mamdani translates the IF-THEN by min-max operation. where the minimum of the inputs fuzzy set and the systems fuzzy set is taken, then the maximum of the minima is taken for the next stage as shown in figure 9.

EXAMPLES
In this section we show two examples in details on how the system work and the general surface solution, the first example assumes a discrete input, while the second example assumes a fuzzy input.

Discrete
Assume the input to the system is given in discrete values of 52 o C for temperature and 535 L of water. If we look at system membership functions, we see that the temperature is in the membership functions V. low and Low, and for the amount of water it falls in the Low and Optimum values for water amount as in figures 11 and 12.
The two intersection points for the temperature would be at 0.4 of Very Low temperature and approximately 0.62 of Low, while the input for the amount of water is shown in figure 12. The intersection points are at 0.4 for Optimum and 0.6 for Low. Fig. 11. Temperature input Fig, 12. Amount input Now we take a look at our FAM tables; for Valve 1: when temperature is v.low, and amount is among v.low, low and optimum then V1 is open, so: We take the maximum of (min (0.4 , 0), min (0.4, 0.6), min (0.4, 0.4)) and we get V1 open with 0.4 When temperature is low, and amount is among v.low, low then we have V1 to open, and in case amount is Optimum the V1 is Almost Open, in numbers: Maximum of (min (0.62 , 0), min (0.62, 0.6)) gives 0.6 to be open and max(min (0.6, 0.4)) gives 0.4 for V1 to be Almost Open This is shown in figure 13.   Fig. 13. the inference results for V1 given the discrete inputs To get the result for Valve one, we use the centroid defuzzification on the found result in figure 13, and it gives a value of 86.1% that is, valve number 1 needs to be open with 86.1% which makes since, since we have low temperature and we need to increase the temperature of water, hence valve 1 need to be opened.

Fig. 14. Fuzzy temperature input
Applying the same procedure for valve 2, the defuzzification gives a value of 62.4%, that is valve 2 needs to be opened by 62.4%, this is because we need to reduce the amount of cold water and at the same time we need to keep the water level within the needed ranges. From these results we see that valve 1 is adding hot water, and valve 2 is removing some of the cold water and keeping the water level within limits.

Fuzzy Example
In the previous example we assumed the sensors inputs were crisp or discrete values, however, in many applications we can have the inputs to be fuzzy sets, in this example we assume fuzzy sets for both inputs as follows; temperature is given as in figure 14 while amount fuzzy input is given in figure 15. The applied inference approach is the same as in crisp input case, Mamdani with min -max operation. The minimum operation between the input temperature and Very low membership function gives what is shown in figure 16. We see the minimum of Very low amount with fuzzy amount input in figure 17.
The maximum of the minimum of the two gives the Mamdani inference result for the IF-THEN rule (if temperature is very low and amount is very low then V1 is Open), so with max operator between the minimum of the fuzzy sets in figures 16 and 17, we get V1 open as a fuzzy set as in figure 18, the same figure shows the inference result of one rule out of the 25 rules in the FAM for valve 1, the same steps are repeated for all the rules with given fuzzy input and then the output is aggregated, given our input, the aggregated output for valve 1 is shown in figure 19.  These values are in accordance with the FAM tables, and they make sense. Both inputs are near the very low region, we need to add hot water and reduce the amount of cold water; hence valve 1 is opened with 97% and valve 2 with 60%.
In this system we considered two inputs and two outputs, a solution surface can be drawn for each output with given input ranges, and such surface is shown in figures 21 and 22.

CONCLUSIONS
In this paper a fuzzy control approach for the control of temperature and water level in fish eggs breeding tank is presented, the fuzzy logic control used Mamdani inference system and centroid defuzzification.
Two examples one with crisp input and one with fuzzy input were presented to show if system work's. The fuzzy control approach based on the given FAM tables works in a good way and the surface for outputs solution were presented. Fig. 19. Aggregated fuzzy output for valve 1, waiting to calculate it is crisp output via centroid defuzzification This fuzzy logic control approach is doing it is job very well, for further investigations and research many aspects could be considered such as: the shape of membership functions, FAM tables, the existence of sensors, if the system would be based only on time and flow rate inside the valves and the inference and defuzzification approaches can be investigated and compared.

CODE
All programming and codes were implemented in MATLAB and provided in a separate file that is attached to this paper.