Skip to Content
ProcessesProcesses
  • Article
  • Open Access

22 November 2025

25 Pages

A Data-Driven Approach for Integrated Design and Dynamic Optimization Under Water Demand Uncertainty of Renewable Electrodialysis Systems

,
,
and
1
Department of Mechanical Engineering, Aristotle University of Thessaloniki, 54124 Thessaloniki, Greece
2
Chemical Process and Energy Resources Institute (CPERI), Centre for Research and Technology Hellas (CERTH), Thermi, 57001 Thessaloniki, Greece
*
Author to whom correspondence should be addressed.

Abstract

This work proposes a modeling framework based on artificial neural networks (ANN) for the integrated design and dynamic optimization of renewable electrodialysis (ED) systems considering water demand uncertainty, using a first-principles ED model as the data source for the development of the ANN. The optimization goal is to identify the optimal photovoltaic (PV) and battery (BAT) capacities and the optimal time-varying ED voltage and flow profiles during the batch process, considering an uncertain distribution of potential water demand for each batch over an annual operating horizon. This is achieved by minimizing the annual capital and operating costs of the renewable ED-PV-BAT system. The ANN model demonstrated excellent predictive capabilities that closely matched the data generated by the ED model, with ± 3.5–9.6% and ± 2.0–4.8% error margins in the prediction intervals at a 95% confidence level. The optimal design resulting from dynamic optimization exhibited a lower cost than the design attained from the steady-state optimization, as the batch time and energy consumption were 50% and 17% lower, respectively. For this design, the energy consumption and nitrate concentration predicted by the ANN were only 0.31% and 1.2% different from the ED model predictions, without any effects on the predicted costs and batch times.

1. Introduction

Electrodialysis (ED) is a widely recognized process for the removal and recovery of ions from dilute aqueous streams. It is based on the application of an electric field in a stack of alternating anion- and cation-selective membranes to separate ions with different charges. ED offers advantages over other membrane technologies such as membrane distillation (MD) or nanofiltration (NF), which are used for the purification of aqueous streams. For example, it is not as energy intensive as MD, which demands about 10 times more energy than ED when treating the same feed [1]. Unlike NF, ED does not require high operating pressures and is therefore less susceptible to pressure-driven fouling and high water use in complex wastewaters [2]. ED has been shown to be up to 35% less energy intensive than reverse osmosis (RO) at low salinities (<4000 μS/cm), e.g., in applications for brackish water desalination, [3] or dissolved solids removal [4]. A major advantage of ED is that it can be combined with renewable electricity and storage systems, making it a promising alternative for water purification in rural or remote areas with limited connection to the electricity grid. The design and operation of such systems is challenging, as the intermittency of renewable electricity, the uncertainty of water demand, and the purity specifications of the water outlet must be considered simultaneously, especially when potable water is required.
To date, work has been carried out on the design and technoeconomic evaluation of ED systems in conjunction with photovoltaics (PV) and storage systems such as batteries or water tanks [4]. Some of these papers evaluated experimental setups [5,6] with the aim of identifying trade-offs between parameters such as PV voltage, current, and equipment size, considering the variability of renewable energy and its impact on system efficiency. Several model-based works have also used dynamic ED models, where systems with fixed design characteristics were considered [7], or varying sizing and operating parameters to meet different demands [8], taking into account different profiles of solar irradiance [9]. Optimization-based work has also been reported, where both the size and operating parameters have been varied [10,11], or where electrodialysis reversal networks have been developed through advanced superstructure representations [12]. Finally, significant work has been reported, in which optimization-based scheduling has been performed by considering typical daily water demand profiles [13] or in which simultaneous sizing and flexible scheduling has been implemented by identifying the optimal On/Off profiles of renewable ED systems [14]. In these works, when the simulations included the use of different voltage and flow values (or these were considered as variables during optimization), these two parameters remained fixed during the ED batch in each simulated scenario.
There are prior works that acknowledged the fact that the dynamic variation in ED voltage and flow can significantly improve the system efficiency by adapting the system operation to internal or external variations. Such works have reported the dynamic optimization of ED processes, where temporal variations in inputs, system states, and constraints can be captured [15,16,17]. These authors developed a reduced-order model of an ED system, using the orthogonal collocation on finite elements technique, with the aim of minimizing ED process time, energy consumption, and cost and maximizing separation efficiency, while varying the voltage and flow rate. These works optimized the ED operation for a fixed system size, while the effects of intermittence coming from renewable energy sources or changes in demand were not considered.
He et al. [18] developed a time-varying operation approach for an ED reversal system (EDR), in which the flow rate and the EDR stack voltage were adaptively controlled, depending on the solar energy availability. This aimed to match the power requirements of the desalination with the available solar energy. It was observed that an EDR stack of reduced size, power supply requirements, and cost is possible compared to static EDR operation. The work provided experimental evidence for a system with fixed design characteristics and was further extended [19] to the pilot demonstration of a control algorithm that was specifically developed to maximize the desalination rate and renewable energy use, while both battery and water storage are considered. This approach enabled 91% increase in solar energy utilization and 92% reduction in battery reliance. Easley [20] and Easley et al. [21] further presented a novel time-varying operation approach for continuous PV-EDR, in which the flow rate and the EDR stack voltage were varied based on the available solar irradiance, so that the desalination power output throughout the day matched the available solar energy. Finally, Connors [22] developed a control approach, in which a model predictive controller prescribes high-level power control actions to exploit future predictions of solar irradiance obtained through a machine learning approach. In addition, a lower-level controller was used to determine the optimal voltage and flow rate of the ED, considering the power available from renewables. This control strategy dynamically adjusted the voltage every second and the flow rate every three seconds, which matched the speed of the empirically determined system dynamics. During control, system-level operation decisions were made, while after optimization, a sensitivity analysis was performed to determine new optimal solutions for different water consumption and reliability scenarios.
Such works indicated that the simultaneous design and dynamic optimization of ED systems is important, especially in the context of also identifying optimal planning strategies for the entire renewable ED process system. Predicting the solar irradiance was, in one case [22], also performed using machine learning (ML) models, whereas the different water demands were only considered either in cases of post-sensitivity analysis or as fixed, daily water profiles. On the one hand, water demand is subject to uncertainties, as it is not possible to predict it correctly based on historical data (e.g., water consumption for agricultural purposes may vary due to intense weather variations or water consumption in urban areas may vary due to a rapid increase or decrease in population, e.g., seasonally, due to tourism, or permanently, etc.). This uncertainty needs to be considered simultaneously with the design and dynamic optimization of renewable ED systems, because the resulting designs are more robust and less susceptible to demand changes that were not accounted for during system design. However, this is computationally challenging. For this reason, Rohman and Aziz [15] and Latinis et al. [17] have developed reduced-order modeling approaches to overcome such challenges. When uncertainty also needs to be considered as part of a renewable ED system design over a long operating period (e.g., yearly), the computational complexity is further amplified.
ML models like artificial neural networks (ANN) can be used as a promising alternative to the computationally intensive first-principle ED models, particularly because the solutions can be determined quickly and accurately, given the wide range of design variables in both equipment capacity and conditions in the temporal dimension. ANN have demonstrated superior performance over traditional models in various applications, often with faster processing times and higher accuracy [23]. ANN are widely used as predictive tools in the fields of pattern recognition, forecasting, classification, and process control [24,25,26]. ANN have also been used in desalination applications. For example, Ansong et al. [27] used a convolutional neural network–long short-term memory (CNN-LSTM) model to forecast solar irradiance from images in a directly coupled PV-powered membrane desalination system. Migaybil and Gopulani [28] used ANN to model water productivity in solar still systems. The authors tested various hidden layer sizes and numbers and evaluated training and validation losses against the number of epochs, among strategies used to ensure efficient training and avoidance of overfitting. Chitgar et al. [29] proposed an ANN modeling approach for the optimization of multi-carrier energy systems for electricity, desalinated water, and hydrogen production. The authors highlighted the need to incorporate uncertainty in the calculations. Zegait et al. [30] employed an ANN model for a RO desalination system in order to efficiently predict the seasonal feed fluctuations of an arid environment, achieving superior predictive accuracy compared to multiple linear regression, support vector regression, random forest, and polynomial regression. The authors note that a 7 neuron architecture required higher training time than the other models used, but the accuracy improved significantly. Wang et al. [31] optimized the performance of RO desalination, using a resource surface methodology (RSM) and an ANN model. The results highlighted the superiority of ANN in terms of accuracy. Najafi et al. [32] applied a Monte Carlo real options framework to PV-RO desalination, evaluating the flexibility of the investment cost under solar and electricity price uncertainty. Kanal et al. [33] combined a long–short term memory network with Monte Calro simulations for the optimization of a polygeneration system that produces electricity, heating, cooling, freshwater, and hydrogen. Their results illustrated how the system configuration shifts depending on uncertainty. Sanan et al. [34] used a geospatial AI framework to map solar desalination, integrating solar irradiance, population exposure, and topography to predict spatially variable demand patterns, indicating that desalination is not uniform across regions. Applications of ANN as part of a stochastic optimization methodology have indicated to be up to 500 times faster at execution than conventional approaches [35]. Recently, very few works have reported the coupling of ED with ANN models. Jaegher et al. [36] investigated the membrane fouling of ED membranes with ANN. Sadrzadeh et al. [37] compared a mathematical differential ED model with an ANN for the removal of lead ions at different feed concentrations, temperatures, flow rates, and voltages. The results showed that the ANN was efficient in predicting the non-linear system behavior, indicating a higher correlation coefficient than the mathematical model. In these reports, ANNs were used as a complementary or replacement tool for an ED model to predict system performance. Chindapan et al. [38] used an ANN in an optimization problem. They constructed an ANN coupled with a genetic algorithm to optimize the ED operating conditions for better product quality, minimum energy consumption, lower experimental time, and maximum current efficiency.
The above discussion shows that the integrated design and dynamic optimization of renewable ED systems is important, but the uncertainty of water demand has not yet been considered in this context. ML models like ANN are promising for providing a less computationally intensive but equally accurate model for ED but have not yet been considered for the integrated design and dynamic optimization of renewable ED systems. This work proposes an ANN-based framework for the integrated design and dynamic optimization of renewable ED systems under uncertain water demand, using a first-principles ED model as a source of process data for developing the ANN. The optimization goal is to determine the optimal PV and battery (BAT) capacities and the optimal time-varying ED voltage and flow profiles during the batch operation, considering the distribution of potential water demand in each batch over an annual operating horizon. The performance index includes the minimization of annual capital and operating costs for the renewable ED system. The proposed approach is implemented when using the renewable ED system for the removal of nitrate ions from a polluted aquifer, while meeting drinking water specifications that allow for human consumption. Nitrate contamination of drinking water sources is a significant public health concern, particularly in agricultural regions where excessive fertilizer use contributes to groundwater pollution.

2. Materials and Methods

2.1. System Description

A PV-BAT-ED system is an innovative integration of solar energy harvesting through PV panels with the ion separation technology of ED. The electricity produced goes through a BAT and is then used to power the ED unit. The latter consists of alternating cation exchange membranes (CEM) and anion exchange membranes (AEM), positioned between an anode and a cathode. The applied electric field drives the migration of the ions. Cations in the feed solution move towards the cathode, while anions move towards the anode. This movement occurs through the respective exchange membranes. As the ions migrate, they pass through the membranes, resulting in the accumulation of deionized water in one compartment and concentrated brine in another. The setup of the proposed system is presented in Figure 1.
Figure 1. Conceptual illustration of PV-BAT-ED system: the red circles indicate cations and the green circles indicate anions.

2.2. Artificial Neural Network Theory

A neural network is a computational model inspired by the way biological brains process information. Instead of using a digital model, in which the computations deal with zeros and ones, a neural network works by establishing connections between elements, commonly referred to as ‘neurons’. Each neuron has an associated weight that adapts as learning progresses. Neural networks operate by receiving input data that is processed by multiple layers of neurons. To be able to predict the results, the network should have a large database of previous data to draw from. In each layer, the input is multiplied by the connection weights, adjusted by biases, and passed through an activation function to determine the output. The network learns by adjusting these weights and biases based on the errors between the predicted output and the actual target during training. By adjusting the connections or weights between neurons, a neural network can learn to recognize patterns and relationships in the data. Activation functions in each neuron introduce non-linear transformations that allow for the network to model complex, non-linear relationships that would be impossible with linear models alone. Through an iterative learning process, the network progressively improves its predictions, making neural networks well-suited for a variety of tasks [39].
The inputs of the neural network are labeled a 1 , a 2 … to a n , while the output is represented by O j . A node can receive multiple input signals, which are processed to produce a single output signal. The values w 1 j , w 2 j … to w n j serve as weight factors linked to each input signal received by a specific node. These weights act as adjustable parameters in the network and influence the strength of each input signal. Each input is multiplied by its associated weight, and the node combines these weighted inputs into a summation that is used for further calculations. Initially, the weight values are often assigned randomly following a specific statistical distribution (Figure 2).
Figure 2. Neural network explanation.
Neural networks include many types: each designed for specific tasks. In a feedforward neural network (FNN), data flows in a single direction—from input to output—without loops or cycles. The data enters the input nodes, travels through the hidden layers, and exits through the output nodes. The network has no links, so the information leaving the output node can be sent back into the network. It comprises a single or multiple hidden layers, as well as input and output layers. The layers are made up of neurons, which are connected to the neurons of the next layer. In this process, the input data is passed through each layer, where it is transformed by weights, biases, and activation functions to produce the final output. During training, the network adjusts the weights of the connections to minimize the error, using a method like backpropagation so that accurate predictions or classifications can be made. In a feedforward neural network, the output, y , is computed for each neuron in the output layer by applying the weighted sum of the inputs and adding a bias, followed by an activation function to introduce non-linearity [40].
Each neuron’s output in an FNN ( y ) is calculated as follows:
y = f ∗ ( ∑ i = 1 n w i ∗ a i + b )
where a i is the i -th input, w i is the weight for a i , b is the bias term used to adjust the output independently of the input, and f is an activation function [41].
When training an FNN, the neuron’s weights are adjusted using the minimization of the difference (error) between the actual and predicted outputs as a criterion. Backpropagation and gradient descent are often used to this end. In forward propagation, the outputs are calculated as the input data goes through the ANN. The mean squared error is a typical error function in these cases. In backpropagation, the weights are updated by passing the errors back through the network. The gradient of the loss function is calculated with respect to the individual weights and gradient descent is used to adjust the weights.

2.3. Method Overview

The ANN-based ED model is developed using data from a rigorous, batch ED model that includes differential mass balances around the ED stack and the tanks to calculate the rates of change in concentrations and volumes in the corresponding process sections. The mass balances include terms for ion electro-migration, ion diffusion, and water transport. A model is also included for the electrical circuit that accounts for the stack voltage, the electrode and membrane potentials, the membrane resistances, and the solutions’ resistivity. The simulation includes the solution of the algebraic part of the model to determine the stack current. This is followed by the solution of the system of differential equations to determine the concentrations prior to updating the time step, in order to capture the dynamic evolution of the phenomena.
The ED model is validated with experimental data, whereas additional model details, including the PV and BAT, are presented in Voutetaki et al. [11]. They are therefore not presented here. A large dataset using this model was derived by performing simulations to collect an adequate number of data points. The inputs that were varied included the stack voltage, V s t a c k , s t , the ED recirculation flowrate, Q s t , and the water demand, W D e m s , where s t is the time step index and s is the water demand instance index, for a total of N T time steps within each batch and of N W water demand instances, where s t ∈ 1 , N T and s ∈ 1 , N W . The outputs that were calculated are the concentrations of the diluate stream, C d i l , s t s , and the current density, I c u r r , s t s . The current density was then used to calculate the required energy, as explained below.
The design and optimization method, shown in Figure 3, includes the following stages:
Figure 3. System design approach.
1.
An optimization algorithm is used that generates the equipment size and dynamic ED operating profile instances in step (1), whereas water demand instances are generated internally in step (2), and both are introduced into the dynamic simulation that is performed with the ED ANN. The information flow of Figure 3 is based on the use of a stochastic search metaheuristic method. In this case, the dynamic ED profile instances include time-variant stack voltage V s t a c k , s t and recirculation flowrates Q s t for every time step, although other parameters may also be used if desired. The values for these parameters pertain to each batch, which are repeated yearly to calculate the yearly energy required for the ED.
2.
This energy, together with capacity (size) values for the PV and BAT, is used in step (4) in order to match the energy required in the ED. This step includes dynamic simulation over a yearly profile of average hourly values for the solar irradiance, as well as an energy management strategy (EMS) that dictates the appropriate actions, depending on the availability of solar irradiance and the state of charge ( S O C ) of the BAT. Specifically:
2.1.
If S O C m i n < S O C < S O C m a x , then the BAT provides the required energy to the ED and the PV provides energy to the BAT.
2.2.
If S O C < S O C m i n , then the energy is provided from the grid to the ED because deep discharging of the BAT may have detrimental effects on its anticipated lifetime. Energy that becomes available from the PV is provided to the BAT.
2.3.
If S O C > S O C m a x , then the energy is provided from the BAT, but the provision of energy from the PV is discontinued to avoid overcharging, which may also harm the BAT’s lifetime.
3.
Step (5) includes the calculation of the objective function value for each W D e m s with s ∈ 1 , N W . The algorithm continuously generates water demand instances within a pre-specified range. These instances may be drawn from a pre-specified set or from a probability distribution, and may be different than the instances used for the derivation of the ANN.
4.
When all the water demand instances have been simulated, the algorithm calculates the expected objective function value, which is an average of the objective function values that correspond in each water demand instance.
5.
The algorithmic optimization criteria are then applied in order to generate the next design and dynamic ED operating profile instances, until the algorithmic termination criteria are met.

2.4. Optimization Problem Formulation and Objective Function

The optimization problem is formulated as shown below:
m i n N B A T , N P V , V s t a c k , s t , Q s t s t = 1 N T   OF e q u i p ( N B A T , N P V ) +   OF o p e r ( W D e m s , V s t a c k , s t , Q s t ) N W
s . t . y = f ∗ ( ∑ i = 1 n w i ∗ a i + b )
PV and BAT models from [11]
EMS of step 4 (Figure 1)
S O C m i n < S O C < S O C m a x N P V m i n < N P V < N P V m a x N B A T m i n < N B A T < N B A T m a x V s t a c k , s t m i n < V s t a c k , s t < V s t a c k , s t m a x Q s t m i n < Q s t < Q s t m a x C d i l , s t s ≤ C d i l , s t s , l i m P W = 0
Formulation (2) illustrates the expected objective function value [42], which represents the main components of the yearly capital and operating costs. Formulation (3) describes the employed constraints. The terms are analyzed below:
O F e q u i p = ( C T P V · A P V · N P V · N R P V + C T B A T · P B A T · N B A T · N R B A T ) / y
O F o p e r = C T v · N b a t c h · ∑ s = 1 N W ∑ s t = 1 N T P E D , s t s ( W D e m s , V s t a c k , s t , Q s t ) · t s t
O F e q u i p is the objective function part that pertains to the equipment costs, with N B A T being the number of BAT and N P V being the number of PV panels. C T P V is a cost coefficient for PV ($/m2), A P V is the surface area per PV panel (m2/PV panel), which is fixed, as we assume that commercially available panel blocks will be used, C T B A T is a cost coefficient for BAT ($/Wh), P B A T is the energy capacity of each BAT unit (Wh/BAT), which results from multiplying the BAT capacity, S P B A T , in Ah with the BAT voltage, V B A T , in volt (these two are also fixed for commercially available BAT units). N R P V and N R B A T represent the number of times that the panels and the BAT units should be replaced in the assumed y years of operation of the PV-BAT-ED plant, based on the estimated lifetime of each panel and BAT, considering wear and tear [43].
O F o p e r accounts for operating costs that are a function of the design variables. P E D , s t s is the energy (W/batch) required by the ED for every time step of the dynamic simulation, with s t ∈ 1 , N T , and for every water demand W D e m s value, with s ∈ 1 , N W .     P E D , s t s is multiplied by the duration, t s t , of each time step (which is the same in this work), in order to calculate the Wh/batch. By multiplying with the number of batches per year ( N b a t c h ), we calculate the yearly energy (Wh/y) needed for the ED. P E D , t s is a direct function of the design parameter, V s t a c k , s t (volt), and is affected by the design parameter, Q s t (m3/h), and by the uncertain parameter, W D e m s (m3/h). It is calculated from the current density, I c u r r , s t s   (A), that results from the ED simulation stage, as follows [44]:
P E D , t s = V s t a c k , s t · ∫ 0 t I c u r r , s t s
C T v is a cost coefficient ($/Wh) that is used in Equation (5) with the purpose of expressing the entire numerator of formulation (2) as the cost. P E D , s t s may be served by either renewable energy, or energy from the grid, or both. Normally, we would only add a cost to the energy that is provided from the grid and assume that renewable energy is free of charge, as it is produced internally by the system. Only during optimization, all energy terms are assigned a cost in order to help the algorithm move toward designs that have overall lower energetic requirements. Once the optimization results are obtained, and specifically in the data reported in the results section, the equipment cost is calculated by using Equation (7), which is adapted to consider various additional fixed costs so that the final cost value is in line with those presented in the published literature for similar systems. However, for the operating costs, only costs for the grid or lost energy are applied. Therefore, a new equation is used to calculate the operating costs after obtaining the optimization results. Both these equations, as well as the one to calculate the total costs, are shown below.
  C T e q u i p = ( C T P V · A P V · N P V · N R P V + C T B A T · P B A T · N B A T · N R B A T + C T m · A m                   · N c e l l + C T s t + C T P u m p · N p u m p + C T t a n k · N t a n k + C T E D p w   · N E D p w + C T a i r b l · N a i r b l + C T i n v · N i n v ) / y
  C T o p e r = C T v ∗ P W ∗ y
  C T t o t a l =   C T e q u i p +   C T o p e r
where C T m   is the membrane cost ($/m2), A m is the membrane size (m2), N c e l l is the number of ED cells, C T s t is the membrane stack cost ($), C T P u m p is the pump cost ($), N p u m p is the number of pumps, C T t a n k is the tank cost ($), N t a n k is the number of tanks, C T E D p w is the ED power supply equipment ($), N E D p w is the amount of equipment needed during the system lifetime, C T a i r b l is the ED air blower cost ($), N a i r b l is the number of air blowers, C T i n v is the inverter cost ($), N i n v is the inverter number, C T v is the cost of electricity ($/kWh) and P W is the annual grid electricity requirement or renewable energy loss (kWh/y). Equations (7)–(9) are based on [11]. Some terms are clearly fixed in this study, but they are used here as they are also typically used in similar studies (e.g., [10]). The optimization is performed with simulated annealing [45], based on the implementation of [46].
The set of constraints (3) includes a generic expression of the ANN model, as originally specified in Equation (1), as well as an indication that the PV and BAT models are also included in the formulation. Other constraints include the upper and lower limits for the design variables and for the S O C of the BAT. They also include a specification for the C d i l , s t s , which should be satisfied in order for the produced water to be potable and an equal constraint on the P W . Ideally, the optimum designs should lose no renewable energy or should not require any energy from the grid. This term represents the energy from the PV-BAT system that surpasses the BAT limitations. This occurs when there is an energy surplus that would charge the battery beyond its maximum S O C m a x , or when an energy deficit arises, causing the BAT charge to drop below its S O C m i n . Both these constraints are used in a relaxed form as penalties that are added in formulation (2) and used by the optimization algorithm. The same cost value is applied on P W when either of the S O C m i n or S O C m a x limits are violated. With respect to uncertainty, the water demand may exhibit temporal variability, influenced by environmental and climatic conditions, lifestyle habits, and operational schedules of industries. Each problem design instance, i.e., each set of values in the vector of the design variables V s t a c k , t , Q t , N P V , and N B A T , is optimized for every point of product water volume,   W D e m s , where s ∈ 1 , N W .

3. Implementation

3.1. Experimental Setup and Method for Model Validation

The rigorous ED model is validated here, using experimental results for nitrate removal from a pilot plant setup comprising 40 cell pairs of cation- and anion-exchange membranes, each with an area of 0.038 m2 per sheet (total effective membrane area of 1.52 m2). Further details are available in Voutetaki et al. [47], where a system with the same membrane area per sheet, but with more cell pairs, was used for the removal of lead and sulfate ions from industrial effluents. The experiments were conducted at 20 V, with a feed flow rate of 300 L/h, 15 L concentrate, and 15 L diluate feed solutions. The pilot was operated in batch recirculation mode for one hour, with samples taken at 0, 10, 30, and 60 min. An initial concentration of 120 mg/L nitrate was used in the ED process. These data were also used in the simulations for validation.
To simulate nitrate-contaminated groundwater, we used NaNO3 from Fischer Scientific (Schwerte, Germany), CaSO4 from Lachner (Main, Germany), and MgCl2 from PanReac Applichem (Darmstadt, Germany). The water feed solution was prepared by dissolving appropriate amounts of solutes in deionized (DI) water (pH 5.5–5.8, electrical conductivity <0.0005 S/m and TOC <0.05 mg/L) to achieve 120 mg/L of nitrate. Sodium sulfate (Na2SO4, Sigma Aldrich, Darmstadt, Germany) was used to prepare the electrolyte rinsing solution at a concentration of 0.25 M. The anion and cation exchange membranes used were PC MVA (Monovalent Anion) and PC MVK (Monovalent Cation), both from PCA Polymerchemie Altmeier GmbH (Heuswriler, Germany). PC MVA and PC MVK are ion exchange membranes reinforced with polyester, used for desalination. Stoichiometric analysis of all ions was performed using ion chromatography with a Prominence LC-20Ai system (Shimadzu, Kyoto, Japan), equipped with an IC SI-52 4E (Shodex, Tokyo, Japan) column, with PEEK as the column material, a flow rate of 0.8 mL/min, and a column temperature of 45 °C. The mobile phase consisted of 3.6 mM sodium carbonate (Na2CO3) for the anions, 4 mM methane sulfonic acid for the cations, and the sample injection volume was set at 20 μL.

3.2. Data Used in Case Studies

This work was implemented for a source in northern Greece, where there is an issue with their drinking water due to a high nitrate concentration. The nitrate feed concentration is 120 mg/L, with the goal being to reduced it to below C d i l , T s , l i m = 50 mg/L. While this value meets the specification of the European Union Drinking Water Directive [48] during optimization it was lowered to C d i l , T s , l i m = 30 mg/L and used as constraint in Formulations (2)–(3). This was performed to identify the operating limits that can be reached through optimization. The ED unit employed to treat nitrate-contaminated water has N c e l l = 25 cell pairs and A m =   0.038 m2 of membrane size, and its feed volume varies depending on the water volume demand. The ED batch time is assumed to be equal to one hour, divided at four time steps of t s t = 15 min each, hence N T = 4 . Eight ED batches are assumed daily, which implies that the ED unit operates for one hour, and remains idle for two hours. Within these two hours, the ED batches are replaced with new batches of feed, and the batteries are charged, given the available solar supply. The hourly solar irradiance in W/m2 of Thessaloniki, Northern Greece, versus time, is presented in Figure 4. The unit is designed to treat eight daily batches (producing 1–6 m3/batch or 8–48 m3/day). Similar works in the literature report comparable daily production, such as Bian et al. [10] producing 10 m3/day, or Wright and Winter [4] producing 6–15 m3/day. These systems are appropriate for small applications in isolated locations lacking an electric grid, where the required daily treated water volume is small.
The ANN model has nine input parameters ( V s t a c k , s t , Q s t with s t ∈ 1,4 , and W D e m s ), and eight output parameters ( I c u r r , s t s and C d i l , s t s ). A total number of 11,220 data points was generated for the development of the ANN; 60% of these data were used for training, 25% were for validation and 15% were for testing. The Matlab 2021a function used for ANN training was the Levenberg–Marquardt backpropagation [49], with a maximum of 1000 epochs and with the hyperbolic tangent sigmoid activation function. The validation test used 810 points. After the validation, the ANN ED model was integrated with the PV-BAT model. The PV panel area per equipment piece was A P V = 0.64 m2/PV panel, the S P B A T = 866 Ah, and the V B A T = 6 volt/BAT, whereas C T P V =   98 $/m2 [10] and C T B A T = 150 $/kWh [10]. The BAT and PV efficiency were 85% [50] and 10% [51], respectively. The BAT S O C ranged between [50%, 90%] of the total BAT capacity [52]. During the optimization, V s t a c k , s t ranged between [0–40 V], Q s t between [50–350 L/h], N P V between [2,30], and N B A T between [2,30]. The values for the uncertain parameter, W D e m s , ranged within [1,6] m3/batch, following a uniform distribution and indicating a maximum variation of ± 71% from the average demand within this range. These were the ranges used in the development of the ANN as well. In the latter case, the values for these parameters were pre-specified, whereas during optimization, six values were selected in each iteration of the simulated annealing.
Figure 4. Annual solar irradiance of Thessaloniki, Greece [53].

4. Results and Discussion

4.1. ED Model Validation

Figure 5a shows the experimental (orange) and simulation (blue lines) results from the ED for both the concentrate and diluate compartments. Axis Υ depicts the normalized concentration, C / C 0 , with C 0 representing the initial nitrate concentration. The simulation results match the experimental results, particularly in the concentrate stream. In the diluate stream, the maximum deviation from the experimental results is 10% at one point before the 15 min, while the errors in the subsequent points are very small. This initial difference in separation is due to phenomena in the solution that are not included in the model, such as boundary-layer development or stack hydration delays that impede ion transfer. Overall, the ED model provides reliable predictions for the development of the ANN under the operating conditions of 20 V and a 300 L/h feed flowrate, which are within the ranges considered in the implemented case study.
The model was also validated with data from Mohammadi et al. [54]. That system had 10 cell pairs and a 69 cm2 membrane area, and operated at a flow rate of 2.5 L/h. The applied voltage was 6.6 V, and the nitrate feed concentration was 100 mg/L. Figure 5b shows that the model predictions match the experimental data sufficiently again, with an average error of 5% across all points, which were within an error range of 1–10%.
Figure 5. ED model validation with experimental results from (a) this study, with the average relative standard deviation of the IC analyses for the nitrate ions being less than 1%, (b) the study of Mohammadi et al. [54].

4.2. ANN Model Validation

Choosing the appropriate number of hidden layers in a neural network is crucial, as it directly affects the model’s capacity to learn complex patterns and generalize to unseen data. The selection of neurons, which are the fundamental processing units that take inputs, is also of great significance. The universal approximation theorem, first proposed by Cybenko [55], suggests that a neural network with a single hidden layer can approximate any continuous function, given sufficient neurons. However, for practical applications, increasing the number of hidden layers (up to five) often enhances the model’s ability to capture hierarchical features, especially for tasks involving high-dimensional data. Furthermore, Ghana Sheel and Deepa [56] discuss various heuristic and analytical methods for determining the number of hidden neurons in neural networks. They highlight that while several rules of thumb exist, there is no one-size-fits-all solution, and empirical testing is often necessary.
The hidden layer and neuron numbers were optimized to reduce deviations of the ANN predicted data from the ED model data. The selected neural network had three hidden layers, with 17 neurons each. The results are presented in Figure 6. Figure 6a represents an error histogram, showing the distribution of errors between the predicted outputs and the actual target values for the training, testing, and validation tests. The x-axis represents the error values. Errors close to zero indicate that the neural network’s predictions are very close to the actual target values. The y-axis shows the frequency of errors for each bin, essentially counting how many predictions fell within each error range. The height of each bar represents the number of instances (data points) that fall within a specific error range. The blue bars show errors from the training set, the red bars show errors from the test set, and the orange bar represents the error line, which is the ideal point where the prediction perfectly matches the target. Clearly, most of the error values are clustered around zero, indicating that the majority of predictions are close to the actual target values. The presence of some bars further from zero (both positive and negative) indicates that there are outliers where the model’s predictions were less accurate.
Figure 6. Neural network with 3 hidden layers and 17 neurons. (a) Error histogram plot, (b) mean squared error plot, (c) ANN model validation in C 1 , (d) ANN model validation in C 4 , and (e) ANN model validation in J 1 .
Figure 6b shows a mean squared error vs. epochs plot, which shows the training and testing performance over time. The x-axis represents a number of complete passes through the training dataset. Each epoch allows the model to update its parameters. The y-axis measures the average squared difference between the predicted and actual values. A lower mean squared error indicated better model performance, as it reflects smaller prediction errors. The annotation ‘best training performance’ indicates the epoch at which the training mean squared error (MSE) reached its minimum, marking the point of optimal performance on the training data. In general, this analysis indicated a good ANN model that can be used to fit the data points with accuracy. However, a validation test using 810 data points was employed to test the ANN’s performance. In Figure 6c–e the relationship of the ANN data predictions with the ED model predictions in three performance indicators, C 1 , C 4 and J , respectively, is shown. C 1 states the final concentration of the first time-step, C 4 the final concentration of the batch, and J the current density of the last time step. To compare the ED model data to the ANN data, simulations using the ED model are performed. The computational time used for one ED simulation was 2.3 s, whereas the time used for an ANN simulation was 0.7 s: about three times faster.
In Figure 6a, the error histogram shows a peak error count close to 9 × 104 instances, indicating a dense concentration around zero error. Additionally, Figure 6a has a tight error distribution, with a cluster of errors around zero and fewer instances of larger deviations. This distribution suggests good generalization or a more refined model fit, including a line for zero error, with most instances centered around it. The MSE in Figure 6b achieved the best training performance at 0.00017956 in epoch 1000. A low MSE indicates that the model’s predictions are close to the target values, suggesting an accurate model with reduced prediction error. Furthermore, in Figure 6b, the training continues for 1000 epochs, indicating optimum model efficiency. For all performance indicators, the slope of the plots and the R2 term are close to one, and the data points from Figure 6c–e present very little scatter. The MSE (mean squared error) values were estimated in the prediction provided by the ANN model for each predicted parameter. The prediction intervals (PI) were further estimated for each one of the above parameters, using the split conformal prediction (SCP) framework. SCP is a distribution-free inference technique that produces finite-sample, calibrated prediction intervals that are applicable to any regression model, regardless of its architecture or training procedure ([57,58]). The data are reported in Table 1 and more details are available in the Supplementary File. The error margins for the PI95% are within 3.5–9.6% for the nitrate concentrations and 2–4.8% for the current densities.
Table 1. Mean squared error and prediction intervals at 95% confidence level. The reported units do not apply to the last row.

4.3. Optimization Results

4.3.1. Dynamic Optimization Under Uncertainty

Selected designs are illustrated in Table 2, including the optimum design, S1,1, that exhibits the lowest total cost, C T t o t a l , and two more designs (S1,2 and S1,3) that exhibit interesting trade-offs. S1,2 has the lowest energy consumption on an annual basis, whereas S1,3 achieves the highest water quality. In the dynamic optimization, the duration of each batch is separated into four time-steps of 15 min each. Designs where V s t a c k , s t > 0 indicate that potential is applied during the 15 min period. From this information, we deduce the total duration of each batch. S1,1 has the lowest cost of all three designs (1641 $/y), with a batch time of 30 min. The achieved C d i l l is within drinking water limits (<50 mg/L), and its P W has a value of 16 kWh/y. S1,2 has the lowest P W of all designs (0.6 kWh/y) and a batch of 1 h and C d i l l within drinking water limits (31 mg/L); however, it has a very high C T t o t a l (3633 $/y). This design includes 19 batteries, which would explain the higher cost and the lower P W value. S1,3 achieves the best water quality ( C d i l l = 23 mg/L), but at the expense of high P W (79 kWh/y) and a higher cost (2104 $/y) than S1,1. The designs with a smaller batch time (S1,1 and S1,3) are more preferable, because the water demand condition is met in half of the time compared to design S1,2, meaning that more batches can be implemented on a daily basis. However, due to its significantly lower cost, S1,1 is more preferable than S1,3.
Table 2. Dynamic optimization solutions, with P W duration indicating the time that the system operated out of the S O C limits.
In Figure 7, we present the selected solutions’ flow rate and voltage profiles, and their respective battery charge–discharge performance. Figure 7a–c show the fluctuation of the design variables within the batch. Figure 7d shows the annual battery performance for all solutions. It is reminded that the term P W accounts for the annual kWh, for which the system has to be connected to the grid due to an inadequate power supply from the batteries or exhibits renewable energy losses, expressed as violation of the S O C m a x . The S O C profiles for all three designs have different trends. Design S1,1 goes through discharge and recharge cycles. The S O C of designs S1,2 and S1,3 gradually decreases throughout the year. Compared to the other designs, S1,2 has a larger battery capacity. S1,1 shows fluctuating behavior, maintaining S O C mostly between 60 and 80% throughout the year, showing frequent charge and discharge. In contrast, S1,2 shows a steady and gradual decline in S O C from about 85% to below 55% without major fluctuations, meaning that it experiences fewer cycles and smoother operation. This could prolong battery life, but risks running closer to the lower limit toward the end of the year. S1,3 exhibits a moderate decline and some variability, eventually reaching around 50%. Considering long-term performance, S1,1 keeps the S O C in a healthier mid-range for most of the period, whereas S1,2 provides the most stable trajectory but approaches the lower S O C threshold sooner. Overall, S1,3 exhibits balance between stability and variability, avoiding extreme cycling while still maintaining S O C within acceptable bounds. However, in a larger-scale operation, S1,3 would probably demand more time for battery recharge, during which the S O C would possibly drop lower than 50%. For the optimum solution S1,1, the P W predicted by the ANN is only 0.31% lower than the corresponding prediction from the ED model. This has no practical effect on the C T t o t a l , which is only 0.0006% different from the one predicted by the ANN model. For S1,2, the difference in C T t o t a l is similar to that for S1,1, whereas for S1,3, the difference is 0.4%, which corresponds to only 8.5 $/y higher cost compared to the C T t o t a l predicted from the ED model. For the final nitrate concentrations, C d i l l , the differences from the predictions of the ED model are 0.28, 0.9, and 0.1 mg/L, or 1.2%, 3%, and 0.3% for S1,1, S1,2, and S1,3, respectively. These are too small to affect the batch time.
Figure 7. Dynamic optimization solution evaluation. (a) Flow rate and voltage profile of S1,1, (b) flow rate and voltage profile of S1,2, (c) flow rate and voltage profile of S1,3, (d) battery performance for all designs.

4.3.2. Evaluation of Selected Profiles on Feed Disturbance

The robustness of the selected designs in sudden peaks of nitrate input (150 mg/L) in the feed tanks was tested. At this simulation, the water demand was fixed at the lowest value possible, at 0.5 m3. Consequently, the respective design responses would be slightly different than those presented in Table 2. The disturbance was inserted just before the second time step, at 15 min, in order to evaluate how the different designs would respond and how long it would take to reach the nominal nitrate concentration. This evaluation is presented in Figure 8, where the nitrate concentration threshold is also depicted with a red line. This disturbance mimics a continuous operating mode, where a high concentration stream would be inserted in the storage tanks and would have to be treated. After the disturbance at 15 min, both S1,1 and S1,2 effectively reduce the concentration from its initial value, while S1,3 stabilizes more slowly at a concentration slightly above the target of 50 mg/L. When the feed concentration increases to 150 mg/L at 15 min, S1,1 shows a relatively small peak and quickly recovers to a steady value below the target. As expected, the solutions with higher voltages (S1,1, S1,3) would react more quickly to the concentration changes. Based on the responses of Figure 8, the S1,1 and S1,3 designs are able to respond fast to the sudden peak of the nitrate feed, while reaching an acceptable nitrate concentration value below the drinking water specifications (~35 mg/L) in about 7 min. For design S1,2, although it was within the drinking water specifications before the disturbance, afterwards it was unable to meet the threshold of 50 mg/L, presenting a rather high concentration at the end of the batch, at ~55 mg/L.
Figure 8. Dynamic optimization designs under feed disturbance. The red line indicates the C d i l , s t s , l i m for the nitrate concentration and the vertical light blue lines indicate the endpoints of the 15 min time steps.

4.3.3. Simulation at Minimum Water Demand

We performed a simulation of all dynamic optimization designs under the minimum water demand (1 m3/batch), estimating each design’s annual costs. The annual costs were compared to the ones from the optimization under uncertainty. The results are presented in Table 3. Lower water demand resulted in lower ED energy for all designs. However, design S1,1 with minimum water demand exhibited a higher cost than the case under uncertainty. This phenomenon occurred because even though the ED energy demand was significantly lower than the nominal, the PV-BAT model resulted in higher P W value (because it exceeded the upper S O C limit, hence wasting solar energy), therefore resulting in higher C T t o t a l . S1,2 and S1,3 resulted in very similar costs, being those of the case under uncertainty. These results indicate that no design would result in economic gains in the case of prolonged operation under minimum demands. However, designs S1,2 and S1,3 would at least maintain the costs that were anticipated from optimization under uncertainty.
Table 3. Optimum solutions from dynamic optimization with minimum water demand.

4.3.4. Simulation at Lower Solar Irradiance and Maximum Water Demand

Next, we performed simulations for the optimum dynamic designs, considering 30% lower solar irradiance for 30 days, which corresponds to 500–700 W/m2 during this period. At the same time, we implemented a maximum water demand (6 m3/batch) for the entire year. The respective C T t o t a l values are presented in Table 4, and the annual S O C performances of all designs are shown in Figure 9. These conditions had minor effects on the costs. The P W increased in designs S1,1 (175 from 16 kWh/y) and S1,3 (196 from 79 kWh/y). However, their impact on costs was small, as the increase was 1–2%. Design S1,2 was practically unaffected, due to the considerably larger battery capacity. Overall, the consideration of uncertainty in water demand during the system design resulted in robust designs. The deterioration of solar irradiance would need to be larger or last for longer periods to incur significant effects on the associated costs. The proposed methodology can be used to address the design of similar systems for more adverse operating conditions, while also expanding the consideration of uncertainty in other parameters.
Table 4. Optimum designs C T t o t a l and P W at low solar irradiance and maximum weather demand.
Figure 9. Battery performance of optimum solutions, at 30% lower solar irradiance for 30 days and at maximum water demand for a year.

4.3.5. Cost Sensitivity Analysis

Subsequently, we performed a sensitivity analysis on C T t o t a l to investigate the effects that BAT, PV, and electricity prices have on the total annual cost. In Figure 10a, it is observed that PV and electricity prices have a negligible effect on C T t o t a l compared to BAT prices. Moreover, S1,2 is influenced more significantly by increases in battery prices, as it has the highest BAT capacity among the three. S1,1 and S1,3 exhibit similar trends, indicating greater robustness compared to S1,3, which has a steeper slope, although S1,1 maintains the lowest C T t o t a l . It appears that for a greater decrease in BAT price, designs S1,1 and S1,3 may eventually attain the same C T t o t a l . Figure 10b shows that if the prices of BAT, PV, and external electricity change simultaneously, the trends remain similar to those in Figure 10a. Overall, S1,1, apart from having the minimum C T t o t a l , seems to be more robust to changes in equipment and electricity costs.
Figure 10. Sensitivity analysis of C T t o t a l for selected dynamic designs, with respect to (a) BAT, PV, and electricity prices, and (b) the combined effect of BAT, PV, and electricity prices. The circular, triangular, and rectangular data points represent the fluctuations in BAT, PV, and non-renewable electricity prices, respectively. The rhombus data points indicate the simultaneous effect of changes in BAT, PV, and electricity prices on C T t o t a l .

4.3.6. Steady-State Optimization Under Uncertainty

In this case, we performed steady-state process optimization to determine if there are any benefits from using dynamic optimization. The main difference with the dynamic optimization approach is that the stack voltages and flow rates retain a fixed value throughout the batch. Furthermore, the batch is not stopped if the C d i l l specification is met. Table 5 illustrates the optimization results. S2,1 has the lowest cost, a C d i l l within drinking water limits, and low P W . S2,2 has the lowest P W value and the C d i l l is within limits but the C T t o t a l   is high. This has resulted from the higher number of batteries. Comparing S2,1 and S1,1, the latter (attained from dynamic optimization) has slightly lower C T t o t a l and C d i l l , and about the same P W ; however, it has 50% lower batch time. This means that with the dynamic optimization approach, it is possible to incorporate more batches within a day and therefore increase the water throughput.
Table 5. Selected designs attained from steady-state optimization under uncertainty.
The respective battery performance for all steady-state optimization designs is illustrated in Figure 11. The red bars indicate the 50% and 90% battery S O C limits under and over which the term P W increases. S2,1 exhibits the same trend as S1,1. The batteries are discharged at 1800 h, they are recharged at 4000 h, and they are discharged again at 6000 h, following the seasonal fluctuations. S2,2, on the other hand, has a similar trend to S1,2. The high number of batteries in both designs (19 for S1,2 and 17 for S2,2) result in a smooth, discharge-only profile. Again, this design is unfavorable for longer-term operations, due to the long charging time of 17 batteries.
Figure 11. Battery performance for steady-state optimization.
Figure 12 shows the normalized concentration profiles ( C / C 0 ) of the two compartments, diluate and concentrate, over time, for the designs obtained in both steady-state and dynamic optimization, together with the applied voltage trend of the dynamic optimization. The dynamic profile is represented by solid lines, and the steady-state profile by the dashed lines. The green line also represents the applied voltage profile in the S1,1 design (resulting from dynamic optimization). The S1,1 design reacts dynamically to any change in the applied voltage. After 15 min, a higher voltage is applied, which results in the concentration reaching an acceptable level for drinking water (<50 mg/L). The batch is then stopped after a total duration of 30 min. S2,1, on the other hand, exhibits a uniform and continuous profile over time. In the case of steady-state optimization (dashed lines), it can be seen that it takes about 5 min to remove 76% of the nitrates and another 55 min to remove a further 3%. Obviously, with the applied voltage value, the separation should have stopped earlier, but this cannot be implemented in steady-state optimization. In the case of the dynamic optimization (continuous lines), it takes 50% of the time to remove 75% of nitrates, and after that, the unit stops, because the nitrate concentration criteria were met. The energy consumptions of the two profiles are estimated to be 374.57 Wh/batch for the S1,1 and 449.48 Wh/batch for the S2,1 design. With S1,1, 17% energy is saved compared to S2,1. Therefore, the dynamic optimization approach is both time and energy efficient.
Figure 12. Normalized concentration profiles ( C / C 0 ) for dynamic and steady-state optimization.

5. Conclusions

In this work, we have developed and used an ANN model to design an ED-PV-BAT system to optimize the design and operation of a pilot unit applied for the removal of nitrate ions from drinking water sources. With such a system, it is important for the designers to include uncertainties, due to variable water consumption demands. We implemented design optimization under water demand uncertainty in dynamic and steady-state conditions. Using an ANN, we were able to perform the optimizations much faster and with less computational effort than with a conventional ED model.
The optimization goal was to select a design that would allow for the ED pilot unit to treat nitrate contaminated water under uncertain water demand conditions, while being energetically autonomous. The optimal designs from the dynamic optimization were then simulated for the minimum water demand, and several proposed designs showed high robustness. The dynamic and steady-state designs resulted in similar annual costs, with the advantage of dynamic optimization being the ability to treat the same volume of feed water in a shorter batch time; therefore, less energy is required. More specifically, a proposed dynamic design with minimal cost has a 30 min batch operation and requires 374 Wh/batch, compared to a steady state design with 0.15% higher annual cost, designed for 60 min batches and requiring 449 Wh/batch of energy. The proposed design aligns with the European Union Drinking Water Directive [48], which sets a maximum allowable nitrate concentration of 50 mg/L. The proposed approach and designs highlight a sustainable and viable pathway for decentralized nitrate removal in compliance with the drinking water standards.
Although the present study focuses on the offline optimization of the ANN-ED/PV-BAT system, the proposed ANN surrogate model could be directly integrated into an online control framework for real-time operation. Due to its sufficient prediction accuracy and fast computations, as discussed in the paper, the ANN can serve as a predictive model within a model predictive control (MPC) algorithm to dynamically adjust ED operating variables, such as voltage and flow rates, in response to fluctuations in solar energy availability and water demand. Similar architectures, where ANNs approximate system dynamics and propose optimal control policies, have been demonstrated for other chemical process systems [59,60]. Beyond its technical scope, the proposed ANN-based optimization framework also supports techno-economic and policy analysis for renewable desalination systems. By linking operating flexibility with cost and demand uncertainty, it can inform strategies such as dynamic water pricing, renewable investment incentives, or decentralized planning for water-stressed regions. Although this study focused on optimal system design, to minimize the annual cost under water demand uncertainty, the proposed framework can be extended to a multi-objective formulation. For instance, a Pareto front could highlight the trade-offs between system costs and operational parameters, providing different cost options for different operating conditions. Note that the proposed approach is presented as a generic optimization problem formulation that is independent of the particular application in nitrate removal discussed here. The same approach can be used for the design of renewable ED systems in other applications, like water desalination, removal of ionic species like sulfur and lead from effluents of battery production [47], and others.
The proposed ANN surrogate demonstrates strong predictive accuracy in the presented work. However, all models of this type depend upon the underlying data that were used for their development. Experiments with larger-scale units would provide data to train and develop ANN models that can accurately predict results at these design ranges. As with all membrane systems (e.g., RO, etc.), the ED is modular and can be easily scaled up by adding more stacks to the treatment train. The design of an appropriately scaled ED stack also involves engineering considerations for pumps, piping, electrical supply, and control systems, to handle the increased operational scale with ease in maintenance and monitoring. Adjusting the dimensions of the channels within the stack, specifically their length and diameter, presents a relatively straightforward method to enhance the current efficiency of large stacks. Nonetheless, determining the optimal channel dimensions often depends on empirical knowledge, highlighting a gap in the development of optimization models that balance current efficiency with pressure drop considerations in stack design [61]. For stacks with different sizes and different flow velocities, but similar residence times of the feedwater, the ion separation and energy consumption can be similar [62]. The optimization applies not only to a single stack but can also be adopted for the different stacks of an integrated ED system with photovoltaics for energy autonomy and continuous operation.
Generally, the study contributes to more sustainable water treatment practices by minimizing chemical consumption and energy demand and reducing potential environmental impacts. These aspects highlight the ethical importance of developing cleaner and more efficient treatment practices. Although PV and BAT systems enable electrodialysis operation with renewable energy, their sustainability depends on efficient recycling or extending the materials’ lifetimes. The disposal of batteries should also be considered, as improper management of spent batteries can lead to contamination. Considering the full life cycle of these components is essential for achieving truly environmentally friendly renewable-powered water treatment technologies. Moreover, expanding the investigation to multi-ion systems represents a critical step towards practical implementation, as real effluents usually do not consist of single ionic species. Such investigations will support the development of ED systems that are suitable for broader industrial and rural applications. The presented work is specifically suited for understanding the potential of renewable water treatment technologies for rural applications that may have limited access to grid energy, and for potentially developing policies.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/pr13123773/s1. Data used in Figure 6c–e and Table 1, additional parity plots for C 2 ,   C 3 ,   J 2 ,   J 3 ,   J 4 , and additional data for Table 3 and Table 4.

Author Contributions

A.V.: Methodology, software, formal analysis, investigation, writing—original draft preparation, visualization, K.V.P.: conceptualization, supervision, writing—original draft preparation, funding acquisition, P.S.: conceptualization, methodology, supervision, writing—original draft preparation, funding acquisition, A.I.P.: conceptualization, methodology, supervision, writing—original draft preparation, visualization, funding acquisition. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by IKY, State Scholarships Foundation of Greece, grant number 53021.

Data Availability Statement

The original contributions presented in this study are included in the article/Supplementary Materials. Further inquiries can be directed to the corresponding author.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
A E M Anion exchange membranes
A m Membrane size (m2)
A N N Artificial neural network
a n Neural network inputs
A P V PV surface area (m2/PV panel)
b Bias term
B A T Battery
C E M Cation exchange membranes
C T a i r b l Air blower cost ($)
C T B A T Battery cost coefficient ($/Wh)
C d i l Diluate final concentration (mg/L)
C d i l l i m Limit for diluate final concentration (50 mg/L)
C T E D p w ED power supply ($)
C T e q u i p Equipment cost ($)
C i Diluate   final   concentration   in   each   time   step ,   ( i   ∈ 1,4 )
C T i n v Inverter cost ($)
C T m Membrane cost ($/m2)
C T o p e r Operating cost ($)
C T P u m p Pump cost ($)
C T P V PV cost coefficient ($/m2)
C T s t Membrane stack cost ($)
C T t a n k Tank cost ($)
C T t o t a l Total cost ($)
C T v Electricity cost ($/kWh)
E D Electrodialysis
f ANN activation factor
F N N Feed forward neural network
I c u r r Current density (A)
J i Final   current   density   at   each   time   step   ( i   ∈ 1,4 )
N a i r b l Air blower number ($)
N B A T Number of batteries
N c e l l Number of ED cells
N E D p w Number of ED power supply replacement
N i n v Number of inverters
N p u m p Number of pumps
N P V Number of PV panels
N R B A T Number of batteries replacement times
N R P V Number of PV replacement times
N T Time steps within batch
N W Water demand instants
O j Neural network outputs
OF e q u i p Equipment cost ($)
OF o p e r Operating cost ($)
P B A T Capacity of batteries (Wh/BAT)
P E D ED energy consumption (W/batch)
P V Photovoltaic
P W Annual grid electricity requirement (kWh)
Q ED flow rate (L/h)
S i , i Selected designs from optimization
S O C m a x Maximum state of charge of accumulator (%)
S O C m i n Minimum state of charge of accumulator (%)
S P B A T Battery capacity (Ah)
t s t Duration of batch time steps (min)
V B A T Battery voltage per item (V/BAT)
V s t a c k ED stack voltage (V)
W D e m Water demand (m3)
w n j Weight factors
y Years of system operation (y)

References

  1. Adewole, J.K.; Al Maawali, H.M.; Jafary, T.; Firouzi, A.; Oladipo, H. A review of seawater desalination with membrane distillation: Material development and energy requirements. Water Supply 2022, 22, 8500–8526. [Google Scholar] [CrossRef] [Scilit]
  2. Pure Water Group. 2025. Available online: https://purewatergroup.com/electrodialysis (accessed on 25 August 2025).
  3. Belhamidi, S.; El-Ghzizel, S.; Taky, M.; Elmidaoui, A. Nitrate removal of groundwater by reverse osmosis, nanofiltration and electrodialysis: Performances and cost comparison. Desalination Water Treat. 2022, 262, 338–346. [Google Scholar] [CrossRef] [Scilit]
  4. Wright, N.C.; Winter, A.G. Justification for community-scale photovoltaic-powered electrodialysis desalination systems for inland rural villages in India. Desalination 2014, 352, 82–91. [Google Scholar] [CrossRef] [Scilit]
  5. Ortiz, J.M.; Expósito, E.; Gallud, F.; García-García, V.; Montiel, V.; Aldaz, A. Electrodialysis of brackish water powered by photovoltaic energy without batteries: Direct connection behavior. Desalination 2007, 208, 89–100. [Google Scholar] [CrossRef] [Scilit]
  6. Malek, P.; Ortiz, J.M.; Schulte-Herbrüggen, H.M.A. Decentralized desalination of brackish water using an electrodialysis system directly powered by wind energy. Desalination 2016, 377, 54–64. [Google Scholar] [CrossRef] [Scilit]
  7. Cipollina, A.; Micale, G.; Rizzuti, L. Seawater Desalination, Conventional and Renewable Energy Processes; Springer: Berlin/Heidelberg, Germany, 2009. [Google Scholar]
  8. Xu, H.; Ji, X.; Wang, L.; Huang, J.; Han, J.; Wang, Y. Performance study on a small-scale photovoltaic electrodialysis system for desalination. Renew. Energy 2020, 154, 1008–1013. [Google Scholar] [CrossRef] [Scilit]
  9. He, W.; Raiker, G.A.; Atmanandmaya; Reddy, B.S.; Umanand, L.; Wang, J. Preliminary Analysis of Photovoltaic-Powered Electrodialysis for In-Home Water Desalination in Rural India. In Proceedings of the B-HTC 2020—1st IEEE Bangalore Humanitarian Technology Conference (B-HTC), Vijiyapur, India, 8–10 October 2020. [Google Scholar] [CrossRef] [Scilit]
  10. Bian, D.W.; Watson, S.M.; Wright, N.C.; Shah, S.R.; Buonassisi, T.; Ramanujan, D.; Peters, I.M.; Winter, A.G. Optimization and design of a low-cost, village-scale, photovoltaic-powered electrodialysis reversal desalination system for rural India. Desalination 2019, 452, 265–278. [Google Scholar] [CrossRef] [Scilit]
  11. Voutetaki, A.; Plakas, K.; Seferlis, P.; Papadopoulos, A.I. Systematic design of optimum and robust renewable electrodialysis systems for removal of nitrate ions. Chem. Eng. Res. Des. 2025, 213, 321–334. [Google Scholar] [CrossRef] [Scilit]
  12. Tristán, C.; Fallanza, M.; Ibáñez, R.; Ortiz, I.; Grossmann, I.E. A generalized disjunctive programming model for the optimal design of reverse electrodialysis process for salinity gradient-based power generation. Comput. Chem. Eng. 2023, 174, 108196. [Google Scholar] [CrossRef] [Scilit]
  13. Moazeni, F.; Khazaei, J. Optimal design and operation of an islanded water-energy network including a combined electrodialysis-reverse osmosis desalination unit. Renew. Energy 2021, 167, 395–408. [Google Scholar] [CrossRef] [Scilit]
  14. Le Henaff, A.-C.; He, W.; Buonassisi, T.; Winter, A.G.; Peters, I.M. Flexible operation of photovoltaic electrodialysis (PV-ED) low-cost community-scale desalination systems. In Proceedings of the 2019 IEEE 46th Photovoltaic Specialists Conference (PVSC), Chicago, IL, USA, 16–21 June 2019. [Google Scholar] [CrossRef] [Scilit]
  15. Rohman, F.; Aziz, N. Optimization of batch electrodialysis for hydrochloric acid recovery using orthogonal collocation method. Desalination 2011, 275, 37–49. [Google Scholar] [CrossRef] [Scilit]
  16. Rohman, F.S.; Aziz, N. Performance metrics of dynamic multi-objective optimization for energy consumption and productivity improvement in batch electrodialysis. Chem. Eng. Commun. 2021, 208, 517–529. [Google Scholar] [CrossRef] [Scilit]
  17. Latinis, A.; Papadopoulos, A.I.; Seferlis, P. Optimal operation profiles in an electrodialysis unit for ion recovery. Chem. Eng. Trans. 2021, 88, 1021–1026. [Google Scholar] [CrossRef]
  18. He, W.; Le Henaff, A.C.; Amrose, S.; Buonassisi, T.; Peters, I.M.; Winter, V.A. Voltage- and flow-controlled electrodialysis batch operation: Flexible and optimized brackish water desalination. Desalination 2021, 500, 114837. [Google Scholar] [CrossRef] [Scilit]
  19. He, W.; Le Henaff, A.C.; Amrose, S.; Buonassisi, T.; Peters, I.M.; Winter, V.A. Flexible batch electrodialysis for low-cost solar-powered brackish water desalination. Nat. Water 2024, 2, 370–379. [Google Scholar] [CrossRef] [Scilit]
  20. Easley, J. Feasibility and Design of Solar-Powered Electrodialysis Systems for Agriculture Applications. Master’s Thesis, Massachusetts Institute of Technology, Cambridge, MA, USA, 2020. Available online: https://hdl.handle.net/1721.1/144619 (accessed on 25 August 2025).
  21. Easley, J.N.; Talozi, S.; Winter, V.A.G. Feasibility and design of solar-powered desalination systems for agricultural applications in the Middle East and North Africa. Desalination 2023, 561, 116628. [Google Scholar] [CrossRef] [Scilit]
  22. Connors, G.B. Predictive Time-Variant Photovoltaic Electrodialysis Reversal: A Novel Design Optimization Using Predictive Machine Learning and Control Theory. Master’s Thesis, Massachusetts Institute of Technology, Cambridge, MA, USA, 2021. Available online: https://hdl.handle.net/1721.1/139521 (accessed on 25 August 2025).
  23. Shreyas, D.K.; Joshi, S.N.; Kumar, V.H.; Venkataramanan, V.; Kaliprasad, C.S. A review on neural networks and its applications. J. Comput. Technol. Appl. 2023, 14, 60–71. [Google Scholar] [CrossRef] [Scilit]
  24. Lennox, B.; Montague, G.A.; Frith, A.M.; Gent, C.; Bevan, V. Industrial application of neural networks-an investigation. J. Process Control 2001, 11, 497–507. [Google Scholar] [CrossRef] [Scilit]
  25. Hu, Z.; Gao, Y.; Ji, S.; Mae, M.; Imaizumi, T. Imroved multistep ahead photovoltaic power prediction model based on LSTM and self- attention with weather forecast data. Appl. Energy 2024, 359, 122709. [Google Scholar] [CrossRef] [Scilit]
  26. Zhang, M.; Han, Y.; Wang, C.; Yang, P.; Wang, C.; Zalhaf, A.S. Ultra-short-term photovoltaic power prediction based on similar day clustering and temporal convolutional network with bidirectional long short-term memory model: A case study using DKASC data. Appl. Energy 2024, 375, 124085. [Google Scholar] [CrossRef] [Scilit]
  27. Ansong, M.; Ogunniyi, E.O.; Jiménez, B.P.; Richards, B.S. Renewable energy powered membrane technology: Integration of solar irradiance forecasting for predictive control of photovoltaic-powered brackish water desalination system. Appl. Energy 2025, 401, 126651. [Google Scholar] [CrossRef] [Scilit]
  28. Migaybil, H.H.; Gopaluni, B. A performance neural network model for conventional solar stills via transfer learning. Appl. Energy 2024, 375, 124118. [Google Scholar] [CrossRef] [Scilit]
  29. Chitgar, N.; Karami, P.; Hemmati, A.; Sadrzadeh, M. A multi-carrier energy system for electricity, desalinated water, and hydrogen production: Conceptual design and techno-economic optimization. Renew. Energy 2025, 243, 122556. [Google Scholar] [CrossRef] [Scilit]
  30. Zegait, R.; Kouadri, S.; Chelgham, M.; Vucinic, L.; Ajia, F.; Sieni, E.; Al-Kilani, M.R. AI-based prediction of total dissolved solids in reverse osmosis desalination for arid regions. Desalination Water Treat. 2025, 323, 101411. [Google Scholar] [CrossRef] [Scilit]
  31. Wang, X.; Sun, X.; Wu, Y.; Gao, F.; Yang, Y. Optimizing reverse osmosis desalination from brackish waters: Predictive approach employing response surface methodology and artificial neural network models. J. Membr. Sci. 2024, 704, 122883. [Google Scholar] [CrossRef] [Scilit]
  32. Najafi, P.; Aghaei, M. Real options analysis of desalination with solar photovoltaic energy systems: A least-squares stochastic perspective. Desalination 2024, 586, 117823. [Google Scholar] [CrossRef] [Scilit]
  33. Kalan, A.S.; Khuyinrud, M.B.; Jahangiri, F.; Ahmadi, R.; Mahboubi, A.; Lü, X.; Rosen, M.A. Thermodynamic analysis and performance enhancement of an integrated solar–geothermal polygeneration system using grey wolf optimization and LSTM-based forecasting with Monte Carlo uncertainty analysis: A case study on Tenerife Island. Appl. Energy 2025, 401, 126640. [Google Scholar] [CrossRef] [Scilit]
  34. Sanan, O.; Pertuz, G.; Winter, A.; Bessette, J. Mapping inland global solar desalination demand using updated global salinity dataset and geospatial multicriteria analysis. Desalination 2025, 617, 119355. [Google Scholar] [CrossRef] [Scilit]
  35. Aminpour, M.; Alaie, R.; Kardani, N.; Moridpour, S.; Nazem, M. Highly efficient reliability analysis of anisotropic heterogeneous slopes: Machine learning aided Monte Carlo method. Mach. Learn. 2022, 18, 3367–3389. [Google Scholar] [CrossRef] [Scilit]
  36. De Jaegher, B.; Larumbe, E.; De Schepper, W.; Verliefde, A.; Nopens, I. Colloidal fouling in electrodialysis: A neural differential equations model. Sep. Purif. Technol. 2020, 249, 116939. [Google Scholar] [CrossRef] [Scilit]
  37. Sadrzadeh, M.; Mohammadi, T.; Ivakpour, J.; Kasiri, N. Separation of lead ions from wastewater using electrodialysis: Comparing mathematical and neural network modeling. Chem. Eng. J. 2008, 144, 431–441. [Google Scholar] [CrossRef] [Scilit]
  38. Chindapan, N.; Sablani, S.S.; Chiewchan, N.; Devahastin, S. Modeling and optimization of electrodialytic desalination of fish sauce using artificial neural networks and genetic algorithm. Food Bioprocess Technol. 2013, 6, 2695–2707. [Google Scholar] [CrossRef] [Scilit]
  39. Wu, Y.-C.; Feng, J.-W. Development and application of artificial neural network. Wirel. Pers. Commun. 2017, 102, 1645–1656. [Google Scholar] [CrossRef] [Scilit]
  40. LeCun, Y.; Bengio, Y.; Hinton, G. Deep Learning. Nature 2015, 436, 521. [Google Scholar] [CrossRef] [Scilit]
  41. Goodfellow, I.; Bengio, Y.; Courville, A. Deep Learning; MIT Press: Cambridge, MA, USA, 2016. [Google Scholar] [CrossRef] [Scilit]
  42. Papadopoulos, A.I.; Giannakoudis, G.; Seferlis, P.; Voutetakis, S. Efficient design under uncertainty of renewable power generation systems using partitioning and regression in the course of optimization. Ind. Eng. Chem. Res. 2012, 51, 12862–12876. [Google Scholar] [CrossRef] [Scilit]
  43. Ipsakis, D.; Voutetakis, S.; Seferlis, P.; Stergiopoulos, F.; Elmasides, C. Power management strategies for a stand-alone power system using renewable energy sources and hydrogen storage. Int. J. Hydrogen Energy 2009, 34, 7081–7095. [Google Scholar] [CrossRef] [Scilit]
  44. Oré, D.G.; Pretell, V.H.; Pilco, A.W. Design of an autonomous photovoltaic system for desalination of groundwater by electrodialysis. J. Phys. Conf. Ser. 2022, 2180, 012020. [Google Scholar] [CrossRef] [Scilit]
  45. Kirkpatrick, S.; Gelatt, D.; Vecchi, M.P. Optimization by simulated annealing. Science 1983, 220, 4598. [Google Scholar] [CrossRef] [Scilit]
  46. Papadopoulos, A.I.; Linke, P. On the synthesis and optimization of liquid-liquid extraction processes using stochastic search methods. Comput. Chem. Eng. 2004, 28, 2391–2406. [Google Scholar] [CrossRef] [Scilit]
  47. Voutetaki, A.; Plakas, K.V.; Papadopoulos, A.I.; Bollas, D.; Parcharidis, S.; Seferlis, P. Pilot-scale separation of lead and sulfate ions from aqueous solutions using electrodialysis: Application and parameter optimization for the battery industry. J. Clean. Prod. 2023, 410, 137200. [Google Scholar] [CrossRef] [Scilit]
  48. EU 2020/2184; Directive (EU) 2020/2184 of the European Parliament and of the Council of 16 December 2020 on the Quality of Water Intended for Human Consumption (Recast). Official Journal of the European Union. 2020; Volume 63, L435. Available online: https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=OJ:L:2020:435:TOC (accessed on 25 August 2025).
  49. Sapna, S.; Tamilarasi, A.; Kumar, M.P. Backpropagation learning algorithm based on Levenberg Marquardt algorithm. Comp. Sci. Inform. Technol. 2012, 2, 393–398. [Google Scholar] [CrossRef] [Scilit]
  50. Kebede, A.A.; Kalogiannis, T.; Van Mierlo, J.; Berecibar, M. A comprehensive review of stationary energy storage devices for large scale renewable energy sources grind integration. Renew. Sustain. Energy Rev. 2022, 159, 112213. [Google Scholar] [CrossRef] [Scilit]
  51. Ipsakis, D.; Voutetakis, S.; Seferlis, P.; Stergiopoulos, F.; Papadopoulou, S.; Elmasides, C. The effect of the hysteresis band on power management strategies in a stand-alone power system. Energy 2008, 33, 1537–1550. [Google Scholar] [CrossRef] [Scilit]
  52. Shami, H.O.; Basem, A.; Al-Rubaye, A.H.; Sabzevari, K. A novel strategy to enhance power management in AC/DC hybrid microgrid usint virtual synchronous generator based interlinking converters integrated with energy storage system. Energy Rep. 2024, 12, 75–94. [Google Scholar] [CrossRef] [Scilit]
  53. European Commission. Annual Weather Data. Available online: https://re.jrc.ec.europa.eu/pvg_tools/en/#MR (accessed on 7 October 2025).
  54. Mohammadi, R.; Ramasamy, D.L.; Sillanpää, M. Enhancement of nitrate removal and recovery from municipal wastewater through single- and multi-batch electrodialysis: Process optimisation and energy consumption. Desalination 2021, 498, 114726. [Google Scholar] [CrossRef] [Scilit]
  55. Cybenko, G. Approximation by superpositions of a sigmoidal function. Math. Control Signals Syst. 1989, 2, 303–314. [Google Scholar] [CrossRef] [Scilit]
  56. Sheela, K.G.; Deepa, S.N. Review on methods to fix number of hidden neurons in neural networks. Math. Prob. Eng. 2013, 1, 425740. [Google Scholar] [CrossRef] [Scilit]
  57. Romano, Y.; Patterson, E.; Candès, E. Conformalized Quantile Regression. Adv. Neural Inf. Process. Syst. 2019, 32, 8613. [Google Scholar]
  58. Lei, J.; G’sell, M.; Rinaldo, A.; Tibshirani, R.J.; Wasserman, L. Distribution-free predictive inference for regression. J. Am. Stat. Assoc. 2018, 113, 1094–1111. [Google Scholar] [CrossRef] [Scilit]
  59. Ülker, H. Design and application of an artificial neural network controller imitating a multiple model predictive controller for stroke control of hydrostatic transmission. Machines 2025, 13, 778. [Google Scholar] [CrossRef] [Scilit]
  60. Hassanpour, H.; Corbett, B.; Mhaskar, P. Artificial neural network-based model predictive control using correlated data. Ind. Eng. Chem. Res. 2022, 61, 3075–3090. [Google Scholar] [CrossRef] [Scilit]
  61. Hopsort, G.; Cacciuttolo, Q.; Pasquier, D. Electrodialysis as a key operating unit in chemical processes: From lab to pilot scale of latest breakthroughs. Chem. Eng. J. 2024, 494, 153111. [Google Scholar] [CrossRef] [Scilit]
  62. Simões, C.; Vital, B.; Sleutels, T.; Saakes, M.; Brilman, W. Scaled-up multistage reverse electrodialysis pilot study with natural waters. Chem. Eng. J. 2022, 340, 138412. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.