How to define speed limits by vehicle class in static models

Technical Note #53
November 2020

By Tessa Hayman

In certain situations, the speed limit can differ according to vehicle type; for instance, on a single-carriageway road in the UK, vehicles over 7.5 tonnes can only travel at 50 miles per hour but other vehicles can travel at 60 miles per hour. You can code this within the delay functions for macroscopic models or through the use of traffic management for microscopic and mesoscopic models as explained in part 1.

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.

 

 

How to define speed limits by vehicle class in static models

 

 

 

Set the bottom row to your desired VDF
Set the bottom row to your desired VDF
 

 

 

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.

More technical notes

Distribution and Modal Split Functions

January 2018: Margarida Delgado explains how the Distribution and Modal Split steps are now split into two separate processes to give you greater flexibility when choosing which model to work with, and to give you more control at each step.

Using the Revisions tool for teamwork

June 2016: Dimitris Triantafyllos explains how the Aimsun Revisions tool allows a modelling team to work within a single file, for faster and less error-prone collaboration.

  • Got a question? Get in touch.

    We are here to help!

SHARE

Cite Aimsun Next

 

Aimsun Next 23

Aimsun (2023). Aimsun Next 23 User's Manual, Aimsun Next Version 23.0.0, Barcelona, Spain. Accessed on: July. 19, 2023. [Online].
Available: https://docs.aimsun.com/next/23.0.0/

 


 

Aimsun Next 20.0.5

Aimsun (2021). Aimsun Next 20.0.5 User's Manual, Aimsun Next Version 20.0.3, Barcelona, Spain. Accessed on: May. 1, 2021. [In software].
Available: qthelp://aimsun.com.aimsun.20.0/doc/UsersManual/Intro.html
 

Aimsun Next 23

@manual {​​​​​​​​AimsunManual,

title = {​​​​​​​​Aimsun Next 23 User's Manual}​​​​​,
author = {​​​​​​​​Aimsun}​​​​​​​​,
edition =  {​​​​​​​​​​​​​​​Aimsun Next 23.0.0}​​​​​​​​​​​​​​​,
address = {​​​​​​​​​​​​​​​Barcelona, Spain}​​​​​​​​​​​​​​​,
year  = {​​​​​​​​​​​​​​​2023. [Online]}​​​​​​​​​​​​​​​,
month = {​​​​​​​​​​​​​​​Accessed on: Month, Day, Year}​​​​​​​​​​​​​​​,
url = {​​​​​​​​​​​​​​​https://docs.aimsun.com/next/23.0.0/}​​​​​​​​​​​​​​​,
}​​​​​​​​​​​​​​​


Aimsun Next 20.0.5

@manual {​​​​​​​​AimsunManual,

title = {​​​​​​​​Aimsun Next 20.0.5 User's Manual}​​​​​​​​,
author = {​​​​​​​​Aimsun}​​​​​​​​,
edition =  {​​​​​​​​​​​​​​​Aimsun Next 20.0.5}​​​​​​​​​​​​​​​,
address = {​​​​​​​​​​​​​​​Barcelona, Spain}​​​​​​​​​​​​​​​,
year  = {​​​​​​​​​​​​​​​2021. [In software]}​​​​​​​​​​​​​​​,
month = {​​​​​​​​​​​​​​​Accessed on: Month, Day, Year}​​​​​​​​​​​​​​​,
url = {​​​​​​​​​​​​​​​qthelp://aimsun.com.aimsun.20.0/doc/UsersManual/Intro.html}​​​​​​​​​​​​​​​,
}​​​​​​​​​​​​​​​

Aimsun Next 23

TY  - COMP
T1  - Aimsun Next 23 User's Manual
A1  - Aimsun
ET - Aimsun Next Version 23.0.0
Y1  - 2023
Y2 - Accessed on: Month, Day, Year
CY  - Barcelona, Spain
PB  - Aimsun
UR  - [In software]. Available: https://docs.aimsun.com/next/23.0.0/


Aimsun Next 20.0.5

TY  - COMP
T1  - Aimsun Next 20.0.5 User's Manual
A1  - Aimsun
ET - Aimsun Next Version 20.0.5
Y1  - 2021
Y2 - Accessed on: Month, Day, Year
CY  - Barcelona, Spain
PB  - Aimsun
UR  - [In software]. Available: qthelp://aimsun.com.aimsun.20.0/doc/UsersManual/Intro.html