# I need help writing a simulation in Python.

I am trying to write a CSMA/CA protocol simulation in Python. Attached is a paper that is similar to what I am trying to do.

## Get Help With a similar task to - I need help writing a simulation in Python.

##### Additional Instructions:

Optimised CSMA/CA Protocol for Safety Messages in Vehicular Ad-Hoc Networks Giorgia V. Rossi and Kin K. Leung Department of Electrical and Electronic Engineering Imperial College London, United Kingdom Email: {giorgia.rossi12, kin.leung}@imperial.ac.uk Abstract—Vehicular ad-hoc networks (VANETs) that enable communication among vehicles have recently attracted signif- icant interest from researchers, due to the range of practical applications they can facilitate, particularly related to road safety. Despite the stringent performance requirements for such applications, the IEEE 802.11p standard still uses the carrier sensing medium access/collision avoidance (CSMA/CA) protocol. The latter when used in broadcast fashion employs a randomly selected backoff period from a fixed contention window (CW) range, which can cause performance degradation as a result of vehicular density changes. Concerns regarding the robustness and adaptiveness of protocols to support time-critical applica- tions have been raised, which motivate this work. This paper investigates how the maximum CW size can be optimised to enhance performance based on vehicular density. A stochastic model is developed to obtain the optimal maximum CW that can be integrated in an amended CSMA/CA protocol to maximise the single-hop throughput among adjacent vehicles. Simulations confirm our optimised protocol can greatly improve the channel throughput and transmission delay performance, when compared to the standardised CSMA/CA, to support safety application in VANETs. Index Terms—Vehicular Ad-Hoc Networks, Throughput, trans- mission probability, MAC layer, 802.11p, CSMA/CA, Contention Window. I. INTRODUCTION Vehicular ad-hoc networks (VANETs) are highly mobile wireless networks of vehicles that can communicate with each other without relying on permanent infrastructure, through a multi-hop ad-hoc connection [1], [2]. Consequently, VANETs enable a wide range of applications, even before considering the fact that they can also be integrated with cellular networks or other external infrastructure, such as unmanned aerial vehicles (UAVs) or cellular base stations as in Figure 1, to support hybrid networking [3], [4]. One of the most attractive benefits of VANETs is their capacity to drastically improve road safety, by means of exchanging safety information. In light of this, an allocated 75 MHz bandwidth at 5.9 GHz has been defined in the IEEE 802.11p (amendment of 802.11a) specifically for vehicle-to- vehicle (V2V) and vehicle-to-infrastructure (V2I) communica- tion. The standard defines the protocols for physical and MAC layers. In Europe, based on the IEEE 802.11p, the European Telecommunications Standards Institute (ETSI) designated a specific type of message to be broadcasted in a single hop employing the carrier sense multiple access with collision avoidance (CSMA/CA). Known as cooperative awareness messages (CAMs), they contain information relevant to safety related applications (i.e., speed and position), and are broad- casted as frequently as ten times per second to provide reliable support for safety applications that usually require low latency (as low as 100 ms) [5], [6], [7]. This is so each vehicle can constantly monitor the surrounding vehicles and infrastructure, allowing them to become aware of possible imminent threats, and to take rapid countermeasures such as sending warning messages to the drivers and neighbouring vehicles in such scenarios. Unfortunately, the medium-access-control (MAC) protocol in the IEEE 802.11p still makes use of carrier sense mecha- nisms. Specifically, the standard uses the enhanced distributed channel access (EDCA) that employs the CSMA/CA protocol. The latter, in broadcast based applications, is characterised by the lack of acknowledgment (ACK) packets required to identify a transmission collision and consequently adapts the maximum contention window (CW), which is doubled follow- ing each unsuccessful transmission attempt, and has to rely on a fixed, maximum CW size instead. Given the importance of vehicular communication applica- tions, the performance of broadcast MAC protocols has been thoroughly investigated. It has been shown that increasing ve- hicular density corresponds to decreasing performance [8], [9], [10]. In particular, the broadcast CSMA/CA performance and its behaviour under different scenarios has been investigated in [11], [12], [13]. The authors in [11], [12], [13] observe, by means of extensive simulation and analysis, that the IEEE 802.11p MAC tends to behave like the Aloha protocol as the vehicular density rises, meaning that the benefits of the sensing mechanism diminishes and the transmission process merely behaves like a random transmission technique. In light of this, VANETs may be particularly vulnerable to performance degradation due to vehicular density changes. Consequently, it is questionable whether the networks are robust enough to support stringent performance requirements, particularly for safety applications. Various solutions have been proposed to overcome the issues related to reliable broadcasting in VANETs [14], [15], [16]. For example, space division multiple access (SDMA) protocols assign different time slots relative to the vehicle location [14]. This implies that roads must be divided into segments, yet fairness can be difficult to maintain under fast changing vehicular densities that may characterize different Unmanned Aerial Vehicle Internet Cellular base station Fig. 1. Hybrid networking scenario: vehicles can communicate with other vehicles for safety or with UAVs and cellular base stations road segments at the same time. Another approach exploits the time division multiple access (TDMA) mechanism that assigns a transmission slot to a vehicle [15], [16]. Origi- nally designed to be used in a centralized fashion, vehicular networks require TDMA protocols to act in a distributed manner, which unfortunately is still not completely immune to the contention problem and can only accommodate a limited number of vehicles, given that the time slot will not be released as long as the vehicle has to transmit a packet (i.e., CAM messages have to be transmitted periodically from each vehicle). Hence, it seems reasonable to efficiently allocate transmission rights to various vehicles based on the current IEEE 802.11p MAC protocol, but by optimising the network performance according to the changing vehicle density. In [17], [18] the authors present approaches to choose the optimal transmission probability for the slotted Aloha and CSMA/CA based on the vehicular density in networks where vehicles arrive and are distributed according to a Poisson Point Process (PPP). However, realistic constraints, such as the size of the vehicles or the estimated number of neighbouring vehicles, are not considered in the analysis. In this paper we develop a stochastic model that accounts for realistic constraints, such as the practical vehicles size, in order to derive the optimal contention window for the CSMA/CA protocol based on the vehicular density. As a first step, to devise efficient MAC protocols for time-critical applications in VANETs, we establish the relation between the (fixed) maximum CW and the transmission probability. A model to evaluate the density-based optimal transmission probability in order to enhance the network throughput is presented and the optimal maximum CW is found. Finally, we integrate our results with the CSMA/CA protocol and present an optimised protocol that additionally accounts for the esti- mated number of surrounding vehicles. Extensive simulation shows the improved performance of the proposed protocol based on vehicular density when compared with the original IEEE 802.11p MAC protocol. Key contributions of this work include: • Enhancement of the communication model with realistic constraints such as the practical vehicle size (instead of treating each vehicle as a dimensionless point) in mod- elling vehicular flows and estimating vehicular density. • Derivation of the optimal maximum CW based on vehicle density, while considering the signal-to-interference ratio (SIR) and capture effect at receiving vehicles. • Integration of the optimal maximum CW with the CSMA/CA protocol to enhance the delay and throughput performance for CAM safety messages. The rest of the paper is organised as follows. Section II presents the network models, describing vehicle distribution, connectivity and throughput. Section III contains numerical results which illustrate the performance merits of the newly proposed CSMA/CA protocol with the maximum CW, which is optimally chosen according to the vehicle density, over the standardized protocol. Finally, conclusions are drawn in section VI. II. SYSTEM MODEL A. CSMA/CA broadcast model The IEEE 802.11p MAC protocol is designed to work over a synchronization interval (SI) of 100 ms, during which every vehicle switches between the control channel (CCH) and service channels (SCHs) for a CCH interval (CCI) and a SCH interval (SCI), respectively, such that SI = CCI + SCI. Specifically, the broadcast CSMA/CA for CAMs (i.e., safety messages) requires a 100 ms latency as well as a periodic message (packet) generation of 10 Hz for each vehicle. This means that a new packet is generated in every CCI (100 ms) for transmission. The states associated with the channel contention protocol over a single CCI are described in Figure 2. At the beginning of every CCI, all vehicles generate a new CAM (packet) for broadcast. For each packet, a backoff time is randomly selected from a fixed contention-window (CW) range of 0 to W - 1 slot times. The backoff time (counter) is then decremented every slot time when the channel is sensed idle. When the counter reaches 0, the vehicle transmits the packet. If the channel is determined to be busy, the counter is frozen. From the Markov model in Figure 2 and assuming that vehicles are able to carry out the backoff process correctly (e.g., no hidden node problem), the state transition probabilities are given byP {k|0} = 1 W , for k ∈ [0,W − 1] P {k − 1|k} = 1, for k ∈ [1,W − 1] (1) where state k represents the current value of the backoff counter on a vehicle. Therefore, let bk represent the probability that a vehicle is in state k. Figure 2 illustrates that every k state, or equivalently backoff value, can be directly selected with probability 1W , as shown in the first line of (1). It is additionally possible to reach a state k by sequentially decrementing the counter with probability 1, as in (1), after the 1 W W −1W − 21 21 1 1 1 1 1 W 1 W 1 W 1 W 0 Fig. 2. Markov model of CSMA/CA Broadcast in 802.11p for every CCI interval selection of a higher backoff value (Figure 2). In light of this, with reference to Figure 2, we can evaluate the probabilities of each state as follows bW−1 = 1 W b0 bW−2 = 1 W b0 + bW−1 bW−3 = 1 W b0 + bW−2 ... bW−i = 1 W b0 + bW−i+1 (2) where b0 represent the probability that the backoff counter is zero and consequently it represents the probability that a vehicle transmits in an idle slot. By introducing the change of variable W − i = k we can eventually express the probability bk as bk = (W − k) b0 W (3) The sum of all possible states probabilities has to be equal to 1. That is, W−1∑ k=0 bk = 1. (4) By substituting (3) into (4) and rearranging we obtain W−1∑ k=0 (W − k) = W b0 . (5) By a change of variable n = W − k and using the fact that N∑ n=1 n = N(N + 1) 2 , (6) the relation between the CW size and the probability b0 can be expressed as W = ⌊ 2 b0 − 1 ⌋ , (7) where b0 is the probability that a vehicle starts transmitting in an arbitrary free slot time and the flooring operation is applied because the CW must be an integer value, as specified in the protocol standards. B. Equivalence of the CSMA/CA Broadcast to Slotted Aloha To consider the CAM safety messages exchanged based on the ETSI standardisation, we focus on the MAC protocol operation over a single CCH interval, where the messages are generated once every CCI of 100 ms for each vehicle. In fact, each vehicle generates a CAM packet synchronously at the beginning of every CCI, resulting in a saturated traffic condition (i.e., every vehicle has a packet ready for trans- mission). According to the CSMA/CA protocol, each vehicle selects a random backoff period from the fixed contention window (CW) range of 0 to W-1. This is because in broadcast fashion ACKs are not used to determine whether a reference packet has been successfully received or not and hence the backoff period is always chosen in the same range. When a vehicle senses the channel idle during a slot time, its backoff counter is decremented by one. On the other hand, if the channel is sensed busy, due to either successful transmission or collision, the counter remains unchanged. When the backoff counter reaches zero for a vehicle, it will start to transmit its packet at the beginning of the next slot time without additional sensing. It follows that if two or more vehicles have picked the same backoff counter at the beginning of the CCI, this will eventually commence a simultaneous transmission, causing collisions and the loss of the packets. Due to the random selection of the backoff period and assuming perfect channel sensing by all vehicles, each vehicle that has a CAM packet to transmit, has the probability of b0 to transmit in an arbitrary idle slot time following the beginning of the CCH interval, as illustrated in Figure 2. When the channel is occupied by any transmission, either successful or collided, the busy channel does not change any backoff counter. Consequently, by focusing only on the idle slot time, the CSMA/CA for CAMs behaves in a way identical to that of slotted Aloha protocol, where vehicles have a probability b0 to transmit in an arbitrary time slot. Therefore the event of a vehicle transmitting is a random variable that can be described by a Bernoulli distribution expressed as f(ω, b0) = b ω 0 (1− b0)1−ω, for ω ∈ {0, 1}. (8) In the following, we shall derive the optimal value of b0 based on the vehicular density λ. This means that the optimal transmission probability can be expressed as a function of the density as b0(λ), and by substituting it in (7) we obtain the optimal maximum CW, W-1, to maximise the CSMA/CA throughput based on the vehicular density W = ⌊ 2 b0(λ) − 1 ⌋ . (9) Before continuing, we note that the transmission time T for a CAM is assumed to be constant, regardless of whether the transmission is successful (collision-free) or not, as given by T = TH + EP rd +AIFS + σ, (10) where TH and EP are the respective amount of time spent in transmitting the MAC header and the packet payload with a data rate rd. The signal propagation delay is denoted by σ, while the arbitration inter-frame spacing (AIFS) is the initial waiting period following every transmission. C. Inter-Vehicles Distance Distribution Model Let us consider the traffic source and its assumptions. A single-lane road with one traveling direction and infinite length is considered, as shown in Figure 3. This one-dimensional case can be helpful in obtaining valuable insight into increasingly complex scenarios. Vehicles are assumed to be located on the road according to a Poisson point process (PPP) with rate λ, which has been considered to be a good model to describe the physical distribution of vehicles on a road [17], [19], [20]. A limitation of a simple PPP is, however, the unrealistic assumption of vehicles as dimensionless points. In fact, the received power Pr is a function of the distance between a transmitter and a receiver and, hence, the dimension of the vehicles in the network clearly plays an important role in accounting for the signal and interference value. Therefore, in this paper we present a model that accounts for the size of the vehicles. Let us assume the vehicles have the same size z, then by the assumption of PPP, the random distance X between receivers mounted on adjacent vehicles on the single-lane roadway has a shifted exponential distribution with a probability density function (pdf) f(x) = λe −λ(x−z), x ≥ z 0. x < z (11) Note that the due to the PPP, distances between every two ad- jacent (neighbouring) vehicles are independent and identically distributed (i.i.d.) random variables. Using (11) we can model the distance between any two non-adjacent vehicles as the sum of shifted exponentially dis- tributed random variables. Therefore, the distance between any two non-adjacent vehicles follows a shifted Erlang distribution with pdf f(x) = λk (k − 1)! (x− kz)k−1e−λ(x−kz) x ≥ z, (12) where k − 1 is the number of vehicles placed between the two non-adjacent reference vehicles being considered and λ denotes the network vehicular density. Let us define N(r) as a random number of vehicles located within a given distance of r/2 metres in front of and behind a reference vehicle on the road. From (12), we have P (N(r/2)=k)=1− k−1∑ n=0 (λ(r/2−kz))ne−λ(r/2−kz) n! . (13) From (13), the expected value of the number of vehicles N(r) within distance r (i.e., at the back and front of the reference vehicle) can be obtained k̄ = E(N(r)) = λr 1 + λz , (14) where k̄ represents the number of neighbouring vehicles that can be estimated by the reference vehicle through sensing. The value of λ, which will be needed in determining the optimal probability b0(λ) and CW parameter in the following section, can hence be evaluated using (14) based on the estimation of the average number of neighbouring vehicles. D. Throughput Model VANETs can enable data packet exchange from one vehicle to another in a multi-hop fashion. However, in this work we focus on communication between two adjacent (neighbouring) vehicles traveling in the same direction, as this scenario is most relevant in the context of safety applications. Hence, we focus on whether the vehicle nj , immediately behind the transmitting vehicle ni, can receive a packet, as shown in Figure 3. Furthermore, the system is assumed to be interfer- ence limited; that is thermal noise is not considered in our model. The analysis is performed in the case of half duplex communication. Consequently, every vehicle is restricted to either transmitting or receiving a signal at any given moment, and is not capable of doing both simultaneously. Let us introduce the notion of communication range Rc. This is defined as the distance from a given reference vehicle within which a signal from a transmitting vehicle can be received at a power level greater than a specified threshold (commonly referred to as the receiver sensitivity) as illustrated in Figure 3. In this work, the communication range Rc is set to be identical for all vehicles within the network, as was done in [17], [20], [21], [22]. Connectivity Requirements: Two adjacent vehicles are con- sidered to be connected if two conditions are fulfilled. Firstly, the vehicles have to be within each other’s commu- nication range Rc, which is referred to as the event C, that is d(ni, nj) ≤ Rc. (15) Given that the distance between two adjacent vehicles is described by a shifted exponential distribution as seen in (11), the probability of event C, or equivalently that (15) is satisfied, becomes P (C) = 1− e−λ(Rc−z). (16) Secondly, the SIR of the signal received by vehicle nj from the transmitting vehicle ni has to exceed a predefined threshold γ, namely SIRi,j ≥ γ. (17) The SIR at the receiving vehicle nj when vehicle ni is transmitting in the presence of M interfering vehicles, is defined as follows SIRi,j = Pr(i,j)∑M k=1 IkPr(k,j) , (18) where Pr(i,j) denotes the received power at vehicle nj from ni. The expression at the denominator of (18) is the total interference power at the receiving vehicle, as seen in Figure 3, and Ik indicates whether vehicle nk is transmitting or not, taking the value of 1 with probability b0 or 0 with probability (1− b0). As previously mentioned in Section II - B, Ik can be represented as a Bernoulli variable and therefore be described by the probability mass function (pmf) in (8). Let us assume the signal attenuation is solely a function of the distance, with a power exponent α > 2, and every vehicle has the same transmission power Pt. In light of this, the received power Pr(i,j) at a reference vehicle nj is a function of the path loss α and the transmission power Pt and is formally expressed as Pr(i,j) = Pt(d(ni, nj)) −α with α > 2, (19) where d(ni, nj) denotes the distance between transmitter and receiver in metres. Inserting (19) into (18), the SIR require- ment expressed in (17) becomes Pt d(ni, nj)α ≥ γ M∑ k=1 IkPt d(nk, nj)α , (20) The expression in (20) does not allow a closed-form expression to be obtained for the performance metrics of interest. Never- theless, in [17], [18] it has been shown, by means of extensive simulation, that (20) can be effectively approximated by a set of M pairwise conditions for each kth vehicle, when analysing a vehicular scenario. By applying the same approximations presented and validated in [17], [18], (20) becomes d(nk, nj) ≥ IkRf ∀k, (21) where Rf represents the interference range within which vehicles may still interfere with the communication between ni and nj ; it is expressed as Rf = γ1/αRc. The condition expressed in (21) means that the distance d(nk, nj) between the interfering vehicle nk and the reference vehicle nj exceeds the distance between vehicles ni and nj (that at most can be as large as the communication range Rc) by a factor of γ1/α. The requirement in (21) can guarantee the successful reception of a packet in terms of SIR, when it is satisfied for all possible interfering k vehicles located in the network. We consider now the event Hk that a single interfering vehicle nk satisfies the condition in (21). Hk can only occur if either the vehicle nk is not transmitting (i.e., Ik = 0) or if it is true that d(nk, nj) ≥ Rf . Consequently, we obtain P (Hk)=P{Ik=0 ∨ (Ik=1 ∧ d(nk, nj) ≥ Rf )} . (22) Therefore, the interference condition in (21) is fulfilled for vehicle nk when the latter is located outside the interference range Rf from the receiving vehicle nj . To evaluate the probability in (22), we require information regarding the vehicle density in the vicinity, which can be estimated from the average number of neighbouring vehicles from (14). Next, let us define the event A that vehicle nk is located outside the interfering range Rf of vehicle nj . As given in (11), the distribution of the distances between adjacent vehicles is a shifted exponential. The distance between two non-adjacent vehicles is consequently described by a shifted Erlang distribution (12), where k−1 represents the number of vehicles between the non-adjacent vehicles. Combining this djk x0 Vehicle flow direction Communication traffic direction kL = 2 kL =1 kR = 3kR = 2 d(k, j) zPr (i, j) Interference = IkPr (k, j) k ∑ Rf Rc d(i, j) ni Segment SL Segment SR njnk Fig. 3. Road configuration and assumptions for the analytical model fact with the indexing scheme k for interfering vehicles as shown in Figure 3, the probability of event A occurring is P (A) = k−1∑ n=0 (λ(Rf − kz))n n! e−λ(Rf−kz) ∀k. (23) As a result of the access protocol assumption in (8), the probability that vehicle nk does not transmit is P (Ik = 0) = 1− b0. (24) Inserting (23) and (24) into (22), the probability of event Hk occurring becomes P (Hk)=1−b0 [ 1− ( k−1∑ n=0 (λ(Rf − kz))n n! e−λ(Rf−kz) )] . (25) The expression in (25) represent the probability of satisfying the interferer SIR condition (21) for a single vehicle nk. The scenario illustrated in Figure 3 shows that for every pair of adjacent vehicles ni and nj in the network, we can identify two separate road segments in front and behind the receiving vehicle nj , namely SL and SR. They represent regions where it is possible to find other vehicles that can interfere with the transmission between ni and nj . Let us define the event L that the requirement in (21) is verified for all possible interfering vehicles nk in the road segment SL, while R is the event that (21) is verified in region SR. By using (25), the probability of L is expressed as follows P (L) = ∏ k P (Hk). (26) Note that the probability of event R, for the road segment SR, is computed in a similar manner. Let us now define the event F in which the interference condition in (21) is satisfied for all possible interfering vehi- cles nk located on both road segments SL and SR, for the transmission from vehicle ni to nj . The probability that event F occurs, by using (26), thus becomes P (F )= ∏M k=1 [ (1−b0)+ ( b0 ∑k−1 n=0 (λ(Rf−kz))n n! e λ(Rf−kz) )]2 (1− b0) + b0eλ(Rf−z) . (27) Optimal Throughput: We define the data throughput Th, from the transmitting vehicle ni to its adjacent vehicle nj , as successful reception subject to satisfying the conditions expressed in (15) and (21). Note that due to the half-duplex mechanism assumption, this definition additionally includes the fact that vehicle ni is transmitting while its adjacent vehicle nj is not (i.e. it is receiving). The combination of all these factors yields Th = P {C ∧ F ∧ Ii = 1 ∧ Ij = 0 } . (28) Substituting (16), (24) and (27) into the above expression and expressing the interference range Rf in terms of communi- cation range Rc as Rf = γ1/αRc, the single-hop throughput from vehicle ni to its neighbouring vehicle nj becomes Th= M∏ k=1 [ 1−b0 ( 1− k−1∑ n=0 (λ(γ1/αRc−kz))n n! eλ(γ 1/αRc−kz) )]2 · (b0 − b20)(1− e−λ(Rc−z)) (1−b0)+b0eλ(γ1/αRc−z) . (29) Note that in this equation the transmission probability, b0 is the only control variable, whilst all other variables are constants for a given network. As described in Algorithm 1, it is possible to evaluate the value of λ from the estimated number of neighbouring vehicles k̄. The optimal b0 can then be determined from (29) as a function of λ, that is b0(λ), and by using (9) the optimal maximum CW size, W-1, can be evaluated based on the vehicular density. Algorithm 1 Optimised CSMA 1: for each vehicle do 2: periodically monitor the radio channel in order to estimate the number of surrounding vehicles k̄ 3: calculate λ from the estimated number of neighbouring vehicles k̄ in the interfering range Rf by using (14) 4: pick the optimal CW size (obtained from (29) and (7)) for the current value of λ 5: execute CSMA/CA procedure with optimised CW 6: end for Algorithm 1 shows the steps of the proposed (optimised) CSMA/CA protocol for broadcast. In the following section, we will present the results of the protocol proposed in this paper, in comparison with the standard IEEE 802.11p MAC protocol. III. NUMERICAL RESULTS Simulation is used to validate the proposed CSMA/CA protocol which is adaptive to vehicle density, and to compare performance with the standard one. In this work, we simulate a one-lane, single-direction road that is 5 km in length. Furthermore, it is assumed that vehicles are able to estimate the number of neighbouring vehicles in the range Rf . The transmission range is assumed to be Rt = 100 m, γ = 4 and TABLE I SIMULATION PARAMETERS Mac Layer Parameters Values aSlotTime, σ 13µs AIFS 58µs Propagation delay, δ 1µs MAC header, TH 50Bytes Packet payload, EP 500Bytes Data rate, rd 6Mbit/s 0 0.2 0.4 0.6 0.8 1 Pr(transmission) 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 T h ro u gh p u t 2 Vehicles in range 4 Vehicles in range 7 Vehicles in range 15 Vehicles in range Fig. 4. Throughput as a function of the probability of transmission b0 the path loss exponent α = 4. The values for the broadcast CSMA/CA can be found in Table I. Using (29), Figure 4 shows how the channel throughput changes as the transmission probability b0 varies for different vehicle densities in the network. As shown in the figure, for a given vehicle density (as reflected by the average number of vehicles located within Rf , from which we can derive the value of λ by exploiting the expression in (14)), there exists the optimal transmission probability b0(λ) that maximises the channel throughput. Substituting the optimal density-based transmission proba- bility b0(λ) in (9), the optimal maximum CW to maximise the single-hop throughput, can be evaluated for different density conditions. The optimal maximum CW is displayed in Figure 5 as a function of the average number of estimated neighbouring vehicles within the interference range Rf of an arbitrary vehicle. It can be observed that the optimal contention window size increases with the vehicle density because a higher density increases the likelihood of transmission collision. Consequently, in these situations, it is advisable to choose a bigger CW to reduce collision, as suggested in Figure 5. As intuitively expected, these results also confirm that a fixed maximum CW without considering the vehicle density, as specified in the ETSI protocol standard, cannot yield the best 0 10 20 30 40 50 Avg number of vehicles in interference range 0 20 40 60 80 100 O p ti m a l C W Fig. 5. Optimal maximum CW, W-1, to maximise the single-hop throughput as a function of the average number of estimated neighbouring vehicles within the interference range Rf of an arbitrary vehicle 5 10 15 20 25 30 35 40 45 Avg number of cars in interference range 0 20 40 60 80 100 A v er a g e D el ay (m s) optimised CSMA/CA CSMA/CA broadcast Fig. 6. Average transmission delay in a CCI for the standardised and proposed protocol as a function of the average number of neighbouring vehicles within the interference range Rf achievable throughput. The average transmission delay in a CCI as a function of the average number of neighbouring vehicles within the interference range Rf is depicted in Figure 6. The delay is defined from the time a vehicle generates a CAM packet at the beginning of the CCI of 100 ms until the packet is transmitted. Each vehicle is assumed to have a buffer of one packet. Due to the safety application under consideration, each CAM packet is expected to be transmitted with a delay of less than 100 ms; that is, before the end of the corresponding CCI. So, if a second packet has been generated at the beginning of the next CCI before the first packet is transmitted, the second packet is assumed to overwrite the first one still in the buffer (e.g., to replace the obsolete information). In this case, the delay for the first packet that has missed the latency requirement is assumed to be 100 ms in the simulation. Figure 6 depicts the 5 10 15 20 25 30 35 40 45 Number of cars in interference range -2 0 2 4 6 8 T ot al D el ay (s ) optimised CSMA/CA CSMA/CA broadcast Fig. 7. Average total delay for a vehicle to collect all CAM messages from its neighbours as a function of the average number of neighbouring vehicles within the interference range Rf 5 10 15 20 25 30 35 40 45 Avg number of cars in interference range 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 T h ro u g h o u t optimised CSMA/CA CSMA/CA broadcast Fig. 8. Throughput for the standardised and proposed protocol as a function of the average number of neighbouring vehicles within the interference range Rf . average packet delay for the standardised CSMA/CA broadcast protocol and our proposed protocol with the optimised CW as a function of vehicle density. As shown in the figure, the new protocol offers much lower delay than the standardised protocol because the CW is optimally selected according to vehicle density by the new protocol to avoid transmission collision. Figure 7 depicts the average total delay for the proposed (optimised) and standard protocol as a function of the average average number of neighbouring vehicles within the inter- ference range Rf . The vertical bars in the figure represent one standard deviation around the average delay. The total delay metric is defined as the average amount of time that a vehicle waits before CAMs from all its neighbours are received. As shown in the figure, the proposed protocol offers much lower delay than the standard protocol because the CW is optimally selected according to vehicle density by the new protocol to avoid transmission collision. In fact, each time a collision occurs, the packets involved are not received and new transmissions can be possible in the next CCI. This increases the total delay in receiving all CAM packets from the neighbours. Vehicle clustering mechanisms for internetworking and road-safety applications strongly rely on the timely reception of accurate status information from neighbouring vehicles. Hence, by offering low latency, the optimised protocol can support such real-time applications. Finally, the throughput for the standardised and the new protocol is compared in Figure 8. By adapting the CW as a function of vehicle density, the proposed protocol is clearly able to maintain throughput performance despite increasing density. By contrast, since the standardised CSMA/CA proto- col has a fixed maximum CW, a greater number of collisions occur as the number of vehicles on the road increases. IV. CONCLUSION As a step toward the design of efficient MAC protocol tailored for VANETs, we have established the relation between the maximum CW size and the transmission probability b0. By exploiting the equivalence between the slotted Aloha and the broadcast CSMA/CA protocols, we have developed a stochas- tic model, including realistic constraints such as the practical vehicle size, to derive the optimal transmission probability and in turn the optimal maximum contention-window size based on the vehicle density. This can drastically help reduce the contention amongst vehicles operating under stringent time constraints, such us in road safety applications, and maximise the single-hop throughput among adjacent vehicles. Further- more, we have proposed an amended protocol that integrates the optimal maximum contention-window size and accounts for the more realistic estimated number of surrounding ve- hicles k̄ rather than rely merely on the theoretical value λ. Results from extensive experimental simulation have revealed significant performance improvement in terms of channel delay and throughput when compared with the standardised protocol over a wide range of vehicle densities. A possible extension to this work can focus on the derivation of an accurate estimation mechanism of the vehicle density by sensing the number of neighbouring vehicles. Since the per- formance of the proposed CSMA/CA protocol depends on the density estimate, its accuracy is important. The performance study in this work essentially assumes a buffer of one single packet for each vehicle, which is reasonable for the CAM or certain safety applications with periodic packet generation. Another area of extension is to consider multiple buffers for other time-critical applications where packet generation can be bursty. ACKNOWLEDGMENT The authors would like to thank the U.K. Defence Science and Technology Laboratory (DSTL) for funding of this re- search through the National U.K. PhD programme. REFERENCES [1] S. Yousefi, M. Mousavi, and M. Fathy, “Vehicular ad hoc networks (vanets): Challenges and perspectives,” in ITS Telecommunications Pro- ceedings, 2006 6th International Conference on, June 2006, pp. 761– 766. [2] H. Hartenstein and K. Laberteaux, “A tutorial survey on vehicular ad hoc networks,” Communications Magazine, IEEE, vol. 46, no. 6, pp. 164–171, June 2008. [3] G. V. Rossi, Z. Fan, W. Chin, and K. K. Leung, “Stable clustering for ad-hoc vehicle networking,” in IEEE WCNC, March 2017. [4] G. V. Rossi and K. K. Leung, “Optimised csma protocol to support efficient clustering for vehicular internetworking,” in IEEE WCNC, March 2017. [5] “Ieee guide for wireless access in vehicular environments (wave) - architecture,” IEEE Std 1609.0-2013, pp. 1–78, March 2014. [6] ETSI, “Intelligent Transport Systems (ITS); Vehicular Communications; Basic Set of Applications; Part 2: Specification of Cooperative Aware- ness Basic Service,” Tech. Rep., 2013. [7] European Telecommunications Standards Institute, “Intelligent Transport Systems (ITS); Access layer specification for Intelligent Transport Systems operating in the 5 GHz frequency band,” ETSI, EN 302 663 V1.2.1, July 2013. [8] S. Eichler, “Performance evaluation of the ieee 802.11 p wave commu- nication standard,” in IEEE VTC, 2007, pp. 2199–2203. [9] K. Bilstrup, E. Uhlemann, E. G. Strom, and U. Bilstrup, “Evaluation of the ieee 802.11 p mac method for vehicle-to-vehicle communication,” in IEEE VTC, 2008, pp. 1–5. [10] G. V. Rossi and K. K. Leung, “Performance tradeoffs by power control in wireless ad-hoc networks,” in IWCMC, July 2013, pp. 1343–1347. [11] S. Subramanian, M. Werner, S. Liu, J. Jose, R. Lupoaie, and X. Wu, “Congestion control for vehicular safety: synchronous and asynchronous mac algorithms,” in Proceedings of the ninth ACM international work- shop on Vehicular inter-networking, systems, and applications. ACM, 2012, pp. 63–72. [12] Z. Tong, H. Lu, M. Haenggi, and C. Poellabauer, “A stochastic geometry approach to the modeling of dsrc for vehicular safety communication,” IEEE Transactions on Intelligent Transportation Systems, vol. 17, no. 5, pp. 1448–1458, May 2016. [13] T. Nguyen, F. Baccelli, K. Zhu, S. Subramanian, and X. Wu, “A performance analysis of csma based broadcast protocol in vanets,” in IEEE INFOCOM, 2013. [14] R. S. Tomar and S. Verma, “Enhanced sdma for vanet communication,” in WAINA, March 2012, pp. 688–693. [15] X. Jiang and D. Du, “Ptmac: A prediction-based tdma mac protocol for reducing packet collisions in vanet,” IEEE Transactions on Vehicular Technology, vol. PP, no. 99, pp. 1–1, 2016. [16] H. A. Omar, W. Zhuang, and L. Li, “Vemac: A tdma-based mac protocol for reliable broadcast in vanets,” IEEE Transactions on Mobile Computing, vol. 12, no. 9, pp. 1724–1736, 2013. [17] G. V. Rossi, K. K. Leung, and A. Gkelias, “Density-based optimal transmission for throughput enhancement in vehicular ad-hoc networks,” in IEEE ICC, 2015. [18] I.-H. Ho, K. K. Leung, and J. W. Polak, “Optimal transmission probabil- ities in vanets with inhomogeneous node distribution,” in IEEE PIMRC, 2009, pp. 3025–3029. [19] J. Wu, “Connectivity analysis of a mobile vehicular ad hoc network with dynamic node population,” in GLOBECOM Workshops, 2008 IEEE, Nov 2008, pp. 1–8. [20] H. Takagi and L. Kleinrock, “Optimal transmission ranges for randomly distributed packet radio terminals,” Communications, IEEE Transactions on, vol. 32, no. 3, pp. 246–257, Mar 1984. [21] P. Gupta and P. R. Kumar, “The capacity of wireless networks,” IEEE Transactions on Information Theory,, vol. 46, no. 2, pp. 388–404, 2000. [22] J. Deng, Y. S. Han, P.-N. Chen, and P. Varshney, “Optimal transmission range for wireless ad hoc networks based on energy efficiency,” Com- munications, IEEE Transactions on, vol. 55, no. 9, pp. 1772–1782, Sept 2007.

## Related Questions

Tutlance Experts offer help in a wide range of topics. Here are some of our top services:

- Math homework help
- Nursing homework help
- Statistics homework help
- Nursing coursework help
- Capstone project writing services
- Essay writers for hire
- Case study writing help
- Buy college papers online
- Buy college research papers
- College homework help
- Professional resume writing services
- Programming homework help
- Coursework writing help
- Term paper writing help
- Biology homework help
- Do my physics homework
- Dissertation data analysis help
- PhD Dissertation writing services
- Chemistry homework help

Post your project now for free and watch professional experts outbid each other in just a few minutes.