61#include <arrow/util/config.h>
77FXMutex Simulation::myStepMutex;
84std::pair<int, std::string>
85Simulation::init(
int ,
int ,
const std::string& ,
const std::string& ,
FILE*
const ) {
86 throw TraCIException(
"Multi client support (including connection switching) is not implemented in libsumo.");
90std::pair<int, std::string>
91Simulation::start(
const std::vector<std::string>& cmd,
int ,
int ,
const std::string& ,
const bool ,
92 const std::string& ,
bool ,
void* ) {
94 if (GUI::start(cmd)) {
98 load(std::vector<std::string>(cmd.begin() + 1, cmd.end()));
104Simulation::isLibsumo() {
110Simulation::switchConnection(
const std::string& ) {
111 throw TraCIException(
"Multi client support (including connection switching) is not implemented in libsumo.");
116Simulation::getLabel() {
117 throw TraCIException(
"Multi client support (including connection switching) is not implemented in libsumo.");
122Simulation::setOrder(
int ) {
123 throw TraCIException(
"Multi client support (including connection switching) is not implemented in libsumo.");
128Simulation::load(
const std::vector<std::string>& args) {
129#ifdef HAVE_LIBSUMOGUI
130 if (GUI::load(args)) {
134 close(
"Libsumo issued load command.");
146 throw TraCIException(e.what());
152Simulation::hasGUI() {
153#ifdef HAVE_LIBSUMOGUI
154 return GUI::hasInstance();
162Simulation::isLoaded() {
168Simulation::step(
const double time) {
170 FXMutexLock lock(myStepMutex);
174#ifdef HAVE_LIBSUMOGUI
184#ifdef HAVE_LIBSUMOGUI
192Simulation::executeMove() {
198Simulation::close(
const std::string& reason) {
201#ifdef HAVE_LIBSUMOGUI
202 !GUI::close(reason) &&
213Simulation::subscribe(
const std::vector<int>& varIDs,
double begin,
double end,
const libsumo::TraCIResults& parameters) {
219Simulation::getSubscriptionResults() {
220 return mySubscriptionResults[
""];
227std::pair<int, std::string>
228Simulation::getVersion() {
234Simulation::getOption(
const std::string& option) {
237 throw TraCIException(
"The option " + option +
" is unknown.");
244Simulation::getCurrentTime() {
250Simulation::getTime() {
255Simulation::getEndTime() {
261Simulation::getLoadedNumber() {
266std::vector<std::string>
267Simulation::getLoadedIDList() {
273Simulation::getDepartedNumber() {
278std::vector<std::string>
279Simulation::getDepartedIDList() {
285Simulation::getArrivedNumber() {
290std::vector<std::string>
291Simulation::getArrivedIDList() {
297Simulation::getParkingStartingVehiclesNumber() {
302std::vector<std::string>
303Simulation::getParkingStartingVehiclesIDList() {
309Simulation::getParkingEndingVehiclesNumber() {
314std::vector<std::string>
315Simulation::getParkingEndingVehiclesIDList() {
321Simulation::getStopStartingVehiclesNumber() {
326std::vector<std::string>
327Simulation::getStopStartingVehiclesIDList() {
333Simulation::getStopEndingVehiclesNumber() {
338std::vector<std::string>
339Simulation::getStopEndingVehiclesIDList() {
345Simulation::getCollidingVehiclesNumber() {
350std::vector<std::string>
351Simulation::getCollidingVehiclesIDList() {
357Simulation::getEmergencyStoppingVehiclesNumber() {
362std::vector<std::string>
363Simulation::getEmergencyStoppingVehiclesIDList() {
369Simulation::getStartingTeleportNumber() {
374std::vector<std::string>
375Simulation::getStartingTeleportIDList() {
381Simulation::getEndingTeleportNumber() {
386std::vector<std::string>
387Simulation::getEndingTeleportIDList() {
392Simulation::getDepartedPersonNumber() {
397std::vector<std::string>
398Simulation::getDepartedPersonIDList() {
404Simulation::getArrivedPersonNumber() {
409std::vector<std::string>
410Simulation::getArrivedPersonIDList() {
414std::vector<std::string>
415Simulation::getBusStopIDList() {
416 std::vector<std::string> result;
418 result.push_back(pair.first);
424Simulation::getBusStopWaiting(
const std::string& stopID) {
427 throw TraCIException(
"Unknown bus stop '" + stopID +
"'.");
432std::vector<std::string>
433Simulation::getBusStopWaitingIDList(
const std::string& stopID) {
436 throw TraCIException(
"Unknown bus stop '" + stopID +
"'.");
438 std::vector<std::string> result;
440 result.push_back(t->getID());
446std::vector<std::string>
447Simulation::getPendingVehicles() {
448 std::vector<std::string> result;
450 result.push_back(veh->getID());
456std::vector<libsumo::TraCICollision>
457Simulation::getCollisions() {
458 std::vector<libsumo::TraCICollision> result;
469 c2.
lane = c.lane->getID();
471 result.push_back(c2);
478Simulation::getScale() {
483Simulation::getDeltaT() {
489Simulation::getNetBoundary() {
491 TraCIPositionVector tb;
500 tb.value.push_back(minV);
501 tb.value.push_back(maxV);
507Simulation::getMinExpectedNumber() {
518Simulation::convert2D(
const std::string& edgeID,
double pos,
int laneIndex,
bool toGeo) {
529Simulation::convert3D(
const std::string& edgeID,
double pos,
int laneIndex,
bool toGeo) {
539Simulation::convertRoad(
double x,
double y,
bool isGeo,
const std::string& vClass) {
545 throw TraCIException(
"Unknown vehicle class '" + vClass +
"'.");
549 if (roadPos.first ==
nullptr) {
550 throw TraCIException(
"Cannot convert position to road.");
552 TraCIRoadPosition result;
553 result.edgeID = roadPos.first->getEdge().getID();
554 result.laneIndex = roadPos.first->getIndex();
555 result.pos = roadPos.second;
561Simulation::convertGeo(
double x,
double y,
bool fromGeo) {
573Simulation::getDistance2D(
double x1,
double y1,
double x2,
double y2,
bool isGeo,
bool isDriving) {
591Simulation::getDistanceRoad(
const std::string& edgeID1,
double pos1,
const std::string& edgeID2,
double pos2,
bool isDriving) {
597 const Position p1 = roadPos1.first->geometryPositionAtOffset(roadPos1.second);
598 const Position p2 = roadPos2.first->geometryPositionAtOffset(roadPos2.second);
605Simulation::findRoute(
const std::string& from,
const std::string& to,
const std::string& typeID,
606 double depart,
int routingMode,
double departPos,
double arrivalPos) {
609 if (fromEdge ==
nullptr) {
610 throw TraCIException(
"Unknown from edge '" + from +
"'.");
613 if (toEdge ==
nullptr) {
614 throw TraCIException(
"Unknown to edge '" + to +
"'.");
618 if (type ==
nullptr) {
619 throw TraCIException(
"The vehicle type '" + typeID +
"' is not known.");
622 pars->
id =
"simulation.findRoute";
630 throw TraCIException(
"Invalid departure edge for vehicle type '" + type->
getID() +
"' (" + msg +
")");
636 throw TraCIException(
"Invalid departure edge for vehicle type '" + type->
getID() +
"' (" + e.what() +
")");
638 if (abs(departPos) > fromEdge->
getLength()) {
639 throw TraCIException(
"Invalid departPos " +
toString(departPos) +
" on edge '" + fromEdge->
getID() +
" (length " +
toString(fromEdge->
getLength()) +
")");
647 if (abs(arrivalPos) > toEdge->
getLength()) {
648 throw TraCIException(
"Invalid arrivalPos " +
toString(arrivalPos) +
" on edge '" + toEdge->
getID() +
" (length " +
toString(toEdge->
getLength()) +
")");
650 if (arrivalPos < 0) {
656 router.
compute(fromEdge, departPos, toEdge, arrivalPos, vehicle, dep, edges);
657 for (
const MSEdge* e : edges) {
658 result.edges.push_back(e->getID());
660 result.travelTime = result.cost = router.
recomputeCostsPos(edges, vehicle, departPos, arrivalPos, dep, &result.length);
661 result.arrivalPos = arrivalPos;
662 result.departPos = departPos;
663 if (vehicle !=
nullptr) {
671std::vector<TraCIStage>
672Simulation::findIntermodalRoute(
const std::string& from,
const std::string& to,
673 const std::string& modes,
double depart,
const int routingMode,
double speed,
double walkFactor,
674 double departPos,
double arrivalPos,
const double departPosLat,
675 const std::string& pType,
const std::string& vType,
const std::string& destStop) {
677 std::vector<TraCIStage> result;
679 if (fromEdge ==
nullptr) {
680 throw TraCIException(
"Unknown from edge '" + from +
"'.");
683 if (toEdge ==
nullptr) {
684 throw TraCIException(
"Unknown to edge '" + to +
"'.");
688 std::vector<SUMOVehicleParameter*> pars;
691 pars.back()->vtypeid = vType;
692 pars.back()->id = vType;
696 const std::string mode = st.next();
700 pars.back()->id = mode;
705 pars.back()->id = mode;
710 pars.back()->id = mode;
711 pars.back()->line = mode;
714 pars.push_back(
nullptr);
719 throw TraCIException(
"Unknown person mode '" + mode +
"'.");
723 pars.push_back(
nullptr);
734 if (walkFactor < 0) {
743 }
else if (arrivalPos < 0) {
746 if (departPos < 0 || departPos >= fromEdge->
getLength()) {
747 throw TraCIException(
"Invalid depart position " +
toString(departPos) +
" for edge '" + from +
"'.");
749 if (arrivalPos < 0 || arrivalPos >= toEdge->
getLength()) {
750 throw TraCIException(
"Invalid arrival position " +
toString(arrivalPos) +
" for edge '" + to +
"'.");
752 double minCost = std::numeric_limits<double>::max();
755 std::vector<TraCIStage> resultCand;
757 if (vehPar !=
nullptr) {
760 if (type ==
nullptr) {
761 throw TraCIException(
"Unknown vehicle type '" + vehPar->vtypeid +
"'.");
764 WRITE_WARNINGF(
TL(
"Ignoring vehicle type '%' when performing intermodal routing because it is not allowed on the start edge '%'."), type->
getID(), from);
772 std::vector<MSTransportableRouter::TripItem> items;
773 if (router.
compute(fromEdge, toEdge, departPos,
"", arrivalPos, destStop,
774 speed * walkFactor, vehicle, pedType->
getParameter(), modeSet, departStep, items, externalFactor)) {
776 for (std::vector<MSTransportableRouter::TripItem>::iterator it = items.begin(); it != items.end(); ++it) {
777 if (!it->edges.empty()) {
779 for (
const MSEdge* e : it->edges) {
780 resultCand.back().edges.push_back(e->getID());
782 resultCand.back().travelTime = it->traveltime;
783 resultCand.back().cost = it->cost;
784 resultCand.back().length = it->length;
785 resultCand.back().intended = it->intended;
786 resultCand.back().depart = it->depart;
787 resultCand.back().departPos = it->departPos;
788 resultCand.back().arrivalPos = it->arrivalPos;
789 resultCand.back().description = it->description;
793 if (cost < minCost) {
798 if (vehicle !=
nullptr) {
808Simulation::getParameter(
const std::string& objectID,
const std::string& key) {
810 WRITE_WARNING(
"Retrieving chargingStation parameters via the simulation API is deprecated, please use traci.chargingstation.");
811 const std::string attrName = key.substr(16);
814 throw TraCIException(
"Invalid chargingStation '" + objectID +
"'");
820 }
else if (attrName ==
"lane") {
825 throw TraCIException(
"Invalid chargingStation parameter '" + attrName +
"'");
828 WRITE_WARNING(
"Retrieving overheadWire parameters via the simulation API is deprecated, please use traci.overheadwire.");
829 const std::string attrName = key.substr(16);
832 throw TraCIException(
"Invalid overhead wire '" + objectID +
"'");
839 throw TraCIException(
"Invalid overhead wire parameter '" + attrName +
"'");
842 const std::string attrName = key.substr(4);
846 throw TraCIException(
"Invalid net parameter '" + attrName +
"'");
849 if (objectID !=
"") {
850 throw TraCIException(
"Simulation parameter '" + key +
"' is not supported for object id '" + objectID +
"'. Use empty id for stats");
852 const std::string attrName = key.substr(6);
855 if (attrName ==
"vehicles.loaded") {
857 }
else if (attrName ==
"vehicles.inserted") {
859 }
else if (attrName ==
"vehicles.running") {
861 }
else if (attrName ==
"vehicles.waiting") {
863 }
else if (attrName ==
"teleports.total") {
865 }
else if (attrName ==
"teleports.jam") {
867 }
else if (attrName ==
"teleports.yield") {
869 }
else if (attrName ==
"teleports.wrongLane") {
871 }
else if (attrName ==
"safety.collisions") {
873 }
else if (attrName ==
"safety.emergencyStops") {
875 }
else if (attrName ==
"safety.emergencyBraking") {
877 }
else if (attrName ==
"persons.loaded") {
879 }
else if (attrName ==
"persons.running") {
881 }
else if (attrName ==
"persons.jammed") {
883 }
else if (attrName ==
"personTeleports.total") {
885 }
else if (attrName ==
"personTeleports.abortWait") {
887 }
else if (attrName ==
"personTeleports.wrongDest") {
890 throw TraCIException(
"Invalid stats parameter '" + attrName +
"'");
893 WRITE_WARNING(
"Retrieving parkingArea parameters via the simulation API is deprecated, please use traci.parkingarea.");
894 const std::string attrName = key.substr(12);
897 throw TraCIException(
"Invalid parkingArea '" + objectID +
"'");
899 if (attrName ==
"capacity") {
901 }
else if (attrName ==
"occupancy") {
905 }
else if (attrName ==
"lane") {
910 throw TraCIException(
"Invalid parkingArea parameter '" + attrName +
"'");
913 WRITE_WARNING(
"Retrieving busStop parameters via the simulation API is deprecated, please use traci.busstop.");
914 const std::string attrName = key.substr(8);
917 throw TraCIException(
"Invalid busStop '" + objectID +
"'");
921 }
else if (attrName ==
"lane") {
926 throw TraCIException(
"Invalid busStop parameter '" + attrName +
"'");
929 if (objectID !=
"") {
930 throw TraCIException(
"Simulation parameter '" + key +
"' is not supported for object id '" + objectID
931 +
"'. Use empty id for global device parameters or vehicle domain for vehicle specific parameters");
933 const std::string attrName = key.substr(16);
936 if (objectID !=
"") {
937 throw TraCIException(
"Simulation parameter '" + key +
"' is not supported for object id '" + objectID
938 +
"'. Use an empty id for buildConfig parameters");
940 if (key ==
"buildConfig.ARROW_SO_VERSION") {
942 return ARROW_SO_VERSION;
946 }
else if (key ==
"buildConfig.JPS_VERSION") {
952 }
else if (key ==
"buildConfig.ENABLED") {
955 throw TraCIException(
"Unknown parameter '" + key +
"'");
956 }
else if (objectID ==
"") {
959 throw TraCIException(
"Simulation parameter '" + key +
"' is not supported for object id '" + objectID +
"'. Use empty id for generic network parameters");
966Simulation::setParameter(
const std::string& objectID,
const std::string& key,
const std::string& value) {
967 if (objectID ==
"") {
970 throw TraCIException(
"Setting simulation parameter '" + key +
"' is not supported for object id '" + objectID +
"'. Use empty id for generic network parameters");
975Simulation::setScale(
double value) {
980Simulation::clearPending(
const std::string& routeID) {
986Simulation::saveState(
const std::string& fileName) {
991Simulation::loadState(
const std::string& fileName) {
1000 throw TraCIException(
"Loading state from '" + fileName +
"' failed. " + e.what());
1002 throw TraCIException(
"Loading state from '" + fileName +
"' failed, check whether SUMO versions match. " + e.what());
1007Simulation::writeMessage(
const std::string& msg) {
1018std::shared_ptr<VariableWrapper>
1019Simulation::makeWrapper() {
1020 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
1025Simulation::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
1028 return wrapper->wrapDouble(objID, variable, getTime());
1030 return wrapper->wrapInt(objID, variable, (
int)getCurrentTime());
1032 return wrapper->wrapDouble(objID, variable, getEndTime());
1034 return wrapper->wrapInt(objID, variable, getLoadedNumber());
1036 return wrapper->wrapStringList(objID, variable, getLoadedIDList());
1038 return wrapper->wrapInt(objID, variable, getDepartedNumber());
1040 return wrapper->wrapStringList(objID, variable, getDepartedIDList());
1042 return wrapper->wrapInt(objID, variable, getStartingTeleportNumber());
1044 return wrapper->wrapStringList(objID, variable, getStartingTeleportIDList());
1046 return wrapper->wrapInt(objID, variable, getEndingTeleportNumber());
1048 return wrapper->wrapStringList(objID, variable, getEndingTeleportIDList());
1050 return wrapper->wrapInt(objID, variable, getArrivedNumber());
1052 return wrapper->wrapStringList(objID, variable, getArrivedIDList());
1054 return wrapper->wrapInt(objID, variable, getParkingStartingVehiclesNumber());
1056 return wrapper->wrapStringList(objID, variable, getParkingStartingVehiclesIDList());
1058 return wrapper->wrapInt(objID, variable, getParkingEndingVehiclesNumber());
1060 return wrapper->wrapStringList(objID, variable, getParkingEndingVehiclesIDList());
1062 return wrapper->wrapInt(objID, variable, getStopStartingVehiclesNumber());
1064 return wrapper->wrapStringList(objID, variable, getStopStartingVehiclesIDList());
1066 return wrapper->wrapInt(objID, variable, getStopEndingVehiclesNumber());
1068 return wrapper->wrapStringList(objID, variable, getStopEndingVehiclesIDList());
1070 return wrapper->wrapInt(objID, variable, getCollidingVehiclesNumber());
1072 return wrapper->wrapStringList(objID, variable, getCollidingVehiclesIDList());
1074 return wrapper->wrapInt(objID, variable, getEmergencyStoppingVehiclesNumber());
1076 return wrapper->wrapStringList(objID, variable, getEmergencyStoppingVehiclesIDList());
1078 return wrapper->wrapInt(objID, variable, getDepartedPersonNumber());
1080 return wrapper->wrapStringList(objID, variable, getDepartedPersonIDList());
1082 return wrapper->wrapInt(objID, variable, getArrivedPersonNumber());
1084 return wrapper->wrapStringList(objID, variable, getArrivedPersonIDList());
1086 return wrapper->wrapDouble(objID, variable, getScale());
1088 return wrapper->wrapDouble(objID, variable, getDeltaT());
1090 return wrapper->wrapString(objID, variable, getOption(objID));
1092 return wrapper->wrapInt(objID, variable, getMinExpectedNumber());
1094 return wrapper->wrapStringList(objID, variable, getBusStopIDList());
1096 return wrapper->wrapInt(objID, variable, getBusStopWaiting(objID));
1098 return wrapper->wrapStringList(objID, variable, getBusStopWaitingIDList(objID));
1100 return wrapper->wrapStringList(objID, variable, getPendingVehicles());
std::vector< const MSEdge * > ConstMSEdgeVector
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGEF(...)
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(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
std::vector< SUMOVehicleParameter::Stop > StopParVector
@ 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.
double getParameter(const int index) const
Returns the nth parameter 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 SUMOVTypeParameter &pars, 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
MSTransportableRouter & getIntermodalRouter(int rngIndex, const int routingMode=0, const Prohibitions &prohibited={}) const
virtual MSTransportableControl & getContainerControl()
Returns the container control.
MSVehicleRouter & getRouterTT(int rngIndex, const Prohibitions &prohibited={}) const
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.
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.
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 Prohibitions &prohibited={})
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...
double recomputeCostsPos(const std::vector< const E * > &edges, const V *const v, double fromPos, double toPos, 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.