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>
332 if (roadPos.first ==
nullptr) {
336 result.
edgeID = roadPos.first->getEdge().getID();
337 result.
laneIndex = roadPos.first->getIndex();
338 result.
pos = roadPos.second;
366 if ((roadPos1.first == roadPos2.first) && (roadPos1.second <= roadPos2.second)) {
368 return roadPos2.second - roadPos1.second;
370 double distance = 0.;
372 if (roadPos2.first->isInternal()) {
373 distance = roadPos2.second;
374 roadPos2.first = roadPos2.first->getLogicalPredecessorLane();
375 roadPos2.second = roadPos2.first->getLength();
379 MSRoute route(
"", newRoute,
false,
nullptr, std::vector<SUMOVehicleParameter::Stop>());
380 return distance + route.
getDistanceBetween(roadPos1.second, roadPos2.second, &roadPos1.first->getEdge(), &roadPos2.first->getEdge());
393 if ((roadPos1.first == roadPos2.first) && (roadPos1.second <= roadPos2.second)) {
395 return roadPos2.second - roadPos1.second;
397 double distance = 0.;
399 if (roadPos2.first->isInternal()) {
400 distance = roadPos2.second;
401 roadPos2.first = roadPos2.first->getLogicalPredecessorLane();
402 roadPos2.second = roadPos2.first->getLength();
406 MSRoute route(
"", newRoute,
false,
nullptr, std::vector<SUMOVehicleParameter::Stop>());
407 return distance + route.
getDistanceBetween(roadPos1.second, roadPos2.second, &roadPos1.first->getEdge(), &roadPos2.first->getEdge());
410 Position pos1 = roadPos1.first->getShape().positionAtOffset(roadPos1.second);
411 Position pos2 = roadPos2.first->getShape().positionAtOffset(roadPos2.second);
418 Simulation::findRoute(
const std::string& from,
const std::string& to,
const std::string& typeID,
const double depart,
const int routingMode) {
421 if (fromEdge ==
nullptr) {
425 if (toEdge ==
nullptr) {
432 if (type ==
nullptr) {
433 throw TraCIException(
"The vehicle type '" + typeID +
"' is not known.");
441 throw TraCIException(
"Invalid departure edge for vehicle type '" + typeID +
"' (" + e.what() +
")");
447 router.
compute(fromEdge, toEdge, vehicle, dep, edges);
448 for (
const MSEdge* e : edges) {
449 result.
edges.push_back(e->getID());
452 if (vehicle !=
nullptr) {
459 std::vector<TraCIStage>
461 const std::string& modes,
double depart,
const int routingMode,
double speed,
double walkFactor,
462 double departPos,
double arrivalPos,
const double departPosLat,
463 const std::string& pType,
const std::string& vType,
const std::string& destStop) {
465 std::vector<TraCIStage> result;
467 if (fromEdge ==
nullptr) {
471 if (toEdge ==
nullptr) {
476 std::vector<SUMOVehicleParameter*> pars;
479 pars.back()->vtypeid = vType;
480 pars.back()->id = vType;
484 const std::string mode = st.next();
488 pars.back()->id = mode;
490 }
else if (mode ==
"bicycle") {
493 pars.back()->id = mode;
495 }
else if (mode ==
"public") {
496 pars.push_back(
nullptr);
503 pars.push_back(
nullptr);
514 if (walkFactor < 0) {
523 }
else if (arrivalPos < 0) {
526 if (departPos < 0 || departPos >= fromEdge->
getLength()) {
529 if (arrivalPos < 0 || arrivalPos >= toEdge->
getLength()) {
532 double minCost = std::numeric_limits<double>::max();
535 std::vector<TraCIStage> resultCand;
537 if (vehPar !=
nullptr) {
539 if (type ==
nullptr) {
540 throw TraCIException(
"Unknown vehicle type '" + vehPar->vtypeid +
"'.");
543 WRITE_WARNING(
"Ignoring vehicle type '" + type->
getID() +
"' when performing intermodal routing because it is not allowed on the start edge '" + from +
"'.");
551 std::vector<MSNet::MSIntermodalRouter::TripItem> items;
552 if (router.
compute(fromEdge, toEdge, departPos, arrivalPos, destStop,
553 speed * walkFactor, vehicle, modeSet, departStep, items, externalFactor)) {
555 for (std::vector<MSNet::MSIntermodalRouter::TripItem>::iterator it = items.begin(); it != items.end(); ++it) {
556 if (!it->edges.empty()) {
557 resultCand.push_back(
TraCIStage(it->line ==
"" 560 resultCand.back().vType = it->vType;
561 resultCand.back().line = it->line;
562 resultCand.back().destStop = it->destStop;
563 for (
const MSEdge* e : it->edges) {
564 resultCand.back().edges.push_back(e->
getID());
566 resultCand.back().travelTime = it->traveltime;
567 resultCand.back().cost = it->cost;
568 resultCand.back().length = it->length;
569 resultCand.back().intended = it->intended;
570 resultCand.back().depart = it->depart;
571 resultCand.back().departPos = it->departPos;
572 resultCand.back().arrivalPos = it->arrivalPos;
573 resultCand.back().description = it->description;
577 if (cost < minCost) {
582 if (vehicle !=
nullptr) {
593 const std::string attrName = key.substr(16);
596 throw TraCIException(
"Invalid chargingStation '" + objectID +
"'");
603 throw TraCIException(
"Invalid chargingStation parameter '" + attrName +
"'");
606 const std::string attrName = key.substr(12);
611 if (attrName ==
"capacity") {
613 }
else if (attrName ==
"occupancy") {
618 throw TraCIException(
"Invalid parkingArea parameter '" + attrName +
"'");
621 const std::string attrName = key.substr(8);
629 throw TraCIException(
"Invalid busStop parameter '" + attrName +
"'");
632 throw TraCIException(
"Parameter '" + key +
"' is not supported.");
649 std::shared_ptr<VariableWrapper>
#define VAR_COLLIDING_VEHICLES_NUMBER
The vehicle has departed (was inserted into the network)
A lane area vehicles can halt at.
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...
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
static std::pair< MSLane *, double > convertCartesianToRoadMap(Position pos)
An edgeId, position and laneIndex.
const Boundary & getConvBoundary() const
Returns the converted boundary.
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()
#define VAR_PARKING_STARTING_VEHICLES_IDS
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()
#define VAR_STOP_ENDING_VEHICLES_IDS
int getActiveCount()
return the number of active transportable objects
static int getDepartedNumber()
#define VAR_PARKING_ENDING_VEHICLES_NUMBER
static std::vector< std::string > getEmergencyStoppingVehiclesIDList()
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
std::vector< double > & getParameter()
Returns the parameters of this distribution.
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
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
MSIntermodalRouter & getIntermodalRouter(const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
static TraCIRoadPosition convertRoad(double x, double y, bool isGeo=false)
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E *> &into)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
#define VAR_LOADED_VEHICLES_IDS
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)
static TraCIPosition convert2D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false)
const PositionVector & getShape() const
Returns this lane's shape.
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
#define VAR_TELEPORT_STARTING_VEHICLES_IDS
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.
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.
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.
#define VAR_LOADED_VEHICLES_NUMBER
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 VAR_STOP_STARTING_VEHICLES_NUMBER
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
The car-following model and parameter.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
#define VAR_EMERGENCYSTOPPING_VEHICLES_IDS
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.
#define CMD_SUBSCRIBE_SIM_VARIABLE
static double getDistance2D(double x1, double y1, double x2, double y2, bool isGeo=false, bool isDriving=false)
A road/street connecting two junctions.
#define INVALID_DOUBLE_VALUE
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()
#define VAR_DEPARTED_VEHICLES_NUMBER
#define VAR_MIN_EXPECTED_VEHICLES
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
The vehicle arrived at his destination (is deleted)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
The vehicles starts to park.
The vehicle is involved in a collision.
static bool hasInstance()
Returns whether the network was already constructed.
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 ...
#define VAR_STOP_STARTING_VEHICLES_IDS
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.
#define VAR_TELEPORT_STARTING_VEHICLES_NUMBER
bool hasContainers() const
Returns whether containers are simulated.
int getCapacity() const
Returns the area capacity.
#define VAR_TELEPORT_ENDING_VEHICLES_IDS
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
static std::vector< std::string > getStopStartingVehiclesIDList()
double xmin() const
Returns minimum x-coordinate.
The vehicle started to teleport.
static int getEndingTeleportNumber()
static std::vector< std::string > getStopEndingVehiclesIDList()
#define VAR_DEPARTED_VEHICLES_IDS
static double getDistanceRoad(const std::string &edgeID1, double pos1, const std::string &edgeID2, double pos2, bool isDriving=false)
static std::vector< std::string > getStartingTeleportIDList()
#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.)
const SUMOVTypeParameter & getParameter() const
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getOccupancy() const
Returns the area occupancy.
vehicle is a passenger car (a "normal" car)
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=0)
Returns the named vehicle type or a sample from the named distribution.
The vehicle was built, but has not yet departed.
static std::vector< std::string > getParkingStartingVehiclesIDList()
static int getCollidingVehiclesNumber()
#define VAR_ARRIVED_VEHICLES_NUMBER
static int getBusStopWaiting(const std::string &id)
static int getStartingTeleportNumber()
#define VAR_EMERGENCYSTOPPING_VEHICLES_NUMBER
Structure representing possible vehicle parameter.
static const TraCIResults getSubscriptionResults()
#define VAR_STOP_ENDING_VEHICLES_NUMBER
static std::vector< std::string > getEndingTeleportIDList()
MSInsertionControl & getInsertionControl()
Returns the insertion control.
const std::string DEFAULT_PEDTYPE_ID
#define ROUTING_MODE_AGGREGATED
int getPendingFlowCount() const
Returns the number of flows that are still active.
static int getParkingEndingVehiclesNumber()
static bool isLoaded()
return whether a simulation (network) is present
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.
#define VAR_PARKING_ENDING_VEHICLES_IDS
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...
#define VAR_TELEPORT_ENDING_VEHICLES_NUMBER
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
double recomputeCosts(const std::vector< const E *> &edges, const V *const v, SUMOTime msTime) const
static std::vector< std::string > getCollidingVehiclesIDList()
#define VAR_PARKING_STARTING_VEHICLES_NUMBER
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
static void clearPending(const std::string &routeID="")
The class responsible for building and deletion of vehicles.
SVCPermissions getPermissions() const
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)
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
#define VAR_COLLIDING_VEHICLES_IDS
double ymax() const
Returns maximum y-coordinate.
static std::shared_ptr< VariableWrapper > makeWrapper()
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
#define VAR_ARRIVED_VEHICLES_IDS
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.
vehicles ignoring classes
static TraCIPosition convert3D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false)
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
#define VAR_BUS_STOP_WAITING
double getTotalCharged() const
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.
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...