Aimsun Next Scripting: GKTrafficDemand Class Reference
Aimsun Next Scripting  22
Public Types | Public Member Functions | Static Public Attributes | List of all members
GKTrafficDemand Class Reference
Inheritance diagram for GKTrafficDemand:
GKObject GKBaseObject

Public Types

enum  GKTrafficDemandType { eODDemand , eStateDemand }
 
- Public Types inherited from GKObject
enum  IdentifierFormFlag {
  eIdentifierDefault , eIdentifierId , eIdentifierName , eIdentifierExternalId ,
  eIdentifierTypeExternalName , eIdentifierDescription , eIdentifierStandard , eIdentifierStandardWithType ,
  eIdentifierAll
}
 
enum  GKLockType { eNone , eModification , eDelete , eModificationDelete }
 
enum  GKObjectStatus { eNew , eSaved , eModified , eDeleted }
 
typedef QFlags< GKObject::IdentifierFormFlagIdentifierForm
 

Public Member Functions

 GKTrafficDemand ()
 
virtual void init ()
 
bool isEmpty () const
 
bool isValid (bool=true, bool=true) const
 
bool overlappedItems () const
 
bool validUserClassesForDynamicSimulations () const
 
QVector< GKCentroidConfiguration * > getCentroidConfigurations () const
 
GKProblemNetgetProblemNet () const
 
void setProblemNet (GKProblemNet *)
 
QVector< const GKMobileAgent * > getUsedVehicles () const
 
QVector< GKUserClass * > getUsedUserClasses () const
 
void setFactor (const QString &afactor)
 
const QString & getFactor () const
 
const QVector< GKScheduleDemandItem > & getSchedule () const
 
QVector< GKScheduleDemandItemgetSchedule (GKTrafficDemandItem *) const
 
QVector< GKScheduleDemandItemgetSchedule (GKMobileAgent *veh) const
 
void removeSchedule ()
 
void addToSchedule (const GKScheduleDemandItem &)
 
void removeFromSchedule (const GKScheduleDemandItem &)
 
QTime initialTime () const
 
GKTimeDuration duration () const
 
const GKTrafficDemandType getDemandType () const
 
float getTrips (GKCentroid *from, GKCentroid *to, GKUserClass *userClass, GKGenericExperiment *exp) const
 
float getTripsByOrigin (GKCentroid *from, GKVehicle *veh, GKGenericExperiment *exp) const
 
float getTripsByDestination (GKCentroid *to, GKVehicle *veh, GKGenericExperiment *exp) const
 
float getTotalTrips (GKVehicle *veh, GKGenericExperiment *exp) const
 
GKTrafficArrivalsgetTrafficArrivals () const
 
void setTrafficArrivals (GKTrafficArrivals *aTrafficArrivals)
 
GKObjectclone (bool addItToModel=true) const
 
- Public Member Functions inherited from GKObject
 GKObject ()
 
 GKObject (const GKObject &o)
 
virtual void addedToCatalog ()
 
virtual void removedFromCatalog ()
 
uint getTick () const
 
virtual void increaseTick ()
 
void setTick (uint t)
 
virtual GKObjectclone (bool addItToModel=true) const
 
virtual GKObjectcloneAsTemporary (bool addItToModel=true) const
 
GKFoldergetCreateRootFolder ()
 
GKFoldergetRootFolder () const
 
void setRootFolder (GKFolder *afolder)
 
GKFolderfindFolder (const QString &byName) const
 
QVector< GKFolder * > getParentFolders () const
 
bool isDataValueNull (const GKColumn *attr) const
 
virtual QVariant * getDataValue (const GKColumn *attr, bool *deleteit, const GKContext &context=GKContext::anyContext) const
 
QVariant * getDataValueByID (uint attrId, bool *deleteit, const GKContext &context=GKContext::anyContext) const
 
virtual void setDataValue (const GKColumn *attr, const QVariant &v)
 
void setDataValueByID (uint attrId, const QVariant &v)
 
virtual void setDataValueObject (const GKColumn *attr, const GKObject *obj)
 
void setDataValueObjectByID (uint attrId, const GKObject *obj)
 
virtual void setDataValueDouble (const GKColumn *attr, double v)
 
void setDataValueDoubleByID (uint attrId, double v)
 
virtual double getDataValueInTS (const GKColumn *attr, GKTimeSerieIndex index, double *deviation=NULL) const
 
double getDataValueInTSByID (uint attrId, GKTimeSerieIndex index, double *deviation=NULL) const
 
bool hasAnyTSWithData () const
 
virtual GKTimeSeriegetDataValueTS (const GKColumn *attr) const
 
GKTimeSeriegetDataValueTSByID (uint attrId) const
 
virtual void setDataValueInTS (const GKColumn *attr, GKTimeSerieIndex index, double value, double deviation, GKTSDescription *aDescription=NULL, int reservedSize=0)
 
virtual void setDataValueInTS (const GKColumn *attr, GKTimeSerieIndex index, double value, double deviation, double lowerValue, GKTSDescription *aDescription=NULL, int reservedSize=0)
 
virtual void setDataValueInSingleTS (const GKColumn *attr, GKTimeSerieIndex index, double value, double deviation, GKTSDescription *aDescription)
 
void setDataValueInTSByID (uint attrId, GKTimeSerieIndex index, double value, double deviation, GKTSDescription *aDescription=NULL, int reservedSize=0)
 
virtual void setAggregatedValueInTS (const GKColumn *attr, double value, double deviation, GKTSDescription *aDescription=NULL)
 
void setAggregatedValueInTSByID (uint attrId, double value, double deviation, GKTSDescription *aDescription=NULL)
 
virtual void clearDataValueTS (const GKColumn *attr, GKTSDescription *aDescription=NULL)
 
void clearDataValueTSByID (uint attrId, GKTSDescription *aDescription=NULL)
 
virtual int getDataValueInt (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
int getDataValueIntByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
virtual double getDataValueDouble (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
double getDataValueDoubleByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
QString getDataValueString (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
QString getDataValueStringByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
virtual bool getDataValueBool (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
bool getDataValueBoolByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
virtual GKObjectgetDataValueObject (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
GKObjectgetDataValueObjectByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
QDate getDataValueDate (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
QDate getDataValueDateByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
QTime getDataValueTime (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
QTime getDataValueTimeByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
QDateTime getDataValueDateTime (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
QDateTime getDataValueDateTimeByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
GKTimeDuration getDataValueTimeDuration (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
GKTimeDuration getDataValueTimeDurationByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
void removeDataValue (const GKColumn *attr)
 
void removeDataValueByID (uint attrId)
 
const QString & getDescription () const
 
void setDescription (const QString &adescription)
 
const QString & getExternalId () const
 
void setExternalId (const QString &anId)
 
virtual GKObjectDelCmd * getDelCmd ()
 
virtual GKObjectConnectionDelCmd * getDelConnectionCmd (GKObject *target)
 
virtual void nonCommandObjectRemoved (GKObject *)
 
virtual void init ()
 
virtual void setId (uint aid, GKModel *model)
 
uint getId () const
 
QUuid getUUID () const
 
virtual void setName (const QString &aname)
 
const QString & getName () const
 
QString getExtendedId (IdentifierForm form=eIdentifierDefault) const
 
QString getNameOrExtendedId (IdentifierForm form=eIdentifierDefault) const
 
virtual const QString & getTypeName () const
 
virtual QString getTypeExternalName () const
 
const GKObjectgetMaster () const
 
GKTypegetType () const
 
virtual void setType (GKType *atype)
 
bool isA (const GKType *atype) const
 
bool isA (const QString &typeName) const
 
virtual void setModel (GKModel *amodel)
 
GKModelgetModel () const
 
virtual void setLock (GKLockType atype)
 
GKLockType getLock () const
 
virtual bool canBeDeleted () const
 
virtual bool canBeModified () const
 
virtual bool canBeEdited () const
 
GKObjectStatus getStatus () const
 
virtual void setStatus (const GKObjectStatus astatus)
 
void notifyStatusChange ()
 
bool isTemporary () const
 
void setTemporary (bool value)
 
bool isExternal () const
 
void setExternal (bool value)
 
virtual void preferencesChanged ()
 
void removeColumn (GKColumn *column)
 
void resetColumn (GKColumn *column)
 
- Public Member Functions inherited from GKBaseObject
 GKBaseObject ()
 
 if (base)
 
virtual uint getId () const =0
 
virtual const QString & getTypeName () const =0
 
virtual QString getTypeExternalName () const =0
 
virtual const GKObjectgetMaster () const =0
 
virtual const QString & getName () const =0
 
virtual const QString & getExternalId () const =0
 
virtual const QString & getDescription () const =0
 
virtual GKModelgetModel () const =0
 
virtual QVariant * getDataValue (const GKColumn *attr, bool *deleteit, const GKContext &context=GKContext::anyContext) const =0
 
virtual QVariant * getDataValueByID (uint attrId, bool *deleteit, const GKContext &context=GKContext::anyContext) const =0
 
virtual double getDataValueInTS (const GKColumn *attr, GKTimeSerieIndex index, double *deviation=NULL) const =0
 
virtual double getDataValueInTSByID (uint attrId, GKTimeSerieIndex index, double *deviation=NULL) const =0
 
virtual GKTimeSeriegetDataValueTS (const GKColumn *attr) const =0
 
virtual GKTimeSeriegetDataValueTSByID (uint attrId) const =0
 
virtual int getDataValueInt (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual int getDataValueIntByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual double getDataValueDouble (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual double getDataValueDoubleByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual QString getDataValueString (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual QString getDataValueStringByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual bool getDataValueBool (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual bool getDataValueBoolByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual GKObjectgetDataValueObject (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual GKObjectgetDataValueObjectByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual QDate getDataValueDate (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual QDate getDataValueDateByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual QTime getDataValueTime (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual QTime getDataValueTimeByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual QDateTime getDataValueDateTime (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual QDateTime getDataValueDateTimeByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual GKTimeDuration getDataValueTimeDuration (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual GKTimeDuration getDataValueTimeDurationByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 

Static Public Attributes

static uint fromAtt
 
static uint durationAtt
 
static uint factorAtt
 
static uint subnetworkAtt
 
- Static Public Attributes inherited from GKObject
static uint typeNameAtt
 
static uint typeExternalNameAtt
 
static uint revisedAtt
 
- Static Public Attributes inherited from GKBaseObject
Py_END_ALLOW_THREADS static End uint idAtt
 
static uint nameAtt
 
static uint externalIdAtt
 
static uint descriptionAtt
 

Additional Inherited Members

- Public Attributes inherited from GKBaseObject
ConvertToSubClassCode Py_BEGIN_ALLOW_THREADS GKBaseObjectbase = (GKBaseObject*)sipCpp
 
 sipType = 0
 

Detailed Description

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 both.

The traffic is in the OD or the state, the demand is just a container for this information organized by

Member Enumeration Documentation

◆ GKTrafficDemandType

Enumerator
eODDemand 
eStateDemand 

Constructor & Destructor Documentation

◆ GKTrafficDemand()

GKTrafficDemand::GKTrafficDemand ( )

Member Function Documentation

◆ addToSchedule()

void GKTrafficDemand::addToSchedule ( const GKScheduleDemandItem )

Adds a new schedule item (the item is copied)

◆ clone()

GKObject * GKTrafficDemand::clone ( bool  addItToModel = true) const
virtual

It clones the whole traffic demand and returns the copy. The cloned traffic demand is added to the catalog if "addItToModel" is true.

Reimplemented from GKObject.

◆ duration()

GKTimeDuration GKTrafficDemand::duration ( ) const

Returns the duration for this traffic demand.

◆ getCentroidConfigurations()

QVector< GKCentroidConfiguration * > GKTrafficDemand::getCentroidConfigurations ( ) const

If using OD matrices returns the centroid configuration to be use in this traffic demand (only matrices for that configuration can be used).

◆ getDemandType()

const GKTrafficDemandType GKTrafficDemand::getDemandType ( ) const

Returns the type of this demand, either OD-based or Traffic State-based.

◆ getFactor()

const QString & GKTrafficDemand::getFactor ( ) const

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.

◆ getProblemNet()

GKProblemNet * GKTrafficDemand::getProblemNet ( ) const

Gets the Subnetwork for this demand (if any)

◆ getSchedule() [1/3]

const QVector< GKScheduleDemandItem > & GKTrafficDemand::getSchedule ( ) const

Returns the information about the schedule defined. The GKScheduleDemandItem are copies and changes done to them will not be reflected in the demand. To modify the items in the schedule see the code below as a sample:

#get a copy of the schedule
currentSchedule = trafficDemand.getSchedule()
#remove all schedule items
trafficDemand.removeSchedule()
for schedule in currentSchedule:
#set schedule item factor to 150
schedule.setFactor('150')
#add the new schedule item to the traffic demand
td.addToSchedule(schedule)

Another option to modify the items in the schedule would be to use the removeFromSchedule and addToSchedule functions.

◆ getSchedule() [2/3]

QVector< GKScheduleDemandItem > GKTrafficDemand::getSchedule ( GKMobileAgent veh) const

Returns all the schedule items for the vehicle "veh" sorted by time. The GKScheduleDemandItem are copies and changes done to them will not be reflected in the demand.

◆ getSchedule() [3/3]

QVector< GKScheduleDemandItem > GKTrafficDemand::getSchedule ( GKTrafficDemandItem ) const

Returns all the schedule items in where the GKTrafficDemandItem "item" is used. The GKScheduleDemandItem are copies and changes done to them will not be reflected in the demand.

◆ getTotalTrips()

float GKTrafficDemand::getTotalTrips ( GKVehicle veh,
GKGenericExperiment exp 
) const

Returns the total number of trips in this matrix for a vehicle (if veh is None, then the trips for all the vehicles in the demand will be returned). If a factor is defined as a variable, and the variable has been defined in an experiment or scenario, then the experiment where to find the definition of the variable can also be provided.

◆ getTrafficArrivals()

GKTrafficArrivals * GKTrafficDemand::getTrafficArrivals ( ) const

Returns the traffic arrivals object that will be used.

◆ getTrips()

float GKTrafficDemand::getTrips ( GKCentroid from,
GKCentroid to,
GKUserClass userClass,
GKGenericExperiment exp 
) const

Returns the number of trips from an origin to a destination centroid for a vehicle (if veh is None, then the trips for all the vehicles in the demand will be returned). If a factor is defined as a variable, and the variable has been defined in an experiment or scenario, then the experiment where to find the definition of the variable can be also provided. Note that if from is not a valid origin or to a valid destination then 0 is returned (no trips)

◆ getTripsByDestination()

float GKTrafficDemand::getTripsByDestination ( GKCentroid to,
GKVehicle veh,
GKGenericExperiment exp 
) const

Returns the number of trips to a destination from all the origin centroids for a vehicle (if veh is None, then the trips for all the vehicles in the demand will be returned). If a factor is defined as a variable, and the variable has been defined in an experiment or scenario, then the experiment where to find the definition of the variable can also be provided. Note that if to is not a valid destination then 0 is returned (no trips).

◆ getTripsByOrigin()

float GKTrafficDemand::getTripsByOrigin ( GKCentroid from,
GKVehicle veh,
GKGenericExperiment exp 
) const

Returns the number of trips from an origin to all the destination centroids for a vehicle (if veh is None, then the trips for all the vehicles in the demand will be returned). If a factor is defined as a variable, and the variable has been defined in an experiment or scenario, then the experiment where to find the definition of the variable can also be provided. Note that if from is not a valid origin then 0 is returned (no trips).

◆ getUsedUserClasses()

QVector< GKUserClass * > GKTrafficDemand::getUsedUserClasses ( ) const

Returns a list of the user classes used in this traffic demand.

◆ getUsedVehicles()

QVector< const GKMobileAgent * > GKTrafficDemand::getUsedVehicles ( ) const

Returns a list of the vehicles used in this traffic demand.

◆ init()

virtual void GKTrafficDemand::init ( )
virtual

Object initialization must be here, this function is called after setting object type, model and the creation of the associate GKRow. Attributes that not depend of the type, or the model can be initialised in the object constructor (since the object is first created and then the type and model are s).

Usually only GKColumn attributes will be initialised here.

Reimplemented from GKObject.

◆ initialTime()

QTime GKTrafficDemand::initialTime ( ) const

Returns the initial time for this traffic demand.

◆ isEmpty()

bool GKTrafficDemand::isEmpty ( ) const

Returns true if no item is in the demand.

◆ isValid()

bool GKTrafficDemand::isValid ( bool  = true,
bool  = true 
) const

Returns true if the demand is valid:

  • No holes between demand items
  • All the vehicles have a demand item that starts at the same time and another one that ends at the same time
  • There is no overlap between items

That is, the temporary line is complete and the same for all the vehicles.

A empty demand ( GKTrafficDemand::isEmpty )returns true.

If reportErrors is true the error will be show in the log window.

◆ overlappedItems()

bool GKTrafficDemand::overlappedItems ( ) const

Returns true if any item overlaps with another. Called by GKTrafficDemand::isValid

◆ removeFromSchedule()

void GKTrafficDemand::removeFromSchedule ( const GKScheduleDemandItem )

Removes a schedule item that is equal to "item".

◆ removeSchedule()

void GKTrafficDemand::removeSchedule ( )

Removes all the schedule information.

◆ setFactor()

void GKTrafficDemand::setFactor ( const QString &  afactor)

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 possible to set a factor by demand item.

◆ setProblemNet()

void GKTrafficDemand::setProblemNet ( GKProblemNet )

Sets the Subnetwork for this demand (if any)

◆ setTrafficArrivals()

void GKTrafficDemand::setTrafficArrivals ( GKTrafficArrivals aTrafficArrivals)

Sets the traffic arrivals object that will be used.

◆ validUserClassesForDynamicSimulations()

bool GKTrafficDemand::validUserClassesForDynamicSimulations ( ) const

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

Member Data Documentation

◆ durationAtt

uint GKTrafficDemand::durationAtt
static

Traffic demand duration.

◆ factorAtt

uint GKTrafficDemand::factorAtt
static

Traffic demand factor.

◆ fromAtt

uint GKTrafficDemand::fromAtt
static

Traffic demand initial time.

◆ subnetworkAtt

uint GKTrafficDemand::subnetworkAtt
static

Traffic demand subnetwork if it belongs to any.

© Aimsun SLU
Aimsun ®