Research on marginal cost model of electric vehicle charging and swapping facilities based on queuing theory

Research on the configuration of charging and switching facilities for electric vehicles is an important part of the development of related industries. In this paper, based on the analysis of charging behaviour of electric vehicles, the mathematical model is established by using queuing theory, and on this basis, the marginal cost theory of microeconomics is introduced to analyse the number of charging facilities under different utilization rates. The marginal cost model of charging and switching facilities is established with the objective of minimizing the total marginal cost of charging and switching facilities service system, and is verified by an actual example. The results show that through the rational allocation of the number of facilities, the marginal cost under different utilization rates can be optimized, which can provide strong support for decision makers to make operation plans and promote industrial development.


Introduction
According to the draft of New Energy Automobile Industry Development Plan (2021-2035) [1] issued in December 2019, has pointed out that electrification, networking, intellectualization and sharing are becoming the development trend of the automobile industry, and we will strive for that by 2030, the sales of new energy vehicles will account for more than 40% of the total sales of automobiles in that year; in view of the two bottlenecks of endurance mileage and supporting infrastructure construction that restrict the development of new energy vehicles, especially electric vehicles, we should vigorously promote the construction of charging and switching network and improve the service level of charging infrastructure.
Nowadays, the charging load of large-scale electric vehicles has brought great impact on the power grid [2] , but the controllable charging and energy storage characteristics of power battery in the switching mode will also provide new opportunities for the safe and economic operation of the power system, and many achievements have been made in the research of charging and switching facilities for electric vehicles. Reference [3] draws a reasonable conclusion that the service time of taxi in the charging station is normal distribution. Reference [4] shows that it is very difficult to calculate the charging load according to the classification of electric vehicles, so the road flow can be considered to convert the charging load. In reference [5], in order to strengthen the global optimization ability of the algorithm, the chaotic simulated annealing particle swarm optimization algorithm is used to solve the location model. Reference [6] realized the automatic optimization of the service range by using enhanced Tyson polygons combined with intelligent algorithms.
In this paper, the marginal cost theory of microeconomics is innovatively combined to find the optimal configuration of charging and swapping facilities for electric vehicles as the starting point of the goal, to construct a model that meets the charging and switching behavior of electric vehicles and its constraints, as well as the cost and marginal cost function involved in the model, and to study the marginal cost of facilities in the station. Finally, the optimal utilization and cost curve is used to verify the rationality and effectiveness of the model design, which provides a theoretical reference for the planning and configuration of electric vehicle charging station facilities.

Electric Vehicle Charging Queuing Model Design
Modern queuing theory was proposed by A. K. Erlang, a Danish mathematician, in the early 19th Century. It was first used to solve the problem of connection congestion between communication equipment, and after decades of development, it has gradually integrated many new theories of different disciplines to make it more suitable for a wide range of queuing problems. The main feature of the queuing model is to obtain the statistical parameters of the utilization rate, queue length, residence time and other indicators through the induction and analysis of the arrival and departure status of service objects, so that researchers can use the rules to further adjust and improve the service system in order to meet the needs of customers.
According to the description of the queuing model, there is no restriction on the number of times that electric vehicles use charging and switching facilities in a day in reality, that is, and electric vehicles are allowed to enter the station repeatedly for charging and swapping operations, the number of users can be considered to be theoretically unlimited. In addition, the time and mode required for charging and swapping of electric vehicles are independent, and as long as there are still spare positions in the station, they can be allocated to any number of users. Above all, following assumptions are made for this model: (1) The rule for electric vehicles to accept charging and switching services is FIFS (first come first served); (2) the arrival of each electric vehicle at the charging station is random and independent; (3) The use of charging and switching facilities in the station is random and independent, that is, any electric vehicle can use any idle charging and switching equipment; (4) The number of times that the electric vehicle uses the charging and switching facilities every day is not set, so the user can return to the queue to queue again after service is done.
According to the above analysis, the state probability equilibrium equation of the queuing system can be obtained as follows: In the above formula, represents the user arrival rate, represents the average service rate, n represents the number of electric vehicles that are receiving charging and swapping services in the station, represents the probability that there are n electric vehicles in the station that are performing charging and replacing services, C represents the number of facilities that can provide charging and swapping services in the station, when 1≤n≤c, it means that there are electric vehicles in the current station, and there are still c-n vacancies; when n>c, it means that all c charging and swapping devices in the current station are serving, the service quota in the station is full, and there are still n-s electric vehicles in the queue, waiting for service.
And the queuing model of electric vehicle charging and switching also has the following constraints: (1) the probability constraint on average wait time of the user, which need to be greater than the probability required to achieve the average waiting time: 1 1 2 (2) the probability constraint on average dwell time of the user, which need to be great than the probability required by the average dwell time: (3) the constraint on user service time, which need to be be greater than the minimum service time: t 4 (4) the constraint on service intensity, which ensures that the system will not form an infinite queue: 1 5 In addition, the facilities in the charging station are also restricted by the charging capacity redundancy R 1 and the swapping capacity redundancy In the above formula, η means the overall load rate of charging facilities in the station, N means the charging facility capacity, n means the number of available charging ports for each set of charging facilities, P means the average charging power, φ means the minimum value of charging capacity redundancy, T means the daily working hours of the facility, m is the average number of times the charging port works per day, Q means the actual electricity consumption, and ω is the minimum value of redundancy for charging electric vehicles.
Through the above mathematical model and constraints, the basic parameters of the charging and swapping queue model for electric vehicles can be obtained as show as follow: (1) The probability that there is no one in the user queue: (2) The average length of the current user queue: ⁄ ! 1 9 (3) Current service intensity of charging and swapping facilities:

10
(4) The average utilization rate u of the facilities in the station is: 11

Analysis of facility cost and marginal cost
The marginal cost is the increment of the total cost brought by the increase of each unit of production in the short term. Because electric vehicle users have real-time requirements on the current charging rate of charging facilities, and due to the influence of geographical environment, electricity price cost and other factors, the utilization rate and service intensity of charging facilities in different time periods lead to fluctuations in their marginal costs, therefore, the analysis of marginal costs is an important method for the operation decision-making analysis of charging stations. In the field of economics and mathematics, its main calculation methods are:

C C 12
Where C represents the total cost and Q represents the quantity.
There are many sources of costs for companies in different industries. The main considerations for the operation of the charging and replacement power station are mainly composed of the initial land acquisition cost, construction cost, purchase cost of in-station facilities, salary cost, electricity cost, maintenance cost, and other service costs C s ; because the model is a M/M/N queuing model, so It is only need to consider the waiting cost C w caused by the user waiting, so the total cost can be roughly divided into the investment and construction cost C I , the service cost C s and the user waiting cost C w , which means: C 13 The investment cost C I in the above formula is a fixed value and can be regarded as a constant: Where F(n) is the construction investment cost of each charging and swapping facility in the station, and it is a function of the total number of charging and swapping facilities, r0 is the depreciation rate, and y is the useful life of the charging and swapping facility.
In the meantime, the service cost C s of the station facilities can be quantified as: 15 Where A represents the total service cost required for each unit of charging and swapping facilities, and c represents the total number of facilities in the station that can be used for charging and swapping services; Similarly, the user waiting cost C w can be quantified as: 16 Where B represents the total waiting cost required for each user to use the charging and swapping facilities, and is given in table 1, which represents the expected number of people currently queuing. So combining the definition of marginal cost, we can know that the marginal cost model of electric vehicle charging and swapping facilities is: And the goal of the model is to obtain the optimal capacity c * and the optimal facility utilization u * when the service cost is equal to the user's waiting cost.

Model Solution
For the convenience of qualitative analysis, it is assumed that the redundancy of the charging and swapping capacity and the redundancy of the charging and swapping power meet the constraints during the calculation process, and set the full service cost factor A required for each unit of the charging and swapping facility and the total waiting cost factor B required for charging and replacing facilities both as 1.
We use R language to build the model, the overall pseudo code of the program is as follows: Step 1. Increase the average utilization rate u from 1 to 100; Step 2. Increase the capacity c of the station facilities from the minimum number of facilities allowed to 1000; Step 3. Calculate the L q and the corresponding C w corresponding to each of the u and c values above; Step 4. Calculate the corresponding C w ' Step 5. Draw the relationship curve of C w , C w '; Step 6. Perform exponential fitting to C w in the form of me nc ; Step 7. Calculate c* and the corresponding optimal utilization rate u*; Step 8. Draw the relationship curve between c* and u* After the above 8 steps, several sets of relationship curves can be obtained for further analysis

Analysis of result
(1) The relationship curve between waiting cost and marginal waiting cost As can be seen from Figure 1, with the increase in the number of facilities, on the one hand, the waiting cost of users will decrease in an approximate exponential trend. On the other hand, the waiting marginal cost is proportional to the queue length,which means the increase number of facilities will lead to a rapid decline in waiting costs and waiting marginal costs.
(2) The relationship curve between marginal cost and service intensity It can be seen from the Figure 2 that when the number of facilities in the station is constant, as the service intensity increases, the waiting cost of users will also increase to a certain extent, which means when the user arrival rate increases or the service capacity decreases, the average utilization rate of the facility also increases. The performance of this model is in full compliance with the fact that these factors will affect the optimal capacity, which proves the correctness of the assumptions and modeling so far. And as the definition of average utilization given, when the service intensity increases significantly, increasing the number of available facilities should be the operator's first choice. And for a given number of facilities c*, there is a unique optimal utilization rate u* corresponding to it.
(3) The relationship curve between average utilization rate u and facility capacity c Using the intersection of C w ' and C s ' in Figure 2, the optimal capacity c* and the corresponding optimal average utilization rate u* under different service intensities are obtained, and the point sets are connected to obtain Figure 3,which is very the optimal curve we want in this model.
Finally, as shown in the Figure 3, if the operating capacity of a charging and swapping station is higher than the optimal level c*, then the utilization rate of the station will drop for a certain period of time and at that time, the marginal service cost will be greater than the marginal waiting cost for users, which will not help decision makers to expand the scale of facilities. On the contrary, if the current facilities in the station are too few, less than the optimal number c* recommend, then the number of facilities should be increased,which means the average utilization rate will be reduced, but the additional costs and safety hazards caused by queuing during peak periods should be reduced too.

Conclusions
This paper analyzes the characteristics of the charging and swapping queue model of electric vehicles, and establishes marginal cost model of electric vehicle charging and swap facilities, then try to obtain the optimal curve of the model, finally analyze how to adjust the capacity of the station facilities in different situations to achieve the curve, verified the correctness and effectiveness of the model.
It has certain reference value for the operation planning and cost control of electric vehicle charging and swapping facilities that are currently urgently needed. In the future work, the model can be actually quoted based on the actual operating data of the relevant charging and swapping station, so as to accurately and modify some empirical parameters used in this essay. But it still needs to be pointed out that large-scale application of electric vehicle charging and swapping facilities is emerging and its uncontrolled impact on the power grid is still a hot issue of current research. How to ensure the safety and stability after the statins integrated into the power grid while ensuring the benefits and convenience of the electric vehicle charging and swapping station, still requires more in-depth research.