## 3 The Model of the Dynamic Allocation of Parking Spaces
### Simulation Process Design  
In order to evaluate whether the model of the dynamic allocation of parking spaces can balance the utilization rate of parking spaces in different zones and improve drivers' degree of satisfaction, it is necessary to analyze the changes in parking spaces utilization conditions in the different zones before and after implementing the dynamic allocation of parking spaces. The data before from before the implementation of dynamic allocation adopts the parking lot data of Metro City on 27 March 2020. The vehicles' entry and departure time data are real, and there is a total of 553 data records. Through modelling the dynamic allocation of parking spaces, the parking spaces were reallocated to these vehicles. Finally, the parking demand characteristic indexes of zone A and B were compared to evaluate the effect of the model of the dynamic allocation of parking spaces. The simulation of the model of the dynamic allocation of parking spaces is written in C++, and the flow chart is shown in Figure 4. The specific process is as follows:  
1. Initializing parking spaces data  
(1) Parking spaces status matrix  
The structure of the parking spaces state matrix is: parking space number, left parking space number, right parking space number, zone to which the parking space belongs, distance between parking space, entrance and elevator. 1 The purpose of recording the left and right parking spaces is to dynamically query the occupancy of the parking spaces and calculate the index \"occupancy of parking spaces on both sides of parking space\". 2 Belonging zone: \"0\" represents zone A and \"1\" represents zone B. (2) Arrival and departure time schedules of parking spaces  
There are 553 datapoints of vehicles' arrival and departure, named T\({}_{\text{C}}\). The entry time and departure time of the vehicles are divided into two tables and sorted in ascending order. 2. Defining the counter \(m\), \(n=0\), and, respectively, recording the array number in the \"entering\" parking space table and the \"leaving\" parking space table. 3. As the status of the parking lot is affected by the entering vehicles and leaving vehicles, therefore, it is necessary to determine whether to deal with the entering vehicle or the leaving vehicle first. Comparing the entry time \(t_{m,entry}\) of the \(m\)th entering vehicle and the departure time \(t_{n,departure}\) of the \(n\)th leaving vehicle, the vehicle with the earliest time is processed preferentially. 4. If \(t_{m,entry}\leq t_{n,departure}\), invoking the user-defined function ADDIN, allocating a parking space for the \(m\)th entering vehicle. 1. Calculating the parking space spatial supply service level index of all parking spaces. The \"occupancy of parking spaces on both sides of parking space\" index is calculated according to Table 2. The \"distance between parking spaces and entrance and elevator \" is in parking spaces status matrix. We then use Equation (3) to calculate \"user optimal parking space\". 2. Calculating the zone parking occupancy index of zone A and B. 3. According to Equation (4), calculating the \"system optimal parking space\". 4. Finding the array number of \"system optimal parking space\", updating the plate number and entry time in this array, which is equivalent to allocating the \(m\)th entry vehicle into the parking space. 5. Calculating the average parking interval time, which is used to evaluate the optimization effect. The parking interval time is the difference between the entry time of the newly allocated vehicle and the departure time of the front vehicle. The average parking interval time = the total parking interval time/interval times. 6. Calculating the turnover number, which is used to evaluate the optimization effect: turnover number + 1. 7. Entering the next entry vehicle: \(m\)++. 5. If \(t_{n,departure}<t_{m,entry}\), the \(n\)th departure vehicle will be processed and the user-defined function ADDOUT will be invoked. 1.