48 #ifdef CHECK_MEMORY_LEAKS
50 #endif // CHECK_MEMORY_LEAKS
56 using namespace traci;
85 std::vector<std::string> ids;
90 std::vector<std::string> ids;
108 if (!
MSNet::getInstance()->getWeightsStorage().retrieveExistingTravelTime(e, 0, time, value)) {
123 if (!
MSNet::getInstance()->getWeightsStorage().retrieveExistingEffort(e, 0, time, value)) {
135 std::vector<std::string> vehIDs;
136 const std::vector<MSLane*>& lanes = e->
getLanes();
137 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
139 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
140 vehIDs.push_back((*j)->getID());
142 (*i)->releaseVehicles();
150 const std::vector<MSLane*>& lanes = e->
getLanes();
151 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
152 sum += (*i)->getHBEFA_CO2Emissions();
160 const std::vector<MSLane*>& lanes = e->
getLanes();
161 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
162 sum += (*i)->getHBEFA_COEmissions();
170 const std::vector<MSLane*>& lanes = e->
getLanes();
171 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
172 sum += (*i)->getHBEFA_HCEmissions();
180 const std::vector<MSLane*>& lanes = e->
getLanes();
181 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
182 sum += (*i)->getHBEFA_PMxEmissions();
190 const std::vector<MSLane*>& lanes = e->
getLanes();
191 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
192 sum += (*i)->getHBEFA_NOxEmissions();
200 const std::vector<MSLane*>& lanes = e->
getLanes();
201 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
202 sum += (*i)->getHBEFA_FuelConsumption();
210 const std::vector<MSLane*>& lanes = e->
getLanes();
211 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
212 sum += (
SUMOReal) pow(10., ((*i)->getHarmonoise_NoiseEmissions() / 10.));
224 const std::vector<MSLane*>& lanes = e->
getLanes();
225 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
226 sum += (*i)->getVehicleNumber();
234 const std::vector<MSLane*>& lanes = e->
getLanes();
235 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
236 sum += (*i)->getMeanSpeed();
244 const std::vector<MSLane*>& lanes = e->
getLanes();
245 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
246 sum += (*i)->getOccupancy();
254 const std::vector<MSLane*>& lanes = e->
getLanes();
255 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
257 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
262 (*i)->releaseVehicles();
271 const std::vector<MSLane*>& lanes = e->
getLanes();
272 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
274 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
275 lengthSum += (*j)->getVehicleType().getLength();
277 noVehicles += (
int) vehs.size();
278 (*i)->releaseVehicles();
281 if (noVehicles == 0) {
301 std::string warning =
"";
317 std::vector<std::string> classes;
322 const std::vector<MSLane*>& lanes = e->
getLanes();
323 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
324 (*i)->setPermissions(permissions);
331 std::vector<std::string> classes;
336 const std::vector<MSLane*>& lanes = e->
getLanes();
337 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
338 (*i)->setPermissions(permissions);
348 int parameterCount = inputStorage.
readInt();
349 if (parameterCount == 3) {
363 }
else if (parameterCount == 1) {
380 int parameterCount = inputStorage.
readInt();
381 if (parameterCount == 3) {
395 }
else if (parameterCount == 1) {
413 const std::vector<MSLane*>& lanes = e->
getLanes();
414 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
415 (*i)->setMaxSpeed(value);
433 const std::vector<MSLane*>& lanes = e->
getLanes();
434 shape.
push_back(lanes.front()->getShape());
435 if (lanes.size() > 1) {
436 shape.
push_back(lanes.back()->getShape().reverse());
446 for (std::vector<MSEdge*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
447 const std::vector<MSLane*>& lanes = (*i)->getLanes();
449 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
450 b.
add((*j)->getShape().getBoxBoundary());
#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
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
std::vector< MSVehicle * > VehCont
Container for vehicles.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
SUMOReal getCurrentTravelTime(const SUMOReal minSpeed=0.00001) const
Computes and returns the current travel time for this edge.
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
static TraCIRTree * getTree()
Returns a tree filled with edge instances.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
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...
virtual void writeUnsignedByte(int)
#define CMD_SET_EDGE_VARIABLE
#define VAR_NOISEEMISSION
#define VAR_FUELCONSUMPTION
A class that stores a 2D geometrical boundary.
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)
virtual int readUnsignedByte()
void addTravelTime(const MSEdge *const e, SUMOReal begin, SUMOReal end, SUMOReal value)
Adds a travel time information for an edge and a time span.
static bool processGet(traci::TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xaa: Get Edge Variable)
TraCI server used to control sumo by a remote TraCI client.
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
A road/street connecting two junctions.
void rebuildAllowedLanes()
virtual void writeStringList(const std::vector< std::string > &s)
void addObject(Named *o, Boundary &b)
Adds an additional object (detector/shape/trigger) for visualisation.
#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. ...
#define LAST_STEP_VEHICLE_NUMBER
#define VAR_EDGE_TRAVELTIME
void push_back(const PositionVector &p)
Appends all positions from the given vector.
A RT-tree for efficient storing of SUMO's GL-objects.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
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
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
static SUMOReal sum(SUMOReal val)
Computes the resulting noise.
virtual void writeDouble(double)
const std::vector< MSEdge * > & getEdges() const
Returns loaded edges.
#define LAST_STEP_OCCUPANCY
MSEdgeControl & getEdgeControl()
Returns the edge control.
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
#define LAST_STEP_VEHICLE_HALTING_NUMBER
static bool processSet(traci::TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xca: Change Edge State)
#define RESPONSE_GET_EDGE_VARIABLE
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.