## 3 Mathematical Modeling Formulation
### Modeling of Battery Swapping Station
Hence, referring to Figure 5, the probability coefficient of power consumption in an electric vehicle charging station can be derived as follows from Equations (3) and (4) [25]:  
\[P_{N}=\frac{\left(\frac{\zeta\rho}{N}\right)^{N}}{N!}\Bigg{/}\left(\sum_{i=0}^{ c}\frac{1}{i!}\bigg{(}\frac{\lambda}{\mu}\bigg{)}^{i}+\sum_{j=c+1}^{N}\frac{1}{c^{j -c}\cdot c!}\bigg{(}\frac{\lambda}{\mu}\bigg{)}^{j}\right)\quad:N<c \tag{3}\]  
\[P_{N}=\frac{\left(\frac{\zeta\rho}{c}\right)^{c}\cdot(N-c)}{c!}\Bigg{/}\left( \sum_{i=0}^{c}\frac{1}{i!}\bigg{(}\frac{\lambda}{\mu}\bigg{)}^{i}+\sum_{j=c+1}^ {N}\frac{1}{c^{j-c}\cdot\frac{1}{c!}\cdot\bigg{(}\frac{\lambda}{\mu}\bigg{)}^{ j}\right)\quad:N<c \tag{4}\]  
In Equations (3) and (4), the following are used:  
\(P_{N}\) represents the probability coefficient of power consumption in an electric vehicle charging station. \(\lambda\) denotes the success rate of a vehicle in accessing the charging converter. \(\mu\) signifies the success rate of a vehicle in completing its battery charging. \(\rho\)=\(\lambda/\mu c\) stands for the number of charging stations for electric vehicles. \(C\) represents the number of BSSs for electric vehicles. Hence, utilizing Equations (2) through (4), the potential power consumption of a charging station can be reformulated as Equation (5):  
\[P_{EV,N}^{total}=P_{EV}^{total}\times P_{N} \tag{5}\]  
On the other hand, the operational characteristics dictating the functionality of a BSS are subject to numerous factors. These factors encompass the configuration of battery units, the duration of backup power, temperature conditions, battery longevity, depth of discharge, stipulated power reserves, and the extent of renewable energy integration into the grid, among other variables. Therefore, it becomes imperative to intricately model the charging and discharging processes of vehicle batteries within charging stations, a detailed representation of which is provided in reference [26] as follows:  
\[P_{BSS}(t)=P_{ch}(t)\quad:\text{if }\{\sum P_{G}(t)-P_{D}(t)\}\geq 0. \tag{6}\]  
Figure 3:0  
where \(P_{\text{BSS}}\) (t), \(\sum P_{G(t)}\), and \(P_{D(t)}\) are the powers of BSS, total generation of the system, and load demand, respectively. Furthermore, \(P_{ch(t)}\) and \(P_{dis(t)}\) are charging and discharging powers of BSS. Essentially, a BSS unit can function in only one mode at a time, either charging or discharging. The computation for the power of the BSS during the charging phase is outlined as follows:  
Figure 3:1  
Figure 3:2  
For the discharging state,  
Figure 3:3  
Figure 3:4  
where in the above equations \(SOC(t)\), \(E_{ch}(t)\), \(E_{dis}(t)\), \(\sigma\), \(\eta_{\text{ch}}\), \(\eta_{\text{dis}}\), and \(\eta_{\text{Conv}}\) represent the battery's charge state, the amount of energy being charged, the amount of energy being discharged, the rate at which energy is self-discharged, the efficiency of charging and discharging processes, and the efficiency of the converter, respectively. The constraints outlined in Equations (12) and (13) are designed to regulate the energy level and the power involved in charging and discharging operations within the PSS. Furthermore, Equation (14) is implemented to ensure the consistency of the PSS's energy level throughout the scheduling horizon, guaranteeing that it remains unchanged from the beginning to the end of the specified timeframe. Figure 3:5  
Figure 3:6  
Figure 3:7  
The operating cost of the PSS (\(\text{C}_{\text{b}}\)w) units can be described as  
Figure 3:8  
where in Equation (15), \(C_{\text{rep, batt}}\), \(\eta_{\text{rt}}\), and \(C_{BSS}^{\text{constant}}\) represent the following parameters: the storage replacement cost, the round-trip efficiency of the storage, and the constant cost of the BSS, respectively.