## 2 System Model
### Calculation Model
#### 2.3.2 MEC Calculation Model  
When the task is offloaded to the MEC server for processing, data is first transmitted from the vehicle to the MEC server through V2R communication. The RSU is equipped with the MEC server. This part of the time is equal to the delay of the task to the RSU. It is then transmitted back to the vehicle after the MEC server has completed the calculation. Therefore, the delay is divided into transmission delay \(T_{i,up}^{m}\), execution delay \(T_{i,cal}^{m}\) and return delay \(T_{i,back}^{m}\):  
\[T_{i,up}^{m}=\frac{d_{i}}{R_{i}^{1}} \tag{6}\]  
\[T_{i,cal}^{m}=\frac{b_{i}}{f_{i}^{msc}} \tag{7}\]  
\[T_{i,back}^{m}=\frac{\lambda d_{i}}{R_{i}^{1}} \tag{8}\]  
where, \(f_{i}^{msc}\) represents the computing resources allocated from the MEC server to the vehicle for task offloading. \(\lambda\) is the output data volume factor, which indicates the relationship between the output data volume and the input data volume.  
The total delay \(T_{i}^{mec}\) and total energy consumption \(E_{i}^{mec}\) of offloading tasks from the mobile vehicle to the MEC server are as follows:  
\[T_{i}^{mec}=T_{i,up}^{m}+T_{i,cal}^{m}+T_{i,back}^{m} \tag{9}\]  
\[E_{i}^{mec}=T_{i,up}^{m}P_{i}^{up}+\left(T_{i,cal}^{m}+T_{i,back}^{m}\right)P_ {mec} \tag{10}\]  
where, \(P_{i}^{up}\) represents the power of the mobile vehicle to upload the task, and \(P_{mec}\) represents the device power of the mobile edge computing servers.2.3.3. Cloud server computing model.  
The mobile vehicle is connected to the cloud server by fiber optics, through which the tasks are transferred [17]. Therefore, the delay in offloading the task to the cloud server can be divided into three parts: the computation delay of the task in the cloud server; the transmission delay of the task to the RSU; and the return delay of the computation result from the RSU to the vehicle. In this case, let \(T_{i,cal}^{y}\) represent the calculation time of the task in the Cloud Server, \(T_{i,up}^{y}\) represent the transmission delay of the task to RSU, \(T_{i,back}^{y}\) represent the return delay of the calculation result from RSU to the mobile vehicle, and average computing tasks on the fiber-optic transmission waiting for time delay for \(T_{cloud}\), \(T_{i}^{cloud}\) represents the task of moving vehicle offloading of the total delay of the cloud, \(E_{i}^{cloud}\) represents the total energy consumption of moving tasks from the vehicle to the cloud server.  
\[T_{i,cal}^{y}=\frac{b_{i}}{f_{i}^{cloud}} \tag{11}\]  
\[T_{i,up}^{y}=\frac{d_{i}}{R_{i}^{1}} \tag{12}\]  
\[T_{i,back}^{y}=\frac{\lambda d_{i}}{R_{i}^{1}} \tag{13}\]  
\[T_{i}^{cloud}=T_{i,cal}^{y}+\left(T_{i,up}^{y}+T_{cloud}\right)+\left(T_{i,back }^{y}+T_{cloud}\right) \tag{14}\]  
\[E_{i}^{cloud}=T_{i,cal}^{y}P_{cloud}+T_{i,up}^{y}P_{i}^{up}+T_{i,back}^{y}P_{ i}^{up}P_{RSU} \tag{15}\]  
where, \(f_{i}^{cloud}\) represents the computing resources provided by the Cloud Server for mobile vehicles, \(P_{cloud}\) represents the device power of the cloud server, and \(P_{RSU}\) represents the transmission power of RSU.  
To sum up, the total time delay of the task calculation can be derived as Equation (16):  
\[T=\sum_{i=1}^{n}\left(T_{i}^{c}+T_{i}^{mec}+T_{i}^{cloud}\right) \tag{16}\]  
Similarly, the total energy consumption of the task computation is Equation (17):  
\[E=\sum_{i=1}^{n}\left(E_{i}^{c}+E_{i}^{mec}+E_{i}^{cloud}\right) \tag{17}\]