SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSInsertionControl.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Inserts vehicles into the network when their departure time is reached
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12 // Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef MSInsertionControl_h
23 #define MSInsertionControl_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include "MSVehicleContainer.h"
36 #include <vector>
37 #include <map>
38 #include <string>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MSVehicle;
45 class MSVehicleControl;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
67 public:
74  MSInsertionControl(MSVehicleControl& vc, SUMOTime maxDepartDelay, bool checkEdgesOnce);
75 
76 
79 
80 
97  unsigned int emitVehicles(SUMOTime time);
98 
99 
106  void add(SUMOVehicle* veh);
107 
108 
113  void add(SUMOVehicleParameter* pars);
114 
115 
123  unsigned int getWaitingVehicleNo() const;
124 
125 
130  int getPendingFlowCount() const;
131 
132 
134  void descheduleDeparture(SUMOVehicle* veh);
135 
136 
137 private:
152  unsigned int tryInsert(SUMOTime time, SUMOVehicle* veh,
153  MSVehicleContainer::VehicleVector& refusedEmits);
154 
155 
160  void checkFlowWait(SUMOVehicle* veh);
161 
162 
168  void checkPrevious(SUMOTime time);
169 
170 
177  unsigned int checkFlows(SUMOTime time,
178  MSVehicleContainer::VehicleVector& refusedEmits);
179 
180 
181 private:
184 
187 
190 
192  std::set<SUMOVehicle*> myAbortedEmits;
193 
197  struct Flow {
204  };
205 
207  std::vector<Flow> myFlows;
208 
211 
214 
215 
216 private:
219 
222 
223 
224 };
225 
226 
227 #endif
228 
229 /****************************************************************************/
230 
int getPendingFlowCount() const
Returns the number of flows that are still active.
void checkFlowWait(SUMOVehicle *veh)
Checks whether any flow is blocked due to this vehicle and clears the block.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
void descheduleDeparture(SUMOVehicle *veh)
stops trying to emit the given vehicle
std::set< SUMOVehicle * > myAbortedEmits
Set of vehicles which shall not be inserted anymore.
SUMOVehicle * vehicle
The last created vehicle.
MSVehicleContainer myAllVeh
All loaded vehicles sorted by their departure time.
~MSInsertionControl()
Destructor.
std::vector< SUMOVehicle * > VehicleVector
definition of a list of vehicles which have the same departure time
unsigned int checkFlows(SUMOTime time, MSVehicleContainer::VehicleVector &refusedEmits)
Checks for all vehicles coming from flows whether they can be emitted.
unsigned int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
Representation of a vehicle.
Definition: SUMOVehicle.h:63
bool myCheckEdgesOnce
Whether an edge on which a vehicle could not depart should be ignored in the same step...
unsigned int tryInsert(SUMOTime time, SUMOVehicle *veh, MSVehicleContainer::VehicleVector &refusedEmits)
Tries to emit the vehicle.
SUMOTime myMaxDepartDelay
The maximum waiting time; vehicles waiting longer are deleted (-1: no deletion)
MSVehicleContainer::VehicleVector myRefusedEmits1
Buffers for vehicles that could not be inserted.
bool isVolatile
whether it has route or vehicle type distribution
Inserts vehicles into the network when their departure time is reached.
std::vector< Flow > myFlows
Container for periodical vehicle parameters.
MSVehicleContainer::VehicleVector myRefusedEmits2
Structure representing possible vehicle parameter.
MSVehicleControl & myVehicleControl
The assigned vehicle control (needed for vehicle re-insertion and deletion)
MSInsertionControl(MSVehicleControl &vc, SUMOTime maxDepartDelay, bool checkEdgesOnce)
Constructor.
unsigned int emitVehicles(SUMOTime time)
Emits vehicles that want to depart at the given time.
The class responsible for building and deletion of vehicles.
SUMOVehicleParameter * pars
The paramters.
MSInsertionControl & operator=(const MSInsertionControl &)
Invalidated assignment operator.
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
void checkPrevious(SUMOTime time)
Adds all vehicles that should have been emitted earlier to the refuse container.