#include <MSEmitter.h>

Classes which realise different schemes to emit vehicles (file-based, based on user entries on the gui, etc.) should subclass this class
Definition at line 84 of file MSEmitter.h.
Public Member Functions | |
| SUMOReal | computeOffset (SUMOReal flow) const |
| Returns the time offset till the next vehicle emission for a given flow. | |
| const std::vector< const MSRoute * > & | getAllRoutes () const |
| Returns a list of all available routes. | |
| const MSRoute * | getRndRoute () const |
| Returns a random route. | |
| MSVehicleType * | getRndVType () const |
| Returns a random type. | |
| RandomDistributor< const MSRoute * > & | getRouteDist () |
| Returns the routes probability. | |
| bool | hasRoutes () const |
| Returns the information whether any route is stored. | |
| bool | hasVTypes () const |
| Returns the information whether any vehicle type is stored. | |
| MSEmitterChild (MSEmitter &parent, MSVehicleControl &vc) | |
| Constructor. | |
| virtual | ~MSEmitterChild () |
| Destructor. | |
Protected Attributes | |
| MSEmitter & | myParent |
| The emitter this instance is child of. | |
| RandomDistributor< const MSRoute * > | myRouteDist |
| The used route probability distribution. | |
| SUMOReal | myTimeOffset |
| The time offset till next emission. | |
| MSVehicleControl & | myVehicleControl |
| The vehicle control to use for vehicle building. | |
| RandomDistributor < MSVehicleType * > | myVTypeDist |
| The used vehicle type probability distribution. | |
Private Member Functions | |
| MSEmitterChild (const MSEmitterChild &) | |
| Invalidated copy constructor. | |
| MSEmitterChild & | operator= (const MSEmitterChild &) |
| Invalidated assignment operator. | |
| MSEmitter::MSEmitterChild::MSEmitterChild | ( | MSEmitter & | parent, | |
| MSVehicleControl & | vc | |||
| ) | [inline] |
Constructor.
Definition at line 87 of file MSEmitter.h.
00088 : myParent(parent), myVehicleControl(vc), myTimeOffset(0) { }
| virtual MSEmitter::MSEmitterChild::~MSEmitterChild | ( | ) | [inline, virtual] |
| MSEmitter::MSEmitterChild::MSEmitterChild | ( | const MSEmitterChild & | ) | [private] |
Invalidated copy constructor.
| SUMOReal MSEmitter::MSEmitterChild::computeOffset | ( | SUMOReal | flow | ) | const [inline] |
Returns the time offset till the next vehicle emission for a given flow.
Definition at line 119 of file MSEmitter.h.
References myTimeOffset, and SUMOReal.
Referenced by MSEmitter::MSEmitter_FileTriggeredChild::execute(), and GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().
00119 { 00120 SUMOReal freq = (SUMOReal)(1. / (flow / 3600.)); 00121 SUMOReal ret = freq; 00122 myTimeOffset += (freq - (SUMOTime) ret); 00123 if (myTimeOffset>1) { 00124 myTimeOffset -= 1; 00125 ret += 1; 00126 } 00127 if (ret==0) { // !!! check what to do in this case (more than one vehicle/s) 00128 ret = 1; 00129 } 00130 return ret; 00131 }
| const std::vector<const MSRoute*>& MSEmitter::MSEmitterChild::getAllRoutes | ( | ) | const [inline] |
Returns a list of all available routes.
Definition at line 99 of file MSEmitter.h.
References RandomDistributor< T >::getVals(), and myRouteDist.
00099 { 00100 return myRouteDist.getVals(); 00101 }
| const MSRoute* MSEmitter::MSEmitterChild::getRndRoute | ( | ) | const [inline] |
Returns a random route.
Definition at line 94 of file MSEmitter.h.
References RandomDistributor< T >::get(), and myRouteDist.
Referenced by GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().
00094 { 00095 return myRouteDist.get(); 00096 }
| MSVehicleType* MSEmitter::MSEmitterChild::getRndVType | ( | ) | const [inline] |
Returns a random type.
Definition at line 104 of file MSEmitter.h.
References RandomDistributor< T >::get(), and myVTypeDist.
Referenced by GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().
00104 { 00105 return myVTypeDist.get(); 00106 }
| RandomDistributor<const MSRoute*>& MSEmitter::MSEmitterChild::getRouteDist | ( | ) | [inline] |
Returns the routes probability.
Definition at line 134 of file MSEmitter.h.
References myRouteDist.
Referenced by GUIEmitter::getEdgeProbs().
00134 { 00135 return myRouteDist; 00136 }
| bool MSEmitter::MSEmitterChild::hasRoutes | ( | ) | const [inline] |
Returns the information whether any route is stored.
Definition at line 109 of file MSEmitter.h.
References RandomDistributor< T >::getOverallProb(), and myRouteDist.
Referenced by GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().
00109 { 00110 return myRouteDist.getOverallProb()!=0; 00111 }
| bool MSEmitter::MSEmitterChild::hasVTypes | ( | ) | const [inline] |
Returns the information whether any vehicle type is stored.
Definition at line 114 of file MSEmitter.h.
References RandomDistributor< T >::getOverallProb(), and myVTypeDist.
Referenced by GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().
00114 { 00115 return myVTypeDist.getOverallProb()!=0; 00116 }
| MSEmitterChild& MSEmitter::MSEmitterChild::operator= | ( | const MSEmitterChild & | ) | [private] |
Invalidated assignment operator.
MSEmitter& MSEmitter::MSEmitterChild::myParent [protected] |
The emitter this instance is child of.
Definition at line 140 of file MSEmitter.h.
Referenced by MSEmitter::MSEmitter_FileTriggeredChild::buildAndScheduleFlowVehicle(), MSEmitter::MSEmitter_FileTriggeredChild::execute(), MSEmitter::MSEmitter_FileTriggeredChild::myStartElement(), MSEmitter::MSEmitter_FileTriggeredChild::processNextEntryReaderTriggered(), and GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().
RandomDistributor<const MSRoute*> MSEmitter::MSEmitterChild::myRouteDist [protected] |
The used route probability distribution.
Definition at line 146 of file MSEmitter.h.
Referenced by MSEmitter::MSEmitter_FileTriggeredChild::buildAndScheduleFlowVehicle(), getAllRoutes(), getRndRoute(), getRouteDist(), hasRoutes(), MSEmitter::MSEmitter_FileTriggeredChild::myStartElement(), and GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().
SUMOReal MSEmitter::MSEmitterChild::myTimeOffset [mutable, protected] |
The time offset till next emission.
Definition at line 152 of file MSEmitter.h.
Referenced by computeOffset().
The vehicle control to use for vehicle building.
Definition at line 143 of file MSEmitter.h.
Referenced by MSEmitter::MSEmitter_FileTriggeredChild::myStartElement().
The used vehicle type probability distribution.
Definition at line 149 of file MSEmitter.h.
Referenced by MSEmitter::MSEmitter_FileTriggeredChild::buildAndScheduleFlowVehicle(), getRndVType(), hasVTypes(), MSEmitter::MSEmitter_FileTriggeredChild::myStartElement(), and GUIEmitter::GUIEmitterChild_UserTriggeredChild::wrappedExecute().
1.5.6