Eclipse SUMO - Simulation of Urban MObility
MSVehicleControl.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-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// The class responsible for building and deletion of vehicles
21/****************************************************************************/
22#include <config.h>
23
24#include "MSVehicleControl.h"
25#include "MSVehicle.h"
26#include "MSLane.h"
27#include "MSEdge.h"
28#include "MSNet.h"
29#include "MSRouteHandler.h"
33#include <utils/common/Named.h>
39
40
41// ===========================================================================
42// member method definitions
43// ===========================================================================
45 myLoadedVehNo(0),
46 myRunningVehNo(0),
47 myEndedVehNo(0),
48 myDiscarded(0),
49 myCollisions(0),
50 myTeleportsCollision(0),
51 myTeleportsJam(0),
52 myTeleportsYield(0),
53 myTeleportsWrongLane(0),
54 myEmergencyStops(0),
55 myStoppedVehicles(0),
56 myTotalDepartureDelay(0),
57 myTotalTravelTime(0),
58 myWaitingForTransportable(0),
59 myMaxSpeedFactor(1),
60 myMinDeceleration(SUMOVTypeParameter::getDefaultDecel(SVC_IGNORING)),
61 myMinDecelerationRail(SUMOVTypeParameter::getDefaultDecel(SVC_RAIL)),
62 myPendingRemovals(MSGlobals::gNumSimThreads > 1) {
63
66}
67
68
70 clearState(false);
71}
72
73
74void
78
82
86
90
94
96 // ISO Container TEU (cannot set this based on vClass)
97 defContainerType.length = 6.1;
98 defContainerType.width = 2.4;
99 defContainerType.height = 2.6;
100 defContainerType.parametersSet |= VTYPEPARS_VEHICLECLASS_SET;
102
104}
105
106
109 ConstMSRoutePtr route, MSVehicleType* type,
110 const bool ignoreStopErrors, const bool fromRouteFile, bool addRouteStops) {
111 MSVehicle* built = new MSVehicle(defs, route, type, type->computeChosenSpeedDeviation(fromRouteFile ? MSRouteHandler::getParsingRNG() : nullptr));
112 initVehicle(built, ignoreStopErrors, addRouteStops);
113 return built;
114}
115
116
117void
118MSVehicleControl::initVehicle(MSBaseVehicle* built, const bool ignoreStopErrors, bool addRouteStops) {
120 try {
121 built->initDevices();
122 built->addStops(ignoreStopErrors, nullptr, addRouteStops);
123 } catch (ProcessError&) {
124 delete built;
125 throw;
126 }
128}
129
130
131void
133 assert(myRunningVehNo > 0);
134 if (!checkDuplicate || !isPendingRemoval(veh)) {
135 myPendingRemovals.push_back(veh);
136 }
137}
138
139
140bool
142#ifdef HAVE_FOX
143 return myPendingRemovals.contains(veh);
144#else
145 return std::find(myPendingRemovals.begin(), myPendingRemovals.end(), veh) == myPendingRemovals.end();
146#endif
147}
148
149
150void
152 OutputDevice* const tripinfoOut = OptionsCont::getOptions().isSet("tripinfo-output") ? &OutputDevice::getDeviceByOption("tripinfo-output") : nullptr;
153#ifdef HAVE_FOX
154 std::vector<SUMOVehicle*>& vehs = myPendingRemovals.getContainer();
155#else
156 std::vector<SUMOVehicle*>& vehs = myPendingRemovals;
157#endif
158 std::sort(vehs.begin(), vehs.end(), ComparatorNumericalIdLess());
159 for (SUMOVehicle* const veh : vehs) {
160 myTotalTravelTime += STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() - veh->getDeparture());
163 // vehicle is equipped with tripinfo device (not all vehicles are)
164 const bool hasTripinfo = veh->getDevice(typeid(MSDevice_Tripinfo)) != nullptr;
165 for (MSVehicleDevice* const dev : veh->getDevices()) {
166 dev->generateOutput(hasTripinfo ? tripinfoOut : nullptr);
167 }
168 if (tripinfoOut != nullptr && hasTripinfo) {
169 // close tag after tripinfo (possibly including emissions from another device) have been written
170 tripinfoOut->closeTag();
171 }
172 deleteVehicle(veh);
173 }
174 vehs.clear();
175 if (tripinfoOut != nullptr) {
176 // there seem to be people who think reading an unfinished xml is a good idea ;-)
177 tripinfoOut->flush();
178 }
179#ifdef HAVE_FOX
180 myPendingRemovals.unlock();
181#endif
182}
183
184
185void
191 if ((v.getVClass() & (SVC_PEDESTRIAN | SVC_NON_ROAD)) == 0) {
192 // only worry about deceleration of road users
194 } else if ((v.getVClass() & SVC_RAIL_CLASSES) != 0) {
196 }
197}
198
199
200void
201MSVehicleControl::setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime) {
202 myRunningVehNo = runningVehNo;
203 myLoadedVehNo = loadedVehNo;
204 myEndedVehNo = endedVehNo;
205 myTotalDepartureDelay = totalDepartureDelay;
206 myTotalTravelTime = totalTravelTime;
207}
208
209
210void
218 // save vehicle types
219 for (const auto& item : myVTypeDict) {
220 if (myReplaceableDefaultVTypes.count(item.first) == 0) {
221 item.second->getParameter().write(out);
222 }
223 }
224 for (const auto& item : myVTypeDistDict) {
226 out.writeAttr(SUMO_ATTR_VTYPES, item.second->getVals());
227 out.writeAttr(SUMO_ATTR_PROBS, item.second->getProbs());
228 out.closeTag();
229 }
230 for (const auto& item : myVehicleDict) {
231 item.second->saveState(out);
232 }
233}
234
235
236void
238 for (const auto& item : myVehicleDict) {
239 delete item.second;
240 }
241 myVehicleDict.clear();
242 // delete vehicle type distributions
243 for (const auto& item : myVTypeDistDict) {
244 delete item.second;
245 }
246 myVTypeDistDict.clear();
247 // delete vehicle types
248 for (const auto& item : myVTypeDict) {
249 delete item.second;
250 }
251 myVTypeDict.clear();
252 myPendingRemovals.clear(); // could be leftovers from MSVehicleTransfer::checkInsertions (teleport beyond arrival)
253 if (reinit) {
255 }
256 myLoadedVehNo = 0;
257 myRunningVehNo = 0;
258 myEndedVehNo = 0;
259 myDiscarded = 0;
260 myCollisions = 0;
262 myTeleportsJam = 0;
269}
270
271
272bool
273MSVehicleControl::addVehicle(const std::string& id, SUMOVehicle* v) {
274 VehicleDictType::iterator it = myVehicleDict.find(id);
275 if (it == myVehicleDict.end()) {
276 // id not in myVehicleDict.
277 myVehicleDict[id] = v;
278 const SUMOVehicleParameter& pars = v->getParameter();
280 const MSEdge* const firstEdge = v->getRoute().getEdges()[0];
282 // position will be checked against person position later
283 static_cast<MSVehicle*>(v)->setTentativeLaneAndPosition(nullptr, v->getParameter().departPos);
284 }
285 if (firstEdge->isTazConnector()) {
286 for (MSEdge* out : firstEdge->getSuccessors()) {
287 out->addWaiting(v);
288 }
289 } else {
290 firstEdge->addWaiting(v);
291 }
293 }
294 if (v->getVClass() != SVC_TAXI && pars.line != "" && pars.repetitionNumber < 0) {
295 myPTVehicles.push_back(v);
296 }
297 return true;
298 }
299 return false;
300}
301
302
304MSVehicleControl::getVehicle(const std::string& id) const {
305 VehicleDictType::const_iterator it = myVehicleDict.find(id);
306 if (it == myVehicleDict.end()) {
307 return nullptr;
308 }
309 return it->second;
310}
311
312
313void
315 myEndedVehNo++;
316 if (discard) {
317 myDiscarded++;
318 }
319 if (veh != nullptr) {
320 myVehicleDict.erase(veh->getID());
321 }
322 auto ptVehIt = std::find(myPTVehicles.begin(), myPTVehicles.end(), veh);
323 if (ptVehIt != myPTVehicles.end()) {
324 myPTVehicles.erase(ptVehIt);
325 }
326 delete veh;
327}
328
329
330bool
331MSVehicleControl::checkVType(const std::string& id) {
332 if (myReplaceableDefaultVTypes.erase(id) > 0) {
333 delete myVTypeDict[id];
334 myVTypeDict.erase(myVTypeDict.find(id));
335 } else {
336 if (myVTypeDict.find(id) != myVTypeDict.end() || myVTypeDistDict.find(id) != myVTypeDistDict.end()) {
337 return false;
338 }
339 }
340 return true;
341}
342
343
344bool
346 if (checkVType(vehType->getID())) {
347 myVTypeDict[vehType->getID()] = vehType;
348 return true;
349 }
350 return false;
351}
352
353
354void
356 assert(vehType != nullptr);
357 assert(myVTypeDict.find(vehType->getID()) != myVTypeDict.end());
358 myVTypeDict.erase(vehType->getID());
359 if (myVTypeToDist.find(vehType->getID()) != myVTypeToDist.end()) {
360 myVTypeToDist.erase(vehType->getID());
361 }
362 delete vehType;
363}
364
365
366bool
368 if (checkVType(id)) {
369 myVTypeDistDict[id] = vehTypeDistribution;
370 std::vector<MSVehicleType*> vehTypes = vehTypeDistribution->getVals();
371 for (auto vehType : vehTypes) {
372 if (myVTypeToDist.find(vehType->getID()) != myVTypeToDist.end()) {
373 myVTypeToDist[vehType->getID()].insert(id);
374 } else {
375 myVTypeToDist[vehType->getID()] = { id };
376 }
377 }
378 return true;
379 }
380 return false;
381}
382
383
384bool
385MSVehicleControl::hasVType(const std::string& id) const {
386 return myVTypeDict.count(id) > 0 || myVTypeDistDict.count(id) > 0;
387}
388
389
390bool
391MSVehicleControl::hasVTypeDistribution(const std::string& id) const {
392 return myVTypeDistDict.count(id) > 0;
393}
394
395
397MSVehicleControl::getVType(const std::string& id, SumoRNG* rng, bool readOnly) {
398 VTypeDictType::iterator it = myVTypeDict.find(id);
399 if (it == myVTypeDict.end()) {
400 VTypeDistDictType::iterator it2 = myVTypeDistDict.find(id);
401 if (it2 == myVTypeDistDict.end()) {
402 return nullptr;
403 }
404 return it2->second->get(rng);
405 }
406 if (!readOnly && myReplaceableDefaultVTypes.erase(id) > 0) {
407 it->second->check();
408 }
409 return it->second;
410}
411
412
413void
414MSVehicleControl::insertVTypeIDs(std::vector<std::string>& into) const {
415 into.reserve(into.size() + myVTypeDict.size() + myVTypeDistDict.size());
416 for (VTypeDictType::const_iterator i = myVTypeDict.begin(); i != myVTypeDict.end(); ++i) {
417 into.push_back((*i).first);
418 }
419 for (VTypeDistDictType::const_iterator i = myVTypeDistDict.begin(); i != myVTypeDistDict.end(); ++i) {
420 into.push_back((*i).first);
421 }
422}
423
424
425const std::set<std::string>
427 std::map<std::string, std::set<std::string>>::const_iterator it = myVTypeToDist.find(id);
428 if (it == myVTypeToDist.end()) {
429 return std::set<std::string>();
430 }
431 return it->second;
432}
433
434
436MSVehicleControl::getVTypeDistribution(const std::string& typeDistID) const {
437 auto it = myVTypeDistDict.find(typeDistID);
438 if (it != myVTypeDistDict.end()) {
439 return it->second;
440 } else {
441 return nullptr;
442 }
443}
444
445
446void
448 for (VehicleDictType::iterator i = myVehicleDict.begin(); i != myVehicleDict.end(); ++i) {
449 WRITE_WARNINGF(TL("Vehicle '%' aborted waiting for a % that will never come."), i->first,
450 i->second->getParameter().departProcedure == DepartDefinition::SPLIT ? "split" : "person or container")
451 }
452}
453
454
455int
457 int result = 0;
458 for (MSVehicleControl::constVehIt it = loadedVehBegin(); it != loadedVehEnd(); ++it) {
459 const SUMOVehicle* veh = it->second;
460 if ((veh->isOnRoad() || veh->isRemoteControlled()) && veh->getSpeed() < SUMO_const_haltingSpeed) {
461 result++;
462 }
463 }
464 return result;
465}
466
467
468std::pair<double, double>
470 double speedSum = 0;
471 double relSpeedSum = 0;
472 int count = 0;
473 for (MSVehicleControl::constVehIt it = loadedVehBegin(); it != loadedVehEnd(); ++it) {
474 const SUMOVehicle* veh = it->second;
475 if ((veh->isOnRoad() || veh->isRemoteControlled()) && !veh->isStopped()) {
476 count++;
477 speedSum += veh->getSpeed();
478 relSpeedSum += veh->getEdge()->getSpeedLimit() > 0 ? veh->getSpeed() / veh->getEdge()->getSpeedLimit() : 0;
479 }
480 }
481 if (count > 0) {
482 return std::make_pair(speedSum / count, relSpeedSum / count);
483 } else {
484 return std::make_pair(-1, -1);
485 }
486}
487
488
489int
490MSVehicleControl::getQuota(double frac, int loaded) const {
491 frac = frac < 0 ? myScale : frac;
492 const int origLoaded = (loaded < 1
493 // the vehicle in question has already been loaded, hence the '-1'
494 ? frac > 1. ? (int)(myLoadedVehNo / frac) : myLoadedVehNo - 1
495 // given transportable number reflects only previously loaded
496 : frac > 1. ? (int)(loaded / frac) : loaded);
497 return getScalingQuota(frac, origLoaded);
498}
499
500
501int
504}
505
506
507void
509 for (const SUMOVehicle* const veh : myPTVehicles) {
510 // add single vehicles with line attribute which are not part of a flow
511 ConstMSRoutePtr const route = MSRoute::dictionary(veh->getParameter().routeid);
512 router.getNetwork()->addSchedule(veh->getParameter(), route == nullptr ? nullptr : &route->getStops());
513 }
514}
515
516/****************************************************************************/
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:268
#define TL(string)
Definition: MsgHandler.h:284
std::shared_ptr< const MSRoute > ConstMSRoutePtr
Definition: Route.h:32
#define STEPS2TIME(x)
Definition: SUMOTime.h:54
#define STEPFLOOR(x)
Definition: SUMOTime.h:57
const long long int VTYPEPARS_VEHICLECLASS_SET
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_RAIL_CLASSES
classes which drive on tracks
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_NON_ROAD
classes which (normally) do not drive on normal roads
@ SVC_TAXI
vehicle is a taxi
@ SVC_PEDESTRIAN
pedestrian
const std::string DEFAULT_TAXITYPE_ID
const std::string DEFAULT_RAILTYPE_ID
const std::string DEFAULT_PEDTYPE_ID
const std::set< std::string > DEFAULT_VTYPES
const std::string DEFAULT_VTYPE_ID
const std::string DEFAULT_CONTAINERTYPE_ID
const std::string DEFAULT_BIKETYPE_ID
@ SPLIT
The departure is triggered by a train split.
@ CONTAINER_TRIGGERED
The departure is container triggered.
@ TRIGGERED
The departure is person triggered.
@ SUMO_TAG_DELAY
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_ATTR_NUMBER
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_PROBS
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ID
@ SUMO_ATTR_TIME
trigger: the time of the step
int getScalingQuota(double frac, int loaded)
Returns the number of instances of the current object that shall be emitted given the number of loade...
Definition: StdDefs.cpp:59
T MIN2(T a, T b)
Definition: StdDefs.h:76
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:58
T MAX2(T a, T b)
Definition: StdDefs.h:82
void addSchedule(const SUMOVehicleParameter &pars, const std::vector< SUMOVehicleParameter::Stop > *addStops=nullptr)
Network * getNetwork() const
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:55
virtual void initDevices()
void addStops(const bool ignoreStopErrors, MSRouteIterator *searchStart=nullptr, bool addRouteStops=true)
Adds stops to the built vehicle.
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:264
A device which collects info on the vehicle trip (mainly on departure and arrival)
A road/street connecting two junctions.
Definition: MSEdge.h:77
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
Definition: MSEdge.cpp:1056
bool isTazConnector() const
Definition: MSEdge.h:288
void addWaiting(SUMOVehicle *vehicle) const
Adds a vehicle to the list of waiting vehicles.
Definition: MSEdge.cpp:1334
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition: MSEdge.cpp:1156
static bool gUseMesoSim
Definition: MSGlobals.h:103
@ BUILT
The vehicle was built, but has not yet departed.
@ ARRIVED
The vehicle arrived at his destination (is deleted)
@ DEPARTED
The vehicle has departed (was inserted into the network)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:183
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:1244
static SumoRNG * getParsingRNG()
get parsing RNG
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:124
static bool dictionary(const std::string &id, ConstMSRoutePtr route)
Adds a route to the dictionary.
Definition: MSRoute.cpp:109
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, ConstMSRoutePtr route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true, bool addRouteStops=true)
Builds a vehicle, increases the number of built vehicles.
int myTeleportsCollision
The number of teleports due to collision.
double myScale
The scaling factor (especially for inc-dua)
bool hasVType(const std::string &id) const
Asks for existence of a vehicle type.
bool addVType(MSVehicleType *vehType)
Adds a vehicle type.
void initVehicle(MSBaseVehicle *built, const bool ignoreStopErrors, bool addRouteStops)
void setState(int runningVehNo, int loadedVehNo, int endedVehNo, double totalDepartureDelay, double totalTravelTime)
Sets the current state variables as loaded from the stream.
void removePending()
Removes a vehicle after it has ended.
std::set< std::string > myReplaceableDefaultVTypes
the default vehicle types which may still be replaced
void adaptIntermodalRouter(MSNet::MSIntermodalRouter &router) const
std::vector< SUMOVehicle * > myPendingRemovals
List of vehicles which are going to be removed.
int myLoadedVehNo
The number of build vehicles.
bool hasVTypeDistribution(const std::string &id) const
Asks for a vehicle type distribution.
void vehicleDeparted(const SUMOVehicle &v)
Informs this control about a vehicle's departure.
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
void initDefaultTypes()
create default types
int myTeleportsYield
The number of teleports due to vehicles stuck on a minor road.
int myTeleportsWrongLane
The number of teleports due to vehicles stuck on the wrong lane.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
void clearState(const bool reinit)
Remove all vehicles before quick-loading state.
std::map< std::string, std::set< std::string > > myVTypeToDist
Inverse lookup from vehicle type to distributions it is a member of.
double myMinDeceleration
The minimum deceleration capability for all road vehicles in the network.
bool isPendingRemoval(SUMOVehicle *veh)
whether the given vehicle is scheduled for removal
double myMinDecelerationRail
The minimum deceleration capability for all rail vehicles in the network.
virtual ~MSVehicleControl()
Destructor.
void removeVType(const MSVehicleType *vehType)
int myStoppedVehicles
The number of stopped vehicles.
void registerOneWaiting()
increases the count of vehicles waiting for a transport to allow recognition of person / container re...
virtual std::pair< double, double > getVehicleMeanSpeeds() const
get current absolute and relative mean vehicle speed in the network
bool checkVType(const std::string &id)
Checks whether the vehicle type (distribution) may be added.
int myCollisions
The number of collisions.
int myEmergencyStops
The number of emergency stops.
int getQuota(double frac=-1, int loaded=-1) const
Returns the number of instances of the current vehicle that shall be emitted considering that "frac" ...
MSVehicleControl()
Constructor.
double myMaxSpeedFactor
The maximum speed factor for all vehicles in the network.
int myDiscarded
The number of vehicles which were discarded while loading.
int myEndedVehNo
The number of removed vehicles.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, SumoRNG *rng=nullptr, bool readOnly=false)
Returns the named vehicle type or a sample from the named distribution.
bool addVTypeDistribution(const std::string &id, RandomDistributor< MSVehicleType * > *vehTypeDistribution)
Adds a vehicle type distribution.
int myTeleportsJam
The number of teleports due to jam.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
void insertVTypeIDs(std::vector< std::string > &into) const
Inserts ids of all known vehicle types and vehicle type distributions to the given vector.
double myTotalDepartureDelay
The aggregated time vehicles had to wait for departure (in seconds)
VTypeDictType myVTypeDict
Dictionary of vehicle types.
const RandomDistributor< MSVehicleType * > * getVTypeDistribution(const std::string &typeDistID) const
return the vehicle type distribution with the given id
virtual int getHaltingVehicleNo() const
Returns the number of halting vehicles.
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
double myTotalTravelTime
The aggregated time vehicles needed to aacomplish their route (in seconds)
std::vector< SUMOVehicle * > myPTVehicles
List of vehicles which belong to public transport.
int getTeleportCount() const
return the number of teleports (including collisions)
VTypeDistDictType myVTypeDistDict
A distribution of vehicle types (probability->vehicle type)
void abortWaiting()
informes about all waiting vehicles (deletion in destructor)
void saveState(OutputDevice &out)
Saves the current state into the given stream.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
const std::set< std::string > getVTypeDistributionMembership(const std::string &id) const
Return the distribution IDs the vehicle type is a member of.
int myRunningVehNo
The number of vehicles within the network (build and inserted but not removed)
VehicleDictType myVehicleDict
Dictionary of vehicles.
Abstract in-vehicle device.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
The car-following model and parameter.
Definition: MSVehicleType.h:63
static MSVehicleType * build(SUMOVTypeParameter &from)
Builds the microsim vehicle type described by the given parameter.
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:91
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
double computeChosenSpeedDeviation(SumoRNG *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
const std::string & getID() const
Returns the id.
Definition: Named.h:74
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:59
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:254
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
const std::vector< T > & getVals() const
Returns the members of the distribution.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual double getChosenSpeedFactor() const =0
virtual double getSpeed() const =0
Returns the object's current speed.
virtual bool isStopped() const =0
Returns whether the object is at a stop.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
virtual const MSEdge * getEdge() const =0
Returns the edge the object is currently at.
Structure representing possible vehicle parameter.
double width
This class' width.
double height
This class' height.
double length
The physical vehicle length.
long long int parametersSet
Information for the router which parameter were set.
Representation of a vehicle.
Definition: SUMOVehicle.h:62
virtual SUMOTime getDeparture() const =0
Returns this vehicle's real departure time.
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
virtual bool isRemoteControlled() const =0
Returns the information whether the vehicle is fully controlled via TraCI.
virtual const MSRoute & getRoute() const =0
Returns the current route.
Structure representing possible vehicle parameter.
double departPos
(optional) The position the vehicle shall depart from
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
std::string line
The vehicle's line (mainly for public transport)
Function-object for stable sorting of objects with numerical ids.
Definition: Named.h:39