Eclipse SUMO - Simulation of Urban MObility
MSInsertionControl.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // Inserts vehicles into the network when their departure time is reached
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <iostream>
28 #include <algorithm>
29 #include <cassert>
30 #include <iterator>
34 #include "MSGlobals.h"
35 #include "MSVehicle.h"
36 #include "MSVehicleControl.h"
37 #include "MSLane.h"
38 #include "MSEdge.h"
39 #include "MSNet.h"
40 #include "MSRouteHandler.h"
41 #include "MSInsertionControl.h"
42 
43 
44 // ===========================================================================
45 // member method definitions
46 // ===========================================================================
48  SUMOTime maxDepartDelay,
49  bool eagerInsertionCheck,
50  int maxVehicleNumber,
51  SUMOTime randomDepartOffset) :
52  myVehicleControl(vc),
53  myMaxDepartDelay(maxDepartDelay),
54  myEagerInsertionCheck(eagerInsertionCheck),
55  myMaxVehicleNumber(maxVehicleNumber),
56  myPendingEmitsUpdateTime(SUMOTime_MIN) {
57  myMaxRandomDepartOffset = randomDepartOffset;
59 }
60 
61 
63  for (std::vector<Flow>::iterator i = myFlows.begin(); i != myFlows.end(); ++i) {
64  delete (i->pars);
65  }
66 }
67 
68 
69 void
71  myAllVeh.add(veh);
72 }
73 
74 
75 bool
77  const bool loadingFromState = index >= 0;
78  if (myFlowIDs.count(pars->id) > 0) {
79  if (loadingFromState) {
80  // flows loaded from simulation state must be unique
81  return false;
82  }
83  // set actual parameters for a state-loaded flow (for which only index is known)
84  for (Flow& flow : myFlows) {
85  // if the flow was loaded from state this is recognizable by having
86  // neither repetitionNumber nor repetitionProbability
87  if (flow.pars->id == pars->id && flow.pars->repetitionNumber == -1 && flow.pars->repetitionProbability == -1) {
88  if (flow.pars->wasSet(VEHPARS_FORCE_REROUTE)) {
90  }
91  delete flow.pars;
92  flow.pars = pars;
93  return true;
94  }
95  }
96  return false;
97  } else {
98  Flow flow;
99  flow.pars = pars;
100  flow.index = loadingFromState ? index : 0;
101  myFlows.push_back(flow);
102  myFlowIDs.insert(pars->id);
103  return true;
104  }
105 }
106 
107 
108 int
110  // check whether any vehicles shall be emitted within this time step
111  const bool havePreChecked = MSRoutingEngine::isEnabled();
112  if (myPendingEmits.empty() || (havePreChecked && myEmitCandidates.empty())) {
113  return 0;
114  }
115  int numEmitted = 0;
116  // we use buffering for the refused emits to save time
117  // for this, we have two lists; one contains previously refused emits, the second
118  // will be used to append those vehicles that will not be able to depart in this
119  // time step
121 
122  // go through the list of previously refused vehicles, first
123  MSVehicleContainer::VehicleVector::const_iterator veh;
124  for (veh = myPendingEmits.begin(); veh != myPendingEmits.end(); veh++) {
125  if (havePreChecked && (myEmitCandidates.count(*veh) == 0)) {
126  refusedEmits.push_back(*veh);
127  } else {
128  numEmitted += tryInsert(time, *veh, refusedEmits);
129  }
130  }
131  myEmitCandidates.clear();
132  myPendingEmits = refusedEmits;
133  return numEmitted;
134 }
135 
136 
137 int
139  MSVehicleContainer::VehicleVector& refusedEmits) {
140  assert(veh->getParameter().depart < time + DELTA_T);
141  const MSEdge& edge = *veh->getEdge();
142  if (veh->isOnRoad()) {
143  return 1;
144  }
145  if ((myMaxVehicleNumber < 0 || (int)MSNet::getInstance()->getVehicleControl().getRunningVehicleNo() < myMaxVehicleNumber)
146  && edge.insertVehicle(*veh, time, false, myEagerInsertionCheck)) {
147  // Successful insertion
148  return 1;
149  }
150  if (myMaxDepartDelay >= 0 && time - veh->getParameter().depart > myMaxDepartDelay) {
151  // remove vehicles waiting too long for departure
152  myVehicleControl.deleteVehicle(veh, true);
153  } else if (edge.isVaporizing()) {
154  // remove vehicles if the edge shall be empty
155  myVehicleControl.deleteVehicle(veh, true);
156  } else if (myAbortedEmits.count(veh) > 0) {
157  // remove vehicles which shall not be inserted for some reason
158  myAbortedEmits.erase(veh);
159  myVehicleControl.deleteVehicle(veh, true);
160  } else {
161  // let the vehicle wait one step, we'll retry then
162  refusedEmits.push_back(veh);
163  }
164  edge.setLastFailedInsertionTime(time);
165  return 0;
166 }
167 
168 
169 void
170 MSInsertionControl::checkCandidates(SUMOTime time, const bool preCheck) {
171  while (myAllVeh.anyWaitingBefore(time + DELTA_T)) {
173  copy(top.begin(), top.end(), back_inserter(myPendingEmits));
174  myAllVeh.pop();
175  }
176  if (preCheck) {
177  MSVehicleContainer::VehicleVector::const_iterator veh;
178  for (veh = myPendingEmits.begin(); veh != myPendingEmits.end(); veh++) {
179  SUMOVehicle* const v = *veh;
180  const MSEdge* const edge = v->getEdge();
181  if (edge->insertVehicle(*v, time, true, myEagerInsertionCheck)) {
182  myEmitCandidates.insert(v);
183  } else {
184  MSDevice_Routing* dev = static_cast<MSDevice_Routing*>(v->getDevice(typeid(MSDevice_Routing)));
185  if (dev != nullptr) {
186  dev->skipRouting(time);
187  }
188  }
189  }
190  }
191 }
192 
193 
194 void
197  for (std::vector<Flow>::iterator i = myFlows.begin(); i != myFlows.end();) {
198  SUMOVehicleParameter* pars = i->pars;
199  bool tryEmitByProb = pars->repetitionProbability > 0;
200  while ((pars->repetitionProbability < 0
201  && pars->repetitionsDone < pars->repetitionNumber
202  && pars->depart + pars->repetitionsDone * pars->repetitionOffset < time + DELTA_T)
203  || (tryEmitByProb
204  && pars->depart < time + DELTA_T
205  && pars->repetitionEnd > time
206  // only call rand if all other conditions are met
208  ) {
209  tryEmitByProb = false; // only emit one per step
210  SUMOVehicleParameter* newPars = new SUMOVehicleParameter(*pars);
211  newPars->id = pars->id + "." + toString(i->index);
212  newPars->depart = pars->repetitionProbability > 0 ? time : (SUMOTime)(pars->depart + pars->repetitionsDone * pars->repetitionOffset) + computeRandomDepartOffset();
213  pars->repetitionsDone++;
214  // try to build the vehicle
215  if (vehControl.getVehicle(newPars->id) == nullptr) {
216  const MSRoute* const route = MSRoute::dictionary(pars->routeid);
217  MSVehicleType* const vtype = vehControl.getVType(pars->vtypeid, MSRouteHandler::getParsingRNG());
218  SUMOVehicle* const vehicle = vehControl.buildVehicle(newPars, route, vtype, !MSGlobals::gCheckRoutes);
219  int quota = vehControl.getQuota();
220  if (quota > 0) {
221  vehControl.addVehicle(newPars->id, vehicle);
222  add(vehicle);
223  i->index++;
224  while (--quota > 0) {
225  SUMOVehicleParameter* const quotaPars = new SUMOVehicleParameter(*pars);
226  quotaPars->id = pars->id + "." + toString(i->index);
227  quotaPars->depart = pars->repetitionProbability > 0 ? time :
229  SUMOVehicle* const quotaVehicle = vehControl.buildVehicle(quotaPars, route, vtype, !MSGlobals::gCheckRoutes);
230  vehControl.addVehicle(quotaPars->id, quotaVehicle);
231  add(quotaVehicle);
232  i->index++;
233  }
234  } else {
235  vehControl.deleteVehicle(vehicle, true);
236  }
237  } else {
238  // strange: another vehicle with the same id already exists
240  vehControl.discountStateLoaded();
241  break;
242  }
243  throw ProcessError("Another vehicle with the id '" + newPars->id + "' exists.");
244  }
245  }
246  if (pars->repetitionsDone == pars->repetitionNumber || (pars->repetitionProbability > 0 && pars->repetitionEnd <= time)) {
247  i = myFlows.erase(i);
249  delete pars;
250  } else {
251  ++i;
252  }
253  }
255 }
256 
257 
258 int
260  return (int)myPendingEmits.size();
261 }
262 
263 
264 int
266  return (int)myFlows.size();
267 }
268 
269 
270 void
272  myAbortedEmits.insert(veh);
273 }
274 
275 
276 void
278  myPendingEmits.erase(std::remove(myPendingEmits.begin(), myPendingEmits.end(), veh), myPendingEmits.end());
279  myAllVeh.remove(veh);
280 }
281 
282 
283 void
284 MSInsertionControl::clearPendingVehicles(const std::string& route) {
285  //clear out the refused vehicle list, deleting the vehicles entirely
286  MSVehicleContainer::VehicleVector::iterator veh;
287  for (veh = myPendingEmits.begin(); veh != myPendingEmits.end();) {
288  if ((*veh)->getRoute().getID() == route || route == "") {
289  myVehicleControl.deleteVehicle(*veh, true);
290  veh = myPendingEmits.erase(veh);
291  } else {
292  ++veh;
293  }
294  }
295 }
296 
297 
298 int
300  if (MSNet::getInstance()->getCurrentTimeStep() > myPendingEmitsUpdateTime) {
301  // updated pending emits (only once per time step)
302  myPendingEmitsForLane.clear();
303  for (const SUMOVehicle* const veh : myPendingEmits) {
304  const MSLane* const vlane = veh->getLane();
305  if (vlane != nullptr) {
306  myPendingEmitsForLane[vlane]++;
307  } else {
308  // no (tentative) departLane was set, increase count for all
309  // lanes of the depart edge
310  for (const MSLane* const l : veh->getEdge()->getLanes()) {
312  }
313  }
314  }
316  }
317  return myPendingEmitsForLane[lane];
318 }
319 
320 
321 void
323  // fill the public transport router with pre-parsed public transport lines
324  for (const Flow& f : myFlows) {
325  if (f.pars->line != "") {
326  const MSRoute* const route = MSRoute::dictionary(f.pars->routeid);
327  router.getNetwork()->addSchedule(*f.pars, route == nullptr ? nullptr : &route->getStops());
328  }
329  }
330 }
331 
332 
333 void
335  // save flow states
336  for (const Flow& flow : myFlows) {
338  out.writeAttr(SUMO_ATTR_ID, flow.pars->id);
339  out.writeAttr(SUMO_ATTR_INDEX, flow.index);
340  if (flow.pars->wasSet(VEHPARS_FORCE_REROUTE)) {
341  out.writeAttr(SUMO_ATTR_REROUTE, true);
342  }
343  out.closeTag();
344  }
345 }
346 
347 
348 SUMOTime
350  if (myMaxRandomDepartOffset > 0) {
351  // round to the closest usable simulation step
353  } else {
354  return 0;
355  }
356 }
357 
358 
359 
360 /****************************************************************************/
MSRoute::checkDist
static void checkDist(const std::string &id)
Checks the distribution whether it is permanent and deletes it if not.
Definition: MSRoute.cpp:185
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
MSInsertionControl::myFlows
std::vector< Flow > myFlows
Container for periodical vehicle parameters.
Definition: MSInsertionControl.h:219
MSInsertionControl::myMaxDepartDelay
SUMOTime myMaxDepartDelay
The maximum waiting time; vehicles waiting longer are deleted (-1: no deletion)
Definition: MSInsertionControl.h:225
MSInsertionControl::Flow::pars
SUMOVehicleParameter * pars
The parameters.
Definition: MSInsertionControl.h:213
SUMOVehicleParameter::parametersSet
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color)
Definition: SUMOVehicleParameter.h:671
MSDevice_Routing
A device that performs vehicle rerouting based on current edge speeds.
Definition: MSDevice_Routing.h:60
MSInsertionControl::myEagerInsertionCheck
bool myEagerInsertionCheck
Whether an edge on which a vehicle could not depart should be ignored in the same step.
Definition: MSInsertionControl.h:228
MSNet.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSEdge::isVaporizing
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
Definition: MSEdge.h:379
MSVehicleControl::getVType
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=nullptr)
Returns the named vehicle type or a sample from the named distribution.
Definition: MSVehicleControl.cpp:353
MSVehicleContainer::pop
void pop()
Removes the uppermost vehicle vector.
Definition: MSVehicleContainer.cpp:171
SUMOVehicle::getParameter
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
MSInsertionControl::emitVehicles
int emitVehicles(SUMOTime time)
Emits vehicles that want to depart at the given time.
Definition: MSInsertionControl.cpp:109
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
MSInsertionControl::getPendingFlowCount
int getPendingFlowCount() const
Returns the number of flows that are still active.
Definition: MSInsertionControl.cpp:265
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:36
MSInsertionControl::myPendingEmits
MSVehicleContainer::VehicleVector myPendingEmits
Buffers for vehicles that could not be inserted.
Definition: MSInsertionControl.h:200
SUMOTrafficObject::getEdge
virtual const MSEdge * getEdge() const =0
Returns the edge the vehicle is currently at.
IntermodalRouter
Definition: IntermodalRouter.h:54
MSVehicleControl::discountStateLoaded
void discountStateLoaded(bool removed=false)
avoid counting a vehicle twice if it was loaded from state and route input
Definition: MSVehicleControl.h:472
MSGlobals::gStateLoaded
static bool gStateLoaded
Information whether a state has been loaded.
Definition: MSGlobals.h:87
SUMOVehicleParameter::vtypeid
std::string vtypeid
The vehicle's type id.
Definition: SUMOVehicleParameter.h:474
VEHPARS_FORCE_REROUTE
const int VEHPARS_FORCE_REROUTE
Definition: SUMOVehicleParameter.h:62
SUMOVehicleParameter::repetitionOffset
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
Definition: SUMOVehicleParameter.h:550
MSInsertionControl::myPendingEmitsUpdateTime
SUMOTime myPendingEmitsUpdateTime
Last time at which pending emits for each edge where counted.
Definition: MSInsertionControl.h:234
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
SUMOVehicle::isOnRoad
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
MSInsertionControl::myVehicleControl
MSVehicleControl & myVehicleControl
The assigned vehicle control (needed for vehicle re-insertion and deletion)
Definition: MSInsertionControl.h:194
IntermodalNetwork::addSchedule
void addSchedule(const SUMOVehicleParameter &pars, const std::vector< SUMOVehicleParameter::Stop > *addStops=nullptr)
Definition: IntermodalNetwork.h:550
MSInsertionControl::myEmitCandidates
std::set< SUMOVehicle * > myEmitCandidates
Buffer for vehicles that may be inserted in the current step.
Definition: MSInsertionControl.h:203
SUMO_ATTR_ID
@ SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
MSEdge.h
MSInsertionControl.h
MSInsertionControl::getWaitingVehicleNo
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
Definition: MSInsertionControl.cpp:259
MSRoute
Definition: MSRoute.h:66
SUMOVehicleParameter::depart
SUMOTime depart
Definition: SUMOVehicleParameter.h:482
MSInsertionControl::myFlowRNG
std::mt19937 myFlowRNG
A random number generator for probabilistic flows.
Definition: MSInsertionControl.h:250
MSVehicle.h
OutputDevice::closeTag
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition: OutputDevice.cpp:253
MSInsertionControl::myMaxVehicleNumber
int myMaxVehicleNumber
Storage for maximum vehicle number.
Definition: MSInsertionControl.h:231
SUMOTime_MIN
#define SUMOTime_MIN
Definition: SUMOTime.h:36
MSInsertionControl::computeRandomDepartOffset
SUMOTime computeRandomDepartOffset() const
compute (optional) random offset to the departure time
Definition: MSInsertionControl.cpp:349
MSVehicleControl::buildVehicle
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
Builds a vehicle, increases the number of built vehicles.
Definition: MSVehicleControl.cpp:100
MSInsertionControl::adaptIntermodalRouter
void adaptIntermodalRouter(MSNet::MSIntermodalRouter &router) const
Definition: MSInsertionControl.cpp:322
OutputDevice::writeAttr
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:255
MSVehicleControl::addVehicle
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
Definition: MSVehicleControl.cpp:215
RandHelper::rand
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
Definition: RandHelper.h:53
MSVehicleControl::getVehicle
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
Definition: MSVehicleControl.cpp:240
MSInsertionControl::MSInsertionControl
MSInsertionControl(MSVehicleControl &vc, SUMOTime maxDepartDelay, bool checkEdgesOnce, int maxVehicleNumber, SUMOTime randomDepartOffset)
Constructor.
Definition: MSInsertionControl.cpp:47
MSEdge::setLastFailedInsertionTime
void setLastFailedInsertionTime(SUMOTime time) const
Sets the last time a vehicle could not be inserted.
Definition: MSEdge.h:519
MSVehicleContainer::remove
void remove(SUMOVehicle *veh)
Removes a single vehicle.
Definition: MSVehicleContainer.cpp:92
TS
#define TS
Definition: SUMOTime.h:43
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:283
MSInsertionControl::Flow::index
int index
the running index
Definition: MSInsertionControl.h:215
MSInsertionControl::saveState
void saveState(OutputDevice &out)
Saves the current state into the given stream.
Definition: MSInsertionControl.cpp:334
SUMOVehicle::getDevice
virtual MSVehicleDevice * getDevice(const std::type_info &type) const =0
Returns a device of the given type if it exists or 0.
MSInsertionControl::myFlowIDs
std::set< std::string > myFlowIDs
Cache for periodical vehicle ids for quicker checking.
Definition: MSInsertionControl.h:222
SUMOVehicleParameter::id
std::string id
The vehicle's id.
Definition: SUMOVehicleParameter.h:468
MSInsertionControl::myAbortedEmits
std::set< const SUMOVehicle * > myAbortedEmits
Set of vehicles which shall not be inserted anymore.
Definition: MSInsertionControl.h:206
MSInsertionControl::getPendingEmits
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
Definition: MSInsertionControl.cpp:299
SUMOVehicleParameter::repetitionProbability
double repetitionProbability
The probability for emitting a vehicle per second.
Definition: SUMOVehicleParameter.h:553
MSVehicleControl::deleteVehicle
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
Definition: MSVehicleControl.cpp:250
MSInsertionControl::descheduleDeparture
void descheduleDeparture(const SUMOVehicle *veh)
stops trying to emit the given vehicle (and delete it)
Definition: MSInsertionControl.cpp:271
ProcessError
Definition: UtilExceptions.h:39
MSInsertionControl::determineCandidates
void determineCandidates(SUMOTime time)
Checks for all vehicles whether they can be emitted.
Definition: MSInsertionControl.cpp:195
MSInsertionControl::myPendingEmitsForLane
std::map< const MSLane *, int > myPendingEmitsForLane
the number of pending emits for each edge in the current time step
Definition: MSInsertionControl.h:237
MSGlobals.h
MSDevice_Routing.h
SUMOVehicleParameter::repetitionsDone
int repetitionsDone
The number of times the vehicle was already inserted.
Definition: SUMOVehicleParameter.h:547
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSVehicleContainer::VehicleVector
std::vector< SUMOVehicle * > VehicleVector
definition of a list of vehicles which have the same departure time
Definition: MSVehicleContainer.h:49
MSInsertionControl::add
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Definition: MSInsertionControl.cpp:70
MSGlobals::gCheckRoutes
static bool gCheckRoutes
Definition: MSGlobals.h:78
MSVehicleControl::getQuota
int getQuota(double frac=-1) const
Returns the number of instances of the current vehicle that shall be emitted considering that "frac" ...
Definition: MSVehicleControl.cpp:437
SUMOVehicleParameter::routeid
std::string routeid
The vehicle's route id.
Definition: SUMOVehicleParameter.h:471
MSRoutingEngine.h
MSInsertionControl::checkCandidates
void checkCandidates(SUMOTime time, const bool preCheck)
Adds all vehicles that should have been emitted earlier to the refuse container.
Definition: MSInsertionControl.cpp:170
RandHelper::initRandGlobal
static void initRandGlobal(std::mt19937 *which=0)
Reads the given random number options and initialises the random number generator in accordance.
Definition: RandHelper.cpp:77
SUMO_ATTR_INDEX
@ SUMO_ATTR_INDEX
Definition: SUMOXMLDefinitions.h:804
MSDevice_Routing::skipRouting
void skipRouting(const SUMOTime currentTime)
Labels the current time step as "unroutable".
Definition: MSDevice_Routing.h:149
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:669
SUMOVehicleParameter::repetitionEnd
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
Definition: SUMOVehicleParameter.h:556
OutputDevice::openTag
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
Definition: OutputDevice.cpp:239
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
MSEdge::insertVehicle
bool insertVehicle(SUMOVehicle &v, SUMOTime time, const bool checkOnly=false, const bool forceCheck=false) const
Tries to insert the given vehicle into the network.
Definition: MSEdge.cpp:544
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
SUMO_TAG_FLOWSTATE
@ SUMO_TAG_FLOWSTATE
a flow state definition (used when saving and loading simulatino state)
Definition: SUMOXMLDefinitions.h:155
MSRoutingEngine::isEnabled
static bool isEnabled()
returns whether any routing actions take place
Definition: MSRoutingEngine.h:97
SUMO_ATTR_REROUTE
@ SUMO_ATTR_REROUTE
Definition: SUMOXMLDefinitions.h:648
MSInsertionControl::clearPendingVehicles
void clearPendingVehicles(const std::string &route)
clears out all pending vehicles from a route, "" for all routes
Definition: MSInsertionControl.cpp:284
MSRouteHandler::getParsingRNG
static std::mt19937 * getParsingRNG()
get parsing RNG
Definition: MSRouteHandler.h:62
MSVehicleContainer::anyWaitingBefore
bool anyWaitingBefore(SUMOTime time) const
Returns the information whether any vehicles want to depart before the given time.
Definition: MSVehicleContainer.cpp:145
MSRoute::getStops
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
Definition: MSRoute.cpp:376
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:167
MSInsertionControl::addFlow
bool addFlow(SUMOVehicleParameter *const pars, int index=-1)
Adds parameter for a vehicle flow for departure.
Definition: MSInsertionControl.cpp:76
MSRoute::dictionary
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
Definition: MSRoute.cpp:113
config.h
MSVehicleControl
The class responsible for building and deletion of vehicles.
Definition: MSVehicleControl.h:71
MSVehicleContainer::top
const VehicleVector & top()
Returns the uppermost vehicle vector.
Definition: MSVehicleContainer.cpp:151
MSInsertionControl::myMaxRandomDepartOffset
SUMOTime myMaxRandomDepartOffset
The maximum random offset to be added to vehicles departure times (non-negative)
Definition: MSInsertionControl.h:240
MSInsertionControl::myAllVeh
MSVehicleContainer myAllVeh
All loaded vehicles sorted by their departure time.
Definition: MSInsertionControl.h:197
MSLane.h
SUMOVehicleParameter::repetitionNumber
int repetitionNumber
Definition: SUMOVehicleParameter.h:544
IntermodalRouter::getNetwork
Network * getNetwork() const
Definition: IntermodalRouter.h:234
MSVehicleContainer::add
void add(SUMOVehicle *veh)
Adds a single vehicle.
Definition: MSVehicleContainer.cpp:74
MSRouteHandler.h
MSInsertionControl::Flow
Definition of vehicle flow with the current index for vehicle numbering.
Definition: MSInsertionControl.h:211
MSVehicleControl.h
MSInsertionControl::tryInsert
int tryInsert(SUMOTime time, SUMOVehicle *veh, MSVehicleContainer::VehicleVector &refusedEmits)
Tries to emit the vehicle.
Definition: MSInsertionControl.cpp:138
MSNet::getVehicleControl
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:336
IntermodalRouter.h
MSInsertionControl::~MSInsertionControl
~MSInsertionControl()
Destructor.
Definition: MSInsertionControl.cpp:62
MSInsertionControl::alreadyDeparted
void alreadyDeparted(SUMOVehicle *veh)
stops trying to emit the given vehicle (because it already departed)
Definition: MSInsertionControl.cpp:277