## 2 Electro-Membrane Technologies: Current Status and Challenges
### Alternative A4--Chemicals towards Self-Supply and Salinity Gradient Energy Harvesting  
In alternative A4 (Figure 6), both chemicals towards self-supply and salinity gradient energy are recovered from brines by means of EDBM and RED, respectively. Thus, the advantages obtained in alternatives A1 and A2 are achieved simultaneously, and at the same time, the disadvantages of these alternatives are partially avoided, as the two main inputs to the SWRO considered (chemicals and energy) are produced in-situ. Figure 5: Alternative A3 flow chart. Since it is estimated that with percentages lower than 2% of the produced brine, enough acid and base would be obtained to achieve self-supply, there is an opportunity to consider another brine management process such as the SGE harvesting by means of RED. Thus, the brine stream would be split between the EDBM and the RED stages. However, if a greater amount of brine is allocated to the EDBM process, the overproduction of acid and base could be stored for future needs or used in other activities. Although RED harvest energy from brines, at the current state of the art of the technology, an additional supply for the SWRO and EDBM processes should be considered. Commonly the grid mix is used as a power supply; however, the potential benefits of the integration of RE such as solar PV have been presented throughout this paper. Alternative A5--Chemicals towards Self-Supply, pH Gradient Energy and Salinity Gradient Energy Harvesting  
The production of acids and bases through EDBM and their subsequent use of the surplus production in energy recovery by means of R-EDBM, as well as energy recovery through RED, are considered in alternative A5 (Figure 7). In this way, the brine is divided between the EDBM and the RED processes so that enough brine is conducted to the EDBM to produce the chemicals required in the SWRO facility and a surplus if peaks of solar PV energy allow. Thereby, the largest fraction could be employed in RED. Indeed, in the case that the EDBM and the RED do not have enough capacity, the remaining brine volume would be directly disposed of. In this way, alternative A5 improves alternative A4 in two points: (i) RE peaks are used for acidic and alkaline solution productions in order to charge Acid-Base Flow Batteries for further pH gradient energy recovery, and (ii) R-EDBM is employed, which present higher power densities than RED although being in a lower TRL. Thus, it seems that alternative A5 presents the greater potential recovery of chemicals and energy from both pH and salinity gradient. Figure 6: Alternative A4 flow chart. Benefits and Challenges of the Proposed Alternatives for Electro-Membrane Technologies Integration for Brine Management in SWRO Facilities  
The alternatives presented in the previous section have certain advantages mainly related to the environmental impact reduction of SWRO; however, there are also disadvantages that must be taken into account before selecting which alternative is the most favorable for a specific desalination plant. Comparison between the alternatives A0 to A5 attending to different criteria will be carried out in this section. In this sense, environmental benefits can be obtained in terms of waste management, but also in terms of the consumption of externally produced chemicals that require transport (and therefore emissions related to this) to the plant. HCl and NaOH are consumed in highly variable amounts. For example, an SWRO plant located in the Mediterranean area requires 0.2-0.5 g\(\cdot\)m\({}^{-3}\) of freshwater of HCl and 30-60 g\(\cdot\)m\({}^{-3}\) of freshwater of NaOH [33]. In the authors' previous works, the potential environmental benefits of the in-situ production of HCl and NaOH from brines for the self-supply of desalination plants have been reported, especially when solar PV energy is employed [33; 65; 66].