|
SUMO - Simulation of Urban MObility
|
Inserts vehicles into the network when their departure time is reached. More...
#include <MSInsertionControl.h>
Data Structures | |
| struct | Flow |
Public Member Functions | |
| void | add (SUMOVehicle *veh) throw () |
| Adds a single vehicle for departure. | |
| void | add (SUMOVehicleParameter *pars) throw () |
| Adds parameter for a vehicle flow for departure. | |
| unsigned int | emitVehicles (SUMOTime time) throw (ProcessError) |
| Emits vehicles that want to depart at the given time. | |
| int | getPendingFlowCount () const throw () |
| Returns the number of flows that are still active. | |
| unsigned int | getWaitingVehicleNo () const throw () |
| Returns the number of waiting vehicles. | |
| MSInsertionControl (MSVehicleControl &vc, SUMOTime maxDepartDelay, bool checkEdgesOnce) throw () | |
| Constructor. | |
| ~MSInsertionControl () throw () | |
| Destructor. | |
Private Member Functions | |
| unsigned int | checkFlows (SUMOTime time, MSVehicleContainer::VehicleVector &refusedEmits) throw (ProcessError) |
| Checks for all vehicles coming from flows whether they can be emitted. | |
| void | checkFlowWait (SUMOVehicle *veh) throw () |
| Checks whether any flow is blocked due to this vehicle and clears the block. | |
| void | checkPrevious (SUMOTime time) throw () |
| Adds all vehicles that should have been emitted earlier to the refuse container. | |
| MSInsertionControl (const MSInsertionControl &) | |
| Invalidated copy constructor. | |
| MSInsertionControl & | operator= (const MSInsertionControl &) |
| Invalidated assignment operator. | |
| unsigned int | tryInsert (SUMOTime time, SUMOVehicle *veh, MSVehicleContainer::VehicleVector &refusedEmits) throw (ProcessError) |
| Tries to emit the vehicle. | |
Private Attributes | |
| MSVehicleContainer | myAllVeh |
| All loaded vehicles sorted by their departure time. | |
| bool | myCheckEdgesOnce |
| Whether an edge on which a vehicle could not depart should be ignored in the same step. | |
| std::vector< Flow > | myFlows |
| Container for periodical vehicle parameters. | |
| SUMOTime | myMaxDepartDelay |
| The maximum waiting time; vehicles waiting longer are deleted (-1: no deletion) | |
| MSVehicleContainer::VehicleVector | myRefusedEmits1 |
| Buffers for vehicles that could not been inserted. | |
| MSVehicleContainer::VehicleVector | myRefusedEmits2 |
| MSVehicleControl & | myVehicleControl |
| The assigned vehicle control (needed for vehicle re-insertion and deletion) | |
Inserts vehicles into the network when their departure time is reached.
Holds a list of vehicles which may be filled by vehicles read by MSRouteLoaders. Tries to emit vehicles departing at a time into the network as soon this time is reached and keeps them as long the insertion fails.
If a vehicle is emitted, the control about it is given to the lanes.
Vehicles are not controlled (created, deleted) by this class.
Definition at line 63 of file MSInsertionControl.h.
| MSInsertionControl::MSInsertionControl | ( | MSVehicleControl & | vc, |
| SUMOTime | maxDepartDelay, | ||
| bool | checkEdgesOnce | ||
| ) | throw () |
Constructor.
| [in] | vc | The assigned vehicle control (needed for vehicle re-insertion and deletion) |
| [in] | maxDepartDelay | Vehicles waiting for insertion longer than this time are deleted (-1: no deletion) |
| [in] | checkEdgesOnce | Whether an edge on which a vehicle could not depart should be ignored in the same step |
Definition at line 46 of file MSInsertionControl.cpp.
| MSInsertionControl::~MSInsertionControl | ( | ) | throw () |
| MSInsertionControl::MSInsertionControl | ( | const MSInsertionControl & | ) | [private] |
Invalidated copy constructor.
| void MSInsertionControl::add | ( | SUMOVehicle * | veh | ) | throw () |
Adds a single vehicle for departure.
The vehicle is added to "myAllVeh".
| [in] | veh | The vehicle to add for later insertion |
Definition at line 61 of file MSInsertionControl.cpp.
Referenced by MSRouteHandler::closeFlow(), MSRouteHandler::closeVehicle(), MSPerson::MSPersonStage_Driving::proceed(), and TraCIServerAPI_Vehicle::processSet().
| void MSInsertionControl::add | ( | SUMOVehicleParameter * | pars | ) | throw () |
Adds parameter for a vehicle flow for departure.
| [in] | flow | The flow to add for later insertion |
Definition at line 67 of file MSInsertionControl.cpp.
References DEPART_LANE_RANDOM, DEPART_POS_RANDOM, MSRoute::distDictionary(), MSNet::getInstance(), RandomDistributor< T >::getVals(), MSNet::getVehicleControl(), MSVehicleControl::hasVTypeDistribution(), MSInsertionControl::Flow::isVolatile, MSInsertionControl::Flow::pars, and MSInsertionControl::Flow::vehicle.
| unsigned int MSInsertionControl::checkFlows | ( | SUMOTime | time, |
| MSVehicleContainer::VehicleVector & | refusedEmits | ||
| ) | throw (ProcessError) [private] |
Checks for all vehicles coming from flows whether they can be emitted.
| [in] | time | The current simulation time |
| [in] | refusedEmits | Container to insert vehicles that could not be emitted into |
Definition at line 193 of file MSInsertionControl.cpp.
References MSVehicleControl::addVehicle(), MSVehicleControl::buildVehicle(), DELTA_T, SUMOVehicleParameter::depart, MSRoute::dictionary(), MSNet::getInstance(), MSVehicleControl::getVehicle(), MSNet::getVehicleControl(), MSVehicleControl::getVType(), SUMOVehicleParameter::id, SUMOVehicleParameter::repetitionNumber, SUMOVehicleParameter::repetitionOffset, SUMOVehicleParameter::repetitionsDone, SUMOVehicleParameter::routeid, toString(), and SUMOVehicleParameter::vtypeid.
| void MSInsertionControl::checkFlowWait | ( | SUMOVehicle * | veh | ) | throw () [private] |
Checks whether any flow is blocked due to this vehicle and clears the block.
| [in] | veh | The vehicle to check for |
Definition at line 169 of file MSInsertionControl.cpp.
| void MSInsertionControl::checkPrevious | ( | SUMOTime | time | ) | throw () [private] |
Adds all vehicles that should have been emitted earlier to the refuse container.
| [in] | time | The current simulation time |
Definition at line 180 of file MSInsertionControl.cpp.
| unsigned int MSInsertionControl::emitVehicles | ( | SUMOTime | time | ) | throw (ProcessError) |
Emits vehicles that want to depart at the given time.
All vehicles scheduled for this time are tried to be emitted. This includes those with a depart time as the given time and those that wait for being emitted due they could not be inserted in previous steps.
For each vehicle, tryInsert is called. If this fails, a vehicle keeps within the refused emit containers ("myRefusedEmits1", "myRefusedEmits2") so that it may be emitted within the next steps.
Returns the number of vehicles that could be inserted into the net.
| [in] | time | The current simulation time |
Definition at line 96 of file MSInsertionControl.cpp.
Referenced by MSNet::simulationStep().
| int MSInsertionControl::getPendingFlowCount | ( | ) | const throw () |
Returns the number of flows that are still active.
Definition at line 246 of file MSInsertionControl.cpp.
References myFlows.
Referenced by MSNet::simulationState().
| unsigned int MSInsertionControl::getWaitingVehicleNo | ( | ) | const throw () |
Returns the number of waiting vehicles.
The sizes of refused emits (sum of vehicles in "myRefusedEmits1" and "myRefusedEmits2") is returned.
Definition at line 240 of file MSInsertionControl.cpp.
References myRefusedEmits1, and myRefusedEmits2.
Referenced by MSNet::closeSimulation(), GUINet::getParameterWindow(), and MSNet::writeOutput().
| MSInsertionControl& MSInsertionControl::operator= | ( | const MSInsertionControl & | ) | [private] |
Invalidated assignment operator.
| unsigned int MSInsertionControl::tryInsert | ( | SUMOTime | time, |
| SUMOVehicle * | veh, | ||
| MSVehicleContainer::VehicleVector & | refusedEmits | ||
| ) | throw (ProcessError) [private] |
Tries to emit the vehicle.
If the insertion fails, it is examined whether the reason was a vaporizing edge. If so, the vehicle is deleted. Otherwise, it is checked whether the time the vehicle had to wait so far is larger than the maximum allowed waiting time. If so, the vehicle is deleted, too. If both does not match, the vehicle is reinserted to "refusedEmits" in order to be emitted in next steps.
| [in] | time | The current simulation time |
| [in] | veh | The vehicle to emit |
| [in] | refusedEmits | Container to insert vehicles that could not be emitted into |
Definition at line 141 of file MSInsertionControl.cpp.
References DELTA_T.
All loaded vehicles sorted by their departure time.
Definition at line 179 of file MSInsertionControl.h.
bool MSInsertionControl::myCheckEdgesOnce [private] |
Whether an edge on which a vehicle could not depart should be ignored in the same step.
Definition at line 203 of file MSInsertionControl.h.
std::vector<Flow> MSInsertionControl::myFlows [private] |
Container for periodical vehicle parameters.
Definition at line 197 of file MSInsertionControl.h.
Referenced by getPendingFlowCount(), and ~MSInsertionControl().
SUMOTime MSInsertionControl::myMaxDepartDelay [private] |
The maximum waiting time; vehicles waiting longer are deleted (-1: no deletion)
Definition at line 200 of file MSInsertionControl.h.
Buffers for vehicles that could not been inserted.
Definition at line 182 of file MSInsertionControl.h.
Referenced by getWaitingVehicleNo().
Definition at line 182 of file MSInsertionControl.h.
Referenced by getWaitingVehicleNo().
The assigned vehicle control (needed for vehicle re-insertion and deletion)
Definition at line 176 of file MSInsertionControl.h.