Eclipse SUMO - Simulation of Urban MObility
libsumo/Simulation.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2017-2022 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// C++ TraCI client API implementation
21/****************************************************************************/
22#include <config.h>
23#ifdef HAVE_VERSION_H
24#include <version.h>
25#endif
36#include <utils/xml/XMLSubSys.h>
37#include <microsim/MSNet.h>
40#include <microsim/MSEdge.h>
41#include <microsim/MSLane.h>
42#include <microsim/MSVehicle.h>
52#include <mesosim/MELoop.h>
53#include <mesosim/MESegment.h>
54#include <netload/NLBuilder.h>
55#include <libsumo/Helper.h>
57#ifdef HAVE_LIBSUMOGUI
58#include "GUI.h"
59#endif
60#include "Simulation.h"
61#include <libsumo/TraCIDefs.h>
62
63
64namespace libsumo {
65// ===========================================================================
66// static member initializations
67// ===========================================================================
68SubscriptionResults Simulation::mySubscriptionResults;
69ContextSubscriptionResults Simulation::myContextSubscriptionResults;
70
71
72// ===========================================================================
73// static member definitions
74// ===========================================================================
75std::pair<int, std::string>
76Simulation::start(const std::vector<std::string>& cmd, int /* port */, int /* numRetries */, const std::string& /* label */, const bool /* verbose */,
77 const std::string& /* traceFile */, bool /* traceGetters */, void* /* _stdout */) {
78#ifdef HAVE_LIBSUMOGUI
79 if (GUI::start(cmd)) {
80 return getVersion();
81 }
82#endif
83 load(std::vector<std::string>(cmd.begin() + 1, cmd.end()));
84 return getVersion();
85}
86
87
88void
89Simulation::load(const std::vector<std::string>& args) {
90#ifdef HAVE_LIBSUMOGUI
91 if (GUI::load(args)) {
92 return;
93 }
94#endif
95 close("Libsumo issued load command.");
96 try {
97 OptionsCont::getOptions().setApplicationName("libsumo", "Eclipse SUMO libsumo Version " VERSION_STRING);
98 gSimulation = true;
100 OptionsIO::setArgs(args);
101 if (NLBuilder::init(true) != nullptr) {
102 const SUMOTime begin = string2time(OptionsCont::getOptions().getString("begin"));
103 MSNet::getInstance()->setCurrentTimeStep(begin); // needed for state loading
104 WRITE_MESSAGEF(TL("Simulation version % started via libsumo with time: %."), VERSION_STRING, time2string(begin));
105 }
106 } catch (ProcessError& e) {
107 throw TraCIException(e.what());
108 }
109}
110
111
112bool
113Simulation::hasGUI() {
114#ifdef HAVE_LIBSUMOGUI
115 return GUI::hasInstance();
116#else
117 return false;
118#endif
119}
120
121
122bool
123Simulation::isLoaded() {
124 return MSNet::hasInstance();
125}
126
127
128void
129Simulation::step(const double time) {
131 const SUMOTime t = TIME2STEPS(time);
132#ifdef HAVE_LIBSUMOGUI
133 if (!GUI::step(t)) {
134#endif
135 if (t == 0) {
137 } else {
138 while (MSNet::getInstance()->getCurrentTimeStep() < t) {
140 }
141 }
142#ifdef HAVE_LIBSUMOGUI
143 }
144#endif
146}
147
148
149void
150Simulation::close(const std::string& reason) {
152 if (
153#ifdef HAVE_LIBSUMOGUI
154 !GUI::close(reason) &&
155#endif
158 delete MSNet::getInstance();
160 }
161}
162
163
164void
165Simulation::subscribe(const std::vector<int>& varIDs, double begin, double end, const libsumo::TraCIResults& params) {
166 libsumo::Helper::subscribe(CMD_SUBSCRIBE_SIM_VARIABLE, "", varIDs, begin, end, params);
167}
168
169
170const TraCIResults
171Simulation::getSubscriptionResults() {
172 return mySubscriptionResults[""];
173}
174
175
177
178
179std::pair<int, std::string>
180Simulation::getVersion() {
181 return std::make_pair(libsumo::TRACI_VERSION, "SUMO " VERSION_STRING);
182}
183
184
185std::string
186Simulation::getOption(const std::string& option) {
188 if (!oc.exists(option)) {
189 throw TraCIException("The option " + option + " is unknown.");
190 }
191 return oc.getValueString(option);
192}
193
194
195int
196Simulation::getCurrentTime() {
197 return (int)MSNet::getInstance()->getCurrentTimeStep();
198}
199
200
201double
202Simulation::getTime() {
203 return SIMTIME;
204}
205
206double
207Simulation::getEndTime() {
208 return STEPS2TIME(string2time(OptionsCont::getOptions().getString("end")));
209}
210
211
212int
213Simulation::getLoadedNumber() {
215}
216
217
218std::vector<std::string>
219Simulation::getLoadedIDList() {
221}
222
223
224int
225Simulation::getDepartedNumber() {
227}
228
229
230std::vector<std::string>
231Simulation::getDepartedIDList() {
233}
234
235
236int
237Simulation::getArrivedNumber() {
239}
240
241
242std::vector<std::string>
243Simulation::getArrivedIDList() {
245}
246
247
248int
249Simulation::getParkingStartingVehiclesNumber() {
251}
252
253
254std::vector<std::string>
255Simulation::getParkingStartingVehiclesIDList() {
257}
258
259
260int
261Simulation::getParkingEndingVehiclesNumber() {
263}
264
265
266std::vector<std::string>
267Simulation::getParkingEndingVehiclesIDList() {
269}
270
271
272int
273Simulation::getStopStartingVehiclesNumber() {
275}
276
277
278std::vector<std::string>
279Simulation::getStopStartingVehiclesIDList() {
281}
282
283
284int
285Simulation::getStopEndingVehiclesNumber() {
287}
288
289
290std::vector<std::string>
291Simulation::getStopEndingVehiclesIDList() {
293}
294
295
296int
297Simulation::getCollidingVehiclesNumber() {
299}
300
301
302std::vector<std::string>
303Simulation::getCollidingVehiclesIDList() {
305}
306
307
308int
309Simulation::getEmergencyStoppingVehiclesNumber() {
311}
312
313
314std::vector<std::string>
315Simulation::getEmergencyStoppingVehiclesIDList() {
317}
318
319
320int
321Simulation::getStartingTeleportNumber() {
323}
324
325
326std::vector<std::string>
327Simulation::getStartingTeleportIDList() {
329}
330
331
332int
333Simulation::getEndingTeleportNumber() {
335}
336
337
338std::vector<std::string>
339Simulation::getEndingTeleportIDList() {
341}
342
343int
344Simulation::getDepartedPersonNumber() {
346}
347
348
349std::vector<std::string>
350Simulation::getDepartedPersonIDList() {
352}
353
354
355int
356Simulation::getArrivedPersonNumber() {
358}
359
360
361std::vector<std::string>
362Simulation::getArrivedPersonIDList() {
364}
365
366std::vector<std::string>
367Simulation::getBusStopIDList() {
368 std::vector<std::string> result;
369 for (const auto& pair : MSNet::getInstance()->getStoppingPlaces(SUMO_TAG_BUS_STOP)) {
370 result.push_back(pair.first);
371 }
372 return result;
373}
374
375int
376Simulation::getBusStopWaiting(const std::string& stopID) {
378 if (s == nullptr) {
379 throw TraCIException("Unknown bus stop '" + stopID + "'.");
380 }
381 return s->getTransportableNumber();
382}
383
384std::vector<std::string>
385Simulation::getBusStopWaitingIDList(const std::string& stopID) {
387 if (s == nullptr) {
388 throw TraCIException("Unknown bus stop '" + stopID + "'.");
389 }
390 std::vector<std::string> result;
391 for (const MSTransportable* t : s->getTransportables()) {
392 result.push_back(t->getID());
393 }
394 return result;
395}
396
397
398std::vector<std::string>
399Simulation::getPendingVehicles() {
400 std::vector<std::string> result;
401 for (const SUMOVehicle* veh : MSNet::getInstance()->getInsertionControl().getPendingVehicles()) {
402 result.push_back(veh->getID());
403 }
404 return result;
405}
406
407
408std::vector<libsumo::TraCICollision>
409Simulation::getCollisions() {
410 std::vector<libsumo::TraCICollision> result;
411 for (auto item : MSNet::getInstance()->getCollisions()) {
412 for (const MSNet::Collision& c : item.second) {
414 c2.collider = item.first;
415 c2.victim = c.victim;
417 c2.victimType = c.victimType;
420 c2.type = c.type;
421 c2.lane = c.lane->getID();
422 c2.pos = c.pos;
423 result.push_back(c2);
424 }
425 }
426 return result;
427}
428
429double
430Simulation::getScale() {
432}
433
434double
435Simulation::getDeltaT() {
436 return TS;
437}
438
439
440TraCIPositionVector
441Simulation::getNetBoundary() {
443 TraCIPositionVector tb;
444 TraCIPosition minV;
445 TraCIPosition maxV;
446 minV.x = b.xmin();
447 maxV.x = b.xmax();
448 minV.y = b.ymin();
449 maxV.y = b.ymax();
450 minV.z = b.zmin();
451 maxV.z = b.zmax();
452 tb.value.push_back(minV);
453 tb.value.push_back(maxV);
454 return tb;
455}
456
457
458int
459Simulation::getMinExpectedNumber() {
460 MSNet* net = MSNet::getInstance();
463 + (net->hasPersons() ? net->getPersonControl().getActiveCount() : 0)
464 + (net->hasContainers() ? net->getContainerControl().getActiveCount() : 0));
465}
466
467
468TraCIPosition
469Simulation::convert2D(const std::string& edgeID, double pos, int laneIndex, bool toGeo) {
470 Position result = Helper::getLaneChecking(edgeID, laneIndex, pos)->geometryPositionAtOffset(pos);
471 if (toGeo) {
473 }
474 result.setz(0.);
475 return Helper::makeTraCIPosition(result);
476}
477
478
479TraCIPosition
480Simulation::convert3D(const std::string& edgeID, double pos, int laneIndex, bool toGeo) {
481 Position result = Helper::getLaneChecking(edgeID, laneIndex, pos)->geometryPositionAtOffset(pos);
482 if (toGeo) {
484 }
485 return Helper::makeTraCIPosition(result, true);
486}
487
488
489TraCIRoadPosition
490Simulation::convertRoad(double x, double y, bool isGeo, const std::string& vClass) {
491 Position pos(x, y);
492 if (isGeo) {
494 }
495 if (!SumoVehicleClassStrings.hasString(vClass)) {
496 throw TraCIException("Unknown vehicle class '" + vClass + "'.");
497 }
498 const SUMOVehicleClass vc = SumoVehicleClassStrings.get(vClass);
499 std::pair<MSLane*, double> roadPos = libsumo::Helper::convertCartesianToRoadMap(pos, vc);
500 if (roadPos.first == nullptr) {
501 throw TraCIException("Cannot convert position to road.");
502 }
503 TraCIRoadPosition result;
504 result.edgeID = roadPos.first->getEdge().getID();
505 result.laneIndex = roadPos.first->getIndex();
506 result.pos = roadPos.second;
507 return result;
508}
509
510
511TraCIPosition
512Simulation::convertGeo(double x, double y, bool fromGeo) {
513 Position pos(x, y);
514 if (fromGeo) {
516 } else {
518 }
519 return Helper::makeTraCIPosition(pos);
520}
521
522
523double
524Simulation::getDistance2D(double x1, double y1, double x2, double y2, bool isGeo, bool isDriving) {
525 Position pos1(x1, y1);
526 Position pos2(x2, y2);
527 if (isGeo) {
530 }
531 if (isDriving) {
532 std::pair<const MSLane*, double> roadPos1 = libsumo::Helper::convertCartesianToRoadMap(pos1, SVC_IGNORING);
533 std::pair<const MSLane*, double> roadPos2 = libsumo::Helper::convertCartesianToRoadMap(pos2, SVC_IGNORING);
534 return Helper::getDrivingDistance(roadPos1, roadPos2);
535 } else {
536 return pos1.distanceTo(pos2);
537 }
538}
539
540
541double
542Simulation::getDistanceRoad(const std::string& edgeID1, double pos1, const std::string& edgeID2, double pos2, bool isDriving) {
543 std::pair<const MSLane*, double> roadPos1 = std::make_pair(libsumo::Helper::getLaneChecking(edgeID1, 0, pos1), pos1);
544 std::pair<const MSLane*, double> roadPos2 = std::make_pair(libsumo::Helper::getLaneChecking(edgeID2, 0, pos2), pos2);
545 if (isDriving) {
546 return Helper::getDrivingDistance(roadPos1, roadPos2);
547 } else {
548 const Position p1 = roadPos1.first->geometryPositionAtOffset(roadPos1.second);
549 const Position p2 = roadPos2.first->geometryPositionAtOffset(roadPos2.second);
550 return p1.distanceTo(p2);
551 }
552}
553
554
555TraCIStage
556Simulation::findRoute(const std::string& from, const std::string& to, const std::string& typeID, const double depart, const int routingMode) {
557 TraCIStage result(STAGE_DRIVING);
558 const MSEdge* const fromEdge = MSEdge::dictionary(from);
559 if (fromEdge == nullptr) {
560 throw TraCIException("Unknown from edge '" + from + "'.");
561 }
562 const MSEdge* const toEdge = MSEdge::dictionary(to);
563 if (toEdge == nullptr) {
564 throw TraCIException("Unknown to edge '" + from + "'.");
565 }
566 SUMOVehicle* vehicle = nullptr;
567 MSVehicleType* type = MSNet::getInstance()->getVehicleControl().getVType(typeID == "" ? DEFAULT_VTYPE_ID : typeID);
568 if (type == nullptr) {
569 throw TraCIException("The vehicle type '" + typeID + "' is not known.");
570 }
572 pars->id = "simulation.findRoute";
573 try {
574 const MSRoute* const routeDummy = new MSRoute("", ConstMSEdgeVector({ fromEdge }), false, nullptr, std::vector<SUMOVehicleParameter::Stop>());
575 vehicle = MSNet::getInstance()->getVehicleControl().buildVehicle(pars, routeDummy, type, false);
576 std::string msg;
577 if (!vehicle->hasValidRouteStart(msg)) {
579 throw TraCIException("Invalid departure edge for vehicle type '" + type->getID() + "' (" + msg + ")");
580 }
581 // we need to fix the speed factor here for deterministic results
582 vehicle->setChosenSpeedFactor(type->getSpeedFactor().getParameter()[0]);
583 } catch (ProcessError& e) {
584 throw TraCIException("Invalid departure edge for vehicle type '" + type->getID() + "' (" + e.what() + ")");
585 }
586 ConstMSEdgeVector edges;
587 const SUMOTime dep = depart < 0 ? MSNet::getInstance()->getCurrentTimeStep() : TIME2STEPS(depart);
589 router.compute(fromEdge, toEdge, vehicle, dep, edges);
590 for (const MSEdge* e : edges) {
591 result.edges.push_back(e->getID());
592 }
593 result.travelTime = result.cost = router.recomputeCosts(edges, vehicle, dep, &result.length);
594 if (vehicle != nullptr) {
596 }
597 return result;
598}
599
600
601std::vector<TraCIStage>
602Simulation::findIntermodalRoute(const std::string& from, const std::string& to,
603 const std::string& modes, double depart, const int routingMode, double speed, double walkFactor,
604 double departPos, double arrivalPos, const double departPosLat,
605 const std::string& pType, const std::string& vType, const std::string& destStop) {
606 UNUSED_PARAMETER(departPosLat);
607 std::vector<TraCIStage> result;
608 const MSEdge* const fromEdge = MSEdge::dictionary(from);
609 if (fromEdge == nullptr) {
610 throw TraCIException("Unknown from edge '" + from + "'.");
611 }
612 const MSEdge* const toEdge = MSEdge::dictionary(to);
613 if (toEdge == nullptr) {
614 throw TraCIException("Unknown to edge '" + to + "'.");
615 }
617 SVCPermissions modeSet = 0;
618 std::vector<SUMOVehicleParameter*> pars;
619 if (vType != "") {
620 pars.push_back(new SUMOVehicleParameter());
621 pars.back()->vtypeid = vType;
622 pars.back()->id = vType;
623 modeSet |= SVC_PASSENGER;
624 }
625 for (StringTokenizer st(modes); st.hasNext();) {
626 const std::string mode = st.next();
627 if (mode == toString(PersonMode::CAR)) {
628 pars.push_back(new SUMOVehicleParameter());
629 pars.back()->vtypeid = DEFAULT_VTYPE_ID;
630 pars.back()->id = mode;
631 modeSet |= SVC_PASSENGER;
632 } else if (mode == toString(PersonMode::BICYCLE)) {
633 pars.push_back(new SUMOVehicleParameter());
634 pars.back()->vtypeid = DEFAULT_BIKETYPE_ID;
635 pars.back()->id = mode;
636 modeSet |= SVC_BICYCLE;
637 } else if (mode == toString(PersonMode::TAXI)) {
638 pars.push_back(new SUMOVehicleParameter());
639 pars.back()->vtypeid = DEFAULT_TAXITYPE_ID;
640 pars.back()->id = mode;
641 modeSet |= SVC_TAXI;
642 } else if (mode == toString(PersonMode::PUBLIC)) {
643 pars.push_back(nullptr);
644 modeSet |= SVC_BUS;
645 } else if (mode == toString(PersonMode::WALK)) {
646 // do nothing
647 } else {
648 throw TraCIException("Unknown person mode '" + mode + "'.");
649 }
650 }
651 if (pars.empty()) {
652 pars.push_back(nullptr);
653 }
654 // interpret default arguments
655 const MSVehicleType* pedType = vehControl.hasVType(pType) ? vehControl.getVType(pType) : vehControl.getVType(DEFAULT_PEDTYPE_ID);
656 SUMOTime departStep = TIME2STEPS(depart);
657 if (depart < 0) {
658 departStep = MSNet::getInstance()->getCurrentTimeStep();
659 }
660 if (speed < 0) {
661 speed = MIN2(pedType->getMaxSpeed(), pedType->getDesiredMaxSpeed());
662 }
663 if (walkFactor < 0) {
664 walkFactor = OptionsCont::getOptions().getFloat("persontrip.walkfactor");
665 }
666 const double externalFactor = StringUtils::toDouble(pedType->getParameter().getParameter("externalEffortFactor", "100"));
667 if (departPos < 0) {
668 departPos += fromEdge->getLength();
669 }
670 if (arrivalPos == INVALID_DOUBLE_VALUE) {
671 arrivalPos = toEdge->getLength() / 2;
672 } else if (arrivalPos < 0) {
673 arrivalPos += toEdge->getLength();
674 }
675 if (departPos < 0 || departPos >= fromEdge->getLength()) {
676 throw TraCIException("Invalid depart position " + toString(departPos) + " for edge '" + to + "'.");
677 }
678 if (arrivalPos < 0 || arrivalPos >= toEdge->getLength()) {
679 throw TraCIException("Invalid arrival position " + toString(arrivalPos) + " for edge '" + to + "'.");
680 }
681 double minCost = std::numeric_limits<double>::max();
683 for (SUMOVehicleParameter* vehPar : pars) {
684 std::vector<TraCIStage> resultCand;
685 SUMOVehicle* vehicle = nullptr;
686 if (vehPar != nullptr) {
687 MSVehicleType* type = MSNet::getInstance()->getVehicleControl().getVType(vehPar->vtypeid);
688 if (type == nullptr) {
689 throw TraCIException("Unknown vehicle type '" + vehPar->vtypeid + "'.");
690 }
691 if (type->getVehicleClass() != SVC_IGNORING && (fromEdge->getPermissions() & type->getVehicleClass()) == 0) {
692 WRITE_WARNING("Ignoring vehicle type '" + type->getID() + "' when performing intermodal routing because it is not allowed on the start edge '" + from + "'.");
693 } else {
694 const MSRoute* const routeDummy = new MSRoute(vehPar->id, ConstMSEdgeVector({ fromEdge }), false, nullptr, std::vector<SUMOVehicleParameter::Stop>());
695 vehicle = vehControl.buildVehicle(vehPar, routeDummy, type, !MSGlobals::gCheckRoutes);
696 // we need to fix the speed factor here for deterministic results
697 vehicle->setChosenSpeedFactor(type->getSpeedFactor().getParameter()[0]);
698 }
699 }
700 std::vector<MSNet::MSIntermodalRouter::TripItem> items;
701 if (router.compute(fromEdge, toEdge, departPos, "", arrivalPos, destStop,
702 speed * walkFactor, vehicle, modeSet, departStep, items, externalFactor)) {
703 double cost = 0;
704 for (std::vector<MSNet::MSIntermodalRouter::TripItem>::iterator it = items.begin(); it != items.end(); ++it) {
705 if (!it->edges.empty()) {
706 resultCand.push_back(TraCIStage((it->line == "" ? STAGE_WALKING : STAGE_DRIVING), it->vType, it->line, it->destStop));
707 for (const MSEdge* e : it->edges) {
708 resultCand.back().edges.push_back(e->getID());
709 }
710 resultCand.back().travelTime = it->traveltime;
711 resultCand.back().cost = it->cost;
712 resultCand.back().length = it->length;
713 resultCand.back().intended = it->intended;
714 resultCand.back().depart = it->depart;
715 resultCand.back().departPos = it->departPos;
716 resultCand.back().arrivalPos = it->arrivalPos;
717 resultCand.back().description = it->description;
718 }
719 cost += it->cost;
720 }
721 if (cost < minCost) {
722 minCost = cost;
723 result = resultCand;
724 }
725 }
726 if (vehicle != nullptr) {
727 vehControl.deleteVehicle(vehicle, true);
728 }
729 }
730 return result;
731}
732
733
734std::string
735Simulation::getParameter(const std::string& objectID, const std::string& key) {
736 if (StringUtils::startsWith(key, "chargingStation.")) {
737 const std::string attrName = key.substr(16);
739 if (cs == nullptr) {
740 throw TraCIException("Invalid chargingStation '" + objectID + "'");
741 }
742 if (attrName == toString(SUMO_ATTR_TOTALENERGYCHARGED)) {
743 return toString(cs->getTotalCharged());
744 } else if (attrName == toString(SUMO_ATTR_NAME)) {
745 return toString(cs->getMyName());
746 } else if (attrName == "lane") {
747 return cs->getLane().getID();
748 } else if (cs->knowsParameter(attrName)) {
749 return cs->getParameter(attrName);
750 } else {
751 throw TraCIException("Invalid chargingStation parameter '" + attrName + "'");
752 }
753 } else if (StringUtils::startsWith(key, "overheadWire.")) {
754 const std::string attrName = key.substr(16);
756 if (cs == 0) {
757 throw TraCIException("Invalid overhead wire '" + objectID + "'");
758 }
759 if (attrName == toString(SUMO_ATTR_TOTALENERGYCHARGED)) {
760 return toString(cs->getTotalCharged());
761 } else if (attrName == toString(SUMO_ATTR_NAME)) {
762 return toString(cs->getMyName());
763 } else {
764 throw TraCIException("Invalid overhead wire parameter '" + attrName + "'");
765 }
766 } else if (StringUtils::startsWith(key, "net.")) {
767 const std::string attrName = key.substr(4);
769 if (attrName == toString(SUMO_ATTR_NET_OFFSET)) {
770 return toString(GeoConvHelper::getFinal().getOffsetBase());
771 } else {
772 throw TraCIException("Invalid net parameter '" + attrName + "'");
773 }
774 } else if (StringUtils::startsWith(key, "parkingArea.")) {
775 const std::string attrName = key.substr(12);
777 if (pa == nullptr) {
778 throw TraCIException("Invalid parkingArea '" + objectID + "'");
779 }
780 if (attrName == "capacity") {
781 return toString(pa->getCapacity());
782 } else if (attrName == "occupancy") {
784 } else if (attrName == toString(SUMO_ATTR_NAME)) {
785 return toString(pa->getMyName());
786 } else if (attrName == "lane") {
787 return pa->getLane().getID();
788 } else if (pa->knowsParameter(attrName)) {
789 return pa->getParameter(attrName);
790 } else {
791 throw TraCIException("Invalid parkingArea parameter '" + attrName + "'");
792 }
793 } else if (StringUtils::startsWith(key, "busStop.")) {
794 const std::string attrName = key.substr(8);
796 if (bs == nullptr) {
797 throw TraCIException("Invalid busStop '" + objectID + "'");
798 }
799 if (attrName == toString(SUMO_ATTR_NAME)) {
800 return toString(bs->getMyName());
801 } else if (attrName == "lane") {
802 return bs->getLane().getID();
803 } else if (bs->knowsParameter(attrName)) {
804 return bs->getParameter(attrName);
805 } else {
806 throw TraCIException("Invalid busStop parameter '" + attrName + "'");
807 }
808 } else if (objectID == "") {
809 return MSNet::getInstance()->getParameter(key, "");
810 } else {
811 throw TraCIException("Simulation parameter '" + key + "' is not supported for object id '" + objectID + "'. Use empty id for generic network parameters");
812 }
813}
814
816
817void
818Simulation::setParameter(const std::string& objectID, const std::string& param, const std::string& value) {
819 if (objectID == "") {
820 MSNet::getInstance()->setParameter(param, value);
821 } else {
822 throw TraCIException("Setting simulation parameter '" + param + "' is not supported for object id '" + objectID + "'. Use empty id for generic network parameters");
823 }
824}
825
826void
827Simulation::setScale(double value) {
829}
830
831void
832Simulation::clearPending(const std::string& routeID) {
834}
835
836
837void
838Simulation::saveState(const std::string& fileName) {
839 MSStateHandler::saveState(fileName, MSNet::getInstance()->getCurrentTimeStep());
840}
841
842double
843Simulation::loadState(const std::string& fileName) {
844 long before = PROGRESS_BEGIN_TIME_MESSAGE("Loading state from '" + fileName + "'");
845 try {
846 const SUMOTime newTime = MSNet::getInstance()->loadState(fileName);
849 PROGRESS_TIME_MESSAGE(before);
850 return STEPS2TIME(newTime);
851 } catch (ProcessError&) {
852 throw TraCIException("Loading state from '" + fileName + "' failed.");
853 }
854}
855
856void
857Simulation::writeMessage(const std::string& msg) {
858 WRITE_MESSAGE(msg);
859}
860
861
862void
863Simulation::storeShape(PositionVector& shape) {
865}
866
867
868std::shared_ptr<VariableWrapper>
869Simulation::makeWrapper() {
870 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
871}
872
873
874bool
875Simulation::handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData) {
876 switch (variable) {
877 case VAR_TIME:
878 return wrapper->wrapDouble(objID, variable, getTime());
879 case VAR_TIME_STEP:
880 return wrapper->wrapInt(objID, variable, (int)getCurrentTime());
881 case VAR_END:
882 return wrapper->wrapDouble(objID, variable, getEndTime());
884 return wrapper->wrapInt(objID, variable, getLoadedNumber());
886 return wrapper->wrapStringList(objID, variable, getLoadedIDList());
888 return wrapper->wrapInt(objID, variable, getDepartedNumber());
890 return wrapper->wrapStringList(objID, variable, getDepartedIDList());
892 return wrapper->wrapInt(objID, variable, getStartingTeleportNumber());
894 return wrapper->wrapStringList(objID, variable, getStartingTeleportIDList());
896 return wrapper->wrapInt(objID, variable, getEndingTeleportNumber());
898 return wrapper->wrapStringList(objID, variable, getEndingTeleportIDList());
900 return wrapper->wrapInt(objID, variable, getArrivedNumber());
902 return wrapper->wrapStringList(objID, variable, getArrivedIDList());
904 return wrapper->wrapInt(objID, variable, getParkingStartingVehiclesNumber());
906 return wrapper->wrapStringList(objID, variable, getParkingStartingVehiclesIDList());
908 return wrapper->wrapInt(objID, variable, getParkingEndingVehiclesNumber());
910 return wrapper->wrapStringList(objID, variable, getParkingEndingVehiclesIDList());
912 return wrapper->wrapInt(objID, variable, getStopStartingVehiclesNumber());
914 return wrapper->wrapStringList(objID, variable, getStopStartingVehiclesIDList());
916 return wrapper->wrapInt(objID, variable, getStopEndingVehiclesNumber());
918 return wrapper->wrapStringList(objID, variable, getStopEndingVehiclesIDList());
920 return wrapper->wrapInt(objID, variable, getCollidingVehiclesNumber());
922 return wrapper->wrapStringList(objID, variable, getCollidingVehiclesIDList());
924 return wrapper->wrapInt(objID, variable, getEmergencyStoppingVehiclesNumber());
926 return wrapper->wrapStringList(objID, variable, getEmergencyStoppingVehiclesIDList());
928 return wrapper->wrapInt(objID, variable, getDepartedPersonNumber());
930 return wrapper->wrapStringList(objID, variable, getDepartedPersonIDList());
932 return wrapper->wrapInt(objID, variable, getArrivedPersonNumber());
934 return wrapper->wrapStringList(objID, variable, getArrivedPersonIDList());
935 case VAR_SCALE:
936 return wrapper->wrapDouble(objID, variable, getScale());
937 case VAR_DELTA_T:
938 return wrapper->wrapDouble(objID, variable, getDeltaT());
939 case VAR_OPTION:
940 return wrapper->wrapString(objID, variable, getOption(objID));
942 return wrapper->wrapInt(objID, variable, getMinExpectedNumber());
944 return wrapper->wrapStringList(objID, variable, getBusStopIDList());
946 return wrapper->wrapInt(objID, variable, getBusStopWaiting(objID));
948 return wrapper->wrapStringList(objID, variable, getBusStopWaitingIDList(objID));
950 return wrapper->wrapStringList(objID, variable, getPendingVehicles());
952 paramData->readUnsignedByte();
953 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->readString()));
955 paramData->readUnsignedByte();
956 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->readString()));
957 default:
958 return false;
959 }
960}
961}
962
963
964/****************************************************************************/
long long int SUMOTime
Definition: GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
#define WRITE_MESSAGEF(...)
Definition: MsgHandler.h:268
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:267
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:265
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
Definition: MsgHandler.h:271
#define TL(string)
Definition: MsgHandler.h:282
#define PROGRESS_TIME_MESSAGE(before)
Definition: MsgHandler.h:272
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define STEPS2TIME(x)
Definition: SUMOTime.h:54
#define TS
Definition: SUMOTime.h:41
#define SIMTIME
Definition: SUMOTime.h:61
#define TIME2STEPS(x)
Definition: SUMOTime.h:56
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
const std::string DEFAULT_TAXITYPE_ID
const std::string DEFAULT_PEDTYPE_ID
const std::string DEFAULT_VTYPE_ID
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_BIKETYPE_ID
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_OVERHEAD_WIRE_SEGMENT
An overhead wire segment.
@ SUMO_ATTR_NET_OFFSET
@ SUMO_ATTR_TOTALENERGYCHARGED
@ SUMO_ATTR_NAME
bool gSimulation
Definition: StdDefs.cpp:29
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:30
T MIN2(T a, T b)
Definition: StdDefs.h:71
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
Definition: TraCIDefs.h:76
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
Definition: TraCIDefs.h:123
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:130
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:118
PositionVector getShape(const bool closeShape) const
get position vector (shape) based on this boundary
Definition: Boundary.cpp:404
double zmin() const
Returns minimum z-coordinate.
Definition: Boundary.cpp:142
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:136
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:124
double zmax() const
Returns maximum z-coordinate.
Definition: Boundary.cpp:148
std::vector< double > & getParameter()
Returns the parameters of this distribution.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
const Position getOffsetBase() const
Returns the network base.
const Boundary & getConvBoundary() const
Returns the converted boundary.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
bool compute(const E *from, const E *to, const double departPos, const std::string &originStopID, const double arrivalPos, const std::string &stopID, const double speed, const V *const vehicle, const SVCPermissions modeSet, const SUMOTime msTime, std::vector< TripItem > &into, const double externalFactor=0.)
Builds the route between the given edges using the minimum effort at the given time The definition of...
C++ TraCI client API implementation.
Definition: Simulation.h:41
double getTotalCharged() const
A road/street connecting two junctions.
Definition: MSEdge.h:77
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
Definition: MSEdge.h:622
double getLength() const
return the length of the edge
Definition: MSEdge.h:658
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary....
Definition: MSEdge.cpp:945
static bool gCheckRoutes
Definition: MSGlobals.h:88
void clearPendingVehicles(const std::string &route)
clears out all pending vehicles from a route, "" for all routes
int getPendingFlowCount() const
Returns the number of flows that are still active.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:533
The simulated network and simulation perfomer.
Definition: MSNet.h:88
MSIntermodalRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1427
@ ENDING_PARKING
The vehicle ends to park.
@ STARTING_STOP
The vehicles starts to stop.
@ BUILT
The vehicle was built, but has not yet departed.
@ STARTING_PARKING
The vehicles starts to park.
@ STARTING_TELEPORT
The vehicle started to teleport.
@ ENDING_STOP
The vehicle ends to stop.
@ ENDING_TELEPORT
The vehicle ended being teleported.
@ ARRIVED
The vehicle arrived at his destination (is deleted)
@ DEPARTED
The vehicle has departed (was inserted into the network)
@ COLLISION
The vehicle is involved in a collision.
@ EMERGENCYSTOP
The vehicle had to brake harder than permitted.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:183
virtual MSTransportableControl & getContainerControl()
Returns the container control.
Definition: MSNet.cpp:1105
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1389
SUMOTime loadState(const std::string &fileName)
load state from file and return new time
Definition: MSNet.cpp:1576
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:321
static bool hasInstance()
Returns whether the network was already constructed.
Definition: MSNet.h:154
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
Definition: MSNet.cpp:618
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition: MSNet.cpp:1287
void simulationStep()
Performs a single simulation step.
Definition: MSNet.cpp:656
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
Definition: MSNet.h:329
bool hasContainers() const
Returns whether containers are simulated.
Definition: MSNet.h:412
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:396
@ PERSON_DEPARTED
The transportable person has departed (was inserted into the network)
@ PERSON_ARRIVED
The transportable person arrived at his destination (is deleted)
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:432
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:379
virtual MSTransportableControl & getPersonControl()
Returns the person control.
Definition: MSNet.cpp:1096
Definition of overhead wire segment.
double getTotalCharged() const
A lane area vehicles can halt at.
Definition: MSParkingArea.h:58
int getCapacity() const
Returns the area capacity.
int getOccupancyIncludingBlocked() const
Returns the area occupancy.
static SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, SUMOVehicleClass svc, const MSEdgeVector &prohibited=MSEdgeVector())
return the router instance
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
A lane area vehicles can halt at.
std::vector< const MSTransportable * > getTransportables() const
Returns the tranportables waiting on this stop.
int getTransportableNumber() const
Returns the number of transportables waiting on this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
const std::string & getMyName() const
int getActiveCount()
return the number of active transportable objects
The class responsible for building and deletion of vehicles.
bool hasVType(const std::string &id) const
Asks for existence of a vehicle type.
double getScale() const
sets the demand scaling factor
void setScale(double scale)
sets the demand scaling factor
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true, bool addRouteStops=true)
Builds a vehicle, increases the number of built 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.
int getActiveVehicleCount() const
Returns the number of build vehicles that have not been removed or need to wait for a passenger or a ...
The car-following model and parameter.
Definition: MSVehicleType.h:63
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double getMaxSpeed() const
Get vehicle's (technical) maximum speed [m/s].
double getDesiredMaxSpeed() const
Returns the vehicles's desired maximum speed.
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:91
const Distribution_Parameterized & getSpeedFactor() const
Returns this type's speed factor.
const SUMOVTypeParameter & getParameter() const
static MSNet * init(const bool isLibsumo=false)
Definition: NLBuilder.cpp:278
const std::string & getID() const
Returns the id.
Definition: Named.h:74
A storage for options typed value containers)
Definition: OptionsCont.h:89
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
bool exists(const std::string &name) const
Returns the information whether the named option is known.
std::string getValueString(const std::string &name) const
Returns the string-value of the named option (all options)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:59
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:58
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:242
void setz(double z)
set position z
Definition: Position.h:80
A list of positions.
double recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
virtual void setChosenSpeedFactor(const double factor)=0
virtual bool hasValidRouteStart(std::string &msg)=0
checks wether the vehicle can depart on the first edge
Structure representing possible vehicle parameter.
std::string id
The vehicle's id.
bool hasNext()
returns the information whether further substrings exist
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static void close()
Closes all of an applications subsystems.
static void init()
Initialises the xml-subsystem.
Definition: XMLSubSys.cpp:54
static double getDrivingDistance(std::pair< const MSLane *, double > &roadPos1, std::pair< const MSLane *, double > &roadPos2)
Definition: Helper.cpp:452
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
Definition: Helper.cpp:374
static void clearStateChanges()
Definition: Helper.cpp:710
static void subscribe(const int commandId, const std::string &id, const std::vector< int > &variables, const double beginTime, const double endTime, const libsumo::TraCIResults &params, const int contextDomain=0, const double range=0.)
Definition: Helper.cpp:109
static const std::vector< std::string > & getTransportableStateChanges(const MSNet::TransportableState state)
Definition: Helper.cpp:704
static void clearSubscriptions()
Definition: Helper.cpp:200
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
Definition: Helper.cpp:417
static const std::vector< std::string > & getVehicleStateChanges(const MSNet::VehicleState state)
Definition: Helper.cpp:698
static void handleSubscriptions(const SUMOTime t)
Definition: Helper.cpp:150
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
Definition: Helper.cpp:400
virtual std::string readString()
Definition: storage.cpp:180
virtual int readUnsignedByte()
Definition: storage.cpp:155
TRACI_CONST double INVALID_DOUBLE_VALUE
TRACI_CONST int VAR_MIN_EXPECTED_VEHICLES
TRACI_CONST int VAR_STOP_ENDING_VEHICLES_IDS
TRACI_CONST int CMD_SUBSCRIBE_SIM_VARIABLE
TRACI_CONST int VAR_ARRIVED_VEHICLES_NUMBER
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_NUMBER
TRACI_CONST int VAR_SCALE
TRACI_CONST int VAR_DEPARTED_VEHICLES_NUMBER
TRACI_CONST int VAR_COLLIDING_VEHICLES_NUMBER
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:301
TRACI_CONST int VAR_PARKING_ENDING_VEHICLES_IDS
TRACI_CONST int VAR_PARKING_STARTING_VEHICLES_IDS
TRACI_CONST int VAR_DEPARTED_PERSONS_NUMBER
TRACI_CONST int VAR_END
TRACI_CONST int VAR_ARRIVED_PERSONS_IDS
TRACI_CONST int ROUTING_MODE_AGGREGATED
TRACI_CONST int VAR_TIME
TRACI_CONST int VAR_PENDING_VEHICLES
TRACI_CONST int VAR_BUS_STOP_ID_LIST
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:300
TRACI_CONST int TRACI_VERSION
TRACI_CONST int VAR_EMERGENCYSTOPPING_VEHICLES_IDS
TRACI_CONST int VAR_BUS_STOP_WAITING_IDS
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_DEPARTED_VEHICLES_IDS
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_NUMBER
TRACI_CONST int VAR_PARKING_ENDING_VEHICLES_NUMBER
TRACI_CONST int VAR_LOADED_VEHICLES_IDS
TRACI_CONST int VAR_DELTA_T
TRACI_CONST int STAGE_WALKING
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int VAR_DEPARTED_PERSONS_IDS
TRACI_CONST int VAR_ARRIVED_PERSONS_NUMBER
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_IDS
TRACI_CONST int VAR_STOP_ENDING_VEHICLES_NUMBER
TRACI_CONST int VAR_LOADED_VEHICLES_NUMBER
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_IDS
TRACI_CONST int VAR_COLLIDING_VEHICLES_IDS
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_NUMBER
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_IDS
TRACI_CONST int VAR_BUS_STOP_WAITING
TRACI_CONST int VAR_TIME_STEP
TRACI_CONST int VAR_ARRIVED_VEHICLES_IDS
TRACI_CONST int STAGE_DRIVING
TRACI_CONST int VAR_PARKING_STARTING_VEHICLES_NUMBER
TRACI_CONST int VAR_EMERGENCYSTOPPING_VEHICLES_NUMBER
std::map< int, std::shared_ptr< libsumo::TraCIResult > > TraCIResults
{variable->value}
Definition: TraCIDefs.h:298
TRACI_CONST int VAR_OPTION
collision tracking
Definition: MSNet.h:116
double victimSpeed
Definition: MSNet.h:121
const MSLane * lane
Definition: MSNet.h:123
std::string victimType
Definition: MSNet.h:119
double pos
Definition: MSNet.h:124
std::string type
Definition: MSNet.h:122
std::string colliderType
Definition: MSNet.h:118
std::string victim
Definition: MSNet.h:117
double colliderSpeed
Definition: MSNet.h:120
std::string lane
The lane where the collision happended.
Definition: TraCIDefs.h:606
std::string type
The type of collision.
Definition: TraCIDefs.h:604
std::string collider
The ids of the participating vehicles and persons.
Definition: TraCIDefs.h:597
std::string victimType
Definition: TraCIDefs.h:600
double pos
The position of the collision along the lane.
Definition: TraCIDefs.h:608
std::string colliderType
Definition: TraCIDefs.h:599