Road Class Reference

A class to represent a road in the simulation. More...

#include <Road.h>

Collaboration diagram for Road:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void setAllowLaneChanging (bool status)
 Sets whether or not lane changing is allowed.
bool getAllowLaneChanging ()
 Gets whether or not lane changing is allowed.
void setPosOuputDetectorDirPos (int loc)
 Sets the position of output detector in the positive direction.
void setPosOuputDetectorDirNeg (int loc)
 Sets the position of output detector in the negative direction.
void setDetectors (std::vector< Detector * > detectors)
 Sets the detector properties.
void initTruckGroup (string inFile, string outFile, WORD fileType)
 Initialises the file handler.
void setNoLanesDirPos (int nlpos)
 Sets the number of lanes in the positive direction.
void setNoLanesDirNeg (int nlneg)
 Sets the number of lanes in the negative direction.
void setNoDirections (int nd)
 Sets the number of directions.
void setNoLanes (int nl)
 Sets the number of lanes.
void setRoadLength (int L)
 Sets the length of the road.
void setTrafFileNoLanesDirPos (int nl)
 Sets the number of lanes in the positive direction in the traffic file.
void setTrafFileNoLanesDirNeg (int nl)
 Sets the number of lanes in the negative direction in the traffic file.
void setIDMParams_Car (CIDMParameterSet *Params)
 Sets the Car IDM Parameter Set.
void setIDMParams_SmallTruck (CIDMParameterSet *Params)
 Sets the Small Truck IDM Parameter Set.
void setIDMParams_LargeTruck (CIDMParameterSet *Params)
 Sets the Large Truck IDM Parameter Set.
void setIDMParams_Crane (CIDMParameterSet *Params)
 Sets the Crane IDM Parameter Set.
void setIDMParams_Lowloader (CIDMParameterSet *Params)
 Sets the Lowloader IDM Parameter Set.
double getLength ()
 Gets the length of the road.
M2D getVehicles ()
 Gets all the vehicles on the road.
void populate (double step, double CurrentTime)
 Populates the road.
double init ()
 Initialises the road.
 Road ()
 Constructor.
virtual ~Road ()
 Destructor.
bool update (double step)
 Updates the properties of the road.

Private Member Functions

void MapTrafLaneToSimLane (Vehicle *pVeh)
 Maps vehicles to appropriate lanes.
void setIDMDriverModel (Vehicle *pVeh)
 Sets a vehicle's drivermodel.

Private Attributes

int m_PosOutputDetectorDirPos
int m_PosOutputDetectorDirNeg
CIDMParameterSetm_pIDMParams_Car
CIDMParameterSetm_pIDMParams_SmallTruck
CIDMParameterSetm_pIDMParams_LargeTruck
CIDMParameterSetm_pIDMParams_Crane
CIDMParameterSetm_pIDMParams_Lowloader
Direction DirectionPos
Direction DirectionNeg
TruckGroupm_TruckGroup
FileHandlerm_FileHandler
int m_TrafFileNoLanesDirPos
int m_TrafFileNoLanesDirNeg
std::vector< Truck * > m_BufferVehicles
std::vector< Lane * > m_vLanes
std::vector< Detector * > m_vDetectorsPos
std::vector< Detector * > m_vDetectorsNeg
std::string filename
bool m_bEndOfFile
bool m_AllowLaneChanging
int m_NoLanesDirPos
int m_NoLanesDirNeg
int m_NoDirections
int m_NoLanes
int m_RoadLength


Detailed Description

A class to represent a road in the simulation.

Constructor & Destructor Documentation

Road::Road (  ) 

Constructor.

Road::~Road (  )  [virtual]

Destructor.


Member Function Documentation

void Road::setAllowLaneChanging ( bool  status  ) 

Sets whether or not lane changing is allowed.

Parameters:
status Whether or not lane changing is allowed

bool Road::getAllowLaneChanging (  ) 

Gets whether or not lane changing is allowed.

Returns:
Whether or not lane changing is allowed

void Road::setPosOuputDetectorDirPos ( int  loc  ) 

Sets the position of output detector in the positive direction.

Parameters:
loc The position of output detector

void Road::setPosOuputDetectorDirNeg ( int  loc  ) 

Sets the position of output detector in the negative direction.

Parameters:
loc The position of output detector

void Road::setDetectors ( std::vector< Detector * >  detectors  ) 

Sets the detector properties.

Parameters:
detectors The vector of detectors to use

void Road::initTruckGroup ( string  inFile,
string  outFile,
WORD  fileType 
)

Initialises the file handler.

Parameters:
inFile The input file to read from
outFile The output file to write to
fileType The type of file
This function determines whether the type of file being used is CASTOR or SAFT format, and creates an appropriate filehandler based on the input provided.

void Road::setNoLanesDirPos ( int  nlpos  ) 

Sets the number of lanes in the positive direction.

Parameters:
nlpos The number of lanes in the positive direction

void Road::setNoLanesDirNeg ( int  nlneg  ) 

Sets the number of lanes in the negative direction.

Parameters:
nlneg The number of lanes in the negative direction

void Road::setNoDirections ( int  nd  ) 

Sets the number of directions.

Parameters:
nd The number of directions

void Road::setNoLanes ( int  nl  ) 

Sets the number of lanes.

Parameters:
nl The number of lanes

void Road::setRoadLength ( int  L  ) 

Sets the length of the road.

Parameters:
L The length of the road

void Road::setTrafFileNoLanesDirPos ( int  nl  ) 

Sets the number of lanes in the positive direction in the traffic file.

Parameters:
nl The number of lanes

void Road::setTrafFileNoLanesDirNeg ( int  nl  ) 

Sets the number of lanes in the negative direction in the traffic file.

Parameters:
nl The number of lanes

void Road::setIDMParams_Car ( CIDMParameterSet Params  ) 

Sets the Car IDM Parameter Set.

Parameters:
Params The IDM Parameter Set

void Road::setIDMParams_SmallTruck ( CIDMParameterSet Params  ) 

Sets the Small Truck IDM Parameter Set.

Parameters:
Params The IDM Parameter Set

void Road::setIDMParams_LargeTruck ( CIDMParameterSet Params  ) 

Sets the Large Truck IDM Parameter Set.

Parameters:
Params The IDM Parameter Set

void Road::setIDMParams_Crane ( CIDMParameterSet Params  ) 

Sets the Crane IDM Parameter Set.

Parameters:
Params The IDM Parameter Set

void Road::setIDMParams_Lowloader ( CIDMParameterSet Params  ) 

Sets the Lowloader IDM Parameter Set.

Parameters:
Params The IDM Parameter Set

double Road::getLength (  ) 

Gets the length of the road.

Returns:
The length of the road

M2D Road::getVehicles (  ) 

Gets all the vehicles on the road.

Returns:
All the vehicles on the road

void Road::populate ( double  step,
double  CurrentTime 
)

Populates the road.

Parameters:
step The timestep
CurrentTime The simulation's current time
This function handles the population of the road which is called in each timestep. The main loop handles the processing of the vehicles in the buffer. If the head of the buffer is currently entering the road, then the other vehicles are also checked. However, since the vehicles are sorted in order of time, if the head of the buffer is not currently entering the road, then no other vehicle is either. When a vehicle enters the road from the buffer, the next vehicle is read from the file being used, and added to the buffer.

double Road::init (  ) 

Initialises the road.

Returns:
The time to the first vehicle
This function initialises the road object. It begins by loading a buffer of vehicles which it will process, and maps these vehicles to their respective lanes. It then takes account of cumulative lane identifiers by loading each direction's lanes into a vector of cumulative lanes. Detectors are also set in each direction to facilitate the retrieval of updated vehicle information when a vehicle passes a specified point.

bool Road::update ( double  step  ) 

Updates the properties of the road.

Parameters:
step The timestep
Returns:
Whether or not the simulation is still running
This function is called for each timestep of the simulation and updates its directions, once the directions are not empty

void Road::MapTrafLaneToSimLane ( Vehicle pVeh  )  [private]

Maps vehicles to appropriate lanes.

Parameters:
pVeh The vehicle to map
This function updates the lane provided by the vehicle's original traffic file assignment to an appropriate lane in the simulation. This is to facilitate the simulation of more lanes than the input file allows for

void Road::setIDMDriverModel ( Vehicle pVeh  )  [private]

Sets a vehicle's drivermodel.

Parameters:
pVeh The vehicle to set
This function sets the drivermodel of a particular vehicle based on the type of that vehicle


Member Data Documentation

std::vector<Truck*> Road::m_BufferVehicles [private]

std::vector<Lane*> Road::m_vLanes [private]

std::vector<Detector*> Road::m_vDetectorsPos [private]

std::vector<Detector*> Road::m_vDetectorsNeg [private]

std::string Road::filename [private]

bool Road::m_bEndOfFile [private]

bool Road::m_AllowLaneChanging [private]

int Road::m_NoLanesDirPos [private]

int Road::m_NoLanesDirNeg [private]

int Road::m_NoDirections [private]

int Road::m_NoLanes [private]

int Road::m_RoadLength [private]


The documentation for this class was generated from the following files:

Generated on Fri Jul 25 16:11:20 2008 for EvolveTraffic by  doxygen 1.5.6