Aimsun Next Scripting  22
Public Member Functions | List of all members
NSPReader Class Reference

Public Member Functions

 NSPReader ()
 
 NSPReader (GKModel *model)
 
 ~NSPReader ()
 
void setForest (BaseForest *_forest)
 
void setForestFile (QString &filename)
 
const QVector< uint > & getVehicleIds ()
 
bool getCostByVehicleType ()
 
QVector< QDateTime > getIntervals ()
 
int getNbIntervals () const
 
const QDateTime & getIntervalAtPos (int pos) const
 
QList< QPair< int, int > > getODtrips (int _vehicleIndex, int _intervalIndex)
 
QVector< int > getPathIds (int _originId, int _originSection, int _destinationId, int _destinationSection, int _vehicleIndex, int _intervalIndex)
 
pathData getPath (int id)
 
QVector< PathStats * > getPathStats (int iOriginId, int iOriginSection, int iDestinationId, int iDestinationSection, int iVehicleIndex, int iIntervalIndex, int iUsingSection)
 
double getDemandTrips (qint32 interval, qint32 userIndex, qint32 originid, qint32 destinationid) const
 
double getPathDistance (GKModel *iModel, const QVector< int > &sections) const
 

Detailed Description

NSPReader gives access to the path results of a static assignment or a dynamic simulation. For the correct functioning of NSPReader it is important that the Active and Store checkboxes both are checked.

Constructor & Destructor Documentation

◆ NSPReader() [1/2]

NSPReader::NSPReader ( )

NSPReader constructor.

◆ NSPReader() [2/2]

NSPReader::NSPReader ( GKModel model)

NSPReader constructor with GKModel. It's better to use this constructor when possible.

◆ ~NSPReader()

NSPReader::~NSPReader ( )

NSPReader deconstructor.

Member Function Documentation

◆ getCostByVehicleType()

bool NSPReader::getCostByVehicleType ( )

Returns true if the paths were calculated considering the vehicle type, false otherwise.

◆ getDemandTrips()

double NSPReader::getDemandTrips ( qint32  interval,
qint32  userIndex,
qint32  originid,
qint32  destinationid 
) const

getDemandTrips Returns the number of trips in the traffic demand that has been used to create the apa file

Parameters
intervalRoute choice interval index. If the apa is from a static assignment then interval is always 0
userIndexThis is the vehicle type index
originidOrigin centroid id
destinationidDestination centroid id

◆ getIntervalAtPos()

const QDateTime & NSPReader::getIntervalAtPos ( int  pos) const

◆ getIntervals()

QVector< QDateTime > NSPReader::getIntervals ( )

getIntervals returns a list of all the intervals this path assignment has data from. When the path assignment comes from a static traffic assignment there will be only one interval When the path assignment comes from a dynamic simulation there will be as many intervals as route choice cycles have been calculated.

◆ getNbIntervals()

int NSPReader::getNbIntervals ( ) const

◆ getODtrips()

QList< QPair< int, int > > NSPReader::getODtrips ( int  _vehicleIndex,
int  _intervalIndex 
)

getODtrips returns a list of all OD pairs with a path assigned for the specified vehicle index and interval index. Usage in Python: trips = getODtrips(0,0) for i in range(0, len(trips) ) trip = trips[i] origin = trip[0] destination = trip[1]

◆ getPath()

pathData NSPReader::getPath ( int  id)

getPath returns a pathData object for the specified path id. Usage in Python: path = getPath(12) sectionIds = path.sectionIds percentage = path.percentage cost = path.travelTime volumen = path.cost for i in range(0, len(sectionIds) ) sectionId = sectionIds[i]

◆ getPathDistance()

double NSPReader::getPathDistance ( GKModel iModel,
const QVector< int > &  sections 
) const

Calculate path total distance

◆ getPathIds()

QVector< int > NSPReader::getPathIds ( int  _originId,
int  _originSection,
int  _destinationId,
int  _destinationSection,
int  _vehicleIndex,
int  _intervalIndex 
)

getPathIds returns a list of path IDs for the specified origin, destination, vehicle index and interval index. Set _originSection and _destinationSection to the ID of the section if percentages are used between the connectors of one centroid. Set to -1 to get all paths from origin to destination Usage: pathIds = getPathIds(101,-1, 154,-1, 0,0) for i in range(0, len(pathIds) ) pathId = pathIds[i]

◆ getPathStats()

QVector< PathStats * > NSPReader::getPathStats ( int  iOriginId,
int  iOriginSection,
int  iDestinationId,
int  iDestinationSection,
int  iVehicleIndex,
int  iIntervalIndex,
int  iUsingSection 
)

Get path stats for the specified origin, originSection, destination, destinationSection, vehicleIndex, intervalIndex, usingSection. Set intervalIndex to -1 for all indeces. Set destinationSection and originSection to -1 for all entrance and exit sections. Set iUsingSection to the section id to return only path statistics that pass through this section. Set iUsingsection to -1 to not use this option.

◆ getVehicleIds()

const QVector< uint > & NSPReader::getVehicleIds ( )

getVehicleIds returns a list of all user classes IDs that are present in the path assignment result. The index of the list is equivalent to the index of the user class in the assignment. Usage in Python: vehicleList = getVehicles() for i in range (0, len(vehicleList) ): vehicleIndex = i vehicleId = vehicleList[i] When only information about all is present, a single user class with ID 0 will be returned

◆ setForest()

void NSPReader::setForest ( BaseForest *  _forest)

Set the forest to be read.

◆ setForestFile()

void NSPReader::setForestFile ( QString &  filename)

Read the forest from an APA file.

© Aimsun SLU
Aimsun ®