## 3 Proposed Model
### Phase 2  
Fuzzy logic can be used to predict chlorine levels in the water. Fuzzy rules describe the relationship between input variables (e.g., temperature, pH, etc.) and the output variable (chlorine level). These rules can be combined to form a fuzzy inference system, making predictions based on input data. The accuracy of the predictions depends on the quality of the fuzzy rules and the accuracy of the input data. It is important to validate the fuzzy inference system using data to ensure accuracy.  
In phase two, fuzzy rules are employed to calculate the amount of chlorine in the drinking water. If the range of chlorine content is less, another beach is required; if the scope of the chlorine value is moderate or less, another beach is not required to be added. Further, through a fuzzy algorithm, the determined chlorine range sends the signal to the solenoid valve. The solenoid valve is an electromechanical component that opens up the beach or chlorine in the water tank, as mentioned in Figure 2. Further, flow meters are used  
Figure 1: Proposed water quality analysis framework.  
to calculate the volume of chlorine, measured in liters, that has to be decomposed in the storage tank. A solenoid valve is used to make the connection to the flow sensor.  
The decision tree algorithm is an intuitive and interpretable method for making predictions. It can also handle missing data and is not sensitive to outliers. However, it can become complex and overfit the data if fewer branches and input variables exist. To address this issue, decision trees can be pruned by removing branches that do not significantly improve the accuracy of the predictions. The pruning process helps reduce the model's complexity and improve its accuracy. The decision tree algorithm is a popular choice for chlorine level assessment and prediction in water monitoring systems due to its ease of use and ability to handle complex data. However, it is important to validate the model's performance using appropriate metrics to ensure that the predictions are accurate.  
The chlorine level is predicted based on two input variables: temperature and chlorine values. Similarly, chlorine sensors measure the amount of chlorine dissolved in the water in the buffer. Since multiple sensors are involved in measuring different values for a particular time interval, it leads to fuzzy rules. The workflow diagram for predicting chlorine levels using fuzzy rules is shown in Figure 3.  
The initial step is fuzzification, which converts the measured chlorine level value from the sensor as input and converts it to linguistic variables of fuzzy sets, which consists of 5 tuples as Very High, High, Medium, Low, and Very Low. Fuzzy rules are formed and evaluated by Fuzzy Associative Mapping (FAM), which is illustrated in Table 1.  
In the system model, we take temperature and chlorine as two input variables and map them into a matrix format in two-dimensional matrix form, which is shown in Table 2. Chlorine is represented column-wise, and temperature is represented row-wise. Fuzzy Associative Mapping reduces the rate of false negatives during the prediction phase.  
Figure 3: Prediction of chlorine level using fuzzy rules.  
Figure 2: Proposed chlorine content assessment and recommendation in drinking water using ML.