## 4 Methodology
### TMR Routing Protocol
```
1:procedure 1: At OnBoard Unit
2: For OBU message:
3:if(\(type==emergency\)) then
4: assign weight = 1
5:else\(itype==normal\)
6: assign weight = 0
7:endif
8:endprocedure
9:procedure 2: At Roadside Unit
10: Check OBU Message
11:if(weight == 1) then
12: broadcast Message;
13:else!weight == 0
14: push Message (FIFO Queue)
15: send data message using TMR in Algorithm 3
16:endif
17:endprocedure
```  
**Algorithm 1** Message Handling  
```
1:procedure 1 At RSU: Upon receiving a message from a vehicle to be forwarded to another vehicle
2: Look Up routing table
3:if(path to destination == null) then
4: Produce RREQ (\(VID\))
5: Broadcast RREQ (\(VID\)) to all nodes (vehicles) in the range
6:else
7: Follow Algorithm 3
8:endif
9:endprocedure
10:procedure 2 at OBU and RSU: Receiving RREQ message
11: For each RREQ (VID) received
12:if(new VID == old VID) then
13: Drop RREQ
14:else
15: Add new VID to CRL
16:endif
17:endprocedure
18:procedure 3 at OBU: Receiving RREQ message
19:if(there is a path to the destination) then
20: Send RREP to the RSU
21: RTT is measured at the RSU
22:else
23: Broadcast RREQ (VID) to other neighboring nodes
24:endif
25:endprocedure
```  
**Algorithm 2** Routing Path Establishment```
1:at RSU:
2:While (RREP = true)!RREPs received from Algorithm 2
3:procedure 1: Calculating average \(RTT_{ij}\)
4:\(!RTT_{ij}\) received from Algorithm 2
5:\(RTT_{ia}=\frac{\sum_{j=1}^{n}RTT_{ij}}{n}\)
6:endprocedure
7:procedure 2 Path Selection
8:if\((RTT_{ij}>RTT_{ia})\)then
9: drop \(RTT_{ij}\) route
10:else
11: add \(RTT_{ij}\) into an array \(A[]\)
12: sort array \(A[]\) in an ascending order
13: update the routing table
14:endif
15: Send a message using a route with the minimum RTT in \(A[]\)
16:if\((timeout)\)then
17: send a message using a route with the next minimum RTT in \(A[]\)
18:endif
19:endprocedure
```

**Algorithm 3** TMR Routing Protocol

Time delay-based Single path Routing (TSR) protocol uses the same concept of the minimum RTT as TMR protocol, but it provides only a single path. In case of having a link failure, this protocol has to restart the route discovery process to find an alternative path in a similar way to the AODV protocol. OBU would send a message to RSU, which, in turn, will send the message as a broadcast (emergency) or unicast (normal message to a specific vehicle) [10] to another vehicle OBU. Figure 3 shows the frame format in the case of unicast transmission used with normal messages. The format mainly consists of six categories: Sequence, Type, Source ID, Destination ID, Timestamp, and Data. 1. Sequence number: It is the frame number that helps to avoid redundancy. 2. Type: This indicates the type of a message, i.e., emergency or normal message. 3. Source ID: This contains the sender's VID to inform the destination (OBU or RSU) from which ID the message is received, an acknowledgment is to be sent. 4. Destination ID: This contains the VID of the destination (OBU or RSU) to which the message should be sent. 5. Timestamp: It can be used in the priority ordering in the FIFO in case of normal messages. In addition, it can be used to reflect status, such as congestion on the road. 6. Data: This field holds the contents of a frame-like latitude, longitude, speed, direction, and the current time. 1. Latitude and Longitude: This field holds the exact location of the vehicle with specific latitude and longitude. 2. Speed: This field holds the speed of the sender's vehicle when the message is sent. 3. Direction: This field displays the direction in which the sender vehicle is moving. 4. Current Time: It displays the time at which the message is sent. Messages are transmitted using VID as the MAC sublayer addresses. TMR is used in the case of unicast transmission from the RSU to the OBU of a vehicle. ### TMR Routing Characteristics

Our algorithms filter those available paths to the final destination in which the instant RTT of a path should be less than or equal to the average RTT for a given route request.