## 2 Materials and Methods
### Electrical Analysis of a DLSC Charged or Discharged with a Voltage Source
When the DLSC is discharged through a voltage source, the following must also be fulfilled:  
\[u_{co}=E+R_{c}\cdot i=u-R\cdot i. \tag{8}\]  
Therefore, the value of the current will be the following:  
\[i=\frac{u-E}{R_{c}+R}. \tag{9}\]  
Substituting in (9) the value of the current obtained in (7) gives the following first-order differential equation of separate variables:  
Figure 1:0Assuming that at t = 0, the DLSC starts from a known internal voltage of value u (t = 0) = U\({}_{0}\) (in the case of the discharge, it is satisfied that U\({}_{0}\) > E), and separating the two variables of (10), it is given that:  
Figure 1:1  
By integrating (11), the following equality, where time is related to the value of internal voltage, is obtained:  
Figure 1:2  
During a charging process (E > U\({}_{0}\)), it will also be true that E \(\geq\) u, since the internal voltage can never exceed the value of the voltage source, and (12) would be equally valid. In order to simplify the mathematical development, two new constants, k\({}_{1}\) and k\({}_{2}\), will be defined:  
Figure 1:3  
Figure 1:4  
k\({}_{1}\) is measured in V\({}^{-1}\) and k\({}_{2}\) in s\({}^{-1}\). Both constants shall be considered positive. The sign of the voltage source, E, cannot be negative since all SCs, such as electrolytic capacitors, only admit one polarity. If E were negative, the SC could reach an internal voltage of u < 0 which would irreversibly damage it. By means of k\({}_{1}\) and k\({}_{2}\), (12) can be simplified as follows:  
Figure 1:5  
The equality obtained in (15) shows the relationship between the internal voltage, u, and the time, t. From this equation, it is possible to obtain the internal voltage as a function of time, u(t):  
Figure 1:6  
where W\({}_{0}\)(x) represents the main or superior branch of the Lambert W function which will be used in both charging (E \(\geq\) u) and discharging (E \(\leq\) u), as will be latter explained. E, k\({}_{1}\) and U\({}_{0}\) make it possible to define a new constant, k\({}_{3}\):  
Figure 1:7  
k\({}_{3}\) is dimensionless, positive at discharge (U\({}_{0}\) > E) and negative at charge (U\({}_{0}\) < E). The  
The expression of the variable g given in (19) is valid only for k\({}_{\rm c}>0\) (k\({}_{0}<1\)). To model a conventional capacitor of constant capacity by using (20) and entering the value k\({}_{0}=1\) would lead to an indeterminacy. However, it can be shown that the same function would be obtained by using the classical formulas without more than taking into account that:  
Figure 1:8  
By means of (9) and (20), the discharge current as a function of g is also obtained:  
Figure 1:9  
In the case of charging (E \(>\) u), it follows from (20) that the value of g will be negative, while during discharging, (u \(>\) E), g will always be positive. As in (22), the expression for the current supplied by the DLSC was presented, if E \(>\) u is satisfied, g will be negative, therefore the current will be absorbed by the DLSC. As mentioned above, only the main branch of the Lambert W function, W\({}_{0}\)(x), can be used. This restriction is caused by the fact that during a discharge, as time, t, increases, the argument x of the function W\({}_{0}\)(x), presented in (19), is positive (k\({}_{3}>0\)) and decreasing; for positive values of x, only the main branch of the function is defined (Figure 2). In this case, if time tends to infinity, the value of x will tend to zero; therefore, the value of g also tends to zero, so the internal voltage, u, will converge to the value of the voltage source E. During a charging process, since u \(<\) E, the argument of W\({}_{0}\)(x) will be negative (k\({}_{3}<0\)) and its absolute value will be decreasing. Consequently, as time increases, the absolute value \(|\)x\(|\) tends to zero, as do the functions W\({}_{0}\)(\(-|\)x\(|\)) and g, and again, the internal voltage, u, will converge to the value of E, which is what must happen.