SUMO - Simulation of Urban MObility
TraCI_Vehicle.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // C++ Vehicle API
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2012-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 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <utils/geom/GeomHelper.h>
39 #include <microsim/MSVehicle.h>
41 #include <microsim/MSVehicleType.h>
42 #include <microsim/MSNet.h>
43 #include <microsim/MSEdge.h>
44 #include <microsim/MSLane.h>
45 #include <traci-server/TraCIDefs.h>
47 #include "TraCI.h"
48 #include "TraCI_Vehicle.h"
49 
50 
51 // ===========================================================================
52 // member definitions
53 // ===========================================================================
54 
55 MSVehicle*
56 TraCI_Vehicle::getVehicle(const std::string& id) {
58  if (sumoVehicle == 0) {
59  throw TraCIException("Vehicle '" + id + "' is not known");
60  }
61  MSVehicle* v = dynamic_cast<MSVehicle*>(sumoVehicle);
62  if (v == 0) {
63  throw TraCIException("Vehicle '" + id + "' is not a micro-simulation vehicle");
64  }
65  return v;
66 }
67 
68 
69 bool
71  return veh->isOnRoad() || veh->isParking() || veh->wasRemoteControlled();
72 }
73 
74 
75 bool
76 TraCI_Vehicle::onInit(const std::string& vehicleID) {
77  SUMOVehicle* sumoVehicle = MSNet::getInstance()->getVehicleControl().getVehicle(vehicleID);
78  return sumoVehicle == 0 || sumoVehicle->getLane() == 0;
79 }
80 
81 std::vector<std::string>
83  std::vector<std::string> ids;
85  for (MSVehicleControl::constVehIt i = c.loadedVehBegin(); i != c.loadedVehEnd(); ++i) {
86  if ((*i).second->isOnRoad() || (*i).second->isParking()) {
87  ids.push_back((*i).first);
88  }
89  }
90  return ids;
91 }
92 
93 int
95  return (int)getIDList().size();
96 }
97 
98 double
99 TraCI_Vehicle::getSpeed(const std::string& vehicleID) {
100  MSVehicle* veh = getVehicle(vehicleID);
101  return isVisible(veh) ? veh->getSpeed() : INVALID_DOUBLE_VALUE;
102 }
103 
104 
105 double
106 TraCI_Vehicle::getSpeedWithoutTraCI(const std::string& vehicleID) {
107  MSVehicle* veh = getVehicle(vehicleID);
109 }
110 
111 
113 TraCI_Vehicle::getPosition(const std::string& vehicleID) {
114  MSVehicle* veh = getVehicle(vehicleID);
115  if (isVisible(veh)) {
116  return TraCI::makeTraCIPosition(veh->getPosition());
117  } else {
118  TraCIPosition result;
119  result.x = INVALID_DOUBLE_VALUE;
120  result.y = INVALID_DOUBLE_VALUE;
121  result.z = INVALID_DOUBLE_VALUE;
122  return result;
123  }
124 }
125 
126 
127 double
128 TraCI_Vehicle::getAngle(const std::string& vehicleID) {
129  MSVehicle* veh = getVehicle(vehicleID);
131 }
132 
133 
134 double
135 TraCI_Vehicle::getSlope(const std::string& vehicleID) {
136  MSVehicle* veh = getVehicle(vehicleID);
137  return veh->isOnRoad() ? veh->getSlope() : INVALID_DOUBLE_VALUE;
138 }
139 
140 
141 std::string
142 TraCI_Vehicle::getRoadID(const std::string& vehicleID) {
143  MSVehicle* veh = getVehicle(vehicleID);
144  return isVisible(veh) ? veh->getLane()->getEdge().getID() : "";
145 }
146 
147 
148 std::string
149 TraCI_Vehicle::getLaneID(const std::string& vehicleID) {
150  MSVehicle* veh = getVehicle(vehicleID);
151  return veh->isOnRoad() ? veh->getLane()->getID() : "";
152 }
153 
154 
155 int
156 TraCI_Vehicle::getLaneIndex(const std::string& vehicleID) {
157  MSVehicle* veh = getVehicle(vehicleID);
158  return veh->isOnRoad() ? veh->getLane()->getIndex() : INVALID_INT_VALUE;
159 }
160 
161 std::string
162 TraCI_Vehicle::getTypeID(const std::string& vehicleID) {
163  return getVehicle(vehicleID)->getVehicleType().getID();
164 }
165 
166 std::string
167 TraCI_Vehicle::getRouteID(const std::string& vehicleID) {
168  return getVehicle(vehicleID)->getRoute().getID();
169 }
170 
171 int
172 TraCI_Vehicle::getRouteIndex(const std::string& vehicleID) {
173  MSVehicle* veh = getVehicle(vehicleID);
174  return veh->hasDeparted() ? veh->getRoutePosition() : INVALID_INT_VALUE;
175 }
176 
178 TraCI_Vehicle::getColor(const std::string& vehicleID) {
179  return TraCI::makeTraCIColor(getVehicle(vehicleID)->getParameter().color);
180 }
181 
182 double
183 TraCI_Vehicle::getLanePosition(const std::string& vehicleID) {
184  MSVehicle* veh = getVehicle(vehicleID);
185  return veh->isOnRoad() ? veh->getPositionOnLane() : INVALID_DOUBLE_VALUE;
186 }
187 
188 double
189 TraCI_Vehicle::getLateralLanePosition(const std::string& vehicleID) {
190  MSVehicle* veh = getVehicle(vehicleID);
191  return veh->isOnRoad() ? veh->getLateralPositionOnLane() : INVALID_DOUBLE_VALUE;
192 }
193 
194 double
195 TraCI_Vehicle::getCO2Emission(const std::string& vehicleID) {
196  MSVehicle* veh = getVehicle(vehicleID);
197  return isVisible(veh) ? veh->getCO2Emissions() : INVALID_DOUBLE_VALUE;
198 }
199 
200 double
201 TraCI_Vehicle::getCOEmission(const std::string& vehicleID) {
202  MSVehicle* veh = getVehicle(vehicleID);
203  return isVisible(veh) ? veh->getCOEmissions() : INVALID_DOUBLE_VALUE;
204 }
205 
206 double
207 TraCI_Vehicle::getHCEmission(const std::string& vehicleID) {
208  MSVehicle* veh = getVehicle(vehicleID);
209  return isVisible(veh) ? veh->getHCEmissions() : INVALID_DOUBLE_VALUE;
210 }
211 
212 double
213 TraCI_Vehicle::getPMxEmission(const std::string& vehicleID) {
214  MSVehicle* veh = getVehicle(vehicleID);
215  return isVisible(veh) ? veh->getPMxEmissions() : INVALID_DOUBLE_VALUE;
216 }
217 
218 double
219 TraCI_Vehicle::getNOxEmission(const std::string& vehicleID) {
220  MSVehicle* veh = getVehicle(vehicleID);
221  return isVisible(veh) ? veh->getNOxEmissions() : INVALID_DOUBLE_VALUE;
222 }
223 
224 double
225 TraCI_Vehicle::getFuelConsumption(const std::string& vehicleID) {
226  MSVehicle* veh = getVehicle(vehicleID);
227  return isVisible(veh) ? veh->getFuelConsumption() : INVALID_DOUBLE_VALUE;
228 }
229 
230 double
231 TraCI_Vehicle::getNoiseEmission(const std::string& vehicleID) {
232  MSVehicle* veh = getVehicle(vehicleID);
234 }
235 
236 double
237 TraCI_Vehicle::getElectricityConsumption(const std::string& vehicleID) {
238  MSVehicle* veh = getVehicle(vehicleID);
240 }
241 
242 int
243 TraCI_Vehicle::getPersonNumber(const std::string& vehicleID) {
244  return getVehicle(vehicleID)->getPersonNumber();
245 }
246 
247 
248 std::pair<std::string, double>
249 TraCI_Vehicle::getLeader(const std::string& vehicleID, double dist) {
250  MSVehicle* veh = getVehicle(vehicleID);
251  if (veh->isOnRoad()) {
252  std::pair<const MSVehicle* const, double> leaderInfo = veh->getLeader(dist);
253  return std::make_pair(
254  leaderInfo.first != 0 ? leaderInfo.first->getID() : "",
255  leaderInfo.second);
256  } else {
257  return std::make_pair("", -1);
258  }
259 }
260 
261 
262 double
263 TraCI_Vehicle::getWaitingTime(const std::string& vehicleID) {
264  return getVehicle(vehicleID)->getWaitingSeconds();
265 }
266 
267 
268 double
269 TraCI_Vehicle::getAccumulatedWaitingTime(const std::string& vehicleID) {
270  return getVehicle(vehicleID)->getAccumulatedWaitingSeconds();
271 }
272 
273 
274 double
275 TraCI_Vehicle::getAdaptedTraveltime(const std::string& vehicleID, const std::string& edgeID, int time) {
276  MSVehicle* veh = getVehicle(vehicleID);
277  MSEdge* edge = TraCI::getEdge(edgeID);
278  double value = INVALID_DOUBLE_VALUE;;
279  veh->getWeightsStorage().retrieveExistingTravelTime(edge, time, value);
280  return value;
281 }
282 
283 
284 double
285 TraCI_Vehicle::getEffort(const std::string& vehicleID, const std::string& edgeID, int time) {
286  MSVehicle* veh = getVehicle(vehicleID);
287  MSEdge* edge = TraCI::getEdge(edgeID);
288  double value = INVALID_DOUBLE_VALUE;;
289  veh->getWeightsStorage().retrieveExistingEffort(edge, time, value);
290  return value;
291 }
292 
293 
294 bool
295 TraCI_Vehicle::isRouteValid(const std::string& vehicleID) {
296  std::string msg;
297  return getVehicle(vehicleID)->hasValidRoute(msg);
298 }
299 
300 std::vector<std::string>
301 TraCI_Vehicle::getEdges(const std::string& vehicleID) {
302  std::vector<std::string> result;
303  MSVehicle* veh = getVehicle(vehicleID);
304  const MSRoute& r = veh->getRoute();
305  for (MSRouteIterator i = r.begin(); i != r.end(); ++i) {
306  result.push_back((*i)->getID());
307  }
308  return result;
309 }
310 
311 
312 int
313 TraCI_Vehicle::getSignalStates(const std::string& vehicleID) {
314  return getVehicle(vehicleID)->getSignals();
315 }
316 
317 std::vector<TraCIBestLanesData>
318 TraCI_Vehicle::getBestLanes(const std::string& vehicleID) {
319  std::vector<TraCIBestLanesData> result;
320  MSVehicle* veh = getVehicle(vehicleID);
321  if (veh->isOnRoad()) {
322  const std::vector<MSVehicle::LaneQ>& bestLanes = veh->getBestLanes();
323  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
324  TraCIBestLanesData bld;
325  const MSVehicle::LaneQ& lq = *i;
326  bld.laneID = lq.lane->getID();
327  bld.length = lq.length;
328  bld.occupation = lq.nextOccupation;
331  for (std::vector<MSLane*>::const_iterator j = lq.bestContinuations.begin(); j != lq.bestContinuations.end(); ++j) {
332  if ((*j) != 0) {
333  bld.continuationLanes.push_back((*j)->getID());
334  }
335  }
336  result.push_back(bld);
337  }
338  }
339  return result;
340 }
341 
342 
343 std::vector<TraCINextTLSData>
344 TraCI_Vehicle::getNextTLS(const std::string& vehicleID) {
345  std::vector<TraCINextTLSData> result;
346  MSVehicle* veh = getVehicle(vehicleID);
347  if (veh->isOnRoad()) {
348  const MSLane* lane = veh->getLane();
349  const std::vector<MSLane*>& bestLaneConts = veh->getBestLanesContinuation(lane);
350  double seen = veh->getLane()->getLength() - veh->getPositionOnLane();
351  int view = 1;
352  MSLinkCont::const_iterator link = MSLane::succLinkSec(*veh, view, *lane, bestLaneConts);
353  while (!lane->isLinkEnd(link)) {
354  if (!lane->getEdge().isInternal()) {
355  if ((*link)->isTLSControlled()) {
356  TraCINextTLSData ntd;
357  ntd.id = (*link)->getTLLogic()->getID();
358  ntd.tlIndex = (*link)->getTLIndex();
359  ntd.dist = seen;
360  ntd.state = (char)(*link)->getState();
361  result.push_back(ntd);
362  }
363  }
364  lane = (*link)->getViaLaneOrLane();
365  if (!lane->getEdge().isInternal()) {
366  view++;
367  }
368  seen += lane->getLength();
369  link = MSLane::succLinkSec(*veh, view, *lane, bestLaneConts);
370  }
371  }
372  return result;
373 }
374 
375 int
376 TraCI_Vehicle::getStopState(const std::string& vehicleID) {
377  MSVehicle* veh = getVehicle(vehicleID);
378  int result = 0;
379  if (veh->isStopped()) {
380  const MSVehicle::Stop& stop = veh->getNextStop();
381  result = (1 + (stop.parking ? 2 : 0) +
382  (stop.triggered ? 4 : 0) +
383  (stop.containerTriggered ? 8 : 0) +
384  (stop.busstop != 0 ? 16 : 0) +
385  (stop.containerstop != 0 ? 32 : 0) +
386  (stop.chargingStation != 0 ? 64 : 0) +
387  (stop.parkingarea != 0 ? 128 : 0));
388  }
389  return result;
390 }
391 
392 double
393 TraCI_Vehicle::getDistance(const std::string& vehicleID) {
394  MSVehicle* veh = getVehicle(vehicleID);
395  if (veh->isOnRoad()) {
396  double distance = veh->getRoute().getDistanceBetween(veh->getDepartPos(), veh->getPositionOnLane(), veh->getRoute().getEdges()[0], &veh->getLane()->getEdge());
397  if (distance == std::numeric_limits<double>::max()) {
398  return INVALID_DOUBLE_VALUE;
399  } else {
400  return distance;
401  }
402  } else {
403  return INVALID_DOUBLE_VALUE;
404  }
405 }
406 
407 
408 double
409 TraCI_Vehicle::getDrivingDistance(const std::string& vehicleID, const std::string& edgeID, double position, int /* laneIndex */) {
410  MSVehicle* veh = getVehicle(vehicleID);
411  if (veh->isOnRoad()) {
412  double distance = veh->getRoute().getDistanceBetween(veh->getPositionOnLane(), position,
413  veh->getEdge(), TraCI::getEdge(edgeID));
414  if (distance == std::numeric_limits<double>::max()) {
415  return INVALID_DOUBLE_VALUE;
416  }
417  return distance;
418  } else {
419  return INVALID_DOUBLE_VALUE;
420  }
421 }
422 
423 
424 double
425 TraCI_Vehicle::getDrivingDistance2D(const std::string& vehicleID, double x, double y) {
426  MSVehicle* veh = getVehicle(vehicleID);
427  if (veh->isOnRoad()) {
428  std::pair<MSLane*, double> roadPos = TraCI::convertCartesianToRoadMap(Position(x, y));
429  double distance = veh->getRoute().getDistanceBetween(veh->getPositionOnLane(), roadPos.second,
430  veh->getEdge(), &roadPos.first->getEdge());
431  if (distance == std::numeric_limits<double>::max()) {
432  return INVALID_DOUBLE_VALUE;
433  }
434  return distance;
435  } else {
436  return INVALID_DOUBLE_VALUE;
437  }
438 }
439 
440 
441 
442 double
443 TraCI_Vehicle::getAllowedSpeed(const std::string& vehicleID) {
444  MSVehicle* veh = getVehicle(vehicleID);
445  if (veh->isOnRoad()) {
446  return veh->getLane()->getVehicleMaxSpeed(veh);
447  } else {
448  return INVALID_DOUBLE_VALUE;
449  }
450 }
451 
452 double
453 TraCI_Vehicle::getSpeedFactor(const std::string& vehicleID) {
454  return getVehicle(vehicleID)->getChosenSpeedFactor();
455 }
456 
457 
458 int
459 TraCI_Vehicle::getSpeedMode(const std::string& vehicleID) {
460  return getVehicle(vehicleID)->getInfluencer().getSpeedMode();
461 }
462 
463 int
464 TraCI_Vehicle::getLanechangeMode(const std::string& vehicleID) {
465  return getVehicle(vehicleID)->getInfluencer().getLanechangeMode();
466 }
467 
468 int
469 TraCI_Vehicle::getRoutingMode(const std::string& vehicleID) {
470  return getVehicle(vehicleID)->getInfluencer().getRoutingMode();
471 }
472 
473 std::string
474 TraCI_Vehicle::getLine(const std::string& vehicleID) {
475  return getVehicle(vehicleID)->getParameter().line;
476 }
477 
478 std::vector<std::string>
479 TraCI_Vehicle::getVia(const std::string& vehicleID) {
480  return getVehicle(vehicleID)->getParameter().via;
481 }
482 
483 
484 std::pair<int, int>
485 TraCI_Vehicle::getLaneChangeState(const std::string& vehicleID, int direction) {
486  MSVehicle* veh = getVehicle(vehicleID);
487  if (veh->isOnRoad()) {
488  return veh->getLaneChangeModel().getSavedState(direction);
489  } else {
490  return std::make_pair((int)LCA_UNKNOWN, (int)LCA_UNKNOWN);
491  }
492 }
493 
494 
495 std::string
496 TraCI_Vehicle::getParameter(const std::string& vehicleID, const std::string& key) {
497  MSVehicle* veh = getVehicle(vehicleID);
498  if (StringUtils::startsWith(key, "device.")) {
499  StringTokenizer tok(key, ".");
500  if (tok.size() < 3) {
501  throw TraCIException("Invalid device parameter '" + key + "' for vehicle '" + vehicleID + "'");
502  }
503  try {
504  return veh->getDeviceParameter(tok.get(1), key.substr(tok.get(0).size() + tok.get(1).size() + 2));
505  } catch (InvalidArgument& e) {
506  throw TraCIException("Vehicle '" + vehicleID + "' does not support device parameter '" + key + "' (" + e.what() + ").");
507  }
508  } else if (StringUtils::startsWith(key, "laneChangeModel.")) {
509  const std::string attrName = key.substr(16);
510  try {
511  return veh->getLaneChangeModel().getParameter(attrName);
512  } catch (InvalidArgument& e) {
513  throw TraCIException("Vehicle '" + vehicleID + "' does not support laneChangeModel parameter '" + key + "' (" + e.what() + ").");
514  }
515  } else if (StringUtils::startsWith(key, "has.") && StringUtils::endsWith(key, ".device")) {
516  StringTokenizer tok(key, ".");
517  if (tok.size() != 3) {
518  throw TraCIException("Invalid check for device. Expected format is 'has.DEVICENAME.device'");
519  }
520  return veh->hasDevice(tok.get(1)) ? "true" : "false";
521  } else {
522  return veh->getParameter().getParameter(key, "");
523  }
524 }
525 
526 
527 const MSVehicleType&
528 TraCI_Vehicle::getVehicleType(const std::string& vehicleID) {
529  return getVehicle(vehicleID)->getVehicleType();
530 }
531 
532 
533 std::string
534 TraCI_Vehicle::getEmissionClass(const std::string& vehicleID) {
536 }
537 
538 std::string
539 TraCI_Vehicle::getShapeClass(const std::string& vehicleID) {
540  return getVehicleShapeName(getVehicleType(vehicleID).getGuiShape());
541 }
542 
543 
544 double
545 TraCI_Vehicle::getLength(const std::string& vehicleID) {
546  return getVehicleType(vehicleID).getLength();
547 }
548 
549 
550 double
551 TraCI_Vehicle::getAccel(const std::string& vehicleID) {
552  return getVehicleType(vehicleID).getLength();
553 }
554 
555 
556 double
557 TraCI_Vehicle::getDecel(const std::string& vehicleID) {
558  return getVehicleType(vehicleID).getCarFollowModel().getMaxDecel();
559 }
560 
561 
562 double
563 TraCI_Vehicle::getTau(const std::string& vehicleID) {
564  return getVehicleType(vehicleID).getCarFollowModel().getHeadwayTime();
565 }
566 
567 
568 double
569 TraCI_Vehicle::getImperfection(const std::string& vehicleID) {
570  return getVehicleType(vehicleID).getCarFollowModel().getImperfection();
571 }
572 
573 
574 double
575 TraCI_Vehicle::getSpeedDeviation(const std::string& vehicleID) {
576  return getVehicleType(vehicleID).getSpeedFactor().getParameter()[1];
577 }
578 
579 
580 std::string
581 TraCI_Vehicle::getVClass(const std::string& vehicleID) {
582  return toString(getVehicleType(vehicleID).getVehicleClass());
583 }
584 
585 
586 double
587 TraCI_Vehicle::getMinGap(const std::string& vehicleID) {
588  return getVehicleType(vehicleID).getMinGap();
589 }
590 
591 
592 double
593 TraCI_Vehicle::getMaxSpeed(const std::string& vehicleID) {
594  return getVehicleType(vehicleID).getMaxSpeed();
595 }
596 
597 
598 double
599 TraCI_Vehicle::getWidth(const std::string& vehicleID) {
600  return getVehicleType(vehicleID).getWidth();
601 }
602 
603 
604 void
605 TraCI_Vehicle::setStop(const std::string& vehicleID,
606  const std::string& edgeID,
607  double endPos,
608  int laneIndex,
609  SUMOTime duration,
610  int flags,
611  double startPos,
612  SUMOTime until) {
613  MSVehicle* veh = getVehicle(vehicleID);
614  // optional stop flags
615  bool parking = false;
616  bool triggered = false;
617  bool containerTriggered = false;
618  SumoXMLTag stoppingPlaceType = SUMO_TAG_NOTHING;
619 
620  parking = ((flags & 1) != 0);
621  triggered = ((flags & 2) != 0);
622  containerTriggered = ((flags & 4) != 0);
623  if ((flags & 8) != 0) {
624  stoppingPlaceType = SUMO_TAG_BUS_STOP;
625  }
626  if ((flags & 16) != 0) {
627  stoppingPlaceType = SUMO_TAG_BUS_STOP;
628  }
629  if ((flags & 32) != 0) {
630  stoppingPlaceType = SUMO_TAG_CHARGING_STATION;
631  }
632  if ((flags & 64) != 0) {
633  stoppingPlaceType = SUMO_TAG_PARKING_AREA;
634  }
635 
636  std::string error;
637  if (stoppingPlaceType != SUMO_TAG_NOTHING) {
638  // Forward command to vehicle
639  if (!veh->addTraciStopAtStoppingPlace(edgeID, duration, until, parking, triggered, containerTriggered, stoppingPlaceType, error)) {
640  throw TraCIException(error);
641  }
642  } else {
643  // check
644  if (startPos < 0) {
645  throw TraCIException("Position on lane must not be negative.");
646  }
647  if (endPos < startPos) {
648  throw TraCIException("End position on lane must be after start position.");
649  }
650  // get the actual lane that is referenced by laneIndex
651  MSEdge* road = MSEdge::dictionary(edgeID);
652  if (road == 0) {
653  throw TraCIException("Unable to retrieve road with given id.");
654  }
655  const std::vector<MSLane*>& allLanes = road->getLanes();
656  if ((laneIndex < 0) || laneIndex >= (int)(allLanes.size())) {
657  throw TraCIException("No lane with index '" + toString(laneIndex) + "' on road '" + edgeID + "'.");
658  }
659  // Forward command to vehicle
660  if (!veh->addTraciStop(allLanes[laneIndex], startPos, endPos, duration, until, parking, triggered, containerTriggered, error)) {
661  throw TraCIException(error);
662  }
663  }
664 }
665 
666 
667 void
668 TraCI_Vehicle::resume(const std::string& vehicleID) {
669  MSVehicle* veh = getVehicle(vehicleID);
670  if (!veh->hasStops()) {
671  throw TraCIException("Failed to resume vehicle '" + veh->getID() + "', it has no stops.");
672  }
673  if (!veh->resumeFromStopping()) {
674  MSVehicle::Stop& sto = veh->getNextStop();
675  std::ostringstream strs;
676  strs << "reached: " << sto.reached;
677  strs << ", duration:" << sto.duration;
678  strs << ", edge:" << (*sto.edge)->getID();
679  strs << ", startPos: " << sto.startPos;
680  std::string posStr = strs.str();
681  throw TraCIException("Failed to resume from stoppingfor vehicle '" + veh->getID() + "', " + posStr);
682  }
683 }
684 
685 
686 void
687 TraCI_Vehicle::changeLane(const std::string& vehID, int laneIndex, SUMOTime duration) {
688  std::vector<std::pair<SUMOTime, int> > laneTimeLine;
689  laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
690  laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + duration, laneIndex));
691  getVehicle(vehID)->getInfluencer().setLaneTimeLine(laneTimeLine);
692 }
693 
694 
695 void
696 TraCI_Vehicle::add(const std::string& vehicleID,
697  const std::string& routeID,
698  const std::string& typeID,
699  std::string depart,
700  const std::string& departLane,
701  const std::string& departPos,
702  const std::string& departSpeed,
703  const std::string& arrivalLane,
704  const std::string& arrivalPos,
705  const std::string& arrivalSpeed,
706  const std::string& fromTaz,
707  const std::string& toTaz,
708  const std::string& line,
709  int personCapacity,
710  int personNumber) {
711  MSVehicle* veh = getVehicle(vehicleID);
712  if (veh != 0) {
713  throw TraCIException("The vehicle " + vehicleID + " to add already exists.");
714  }
715 }
716 
717 void
718 TraCI_Vehicle::moveTo(const std::string& vehicleID, const std::string& laneID, double position) {
719  getVehicle(vehicleID);
720 }
721 
722 void
723 TraCI_Vehicle::moveToXY(const std::string& vehicleID, const std::string& edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute) {
724  getVehicle(vehicleID);
725 }
726 
727 void
728 TraCI_Vehicle::slowDown(const std::string& vehicleID, double speed, int duration) {
729  getVehicle(vehicleID);
730 }
731 
732 void
733 TraCI_Vehicle::setSpeed(const std::string& vehicleID, double speed) {
734  getVehicle(vehicleID);
735 }
736 
737 void
738 TraCI_Vehicle::setMaxSpeed(const std::string& vehicleID, double speed) {
739  getVehicle(vehicleID)->getSingularType().setMaxSpeed(speed);
740 }
741 
742 void
743 TraCI_Vehicle::remove(const std::string& vehicleID, char reason) {
744  getVehicle(vehicleID);
745 }
746 
747 
748 void
749 TraCI_Vehicle::setColor(const std::string& vehicleID, const TraCIColor& col) {
750  const SUMOVehicleParameter& p = getVehicle(vehicleID)->getParameter();
751  p.color.set(col.r, col.g, col.b, col.a);
753 }
754 
755 
756 void
757 TraCI_Vehicle::setLine(const std::string& vehicleID, const std::string& line) {
758  getVehicle(vehicleID)->getParameter().line = line;
759 }
760 
761 void
762 TraCI_Vehicle::setVia(const std::string& vehicleID, const std::vector<std::string>& via) {
763  getVehicle(vehicleID);
764 }
765 
766 void
767 TraCI_Vehicle::setShapeClass(const std::string& vehicleID, const std::string& clazz) {
769 }
770 
771 void
772 TraCI_Vehicle::setEmissionClass(const std::string& vehicleID, const std::string& clazz) {
773  getVehicle(vehicleID);
774 }
775 
776 
777 void
778 TraCI_Vehicle::setParameter(const std::string& vehicleID, const std::string& key, const std::string& value) {
779  MSVehicle* veh = getVehicle(vehicleID);
780  if (StringUtils::startsWith(key, "device.")) {
781  StringTokenizer tok(key, ".");
782  if (tok.size() < 3) {
783  throw TraCIException("Invalid device parameter '" + key + "' for vehicle '" + vehicleID + "'");
784  }
785  try {
786  veh->setDeviceParameter(tok.get(1), key.substr(tok.get(0).size() + tok.get(1).size() + 2), value);
787  } catch (InvalidArgument& e) {
788  throw TraCIException("Vehicle '" + vehicleID + "' does not support device parameter '" + key + "' (" + e.what() + ").");
789  }
790  } else if (StringUtils::startsWith(key, "laneChangeModel.")) {
791  const std::string attrName = key.substr(16);
792  try {
793  veh->getLaneChangeModel().setParameter(attrName, value);
794  } catch (InvalidArgument& e) {
795  throw TraCIException("Vehicle '" + vehicleID + "' does not support laneChangeModel parameter '" + key + "' (" + e.what() + ").");
796  }
797  } else if (StringUtils::startsWith(key, "has.") && StringUtils::endsWith(key, ".device")) {
798  StringTokenizer tok(key, ".");
799  if (tok.size() != 3) {
800  throw TraCIException("Invalid request for device status change. Expected format is 'has.DEVICENAME.device'");
801  }
802  const std::string deviceName = tok.get(1);
803  bool create;
804  try {
805  create = TplConvert::_2bool(value.c_str());
806  } catch (BoolFormatException) {
807  throw TraCIException("Changing device status requires a 'true' or 'false'");
808  }
809  if (!create) {
810  throw TraCIException("Device removal is not supported for device of type '" + deviceName + "'");
811  }
812  try {
813  veh->createDevice(deviceName);
814  } catch (InvalidArgument& e) {
815  throw TraCIException("Cannot create vehicle device (" + std::string(e.what()) + ").");
816  }
817  } else {
818  ((SUMOVehicleParameter&) veh->getParameter()).addParameter(key, value);
819  }
820 }
821 
822 
823 /****************************************************************************/
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
double x
Definition: TraCIDefs.h:72
double getMinGap() const
Get the free space in front of vehicles of this class.
static double getMinGap(const std::string &vehicleID)
SumoXMLTag
Numbers representing SUMO-XML - element names.
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:582
RGBColor color
The vehicle&#39;s color, TraCI may change this.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
bool isLinkEnd(MSLinkCont::const_iterator &i) const
Definition: MSLane.cpp:1663
static double getLength(const std::string &vehicleID)
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
Definition: MSLane.cpp:1730
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
static int getPersonNumber(const std::string &vehicleID)
bool allowsContinuation
Whether this lane allows continuing the route.
Definition: TraCIDefs.h:205
static std::vector< TraCINextTLSData > getNextTLS(const std::string &vehicleID)
Stop & getNextStop()
Definition: MSVehicle.cpp:4217
static double getAccel(const std::string &vehicleID)
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
static TraCIColor getColor(const std::string &vehicleID)
bool resumeFromStopping()
Definition: MSVehicle.cpp:4170
void setDeviceParameter(const std::string &deviceName, const std::string &key, const std::string &value)
try to set the given parameter from any of the vehicles devices, raise InvalidArgument if no device p...
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:168
static bool _2bool(const E *const data)
converts a 0-terminated char-type array into the boolean value described by it
Definition: TplConvert.h:389
static std::string getLaneID(const std::string &vehicleID)
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
Definition: MSVehicle.h:725
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
void setShape(SUMOVehicleShape shape)
Set a new value for this type&#39;s shape.
int getLanechangeMode() const
return the current lane change mode
Definition: MSVehicle.cpp:290
static void setLine(const std::string &vehicleID, const std::string &line)
static double getAccumulatedWaitingTime(const std::string &vehicleID)
static double getPMxEmission(const std::string &vehicleID)
static TraCIColor makeTraCIColor(const RGBColor &color)
Definition: TraCI.cpp:128
double getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
static double getAllowedSpeed(const std::string &vehicleID)
std::vector< double > & getParameter()
Returns the parameters of this distribution.
static double getDistance(const std::string &vehicleID)
static MSEdge * getEdge(const std::string &edgeID)
Definition: TraCI.cpp:160
static void setColor(const std::string &vehicleID, const TraCIColor &col)
static double getNOxEmission(const std::string &vehicleID)
static std::vector< std::string > getVia(const std::string &vehicleID)
static double getWaitingTime(const std::string &vehicleID)
unsigned char g
Definition: TraCIDefs.h:79
double getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:3614
bool addTraciStopAtStoppingPlace(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string &errorMsg)
Definition: MSVehicle.cpp:4080
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:848
virtual double getHeadwayTime() const
Get the driver&#39;s desired headway [s].
Definition: MSCFModel.h:247
double getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:484
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:169
const std::pair< int, int > & getSavedState(const int dir) const
static bool isVisible(const MSVehicle *veh)
double getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
const MSRoute & getRoute() const
Returns the current route.
static void add(const std::string &vehicleID, const std::string &routeID, const std::string &typeID="DEFAULT_VEHTYPE", std::string depart="-1", const std::string &departLane="first", const std::string &departPos="base", const std::string &departSpeed="0", const std::string &arrivalLane="current", const std::string &arrivalPos="max", const std::string &arrivalSpeed="current", const std::string &fromTaz="", const std::string &toTaz="", const std::string &line="", int personCapacity=0, int personNumber=0)
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:806
double getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:3626
bool hasDeparted() const
Returns whether this vehicle has already departed.
unsigned char r
Definition: TraCIDefs.h:79
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn&#39;t already in the dictionary...
Definition: MSEdge.cpp:745
double getPositionOnLane() const
Get the vehicle&#39;s position along the lane.
Definition: MSVehicle.h:375
static std::string getEmissionClass(const std::string &vehicleID)
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:820
static void setParameter(const std::string &vehicleID, const std::string &key, const std::string &value)
static MSVehicle * getVehicle(const std::string &id)
double getAngle() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:605
static int getRouteIndex(const std::string &vehicleID)
static std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
void setMaxSpeed(const double &maxSpeed)
Set a new value for this type&#39;s maximum speed.
double nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:723
double length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:717
static std::string getRouteID(const std::string &vehicleID)
unsigned char a
Definition: TraCIDefs.h:79
static std::vector< std::string > getIDList()
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:888
static double getCO2Emission(const std::string &vehicleID)
static double getSpeedDeviation(const std::string &vehicleID)
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
static int getStopState(const std::string &vehicleID)
static double getSpeedWithoutTraCI(const std::string &vehicleID)
The car-following model and parameter.
Definition: MSVehicleType.h:73
bool triggered
whether an arriving person lets the vehicle continue
Definition: MSVehicle.h:842
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:3144
const MSCFModel & getCarFollowModel() const
Returns the vehicle type&#39;s car following model definition (const version)
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
static double getTau(const std::string &vehicleID)
MSChargingStation * chargingStation
(Optional) charging station if one is assigned to the stop
Definition: MSVehicle.h:832
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:4238
double getSlope() const
Returns the slope of the road at vehicle&#39;s position.
Definition: MSVehicle.cpp:795
double z
Definition: TraCIDefs.h:72
static std::string getLine(const std::string &vehicleID)
static TraCIPosition getPosition(const std::string &vehicleID)
std::string getDeviceParameter(const std::string &deviceName, const std::string &key) const
try to retrieve the given parameter from any of the vehicles devices, raise InvalidArgument if no dev...
const std::string & getID() const
Returns the id.
Definition: Named.h:66
A road/street connecting two junctions.
Definition: MSEdge.h:81
static double getAdaptedTraveltime(const std::string &vehicleID, const std::string &edgeID, int time)
double getElectricityConsumption() const
Returns electricity consumption of the current state.
Definition: MSVehicle.cpp:3650
static void slowDown(const std::string &vehicleID, double speed, int duration)
MSLane * lane
The described lane.
Definition: MSVehicle.h:715
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:187
The action has not been determined.
static void setMaxSpeed(const std::string &vehicleID, double speed)
#define max(a, b)
Definition: polyfonts.c:65
static double getWidth(const std::string &vehicleID)
static double getNoiseEmission(const std::string &vehicleID)
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static void setEmissionClass(const std::string &vehicleID, const std::string &clazz)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
void createDevice(const std::string &deviceName)
create device of the given type
static double getFuelConsumption(const std::string &vehicleID)
Representation of a vehicle.
Definition: SUMOVehicle.h:67
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
Definition: MSVehicle.h:828
static double getDrivingDistance2D(const std::string &vehicleID, double x, double y)
static bool isRouteValid(const std::string &vehicleID)
A 3D-position.
Definition: TraCIDefs.h:71
virtual double getImperfection() const
Get the driver&#39;s imperfection.
Definition: MSCFModel.h:239
double getMaxDecel() const
Get the vehicle type&#39;s maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:212
static double getElectricityConsumption(const std::string &vehicleID)
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:3502
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
virtual void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this laneChangeModel. Throw exception for unsupported key ...
void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
assigns new values
Definition: RGBColor.cpp:83
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:305
static int getRoutingMode(const std::string &vehicleID)
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:65
static double getAngle(const std::string &vehicleID)
static int getSignalStates(const std::string &vehicleID)
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:1240
int tlIndex
The tls index of the controlled link.
Definition: TraCIDefs.h:185
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:128
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:838
double getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:3638
static void remove(const std::string &vehicleID, char reason=REMOVE_VAPORIZED)
A structure representing the best lanes for continuing the current route starting at &#39;lane&#39;...
Definition: MSVehicle.h:713
static double getImperfection(const std::string &vehicleID)
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
int getRoutingMode() const
return the current routing mode
Definition: MSVehicle.h:1274
static void moveTo(const std::string &vehicleID, const std::string &laneID, double position)
static void setStop(const std::string &vehicleID, const std::string &edgeID, double endPos=1., int laneIndex=0, SUMOTime duration=4294967295u, int flags=STOP_DEFAULT, double startPos=INVALID_DOUBLE_VALUE, SUMOTime until=-1)
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
Definition: MSVehicle.h:830
int getIndex() const
Returns the lane&#39;s index.
Definition: MSLane.h:507
const int VEHPARS_COLOR_SET
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:230
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:581
bool isParking() const
Returns whether the vehicle is parking.
Definition: MSVehicle.cpp:1266
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:3156
int getRoutePosition() const
Definition: MSVehicle.cpp:707
double dist
The distance to the tls.
Definition: TraCIDefs.h:187
int getPersonNumber() const
Returns the number of persons.
Definition: MSVehicle.cpp:3734
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:727
double getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:3632
std::string line
The vehicle&#39;s line (mainly for public transport)
#define INVALID_DOUBLE_VALUE
static double getHCEmission(const std::string &vehicleID)
static double getCOEmission(const std::string &vehicleID)
static int getIDCount()
static std::pair< MSLane *, double > convertCartesianToRoadMap(Position pos)
Definition: TraCI.cpp:185
std::string id
The id of the next tls.
Definition: TraCIDefs.h:183
std::vector< std::string > via
List of the via-edges the vehicle must visit.
static std::string getParameter(const std::string &vehicleID, const std::string &key)
virtual std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this laneChangeModel. Throw exception for unsupported key ...
bool wasRemoteControlled(SUMOTime lookBack=DELTA_T) const
Returns the information whether the vehicle is fully controlled via TraCI within the lookBack time...
Definition: MSVehicle.cpp:4273
static double getSlope(const std::string &vehicleID)
bool addTraciStop(MSLane *const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
Definition: MSVehicle.cpp:4043
double getLength() const
Get vehicle&#39;s length [m].
const Distribution_Parameterized & getSpeedFactor() const
Returns this type&#39;s speed factor.
static std::string getVClass(const std::string &vehicleID)
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:4223
Structure representing possible vehicle parameter.
#define INVALID_INT_VALUE
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Definition: MSRoute.cpp:80
std::string laneID
The id of the lane.
Definition: TraCIDefs.h:197
bool containerTriggered
whether an arriving container lets the vehicle continue
Definition: MSVehicle.h:844
static std::string getShapeClass(const std::string &vehicleID)
static void moveToXY(const std::string &vehicleID, const std::string &edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute)
int setParameter
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
static const MSVehicleType & getVehicleType(const std::string &vehicleID)
std::vector< MSLane * > bestContinuations
Definition: MSVehicle.h:733
static void changeLane(const std::string &vehID, int laneIndex, SUMOTime duration)
std::pair< const MSVehicle *const, double > getLeader(double dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:3574
static double getSpeedFactor(const std::string &vehicleID)
std::string get(int pos) const
bool hasDevice(const std::string &deviceName) const
check whether the vehicle is equiped with a device of the given type
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
static void setVia(const std::string &vehicleID, const std::vector< std::string > &via)
double length
The length than can be driven from that lane without lane change.
Definition: TraCIDefs.h:199
int bestLaneOffset
The offset of this lane from the best lane.
Definition: TraCIDefs.h:203
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
Definition: TraCIDefs.h:207
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSVehicle.h:822
double occupation
The traffic density along length.
Definition: TraCIDefs.h:201
const std::string & getID() const
Returns the name of the vehicle type.
static std::string getRoadID(const std::string &vehicleID)
double getLateralPositionOnLane() const
Get the vehicle&#39;s lateral position on the lane.
Definition: MSVehicle.h:407
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;s parameter (including departure definition)
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane&#39;s maximum speed, given a vehicle&#39;s speed limit adaptation.
Definition: MSLane.h:462
char state
The current state of the tls.
Definition: TraCIDefs.h:189
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
Definition: MSVehicle.h:591
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
Definition: MSRoute.cpp:281
static double getDrivingDistance(const std::string &vehicleID, const std::string &edgeID, double position, int laneIndex)
static double getLateralLanePosition(const std::string &vehicleID)
unsigned char b
Definition: TraCIDefs.h:79
static int getSpeedMode(const std::string &vehicleID)
static TraCIPosition makeTraCIPosition(const Position &position)
Definition: TraCI.cpp:144
static double getMaxSpeed(const std::string &vehicleID)
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:1147
static int getLanechangeMode(const std::string &vehicleID)
double getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:3644
double getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:3620
static std::string getTypeID(const std::string &vehicleID)
static int getLaneIndex(const std::string &vehicleID)
long long int SUMOTime
Definition: TraCIDefs.h:52
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
double y
Definition: TraCIDefs.h:72
int getSpeedMode() const
return the current speed mode
Definition: MSVehicle.cpp:280
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
Definition: MSVehicle.cpp:270
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
The class responsible for building and deletion of vehicles.
static void resume(const std::string &vehicleID)
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:3656
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:521
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
static double getSpeed(const std::string &vehicleID)
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:499
static double getLanePosition(const std::string &vehicleID)
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:826
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle&#39;s internal edge travel times/efforts container.
Definition: MSVehicle.cpp:722
static std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist)
static std::vector< std::string > getEdges(const std::string &vehicleID)
static bool onInit(const std::string &vehicleID)
static std::vector< TraCIBestLanesData > getBestLanes(const std::string &vehicleID)
double getDepartPos() const
Returns this vehicle&#39;s real departure position.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:74
static void setSpeed(const std::string &vehicleID, double speed)
double startPos
The stopping position start.
Definition: MSVehicle.h:834
bool parking
whether the vehicle is removed from the net while stopping
Definition: MSVehicle.h:846
static void setShapeClass(const std::string &vehicleID, const std::string &clazz)
static double getEffort(const std::string &vehicleID, const std::string &edgeID, int time)
const std::string & getID() const
Returns the name of the vehicle.
double getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:443
static double getDecel(const std::string &vehicleID)