# Smart Low-Cost Control System for Fish Farm Facilities
## 5 Smart Control Algorithm for Aquaculture
### Included Algorithms in the Complete System
#### 5.1.4 Data Management and Smart Control Algorithm  
Finally, the smart control algorithm is described in this subsection. This algorithm runs between the DB and the AI. The data in the DB come from three sources:  
* The sensor-gathered data contain information on the value of the different monitored factors such as water temperature, swimming depth, and feed falling, among others. This can be considered the primary source of information.
* The actuator data indicate the operation modes of different actuators in the fish farm facilities. They might indicate the periods in which actuators were deactivatedor activated. Since some actuators might operate at different velocities or ratios, data include the value in those cases. The schedule of feeders or photoperiod of lights is another type of information. Finally, the activation of the alarm is important information for the system. This can be considered the second information source, which is particularly important in the case of RAS facilities.
* The remote sensing data offer reliable information on water quality in areas beyond the fish farm facilities. This information is only useful in marine cages and can be essential for pollution monitoring. It is the third information source.  
All the data are collected in the Management System of the DB; the data management algorithm defines the data processing and data fusion, if necessary. In the AI, the data for the DB are combined with existing knowledge about fish behavior, systems sustainability, the effect of the presence of predators and pollutions, and water and weather conditions. With all these data, a decision is made based on the use of different AI tools.  
Then, the machine learning mechanism stores the decisions taken by the system for future events. The decision of the system can suppose the activation of the alarm system, the prediction system, or the control system. In the two first systems, the decision can be linked to the different domains. For example, the alarm due to maintenance needs or a failure in a sensor which is linked to the Control Domain, the alarm due to water pollution from the Abiotic Domain, the alarm due to stress or mortality episode from the Species Biotic Domain, and the alarm due to biofouling or predators form the External Biotic Domain. In case of these alarms, the system needs to save all previous information and analyze it in order to find the causes. Reinforced and deep learning can provide valuable tools for learning from these cases and avoiding similar scenarios in the future by generating early warning alarms. The same situation is found in prediction systems with predictions on the failure of actuators, abnormal swimming detected, low DO, or high phytoplankton. These situations will require actions in order to prevent an alarm. Finally, the control system decisions aim to activate or deactivate actuators to prevent alarm situations, for example, activating the aerator if a tank is isolated from the water reconditioning system since the DO will decrease in the tank. Moreover, this system is responsible for regularly operating daily activities, such as adjusting the feeder dose and fed velocity, given the current factors. Another example is to activate the alarm if an abnormal situation is detected. Thus, the three systems are closely related.  
A summary of the whole smart control algorithm is presented in Figure 15.