ROJTREdge Class Reference

#include <ROJTREdge.h>

Inheritance diagram for ROJTREdge:

ROEdge

Detailed Description

An edge the jtr-router may route through.

A router edge extended by the definition about the probability a vehicle chooses a certain following edge over time.

Definition at line 55 of file ROJTREdge.h.


Public Types

enum  EdgeType { ET_NORMAL, ET_DISTRICT, ET_SOURCE, ET_SINK }
 Possible types of edges. More...

Public Member Functions

void addFollower (ROEdge *s) throw ()
 Adds information about a connected edge.
void addFollowerProbability (ROJTREdge *follower, SUMOTime begTime, SUMOTime endTime, SUMOReal probability)
 adds the information about the percentage of using a certain follower
ROJTREdgechooseNext (const ROVehicle *const, SUMOTime time) const
 Returns the next edge to use.
 ROJTREdge (const std::string &id, RONode *from, RONode *to, unsigned int index) throw ()
 Constructor.
void setTurnDefaults (const std::vector< SUMOReal > &defs)
 Sets the turning definition defaults.
 ~ROJTREdge () throw ()
 Destructor.
Methods for getting/setting travel time and cost information
void addEffort (SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd) throw ()
 Adds a weight value.
void addTravelTime (SUMOReal value, SUMOReal timeBegin, SUMOReal timeEnd) throw ()
 Adds a travel time value.
SUMOReal getCO2Effort (const ROVehicle *const veh, SUMOReal time) const throw ()
SUMOReal getCOEffort (const ROVehicle *const veh, SUMOReal time) const throw ()
SUMOReal getEffort (const ROVehicle *const veh, SUMOReal time) const throw ()
 Returns the effort for this edge.
ROEdgegetFollower (unsigned int pos) const throw ()
 Returns the edge at the given position from the list of reachable edges.
SUMOReal getFuelEffort (const ROVehicle *const veh, SUMOReal time) const throw ()
SUMOReal getHCEffort (const ROVehicle *const veh, SUMOReal time) const throw ()
unsigned int getNoFollowing () const throw ()
 Returns the number of edges this edge is connected to.
SUMOReal getNoiseEffort (const ROVehicle *const veh, SUMOReal time) const throw ()
SUMOReal getNOxEffort (const ROVehicle *const veh, SUMOReal time) const throw ()
SUMOReal getPMxEffort (const ROVehicle *const veh, SUMOReal time) const throw ()
SUMOReal getTravelTime (const ROVehicle *const veh, SUMOReal time) const throw ()
 Returns the travel time for this edge.
Set-up methods
virtual void addLane (ROLane *lane) throw ()
 Adds a lane to the edge while loading.
void buildTimeLines (const std::string &measure) throw ()
 Builds the internal representation of the travel time/effort.
void setType (EdgeType type) throw ()
 Sets the type of te edge.
Getter methods
bool allFollowersProhibit (const ROVehicle *const vehicle) const throw ()
 Returns whether this edge succeding edges prohibit the given vehicle to pass them.
RONodegetFromNode () const throw ()
 Returns the node this edge starts at.
const std::string & getID () const throw ()
 Returns the id of the edge.
unsigned int getLaneNo () const throw ()
 Returns the number of lanes this edge has.
SUMOReal getLength () const throw ()
 Returns the length of the edge.
unsigned int getNumericalID () const throw ()
 Returns the index (numeric id) of the edge.
SUMOReal getSpeed () const throw ()
 Returns the speed allowed on this edge.
RONodegetToNode () const throw ()
 Returns the node this edge ends at.
EdgeType getType () const throw ()
 Returns the type of the edge.
bool isConnectedTo (const ROEdge *const e) const throw ()
 returns the information whether this edge is directly connected to the given
bool prohibits (const ROVehicle *const vehicle) const throw ()
 Returns whether this edge prohibits the given vehicle to pass it.

Static Public Member Functions

static ROEdgedictionary (size_t index) throw ()
 Returns the ROEdge at the index.

Protected Member Functions

bool getStoredEffort (SUMOReal time, SUMOReal &ret) const throw ()
 Retrieves the stored effort.

Protected Attributes

std::vector< SUMOVehicleClassmyAllowedClasses
 The list of allowed vehicle classes.
ValueTimeLine< SUMOReal > myEfforts
 Container storing passing time varying over time for the edge.
std::vector< ROEdge * > myFollowingEdges
 List of edges that may be approached from this edge.
RONodemyFromNode
 The nodes this edge is connecting.
std::string myID
 The id of the edge.
unsigned int myIndex
 The index (numeric id) of the edge.
bool myInterpolate
 Information whether to interpolate at interval boundaries.
std::vector< ROLane * > myLanes
 This edge's lanes.
SUMOReal myLength
 The length of the edge.
std::vector< SUMOVehicleClassmyNotAllowedClasses
 The list of disallowed vehicle classes.
SUMOReal mySpeed
 The maximum speed allowed on this edge.
RONodemyToNode
ValueTimeLine< SUMOReal > myTravelTimes
 Container storing passing time varying over time for the edge.
EdgeType myType
 The type of the edge.
bool myUseBoundariesOnOverrideE
 Whether overriding weight boundaries shall be reported.
bool myUseBoundariesOnOverrideTT
 Whether overriding weight boundaries shall be reported.
bool myUsingETimeLine
 Information whether the time line shall be used instead of the length value.
bool myUsingTTTimeLine
 Information whether the time line shall be used instead of the length value.

Static Protected Attributes

static std::vector< ROEdge * > myEdges
static bool myHaveEWarned = false
 Information whether the edge has reported missing weights.
static bool myHaveTTWarned = false
 Information whether the edge has reported missing weights.

Private Types

typedef std::map< ROJTREdge
*, ValueTimeLine< SUMOReal > * > 
FollowerUsageCont
 Definition of a map that stores the probabilities of using a certain follower over time.

Private Member Functions

ROJTREdgeoperator= (const ROJTREdge &src)
 invalidated assignment operator
 ROJTREdge (const ROJTREdge &src)
 invalidated copy constructor

Private Attributes

FollowerUsageCont myFollowingDefs
 Storage for the probabilities of using a certain follower over time.
std::vector< SUMOReal > myParsedTurnings
 The defaults for turnings.

Member Typedef Documentation

typedef std::map<ROJTREdge*, ValueTimeLine<SUMOReal>*> ROJTREdge::FollowerUsageCont [private]

Definition of a map that stores the probabilities of using a certain follower over time.

Definition at line 104 of file ROJTREdge.h.


Member Enumeration Documentation

enum ROEdge::EdgeType [inherited]

Possible types of edges.

Enumerator:
ET_NORMAL  A normal edge.
ET_DISTRICT  An edge representing a whole district.
ET_SOURCE  An edge where vehicles are emitted at (no vehicle may come from back).
ET_SINK  An edge where vehicles disappear (no vehicle may leave this edge).

Definition at line 66 of file ROEdge.h.

00066                   {
00068         ET_NORMAL,
00070         ET_DISTRICT,
00072         ET_SOURCE,
00074         ET_SINK
00075     };


Constructor & Destructor Documentation

ROJTREdge::ROJTREdge ( const std::string &  id,
RONode from,
RONode to,
unsigned int  index 
) throw ()

Constructor.

Parameters:
[in] id The id of the edge
[in] from The node the edge begins at
[in] to The node the edge ends at
[in] index The numeric id of the edge

Definition at line 45 of file ROJTREdge.cpp.

00046         : ROEdge(id, from, to, index, false) {}

ROJTREdge::~ROJTREdge (  )  throw ()

Destructor.

Definition at line 49 of file ROJTREdge.cpp.

References myFollowingDefs.

00049                               {
00050     for (FollowerUsageCont::iterator i=myFollowingDefs.begin(); i!=myFollowingDefs.end(); i++) {
00051         delete(*i).second;
00052     }
00053 }

ROJTREdge::ROJTREdge ( const ROJTREdge src  )  [private]

invalidated copy constructor


Member Function Documentation

void ROEdge::addEffort ( SUMOReal  value,
SUMOReal  timeBegin,
SUMOReal  timeEnd 
) throw () [inherited]

Adds a weight value.

Parameters:
[in] value The value to add
[in] timeBegin The begin time of the interval the given value is valid for [s]
[in] timeEnd The end time of the interval the given value is valid for [s]

Definition at line 132 of file ROEdge.cpp.

References ValueTimeLine< T >::add(), ROEdge::myEfforts, and ROEdge::myUsingETimeLine.

Referenced by ROLoader::EdgeFloatTimeLineRetriever_EdgeWeight::addEdgeWeight().

00132                                                                               {
00133     myEfforts.add(timeBegin, timeEnd, value);
00134     myUsingETimeLine = true;
00135 }

void ROJTREdge::addFollower ( ROEdge s  )  throw () [virtual]

Adds information about a connected edge.

Makes this edge know the given following edge. Calls ROEdge::addFollower.

Additionally it generates the entry for the given following edge in myFollowingDefs.

Parameters:
[in] s The following edge
See also:
ROEdge::addFollower

Reimplemented from ROEdge.

Definition at line 57 of file ROJTREdge.cpp.

References ROEdge::addFollower(), and myFollowingDefs.

00057                                         {
00058     ROEdge::addFollower(s);
00059     ROJTREdge *js = static_cast<ROJTREdge*>(s);
00060     if (myFollowingDefs.find(js)==myFollowingDefs.end()) {
00061         myFollowingDefs[js] = new ValueTimeLine<SUMOReal>();
00062     }
00063 }

void ROJTREdge::addFollowerProbability ( ROJTREdge follower,
SUMOTime  begTime,
SUMOTime  endTime,
SUMOReal  probability 
)

adds the information about the percentage of using a certain follower

!!!

Parameters:
[in] follower The following edge
[in] begTime Time begin for which this probability is valid
[in] endTime Time end for which this probability is valid
[in] probability The probability to use the given follower

Definition at line 67 of file ROJTREdge.cpp.

References MsgHandler::getErrorInstance(), ROEdge::getID(), MsgHandler::inform(), and myFollowingDefs.

Referenced by ROJTRTurnDefLoader::addToEdge().

00068                                                                           {
00069     FollowerUsageCont::iterator i = myFollowingDefs.find(follower);
00070     if (i==myFollowingDefs.end()) {
00071         MsgHandler::getErrorInstance()->inform("The edges '" + getID() + "' and '" + follower->getID() + "' are not connected.");
00072         return;
00073     }
00074     (*i).second->add(begTime, endTime, probability);
00075 }

void ROEdge::addLane ( ROLane lane  )  throw () [virtual, inherited]

Adds a lane to the edge while loading.

The lane's length is adapted. Additionally, the information about allowed/disallowed vehicle classes is patched using the information stored in the lane.

Parameters:
[in] lane The lane to add
Todo:
What about vehicle-type aware connections?

Definition at line 80 of file ROEdge.cpp.

References ROEdge::myAllowedClasses, ROEdge::myLanes, ROEdge::myLength, ROEdge::myNotAllowedClasses, ROEdge::mySpeed, and SUMOReal.

Referenced by RONetHandler::parseLane().

00080                                     {
00081     SUMOReal length = lane->getLength();
00082     assert(myLength==-1||length==myLength);
00083     myLength = length;
00084     SUMOReal speed = lane->getSpeed();
00085     mySpeed = speed > mySpeed ? speed : mySpeed;
00086     myLanes.push_back(lane);
00087 
00088     std::vector<SUMOVehicleClass>::const_iterator i;
00089     const std::vector<SUMOVehicleClass> &allowed = lane->getAllowedClasses();
00090     // for allowed classes
00091     for (i=allowed.begin(); i!=allowed.end(); ++i) {
00092         SUMOVehicleClass allowedC = *i;
00093         std::vector<SUMOVehicleClass>::iterator t;
00094         // add to allowed if not already in there
00095         t = find(myAllowedClasses.begin(), myAllowedClasses.end(), allowedC);
00096         if (t==myAllowedClasses.end()) {
00097             myAllowedClasses.push_back(allowedC);
00098         }
00099         // remove from disallowed if allowed on the lane
00100         t = find(myNotAllowedClasses.begin(), myNotAllowedClasses.end(), allowedC);
00101         if (t!=myNotAllowedClasses.end()) {
00102             myNotAllowedClasses.erase(t);
00103         }
00104     }
00105     // for disallowed classes
00106     const std::vector<SUMOVehicleClass> &disallowed = lane->getNotAllowedClasses();
00107     for (i=disallowed.begin(); i!=disallowed.end(); ++i) {
00108         SUMOVehicleClass disallowedC = *i;
00109         std::vector<SUMOVehicleClass>::iterator t;
00110         // add to disallowed if not already in there
00111         //  and not within allowed
00112         t = find(myAllowedClasses.begin(), myAllowedClasses.end(), disallowedC);
00113         if (t==myAllowedClasses.end()) {
00114             t = find(myNotAllowedClasses.begin(), myNotAllowedClasses.end(), disallowedC);
00115             if (t==myNotAllowedClasses.end()) {
00116                 myNotAllowedClasses.push_back(disallowedC);
00117             }
00118         }
00119     }
00120 }

void ROEdge::addTravelTime ( SUMOReal  value,
SUMOReal  timeBegin,
SUMOReal  timeEnd 
) throw () [inherited]

Adds a travel time value.

Parameters:
[in] value The value to add
[in] timeBegin The begin time of the interval the given value is valid for [s]
[in] timeEnd The end time of the interval the given value is valid for [s]

Definition at line 139 of file ROEdge.cpp.

References ValueTimeLine< T >::add(), ROEdge::myTravelTimes, and ROEdge::myUsingTTTimeLine.

Referenced by ROLoader::EdgeFloatTimeLineRetriever_EdgeTravelTime::addEdgeWeight().

00139                                                                                   {
00140     myTravelTimes.add(timeBegin, timeEnd, value);
00141     myUsingTTTimeLine = true;
00142 }

bool ROEdge::allFollowersProhibit ( const ROVehicle *const   vehicle  )  const throw () [inherited]

Returns whether this edge succeding edges prohibit the given vehicle to pass them.

Parameters:
[in] vehicle The vehicle for which the information has to be returned
Returns:
Whether the vehicle may continue its route on any of the following edges

Definition at line 385 of file ROEdge.cpp.

References ROEdge::myFollowingEdges.

Referenced by chooseNext().

00385                                                                           {
00386     for (std::vector<ROEdge*>::const_iterator i=myFollowingEdges.begin(); i!=myFollowingEdges.end(); ++i) {
00387         if (!(*i)->prohibits(vehicle)) {
00388             return false;
00389         }
00390     }
00391     return true;
00392 }

void ROEdge::buildTimeLines ( const std::string &  measure  )  throw () [inherited]

Builds the internal representation of the travel time/effort.

Should be called after weights / travel times have been loaded.

In the case "measure" is one of "CO", "CO2", "HC", "NOx", "PMx", or "fuel" the proper value (emission/s) is computed and multiplied with the travel time.

Parameters:
[in] measure The name of the measure to use.

Definition at line 354 of file ROEdge.cpp.

References HelpersHBEFA::computeCO(), HelpersHBEFA::computeCO2(), HelpersHBEFA::computeFuel(), HelpersHBEFA::computeHC(), HelpersHBEFA::computeNOx(), HelpersHBEFA::computePMx(), ValueTimeLine< T >::fillGaps(), ROEdge::myEfforts, ROEdge::myLength, ROEdge::mySpeed, ROEdge::myTravelTimes, ROEdge::myUseBoundariesOnOverrideE, ROEdge::myUseBoundariesOnOverrideTT, ROEdge::myUsingETimeLine, ROEdge::myUsingTTTimeLine, SUMOReal, and SVE_UNKNOWN.

00354                                                        {
00355     if (myUsingETimeLine) {
00356         SUMOReal value = (SUMOReal)(myLength / mySpeed);
00357         if (measure=="CO") {
00358             value = HelpersHBEFA::computeCO(SVE_UNKNOWN, mySpeed, 0) * value;
00359         }
00360         if (measure=="CO2") {
00361             value = HelpersHBEFA::computeCO2(SVE_UNKNOWN, mySpeed, 0) * value;
00362         }
00363         if (measure=="HC") {
00364             value = HelpersHBEFA::computeHC(SVE_UNKNOWN, mySpeed, 0) * value;
00365         }
00366         if (measure=="PMx") {
00367             value = HelpersHBEFA::computePMx(SVE_UNKNOWN, mySpeed, 0) * value;
00368         }
00369         if (measure=="NOx") {
00370             value = HelpersHBEFA::computeNOx(SVE_UNKNOWN, mySpeed, 0) * value;
00371         }
00372         if (measure=="fuel") {
00373             value = HelpersHBEFA::computeFuel(SVE_UNKNOWN, mySpeed, 0) * value;
00374         }
00375         myEfforts.fillGaps(value, myUseBoundariesOnOverrideE);
00376     }
00377     if (myUsingTTTimeLine) {
00378         SUMOReal value = (SUMOReal)(myLength / mySpeed);
00379         myTravelTimes.fillGaps(value, myUseBoundariesOnOverrideTT);
00380     }
00381 }

ROJTREdge * ROJTREdge::chooseNext ( const ROVehicle * const  veh,
SUMOTime  time 
) const

Returns the next edge to use.

Definition at line 79 of file ROJTREdge.cpp.

References RandomDistributor< T >::add(), ROEdge::allFollowersProhibit(), RandomDistributor< T >::get(), RandomDistributor< T >::getOverallProb(), myFollowingDefs, ROEdge::myFollowingEdges, myParsedTurnings, and ROEdge::prohibits().

Referenced by ROJTRRouter::compute().

00079                                                                       {
00080     // if no usable follower exist, return 0
00081     //  their probabilities are not yet regarded
00082     if (myFollowingEdges.size()==0 || (veh!=0 && allFollowersProhibit(veh))) {
00083         return 0;
00084     }
00085     // gather information about the probabilities at this time
00086     RandomDistributor<ROJTREdge*> dist;
00087     {
00088         // use the loaded definitions, first
00089         FollowerUsageCont::const_iterator i;
00090         for (i=myFollowingDefs.begin(); i!=myFollowingDefs.end(); i++) {
00091             if ((veh==0 || !(*i).first->prohibits(veh)) && (*i).second->describesTime(time)) {
00092                 dist.add((*i).second->getValue(time), (*i).first);
00093             }
00094         }
00095     }
00096     // if no loaded definitions are valid for this time, try to use the defaults
00097     if (dist.getOverallProb()==0) {
00098         for (size_t i=0; i<myParsedTurnings.size(); ++i) {
00099             if (veh==0 || !myFollowingEdges[i]->prohibits(veh)) {
00100                 dist.add(myParsedTurnings[i], static_cast<ROJTREdge*>(myFollowingEdges[i]));
00101             }
00102         }
00103     }
00104     // if still no valid follower exists, return null
00105     if (dist.getOverallProb()==0) {
00106         return 0;
00107     }
00108     // return one of the possible followers
00109     return dist.get();
00110 }

ROEdge * ROEdge::dictionary ( size_t  index  )  throw () [static, inherited]

Returns the ROEdge at the index.

Definition at line 396 of file ROEdge.cpp.

References ROEdge::myEdges.

00396                                     {
00397     assert(myEdges.size()>id);
00398     return myEdges[id];
00399 }

SUMOReal ROEdge::getCO2Effort ( const ROVehicle *const   veh,
SUMOReal  time 
) const throw () [inherited]

Definition at line 193 of file ROEdge.cpp.

References HelpersHBEFA::computeCO2(), ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MIN2(), ROEdge::mySpeed, SUMOReal, and SVE_UNKNOWN.

Referenced by computeRoutes().

00193                                                                              {
00194     SUMOReal ret = 0;
00195     if (!getStoredEffort(time, ret)) {
00196         SUMOReal v = mySpeed;
00197         SUMOEmissionClass c = SVE_UNKNOWN;
00198         if (veh->getType()!=0) {
00199             v = MIN2(veh->getType()->maxSpeed, mySpeed);
00200             c = veh->getType()->emissionClass;
00201         }
00202         ret = HelpersHBEFA::computeCO2(c, v, 0) * getTravelTime(veh, time);
00203     }
00204     return ret;
00205 }

SUMOReal ROEdge::getCOEffort ( const ROVehicle *const   veh,
SUMOReal  time 
) const throw () [inherited]

Definition at line 177 of file ROEdge.cpp.

References HelpersHBEFA::computeCO(), ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MIN2(), ROEdge::mySpeed, SUMOReal, and SVE_UNKNOWN.

Referenced by computeRoutes().

00177                                                                             {
00178     SUMOReal ret = 0;
00179     if (!getStoredEffort(time, ret)) {
00180         SUMOReal v = mySpeed;
00181         SUMOEmissionClass c = SVE_UNKNOWN;
00182         if (veh->getType()!=0) {
00183             v = MIN2(veh->getType()->maxSpeed, mySpeed);
00184             c = veh->getType()->emissionClass;
00185         }
00186         ret = HelpersHBEFA::computeCO(c, v, 0) * getTravelTime(veh, time);
00187     }
00188     return ret;
00189 }

SUMOReal ROEdge::getEffort ( const ROVehicle *const   veh,
SUMOReal  time 
) const throw () [inherited]

Returns the effort for this edge.

Parameters:
[in] veh The vehicle for which the effort on this edge shall be retrieved
[in] time The tim for which the effort shall be returned [s]
Returns:
The effort needed by the given vehicle to pass the edge at the given time
Todo:
Recheck whether the vehicle's maximum speed is considered

Definition at line 146 of file ROEdge.cpp.

References ROEdge::getStoredEffort(), ROEdge::myLength, ROEdge::mySpeed, and SUMOReal.

00146                                                                          {
00147     SUMOReal ret = 0;
00148     if (!getStoredEffort(time, ret)) {
00149         return (SUMOReal)(myLength / mySpeed);
00150     }
00151     return ret;
00152 }

ROEdge* ROEdge::getFollower ( unsigned int  pos  )  const throw () [inline, inherited]

Returns the edge at the given position from the list of reachable edges.

Parameters:
[in] pos The position of the list within the list of following
Returns:
The following edge, stored at position pos

Definition at line 268 of file ROEdge.h.

References ROEdge::myFollowingEdges.

Referenced by RODFRouteCont::addAllEndFollower(), and RODFNet::buildApproachList().

00268                                                         {
00269         return myFollowingEdges[pos];
00270     }

RONode* ROEdge::getFromNode (  )  const throw () [inline, inherited]

Returns the node this edge starts at.

Returns:
The node this edge starts at

Definition at line 194 of file ROEdge.h.

References ROEdge::myFromNode.

Referenced by RODFNet::buildApproachList().

00194                                         {
00195         return myFromNode;
00196     }

SUMOReal ROEdge::getFuelEffort ( const ROVehicle *const   veh,
SUMOReal  time 
) const throw () [inherited]

Definition at line 257 of file ROEdge.cpp.

References HelpersHBEFA::computeFuel(), ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MIN2(), ROEdge::mySpeed, SUMOReal, and SVE_UNKNOWN.

Referenced by computeRoutes().

00257                                                                               {
00258     SUMOReal ret = 0;
00259     if (!getStoredEffort(time, ret)) {
00260         SUMOReal v = mySpeed;
00261         SUMOEmissionClass c = SVE_UNKNOWN;
00262         if (veh->getType()!=0) {
00263             v = MIN2(veh->getType()->maxSpeed, mySpeed);
00264             c = veh->getType()->emissionClass;
00265         }
00266         ret = HelpersHBEFA::computeFuel(c, v, 0) * getTravelTime(veh, time);
00267     }
00268     return ret;
00269 }

SUMOReal ROEdge::getHCEffort ( const ROVehicle *const   veh,
SUMOReal  time 
) const throw () [inherited]

Definition at line 225 of file ROEdge.cpp.

References HelpersHBEFA::computeHC(), ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MIN2(), ROEdge::mySpeed, SUMOReal, and SVE_UNKNOWN.

Referenced by computeRoutes().

00225                                                                             {
00226     SUMOReal ret = 0;
00227     if (!getStoredEffort(time, ret)) {
00228         SUMOReal v = mySpeed;
00229         SUMOEmissionClass c = SVE_UNKNOWN;
00230         if (veh->getType()!=0) {
00231             v = MIN2(veh->getType()->maxSpeed, mySpeed);
00232             c = veh->getType()->emissionClass;
00233         }
00234         ret = HelpersHBEFA::computeHC(c, v, 0) * getTravelTime(veh, time);
00235     }
00236     return ret;
00237 }

const std::string& ROEdge::getID (  )  const throw () [inline, inherited]

Returns the id of the edge.

Returns:
This edge's id

Definition at line 146 of file ROEdge.h.

References ROEdge::myID.

Referenced by addFollowerProbability(), RODFNet::buildApproachList(), ROJTRRouter::compute(), RODFDetectorCon::getAggFlowFor(), RODFDetectorCon::getAnyDetectorForEdge(), and RODFDetectorCon::getFlowFor().

00146                                            {
00147         return myID;
00148     }

unsigned int ROEdge::getLaneNo (  )  const throw () [inline, inherited]

Returns the number of lanes this edge has.

Returns:
This edge's number of lanes

Definition at line 186 of file ROEdge.h.

References ROEdge::myLanes.

Referenced by RODFDetectorHandler::myStartElement().

00186                                            {
00187         return (unsigned int) myLanes.size();
00188     }

SUMOReal ROEdge::getLength (  )  const throw () [inline, inherited]

Returns the length of the edge.

Returns:
This edge's length

Definition at line 163 of file ROEdge.h.

References ROEdge::myLength.

Referenced by RODFNet::buildRoutes(), and RODFNet::getAbsPos().

00163                                        {
00164         return myLength;
00165     }

unsigned int ROEdge::getNoFollowing (  )  const throw () [inherited]

Returns the number of edges this edge is connected to.

If this edge's type is set to "sink", 0 is returned, otherwise the number of edges stored in "myFollowingEdges".

Returns:
The number of edges following this edge

Definition at line 314 of file ROEdge.cpp.

References ROEdge::ET_SINK, ROEdge::getType(), and ROEdge::myFollowingEdges.

Referenced by RODFRouteCont::addAllEndFollower(), and RODFNet::buildApproachList().

00314                                      {
00315     if (getType()==ET_SINK) {
00316         return 0;
00317     }
00318     return (unsigned int) myFollowingEdges.size();
00319 }

SUMOReal ROEdge::getNoiseEffort ( const ROVehicle *const   veh,
SUMOReal  time 
) const throw () [inherited]

Definition at line 273 of file ROEdge.cpp.

References HelpersHarmonoise::computeNoise(), ROEdge::getStoredEffort(), MIN2(), ROEdge::mySpeed, SUMOReal, and SVE_UNKNOWN.

Referenced by computeRoutes().

00273                                                                                {
00274     SUMOReal ret = 0;
00275     if (!getStoredEffort(time, ret)) {
00276         SUMOReal v = mySpeed;
00277         SUMOEmissionClass c = SVE_UNKNOWN;
00278         if (veh->getType()!=0) {
00279             v = MIN2(veh->getType()->maxSpeed, mySpeed);
00280             c = veh->getType()->emissionClass;
00281         }
00282         ret = HelpersHarmonoise::computeNoise(veh->getType()->emissionClass, v, 0);
00283     }
00284     return ret;
00285 }

SUMOReal ROEdge::getNOxEffort ( const ROVehicle *const   veh,
SUMOReal  time 
) const throw () [inherited]

Definition at line 241 of file ROEdge.cpp.

References HelpersHBEFA::computeNOx(), ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MIN2(), ROEdge::mySpeed, SUMOReal, and SVE_UNKNOWN.

Referenced by computeRoutes().

00241                                                                              {
00242     SUMOReal ret = 0;
00243     if (!getStoredEffort(time, ret)) {
00244         SUMOReal v = mySpeed;
00245         SUMOEmissionClass c = SVE_UNKNOWN;
00246         if (veh->getType()!=0) {
00247             v = MIN2(veh->getType()->maxSpeed, mySpeed);
00248             c = veh->getType()->emissionClass;
00249         }
00250         ret = HelpersHBEFA::computeNOx(c, v, 0) * getTravelTime(veh, time);
00251     }
00252     return ret;
00253 }

unsigned int ROEdge::getNumericalID (  )  const throw () [inline, inherited]

Returns the index (numeric id) of the edge.

Returns:
This edge's numerical id

Definition at line 170 of file ROEdge.h.

References ROEdge::myIndex.

00170                                                 {
00171         return myIndex;
00172     }

SUMOReal ROEdge::getPMxEffort ( const ROVehicle *const   veh,
SUMOReal  time 
) const throw () [inherited]

Definition at line 209 of file ROEdge.cpp.

References HelpersHBEFA::computePMx(), ROEdge::getStoredEffort(), ROEdge::getTravelTime(), MIN2(), ROEdge::mySpeed, SUMOReal, and SVE_UNKNOWN.

Referenced by computeRoutes().

00209                                                                              {
00210     SUMOReal ret = 0;
00211     if (!getStoredEffort(time, ret)) {
00212         SUMOReal v = mySpeed;
00213         SUMOEmissionClass c = SVE_UNKNOWN;
00214         if (veh->getType()!=0) {
00215             v = MIN2(veh->getType()->maxSpeed, mySpeed);
00216             c = veh->getType()->emissionClass;
00217         }
00218         ret = HelpersHBEFA::computePMx(c, v, 0) * getTravelTime(veh, time);
00219     }
00220     return ret;
00221 }

SUMOReal ROEdge::getSpeed (  )  const throw () [inline, inherited]

Returns the speed allowed on this edge.

Returns:
The speed allowed on this edge

Definition at line 178 of file ROEdge.h.

References ROEdge::mySpeed.

Referenced by RODFNet::buildRoutes(), RODFNet::computeRoutesFor(), RODFNet::isDestination(), RODFNet::isFalseSource(), and RODFNet::isSource().

00178                                       {
00179         return mySpeed;
00180     }

bool ROEdge::getStoredEffort ( SUMOReal  time,
SUMOReal &  ret 
) const throw () [protected, inherited]

Retrieves the stored effort.

Parameters:
[in] veh The vehicle for which the effort on this edge shall be retrieved
[in] time The tim for which the effort shall be returned
Returns:
Whether the effort is given

Definition at line 289 of file ROEdge.cpp.

References ValueTimeLine< T >::describesTime(), ValueTimeLine< T >::getSplitTime(), ValueTimeLine< T >::getValue(), ROEdge::myEfforts, ROEdge::myHaveEWarned, ROEdge::myID, ROEdge::myInterpolate, ROEdge::myTravelTimes, ROEdge::myUsingETimeLine, SUMOReal, toString(), and WRITE_WARNING.

Referenced by ROEdge::getCO2Effort(), ROEdge::getCOEffort(), ROEdge::getEffort(), ROEdge::getFuelEffort(), ROEdge::getHCEffort(), ROEdge::getNoiseEffort(), ROEdge::getNOxEffort(), and ROEdge::getPMxEffort().

00289                                                                   {
00290     if (myUsingETimeLine) {
00291         if (!myEfforts.describesTime(time)) {
00292             if (!myHaveEWarned) {
00293                 WRITE_WARNING("No interval matches passed time "+ toString(time)  + " in edge '" + myID + "'.\n Using edge's length / edge's speed.");
00294                 myHaveEWarned = true;
00295             }
00296             return false;
00297         }
00298         if (myInterpolate) {
00299             SUMOReal inTT = myTravelTimes.getValue(time);
00300             SUMOReal ratio = (SUMOReal)(myEfforts.getSplitTime(time, time + (SUMOTime)inTT) - time) / inTT;
00301             if (ratio >= 0) {
00302                 ret = ratio * myEfforts.getValue(time) + (1-ratio)*myEfforts.getValue(time + (SUMOTime)inTT);
00303                 return true;
00304             }
00305         }
00306         ret = myEfforts.getValue(time);
00307         return true;
00308     }
00309     return false;
00310 }

RONode* ROEdge::getToNode (  )  const throw () [inline, inherited]

Returns the node this edge ends at.

Returns:
The node this edge ends at

Definition at line 202 of file ROEdge.h.

References ROEdge::myToNode.

Referenced by RODFNet::buildApproachList().

00202                                       {
00203         return myToNode;
00204     }

SUMOReal ROEdge::getTravelTime ( const ROVehicle *const  veh,
SUMOReal  time 
) const throw () [inherited]

Returns the travel time for this edge.

Parameters:
[in] veh The vehicle for which the effort on this edge shall be retrieved
[in] time The time for which the effort shall be returned [s]
Returns:
The effort needed by the given vehicle to pass the edge at the given time
Todo:
Recheck whether the vehicle's maximum speed is considered

Definition at line 156 of file ROEdge.cpp.

References ValueTimeLine< T >::describesTime(), ValueTimeLine< T >::getSplitTime(), ValueTimeLine< T >::getValue(), ROEdge::myHaveTTWarned, ROEdge::myID, ROEdge::myInterpolate, ROEdge::myLength, ROEdge::mySpeed, ROEdge::myTravelTimes, ROEdge::myUsingTTTimeLine, SUMOReal, toString(), and WRITE_WARNING.

Referenced by ROJTRRouter::compute(), computeRoutes(), ROEdge::getCO2Effort(), ROEdge::getCOEffort(), ROEdge::getFuelEffort(), ROEdge::getHCEffort(), ROEdge::getNOxEffort(), and ROEdge::getPMxEffort().

00156                                                                          {
00157     if (myUsingTTTimeLine) {
00158         if (!myHaveTTWarned && !myTravelTimes.describesTime(time)) {
00159             WRITE_WARNING("No interval matches passed time "+ toString(time)  + " in edge '" + myID + "'.\n Using edge's length / edge's speed.");
00160             myHaveTTWarned = true;
00161         }
00162         if (myInterpolate) {
00163             SUMOReal inTT = myTravelTimes.getValue(time);
00164             SUMOReal split = (SUMOReal)(myTravelTimes.getSplitTime(time, time + (SUMOTime)inTT) - time);
00165             if (split >= 0) {
00166                 return myTravelTimes.getValue(time + (SUMOTime)inTT) *((SUMOReal)1. - split / inTT) + split;
00167             }
00168         }
00169         return myTravelTimes.getValue(time);
00170     }
00171     // ok, no absolute value was found, use the normal value (without) as default
00172     return (SUMOReal)(myLength / mySpeed);
00173 }

EdgeType ROEdge::getType (  )  const throw () [inline, inherited]

Returns the type of the edge.

Returns:
This edge's type
See also:
EdgeType

Definition at line 155 of file ROEdge.h.

References ROEdge::myType.

Referenced by RONet::checkSourceAndDestinations(), ROJTRRouter::compute(), and ROEdge::getNoFollowing().

00155                                      {
00156         return myType;
00157     }

bool ROEdge::isConnectedTo ( const ROEdge *const   e  )  const throw () [inline, inherited]

returns the information whether this edge is directly connected to the given

Parameters:
[in] e The edge which may be connected
Returns:
Whether the given edge is a direct successor to this one

Definition at line 212 of file ROEdge.h.

References ROEdge::myFollowingEdges.

00212                                                              {
00213         return std::find(myFollowingEdges.begin(), myFollowingEdges.end(), e)!=myFollowingEdges.end();
00214     }

ROJTREdge& ROJTREdge::operator= ( const ROJTREdge src  )  [private]

invalidated assignment operator

bool ROEdge::prohibits ( const ROVehicle *const   vehicle  )  const throw () [inherited]

Returns whether this edge prohibits the given vehicle to pass it.

Parameters:
[in] vehicle The vehicle for which the information has to be returned
Returns:
Whether the vehicle must not enter this edge

Definition at line 329 of file ROEdge.cpp.

References DEFAULT_VEH_CLASS, ROEdge::myAllowedClasses, ROEdge::myNotAllowedClasses, and SVC_UNKNOWN.

Referenced by chooseNext(), and ROJTRRouter::compute().

00329                                                                {
00330     if (myAllowedClasses.size()==0&&myNotAllowedClasses.size()==0) {
00331         return false;
00332     }
00333     // ok, vehicles with an unknown class may be only prohibited
00334     //  if the edge is limited to a set of classes
00335     SUMOVehicleClass vclass = vehicle->getType()!=0 ? vehicle->getType()->vehicleClass : DEFAULT_VEH_CLASS;
00336     if (vclass==SVC_UNKNOWN) {
00337         return false;
00338     }
00339     // check whether it is explicitely disallowed
00340     if (find(myNotAllowedClasses.begin(), myNotAllowedClasses.end(), vclass)!=myNotAllowedClasses.end()) {
00341         return true;
00342     }
00343     // check whether it is within the allowed classes
00344     if (myAllowedClasses.size()==0||find(myAllowedClasses.begin(), myAllowedClasses.end(), vclass)!=myAllowedClasses.end()) {
00345         return false;
00346     }
00347     // ok, we have a set of allowed vehicle classes, but this vehicle's class
00348     //  is not among them
00349     return true;
00350 }

void ROJTREdge::setTurnDefaults ( const std::vector< SUMOReal > &  defs  ) 

Sets the turning definition defaults.

Definition at line 114 of file ROJTREdge.cpp.

References ROEdge::myFollowingEdges, myParsedTurnings, and SUMOReal.

00114                                                           {
00115     // I hope, we'll find a less ridiculous solution for this
00116     std::vector<SUMOReal> tmp(defs.size()*myFollowingEdges.size(), 0);
00117     // store in less common multiple
00118     size_t i;
00119     for (i=0; i<defs.size(); i++) {
00120         for (size_t j=0; j<myFollowingEdges.size(); j++) {
00121             tmp[i*myFollowingEdges.size()+j] = (SUMOReal)
00122                                                (defs[i] / 100.0 / (myFollowingEdges.size()));
00123         }
00124     }
00125     // parse from less common multiple
00126     for (i=0; i<myFollowingEdges.size(); i++) {
00127         SUMOReal value = 0;
00128         for (size_t j=0; j<defs.size(); j++) {
00129             value += tmp[i*defs.size()+j];
00130         }
00131         myParsedTurnings.push_back((SUMOReal) value);
00132     }
00133 }

void ROEdge::setType ( ROEdge::EdgeType  type  )  throw () [inherited]

Sets the type of te edge.

Parameters:
[in] type The new type for the edge

Definition at line 323 of file ROEdge.cpp.

References ROEdge::myType.

Referenced by loadJTRDefinitions(), ROJTRTurnDefLoader::myCharacters(), ROJTRTurnDefLoader::myStartElement(), RONetHandler::parseDistrict(), and RONetHandler::parseEdge().

00323                                            {
00324     myType = type;
00325 }


Field Documentation

std::vector<SUMOVehicleClass> ROEdge::myAllowedClasses [protected, inherited]

The list of allowed vehicle classes.

Definition at line 363 of file ROEdge.h.

Referenced by ROEdge::addLane(), and ROEdge::prohibits().

std::vector< ROEdge * > ROEdge::myEdges [static, protected, inherited]

Definition at line 371 of file ROEdge.h.

Referenced by ROEdge::dictionary().

ValueTimeLine<SUMOReal> ROEdge::myEfforts [mutable, protected, inherited]

Container storing passing time varying over time for the edge.

Definition at line 341 of file ROEdge.h.

Referenced by ROEdge::addEffort(), ROEdge::buildTimeLines(), and ROEdge::getStoredEffort().

Storage for the probabilities of using a certain follower over time.

Definition at line 107 of file ROJTREdge.h.

Referenced by addFollower(), addFollowerProbability(), chooseNext(), and ~ROJTREdge().

std::vector<ROEdge*> ROEdge::myFollowingEdges [protected, inherited]

List of edges that may be approached from this edge.

Definition at line 354 of file ROEdge.h.

Referenced by ROEdge::addFollower(), ROEdge::allFollowersProhibit(), chooseNext(), ROEdge::getFollower(), ROEdge::getNoFollowing(), ROEdge::isConnectedTo(), and setTurnDefaults().

RONode* ROEdge::myFromNode [protected, inherited]

The nodes this edge is connecting.

Definition at line 369 of file ROEdge.h.

Referenced by ROEdge::getFromNode().

bool ROEdge::myHaveEWarned = false [static, protected, inherited]

Information whether the edge has reported missing weights.

Definition at line 347 of file ROEdge.h.

Referenced by ROEdge::getStoredEffort().

bool ROEdge::myHaveTTWarned = false [static, protected, inherited]

Information whether the edge has reported missing weights.

Definition at line 338 of file ROEdge.h.

Referenced by ROEdge::getTravelTime().

std::string ROEdge::myID [protected, inherited]

The id of the edge.

Definition at line 319 of file ROEdge.h.

Referenced by ROEdge::getID(), ROEdge::getStoredEffort(), and ROEdge::getTravelTime().

unsigned int ROEdge::myIndex [protected, inherited]

The index (numeric id) of the edge.

Definition at line 325 of file ROEdge.h.

Referenced by ROEdge::getNumericalID().

bool ROEdge::myInterpolate [protected, inherited]

Information whether to interpolate at interval boundaries.

Definition at line 350 of file ROEdge.h.

Referenced by ROEdge::getStoredEffort(), and ROEdge::getTravelTime().

std::vector<ROLane*> ROEdge::myLanes [protected, inherited]

This edge's lanes.

Definition at line 360 of file ROEdge.h.

Referenced by ROEdge::addLane(), ROEdge::getLaneNo(), and ROEdge::~ROEdge().

SUMOReal ROEdge::myLength [protected, inherited]

The length of the edge.

Definition at line 328 of file ROEdge.h.

Referenced by ROEdge::addLane(), ROEdge::buildTimeLines(), ROEdge::getEffort(), ROEdge::getLength(), and ROEdge::getTravelTime().

std::vector<SUMOVehicleClass> ROEdge::myNotAllowedClasses [protected, inherited]

The list of disallowed vehicle classes.

Definition at line 366 of file ROEdge.h.

Referenced by ROEdge::addLane(), and ROEdge::prohibits().

std::vector<SUMOReal> ROJTREdge::myParsedTurnings [private]

The defaults for turnings.

Definition at line 110 of file ROJTREdge.h.

Referenced by chooseNext(), and setTurnDefaults().

SUMOReal ROEdge::mySpeed [protected, inherited]

RONode * ROEdge::myToNode [protected, inherited]

Definition at line 369 of file ROEdge.h.

Referenced by ROEdge::getToNode().

ValueTimeLine<SUMOReal> ROEdge::myTravelTimes [mutable, protected, inherited]

Container storing passing time varying over time for the edge.

Definition at line 332 of file ROEdge.h.

Referenced by ROEdge::addTravelTime(), ROEdge::buildTimeLines(), ROEdge::getStoredEffort(), and ROEdge::getTravelTime().

EdgeType ROEdge::myType [protected, inherited]

The type of the edge.

Definition at line 357 of file ROEdge.h.

Referenced by ROEdge::getType(), and ROEdge::setType().

bool ROEdge::myUseBoundariesOnOverrideE [protected, inherited]

Whether overriding weight boundaries shall be reported.

Definition at line 345 of file ROEdge.h.

Referenced by ROEdge::buildTimeLines().

bool ROEdge::myUseBoundariesOnOverrideTT [protected, inherited]

Whether overriding weight boundaries shall be reported.

Definition at line 336 of file ROEdge.h.

Referenced by ROEdge::buildTimeLines().

bool ROEdge::myUsingETimeLine [protected, inherited]

Information whether the time line shall be used instead of the length value.

Definition at line 343 of file ROEdge.h.

Referenced by ROEdge::addEffort(), ROEdge::buildTimeLines(), and ROEdge::getStoredEffort().

bool ROEdge::myUsingTTTimeLine [protected, inherited]

Information whether the time line shall be used instead of the length value.

Definition at line 334 of file ROEdge.h.

Referenced by ROEdge::addTravelTime(), ROEdge::buildTimeLines(), and ROEdge::getTravelTime().


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

Generated on Wed May 5 00:06:59 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6