## 6 Adapting MMS-DSR from MANETs to VANETs for Smart Cities  
To adapt the mathematical model discussed in Section 4 from MANETs to VANETs, it is necessary to consider the specific characteristics and requirements of VANETs. In particular, in mathematical formalization for VANETs we must incorporate additional parameters such as the Density of the Vehicles, the Distance of the Vehicle from the Destination, and the Trajectory of the Vehicle [35, 36]. These parameters are crucial for ensuring efficient and reliable routing in highly dynamic vehicular environments. **Vehicle Density (De)**: vehicle density measures the concentration of vehicles within a specific area of the network. It is a critical metric for evaluating network congestion, as high vehicle density can lead to increased communication delays and packet collisions. \[De(r,t)=\frac{\text{TNVA}}{\text{AS}} \tag{7}\]  
\(TNVA\) is the total number of vehicles in the area while \(AS\) is the area size. High vehicle density indicates potential congestion, which can negatively impact communication reliability and latency. Understanding vehicle density helps in optimizing routing decisions to avoid congested areas and improve overall network performance. **Vehicle Distance (Di)**: vehicle distance is the Euclidean distance of the vehicle in the route from the destination. \[Di(r,t)=\exp\left(-\left(\frac{d_{\text{i}}}{d_{\text{ref}}}\right)^{\zeta}\right) \tag{8}\]  
where: \(d_{\text{i}}\) denotes the Euclidean distance of the vehicle from the destination, \(d_{\text{ref}}\) is a reference distance, \(\zeta\) is an attenuation factor. Vehicle distance provides insight into the potential longevity of communication links, allowing for better route stability. Routes with shorter distances to the destination are preferred, as they are likely to offer more reliable communication. **Vehicle Trajectory (T)**: vehicle trajectory measures the predicted path toward the destination for the vehicle in the route, considering its current and future positions. This metric helps in assessing the alignment of vehicle movements with the desired route. \[T(r,t)=\exp\left(-\left(\frac{\Delta d(t)^{\zeta}}{d_{\text{ref}}}\right)\right) \tag{9}\]  
\(\Delta d(t)^{\zeta}=d(t)^{\zeta}-d(0)^{\zeta}\), \(d(t)\) denotes the future distance of the vehicle in the route to the destination at time \(t\), \(d(0)\) is the current distance to the destination, \(d_{\text{ref}}\) is a reference distance, \(\zeta\) is an attenuation factor. Vehicle trajectory helps in predicting the future alignment of vehicles with the intended route, ensuring that the selected path remains optimal over time. Routes with stable trajectories are preferred as they minimize deviations and potential disruptions in communication. To predict the next position \((x_{i+1},y_{i+1})\) of the vehicle, we use the current velocity vector \((v_{x},v_{y})\) and the time interval \(\Delta t\):\[x_{i+1} =x_{i}+v_{x}\cdot\Delta t \tag{10}\] \[y_{i+1} =y_{i}+v_{y}\cdot\Delta t \tag{11}\]  
\((x_{i},y_{i})\) are the current coordinates of the vehicle, \(v_{x}\) and \(v_{y}\) are the velocity components in the x and y directions, respectively, and \(\Delta t\) is the time interval. The overall score for each route, \(S\), is computed as follows:  
\[ \begin{split} S(r,t)&=w_{1}\cdot\frac{1}{L(r,t)}+w_ {2}\cdot B(r,t)+w_{3}\cdot R(r,t)+w_{4}\cdot BE(r,t)\\ &\quad+w_{5}\cdot\frac{1}{De(r,t)}+w_{6}\cdot\frac{1}{Di(r,t)}+w _{7}\cdot\frac{1}{T(r,t)}\end{split}  \tag{12}\]  
Weights \(w_{1},w_{2},w_{3},w_{4},w_{5},w_{6}\), and \(w_{7}\) are referred to as latency, bandwidth, reliability, beamforming efficacy, density, distance, and trajectory, respectively.