How to use Attribute Overrides
December 2016: Maud Chassat describes how Aimsun’s attribute overrides can be extremely useful for modifying attributes of existing objects.
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.
December 2016: Maud Chassat describes how Aimsun’s attribute overrides can be extremely useful for modifying attributes of existing objects.
“My model is in the Atlantic Ocean!”
Tessa Hayman guides you on how to set the coordinate reference system correctly in your Aimsun Next model.
SHARE
Aimsun Next 24
Aimsun (2024). Aimsun Next 24 User’s Manual, Aimsun Next Version 24.0.0, Barcelona, Spain. Accessed on: April. 16, 2024. [Online].
Available: https://docs.aimsun.com/next/24.0.0/
Aimsun Next 24
@manual {AimsunManual,
title = {Aimsun Next 24 User’s Manual},
author = {Aimsun},
edition = {Aimsun Next 24.0.0},
address = {Barcelona, Spain},
year = {2024. [Online]},
month = {Accessed on: Month, Day, Year},
url = {https://docs.aimsun.com/next/24.0.0},
}
Aimsun Next 24
TY – COMP
T1 – Aimsun Next 24 User’s Manual
A1 – Aimsun
ET – Aimsun Next Version 24.0.0
Y1 – 2024
Y2 – Accessed on: Month, Day, Year
CY – Barcelona, Spain
PB – Aimsun
UR – [In software]. Available:
https://docs.aimsun.com/next/24.0.0/