## Materials and Methods
### Description of Sant Joan Despi DWTP  
Since its inception in 1955, the DWTP of Sant Joan Despi (Barcelona, Spain) has aimed to purify the surface waters captured from the Llobregat River and groundwater from the delta aquifer of the river, today supplying drinking water to more than half of the inhabitants (1,900,000) of the city of Barcelona, as well as the southwest conurbation.  
Figure 2: General architecture of the simulation system for tank chlorination.  
The DWTP in Sant Joan Despi incorporates the latest technology in drinking water treatment. The schematic of the plant is shown in Figure 3. Since the water is captured in the Llobregat river, the following processes are applied: surface water capture and desanding; peroxidation; pumping water to the decantation tanks (tag 5 in Figure 3); filtration by sand; pumping by means of four Archimedes screws, wherein the water is raised so that it can follow the process by its own gravity; ozonation; filtration by activated carbon filters; and reverse osmosis, to finally arrive at the mixing and chlorination chambers (tags 13, 14 in Figure 3). In these chambers, the water from the two treatment lines is mixed and chlorination takes place, which ensures the removal of almost all the ammonium content remaining in the water. The study of this paper concentrated mainly on these tanks. Finally, two pumping stations inject water to the distribution network at different levels to be supplied.  
The DWTP has a series of processes prior to chlorination in the effluent that favor, to a greater or lesser extent, the elimination of organic matter of natural source and those derived from human activities.  
One of the last processes of the plant is chlorination, before driving the treated water to the tanks distributed throughout the city of Barcelona. In [11], there is a good explanation of how the Barcelona water network is implemented, not only physically, but also with an extensive set of sensors to obtain chlorine concentration at the storage tanks distributed along the city, with a total amount of 200 sensors for a distribution network of 4600 km. These tanks, close to the final destination of drinking water (domestic homes), have sensors that measure the lack of chlorine during its transportation from the DWTP to the storage tanks, and a last rechlorination is done to ensure a concentration in the range of 0.8 to 1 ppm when reaching the taps.  
To better understand the power of the DWTP, Table 1 contains a set of parameters of water taken at different points in the plant, specifically, the sampling points located: (i) at the entrance of the plant, the intake; (ii) at the entrance of the mixing chamber in the chlorination tanks; and (iii) at the output of chlorination tanks when the drinking water is ready to be transported and distributed through the water network. The chlorination process was performed appropriately because the ammonium concentration dropped to 0 ppm. This is one of the most critical parameters to control to avoid, and the rest of parameters were expected to have those values after all the processes involved in the plant.  
In the following sections, the chlorine disinfection strategy in both tanks of the plant is described. Before the process was carried out automatically by the control and instrumentation electronics and the supervision system, we performed the process manually. The facilities and equipment that compose the chlorine regulation system are detailed as well. It should be borne in mind, however, that the validation step described in this article was carried out in the first tank (tank 1) where the ammonium  
Figure 3: Drinking water treatment plant (DWTP) at Sant Joan Despi schematic.  
appears and can be detected. The same process would be totally valid when applied to the second tank (tank 2).