For macroscopic models, a vehicle’s travel time (and thus speed) is specified by the volume delay function, turn penalty function and junction delay function. These functions can read parameters such as speed limit to estimate a travel time along a section or turn. To alter the speed by vehicle type, you must therefore make edits within these functions.
For this pro tip, we will code the UK rules on single carriageway roads for a volume delay function. A similar approach would be taken on the turn penalty functions. We will need to check the road type, vehicle type and number of lanes.
To find out the vehicle type being considered, use:
vehicle = context.userClass.getVehicle()
To find out the speed limit being considered, use:
SectionSpeed=section.getSpeed()
To find out the number of lanes being considered, use:
NbLanes=section.getNbFullLanes()
The speed along a section can then be specified using the following function:
def freeFlowTravelTime(context, section, funcVolume):
model = context.experiment.getModel()
vehicleName = context.userClass.getVehicle().getName()
SectionSpeed=section.getSpeed()
NbLanes=section.getNbFullLanes()
if vehicleName==”HGV” and SectionSpeed==96 and NbLanes==1: #If its a HGV on a single carriageway road with a 96kph/60mph limit
speed=80
else:
speed=SectionSpeed
distance=section.length3D() / 1000.0 # Km
t0 = distance/speed # hour
return t0
This could be expanded with other vehicle types such as trailered vehicles if necessary.
This freeflowspeed function should then be integrated into the VDF. For example using the BPR function. It is important however to still take into account the delay within the total travel time. We will therefore calculate travel time as the maximum of the volume specific travel time and the vehicle speed limit)
def freeFlowVehicleTravelTime(context, section, funcVolume):
model = context.experiment.getModel()
vehicleName = context.userClass.getVehicle().getName()
SectionSpeed=section.getSpeed()
NbLanes=section.getNbFullLanes()
if vehicleName==”HGV” and SectionSpeed==96 and NbLanes==1: #If its a HGV on a single carriageway road with a 96kph/60mph limit
speed=80
else:
speed=SectionSpeed
distance=section.length3D() / 1000.0 # Km
t0 = distance/speed # hour
return t0
def freeFlowTravelTime(context, section, funcVolume):
model = context.experiment.getModel()
speed=SectionSpeed
distance=section.length3D() / 1000.0 # Km
t0 = distance/speed # hour
return t0
def vdf( context, section, funcVolume ):
#coefficients alpha and beta must be modified accordingly
alpha = 0.15
beta = 4.0
freeFlowVehicleTravelTime = freeFlowVehicleTravelTime(context, section, funcVolume)
freeFlowTravelTime=freeFlowTravelTime(context, section, funcVolume)
volume = funcVolume.getVolume()
addVolume = section.getAdditionalVolume()
capacity = section.getCapacity()
cost = max(freeFlowTravelTime * (1 + alpha * ((volume + addVolume) / capacity ) ** beta), freeFlowVehicleTravelTime)
return cost
Don’t forget you can then use table view to apply the function to all sections in the network. This can be found in Window > Windows > Table View. By going to the volume delay function column and changing the bottom row, all sections can be updated.
For more information on scripting and functions, please see qthelp://aimsun.com.aimsun.20.0/doc/UsersManual/ScriptIntro.html
or attend one of our Scripting courses.
Ronda Universitat 22 B
Barcelona 08007
Spain
t: +34 933 171 693
80 George St
Edinburgh EH2 3BU
UK
t: +44 7401 977 191
Waterhouse Square
138 Holborn
London EC1N 2ST
UK
t: +44 7401 977 191
t: 020 7193 7103
Paseo de la Castellana 77
Madrid 28046
Spain
t: +34 627 454 880
152 Elizabeth Street
Melbourne VIC 3000
Australia
t: +61 404 122 968
980 6th Avenue
2nd Floor
New York, NY 10018
USA
t: +1 917 267 8534
54 Rue de Clichy
Paris 75009
France
t: +33 (0) 1 86 95 41 52
36 Robinson Road, #02-01
Singapore 068877
t: +65 8186 5589
333 George Street
Level 13
Sydney, NSW 2000
Australia
t: +61 (2) 7208 7869
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.