59 if (sumoVehicle == 0) {
64 throw TraCIException(
"Vehicle '" +
id +
"' is not a micro-simulation vehicle");
79 return sumoVehicle == 0 || sumoVehicle->
getLane() == 0;
82 std::vector<std::string>
84 std::vector<std::string> ids;
87 if ((*i).second->isOnRoad() || (*i).second->isParking()) {
88 ids.push_back((*i).first);
249 std::pair<std::string, double>
253 std::pair<const MSVehicle* const, double> leaderInfo = veh->
getLeader(dist);
254 return std::make_pair(
255 leaderInfo.first != 0 ? leaderInfo.first->getID() :
"",
258 return std::make_pair(
"", -1);
301 std::vector<std::string>
303 std::vector<std::string> result;
307 result.push_back((*i)->getID());
318 std::vector<TraCIBestLanesData>
320 std::vector<TraCIBestLanesData> result;
323 const std::vector<MSVehicle::LaneQ>& bestLanes = veh->
getBestLanes();
324 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
337 result.push_back(bld);
344 std::vector<TraCINextTLSData>
346 std::vector<TraCINextTLSData> result;
356 if ((*link)->isTLSControlled()) {
358 ntd.
id = (*link)->getTLLogic()->getID();
359 ntd.
tlIndex = (*link)->getTLIndex();
361 ntd.
state = (char)(*link)->getState();
362 result.push_back(ntd);
365 lane = (*link)->getViaLaneOrLane();
409 if (distance == std::numeric_limits<double>::max()) {
426 if (distance == std::numeric_limits<double>::max()) {
442 veh->
getEdge(), &roadPos.first->getEdge());
443 if (distance == std::numeric_limits<double>::max()) {
490 std::vector<std::string>
502 return std::make_pair((
int)
LCA_UNKNOWN, (
int)LCA_UNKNOWN);
512 if (tok.
size() < 3) {
513 throw TraCIException(
"Invalid device parameter '" + key +
"' for vehicle '" + vehicleID +
"'");
518 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support device parameter '" + key +
"' (" + e.what() +
").");
521 const std::string attrName = key.substr(16);
525 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support laneChangeModel parameter '" + key +
"' (" + e.what() +
").");
529 if (tok.
size() != 3) {
530 throw TraCIException(
"Invalid check for device. Expected format is 'has.DEVICENAME.device'");
631 const std::string& edgeID,
640 bool parking =
false;
641 bool triggered =
false;
642 bool containerTriggered =
false;
645 parking = ((flags & 1) != 0);
646 triggered = ((flags & 2) != 0);
647 containerTriggered = ((flags & 4) != 0);
648 if ((flags & 8) != 0) {
651 if ((flags & 16) != 0) {
654 if ((flags & 32) != 0) {
657 if ((flags & 64) != 0) {
664 if (!veh->
addTraciStopAtStoppingPlace(edgeID, duration, until, parking, triggered, containerTriggered, stoppingPlaceType, error)) {
672 if (endPos < startPos) {
673 throw TraCIException(
"End position on lane must be after start position.");
680 const std::vector<MSLane*>& allLanes = road->
getLanes();
681 if ((laneIndex < 0) || laneIndex >= (
int)(allLanes.size())) {
685 if (!veh->
addTraciStop(allLanes[laneIndex], startPos, endPos, duration, until, parking, triggered, containerTriggered, error)) {
700 std::ostringstream strs;
701 strs <<
"reached: " << sto.
reached;
702 strs <<
", duration:" << sto.
duration;
703 strs <<
", edge:" << (*sto.
edge)->getID();
705 std::string posStr = strs.str();
706 throw TraCIException(
"Failed to resume from stoppingfor vehicle '" + veh->
getID() +
"', " + posStr);
715 const bool onInit =
isOnInit(vehicleID);
739 std::vector<std::pair<SUMOTime, int> > laneTimeLine;
740 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
741 laneTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + duration, laneIndex));
754 const std::string& routeID,
755 const std::string& typeID,
770 throw TraCIException(
"The vehicle " + vehicleID +
" to add already exists.");
774 vehicleParams.
id = vehicleID;
777 throw TraCIException(
"Invalid type '" + typeID +
"' for vehicle '" + vehicleID +
"'");
781 throw TraCIException(
"Invalid route '" + routeID +
"' for vehicle: '" + vehicleID +
"'");
785 const int proc = -depart;
793 WRITE_WARNING(
"Departure time for vehicle '" + vehicleID +
"' is in the past; using current time instead.");
795 vehicleParams.
depart = depart;
800 const int proc =
static_cast<int>(-vehicleParams.
departPos);
811 const int proc =
static_cast<int>(-vehicleParams.
departSpeed);
822 const int proc =
static_cast<int>(-vehicleParams.
departLane);
843 Vehicle::moveToXY(
const std::string& vehicleID,
const std::string& edgeID,
const int laneIndex,
const double x,
const double y,
double angle,
const int keepRouteFlag) {
845 bool keepRoute = (keepRouteFlag == 1) && veh->
getID() !=
"VTD_EGO";
846 bool mayLeaveNetwork = (keepRouteFlag == 2);
848 const std::string origID = edgeID +
"_" +
toString(laneIndex);
852 const double origAngle = angle;
857 while (angle >= 360.) {
867 std::cout << std::endl <<
"begin vehicle " << veh->
getID() <<
" vehPos:" << vehPos <<
" lane:" <<
Named::getIDSecure(veh->
getLane()) << std::endl;
868 std::cout <<
" want pos:" << pos <<
" origID:" << origID <<
" laneIndex:" << laneIndex <<
" origAngle:" << origAngle <<
" angle:" << angle <<
" keepRoute:" << keepRoute << std::endl;
874 double lanePosLat = 0;
875 double bestDistance = std::numeric_limits<double>::max();
878 double maxRouteDistance = 100;
887 bestDistance, &lane, lanePos, routeOffset);
893 bestDistance, &lane, lanePos, routeOffset, edges);
895 if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) {
900 lanePosLat = perpDist;
901 if (!mayLeaveNetwork) {
909 WRITE_WARNING(
"Could not determine position on lane '" + lane->
getID() +
" at lateral position " +
toString(-lanePosLat) +
".");
913 lanePosLat = -lanePosLat;
921 assert((found && lane != 0) || (!found && lane == 0));
938 throw TraCIException(
"Could not map vehicle '" + vehicleID +
"' no road found within " +
toString(maxRouteDistance) +
"m.");
940 throw TraCIException(
"Could not map vehicle '" + vehicleID +
"' distance to road is " +
toString(bestDistance) +
".");
948 std::vector<std::pair<SUMOTime, double> > speedTimeLine;
950 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep() + duration, speed));
963 if (vehicleType == 0) {
964 throw TraCIException(
"Vehicle type '" + vehicleID +
"' is not known");
974 throw TraCIException(
"The route '" + routeID +
"' is not known.");
978 WRITE_WARNING(
"Invalid route replacement for vehicle '" + veh->
getID() +
"'. " + msg);
997 throw TraCIException(
"Invalid edge list for vehicle '" + veh->
getID() +
"' (" + e.what() +
")");
1006 double time,
double begSeconds,
double endSeconds) {
1010 throw TraCIException(
"Referended edge '" + edgeID +
"' is not known.");
1014 if (begSeconds == 0 && endSeconds == std::numeric_limits<double>::max()) {
1032 double effort,
double begSeconds,
double endSeconds) {
1036 throw TraCIException(
"Referended edge '" + edgeID +
"' is not known.");
1040 if (begSeconds == 0 && endSeconds == std::numeric_limits<double>::max()) {
1084 Vehicle::moveTo(
const std::string& vehicleID,
const std::string& laneID,
double position) {
1091 if (!veh->
willPass(&destinationEdge)) {
1092 throw TraCIException(
"Vehicle '" + laneID +
"' may be set onto an edge to pass only.");
1100 while (veh->
getEdge() != &destinationEdge) {
1124 if (actionStepLength < 0.0) {
1125 WRITE_ERROR(
"Invalid action step length (<0). Ignoring command setActionStepLength().");
1129 if (actionStepLength == 0.) {
1136 if (resetActionOffset) {
1186 if (tok.
size() < 3) {
1187 throw TraCIException(
"Invalid device parameter '" + key +
"' for vehicle '" + vehicleID +
"'");
1192 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support device parameter '" + key +
"' (" + e.what() +
").");
1195 const std::string attrName = key.substr(16);
1199 throw TraCIException(
"Vehicle '" + vehicleID +
"' does not support laneChangeModel parameter '" + key +
"' (" + e.what() +
").");
1203 if (tok.
size() != 3) {
1204 throw TraCIException(
"Invalid request for device status change. Expected format is 'has.DEVICENAME.device'");
1206 const std::string deviceName = tok.
get(1);
1211 throw TraCIException(
"Changing device status requires a 'true' or 'false'");
1214 throw TraCIException(
"Device removal is not supported for device of type '" + deviceName +
"'");
1219 throw TraCIException(
"Cannot create vehicle device (" + std::string(e.what()) +
").");
int getRoutePosition() const
static void slowDown(const std::string &vehicleID, double speed, SUMOTime duration)
static std::string getLaneID(const std::string &vehicleID)
double getApparentDecel() const
Get the vehicle type's apparent deceleration [m/s^2] (the one regarded by its followers.
static std::vector< TraCIBestLanesData > getBestLanes(const std::string &vehicleID)
static double gLateralResolution
double getFuelConsumption() const
Returns fuel consumption of the current state.
std::string id
The id of the next tls.
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
SumoXMLTag
Numbers representing SUMO-XML - element names.
double getNOxEmissions() const
Returns NOx emission of the current state.
static std::vector< std::string > getEdges(const std::string &vehicleID)
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
RGBColor color
The vehicle's color, TraCI may change this.
MSEdge & getEdge() const
Returns the lane's edge.
static void setEffort(const std::string &vehicleID, const std::string &edgeID, double effort=INVALID_DOUBLE_VALUE, double begSeconds=0, double endSeconds=std::numeric_limits< double >::max())
Representation of a vehicle in the micro simulation.
static double getEmergencyDecel(const std::string &vehicleID)
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
static TraCIPosition getPosition(const std::string &vehicleID)
double getElectricityConsumption() const
Returns electricity consumption of the current state.
static void setLine(const std::string &vehicleID, const std::string &line)
double dist
The distance to the tls.
double getAngle() const
Returns the vehicle's direction in radians.
bool allowsContinuation
Whether this lane allows continuing the route.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
const ConstMSEdgeVector & getEdges() const
static int getSignalStates(const std::string &vehicleID)
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
static double getSpeedWithoutTraCI(const std::string &vehicleID)
static std::string getRoadID(const std::string &vehicleID)
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector) ...
bool parking
whether the vehicle is removed from the net while stopping
static void setRoute(const std::string &vehicleID, const std::vector< std::string > &edgeIDs)
static double getDrivingDistance(const std::string &vehicleID, const std::string &edgeID, double position, int laneIndex)
bool hasDeparted() const
Returns whether this vehicle has already departed.
static void setRemoteControlled(MSVehicle *v, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
static int getPersonNumber(const std::string &vehicleID)
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
bool resumeFromStopping()
MSLane * getLane() const
Returns the lane the vehicle is on.
void setDeviceParameter(const std::string &deviceName, const std::string &key, const std::string &value)
try to set the given parameter from any of the vehicles devices, raise InvalidArgument if no device p...
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
static bool _2bool(const E *const data)
converts a 0-terminated char-type array into the boolean value described by it
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
void setShape(SUMOVehicleShape shape)
Set a new value for this type's shape.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
static double getWidth(const std::string &vehicleID)
int getPersonNumber() const
Returns the number of persons.
std::pair< const MSVehicle *const, double > getLeader(double dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
const SUMOVehicleParameter::Stop pars
The stop parameter.
SUMOTime duration
The stopping duration.
static std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist)
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
static void setParameter(const std::string &vehicleID, const std::string &key, const std::string &value)
virtual double getImperfection() const
Get the driver's imperfection.
std::vector< double > & getParameter()
Returns the parameters of this distribution.
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
static double getSlope(const std::string &vehicleID)
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
double getPositionOnLane() const
Get the vehicle's position along the lane.
Tag for the last element in the enum for safe int casting.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
static std::string getTypeID(const std::string &vehicleID)
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
bool reached
Information whether the stop has been reached.
static TraCIPosition makeTraCIPosition(const Position &position)
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
static double getTau(const std::string &vehicleID)
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...
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
std::string get(int pos) const
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
bool addTraciStopAtStoppingPlace(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string &errorMsg)
static SUMOTime processActionStepLength(double given)
Checks and converts given value for the action step length from seconds to miliseconds assuring it be...
double occupation
The traffic density along length.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
static double getCOEmission(const std::string &vehicleID)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
std::string laneID
The id of the lane.
double getLength() const
Returns the lane's length.
const PositionVector & getShape() const
Returns this lane's shape.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
bool isLinkEnd(MSLinkCont::const_iterator &i) const
static std::vector< std::string > getVia(const std::string &vehicleID)
virtual std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this laneChangeModel. Throw exception for unsupported key ...
const MSRoute & getRoute() const
Returns the current route.
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...
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
std::vector< const MSEdge * > ConstMSEdgeVector
int getSignals() const
Returns the signals.
static void setRouteID(const std::string &vehicleID, const std::string &routeID)
const std::string & getID() const
Returns the id.
static void setColor(const std::string &vehicleID, const TraCIColor &col)
static double getAngle(const std::string &vehicleID)
int getSpeedMode() const
return the current speed mode
void setMaxSpeed(const double &maxSpeed)
Set a new value for this type's maximum speed.
double nextOccupation
As occupation, but without the first lane.
double length
The overall length which may be driven when using this lane without a lane change.
static std::string getLine(const std::string &vehicleID)
Tag for the last element in the enum for safe int casting.
static double getSpeedFactor(const std::string &vehicleID)
bool wasRemoteControlled(SUMOTime lookBack=DELTA_T) const
Returns the information whether the vehicle is fully controlled via TraCI within the lookBack time...
double getWidth() const
Returns the lane's width.
#define UNUSED_PARAMETER(x)
static double getDistance(const std::string &vehicleID)
static double getNoiseEmission(const std::string &vehicleID)
#define WRITE_WARNING(msg)
The car-following model and parameter.
MSAbstractLaneChangeModel & getLaneChangeModel()
double getDepartPos() const
Returns this vehicle's real departure position.
std::string getDeviceParameter(const std::string &deviceName, const std::string &key) const
try to retrieve the given parameter from any of the vehicles devices, raise InvalidArgument if no dev...
static std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction)
static void add(const std::string &vehicleID, const std::string &routeID, const std::string &typeID="DEFAULT_VEHTYPE", int depart=DEPARTFLAG_NOW, int departLane=DEPARTFLAG_LANE_FIRST_ALLOWED, double departPos=DEPARTFLAG_POS_BASE, double departSpeed=0, int arrivalLane=ARRIVALFLAG_LANE_CURRENT, double arrivalPos=ARRIVALFLAG_POS_MAX, double arrivalSpeed=ARRIVALFLAG_SPEED_CURRENT, const std::string &fromTaz="", const std::string &toTaz="", const std::string &line="", int personCapacity=4, int personNumber=0)
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
static double getNOxEmission(const std::string &vehicleID)
static void rerouteTraveltime(const std::string &vehicleID)
static double getWaitingTime(const std::string &vehicleID)
static double getLastActionTime(const std::string &vehicleID)
double getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
static double getCO2Emission(const std::string &vehicleID)
static const MSVehicleType & getVehicleType(const std::string &vehicleID)
int bestLaneOffset
The offset of this lane from the best lane.
double departSpeed
(optional) The initial speed of the vehicle
A road/street connecting two junctions.
static void resume(const std::string &vehicleID)
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
MSLane * lane
The described lane.
static double naviDegree(const double angle)
The action has not been determined.
double getCO2Emissions() const
Returns CO2 emission of the current state.
static double getDecel(const std::string &vehicleID)
int getIndex() const
Returns the lane's index.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
static double getImperfection(const std::string &vehicleID)
void removeEffort(const MSEdge *const e)
Removes the effort information for an edge.
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
void setSublaneChange(double latDist)
Sets a new sublane-change request.
DepartLaneDefinition
Possible ways to choose a lane on depart.
static std::vector< TraCINextTLSData > getNextTLS(const std::string &vehicleID)
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
static int getSpeedMode(const std::string &vehicleID)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void createDevice(const std::string &deviceName)
create device of the given type
static int getRouteIndex(const std::string &vehicleID)
Representation of a vehicle.
static void setVia(const std::string &vehicleID, const std::vector< std::string > &via)
double startPos
The stopping position start.
static double getLateralLanePosition(const std::string &vehicleID)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
static double getHCEmission(const std::string &vehicleID)
A point in 2D or 3D with translation and scaling methods.
SUMOTime getActionStepLength() const
Returns the vehicle's action step length in millisecs, i.e. the interval between two action points...
MSRouteIterator edge
The edge in the route to stop at.
virtual void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this laneChangeModel. Throw exception for unsupported key ...
void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
assigns new values
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true)
Replaces the current route by the given one.
int getRoutingMode() const
return the current routing mode
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
static bool isOnInit(const std::string &vehicleID)
double getEmergencyDecel() const
Get the vehicle type's maximal phisically possible deceleration [m/s^2].
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
static double getFuelConsumption(const std::string &vehicleID)
bool triggered
whether an arriving person lets the vehicle continue
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
ConstMSEdgeVector::const_iterator MSRouteIterator
static double getLanePosition(const std::string &vehicleID)
SUMOTime depart
The vehicle's departure time.
static TraCIColor makeTraCIColor(const RGBColor &color)
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
static bool isVisible(const MSVehicle *veh)
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static void changeLane(const std::string &vehicleID, int laneIndex, SUMOTime duration)
static void moveTo(const std::string &vehicleID, const std::string &laneID, double position)
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false, bool check=false, bool removeStops=true)
Replaces the current route by the given edges.
Tag for the last element in the enum for safe int casting.
A structure representing the best lanes for continuing the current route starting at 'lane'...
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
static std::vector< std::string > getIDList()
double getMinGap() const
Get the free space in front of vehicles of this class.
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
static double getAccumulatedWaitingTime(const std::string &vehicleID)
static const double INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
bool isInternal() const
return whether this edge is an internal edge
const int VEHPARS_COLOR_SET
static void setSpeed(const std::string &vehicleID, double speed)
static std::string getRouteID(const std::string &vehicleID)
bool containerTriggered
whether an arriving container lets the vehicle continue
void move2side(double amount)
move position vector to side using certain ammount
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane *> &conts)
bool allowsContinuation
Whether this lane allows to continue the drive.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
std::string line
The vehicle's line (mainly for public transport)
#define INVALID_DOUBLE_VALUE
void setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset)
Set a new value for this type's action step length.
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
static std::string getEmissionClass(const std::string &vehicleID)
DepartSpeedDefinition
Possible ways to choose the departure speed.
void alreadyDeparted(SUMOVehicle *veh)
stops trying to emit the given vehicle (because it already departed)
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.
double getCOEmissions() const
Returns CO emission of the current state.
static void setStop(const std::string &vehicleID, const std::string &edgeID, double endPos=1., int laneIndex=0, SUMOTime duration=4294967295u, int flags=STOP_DEFAULT, double startPos=INVALID_DOUBLE_VALUE, SUMOTime until=-1)
std::vector< std::string > via
List of the via-edges the vehicle must visit.
static std::string getParameter(const std::string &vehicleID, const std::string &key)
static double getActionStepLength(const std::string &vehicleID)
static bool moveToXYMap(const Position &pos, double maxRouteDistance, bool mayLeaveNetwork, const std::string &origID, const double angle, double speed, const ConstMSEdgeVector ¤tRoute, const int routePosition, MSLane *currentLane, double currentLanePos, bool onRoad, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
static int getLaneIndex(const std::string &vehicleID)
bool addTraciStop(MSLane *const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
static void moveToXY(const std::string &vehicleID, const std::string &edgeID, const int laneIndex, const double x, const double y, double angle, const int keepRouteFlag)
double departPos
(optional) The position the vehicle shall depart from
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
static void setShapeClass(const std::string &vehicleID, const std::string &clazz)
void removeTravelTime(const MSEdge *const e)
Removes the travel time information for an edge.
static void changeTarget(const std::string &vehicleID, const std::string &edgeID)
The vehicle has departed (was inserted into the network)
Influencer & getInfluencer()
Returns the velocity/lane influencer.
void scheduleVehicleRemoval(SUMOVehicle *veh)
Removes a vehicle after it has ended.
Structure representing possible vehicle parameter.
#define INVALID_INT_VALUE
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
static double getAllowedSpeed(const std::string &vehicleID)
static double getPMxEmission(const std::string &vehicleID)
static void setSignals(const std::string &vehicleID, int signals)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
static bool isRouteValid(const std::string &vehicleID)
static void setMaxSpeed(const std::string &vehicleID, double speed)
void setTentativeLaneAndPosition(MSLane *lane, double pos, double posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
static TraCIColor getColor(const std::string &vehicleID)
MSInsertionControl & getInsertionControl()
Returns the insertion control.
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
static double getDrivingDistance2D(const std::string &vehicleID, double x, double y)
std::vector< MSLane * > bestContinuations
MSStoppingPlace * chargingStation
(Optional) charging station if one is assigned to the stop
char state
The current state of the tls.
static double getAccel(const std::string &vehicleID)
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
int getLanechangeMode() const
return the current lane change mode
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
const std::string & getID() const
Returns the name of the vehicle type.
double getPMxEmissions() const
Returns PMx emission of the current state.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
double getActionStepLengthSecs() const
Returns this type's default action step length in seconds.
static int getRoutingMode(const std::string &vehicleID)
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
static std::string getShapeClass(const std::string &vehicleID)
void updateActionOffset(const SUMOTime oldActionStepLength, const SUMOTime newActionStepLength)
Process an updated action step length value (only affects the vehicle's action offset, The actionStepLength is stored in the (singular) vtype)
double getLength() const
Get vehicle's length [m].
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
static double getLength(const std::string &vehicleID)
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
void setSignals(int signals)
static void setAdaptedTraveltime(const std::string &vehicleID, const std::string &edgeID, double time=INVALID_DOUBLE_VALUE, double begSeconds=0, double endSeconds=std::numeric_limits< double >::max())
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
static double getMaxSpeed(const std::string &vehicleID)
static MSEdge * getEdge(const std::string &edgeID)
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
static int getLanechangeMode(const std::string &vehicleID)
void switchOffSignal(int signal)
Switches the given signal off.
void switchOnSignal(int signal)
Switches the given signal on.
double getSlope() const
Returns the slope of the road at vehicle's position.
static void remove(const std::string &vehicleID, char reason=REMOVE_VAPORIZED)
bool hasDevice(const std::string &deviceName) const
check whether the vehicle is equiped with a device of the given type
static MSVehicle * getVehicle(const std::string &id)
double length
The length than can be driven from that lane without lane change.
void reroute(SUMOTime t, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false)
Performs a rerouting using the given router.
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
double getHCEmissions() const
Returns HC emission of the current state.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
bool isStopped() const
Returns whether the vehicle is at a stop.
The class responsible for building and deletion of vehicles.
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
static double getElectricityConsumption(const std::string &vehicleID)
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.
static double getEffort(const std::string &vehicleID, const std::string &edgeID, int time)
static void setEmissionClass(const std::string &vehicleID, const std::string &clazz)
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
static void setType(const std::string &vehicleID, const std::string &typeID)
static double getApparentDecel(const std::string &vehicleID)
bool isParking() const
Returns whether the vehicle is parking.
double getSpeed() const
Returns the vehicle's current speed.
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
static double getMinGap(const std::string &vehicleID)
Tag for the last element in the enum for safe int casting.
static std::string getVClass(const std::string &vehicleID)
DepartPosDefinition
Possible ways to choose the departure position.
static double getSpeedDeviation(const std::string &vehicleID)
const std::string & getID() const
Returns the name of the vehicle.
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
static std::pair< MSLane *, double > convertCartesianToRoadMap(Position pos)
static void changeSublane(const std::string &vehicleID, double latDist)
Representation of a lane in the micro simulation.
int tlIndex
The tls index of the controlled link.
static double getSpeed(const std::string &vehicleID)
static int getStopState(const std::string &vehicleID)
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
const Distribution_Parameterized & getSpeedFactor() const
Returns this type's speed factor.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
static void parseEdgesList(const std::string &desc, ConstMSEdgeVector &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
DepartDefinition
Possible ways to depart.
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
static bool moveToXYMap_matchingRoutePosition(const Position &pos, const std::string &origID, const ConstMSEdgeVector ¤tRoute, int routeIndex, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset)
std::string id
The vehicle's id.
static double getAdaptedTraveltime(const std::string &vehicleID, const std::string &edgeID, int time)
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
The vehicle is being teleported.
static void rerouteEffort(const std::string &vehicleID)
Definition of vehicle stop (position and duration)
const std::pair< int, int > & getSavedState(const int dir) const
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
static void setActionStepLength(const std::string &vehicleID, double actionStepLength, bool resetActionOffset=true)