SUMO - Simulation of Urban MObility
MEVehicleControl.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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // The class responsible for building and deletion of vehicles (meso-version)
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
35 #include <microsim/MSNet.h>
37 #include <microsim/MSVehicleType.h>
38 #include "MESegment.h"
39 #include "MEVehicle.h"
40 #include "MEVehicleControl.h"
41 
42 
43 // ===========================================================================
44 // member method definitions
45 // ===========================================================================
47  : MSVehicleControl() {}
48 
49 
51 
52 
55  const MSRoute* route, MSVehicleType* type,
56  const bool ignoreStopErrors, const bool fromRouteFile) {
57  myLoadedVehNo++;
58  if (fromRouteFile) {
60  }
61  MEVehicle* built = new MEVehicle(defs, route, type, type->computeChosenSpeedDeviation(fromRouteFile ? MSRouteHandler::getParsingRNG() : 0));
62  built->addStops(ignoreStopErrors);
64  return built;
65 }
66 
67 
68 /****************************************************************************/
69 
SUMOTime computeRandomDepartOffset() const
compute (optional) random offset to the departure time
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:51
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
The car-following model and parameter.
Definition: MSVehicleType.h:72
static std::mt19937 * getParsingRNG()
Representation of a vehicle.
Definition: SUMOVehicle.h:66
SUMOTime depart
The vehicle&#39;s departure time.
int myLoadedVehNo
The number of build vehicles.
~MEVehicleControl()
Destructor.
The vehicle was built, but has not yet departed.
Definition: MSNet.h:484
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
Structure representing possible vehicle parameter.
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.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle&#39;s state change.
Definition: MSNet.cpp:849
MEVehicleControl()
Constructor.
The class responsible for building and deletion of vehicles.
double computeChosenSpeedDeviation(std::mt19937 *rng, const double minDev=-1.) const
Computes and returns the speed deviation.