## 4 Model
### Vehicular Communication Model  
The data packets of the CM must be forwarded to the CH. Then, the CH selects the communication method to send the packets according to the QoS requirements of the packets. If C-V2X is selected, the CH directly sends the data packet to the nearby cellular network base station (BS); otherwise, the packet is sent to the next node according to the VANET routing path until the packet is sent to the RSU. Last, the packet is sent to the edge server by the BS or RSU. Although through the CH, relay forwarding the packets adds extra delay, it is easier to optimize the network and reduce the overhead of communication resources [19]. If all data packets are sent through the cellular network, it will lead to a large increase in the communication cost for network users and increase the burden on the cellular network. Therefore, we combine DSRC and C-V2X communication methods in one framework and consider the balance between QoS and user communication costs in the following modeling. First, we introduce the decision variable \(\theta_{ik}\), its meaning is:  
\[\theta_{ik}=\left\{ \begin{array}{ll}0,\text{use VANETs send $k$-th packet of $a_{i}$}\\ 1,\text{use C-V2X send $k$-th packet of $a_{i}$}\end{array} \right. \tag{4}\]  
We use \(\mathcal{B}_{i}=\{b_{1},b_{2},\dots,b_{k},\dots\}\) to represent the data packet buffer of \(a_{i}\), where \(b_{k},k\in\{1,2,\dots\}\) is the \(k\)-th packet in \(\mathcal{B}_{i}\). In the following, we denote \(b_{k}\) in \(\mathcal{B}_{i}\) by \(b_{ik}\). Moreover, \(\theta_{ik}\) is used to represent how \(b_{ik}\) is sent. When \(\theta_{ik}\) is equal to 1, it means that VANET is used to send \(b_{ik}\); when \(\theta_{ik}\) is equal to 0, it means that C-V2X is used to send \(b_{ik}\). To balance the QoS and the user's communication cost, we next model the total delay and total communication cost generated in the service domain per unit time. In the service domain, the delay is partly caused by packets sent via VANETs and partly by packets sent via C-V2X. Therefore, the total delay should be the sum of these two parts. No matter which part of the delay, it is composed of the following four types: processing delay, queuing delay, transmission delay, and propagation delay. As the propagation delay is extremely short, it is ignored in this paper. The transmission delay can be calculated by dividing the packet size by the data transmission rate. We used \(S_{ik}\) to represent the size of \(b_{ik}\), \(f^{CV2X}\) to represent the data transmission rate of C-V2X, and \(f^{DSRC}\) to represent the data transmission rate of VANETs. In addition, we measure the processing delay and forwarding delay with the time interval from when a data packet enters \(\mathcal{B}_{i}\) to when the data packet is sent from \(\mathcal{B}_{i}\), and call it forwarding delay. \(q_{ik}^{CV2X}\) represents the C-V2X forwarding delay of \(b_{ik}\), and \(q_{ik}^{m}\) represents the forwarding delay generated when \(b_{ik}\) is forwarded by the \(m\)-th node in \(Path_{i}\). \(Path_{i}\) represents the routing path of VANET from \(a_{i}\) to RSU. Different packets have different QoS requirements. Packets with high QoS usually require lower transmission delays, so they should also be forwarded preferentially to reduce their forwarding delays, so we multiply the forwarding delay of each packet by a weight. \(w_{ik}\) is the weight of \(b_{ik}\), and its calculation formula is as follows:  
\[\omega_{ik}=2\times\left[1-\left(\frac{l^{max}-l_{ik}}{l^{max}-l^{min}}\right)\right] \tag{5}\]  
where \(l_{ik}\) represents the maximum delay allowed for \(b_{ik}\), which is the maximum time allowed from the start of the packet generation to the time the packet is sent to the RSU/BS. \(l_{ik}\) will subtract the elapsed time in real time after the data packets are generated, which will ensure that the data packets with lower QoS requirements can also be processed in time. \(\left[l^{min},l^{max}\right]\) is the value range of \(l_{ik}\).