46 #ifdef CHECK_MEMORY_LEAKS 48 #endif // CHECK_MEMORY_LEAKS 81 std::vector<std::string> ids;
86 std::vector<std::string> ids;
118 tempContent.
writeInt((
int) links.size());
121 for (MSLinkCont::const_iterator i = links.begin(); i != links.end(); ++i) {
129 #ifdef HAVE_INTERNAL_LANES 130 tempContent.
writeString(link->getViaLane() != 0 ? link->getViaLane()->getID() :
"");
169 if (permissions ==
SVCAll) {
182 for (
int iPoint = 0; iPoint <
MIN2(255, (
int)lane->
getShape().size()); ++iPoint) {
228 std::vector<std::string> vehIDs;
230 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
231 vehIDs.push_back((*j)->getID());
245 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
258 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
259 lengthSum += (*j)->getVehicleType().getLength();
262 if (vehs.size() == 0) {
278 if (meanSpeed != 0) {
290 std::string paramName =
"";
311 std::string warning =
"";
343 std::vector<std::string> classes;
352 std::vector<std::string> classes;
401 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
402 if (myShape.distance2D((*j)->getPosition()) <= myRange) {
403 myIDs.insert((*j)->getID());
417 myIDs.insert(l->
getID());
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa3: Get Lane Variable)
SUMOReal getWidth() const
Returns the lane's width.
#define LAST_STEP_MEAN_SPEED
SUMOReal getLength() const
Returns the lane's length.
MSEdge & getEdge() const
Returns the lane's edge.
SUMOReal getPMxEmissions() const
Returns the sum of last step PMx emissions.
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc3: Change Lane State)
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
#define CMD_GET_VEHICLE_VARIABLE
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
#define VAR_CURRENT_TRAVELTIME
MSLane * getLane() const
Returns the connected lane.
void setLength(SUMOReal val)
Sets a new length for the lane (used by TraCI only)
std::vector< std::string > getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
SUMOReal length
The physical vehicle length.
SUMOReal getSpeedLimit() const
Returns the lane's maximum allowed speed.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
const PositionVector & getShape() const
Returns this lane's shape.
const std::string & getID() const
Returns the id.
SUMOReal getLength() const
Returns the length of this link.
static StringBijection< LinkState > LinkStates
const SVCPermissions SVCAll
virtual void writeUnsignedByte(int)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
#define VAR_NOISEEMISSION
#define VAR_FUELCONSUMPTION
virtual void writeInt(int)
virtual int readUnsignedByte()
LinkState getState() const
Returns the current state of the link.
void setMaxSpeed(SUMOReal val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
static StringBijection< LinkDirection > LinkDirections
#define RESPONSE_GET_LANE_VARIABLE
void rebuildAllowedLanes()
SUMOReal getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
SUMOReal getNOxEmissions() const
Returns the sum of last step NOx emissions.
SUMOReal getFuelConsumption() const
Returns the sum of last step fuel consumption.
SUMOReal getHCEmissions() const
Returns the sum of last step HC emissions.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
SUMOReal getWaitingSeconds() const
Returns the overall waiting time on this lane.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
virtual void writeStringList(const std::vector< std::string > &s)
bool havePriority() const
Returns whether this link is a major link.
#define CMD_GET_LANE_VARIABLE
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
SUMOReal getElectricityConsumption() const
Returns the sum of last step electricity consumption.
virtual std::string readString()
#define CMD_GET_EDGE_VARIABLE
bool opened(SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, SUMOReal posLat=0, std::vector< const SUMOVehicle *> *collectFoes=0) const
Returns the information whether the link may be passed.
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
SUMOReal 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) ...
TraCI server used to control sumo by a remote TraCI client.
virtual void writeStorage(tcpip::Storage &store)
std::vector< MSVehicle * > VehCont
Container for vehicles.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
#define LAST_STEP_VEHICLE_NUMBER
SUMOReal getMeanSpeed() const
Returns the mean speed on this lane.
void addParameter(const std::string &key, const std::string &value)
Adds a parameter.
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
void setPermissions(SVCPermissions permissions, long transientID)
Sets the permissions to the given value. If a transientID is given, the permissions are recored as te...
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
virtual void writeString(const std::string &s)
#define LAST_STEP_VEHICLE_ID_LIST
static SUMOReal getDefaultDecel(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default deceleration for the given vehicle class This needs to be a function because the ...
SUMOReal impatience
The vehicle's impatience (willingness to obstruct others)
SUMOReal getCO2Emissions() const
Returns the sum of last step CO2 emissions.
std::string toHex(const T i, std::streamsize numDigits=0)
#define CMD_SET_LANE_VARIABLE
#define VAR_ELECTRICITYCONSUMPTION
SUMOReal getCOEmissions() const
Returns the sum of last step CO emissions.
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
virtual void writeDouble(double)
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
#define LAST_STEP_OCCUPANCY
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
static const long CHANGE_PERMISSIONS_PERMANENT
static const SUMOVTypeParameter & getDefault()
return the default parameters, this is a function due to the http://www.parashift.com/c++-faq/static-init-order.html
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
void add(const MSLane *const l) const
Adds the given object to the container.
Representation of a lane in the micro simulation.
#define LAST_STEP_VEHICLE_HALTING_NUMBER
bool hasApproachingFoe(SUMOTime arrivalTime, SUMOTime leaveTime, SUMOReal speed, SUMOReal decel) const
Returns the information whether a vehicle is approaching on one of the link's foe streams...
static bool getShape(const std::string &id, PositionVector &shape)
Returns the named lane's shape.