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-2018 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 /****************************************************************************/
15 // The class responsible for building and deletion of vehicles (meso-version)
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
29 #include <microsim/MSNet.h>
31 #include <microsim/MSVehicleType.h>
32 #include "MESegment.h"
33 #include "MEVehicle.h"
34 #include "MEVehicleControl.h"
35 
36 
37 // ===========================================================================
38 // member method definitions
39 // ===========================================================================
41  : MSVehicleControl() {}
42 
43 
45 
46 
49  const MSRoute* route, MSVehicleType* type,
50  const bool ignoreStopErrors, const bool fromRouteFile) {
51  myLoadedVehNo++;
52  MEVehicle* built = new MEVehicle(defs, route, type, type->computeChosenSpeedDeviation(fromRouteFile ? MSRouteHandler::getParsingRNG() : nullptr));
53  built->addStops(ignoreStopErrors);
55  return built;
56 }
57 
58 
59 /****************************************************************************/
60 
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:45
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle&#39;s state change.
Definition: MSNet.cpp:855
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:165
The car-following model and parameter.
Definition: MSVehicleType.h:66
static std::mt19937 * getParsingRNG()
Representation of a vehicle.
Definition: SUMOVehicle.h:60
int myLoadedVehNo
The number of build vehicles.
~MEVehicleControl()
Destructor.
The vehicle was built, but has not yet departed.
Definition: MSNet.h:496
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.
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.