266 if (inputStorage.
readInt() != 2) {
288 if (inputStorage.
readInt() != 2) {
325 tempContent.
writeInt((
int) bestLanes.size());
327 for (std::vector<libsumo::TraCIBestLanesData>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
355 const int cnt = 1 + (int)nextTLS.size() * 4;
358 tempMsg.
writeInt((
int)nextTLS.size());
359 for (std::vector<libsumo::TraCINextTLSData>::iterator it = nextTLS.begin(); it != nextTLS.end(); ++it) {
383 if (inputStorage.
readInt() != 2) {
395 std::string roadID = inputStorage.
readString();
468 std::string paramName =
"";
497 std::string warning =
"";
530 std::cout <<
SIMTIME <<
" processSet veh=" <<
id <<
"\n";
532 const bool shouldExist = variable !=
ADD && variable !=
ADD_FULL;
534 if (sumoVehicle == 0) {
540 if (v == 0 && shouldExist) {
549 int compoundSize = inputStorage.
readInt();
550 if (compoundSize < 4 || compoundSize > 7) {
572 if (compoundSize >= 5) {
578 if (compoundSize >= 6) {
588 if (compoundSize >= 7) {
601 if (inputStorage.
readInt() != 0) {
612 if (inputStorage.
readInt() != 2) {
625 if ((laneIndex < 0) || (laneIndex >= (
int)(v->
getEdge()->
getLanes().size()))) {
643 if (inputStorage.
readInt() != 2) {
688 std::vector<std::string> edgeIDs;
699 int parameterCount = inputStorage.
readInt();
704 if (parameterCount == 4) {
721 }
else if (parameterCount == 2) {
730 }
else if (parameterCount == 1) {
745 int parameterCount = inputStorage.
readInt();
750 if (parameterCount == 4) {
767 }
else if (parameterCount == 2) {
775 }
else if (parameterCount == 1) {
784 libsumo::Vehicle::setEffort(
id, edgeID, value, (
double)begTime, endTime == -1 ? std::numeric_limits<double>::max() : (
double)endTime);
791 if (inputStorage.
readInt() != 0) {
801 if (inputStorage.
readInt() != 0) {
819 if (inputStorage.
readInt() != 2) {
841 std::vector<std::pair<SUMOTime, double> > speedTimeLine;
843 speedTimeLine.push_back(std::make_pair(
MSNet::getInstance()->getCurrentTimeStep(), speed));
858 int laneChangeMode = 0;
886 if (inputStorage.
readInt() != 6) {
923 if (inputStorage.
readInt() != 14) {
927 vehicleParams.
id = id;
1071 const int numArgs = inputStorage.
readInt();
1072 if (numArgs != 5 && numArgs != 6) {
1101 int keepRouteFlag = 1;
1127 std::vector<std::string> edgeIDs;
1168 if (fabs(value) == std::numeric_limits<double>::infinity()) {
1171 bool resetActionOffset = value >= 0.0;
static void slowDown(const std::string &vehicleID, double speed, SUMOTime duration)
static std::string getLaneID(const std::string &vehicleID)
static std::vector< TraCIBestLanesData > getBestLanes(const std::string &vehicleID)
static std::vector< std::string > getEdges(const std::string &vehicleID)
bool readTypeCheckingColor(tcpip::Storage &inputStorage, libsumo::TraCIColor &into)
Reads the value type and a color, verifying the type.
RGBColor color
The vehicle's color, TraCI may change this.
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.
#define VAR_EMISSIONCLASS
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
static TraCIPosition getPosition(const std::string &vehicleID)
#define REQUEST_DRIVINGDIST
bool allowsContinuation
Whether this lane allows continuing the route.
#define RESPONSE_GET_VEHICLE_VARIABLE
static int getSignalStates(const std::string &vehicleID)
#define CMD_GET_VEHICLE_VARIABLE
static double getSpeedWithoutTraCI(const std::string &vehicleID)
static std::string getRoadID(const std::string &vehicleID)
#define VAR_ACCUMULATED_WAITING_TIME
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 int getPersonNumber(const std::string &vehicleID)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc4: Change Vehicle State)
MSLane * getLane() const
Returns the lane the vehicle is on.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
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)
#define VAR_ALLOWED_SPEED
static double getSlope(const std::string &vehicleID)
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
virtual double readDouble()
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) ...
Notification
Definition of a vehicle state.
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
#define CMD_CHANGESUBLANE
static bool getPosition(const std::string &id, Position &p)
Returns the named vehicle's position.
double occupation
The traffic density along length.
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static double getCOEmission(const std::string &vehicleID)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::string laneID
The id of the lane.
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
static std::vector< std::string > getVia(const std::string &vehicleID)
The vehicle got vaporized.
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
std::vector< const MSEdge * > ConstMSEdgeVector
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
static void setRouteID(const std::string &vehicleID, const std::string &routeID)
const std::string & getID() const
Returns the id.
virtual void writeUnsignedByte(int)
static double getAngle(const std::string &vehicleID)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
static std::string getLine(const std::string &vehicleID)
static double getSpeedFactor(const std::string &vehicleID)
static bool getVariable(const int variable, const std::string &v, tcpip::Storage &tempMsg)
Processes a value request for the given type.
#define VAR_SPEED_DEVIATION
#define VAR_NOISEEMISSION
#define VAR_FUELCONSUMPTION
static double getDistance(const std::string &vehicleID)
static double getNoiseEmission(const std::string &vehicleID)
virtual void writeInt(int)
The car-following model and parameter.
virtual int readUnsignedByte()
std::string toTaz
The vehicle's destination zone (district)
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)
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa4: Get Vehicle Variable)
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)
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
static void resume(const std::string &vehicleID)
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
#define VAR_PERSON_NUMBER
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
static std::vector< TraCINextTLSData > getNextTLS(const std::string &vehicleID)
static int getSpeedMode(const std::string &vehicleID)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static int getRouteIndex(const std::string &vehicleID)
Representation of a vehicle.
static double getLateralLanePosition(const std::string &vehicleID)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
#define REMOVE_TELEPORT_ARRIVED
static double getHCEmission(const std::string &vehicleID)
A point in 2D or 3D with translation and scaling methods.
void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
assigns new values
#define VAR_ACTIONSTEPLENGTH
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual void writeByte(int)
static double getFuelConsumption(const std::string &vehicleID)
#define VAR_LASTACTIONTIME
static double getLanePosition(const std::string &vehicleID)
#define VAR_EMERGENCY_DECEL
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
The vehicle arrived at its destination (is deleted)
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
virtual void writeStringList(const std::vector< std::string > &s)
SUMOTime depart
The vehicle's departure time.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static void changeLane(const std::string &vehicleID, int laneIndex, SUMOTime duration)
#define CMD_SET_VEHICLE_VARIABLE
static void moveTo(const std::string &vehicleID, const std::string &laneID, double position)
std::string fromTaz
The vehicle's origin zone (district)
virtual std::string readString()
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
static std::vector< std::string > getIDList()
#define CMD_REROUTE_EFFORT
static double getAccumulatedWaitingTime(const std::string &vehicleID)
void setChosenSpeedFactor(const double factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit...
TraCI server used to control sumo by a remote TraCI client.
const int VEHPARS_COLOR_SET
virtual void writeStorage(tcpip::Storage &store)
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
static std::string getRouteID(const std::string &vehicleID)
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
double arrivalPos
(optional) The position the vehicle shall arrive on
void setRoutingMode(int value)
Sets routing behavior.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
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.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
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)
static std::string getParameter(const std::string &vehicleID, const std::string &key)
#define VAR_EDGE_TRAVELTIME
static int getLaneIndex(const std::string &vehicleID)
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 setVariable(const int cmd, const int variable, const std::string &id, TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value for the given type.
virtual void writeString(const std::string &s)
static void changeTarget(const std::string &vehicleID, const std::string &edgeID)
Influencer & getInfluencer()
Returns the velocity/lane influencer.
void scheduleVehicleRemoval(SUMOVehicle *veh)
Removes a vehicle after it has ended.
Structure representing possible vehicle parameter.
#define VAR_LANEPOSITION_LAT
static double getAllowedSpeed(const std::string &vehicleID)
static double getPMxEmission(const std::string &vehicleID)
static void setSignals(const std::string &vehicleID, int signals)
static bool isRouteValid(const std::string &vehicleID)
std::string toHex(const T i, std::streamsize numDigits=0)
static TraCIColor getColor(const std::string &vehicleID)
MSInsertionControl & getInsertionControl()
Returns the insertion control.
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
#define CMD_REROUTE_TRAVELTIME
static double getDrivingDistance2D(const std::string &vehicleID, double x, double y)
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
#define VAR_ELECTRICITYCONSUMPTION
const std::string & getID() const
Returns the name of the vehicle type.
static int getRoutingMode(const std::string &vehicleID)
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
void setLaneChangeMode(int value)
Sets lane changing behavior.
virtual void writeDouble(double)
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())
static int getLanechangeMode(const std::string &vehicleID)
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
#define VAR_APPARENT_DECEL
#define VAR_SPEED_WITHOUT_TRACI
double length
The length than can be driven from that lane without lane change.
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
#define VAR_LANECHANGE_MODE
The vehicle was teleported out of the net.
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 setType(const std::string &vehicleID, const std::string &typeID)
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
static void changeSublane(const std::string &vehicleID, double latDist)
static double getSpeed(const std::string &vehicleID)
static int getStopState(const std::string &vehicleID)
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.
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
bool readTypeCheckingByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and a byte, verifying the type.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
std::string id
The vehicle's id.
static double getAdaptedTraveltime(const std::string &vehicleID, const std::string &edgeID, int time)
static void rerouteEffort(const std::string &vehicleID)
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
static void setActionStepLength(const std::string &vehicleID, double actionStepLength, bool resetActionOffset=true)