PyANGKernel.GKTrafficDemand¶
- class GKTrafficDemand¶
The traffic demand for a network.
Details
A traffic demand is used by the Aimsun Next simulators to generate traffic in a network. It can be based either in OD matrices (
GKODMatrix) or traffic states (GKTrafficState) but not on a mixture of both.The traffic is in the OD matrix or the state, the demand is just a container for this information organized by - time - user class (vehicle type and purpose) An entry (by time and user class) is stored in a
GKTrafficDemandItemobject.Synopsis¶
Methods¶
def
__init__()def
addToSchedule()def
duration()def
getCentroids()def
getDemandType()def
getFactor()def
getFactorValue()def
getProblemNet()def
getSchedule()def
getTotalMatrix()def
getTotalTrips()def
getTrips()def
hasPedestrians()def
initialTime()def
isEmpty()def
isValid()def
removeSchedule()def
setFactor()def
setProblemNet()
Static functions¶
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
- class GKTrafficDemandType¶
The Traffic Demand can be based in OD matrices or States.
- __init__()¶
- __init__(src)
- Parameters:
src –
GKTrafficDemand
Copy constructor which creates a ‘copy’ of the current demand.
Warning
Referenced objects are not duplicated. The new
GKTrafficDemandobject will instead share the referenced objects with this one.- addToSchedule(item)¶
- Parameters:
item –
GKScheduleDemandItem
Adds a new schedule item (the item is copied). It’s highly recommended that before adding new items the user calls setEnableColumnUpdate(false) to disable the total trips update.
- clearExternalMatrixData()¶
clear external matrices
- compressMatrices()¶
Compress all the matrices in this demand.
Decompress all the matrices in this demand. Returns true if any matrix was compressed and then decompressed by this call.
- duration()¶
- Return type:
Returns the duration for this traffic demand.
- ensureMatrixData()¶
ensure matrix data of demand
- getCentroidConfigurations()¶
- Return type:
.list of GKCentroidConfiguration
If using OD matrices, it returns all centroid configurations. It is possible to have OD matrices from different centroid configurations within the same traffic demand.
- getCentroids()¶
- Return type:
.std.vectorGKCentroid
Get all the centroids in the different centroid configuration
- getDemandType()¶
- Return type:
Returns the type of this demand, either OD Matrix based or Traffic State-based.
Returns the percentage of the traffic demand to be used. 100 means all the traffic, 50 half the traffic, 200 two times the traffic found in each demand item. Note that it is possible also to set a factor by demand item.
- getFactorValue([exp=None])¶
- Parameters:
exp –
GKGenericExperiment- Return type:
Returns the ‘factor’ value as a number. If the factor is defined through a variable, then the given experiment will be used to get the value. If the factor is not defined in the experiment, 100.0 will be returned.
- getProblemNet()¶
- Return type:
Returns the Subnetwork for this demand (if any).
- getSchedule()¶
- Return type:
.list of GKScheduleDemandItem
Returns all the schedule.
- getSchedule(veh)
- Parameters:
veh –
GKMobileAgent- Return type:
.list of GKScheduleDemandItem
Returns all the items for the vehicle “veh” sorted by time.
- getSchedule(item)
- Parameters:
item –
GKTrafficDemandItem- Return type:
.list of GKScheduleDemandItem
Returns all the schedule in where the
GKTrafficDemandItem“item” is used- getSchedule(userClass)
- Parameters:
userClass –
GKUserClass- Return type:
.list of GKScheduleDemandItem
Returns all the items for the user class “userClass” sorted by time.
- getTotalMatrix(cenConfiguration[, userClass=None[, experiment=None]])¶
- Parameters:
cenConfiguration –
GKCentroidConfigurationuserClass –
GKUserClassexperiment –
GKGenericExperiment
- Return type:
- getTotalTrips([veh=None[, exp=None]])¶
- Parameters:
veh –
GKVehicleexp –
GKGenericExperiment
- Return type:
Returns the total number of trips in this matrix for a vehicle (if veh is NULL, then the trips for all the vehicles in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem.- getTrafficArrivals()¶
- Return type:
Returns the traffic arrivals object that will be used.
helper function: list all the available traffic arrivals items, either from the project or from the subnetwork
- getTrips(from, to[, userClass=None[, exp=None]])¶
- Parameters:
from –
GKCentroidto –
GKCentroiduserClass –
GKUserClassexp –
GKGenericExperiment
- Return type:
Returns the number of trips from an origin to a destination centroid for a vehicle (if veh is NULL, then the trips for all the vehicles in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem. Note that if from is not a valid origin or to a valid destination then 0 is returned (no trips)- getTrips(from, to, start, duration[, userClass=None[, iExperiment=None]])
- Parameters:
from –
GKCentroidto –
GKCentroidstart – int
duration – int
userClass –
GKUserClassiExperiment –
GKGenericExperiment
- Return type:
Returns the number of trips from an origin to a destination centroid for a user class between start time and end time. Applies factors from
GKGenericExperimentandGKScheduleDemandItem.- getTripsByDestination(to[, user=None[, exp=None]])¶
- Parameters:
to –
GKCentroiduser –
GKUserClassexp –
GKGenericExperiment
- Return type:
Returns the number of trips to a destination from all the origin centroids for a vehicle (if veh is NULL, then the trips for all the vehicles in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem. Note that if to is not a valid destination then 0 is returned (no trips).- getTripsByDestination(to, veh, exp)
- Parameters:
to –
GKCentroidveh –
GKVehicleexp –
GKGenericExperiment
- Return type:
Returns the number of trips to a destination from all the origin centroids for a user class(if user is NULL, then the trips for all the user classes in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem. Note that if to is not a valid destination then 0 is returned (no trips).- getTripsByOrigin(from[, user=None[, exp=None]])¶
- Parameters:
from –
GKCentroiduser –
GKUserClassexp –
GKGenericExperiment
- Return type:
Returns the number of trips from an origin to all the destination centroids for a user class (if user is NULL, then the trips for all the vehicles in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem. Note that if from is not a valid origin then 0 is returned (no trips).- getTripsByOrigin(from, veh, exp)
- Parameters:
from –
GKCentroidveh –
GKVehicleexp –
GKGenericExperiment
- Return type:
Returns the number of trips from an origin to all the destination centroids for a vehicle (if veh is NULL, then the trips for all the vehicles in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem. Note that if from is not a valid origin then 0 is returned (no trips).- getUsedUserClasses()¶
- Return type:
.std.vectorGKUserClass
Returns a list of the user classes used in this traffic demand.
- getUsedVehicles()¶
- Return type:
.list of const GKMobileAgent
Returns a list of the mobile agents (either vehicle types or pedestrian types) used in this traffic demand.
Returns true if any of the mobile agents in this traffic demand is a pedestrian type
- hasTripsByDestination(to[, user=None[, exp=None]])¶
- Parameters:
to –
GKCentroiduser –
GKUserClassexp –
GKGenericExperiment
- Return type:
Returns if the centroid has any trips by destination for a user class (if user is nullptr, then the trips for all the vehicles in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem. Note that if from is not a valid origin then 0 is returned (no trips).- hasTripsByDestination(to, veh, exp)
- Parameters:
to –
GKCentroidveh –
GKVehicleexp –
GKGenericExperiment
- Return type:
Returns if the centroid has any trips by destination for a vehicle (if veh is nullptr, then the trips for all the vehicles in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem. Note that if from is not a valid origin then 0 is returned (no trips).- hasTripsByOrigin(from[, user=None[, exp=None]])¶
- Parameters:
from –
GKCentroiduser –
GKUserClassexp –
GKGenericExperiment
- Return type:
Returns if the centroid has any trips by origin for a user class (if user is nullptr, then the trips for all * the vehicles in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem. * Note that if from is not a valid origin then 0 is returned (no trips).- hasTripsByOrigin(from, veh, exp)
- Parameters:
from –
GKCentroidveh –
GKVehicleexp –
GKGenericExperiment
- Return type:
Returns if the centroid has any trips by origin for a vehicle (if veh is nullptr, then the trips for all * the vehicles in the demand will be returned). Applies factors from
GKGenericExperimentandGKScheduleDemandItem. * Note that if from is not a valid origin then 0 is returned (no trips).Returns the initial time for this traffic demand.
Returns true if no item is in the demand.
- isItIncludedInPlan(plan)¶
- Parameters:
plan –
GKMasterControlPlan- Return type:
Checks if all the times in this demand have control plan information in the master control plan
- isValid([reportErrors=true[, checkHoles=true]])¶
- Parameters:
reportErrors – bool
checkHoles – bool
- Return type:
Returns true if the demand is valid: - No holes between demand items. - All the vehicles demands start and end at the same time. - There is no overlap between items.
That is, the temporal line is complete and the same for all the vehicles.
A empty demand (
isEmpty)returns true.If <b>reportErrors</b> is true, the error will be shown in the Log window.
Returns true if any item overlaps with another. Called by
isValid.- removeFromSchedule(item)¶
- Parameters:
item –
GKScheduleDemandItem
Removes a schedule item that is equal to “item” from the schedule. The item itself is not deleted.
- removeSchedule()¶
Removes all the schedule information.
- setFactor(afactor)¶
- Parameters:
afactor – str
Sets the percentage of the traffic demand to be used. 100 means all the traffic, 50 half the traffic, 200 two times the traffic found in each demand item. Note that it is also possible to set a factor by demand item.
Moves all the schedule from its original initial time to the new initial time given.
- setProblemNet(pn)¶
- Parameters:
pn –
GKProblemNet
Sets the Subnetwork for this demand (if any).
- setTrafficArrivals(aTrafficArrivals)¶
- Parameters:
aTrafficArrivals –
GKTrafficArrivals
Sets the traffic arrivals object that will be used.
- trafficDemandItemHasChanged(i)¶
- Parameters:
Notifies the
GKTrafficDemandthat the specifiedGKTrafficDemandItemhas changed.- static translateFactor(factor[, exp=None])¶
- Parameters:
factor – str
exp –
GKGenericExperiment
- Return type:
Helper function used by
See also
Returns true if there are as maximum one purpose per vehicle type. Dynamic simulations do not allow right now traffic demands with different purposes for the same vehicle type