# Smart Low-Cost Control System for Fish Farm Facilities
## 5 Smart Control Algorithm for Aquaculture
### Example 1: Control Algorithm Operation in Sea Cages  
As mentioned above, in sea cages, the most relevant use of these algorithms is related to the feeding process. Concerning the feeder control, a series of water quality parameters need to be evaluated. First, the parameters that affect the feed demand are linked to fish metabolic requirements and are mainly affected by water temperature. If low temperatures are detected, the total amount of feed, according to the models based on formulas (1) and (2), is decreased by a factor. Then, the system checks if water quality might affect the fish foraging behavior, altering feed consumption over time. If abnormal values are detected in water quality (such as high water turbidity), the speed of feeders is reduced to allow fish to eat the feed. Given the environmental parameters, the system starts feeding at the maximum allowed speed and keeps feeding at the same velocity until the feed falling trespasses an established value. Then, the system assumes that fewer fish are eating, and the feed velocity must be reduced. This continuous checking of feed falling is performed until the calculated amount of feed has been provided. This algorithm is connected with AI, as shown in Figure 16. The models, thresholds, and coefficients used, as well as the water quality parameters to be considered, will be modified by the deep learning parts of the system. In Figures 17 and 18, we can see the feeding process of two stations, one with connectivity with the DB and AI engine, Figure 17a,b, and an example with no connectivity, Figure 18a,b. In the first example, the AI evaluated the water and fish conditions to define the feed dose, and considering the high value of turbidity and low temperature; the control system decided to reduce the dose by up to 5% and the initial feeder velocity by up to 20%. Once the feed falling sensor detects uneaten pellets, the feeder velocity is adjusted to 40% and 20% the second time that feed falling is detected, reducing by 50% every time. The total uneaten feed represents 3.15% of the total feed, and the fish at in a ratio of 13.82 kg/m\({}^{3}\). \[Feed\ (\text{kg})=Feed\ dose\ \left(\frac{\text{kg}}{\text{kg}}\right)\times Biomass \ (\text{kg}) \tag{1}\]  
\[Biomass\ (\text{kg})=\frac{Mean\ Body\ Weight\ (\text{g})\times(Initial\ fish-(Initial\ Fish\times Mortality))}{1000} \tag{2}\]  
Figure 15: General control algorithm. It is the algorithm that summarizes the processes conducted between the database and the artificial intelligence engine. This algorithm is in charge of conducting the most appropriate decisions in the fish farm facilities to ensure the sustainability of the fish farm, the fish performance, and fish well-being. Figure 16: Smart algorithm for feeder controller subsystem. This algorithm represents the initial algorithm provided to the deep learning system, which will evolve based on sensed data and the output values of other decision-making algorithms. Figure 17: Feed falling in Scenario 1 with connection with the Smart Control System. (**a**) Represents the remaining feed and the feeder velocity, and (**b**) illustrates the uneaten feed and feed falling detection. When feed falling is detected, the feeder velocity is reduced from 80% to 40%, and then to 20%. In the case that no actualization of feeding parameters is given from the DB, the actuator node, according to the fault tolerance algorithm, applies the predefined control algorithm and feeds the cage with the parameters of the last shot. No reduction due to turbidity and temperature is applied, 15 kg/m\({}^{3}\) is applied as the feed dose, and the feeder is started with an initial feeder velocity of 100%. The reduction in the feeder velocity is applied by reducing by 20% every time that uneaten feed is detected. This situation leads to an inefficient feeding process, with 12.13% of the feed left uneaten. The fish consumed feed in a ratio of 13.18 kg/m\({}^{3}\).