79 std::vector<std::string> ids;
84 std::vector<std::string> ids;
102 if (!
MSNet::getInstance()->getWeightsStorage().retrieveExistingTravelTime(e, time, value)) {
117 if (!
MSNet::getInstance()->getWeightsStorage().retrieveExistingEffort(e, time, value)) {
130 const std::vector<MSLane*>& lanes = e->
getLanes();
131 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
132 wtime += (*i)->getWaitingSeconds();
139 std::vector<std::string> personIDs;
141 for (std::vector<MSTransportable*>::iterator it = persons.begin(); it != persons.end(); ++it) {
142 personIDs.push_back((*it)->getID());
149 std::vector<std::string> vehIDs;
150 const std::vector<MSLane*>& lanes = e->
getLanes();
151 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
153 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
154 vehIDs.push_back((*j)->getID());
156 (*i)->releaseVehicles();
164 const std::vector<MSLane*>& lanes = e->
getLanes();
165 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
166 sum += (*i)->getCO2Emissions();
174 const std::vector<MSLane*>& lanes = e->
getLanes();
175 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
176 sum += (*i)->getCOEmissions();
184 const std::vector<MSLane*>& lanes = e->
getLanes();
185 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
186 sum += (*i)->getHCEmissions();
194 const std::vector<MSLane*>& lanes = e->
getLanes();
195 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
196 sum += (*i)->getPMxEmissions();
204 const std::vector<MSLane*>& lanes = e->
getLanes();
205 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
206 sum += (*i)->getNOxEmissions();
214 const std::vector<MSLane*>& lanes = e->
getLanes();
215 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
216 sum += (*i)->getFuelConsumption();
224 const std::vector<MSLane*>& lanes = e->
getLanes();
225 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
226 sum += (double) pow(10., ((*i)->getHarmonoise_NoiseEmissions() / 10.));
238 const std::vector<MSLane*>& lanes = e->
getLanes();
239 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
240 sum += (*i)->getElectricityConsumption();
248 const std::vector<MSLane*>& lanes = e->
getLanes();
249 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
250 sum += (*i)->getVehicleNumber();
263 const std::vector<MSLane*>& lanes = e->
getLanes();
264 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
265 sum += (*i)->getNettoOccupancy();
273 const std::vector<MSLane*>& lanes = e->
getLanes();
274 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
276 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
281 (*i)->releaseVehicles();
288 double lengthSum = 0;
290 const std::vector<MSLane*>& lanes = e->
getLanes();
291 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
293 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
294 lengthSum += (*j)->getVehicleType().getLength();
296 noVehicles += (int) vehs.size();
297 (*i)->releaseVehicles();
300 if (noVehicles == 0) {
303 tempMsg.
writeDouble(lengthSum / (
double) noVehicles);
308 std::string paramName =
"";
329 std::string warning =
"";
345 std::vector<std::string> classes;
350 const std::vector<MSLane*>& lanes = e->
getLanes();
351 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
359 std::vector<std::string> classes;
364 const std::vector<MSLane*>& lanes = e->
getLanes();
365 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
376 int parameterCount = inputStorage.
readInt();
377 if (parameterCount == 3) {
379 int begTime = 0, endTime = 0;
391 }
else if (parameterCount == 1) {
408 int parameterCount = inputStorage.
readInt();
409 if (parameterCount == 3) {
411 int begTime = 0, endTime = 0;
423 }
else if (parameterCount == 1) {
441 const std::vector<MSLane*>& lanes = e->
getLanes();
442 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
443 (*i)->setMaxSpeed(value);
478 const std::vector<MSLane*>& lanes = e->
getLanes();
479 shape = lanes.front()->getShape();
480 if (lanes.size() > 1) {
481 copy(lanes.back()->getShape().begin(), lanes.back()->getShape().end(), back_inserter(shape));
#define LAST_STEP_MEAN_SPEED
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
#define VAR_CURRENT_TRAVELTIME
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
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 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.
double getMeanSpeed() const
get the mean speed
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
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 bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xca: Change Edge State)
virtual void writeUnsignedByte(int)
#define CMD_SET_EDGE_VARIABLE
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
std::vector< MSTransportable * > getSortedPersons(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's persons sorted by pos.
#define VAR_NOISEEMISSION
#define VAR_FUELCONSUMPTION
virtual void writeInt(int)
virtual int readUnsignedByte()
double getCurrentTravelTime(const double minSpeed=NUMERICAL_EPS) const
Computes and returns the current travel time for this edge.
A road/street connecting two junctions.
void rebuildAllowedLanes()
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
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)
#define CMD_SET_VEHICLE_VARIABLE
virtual std::string readString()
#define CMD_GET_EDGE_VARIABLE
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
TraCI server used to control sumo by a remote TraCI client.
std::vector< MSVehicle * > VehCont
Container for vehicles.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
#define LAST_STEP_VEHICLE_NUMBER
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.
#define VAR_EDGE_TRAVELTIME
static bool getShape(const std::string &id, PositionVector &shape)
Returns the named edge's shape.
virtual void writeString(const std::string &s)
#define LAST_STEP_VEHICLE_ID_LIST
std::string toHex(const T i, std::streamsize numDigits=0)
#define VAR_ELECTRICITYCONSUMPTION
virtual void writeDouble(double)
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
#define LAST_STEP_PERSON_ID_LIST
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
static const long CHANGE_PERMISSIONS_PERMANENT
static double sum(double val)
Computes the resulting noise.
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xaa: Get Edge Variable)
#define LAST_STEP_VEHICLE_HALTING_NUMBER
#define RESPONSE_GET_EDGE_VARIABLE
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.