SUMO - Simulation of Urban MObility
MEVehicleControl.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // The class responsible for building and deletion of vehicles (meso-version)
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
36 #include <microsim/MSNet.h>
38 #include <microsim/MSVehicleType.h>
39 #include "MESegment.h"
40 #include "MEVehicle.h"
41 #include "MEVehicleControl.h"
42 
43 
44 // ===========================================================================
45 // member method definitions
46 // ===========================================================================
48  : MSVehicleControl() {}
49 
50 
52 
53 
56  const MSRoute* route, const MSVehicleType* type,
57  const bool ignoreStopErrors, const bool fromRouteFile) {
58  myLoadedVehNo++;
59  if (fromRouteFile) {
61  }
62  MEVehicle* built = new MEVehicle(defs, route, type, type->computeChosenSpeedDeviation(fromRouteFile ? MSRouteHandler::getParsingRNG() : 0));
63  built->addStops(ignoreStopErrors);
65  return built;
66 }
67 
68 
69 /****************************************************************************/
70 
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, const MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
Builds a vehicle, increases the number of built vehicles.
SUMOTime computeRandomDepartOffset() const
compute (optional) random offset to the departure time
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:52
static MTRand * getParsingRNG()
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:158
The car-following model and parameter.
Definition: MSVehicleType.h:74
Representation of a vehicle.
Definition: SUMOVehicle.h:67
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:578
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
Structure representing possible vehicle parameter.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle&#39;s state change.
Definition: MSNet.cpp:811
MEVehicleControl()
Constructor.
double computeChosenSpeedDeviation(MTRand *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
The class responsible for building and deletion of vehicles.