Eclipse 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-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 /****************************************************************************/
14 // The class responsible for building and deletion of vehicles (meso-version)
15 /****************************************************************************/
16 
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
28 #include <microsim/MSNet.h>
30 #include <microsim/MSVehicleType.h>
31 #include "MESegment.h"
32 #include "MEVehicle.h"
33 #include "MEVehicleControl.h"
34 
35 
36 // ===========================================================================
37 // member method definitions
38 // ===========================================================================
40  : MSVehicleControl() {}
41 
42 
44 
45 
48  const MSRoute* route, MSVehicleType* type,
49  const bool ignoreStopErrors, const bool fromRouteFile) {
50  myLoadedVehNo++;
51  MEVehicle* built = new MEVehicle(defs, route, type, type->computeChosenSpeedDeviation(fromRouteFile ? MSRouteHandler::getParsingRNG() : nullptr));
52  built->addStops(ignoreStopErrors);
54  return built;
55 }
56 
57 
58 /****************************************************************************/
59 
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
MEVehicle
A vehicle from the mesoscopic point of view.
Definition: MEVehicle.h:44
MSNet.h
MSNet::informVehicleStateListener
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
Definition: MSNet.cpp:894
MsgHandler.h
FileHelpers.h
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
MEVehicleControl::MEVehicleControl
MEVehicleControl()
Constructor.
Definition: MEVehicleControl.cpp:39
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
MEVehicleControl::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: MEVehicleControl.cpp:47
MSRoute
Definition: MSRoute.h:66
MSVehicleType.h
MESegment.h
MSVehicleControl::myLoadedVehNo
int myLoadedVehNo
The number of build vehicles.
Definition: MSVehicleControl.h:521
BinaryInputDevice.h
MSVehicleType::computeChosenSpeedDeviation
double computeChosenSpeedDeviation(std::mt19937 *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
Definition: MSVehicleType.cpp:82
MEVehicleControl.h
OutputDevice.h
MSNet::VEHICLE_STATE_BUILT
@ VEHICLE_STATE_BUILT
The vehicle was built, but has not yet departed.
Definition: MSNet.h:537
MSBaseVehicle::addStops
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
Definition: MSBaseVehicle.cpp:593
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
MSRouteHandler::getParsingRNG
static std::mt19937 * getParsingRNG()
get parsing RNG
Definition: MSRouteHandler.h:62
MEVehicle.h
config.h
MSVehicleControl
The class responsible for building and deletion of vehicles.
Definition: MSVehicleControl.h:71
SUMOVTypeParameter.h
MSRouteHandler.h
MEVehicleControl::~MEVehicleControl
~MEVehicleControl()
Destructor.
Definition: MEVehicleControl.cpp:43