SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TraCIServerAPI_Edge.cpp
Go to the documentation of this file.
1 /****************************************************************************/
12 // APIs for getting/setting edge values via TraCI
13 /****************************************************************************/
14 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
15 // Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors
16 /****************************************************************************/
17 //
18 // This file is part of SUMO.
19 // SUMO is free software: you can redistribute it and/or modify
20 // it under the terms of the GNU General Public License as published by
21 // the Free Software Foundation, either version 3 of the License, or
22 // (at your option) any later version.
23 //
24 /****************************************************************************/
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #ifndef NO_TRACI
37 
38 #include <utils/common/StdDefs.h>
39 #include <microsim/MSNet.h>
40 #include <microsim/MSEdgeControl.h>
41 #include <microsim/MSEdge.h>
42 #include <microsim/MSLane.h>
43 #include <microsim/MSVehicle.h>
45 #include "TraCIConstants.h"
46 #include "TraCIServerAPI_Edge.h"
49 
50 #ifdef CHECK_MEMORY_LEAKS
51 #include <foreign/nvwa/debug_new.h>
52 #endif // CHECK_MEMORY_LEAKS
53 
54 
55 // ===========================================================================
56 // method definitions
57 // ===========================================================================
58 bool
60  tcpip::Storage& outputStorage) {
61  // variable & id
62  int variable = inputStorage.readUnsignedByte();
63  std::string id = inputStorage.readString();
64  // check variable
65  if (variable != ID_LIST && variable != VAR_EDGE_TRAVELTIME && variable != VAR_EDGE_EFFORT && variable != VAR_CURRENT_TRAVELTIME
66  && variable != VAR_CO2EMISSION && variable != VAR_COEMISSION && variable != VAR_HCEMISSION && variable != VAR_PMXEMISSION
67  && variable != VAR_NOXEMISSION && variable != VAR_FUELCONSUMPTION && variable != VAR_NOISEEMISSION
68  && variable != VAR_ELECTRICITYCONSUMPTION && variable != VAR_WAITING_TIME
69  && variable != LAST_STEP_VEHICLE_NUMBER && variable != LAST_STEP_MEAN_SPEED && variable != LAST_STEP_OCCUPANCY
70  && variable != LAST_STEP_VEHICLE_HALTING_NUMBER && variable != LAST_STEP_LENGTH
71  && variable != LAST_STEP_PERSON_ID_LIST
72  && variable != LAST_STEP_VEHICLE_ID_LIST && variable != ID_COUNT && variable != VAR_PARAMETER) {
73  return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "Get Edge Variable: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
74  }
75  // begin response building
76  tcpip::Storage tempMsg;
77  // response-code, variableID, objectID
79  tempMsg.writeUnsignedByte(variable);
80  tempMsg.writeString(id);
81  // process request
82  if (variable == ID_LIST) {
83  std::vector<std::string> ids;
84  MSEdge::insertIDs(ids);
86  tempMsg.writeStringList(ids);
87  } else if (variable == ID_COUNT) {
88  std::vector<std::string> ids;
89  MSEdge::insertIDs(ids);
91  tempMsg.writeInt((int) ids.size());
92  } else {
93  MSEdge* e = MSEdge::dictionary(id);
94  if (e == 0) {
95  return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "Edge '" + id + "' is not known", outputStorage);
96  }
97  switch (variable) {
98  case VAR_EDGE_TRAVELTIME: {
99  // time
100  int time = 0;
101  if (!server.readTypeCheckingInt(inputStorage, time)) {
102  return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "The message must contain the time definition.", outputStorage);
103  }
105  SUMOReal value;
106  if (!MSNet::getInstance()->getWeightsStorage().retrieveExistingTravelTime(e, time, value)) {
107  tempMsg.writeDouble(-1);
108  } else {
109  tempMsg.writeDouble(value);
110  }
111  }
112  break;
113  case VAR_EDGE_EFFORT: {
114  // time
115  int time = 0;
116  if (!server.readTypeCheckingInt(inputStorage, time)) {
117  return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "The message must contain the time definition.", outputStorage);
118  }
120  SUMOReal value;
121  if (!MSNet::getInstance()->getWeightsStorage().retrieveExistingEffort(e, time, value)) {
122  tempMsg.writeDouble(-1);
123  } else {
124  tempMsg.writeDouble(value);
125  }
126  }
127  break;
130  tempMsg.writeDouble(e->getCurrentTravelTime());
131  break;
132  case VAR_WAITING_TIME: {
133  SUMOReal wtime = 0;
134  const std::vector<MSLane*>& lanes = e->getLanes();
135  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
136  wtime += (*i)->getWaitingSeconds();
137  }
139  tempMsg.writeDouble(wtime);
140  }
141  break;
143  std::vector<std::string> personIDs;
144  std::vector<MSTransportable*> persons = e->getSortedPersons(MSNet::getInstance()->getCurrentTimeStep());
145  for (std::vector<MSTransportable*>::iterator it = persons.begin(); it != persons.end(); ++it) {
146  personIDs.push_back((*it)->getID());
147  }
149  tempMsg.writeStringList(personIDs);
150  }
151  break;
153  std::vector<std::string> vehIDs;
154  const std::vector<MSLane*>& lanes = e->getLanes();
155  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
156  const MSLane::VehCont& vehs = (*i)->getVehiclesSecure();
157  for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
158  vehIDs.push_back((*j)->getID());
159  }
160  (*i)->releaseVehicles();
161  }
163  tempMsg.writeStringList(vehIDs);
164  }
165  break;
166  case VAR_CO2EMISSION: {
167  SUMOReal sum = 0;
168  const std::vector<MSLane*>& lanes = e->getLanes();
169  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
170  sum += (*i)->getCO2Emissions();
171  }
173  tempMsg.writeDouble(sum);
174  }
175  break;
176  case VAR_COEMISSION: {
177  SUMOReal sum = 0;
178  const std::vector<MSLane*>& lanes = e->getLanes();
179  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
180  sum += (*i)->getCOEmissions();
181  }
183  tempMsg.writeDouble(sum);
184  }
185  break;
186  case VAR_HCEMISSION: {
187  SUMOReal sum = 0;
188  const std::vector<MSLane*>& lanes = e->getLanes();
189  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
190  sum += (*i)->getHCEmissions();
191  }
193  tempMsg.writeDouble(sum);
194  }
195  break;
196  case VAR_PMXEMISSION: {
197  SUMOReal sum = 0;
198  const std::vector<MSLane*>& lanes = e->getLanes();
199  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
200  sum += (*i)->getPMxEmissions();
201  }
203  tempMsg.writeDouble(sum);
204  }
205  break;
206  case VAR_NOXEMISSION: {
207  SUMOReal sum = 0;
208  const std::vector<MSLane*>& lanes = e->getLanes();
209  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
210  sum += (*i)->getNOxEmissions();
211  }
213  tempMsg.writeDouble(sum);
214  }
215  break;
216  case VAR_FUELCONSUMPTION: {
217  SUMOReal sum = 0;
218  const std::vector<MSLane*>& lanes = e->getLanes();
219  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
220  sum += (*i)->getFuelConsumption();
221  }
223  tempMsg.writeDouble(sum);
224  }
225  break;
226  case VAR_NOISEEMISSION: {
227  SUMOReal sum = 0;
228  const std::vector<MSLane*>& lanes = e->getLanes();
229  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
230  sum += (SUMOReal) pow(10., ((*i)->getHarmonoise_NoiseEmissions() / 10.));
231  }
233  if (sum != 0) {
234  tempMsg.writeDouble(HelpersHarmonoise::sum(sum));
235  } else {
236  tempMsg.writeDouble(0);
237  }
238  }
239  break;
241  SUMOReal sum = 0;
242  const std::vector<MSLane*>& lanes = e->getLanes();
243  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
244  sum += (*i)->getElectricityConsumption();
245  }
247  tempMsg.writeDouble(sum);
248  }
249  break;
251  int sum = 0;
252  const std::vector<MSLane*>& lanes = e->getLanes();
253  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
254  sum += (*i)->getVehicleNumber();
255  }
257  tempMsg.writeInt(sum);
258  }
259  break;
260  case LAST_STEP_MEAN_SPEED: {
262  tempMsg.writeDouble(e->getMeanSpeed());
263  }
264  break;
265  case LAST_STEP_OCCUPANCY: {
266  SUMOReal sum = 0;
267  const std::vector<MSLane*>& lanes = e->getLanes();
268  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
269  sum += (*i)->getNettoOccupancy();
270  }
272  tempMsg.writeDouble(sum / (SUMOReal) lanes.size());
273  }
274  break;
276  int halting = 0;
277  const std::vector<MSLane*>& lanes = e->getLanes();
278  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
279  const MSLane::VehCont& vehs = (*i)->getVehiclesSecure();
280  for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
281  if ((*j)->getSpeed() < SUMO_const_haltingSpeed) {
282  ++halting;
283  }
284  }
285  (*i)->releaseVehicles();
286  }
288  tempMsg.writeInt(halting);
289  }
290  break;
291  case LAST_STEP_LENGTH: {
292  SUMOReal lengthSum = 0;
293  int noVehicles = 0;
294  const std::vector<MSLane*>& lanes = e->getLanes();
295  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
296  const MSLane::VehCont& vehs = (*i)->getVehiclesSecure();
297  for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
298  lengthSum += (*j)->getVehicleType().getLength();
299  }
300  noVehicles += (int) vehs.size();
301  (*i)->releaseVehicles();
302  }
304  if (noVehicles == 0) {
305  tempMsg.writeDouble(0);
306  } else {
307  tempMsg.writeDouble(lengthSum / (SUMOReal) noVehicles);
308  }
309  }
310  break;
311  case VAR_PARAMETER: {
312  std::string paramName = "";
313  if (!server.readTypeCheckingString(inputStorage, paramName)) {
314  return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "Retrieval of a parameter requires its name.", outputStorage);
315  }
317  tempMsg.writeString(e->getParameter(paramName, ""));
318  }
319  break;
320  default:
321  break;
322  }
323  }
324  server.writeStatusCmd(CMD_GET_EDGE_VARIABLE, RTYPE_OK, "", outputStorage);
325  server.writeResponseWithLength(outputStorage, tempMsg);
326  return true;
327 }
328 
329 
330 bool
332  tcpip::Storage& outputStorage) {
333  std::string warning = ""; // additional description for response
334  // variable
335  int variable = inputStorage.readUnsignedByte();
336  if (variable != VAR_EDGE_TRAVELTIME && variable != VAR_EDGE_EFFORT && variable != VAR_MAXSPEED && variable != VAR_PARAMETER) {
337  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "Change Edge State: unsupported variable " + toHex(variable, 2) + " specified", outputStorage);
338  }
339  // id
340  std::string id = inputStorage.readString();
341  MSEdge* e = MSEdge::dictionary(id);
342  if (e == 0) {
343  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "Edge '" + id + "' is not known", outputStorage);
344  }
345  // process
346  switch (variable) {
347  case LANE_ALLOWED: {
348  // read and set allowed vehicle classes
349  std::vector<std::string> classes;
350  if (!server.readTypeCheckingStringList(inputStorage, classes)) {
351  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "Allowed vehicle classes must be given as a list of strings.", outputStorage);
352  }
353  SVCPermissions permissions = parseVehicleClasses(classes);
354  const std::vector<MSLane*>& lanes = e->getLanes();
355  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
356  (*i)->setPermissions(permissions, MSLane::CHANGE_PERMISSIONS_PERMANENT);
357  }
358  e->rebuildAllowedLanes();
359  }
360  break;
361  case LANE_DISALLOWED: {
362  // read and set disallowed vehicle classes
363  std::vector<std::string> classes;
364  if (!server.readTypeCheckingStringList(inputStorage, classes)) {
365  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "Not allowed vehicle classes must be given as a list of strings.", outputStorage);
366  }
367  SVCPermissions permissions = ~parseVehicleClasses(classes); // negation yields allowed
368  const std::vector<MSLane*>& lanes = e->getLanes();
369  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
370  (*i)->setPermissions(permissions, MSLane::CHANGE_PERMISSIONS_PERMANENT);
371  }
372  e->rebuildAllowedLanes();
373  }
374  break;
375  case VAR_EDGE_TRAVELTIME: {
376  // read and set travel time
377  if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) {
378  return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time requires a compound object.", outputStorage);
379  }
380  int parameterCount = inputStorage.readInt();
381  if (parameterCount == 3) {
382  // bound by time
383  int begTime = 0, endTime = 0;
384  double value = 0;
385  if (!server.readTypeCheckingInt(inputStorage, begTime)) {
386  return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "The first variable must be the begin time given as int.", outputStorage);
387  }
388  if (!server.readTypeCheckingInt(inputStorage, endTime)) {
389  return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "The second variable must be the end time given as int.", outputStorage);
390  }
391  if (!server.readTypeCheckingDouble(inputStorage, value)) {
392  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "The third variable must be the value given as double", outputStorage);
393  }
394  MSNet::getInstance()->getWeightsStorage().addTravelTime(e, begTime, endTime, value);
395  } else if (parameterCount == 1) {
396  // unbound
397  double value = 0;
398  if (!server.readTypeCheckingDouble(inputStorage, value)) {
399  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "The variable must be the value given as double", outputStorage);
400  }
402  } else {
403  return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting travel time requires either begin time, end time, and value, or only value as parameter.", outputStorage);
404  }
405  }
406  break;
407  case VAR_EDGE_EFFORT: {
408  // read and set effort
409  if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) {
410  return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort requires a compound object.", outputStorage);
411  }
412  int parameterCount = inputStorage.readInt();
413  if (parameterCount == 3) {
414  // bound by time
415  int begTime = 0, endTime = 0;
416  double value = 0;
417  if (!server.readTypeCheckingInt(inputStorage, begTime)) {
418  return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "The first variable must be the begin time given as int.", outputStorage);
419  }
420  if (!server.readTypeCheckingInt(inputStorage, endTime)) {
421  return server.writeErrorStatusCmd(CMD_GET_EDGE_VARIABLE, "The second variable must be the end time given as int.", outputStorage);
422  }
423  if (!server.readTypeCheckingDouble(inputStorage, value)) {
424  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "The third variable must be the value given as double", outputStorage);
425  }
426  MSNet::getInstance()->getWeightsStorage().addEffort(e, begTime, endTime, value);
427  } else if (parameterCount == 1) {
428  // unbound
429  double value = 0;
430  if (!server.readTypeCheckingDouble(inputStorage, value)) {
431  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "The variable must be the value given as double", outputStorage);
432  }
434  } else {
435  return server.writeErrorStatusCmd(CMD_SET_VEHICLE_VARIABLE, "Setting effort requires either begin time, end time, and value, or only value as parameter.", outputStorage);
436  }
437  }
438  break;
439  case VAR_MAXSPEED: {
440  // read and set max. speed
441  double value = 0;
442  if (!server.readTypeCheckingDouble(inputStorage, value)) {
443  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "The speed must be given as a double.", outputStorage);
444  }
445  const std::vector<MSLane*>& lanes = e->getLanes();
446  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
447  (*i)->setMaxSpeed(value);
448  }
449  }
450  break;
451  case VAR_PARAMETER: {
452  if (inputStorage.readUnsignedByte() != TYPE_COMPOUND) {
453  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "A compound object is needed for setting a parameter.", outputStorage);
454  }
455  //readt itemNo
456  inputStorage.readInt();
457  std::string name;
458  if (!server.readTypeCheckingString(inputStorage, name)) {
459  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "The name of the parameter must be given as a string.", outputStorage);
460  }
461  std::string value;
462  if (!server.readTypeCheckingString(inputStorage, value)) {
463  return server.writeErrorStatusCmd(CMD_SET_EDGE_VARIABLE, "The value of the parameter must be given as a string.", outputStorage);
464  }
465  e->addParameter(name, value);
466  }
467  break;
468  default:
469  break;
470  }
471  server.writeStatusCmd(CMD_SET_EDGE_VARIABLE, RTYPE_OK, warning, outputStorage);
472  return true;
473 }
474 
475 
476 bool
477 TraCIServerAPI_Edge::getShape(const std::string& id, PositionVector& shape) {
478  MSEdge* e = MSEdge::dictionary(id);
479  if (e == 0) {
480  return false;
481  }
482  const std::vector<MSLane*>& lanes = e->getLanes();
483  shape = lanes.front()->getShape();
484  if (lanes.size() > 1) {
485  copy(lanes.back()->getShape().begin(), lanes.back()->getShape().end(), back_inserter(shape));
486  }
487  return true;
488 }
489 
490 #endif
491 
492 
493 /****************************************************************************/
494 
#define LAST_STEP_MEAN_SPEED
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
Definition: MSEdge.cpp:721
#define VAR_CO2EMISSION
#define TYPE_COMPOUND
#define VAR_CURRENT_TRAVELTIME
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:192
int SVCPermissions
#define RTYPE_OK
#define VAR_WAITING_TIME
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:159
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
#define TYPE_STRINGLIST
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...
Definition: MSEdge.cpp:673
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
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
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
void addEffort(const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value)
Adds an effort information for an edge and a time span.
virtual void writeInt(int)
#define TYPE_STRING
virtual int readUnsignedByte()
#define LAST_STEP_LENGTH
void addTravelTime(const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value)
Adds a travel time information for an edge and a time span.
#define VAR_NOXEMISSION
A road/street connecting two junctions.
Definition: MSEdge.h:80
#define LANE_ALLOWED
void rebuildAllowedLanes()
Definition: MSEdge.cpp:251
virtual int readInt()
A list of positions.
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 VAR_PMXEMISSION
#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...
#define VAR_EDGE_EFFORT
TraCI server used to control sumo by a remote TraCI client.
Definition: TraCIServer.h:73
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:91
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.
#define VAR_EDGE_TRAVELTIME
#define VAR_COEMISSION
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
#define LANE_DISALLOWED
#define SUMOTime_MAX
Definition: SUMOTime.h:44
#define TYPE_DOUBLE
std::string toHex(const T i, std::streamsize numDigits=0)
Definition: ToString.h:65
SUMOReal getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:629
#define VAR_ELECTRICITYCONSUMPTION
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:57
static SUMOReal sum(SUMOReal val)
Computes the resulting noise.
virtual void writeDouble(double)
#define SUMOReal
Definition: config.h:214
#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
#define VAR_MAXSPEED
#define VAR_PARAMETER
#define ID_COUNT
static const long CHANGE_PERMISSIONS_PERMANENT
Definition: MSLane.h:977
#define TYPE_INTEGER
#define ID_LIST
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xaa: Get Edge Variable)
SUMOReal getCurrentTravelTime(const SUMOReal minSpeed=NUMERICAL_EPS) const
Computes and returns the current travel time for this edge.
Definition: MSEdge.cpp:656
#define LAST_STEP_VEHICLE_HALTING_NUMBER
std::vector< MSTransportable * > getSortedPersons(SUMOTime timestep) const
Returns this edge's persons sorted by pos.
Definition: MSEdge.cpp:794
#define VAR_HCEMISSION
#define RESPONSE_GET_EDGE_VARIABLE
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition: MSNet.cpp:716