How to define different costs per trip purpose in static models

Technical Note #55
January 2021

By Marga Delgado

In static models, you might want to include the different perceptions of cost that network users will have about certain network components, depending on the purpose of the trip. A commuter may consider using a toll road, but may be more reluctant to use it when going shopping.

In Aimsun Next, both static assignments (private vehicles) and transit assignments (passengers) can take trip purpose into consideration when evaluating a path cost.

 

In Technical Note #53, we gave some tips on how to modify the cost for static assignment based on the vehicle type. Demands in static models are coded through OD matrices and these are given by user class (vehicle type + trip purpose). Accessing the trip purpose in a volume delay function, turn penalty function, and junction delay function is, therefore, as easy as accessing the vehicle type:

vehicle = context.userClass.getPurpose()

 

For example, in a BPR function that has an additional term for tolls, we can decrease the vehicle VoT (value of time), which converts a toll (coded in the first user defined cost) into time units including a weight, when the trip purpose is ‘Work’.

def vdf(context, section, funcVolume):
	vehicleName = context.userClass.getVehicle().getName()
	tripPurposeName = context.userClass.getPurpose().getName()
	vehicleVoT = context.userClass.getVehicle().getValueOfTimeMean()
	if vehiclePurpose==”Work”: #If trip purpose is “Work”
		vehicleVoT = 0.5 * vehicleVoT

	#coefficients alpha and beta must be modified accordingly
	alpha = 0.15
	beta = 4.0
	freeflowTravelTime = ( 60.0 / section.getSpeed() ) * section.length3D() / 1000.0 
	volume = funcVolume.getVolume()
	addVolume = section.getAdditionalVolume()
	capacity = section.getCapacity()
	cost = freeflowTravelTime * ( 1 + alpha * ((volume + addVolume) / capacity ) ** beta) + vehicleVoT * section.getUserDefinedCost()
	return cost

 

Another option, if you want to define a different VoT or VOC (vehicle operating cost) per vehicle type and trip purpose, is to define these values as an attribute of the User Class instead of using the Vehicle Type parameter. Activate the Types window, find the User Class type and double-click on User Class (GKUserClass) to access the Type Editor.

 

 

How to define different costs per trip purpose in static models

 

 

Click the Add button and create a new attribute of the type Double.

 

 

How to define different costs per trip purpose in static models

 

 

This attribute will now be available for any User Class. You can find it in the Attributes tab in the User Class Editor. Just fill in the values and access this attribute in the cost functions (for section, turn, or both).

 

 

How to define different costs per trip purpose in static models

 

 

col = section.getModel().getColumn("GKUserClass::VoTperPurpose")
VoT = context.userClass.getDataValueDouble(col)

 

Transit cost functions can also access the trip purpose through the context parameter, and can access user class attributes, so you can still use the approaches presented above. In addition, another approach is available. In the User Class editor, for each Vehicle Type and Trip Purpose, a set of weights for Transit is available. These weights are automatically taken into account when adding up all cost components for the evaluation of the total cost of a transit trip.

 

 

How to define different costs per trip purpose in static models

 

 

For more information on static private and transit functions, please see qthelp://aimsun.com.aimsun.20.0/doc/UsersManual/FunctionEditing.html or attend one of our Macroscopic or Strategic Modeling courses.

 

For more information on scripting, please see qthelp://aimsun.com.aimsun.20.0/doc/UsersManual/ScriptIntro.html or attend one of our Scripting courses.