Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Vehicularadhocnetworks(VANETs)arenetworksinwhicheachnodeisavehicle.

Suchsystemsaimto
providecommunicationsbetweenindividualvehiclesandbetweenvehiclesandnearbyfixedequipment,
orroadsideunits.ThegoalofVANETs,andmorebroadlyvehicularnetworks,istoimprovetrafficsafety
byprovidingtimelyinformationtodriversandconcernedauthorities.
b .
.
.
FioreandHarri(2008)andFiore(2009)investigatedtheeffectsofnodemobilityonnetworkcharacteristics.
Theyfoundthatrealisticmobility,especiallyatintersections,hasagreatimpactonnetworkingconnec
tivitymetricsandthatcarfollowingmodels,suchastheIntelligentDriverModel(IDM)(Treiberetal.
2000),providerealisticmovement.Inaddition,theyfoundthatmultilanescenariosareimportantwhen
consideringnetworklevelclustering.
.(Fiore and Harri(2008)andFiore(2009

.
.
Inaddition,wehaveprovidedaHighwayclasstorepresentastraightmultilane,bidirectionalroadway.
Inoursimulations,theHighwayobjectisthebrainofthesystemandefficientlymanagesthebehavior
ofvehiclesandtheirmobilityontheroad.Eachvehicleisafullyfledgedwirelessnodeinns3.Inthis
way,vehiclescanmovewithrealisticmobilityandcommunicatewitheachothertoformaVANET.In
ournetworkandmobilitycombineddesign,ausercansimulateVANETsinhighwayswithcustomized
roadsideandonboardunits.Userscancreateuserdefinedactionsandeventhandlerstocustomizesimu
lationscenarios,allowingthemtostudyvehiculartraffic,networktraffic,orboth.
.
.ns3 .
.
.
.
ARCHITECTURE
Herewedescribethecomponentsofourdesign,whichconsistsoffivemainclasses(Figure1):
1.Vehicleamobilenodethatcontainsawirelesscommunicationsdevice
2.ObstacleaVehiclethathasnomobility
3.ModeltheIDMcarfollowingmobilitymodel
4.LaneChangetheMOBILlanechangemodel
5.HighwayholdsVehicleandObstacleobjectsandusesaVehiclesModelandLaneChangeprop
ertiestocontrolitsmobility
:
.:.
.:.
IDM:.
MOBIL:.
.:.

1.AVehicleisamobilenodethatcontainsawirelesscommunicationsdevice.AVehiclehasthefollowing
properties:
:
vehicleID

width

length

lane

direction

}{1,1

position

(x,y,z) x yz
m.

velocity

m/s

acceleration

m/s2

model

lanechange

Inourdesign,theHighwayobjectisinchargeofmanagingthepositions,directions,andthelane
numbersofitsvehicles.AVehiclesaccelerationandvelocitycanbesetmanuallyorcanbecalculated
basedontheIDMmobilitymodelrules.AVehicleisabletochangelanes,ifnecessaryandifpossible,
basedontheMOBILlanechangemodel.Vehicleobjectscaneitherbemanuallycreatedandinsertedonto
theHighwayorcanbeautomaticallyinjectedontotheHighway.
.
IDM . MOBIL
..

Since a Vehicle contains a wireless communications device, we can control thevehicle's WiFi capabilities. Vehicles are
able to communicate (send/receive)throughthestandardns3WiFichannels.Themessages,includingsent andreceived
packets, and all related events can be captured by setting the appropriate event handlers to theimplemented callbacks
which are designed and considered for these purposes. A Vehicle can unicast packets or it can send broadcast
messages. The user has full control on how to schedule the sending process and how to handle the receive callback.
There are alsoseveralcallbacksforthepurposeof tracing thedifferentlayersofthenetworkandthemobilityofthevehicle
Thesehelptheusercreateandtracesimulationscenarioseasily.
/).
. NS3 (
Unicast.
. .
.
.
2.AnObstacleisastaticnodethatcontainsawirelesscommunicationsdevice.ItisinheritedfromtheVehi
cle class and hasallof the capabilities of a Vehicle except that it cannot be mobile (i.e., velocity =acceleration =model=
lanechange = 0 ). An obstacle can be used as an barrier to close a lane or to temporarilycreate stoppages that result in
congestion on the highway. An obstacle can also be used as a roadside unit or other piece of infrastructure along, bu
outside of, the highway. If an Obstacle is placed on the highway, itmust have a direction and lane number. Anything tha
can be done to a Vehicle object can be done to an Obstacle object (aside from affecting mobility), so in the rest of this
paperwewilljustusethetermVehicle.
= ==).
.( =
. .
..
3.MobilityModel
Model is the class that implements the mobility model for a Vehicle. We have implemented the Intelligent Driver Mode
(IDM) in ns3 based on equations and parameters developed by Treiber (Treiber et al. 2000, Treiber 2006a). IDM is
carfollowing model, meaning that each vehicles acceleration or deceleration depends upon its own velocity, its desired
velocity, and the position and velocity of the vehicle immediately in front in the same lane, which Treiber calls the fron
vehicle.
IDM..
.
Each vehicle inIDM has adesired velocity, safety time headway (time needed to cover a gap between twovehicles,e.g
the 2 second rule), acceleration in freeflow traffic, comfortable braking deceleration, and desired minimum distance to
the front vehicle. IDM uses these parameters and the current state of the vehicle and front vehicle to compute the new
acceleration. Acceleration is, in turn, used to update the velocity and position of the vehicle. Note that acceleratio
necessarilydecreasestowards0whenthevelocityofthevehicleapproachesthedesiredvelocity.
(" " ) IDM
IDM.
. .
.0
The function CalculateAcceleration in the Model class usestheIDMequationstocalculateandreturnthenewacceleratio
at each time step. The vehicles new velocity and position are then adjusted based on this new acceleration. Fo

customizability, each vehicle can have its own set of IDM parameters. Treiber suggests different parameter settings for
cars and trucks. For example, trucks have a lowerdesiredvelocity,accelerationinfreeflow,andcomfortabledeceleration
than cars. Careful drivers would have a high safety time headway, and pushy drivers would have a low safety time
headway,higherdesiredvelocity,accelerationinfreeflow,andcomfortabledeceleration.
.IDM CalculateAcceleration
Treiber . IDM .
.
"" " " .
.
In our design, we also allow each Vehicle object to have its own IDM parameters. We have included reasonable defau
values for cars (the Sedan class)and trucks (the Truck class). The user can create their own vehicletypeswithdifferent
parameter values for specific experiments. Forexample, a user may want to create amixofcarefulandpushydrivers,or
include sports cars, police cars, emergency vehicles, and buses, all of which would have very different mobility
characteristics.
)
. . ( ) (

.
4.LaneChangeModel
LaneChange is the class that implements the lane changingmodel for a Vehicle. We have implementedthe MOBIL lane
change model based on equations and parametersdeveloped by Treiber (Treiber 2006b,Treiber and Helbing2002).Eac
lane changein thismodel must satisfy both the safety criterion and the incentive criterion. The safety criterion statestha
the lane change must not cause the vehicle that is being changed in front of (the back vehicle) to decelerate unsafely
(faster than a certain threshold). The incentive criterion is satisfied ifthe lanechangingvehiclesadvantageisgreatertha
the other vehiclesdisadvantages.Notethatalthoughtheincentivecriterionisusuallymucheasiertosatisfythanthesafet
criterion,bothmustholdforthelanechangetooccur.Inaddition,theIDMrulesstillapply,meaningthatthe
newfrontvehiclemustbeacertaindistanceaheadinorderforthelanechangetooccur.
. IDM .
.
. ( )
.
IDM .
.
To compute the incentive criterion, MOBIL first calculates the lanechanging vehicles advantage.This is simply the
difference betweenthe vehicles current acceleration andthe vehicles newaccelerationafterthelanechange.Thegoali
to increase the acceleration, or to reduce the braking deceleration, whichArbabi and Weigle are essentially the same
things. The disadvantage to both the back vehicle in the current lane and the backvehicleinthenewlaneareconsidered
Again,thisisdonebycomparingtheaccelerationbeforethelanechangewiththeaccelerationafterlanechange.
. MOBIL
()..
.
To allow for some variability in how aggressive drivers are in deciding when to change lanes, MOBIL weights the othe
vehicles disadvantage with a politeness factor, p. When p 1, the driver is considerate andputs others disadvantages

equaltoor aheadoftheirownadvantage.Inreality,mostdriversareinthe0<p0.5range,wheresomeweightisgivent
otherdriversdisadvantage.Ifp=0,thedriverisinconsiderate,discountingthedisadvantagetoothers.
.p MOBIL
p=0. 0..0.5 p [] p>=1
.
MOBIL also includes a rightlane bias parameter when computing the incentive criterion. This parameter allows fo
modeling situations in countries where passing a vehicle on the right is not allowed. The parameter can also be used to
allowvehiclestopassfromeithersideorpreventtrucksfromtravellingintheleftmostlanes.
. MOBIL
.
.()
The function CheckLaneChange inourLaneChangeclassreturnsabooleantoindicateifthelanechangecantakeplaceo
not. CheckLaneChange uses the MOBIL equations and suggested parameters along with the statuses of the
lanechangingvehicle,thecurrentfrontvehicle,thenewfrontvehicle,andthenewbackvehicle.
CheckLaneChange . LaneChange CheckLaneChange
MOBIL
.
As with our IDM implementation, we have included reasonable default values for each of these parameters.Weprovide
Considerate driver class and an Inconsiderate driver class. The user can, of course, create their own driver types with
differentparameters.
. IDM
.
5Highway
Highway is the class that holds Vehicles and manages their mobility. We will discuss Highways physical properties,
Vehiclemanagementtasks,andhowuserscancontrolvehiclesonthehighwayinordertocustomizesimulations.
Highway
.
5.1PhysicalProperties
Highwayrepresentsastraighthighwaytopologyandhasthefollowingphysicalproperties:
lengthlengthofthehighwayinmeters(upto10,000m)
numberoflanesineachdirection[1,5]
lanewidthinmeters
mediangapwidthofthemedian,inmeters
bidirectionaltrueifthehighwaycontainstwowaytraffic,falseifthehighwayisoneway
.Highway
m

length

numberoflanes
m

lanewidth

mediangap

falsetrue

bidirectional

Figure2showstwoexamplehighwayconfigurations.Figure2aisaunidirectionalhighwaywiththree
lanes,andFigure2bisabidirectionalhighwaywithfourlanesineachdirection.

Figure2:Asmallsegmentofahighway.Carsarerepresentedbysmallbluerectangles,andtrucksare
representedbylargerredrectangles.(a)unidirectionalhighwaywiththreelanes,(b)bidirectionalhigh
waywithfourlanesineachdirectionandaseparatingmedian.ArbabiandWeigle

5.2VehicleManagement
There are several Vehicle management functions that Highway performs. Highway can automatically create Vehicle
objects with certain parameters, automaticallyinsertthesecreatedobjectsintolanes,andmoveeachVehicleaccordingto
itsmobilityandlanechangemodels.
.
.
5.2.1AutomaticCreationandInjectionofVehicles
When the AutoInjection parameter of Highway is true, Vehicle objects willbe automatically created and injected onto th
highway. For this purpose, Highway creates default mobility modelswithparameterssetappropriatelyforthestandardca
and truck, named SedanModel and TruckModel, respectively. Highway also creates default lane change models wit
appropriate parameters set for carsand trucks. The ratio ofcarstotrucksthatarecreatediscontrolledbytheinjectionMix
parameter.AutomaticallycreatedVehicleobjectsareprovidedwithdefaultWiFiPhy/MacsettingsappropriateforVANETs
.trueAutoInjection
.
injectionMix.
.WiFiPhy/Mac.
Highway stores each lane as a list structure. When a Vehicle object is addedto Highway, it is inserted initsproper place
according to its lane, direction, and x position. For autoinjection, there isaminGapparameterthatspecifiestheminimum
distance betweentwo vehicles entering the highway. Newly created Vehicle objects are not inserted until the x positiono
thelastVehicleinthelaneisatleastminGapmetersfromthestartofthehighway.
.
. minGap .
.minGapx
Vehicles are inserted with a negative x position, so that thefrontof the vehicle starts at the start of the highway ( x = 0 )

Each lane ischeckedtoseeifaVehiclecanbeadded,inroundrobinfashion,startingwith therightmostlane(lane= 0)in


theeastbounddirection(direction
= 1 ) and ending with the leftmost lanein the westbound direction ( direction = 1,ifusingbidirectionaltraffic). Thus,ona
bidirectionalhighway,vehiclesareaddedtobothdirectionsatthesamerate.
.(x=0) x
,direction =1) (direction=1) (lane = 0)
..(
5.2.2MobilityofVehicles
Every DeltaT seconds, Highway calls its step function which updates the position, velocity, and acceleration of each
Vehicle according to its mobilitymodel.In this way, vehicleswithdifferentmobilitycharacteristics(e.g.,trucks,emergency
vehicles) can be represented on the same highway. Vehicles are updated by lane in roundrobin fashion, startingwithth
Vehicles in the rightmost lane in theeastbounddirection.Aftertheupdate,ifaVehiclesxpositionisgreaterthantheleng
of the Highway, the Vehicle is removed from thelane list.AfterallVehiclepositionshavebeenupdated,automaticinjectio
ofnewVehiclesoccurs.
. DeltaT
.( )
x .
..
The opportunity for each vehicle to change lanes is evaluated every 10 * DeltaT seconds to prevent unrealistic
lanechanging patterns (e.g., vehicles changing lanesmultiple times in less than 1second). Ifavehiclecansafelychange
lanes (according to the Vehicle's MOBIL parameters), Highway removesthe Vehiclefromthe current lane and adds itto
the target laneatthexpositionspecifiedaccordingtoIDM/MOBIL.Whenalanechangeisallowed,itoccursbeforemobilit
isupdated,soaVehiclechanginglanesonlyhasitsmobilityupdatedonetimeinDeltaTseconds.
)DeltaT *10
(MOBIL).(
. IDM/MOBIL
DeltaT
The best case driver reaction time is 0.7 seconds (Green, 2000).Vehiclepositionsshouldbeupdated moreoftenthanthe
driver reaction time, and we choose 0.1 seconds for the default value of DeltaT as a tradeoff between efficiency and
accuracy. ReducingDeltaT (i.e., having the step function called more often)willproduceamoredetailedtranslationofthe
position of the vehicle, but will result in a slower simulation (Figure 3). Increasing DeltaT (i.e., having the step functio
called less often) will cause less accuracy in mobility since each step may result in a largerdisplacement ofthevehicles
(Figure4).ArbabiandWeigle
0.1 .(Green,2000) 0.7
)DeltaT . DeltaT
( )DeltaT .() (
.()

5.3UserControlofVehicles

To allow for feedback between the network and the mobility model, there mustbe a wayfortheusersapplicationcodeto
interact with individual Vehicle objects. Highway allows the user to access any Vehicle object through its VehicleID usin
FindVehicle(). The usercan then use this object to change any of the Vehicles parameters.Inaddition,Highwayprovide
FindVehiclesInRange()whichreturnsalistofallVehicleobjectswithinrangemetersofthegivenVehicle.
().
..VehicleID FindVehicle
.FindVehiclesInRange()
FindVehiclesInSegment() returns a list of all Vehicle objects in a particular lane between positionsx1andx2.Toaccess
these Vehicle objects atparticulartimes,Highwaytriggersseveral eventsthatcanbeboundtoan eventhandlercreatedb
theuser.TheeventsInitVehicle,ControlVehicle,andReceiveDataarediscussedbelow.Inaddition,thereareseveral
other events, such as DevRxTrace and PhyRxErrorTrace, for the purposes of tracing the communication channel, the
PHY/MAClayer,andthebehaviorofthenetworkdevicesinstalledonvehicles.
. x2 x1 FindVehiclesInSegment
.
DevRxTrace : . ReceiveData ,InitVehicle, ControlVehicle
.PHY/MACPhyRxErrorTrace
InitVehicleistriggeredatHighwayinitializationtime.Thisgivesthe usertheabilitytocreatecustomizedscenariosor modif
the initial settings. Although the user can create and position Vehicle objects at any time, inside this event handler is th
ideal placeto createandplaceinitialobjectsonthehighway.IfAutoInjectionissettotrueinHighway,automaticallycreate
Vehicles will move around the previously placed Vehicles. The event handler is passed a pointer to the Highway and
reference to a vehicleID (set to 1 initially). Any manuallycreated Vehicles should use and increment this vehicleIDsotha
all objects will have unique IDs. Note that any manuallycreated Vehicles will be controlled by Highway according to th
Vehiclesmobilitymodel.TheeventhandlershouldreturntrueifVehicleshavebeenmanually
added to the Highway or default settings have been modified. In this case, Highway will sort the lane lists based on th
Vehicle positions. If noVehicles have been added, there is no reason to sort the lists, so the event handler should retur
false.
. InitVehicle
.
true AutoInjection .
.()vehicleID .
. ID vehicleID
.
. true
.false.
ArbabiandWeigleForeachVehicle,ControlVehicleistriggeredbythestepfunction,whichisexecutedeveryDeltaT
seconds. In this way, theuserhasfullcontrolofeachVehicleateachtimestep.Forexample,aparticularVehiclecouldbe
made to decelerate or stopinordertocreatetrafficcongestion.Inaddition,thiseventhandlerisanidealplacetooutputth
locationsofallVehiclesinordertoproducetrafficvisualizations.
The event handler is passed a pointer to the Highway, a pointer to the particular Vehicle, and the value of DeltaT. Ifth
event handlerhaschangedtheVehiclesposition,itshouldreturntrue,sothattheVehiclesaccelerationwillnotbeupdate
by the mobility model. Otherwise, the event handler should return false so that Highway will adjust the Vehicles positio
accordingtoitsmobilitymodel.
.DeltaT ControlVehicle

. .
.
DeltaT.
true .
false.
ReceiveData is triggered when any Vehicle successfully receives data from the network.The event handler is passed a
pointertotheVehiclethatreceivedthedata,apointertothedatapacket,andtheaddressofthepacketssender.
ReceiveData .
.
========================================================ImprovingVANETSimulatorInNS32011
OriginalArchitecture
BuiltbyArbabi,Weigle
)UsesIntelligentDriverModel(IDM
Adriverfollowingmodel
Equationusesdistance,velocitydelta,andmaxaccelerationandbreaking
UsesMOBIL
Alanechangemodel
UsesinformationfromIDM
Looksforamorefreepathinnextlanevs.negativeimpactonfollowingvehicleinnextlane
OneorTwoDirectionHighway
HighwayhasmultipleLanes
VehicleObjects
Wifinode
ConfigurableIDM/MOBILobjects
AutomaticorManualVehicleCreation
Customizationhooks
OnlyoneHighway
Onlyeast/west
Nointersections
Commandlineconfig
Highwayclassdifficulttomaintain/extend


(IDM)


MOBIL

IDM


IDM/MOBIL

NewArchitecture

MaintainIDMandMOBIL
OmnidirectionalHighways
ConnectHighways
Intersectionsespeciallyimportant
Caninfluencetrafficflow
Canquicklymodifytrafficdensity
HighwaycontrolledbyHighwayProject
HighwaysconnecttoHighways
Vehiclecreationexternalized
Fourdifferenttypesofconnections
Straight,Left,Right,Back
Highwaycanhaveanycombinationonanylane
HighwayslookforVehiclesrecursively
HighwayhandlesTrafficLights
TrafficLightsarespecialObstacles
VehiclesthatcannotstopintimepassthroughTrafficLights
TrafficLightGeneratorutilitycreated

MOBILIDM





Highwayproject


( )

.
.
VehiclesthatcannotstopintimepassthroughTrafficLights
TrafficLightGenerator

3.Architecture
3.1HighwayProject
Arbabi's architecture's primary container was Highway. This has been replaced by the HighwayProject class. The
HighwayProject classs primary duty is to process the XML document representing the Highway configuration, wiring
together the instances of the various classes, and then startingandrunningthesimulation.Theclassesdirectlycontrolled
by HighwayProject are: Highway (section 3.2), WifiConfiguration (section3.3), VehicleGenerator (section 3.4.1), an
TrafficLightGenerator(section3.4.2).
.
HighwayProject.
. HighwayProject . (Container)
. xml
HighwayProject TrafficLightGeneratorHighwayWifiConfigurationVehicleGenerator
.
HighwayProject first reads in an XML document from the file system using the TinyXml library [3]. See Appendix B fo
source code information. An XSD document describing the XML is available along with the source code. Using this
information, it first creates all of theHighway instances. It then ``wires''themtogether,connectingHighwaysto eachothe
based on the configuration. See section 3.2.2 for more details on the connections. Once these connections are made,
HighwayProject uses Dijkstra's algorithm to creating a routing map for each Highway instance to all other Highway
instances (if reachable). Afterthe algorithm is run,eachHighwayhasamapcontaininganentryforallotherHighwaystha
willdirectavehicletoeitherturnleft,turnright,orgostraight.
. . TinyXml XML HighwayProject
HighwayProject .
. ( ) Dijkstra's

.
Once the Highways are created and routed, HighwayProject creates all instances of WifiConfiguration and
VehicleGenerator. Each VehicleGenerator is 7connected to one Highway. A single WifiConfiguration can be associate
with multiple VehicleGenerators. If different WifiConfigurations are wanted for different generators, however, they can b
configuredandusedseparately.
. VehicleGenerator WifiConfiguration HighwayProject
WifiConfigurations . VehicleGenerators WifiConfiguration
.

HighwayProject is also responsible for creating two trace files, one for vehicle location and one for network traffic. The

default locations are ``vehicleTrace.csv'' and ``networkTrace.csv'' in the working directory of the program. Other file
names/locations can be provided to HighwayProject before starting. The vehicle trace has the following columns
Simulation Time (Nanoseconds), Vehicle ID (Integer), Type ID (0 for Vehicle, 1 for Obstacle, 2 for trafficlight), X Positio
(double), Y Position (double), Direction (double), Velocity (double), Acceleration (double). The network trace has th
following columns: Simulation Time (Nanoseconds), Vehicle ID (Integer), Message(String), UserIndex (an integer base
on the type of message). Thenetworktrace,bydefault,doesnotprintanymessages.Eachtypeofmessage (i.e.Physica
ReceiptOK,PhysicalReceiptError,VehicleReceipt,etc.)mustbeturnedonindependently.
. HighwayProject
.[].
SimulationTime

VehicleID

210

TypeID

Direction

Velocity

Acceleration

SimulationTime

VehicleID

Message

UserIndex

,
PhysicalReceiptOK,PhysicalReceiptError,VehicleReceipt ) .
.(
3.2Highway
Highway is the primary container for Vehicle (section 3.5) instances. It does not create any Vehicle instances on its own
Instead,itonlymanagestheVehiclesitcontainsatthetimeofthecurrentstep.
. .
.
3.2.1PhysicalProperties

AHighwayisalwaysstraight.Ithasthefollowingcharacteristics:

:
Name Description Start Location The center point of the start of the Highway Length The length of the highway inmeter
(default 1000m) Number of Lanes The number of lanes the highway has (default 1) Lane Width The width of each lane
(default5m)DirectionThedirectionavehiclewilltravelontheHighway(default0radiansoffthexaxis)

StartLocation

(1000M)

Length

(1)

NumberofLanes

(5M)

LaneWidth

(x0)

Direction

Each lane has an ID, beginning with 1 in the leftmost lane. The leftmost lane is determined based on Direction. Lanes
always terminate on a line paralleltotheYaxislocated atapointinthemiddleoftheHighway,Lengthwayfromthestarto

the Highway. If the Direction is either or


(straight up or straight down), the terminating line is parallel to theXaxi
insteadoftheYaxis.
. Direction . 1
Y()

. Y
.X

3.2.2HighwayConnection

A Highway has fourdifferent typesofconnectionstootherHighways:Left,Right,Straight,andBack.Whenaconnectioni


established, two indexes are sent in, an initializing offset, anda lane offset. The initializing offset determines whatlane i
the current Highway the connecting Highway will start at. This initializing offset isdeterminedfromthe leftmost lane, with
thefirstoffsetbeing0upto(NumberofLanes1).
initializing . :
. initializingoffset.laneoffsetoffset
(1)0

Figure1aLaneIDs
Figure1bConnectionTypes
The lane offset is subtracted from the current Highway's lane ID to determine what lane ID to use in the connecting

Highway. In Figure 1a,the highway on the left is connected (Straight) to the one on the right with an initializing offset of
and a lane offset of 1. The Highway on the right is connected (Back) to the left with an initializing offset of 0 and alan
offset of 1. Note that the offsets do not modifyHighwaypositions.Itisuptotheusertoconfigurethe instancecorrectlyso
that lanes will line up. A Highway can have any combination of Left, Right, or Straight connections, or none, on any lane
Figure 1b demonstrates 5 separate Highway instances. The farthest ontheleftconnectstoanothertwolaneHighwayina
Straightconnection.
1a. lane offset
.
. .
. .
[].1b
The Highway in the middle is connected to 3 Highway instances. In its leftmost lane, it has a Left connection. In its
rightmost lane, it has two connections: one Straight connection and one Right connection. If a Vehicle is in the rightmos
lane,theHighwayitistransferredtodependsonwheretheVehiclewantstogo.
: . .
..
If a Highway has anyavailable connectionsandtherearelaneswithoutaHighwayconnection,anObstacle(section3.5)i
addedtothenonconnectedlanesothatVehicleswillbeforcedtochangelanesbeforethatpoint.InFigure1a,lane1on
the left side would have an Obstacle at the end of it. If there are no forward connections, all lanes are left open and
vehicle crossing the end of the Highway is removed from 10the simulation. In Figure 1a,therightHighwayinstancewoul
havenoObstaclesandVehicleswouldberemovedfromthesimulationuponleaving.

3.2.3VehicleMovement
Each step of the simulation,HighwayProjectcallsthestepfunctiononallHighwayinstances.OncetheHighwaysaredone
withtheindividualtranslations,HighwayProjectthengoesthroughallHighwayinstancesagain,tellingthemtomove
VehiclestotheirconnectingHighwaysasnecessary.ThisisneededtomakesurethatVehiclesarenotmovedtwice.

3.2.3.1LaneChanging
Every tenth step, aHighway will attempt lanechange calculations.EveryVehicle(butnotObstaclesorTrafficLights)hasa
LaneChange objectassociatedwithit.Seesection3.5.1and3.5.2formoreinformationon theLaneChangeandtheMOBI
model.
All lane change calculationsare done before any acceleration ortranslation calculations.Thisis tomakesurethatVehicle
accelerationsandtranslationsarenotaffectedbyaVehiclebeingintwoplacesatonce.
It is during this stepthata Vehicles destination is queried. This destinationislookedupintheHighwaysroutingmap.Th
resultinthemapwillbeeitherStraight,Left,orRight.IfaVehicleisgoingStraight,theHighwayinstance willmakesuretha
the Vehicle doesnot attempt to change lanes into aturn only lane. If theHighwayonlyhasLeftorRightconnections,th
Vehicle willdefaulttoturningRight.IftheVehicleneedstomakeaturn,theHighwaywill(safely)forcetheVehicletogetin
a

lane that hasa connection of the proper direction. If thereare multiple turn lanes, the Highway will force it only to the firs
turn lane. Once aVehicle isin aturninglane,it canchangelanesnormally,providedthatthelaneitischangingtoisalso
turninglane.

3.2.3.2AccelerationandTranslation
During each step, a Vehicles Model object is queried to determine what its current acceleration is. The Model objec
implementstheIntelligentDriverModel(IDM).
For more information, see section 3.5.1. During this calculation, if the value returned from the Model is the special value
NaN, Highway assumes that theVehicle wants to passthroughtheVehicleobjectinfrontofit.Thiscurrentlyonlyhappen
in the case ofaTrafficLightbeingplacetoocloseinfrontoftheVehicleforittosafelystop.Whatthis allowstheHighwayto
doiseffectivelymodeltheyellowlightscenario.
When a Vehicle is making a turn, the Highway will adjust the Vehicles speed to a configured parameter (either turn le
speed or turn right speed). Thisadjustment is done by linearly decreasing the desired speed of the Vehiclefromitsusua
desired speed tothe configured parameter over the length of the highway(Figure2).OncetheVehiclehasmadetheturn
its desired speed is returned to normal and the IDM takes over. Note that thedesiredspeedisadjusted,notactualspeed
AllaccelerationsaredeterminedbytheIDM.

3.2.3.3MovementandConnections
During translations and lane changes,itisnecessarytohavethedistancetobothVehicle instancesinfrontandbehindthe
current Vehicle. The Highway provides all of these calculations. It first checks its own Vehicle lists for the appropriate
Vehicles.
If it cant find a Vehicle, it looks at its connecting Highways. If there are no appropriate Vehicles in the adjacent Highwa
that Highway will continue the search recursively until their are no available connections in that lane. Only Straigh
connectionsarequeried.QueryingonlyStraightconnectionsisduetothefactthatVehiclestravellingstraightdo
notwanttobasetheiraccelerationsonVehiclesthathavealreadyturned.

You might also like