The characteristic mobility and related synthesized trajectories of a batch of EVs may pose great impact on the energy consumption and charging demand, and then are key to the trustworthiness of the EV charging simulation. Moreover, in order to make the journey of EVs more realistic, we introduce agenda model to the mobility model based on public daily traffic survey data. The events in the agenda are generated on a random basis in time and space, described as event start time, deadline, dwell time, queuing time, service time, leaving time, patronage frequency, service type, location, accommodating population, priority, and profits, etc. For example, an EV driver may go to a small restaurant near working place at 11:00–12:00 for 2–4 times every week with medium priority and has lunch there for about 40 min after 10 min of ordering and waiting. Event generator inserts a task item into the EV’s agenda list with randomly varied properties based on the event description. The EVs execute the task according to the current status of task load and energy budget. If the EVs are available at that time without other higher priority tasks such as charging and repairing to handle, it navigates there and detains for certain time before it picks up the next task to execute. In this event-driven process, the EVs create time series behaviors and generate continuous and realistic trajectory as a EV may behave in the real world.

To reflect the variety of EVs’ behavior, we define six types of agenda templates to reflect different typical travel patterns such as travel patterns of routine prone, shopping prone, weekend prone, night shift prone, busy prone, and lazy prone. All the modeled EVs have presumed agenda to follow and drive to a series of points of interest in the simulation while satisfying the energy budget constraint by periodical charging. The mobility and the charging schedule of EVs impose correspondent impact to the daily traffic and charging demand on the charging piles. By simulating traffic and charging load in a large scale of interconnected EVs, we can evaluate the performance of different proposed algorithms of charging scheduling and charging pile deployments.

- 2.
Motion synthesis model

In this paper, we introduce a fine controlled motion synthesis method to simulate the moving process of EVs. We model the EV’s motion as how EVs are controlled and operated by a driver on moving [8, 10]. The motion synthesis model abstracts the primitive motions of EVs as time series behavior such as steering, accelerating, and braking. This microscopic mobility model delivers a convincing trajectory with more practical and accurate mileage and energy consumption. Each EV is modeled as visual object with physical and geometric properties such as vehicle body size, current moving direction, and orientation (the orientation of the head of vehicle). Each EV is assigned with operation and motion parameters such as steer angel and range, speed, and acceleration for the monitoring of EV safety [11, 12]. The mobility of the dynamic moving is controlled by basic operations of EVs such as steering, braking, and accelerating. The time varied position of an EV is expressed as function of these operation parameters.

In the motion synthesis model, to get accurate trajectory of EVs, the space coordination system should be mapped between device screen and the real field of scenario [13,14,15]. The time coordination system should be mapped between computer system time and the time of scenario to be simulated. Let λ be the space scale and τ be the time scale. λ denotes the amount of scenario miles that are mapped to a computer screen pixel, and with the unit of mile/pixel. τ denotes the amount of scenario hours that are mapped to a computer millisecond, and with the unit of h/ms. Then the speed of EVs can be denoted as moving speed of EVs on screen. The vehicle velocity *v* in unit of mile/h can be mapped to screen speed *s* in unit pixel/s with a transmission ratio of τ/λ. We have *s* = *v*∙τ/λ [16]. For example, given *τ* = 0.001(1 computer second for 1 h in simulated scenario), and *λ* = 0.3 (1 computer pixel for 0.3 mile in simulated scenario), speed of 30 mile/h can be mapped to screen speed of 30 × τ/λ = 10 pixel/s.

To simulate the moving process of EVs, the dynamic position and direction of EVs should be calculated according to the mobility parameter and the EV profile [17]. Given the position of EV at time *t* is (*x*, *y*), the position and direction of EV at *t* + ∆*t* (∆*t* is the interval slot of refreshing) can be obtained by a parametric equation as follows [18]:

$$ \Big\{{\displaystyle \begin{array}{c}x\hbox{'}=x+v\cdot \frac{\tau }{\lambda}\cdot \varDelta t\cdot \cos \left(\uptheta \cdot \frac{\pi }{180}\right)\\ {}y\hbox{'}=x+v\cdot \frac{\tau }{\lambda}\cdot \varDelta t\cdot \sin \left(\uptheta \cdot \frac{\pi }{180}\right)\end{array}} $$

(1)

where *x*′ and *y*′ is the coordinate of EV after next refresh time slot given the current position (*x*, *y*).

As to the vehicle direction and orientation angle θ in degree, it also varies as moving with certain vehicle wheel steer angle *α* in degree. Let θ′ be the vehicle direction angle at time at *t* + ∆*t*.

If the vehicle moves with fixed wheel steer angle *α*, the vehicle of cause moves in a circle with a steering radius *R*. Let vehicle body length be *L*, if the steer angle *α* is 0, the vehicle drives straight and the *R* is ∞, and if the *α* is ± *π*/2 or ± 90°, the front wheels are vertical to the vehicle body, the vehicle drives in a circle with *R* equal to *L*. Assuming the angular velocity (in radian) is ω, and *α* is kept the same during ∆*t*, the change of vehicle orientation after ∆*t* is correspondent to the arc angle between the point (*x*, *y*) and (*x*′, *y′*), i.e. \( \varDelta \uptheta =\upomega \varDelta \mathrm{t}\frac{180}{\pi } \) in degree. We have \( \uptheta \hbox{'}=\uptheta +\upomega \varDelta \mathrm{t}\frac{180}{\pi } \)

As \( \upomega =\frac{S}{R} \), where steering radius *R* is related to the vehicle body length and vehicle wheel steer angle *α* . Then we have \( {\uptheta}^{\prime }=\uptheta +v\bullet \frac{\tau }{R\lambda}\Delta t \) \( \frac{180}{\pi } \).

So we can present the radius as *R* = *L*/sin\( \left(\alpha \bullet \frac{\uppi}{180}\right) \), and we have:

$$ \uptheta \hbox{'}=\uptheta +v\cdot \frac{\tau }{\lambda}\cdot \varDelta t\cdot \sin \left(\alpha \cdot \frac{\pi }{180}\right)\cdot \frac{180}{\pi } $$

(2)

The velocity of the EV is also time-varying and the vehicle velocity *v* can be calculated as:

$$ v\hbox{'}=v+\varDelta t\cdot A $$

(3)

where *A* is the acceleration of EV.

During moving, the EVs adjust the steer wheel and change acceleration dynamically, the mobility model can calculate and update the time-varying position and orientation of vehicle according to Eqs. (1), (2), (3). An EV then can move from current position to a new position on screen at a fine updating interval and generate smooth and realistic trajectory. The time series behavior of an EV is the basis of traffic generation in the simulation of a large-scale charging scenario. Due to the mathematical simplicity of the approach and the fact that relatively few control parameters are required, the motion synthesis model is easy to be used in simulation platform and can achieve high performance especially in scenarios with large scale of EVs [19].

In the simulation, when an EV is assigned to a task according to the travel agenda model, the EV is navigated automatically to the destination related to the task. A direct and straight way to approaching to the target is U-Turn algorithm. In this algorithm, when EV is assigned to a new target, it adjusts its orientation to the direction pointing to the target. The adjustment of orientation can be achieved by resetting the orientation angle forcedly, or by adjusting the previous angle to the final angle pointing to the targets bit by bit by steering the wheel with certain angle. Reset of the orientation is simple to realize, but the trajectory of EV shows as a straight line from the current location to the designation [20,21,22].

The straight trajectory is not realistic and may cause inaccurate mileage. So we choose to adjust the orientation angle by steering the wheel with smooth operation. We calculate the difference between the current orientation angle and the correct orientation angle that is aiming to the target. Then EVs steer to the right or left by a fine wheel angle bit by bit with corresponding adjustment value, and EVs keep steering for a certain amount of time, and EVs arrive at a new position with updated orientation angle which can be obtained according to the Eq. (2). The EVs repeat this procedure until they aim to the right orientation and approaches the destination.

Figure 1a shows the synthesized trajectories of a batch of EVs evacuating from the same source site to different destinations by the proposed mobility model. Instead of just adjusting the EV direction to the target and drive straight to the target, we use more realistic and less radical navigation method. In Fig.1b, the mobility model is used to simulate the traffic flow in a scenario of signalized flat intersection. The EVs follow the respective lanes of the road, by adjusting the angle smoothly, digital twin EV can keep realistic trajectory during marching in queue as how the real EV does.

The route choice model used in the navigation is gravity-based attraction algorithm, where the EVs steer the wheel smoothly and approach the target gradually [23]. The trajectories of EVs are more smooth and then more realistic compared with other mobility models. As to the navigation algorithms, the EV may choose the path to approaching the target or destination according to different matrices and strategies.

### 3.1 Modeling of charging pile

Accompanying to the digital twin modeling of discharging process of EVs, the digital twin of the charging pile is also needed to simulate the charging process of EV. The digital twin of charging pile is modeled with a certain number of plug-in electric connectors with different geographical, physical, and electrical parameters, such as GPS location, type of plugs, charging voltage, current, temperature, price, and power.

The energy exchanging conducts according to the constraints of the BMS (Battery Management System) and charging profiles of EVs and piles. What’s more, the quality of a charging service such as charging speed, number of plugs, capacity of parking lot, availability of pile, waiting time, waiting queue line, and charging frequency may vary dynamically and should be considered when EVs make charging plan. With the communication capacity provided by the smart grid and VANET, the charging pile can negotiate with an EV based on these running data. It can also sense the distribution of nearby EVs and their charging demands [24,25,26]. Charging pile may advertise the quality and availability of service to the EVs which can make decision of charging choice to eliminate the waste of time and energy in case of choosing another pile due to capacity limit and profile mismatch. When an EV chooses to drive to the charging pile, the charging scheduler may prepare the preserved matched pile and correspondent power load budget according to the physical and electrical profile of the given vehicle type [27]. The request reserved renegotiation procedure eliminates possibility of the denies of service for the incoming request due to limited resource such as power and related service infrastructure.

### 3.2 Route choice model in task processing

Each EV is assigned to an agenda template to simulate travel demand patterns according to the travel agenda model. We select 17 types of most typical interesting sites (such as office, park yard, bank, medical center, school, and restaurant) to construct the events pool according to spatially distributed travel demand [2, 28]. The event site is randomly dropped on the map at specific event occurrence intensity. The density and distribution of the events can be configured to reflect the difference in commercial and administrative prosperity of different areas and sections in the simulation scenarios.

The events or tasks can be seen as dynamically created time series data with time and special property to simulate the time-varying travel demands of EVs (Fig. 2). When EVs approach the event site assigned by the agenda, EVs may dwell there for certain period of time to simulate the parking or charging activities before driving to the next task. When the task is processed, bonus is scored by the EVs to calculate the activity intensity of EVs. EV repeats this task routine and generates trajectory according to the motion synthesis model. Energy consumption and supply model is responsible for updating the SOC of EVs and route choice model in charging makes charging decision during the task processing. The route choice model in task processing imposes simulated traffic flow to the scenarios and generates the charging demand by the travel mileage of EVs when it drives to different interesting sites according to the travel agenda model.

### 3.3 Route choice model in charging

Within route choice model in charging, we have three options. Firstly, we use the static pre-trip route choice models, where EVs are assumed to choose their route (from origin to destination) before departure according to information obtained or past experiences and do not switch routes or destination (target charging pile) while driving for charging. For in-route route choice models, travelers observe prevailing traffic conditions and quality of charging services as they travel, and make route choice decisions accordingly. EV may change their target charging pile during the trip adaptively [29]. In hybrid route choice models, travelers rely on both on pre-trip route decisions and in-trip decisions. They may find a better choice according to different conditions. Some travelers may decide to switch to an alternative route when receiving advertised guiding information from the smart grid.

In the simulation, we presume that all the EV initiate with a fixed energy level that is much higher than the critical level (with enough energy to drive to the nearest charging pile). A proper charging plan is important to help overcome range anxiety of EV driver, and avoid an EV battery running out of energy before a destination is reached. The charging scheduling model should confirm this safe energy status and make prompt and proper charging decisions. Our route choice model for charging considers three basic requirements to simulate this process of charging of EVs. EVs should decide when, where to charge, how long to charge, and where to go after charging.

As to the time point to toggle the route choice, there are several options. An EV may choose to go to charging pile whenever the SOC of EV approaches certain fixed threshold value which should be higher than the critical level. EV may also choose to charge whenever it approaches some charging pile which is within a close distance range (i.e., 1–2 miles) from the current location. Some EVs choose to charge on a regular time basis or choose to charge according to the random intend of EV drivers.

When an EV decides to go to charge, the next decision for the EV is where or which charging pile to choose. Distance, type of charging pile, service quality, and availability of pile should be taken into account respectively or associatively. Take short-distance-first policy as an example, the model can choose the nearest pile from the current location of an EV, or it may not go to charge right now but choose the pile which is nearest to the upcoming trajectory along the way to the next destinations according to the travel agenda model [30]. When certain charging pile is set as the target, the motion synthesis model navigates the EV to the destination.

The EV then decides how much energy to supply and how long or how much the charging process takes. The time and amount may vary due to the constraints such as time and budget limit, capacity, and policy of parking lots [31]. To simulate this process, the model provides 4 basic options for EVs. The most conservative option is to charge the minimal amount to keep the SOC above the critical level. EV may also choose to charge for a fixed amount of energy to simulate the regular consumption custom of EV driver. Some EV may choose to let the battery fully charged or to a certain fixed threshold. Route choice model demonstrates the variety in charging behavior of EVs in simulation.

When EV finishes charging, it may decide where to go after interruption of charging. Some policy may choose to return to the interrupted point where the EV detours to the charging pile while processing the daily tasks. EV may also not go back but continue to navigate to the next event site based on the current charging location. Different return policies may have different impact on the performance and efficiency of charging.

These multimodal decision-making policy of digital twin EV provides high freedom of motion in the charging process of EV and helps simulate the complex possible mobility pattern of EV in real world. The fine controlled digital twin EV model can increase the trustworthiness of the motion simulation of IoV.