*3.1. Objective Function*

The objective function is to reduce the electricity purchase cost from the grid, keeping in mind that it will be more useful for the economic operation of the PL if the operator assigns the EVs to the chargers in an optimal manner considering the electricity price and charging limit. The objective function is to minimize the charging cost as given in Equation (1).

$$\mathbf{C}(t) = \sum\_{t=1}^{T} \left( \sum\_{i=1}^{NF} \mathbf{C}i(t)\mathbf{R}\_i + \sum\_{j=1}^{NM} \mathbf{C}j(t)\mathbf{R}\_j + \sum\_{k=1}^{NS} \mathbf{C}k(t)\mathbf{R}\_k \right) \tag{1}$$

where *C*(*t*) is the total purchase cost of electricity to charge all the EVs. *NF* is the number of fast chargers, *NM* is the number of medium chargers, and *NS* is the number of slow chargers. *T* is the total time to charge all EVs, which is calculated using Equation (2).

$$T = \sum\_{n=1}^{N} \left| \sum\_{i=1}^{NF} \left( \frac{V\_c^n - SOC(n)}{P\_{ifc}} \right) + \sum\_{j=1}^{NM} \left( \frac{V\_c^n - SOC(n)}{P\_{j\text{mc}}} \right) + \sum\_{k=1}^{NS} \left( \frac{V\_c^n - SOC(n)}{P\_{k\text{sc}}} \right) \right| \tag{2}$$

where *N* is the total number of vehicles, *V n c* is the rated power capacity of the EV, *SOC*(*n*) is the power left in the *n*th vehicle, *Pi f c*, *Pjmc* and *Pksc* are the rated charging power capacity of the fast, medium, and slow chargers.

The required power *R<sup>P</sup>* to charge the EV is calculated as follows:

$$R\_p = V\_c^n - \text{SOC}(n) \tag{3}$$

The charging time (*R*) to reach 100% *SOC* level is given in Equation (4).

$$R = \frac{R\_p}{P\_c} \tag{4}$$

where *P<sup>c</sup>* is the charger rated output power.

The charging cost of each EV is calculated using Equation (5).

$$\mathbf{C}(n) = \mathbb{R}\_p \times E\_c(t) \tag{5}$$

where *Ec*(*t*) is the electricity price at time *t*.

*3.2. Constraints*

The various constraints considered in the problem are given below. The battery of any EV that departs the PL should be charged to 100%, which is given in Equation (6).

$$\text{SOC}(n)^{\text{dep}} = \text{SOC}(n)^{\text{max}} \tag{6}$$

The proportion of the allocated power at any timeslot to an EV should be between 0.1 and 1 as given in Equation (7). Furthermore, to ensure that all the EVs are charged to 100% of the battery capacity, the sum of all proportion should be equal to 1. The allocated power should be within the limit of all the chargers' rated output as represented in Equation (8).

$$0 \le D\_{power(n)}^t \le 1\tag{7}$$

$$D\_{power}^t \le \mathcal{C}\_{power}^{\text{lim}} \tag{8}$$

The dynamic charging scheduling is first examined by the conventional FIFS method, and then the optimization techniques, PSO and SFLA, are used for minimizing the electricity purchase cost of the PL.

The non-booked EV can be allowed based on the two following conditions:


However, it should be noted that if these conditions are not satisfied, it will be considered an unwanted charging request for the PL operator. In such a case, the user has to decide whether to reduce the demand or extend the departure time.
