74FXMutex Simulation::myStepMutex;
81std::pair<int, std::string>
82Simulation::init(
int ,
int ,
const std::string& ,
const std::string& , FILE*
const ) {
83 throw TraCIException(
"Multi client support (including connection switching) is not implemented in libsumo.");
82Simulation::init(
int ,
int ,
const std::string& ,
const std::string& , FILE*
const ) {
…}
87std::pair<int, std::string>
88Simulation::start(
const std::vector<std::string>& cmd,
int ,
int ,
const std::string& ,
const bool ,
89 const std::string& ,
bool ,
void* ) {
91 if (GUI::start(cmd)) {
95 load(std::vector<std::string>(cmd.begin() + 1, cmd.end()));
88Simulation::start(
const std::vector<std::string>& cmd,
int ,
int ,
const std::string& ,
const bool , {
…}
101Simulation::isLibsumo() {
101Simulation::isLibsumo() {
…}
107Simulation::switchConnection(
const std::string& ) {
108 throw TraCIException(
"Multi client support (including connection switching) is not implemented in libsumo.");
107Simulation::switchConnection(
const std::string& ) {
…}
113Simulation::getLabel() {
114 throw TraCIException(
"Multi client support (including connection switching) is not implemented in libsumo.");
113Simulation::getLabel() {
…}
119Simulation::setOrder(
int ) {
120 throw TraCIException(
"Multi client support (including connection switching) is not implemented in libsumo.");
119Simulation::setOrder(
int ) {
…}
125Simulation::load(
const std::vector<std::string>& args) {
126#ifdef HAVE_LIBSUMOGUI
127 if (GUI::load(args)) {
131 close(
"Libsumo issued load command.");
143 throw TraCIException(e.what());
125Simulation::load(
const std::vector<std::string>& args) {
…}
149Simulation::hasGUI() {
150#ifdef HAVE_LIBSUMOGUI
151 return GUI::hasInstance();
149Simulation::hasGUI() {
…}
159Simulation::isLoaded() {
159Simulation::isLoaded() {
…}
165Simulation::step(
const double time) {
167 FXMutexLock lock(myStepMutex);
171#ifdef HAVE_LIBSUMOGUI
181#ifdef HAVE_LIBSUMOGUI
165Simulation::step(
const double time) {
…}
189Simulation::executeMove() {
189Simulation::executeMove() {
…}
195Simulation::close(
const std::string& reason) {
198#ifdef HAVE_LIBSUMOGUI
199 !GUI::close(reason) &&
195Simulation::close(
const std::string& reason) {
…}
210Simulation::subscribe(
const std::vector<int>& varIDs,
double begin,
double end,
const libsumo::TraCIResults& parameters) {
210Simulation::subscribe(
const std::vector<int>& varIDs,
double begin,
double end,
const libsumo::TraCIResults& parameters) {
…}
216Simulation::getSubscriptionResults() {
217 return mySubscriptionResults[
""];
216Simulation::getSubscriptionResults() {
…}
224std::pair<int, std::string>
225Simulation::getVersion() {
225Simulation::getVersion() {
…}
231Simulation::getOption(
const std::string& option) {
234 throw TraCIException(
"The option " + option +
" is unknown.");
231Simulation::getOption(
const std::string& option) {
…}
241Simulation::getCurrentTime() {
241Simulation::getCurrentTime() {
…}
247Simulation::getTime() {
247Simulation::getTime() {
…}
252Simulation::getEndTime() {
252Simulation::getEndTime() {
…}
258Simulation::getLoadedNumber() {
258Simulation::getLoadedNumber() {
…}
263std::vector<std::string>
264Simulation::getLoadedIDList() {
264Simulation::getLoadedIDList() {
…}
270Simulation::getDepartedNumber() {
270Simulation::getDepartedNumber() {
…}
275std::vector<std::string>
276Simulation::getDepartedIDList() {
276Simulation::getDepartedIDList() {
…}
282Simulation::getArrivedNumber() {
282Simulation::getArrivedNumber() {
…}
287std::vector<std::string>
288Simulation::getArrivedIDList() {
288Simulation::getArrivedIDList() {
…}
294Simulation::getParkingStartingVehiclesNumber() {
294Simulation::getParkingStartingVehiclesNumber() {
…}
299std::vector<std::string>
300Simulation::getParkingStartingVehiclesIDList() {
300Simulation::getParkingStartingVehiclesIDList() {
…}
306Simulation::getParkingEndingVehiclesNumber() {
306Simulation::getParkingEndingVehiclesNumber() {
…}
311std::vector<std::string>
312Simulation::getParkingEndingVehiclesIDList() {
312Simulation::getParkingEndingVehiclesIDList() {
…}
318Simulation::getStopStartingVehiclesNumber() {
318Simulation::getStopStartingVehiclesNumber() {
…}
323std::vector<std::string>
324Simulation::getStopStartingVehiclesIDList() {
324Simulation::getStopStartingVehiclesIDList() {
…}
330Simulation::getStopEndingVehiclesNumber() {
330Simulation::getStopEndingVehiclesNumber() {
…}
335std::vector<std::string>
336Simulation::getStopEndingVehiclesIDList() {
336Simulation::getStopEndingVehiclesIDList() {
…}
342Simulation::getCollidingVehiclesNumber() {
342Simulation::getCollidingVehiclesNumber() {
…}
347std::vector<std::string>
348Simulation::getCollidingVehiclesIDList() {
348Simulation::getCollidingVehiclesIDList() {
…}
354Simulation::getEmergencyStoppingVehiclesNumber() {
354Simulation::getEmergencyStoppingVehiclesNumber() {
…}
359std::vector<std::string>
360Simulation::getEmergencyStoppingVehiclesIDList() {
360Simulation::getEmergencyStoppingVehiclesIDList() {
…}
366Simulation::getStartingTeleportNumber() {
366Simulation::getStartingTeleportNumber() {
…}
371std::vector<std::string>
372Simulation::getStartingTeleportIDList() {
372Simulation::getStartingTeleportIDList() {
…}
378Simulation::getEndingTeleportNumber() {
378Simulation::getEndingTeleportNumber() {
…}
383std::vector<std::string>
384Simulation::getEndingTeleportIDList() {
384Simulation::getEndingTeleportIDList() {
…}
389Simulation::getDepartedPersonNumber() {
389Simulation::getDepartedPersonNumber() {
…}
394std::vector<std::string>
395Simulation::getDepartedPersonIDList() {
395Simulation::getDepartedPersonIDList() {
…}
401Simulation::getArrivedPersonNumber() {
401Simulation::getArrivedPersonNumber() {
…}
406std::vector<std::string>
407Simulation::getArrivedPersonIDList() {
407Simulation::getArrivedPersonIDList() {
…}
411std::vector<std::string>
412Simulation::getBusStopIDList() {
413 std::vector<std::string> result;
415 result.push_back(pair.first);
412Simulation::getBusStopIDList() {
…}
421Simulation::getBusStopWaiting(
const std::string& stopID) {
424 throw TraCIException(
"Unknown bus stop '" + stopID +
"'.");
421Simulation::getBusStopWaiting(
const std::string& stopID) {
…}
429std::vector<std::string>
430Simulation::getBusStopWaitingIDList(
const std::string& stopID) {
433 throw TraCIException(
"Unknown bus stop '" + stopID +
"'.");
435 std::vector<std::string> result;
437 result.push_back(t->getID());
430Simulation::getBusStopWaitingIDList(
const std::string& stopID) {
…}
443std::vector<std::string>
444Simulation::getPendingVehicles() {
445 std::vector<std::string> result;
447 result.push_back(veh->getID());
444Simulation::getPendingVehicles() {
…}
453std::vector<libsumo::TraCICollision>
454Simulation::getCollisions() {
455 std::vector<libsumo::TraCICollision> result;
466 c2.
lane = c.lane->getID();
468 result.push_back(c2);
454Simulation::getCollisions() {
…}
475Simulation::getScale() {
475Simulation::getScale() {
…}
480Simulation::getDeltaT() {
480Simulation::getDeltaT() {
…}
486Simulation::getNetBoundary() {
488 TraCIPositionVector tb;
497 tb.value.push_back(minV);
498 tb.value.push_back(maxV);
486Simulation::getNetBoundary() {
…}
504Simulation::getMinExpectedNumber() {
504Simulation::getMinExpectedNumber() {
…}
515Simulation::convert2D(
const std::string& edgeID,
double pos,
int laneIndex,
bool toGeo) {
515Simulation::convert2D(
const std::string& edgeID,
double pos,
int laneIndex,
bool toGeo) {
…}
526Simulation::convert3D(
const std::string& edgeID,
double pos,
int laneIndex,
bool toGeo) {
526Simulation::convert3D(
const std::string& edgeID,
double pos,
int laneIndex,
bool toGeo) {
…}
536Simulation::convertRoad(
double x,
double y,
bool isGeo,
const std::string& vClass) {
542 throw TraCIException(
"Unknown vehicle class '" + vClass +
"'.");
546 if (roadPos.first ==
nullptr) {
547 throw TraCIException(
"Cannot convert position to road.");
549 TraCIRoadPosition result;
550 result.edgeID = roadPos.first->getEdge().getID();
551 result.laneIndex = roadPos.first->getIndex();
552 result.pos = roadPos.second;
536Simulation::convertRoad(
double x,
double y,
bool isGeo,
const std::string& vClass) {
…}
558Simulation::convertGeo(
double x,
double y,
bool fromGeo) {
558Simulation::convertGeo(
double x,
double y,
bool fromGeo) {
…}
570Simulation::getDistance2D(
double x1,
double y1,
double x2,
double y2,
bool isGeo,
bool isDriving) {
570Simulation::getDistance2D(
double x1,
double y1,
double x2,
double y2,
bool isGeo,
bool isDriving) {
…}
588Simulation::getDistanceRoad(
const std::string& edgeID1,
double pos1,
const std::string& edgeID2,
double pos2,
bool isDriving) {
594 const Position p1 = roadPos1.first->geometryPositionAtOffset(roadPos1.second);
595 const Position p2 = roadPos2.first->geometryPositionAtOffset(roadPos2.second);
588Simulation::getDistanceRoad(
const std::string& edgeID1,
double pos1,
const std::string& edgeID2,
double pos2,
bool isDriving) {
…}
602Simulation::findRoute(
const std::string& from,
const std::string& to,
const std::string& typeID,
const double depart,
const int routingMode) {
605 if (fromEdge ==
nullptr) {
606 throw TraCIException(
"Unknown from edge '" + from +
"'.");
609 if (toEdge ==
nullptr) {
610 throw TraCIException(
"Unknown to edge '" + to +
"'.");
614 if (type ==
nullptr) {
615 throw TraCIException(
"The vehicle type '" + typeID +
"' is not known.");
618 pars->
id =
"simulation.findRoute";
620 ConstMSRoutePtr const routeDummy = std::make_shared<MSRoute>(
"",
ConstMSEdgeVector({ fromEdge }),
false,
nullptr, std::vector<SUMOVehicleParameter::Stop>());
626 throw TraCIException(
"Invalid departure edge for vehicle type '" + type->
getID() +
"' (" + msg +
")");
632 throw TraCIException(
"Invalid departure edge for vehicle type '" + type->
getID() +
"' (" + e.what() +
")");
637 router.
compute(fromEdge, toEdge, vehicle, dep, edges);
638 for (
const MSEdge* e : edges) {
639 result.edges.push_back(e->getID());
641 result.travelTime = result.cost = router.
recomputeCosts(edges, vehicle, dep, &result.length);
642 if (vehicle !=
nullptr) {
602Simulation::findRoute(
const std::string& from,
const std::string& to,
const std::string& typeID,
const double depart,
const int routingMode) {
…}
650std::vector<TraCIStage>
651Simulation::findIntermodalRoute(
const std::string& from,
const std::string& to,
652 const std::string& modes,
double depart,
const int routingMode,
double speed,
double walkFactor,
653 double departPos,
double arrivalPos,
const double departPosLat,
654 const std::string& pType,
const std::string& vType,
const std::string& destStop) {
656 std::vector<TraCIStage> result;
658 if (fromEdge ==
nullptr) {
659 throw TraCIException(
"Unknown from edge '" + from +
"'.");
662 if (toEdge ==
nullptr) {
663 throw TraCIException(
"Unknown to edge '" + to +
"'.");
667 std::vector<SUMOVehicleParameter*> pars;
670 pars.back()->vtypeid = vType;
671 pars.back()->id = vType;
675 const std::string mode = st.next();
679 pars.back()->id = mode;
684 pars.back()->id = mode;
689 pars.back()->id = mode;
690 pars.back()->line = mode;
693 pars.push_back(
nullptr);
698 throw TraCIException(
"Unknown person mode '" + mode +
"'.");
702 pars.push_back(
nullptr);
713 if (walkFactor < 0) {
722 }
else if (arrivalPos < 0) {
725 if (departPos < 0 || departPos >= fromEdge->
getLength()) {
726 throw TraCIException(
"Invalid depart position " +
toString(departPos) +
" for edge '" + from +
"'.");
728 if (arrivalPos < 0 || arrivalPos >= toEdge->
getLength()) {
729 throw TraCIException(
"Invalid arrival position " +
toString(arrivalPos) +
" for edge '" + to +
"'.");
731 double minCost = std::numeric_limits<double>::max();
734 std::vector<TraCIStage> resultCand;
736 if (vehPar !=
nullptr) {
739 if (type ==
nullptr) {
740 throw TraCIException(
"Unknown vehicle type '" + vehPar->vtypeid +
"'.");
743 WRITE_WARNINGF(
TL(
"Ignoring vehicle type '%' when performing intermodal routing because it is not allowed on the start edge '%'."), type->
getID(), from);
745 ConstMSRoutePtr const routeDummy = std::make_shared<MSRoute>(vehPar->id,
ConstMSEdgeVector({ fromEdge }),
false,
nullptr, std::vector<SUMOVehicleParameter::Stop>());
751 std::vector<MSTransportableRouter::TripItem> items;
752 if (router.
compute(fromEdge, toEdge, departPos,
"", arrivalPos, destStop,
753 speed * walkFactor, vehicle, modeSet, departStep, items, externalFactor)) {
755 for (std::vector<MSTransportableRouter::TripItem>::iterator it = items.begin(); it != items.end(); ++it) {
756 if (!it->edges.empty()) {
758 for (
const MSEdge* e : it->edges) {
759 resultCand.back().edges.push_back(e->getID());
761 resultCand.back().travelTime = it->traveltime;
762 resultCand.back().cost = it->cost;
763 resultCand.back().length = it->length;
764 resultCand.back().intended = it->intended;
765 resultCand.back().depart = it->depart;
766 resultCand.back().departPos = it->departPos;
767 resultCand.back().arrivalPos = it->arrivalPos;
768 resultCand.back().description = it->description;
772 if (cost < minCost) {
777 if (vehicle !=
nullptr) {
651Simulation::findIntermodalRoute(
const std::string& from,
const std::string& to, {
…}
787Simulation::getParameter(
const std::string& objectID,
const std::string& key) {
789 const std::string attrName = key.substr(16);
792 throw TraCIException(
"Invalid chargingStation '" + objectID +
"'");
798 }
else if (attrName ==
"lane") {
803 throw TraCIException(
"Invalid chargingStation parameter '" + attrName +
"'");
806 const std::string attrName = key.substr(16);
809 throw TraCIException(
"Invalid overhead wire '" + objectID +
"'");
816 throw TraCIException(
"Invalid overhead wire parameter '" + attrName +
"'");
819 const std::string attrName = key.substr(4);
823 throw TraCIException(
"Invalid net parameter '" + attrName +
"'");
826 if (objectID !=
"") {
827 throw TraCIException(
"Simulation parameter '" + key +
"' is not supported for object id '" + objectID +
"'. Use empty id for stats");
829 const std::string attrName = key.substr(6);
832 if (attrName ==
"vehicles.loaded") {
834 }
else if (attrName ==
"vehicles.inserted") {
836 }
else if (attrName ==
"vehicles.running") {
838 }
else if (attrName ==
"vehicles.waiting") {
840 }
else if (attrName ==
"teleports.total") {
842 }
else if (attrName ==
"teleports.jam") {
844 }
else if (attrName ==
"teleports.yield") {
846 }
else if (attrName ==
"teleports.wrongLane") {
848 }
else if (attrName ==
"safety.collisions") {
850 }
else if (attrName ==
"safety.emergencyStops") {
852 }
else if (attrName ==
"safety.emergencyBraking") {
854 }
else if (attrName ==
"persons.loaded") {
856 }
else if (attrName ==
"persons.running") {
858 }
else if (attrName ==
"persons.jammed") {
860 }
else if (attrName ==
"personTeleports.total") {
862 }
else if (attrName ==
"personTeleports.abortWait") {
864 }
else if (attrName ==
"personTeleports.wrongDest") {
867 throw TraCIException(
"Invalid stats parameter '" + attrName +
"'");
870 const std::string attrName = key.substr(12);
873 throw TraCIException(
"Invalid parkingArea '" + objectID +
"'");
875 if (attrName ==
"capacity") {
877 }
else if (attrName ==
"occupancy") {
881 }
else if (attrName ==
"lane") {
886 throw TraCIException(
"Invalid parkingArea parameter '" + attrName +
"'");
889 const std::string attrName = key.substr(8);
892 throw TraCIException(
"Invalid busStop '" + objectID +
"'");
896 }
else if (attrName ==
"lane") {
901 throw TraCIException(
"Invalid busStop parameter '" + attrName +
"'");
904 if (objectID !=
"") {
905 throw TraCIException(
"Simulation parameter '" + key +
"' is not supported for object id '" + objectID
906 +
"'. Use empty id for global device parameers or vehicle domain for vehicle specific parameters");
908 const std::string attrName = key.substr(16);
910 }
else if (objectID ==
"") {
913 throw TraCIException(
"Simulation parameter '" + key +
"' is not supported for object id '" + objectID +
"'. Use empty id for generic network parameters");
787Simulation::getParameter(
const std::string& objectID,
const std::string& key) {
…}
920Simulation::setParameter(
const std::string& objectID,
const std::string& key,
const std::string& value) {
921 if (objectID ==
"") {
924 throw TraCIException(
"Setting simulation parameter '" + key +
"' is not supported for object id '" + objectID +
"'. Use empty id for generic network parameters");
920Simulation::setParameter(
const std::string& objectID,
const std::string& key,
const std::string& value) {
…}
929Simulation::setScale(
double value) {
929Simulation::setScale(
double value) {
…}
934Simulation::clearPending(
const std::string& routeID) {
934Simulation::clearPending(
const std::string& routeID) {
…}
940Simulation::saveState(
const std::string& fileName) {
940Simulation::saveState(
const std::string& fileName) {
…}
945Simulation::loadState(
const std::string& fileName) {
954 throw TraCIException(
"Loading state from '" + fileName +
"' failed. " + e.what());
956 throw TraCIException(
"Loading state from '" + fileName +
"' failed, check whether SUMO versions match. " + e.what());
945Simulation::loadState(
const std::string& fileName) {
…}
961Simulation::writeMessage(
const std::string& msg) {
961Simulation::writeMessage(
const std::string& msg) {
…}
972std::shared_ptr<VariableWrapper>
973Simulation::makeWrapper() {
974 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
973Simulation::makeWrapper() {
…}
979Simulation::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
982 return wrapper->wrapDouble(objID, variable, getTime());
984 return wrapper->wrapInt(objID, variable, (
int)getCurrentTime());
986 return wrapper->wrapDouble(objID, variable, getEndTime());
988 return wrapper->wrapInt(objID, variable, getLoadedNumber());
990 return wrapper->wrapStringList(objID, variable, getLoadedIDList());
992 return wrapper->wrapInt(objID, variable, getDepartedNumber());
994 return wrapper->wrapStringList(objID, variable, getDepartedIDList());
996 return wrapper->wrapInt(objID, variable, getStartingTeleportNumber());
998 return wrapper->wrapStringList(objID, variable, getStartingTeleportIDList());
1000 return wrapper->wrapInt(objID, variable, getEndingTeleportNumber());
1002 return wrapper->wrapStringList(objID, variable, getEndingTeleportIDList());
1004 return wrapper->wrapInt(objID, variable, getArrivedNumber());
1006 return wrapper->wrapStringList(objID, variable, getArrivedIDList());
1008 return wrapper->wrapInt(objID, variable, getParkingStartingVehiclesNumber());
1010 return wrapper->wrapStringList(objID, variable, getParkingStartingVehiclesIDList());
1012 return wrapper->wrapInt(objID, variable, getParkingEndingVehiclesNumber());
1014 return wrapper->wrapStringList(objID, variable, getParkingEndingVehiclesIDList());
1016 return wrapper->wrapInt(objID, variable, getStopStartingVehiclesNumber());
1018 return wrapper->wrapStringList(objID, variable, getStopStartingVehiclesIDList());
1020 return wrapper->wrapInt(objID, variable, getStopEndingVehiclesNumber());
1022 return wrapper->wrapStringList(objID, variable, getStopEndingVehiclesIDList());
1024 return wrapper->wrapInt(objID, variable, getCollidingVehiclesNumber());
1026 return wrapper->wrapStringList(objID, variable, getCollidingVehiclesIDList());
1028 return wrapper->wrapInt(objID, variable, getEmergencyStoppingVehiclesNumber());
1030 return wrapper->wrapStringList(objID, variable, getEmergencyStoppingVehiclesIDList());
1032 return wrapper->wrapInt(objID, variable, getDepartedPersonNumber());
1034 return wrapper->wrapStringList(objID, variable, getDepartedPersonIDList());
1036 return wrapper->wrapInt(objID, variable, getArrivedPersonNumber());
1038 return wrapper->wrapStringList(objID, variable, getArrivedPersonIDList());
1040 return wrapper->wrapDouble(objID, variable, getScale());
1042 return wrapper->wrapDouble(objID, variable, getDeltaT());
1044 return wrapper->wrapString(objID, variable, getOption(objID));
1046 return wrapper->wrapInt(objID, variable, getMinExpectedNumber());
1048 return wrapper->wrapStringList(objID, variable, getBusStopIDList());
1050 return wrapper->wrapInt(objID, variable, getBusStopWaiting(objID));
1052 return wrapper->wrapStringList(objID, variable, getBusStopWaitingIDList(objID));
1054 return wrapper->wrapStringList(objID, variable, getPendingVehicles());
979Simulation::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
…}
std::vector< const MSEdge * > ConstMSEdgeVector
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGEF(...)
#define WRITE_MESSAGE(msg)
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
#define PROGRESS_TIME_MESSAGE(before)
std::shared_ptr< const MSRoute > ConstMSRoutePtr
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_TAXITYPE_ID
const std::string DEFAULT_PEDTYPE_ID
const std::string DEFAULT_VTYPE_ID
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_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_TOTALENERGYCHARGED
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
A class that stores a 2D geometrical boundary.
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
PositionVector getShape(const bool closeShape) const
get position vector (shape) based on this boundary
double zmin() const
Returns minimum z-coordinate.
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
double zmax() const
Returns maximum z-coordinate.
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 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.
The base class for microscopic and mesoscopic vehicles.
void setChosenSpeedFactor(const double factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
void setRoutingMode(int value)
Sets routing behavior.
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
virtual bool hasValidRouteStart(std::string &msg)
checks wether the vehicle can depart on the first edge
double getTotalCharged() const
static bool hasServableReservations()
check whether there are still (servable) reservations in the system
static std::string getGlobalParameter(const std::string &prefixedKey)
try to retrieve the given parameter from the global statistics. Throw exception for unsupported key
A road/street connecting two junctions.
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
double getLength() const
return the length of the edge
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....
const MSVehicleContainer::VehicleVector & getPendingVehicles() const
retrieve vehicles waiting for insertion
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
The simulated network and simulation perfomer.
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
@ 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).
const CollisionMap & getCollisions() const
virtual MSTransportableControl & getContainerControl()
Returns the container control.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static bool hasInstance()
Returns whether the network was already constructed.
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
void simulationStep(const bool onlyMove=false)
Performs a single simulation step.
MSTransportableRouter & getIntermodalRouter(int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
bool hasContainers() const
Returns whether containers are simulated.
bool hasPersons() const
Returns whether persons are simulated.
@ 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.
MSVehicleRouter & getRouterTT(int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition of overhead wire segment.
double getTotalCharged() const
A lane area vehicles can halt at.
int getCapacity() const
Returns the area capacity.
int getOccupancyIncludingBlocked() const
Returns the area occupancy.
static MSVehicleRouter & getRouterTT(const int rngIndex, SUMOVehicleClass svc, const MSEdgeVector &prohibited=MSEdgeVector())
return the vehicle 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 transportables 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 getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
int getTeleportCount() const
Returns the number of teleports transportables did.
int getLoadedNumber() const
Returns the number of build transportables.
int getTeleportsWrongDest() const
return the number of teleports of transportables riding to the wrong destination
int getJammedNumber() const
Returns the number of times a transportables was jammed.
int getTeleportsAbortWait() const
return the number of teleports due to excessive waiting for a ride
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.
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
double getScale() const
sets the demand scaling factor
void setScale(double scale)
sets the demand scaling factor
int getLoadedVehicleNo() const
Returns the number of build vehicles.
int getCollisionCount() const
return the number of collisions
int getTeleportsWrongLane() const
return the number of teleports due to vehicles stuck on the wrong lane
int getTeleportsYield() const
return the number of teleports due to vehicles stuck on a minor road
int getEmergencyBrakingCount() const
return the number of emergency stops
int getEmergencyStops() const
return the number of emergency stops
void discountRoutingVehicle()
int getDepartedVehicleNo() const
Returns the number of inserted 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 ...
int getTeleportsJam() const
return the number of teleports due to jamming
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, ConstMSRoutePtr route, MSVehicleType *type, const bool ignoreStopErrors, const VehicleDefinitionSource source=ROUTEFILE, bool addRouteStops=true)
Builds a vehicle, increases the number of built vehicles.
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false, bool wasKept=false)
Deletes the vehicle.
int getTeleportCount() const
return the number of teleports (including collisions)
The car-following model and parameter.
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.
const Distribution_Parameterized & getSpeedFactor() const
Returns this type's speed factor.
const SUMOVTypeParameter & getParameter() const
static MSNet * init(const bool isLibsumo=false)
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
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.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
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.
A point in 2D or 3D with translation and scaling methods.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimensions
void setz(double z)
set position z
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 double recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
Representation of a vehicle.
virtual void setChosenSpeedFactor(const double factor)=0
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.
static double getDrivingDistance(std::pair< const MSLane *, double > &roadPos1, std::pair< const MSLane *, double > &roadPos2)
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
static void clearStateChanges()
static void subscribe(const int commandId, const std::string &id, const std::vector< int > &variables, const double beginTime, const double endTime, const libsumo::TraCIResults ¶ms, const int contextDomain=0, const double range=0.)
static const std::vector< std::string > & getTransportableStateChanges(const MSNet::TransportableState state)
static void clearSubscriptions()
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
static const std::vector< std::string > & getVehicleStateChanges(const MSNet::VehicleState state)
static void handleSubscriptions(const SUMOTime t)
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
static std::string readTypedString(tcpip::Storage &ret, const std::string &error="")
#define UNUSED_PARAMETER(x)
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
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_ARRIVED_PERSONS_IDS
TRACI_CONST int ROUTING_MODE_AGGREGATED
TRACI_CONST int VAR_PENDING_VEHICLES
TRACI_CONST int VAR_BUS_STOP_ID_LIST
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
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}
TRACI_CONST int VAR_OPTION
std::string lane
The lane where the collision happended.
std::string type
The type of collision.
std::string collider
The ids of the participating vehicles and persons.
double pos
The position of the collision along the lane.