138 std::vector<std::string>
150 std::vector<std::string>
162 std::vector<std::string>
174 std::vector<std::string>
186 std::vector<std::string>
198 std::vector<std::string>
210 std::vector<std::string>
222 std::vector<std::string>
234 std::vector<std::string>
246 std::vector<std::string>
258 std::vector<std::string>
263 std::vector<std::string>
265 std::vector<std::string> result;
267 result.push_back(pair.first);
281 std::vector<std::string>
285 std::vector<std::string> result;
286 for (std::vector<MSTransportable*>::iterator it = transportables.begin(); it != transportables.end(); it++) {
287 result.push_back((*it)->getID());
355 if (roadPos.first ==
nullptr) {
359 result.
edgeID = roadPos.first->getEdge().getID();
360 result.
laneIndex = roadPos.first->getIndex();
361 result.
pos = roadPos.second;
389 if ((roadPos1.first == roadPos2.first) && (roadPos1.second <= roadPos2.second)) {
391 return roadPos2.second - roadPos1.second;
393 double distance = 0.;
395 if (roadPos2.first->isInternal()) {
396 distance = roadPos2.second;
397 roadPos2.first = roadPos2.first->getLogicalPredecessorLane();
398 roadPos2.second = roadPos2.first->getLength();
402 MSRoute route(
"", newRoute,
false,
nullptr, std::vector<SUMOVehicleParameter::Stop>());
403 return distance + route.
getDistanceBetween(roadPos1.second, roadPos2.second, &roadPos1.first->getEdge(), &roadPos2.first->getEdge());
416 if ((roadPos1.first == roadPos2.first) && (roadPos1.second <= roadPos2.second)) {
418 return roadPos2.second - roadPos1.second;
420 double distance = 0.;
422 if (roadPos2.first->isInternal()) {
423 distance = roadPos2.second;
424 roadPos2.first = roadPos2.first->getLogicalPredecessorLane();
425 roadPos2.second = roadPos2.first->getLength();
429 MSRoute route(
"", newRoute,
false,
nullptr, std::vector<SUMOVehicleParameter::Stop>());
430 return distance + route.
getDistanceBetween(roadPos1.second, roadPos2.second, &roadPos1.first->getEdge(), &roadPos2.first->getEdge());
433 const Position pos1 = roadPos1.first->geometryPositionAtOffset(roadPos1.second);
434 const Position pos2 = roadPos2.first->geometryPositionAtOffset(roadPos2.second);
441 Simulation::findRoute(
const std::string& from,
const std::string& to,
const std::string& typeID,
const double depart,
const int routingMode) {
444 if (fromEdge ==
nullptr) {
448 if (toEdge ==
nullptr) {
455 if (type ==
nullptr) {
456 throw TraCIException(
"The vehicle type '" + typeID +
"' is not known.");
464 throw TraCIException(
"Invalid departure edge for vehicle type '" + typeID +
"' (" + e.what() +
")");
470 router.
compute(fromEdge, toEdge, vehicle, dep, edges);
471 for (
const MSEdge* e : edges) {
472 result.
edges.push_back(e->getID());
475 if (vehicle !=
nullptr) {
482 std::vector<TraCIStage>
484 const std::string& modes,
double depart,
const int routingMode,
double speed,
double walkFactor,
485 double departPos,
double arrivalPos,
const double departPosLat,
486 const std::string& pType,
const std::string& vType,
const std::string& destStop) {
488 std::vector<TraCIStage> result;
490 if (fromEdge ==
nullptr) {
494 if (toEdge ==
nullptr) {
499 std::vector<SUMOVehicleParameter*> pars;
502 pars.back()->vtypeid = vType;
503 pars.back()->id = vType;
507 const std::string mode = st.next();
511 pars.back()->id = mode;
516 pars.back()->id = mode;
519 pars.push_back(
nullptr);
528 pars.push_back(
nullptr);
539 if (walkFactor < 0) {
548 }
else if (arrivalPos < 0) {
551 if (departPos < 0 || departPos >= fromEdge->
getLength()) {
554 if (arrivalPos < 0 || arrivalPos >= toEdge->
getLength()) {
557 double minCost = std::numeric_limits<double>::max();
560 std::vector<TraCIStage> resultCand;
562 if (vehPar !=
nullptr) {
564 if (type ==
nullptr) {
565 throw TraCIException(
"Unknown vehicle type '" + vehPar->vtypeid +
"'.");
568 WRITE_WARNING(
"Ignoring vehicle type '" + type->
getID() +
"' when performing intermodal routing because it is not allowed on the start edge '" + from +
"'.");
576 std::vector<MSNet::MSIntermodalRouter::TripItem> items;
577 if (router.
compute(fromEdge, toEdge, departPos, arrivalPos, destStop,
578 speed * walkFactor, vehicle, modeSet, departStep, items, externalFactor)) {
580 for (std::vector<MSNet::MSIntermodalRouter::TripItem>::iterator it = items.begin(); it != items.end(); ++it) {
581 if (!it->edges.empty()) {
582 resultCand.push_back(
TraCIStage(it->line ==
"" 585 resultCand.back().vType = it->vType;
586 resultCand.back().line = it->line;
587 resultCand.back().destStop = it->destStop;
588 for (
const MSEdge* e : it->edges) {
589 resultCand.back().edges.push_back(e->
getID());
591 resultCand.back().travelTime = it->traveltime;
592 resultCand.back().cost = it->cost;
593 resultCand.back().length = it->length;
594 resultCand.back().intended = it->intended;
595 resultCand.back().depart = it->depart;
596 resultCand.back().departPos = it->departPos;
597 resultCand.back().arrivalPos = it->arrivalPos;
598 resultCand.back().description = it->description;
602 if (cost < minCost) {
607 if (vehicle !=
nullptr) {
618 const std::string attrName = key.substr(16);
621 throw TraCIException(
"Invalid chargingStation '" + objectID +
"'");
627 }
else if (attrName ==
"lane") {
632 throw TraCIException(
"Invalid chargingStation parameter '" + attrName +
"'");
635 const std::string attrName = key.substr(12);
640 if (attrName ==
"capacity") {
642 }
else if (attrName ==
"occupancy") {
646 }
else if (attrName ==
"lane") {
651 throw TraCIException(
"Invalid parkingArea parameter '" + attrName +
"'");
654 const std::string attrName = key.substr(8);
661 }
else if (attrName ==
"lane") {
666 throw TraCIException(
"Invalid busStop parameter '" + attrName +
"'");
669 throw TraCIException(
"Parameter '" + key +
"' is not supported.");
686 std::shared_ptr<VariableWrapper>
The vehicle has departed (was inserted into the network)
A lane area vehicles can halt at.
TRACI_CONST int VAR_MIN_EXPECTED_VEHICLES
bool compute(const E *from, const E *to, const double departPos, 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...
TRACI_CONST int VAR_PARKING_ENDING_VEHICLES_NUMBER
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
double ymin() const
Returns minimum y-coordinate.
static void init()
Initialises the xml-subsystem.
double xmax() const
Returns maximum x-coordinate.
static SubscriptionResults mySubscriptionResults
static int getStopStartingVehiclesNumber()
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
static void step(const double time=0.)
Advances by one step (or up to the given time)
bool hasPersons() const
Returns whether persons are simulated.
static void close()
Closes the xml-subsystem.
void clearPendingVehicles(const std::string &route)
clears out all pending vehicles from a route, "" for all routes
An edgeId, position and laneIndex.
TRACI_CONST int VAR_TIME_STEP
const Boundary & getConvBoundary() const
Returns the converted boundary.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static void clearVehicleStates()
static std::vector< std::string > getParkingEndingVehiclesIDList()
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
A lane area vehicles can halt at.
static void registerVehicleStateListener()
TRACI_CONST int VAR_STOP_ENDING_VEHICLES_NUMBER
static std::vector< TraCIStage > findIntermodalRoute(const std::string &fromEdge, const std::string &toEdge, const std::string &modes="", double depart=-1., const int routingMode=0, double speed=-1., double walkFactor=-1., double departPos=0, double arrivalPos=INVALID_DOUBLE_VALUE, const double departPosLat=0, const std::string &pType="", const std::string &vType="", const std::string &destStop="")
static double getDeltaT()
int getActiveCount()
return the number of active transportable objects
static int getDepartedNumber()
static std::vector< std::string > getEmergencyStoppingVehiclesIDList()
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
TRACI_CONST int VAR_LOADED_VEHICLES_NUMBER
static void load(const std::vector< std::string > &args)
load a simulation with the given arguments
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=nullptr)
Returns the named vehicle type or a sample from the named distribution.
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
MSIntermodalRouter & getIntermodalRouter(const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
double zmax() const
Returns maximum z-coordinate.
static std::vector< std::string > getDepartedIDList()
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static std::string getParameter(const std::string &objectID, const std::string &key)
std::vector< double > & getParameter()
Returns the parameters of this distribution.
static TraCIPosition convert2D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false)
TRACI_CONST int VAR_EMERGENCYSTOPPING_VEHICLES_NUMBER
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...
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
int getActiveVehicleCount() const
Returns the number of build vehicles that have not been removed or need to wait for a passenger or a ...
const std::string DEFAULT_BIKETYPE_ID
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
std::vector< const MSEdge * > ConstMSEdgeVector
const std::string & getID() const
Returns the id.
int getTransportableNumber() const
Returns the number of transportables waiting on this stop.
bool hasNext()
returns the information whether further substrings exist
static SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector())
return the router instance
bool hasVType(const std::string &id) const
Asks for existence of a vehicle type.
TRACI_CONST int VAR_DEPARTED_VEHICLES_IDS
static TraCIPosition convertGeo(double x, double y, bool fromGeo=false)
double getLength() const
return the length of the edge
const std::string DEFAULT_VTYPE_ID
static void close()
Closes all of an applications subsystems.
const std::string & getMyName() const
double zmin() const
Returns minimum z-coordinate.
#define UNUSED_PARAMETER(x)
A class that stores a 2D geometrical boundary.
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
TRACI_CONST int VAR_BUS_STOP_WAITING
The car-following model and parameter.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
static OptionsCont & getOptions()
Retrieves the options.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
The vehicles starts to stop.
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
static double getDistance2D(double x1, double y1, double x2, double y2, bool isGeo=false, bool isDriving=false)
TRACI_CONST int VAR_ARRIVED_VEHICLES_NUMBER
A road/street connecting two junctions.
static TraCIStage findRoute(const std::string &fromEdge, const std::string &toEdge, const std::string &vType="", const double depart=-1., const int routingMode=0)
static int getParkingStartingVehiclesNumber()
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static const std::vector< std::string > & getVehicleStateChanges(const MSNet::VehicleState state)
virtual void setChosenSpeedFactor(const double factor)=0
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
The vehicle arrived at his destination (is deleted)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
The vehicles starts to park.
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_NUMBER
The vehicle is involved in a collision.
TRACI_CONST int CMD_SUBSCRIBE_SIM_VARIABLE
static bool hasInstance()
Returns whether the network was already constructed.
TRACI_CONST int VAR_STOP_ENDING_VEHICLES_IDS
Representation of a vehicle.
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
The vehicle had to brake harder than permitted.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
double recomputeCosts(const std::vector< const E *> &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
static std::vector< std::string > getLoadedIDList()
A point in 2D or 3D with translation and scaling methods.
void closeSimulation(SUMOTime start)
Closes the simulation (all files, connections, etc.)
static TraCIPositionVector getNetBoundary()
std::vector< std::string > edges
The sequence of edges to travel.
static LIBSUMO_SUBSCRIPTION_API void subscribe(const std::vector< int > &vars=std::vector< int >(), double beginTime=INVALID_DOUBLE_VALUE, double endTime=INVALID_DOUBLE_VALUE)
static void close()
close simulation
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
std::vector< MSTransportable * > getTransportables() const
Returns the tranportables waiting on this stop.
bool hasContainers() const
Returns whether containers are simulated.
int getCapacity() const
Returns the area capacity.
TRACI_CONST int ROUTING_MODE_AGGREGATED
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
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 getMaxSpeed() const
Get vehicle's maximum speed [m/s].
TRACI_CONST int VAR_DELTA_T
static std::vector< std::string > getStopStartingVehiclesIDList()
double xmin() const
Returns minimum x-coordinate.
The vehicle started to teleport.
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_IDS
static int getEndingTeleportNumber()
static std::vector< std::string > getStopEndingVehiclesIDList()
static double getDistanceRoad(const std::string &edgeID1, double pos1, const std::string &edgeID2, double pos2, bool isDriving=false)
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
static std::vector< std::string > getStartingTeleportIDList()
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
The vehicle ends to park.
static void saveState(const std::string &fileName)
static void subscribe(const int commandId, const std::string &id, const std::vector< int > &variables, const double beginTime, const double endTime, const int contextDomain=0, const double range=0.)
static std::vector< std::string > getBusStopIDList()
TRACI_CONST int VAR_DEPARTED_VEHICLES_NUMBER
const SUMOVTypeParameter & getParameter() const
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
vehicle is a passenger car (a "normal" car)
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_IDS
The vehicle was built, but has not yet departed.
static std::vector< std::string > getParkingStartingVehiclesIDList()
TRACI_CONST int VAR_COLLIDING_VEHICLES_IDS
static int getCollidingVehiclesNumber()
static int getBusStopWaiting(const std::string &id)
static int getStartingTeleportNumber()
int getOccupancyIncludingBlocked() const
Returns the area occupancy.
Structure representing possible vehicle parameter.
static const TraCIResults getSubscriptionResults()
static std::vector< std::string > getEndingTeleportIDList()
MSInsertionControl & getInsertionControl()
Returns the insertion control.
const std::string DEFAULT_PEDTYPE_ID
static std::vector< std::string > getBusStopWaitingIDList(const std::string &id)
Returns the IDs of the transportables on a given bus stop.
int getPendingFlowCount() const
Returns the number of flows that are still active.
TRACI_CONST int VAR_LOADED_VEHICLES_IDS
static int getParkingEndingVehiclesNumber()
static bool isLoaded()
return whether a simulation (network) is present
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_IDS
TRACI_CONST int VAR_COLLIDING_VEHICLES_NUMBER
const std::string & getID() const
Returns the name of the vehicle type.
double travelTime
duration of the stage in seconds
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
TRACI_CONST int VAR_PARKING_STARTING_VEHICLES_NUMBER
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
static int getEmergencyStoppingVehiclesNumber()
The vehicle ends to stop.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
static ContextSubscriptionResults myContextSubscriptionResults
static int getArrivedNumber()
static int getMinExpectedNumber()
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation. ...
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
static std::vector< std::string > getCollidingVehiclesIDList()
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
static TraCIRoadPosition convertRoad(double x, double y, bool isGeo=false, const std::string &vClass="ignoring")
static void clearPending(const std::string &routeID="")
The class responsible for building and deletion of vehicles.
SVCPermissions getPermissions() const
TRACI_CONST int VAR_ARRIVED_VEHICLES_IDS
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
Builds a vehicle, increases the number of built vehicles.
void simulationStep()
Performs a single simulation step.
static void handleSubscriptions(const SUMOTime t)
const MSLane & getLane() const
Returns the lane this stop is located at.
TRACI_CONST int VAR_PARKING_STARTING_VEHICLES_IDS
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
double ymax() const
Returns maximum y-coordinate.
static std::shared_ptr< VariableWrapper > makeWrapper()
TRACI_CONST double INVALID_DOUBLE_VALUE
static std::vector< std::string > getArrivedIDList()
static int getLoadedNumber()
static int getCurrentTime()
const Distribution_Parameterized & getSpeedFactor() const
Returns this type's speed factor.
The vehicle ended being teleported.
TRACI_CONST int VAR_PARKING_ENDING_VEHICLES_IDS
vehicles ignoring classes
static TraCIPosition convert3D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false)
TRACI_CONST int VAR_EMERGENCYSTOPPING_VEHICLES_IDS
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_NUMBER
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double getTotalCharged() const
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_NUMBER
static int getStopEndingVehiclesNumber()
void setz(double z)
set position z
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true, int routePosition=0) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...