Eclipse SUMO - Simulation of Urban MObility
Lane.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2017-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // C++ TraCI client API implementation
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <microsim/MSNet.h>
29 #include <microsim/MSLane.h>
30 #include <microsim/MSEdge.h>
31 #include <microsim/MSVehicle.h>
32 #include <libsumo/TraCIConstants.h>
33 #include "Lane.h"
34 
35 
36 namespace libsumo {
37 // ===========================================================================
38 // static member initializations
39 // ===========================================================================
42 
43 
44 // ===========================================================================
45 // static member definitions
46 // ===========================================================================
47 std::vector<std::string>
49  std::vector<std::string> ids;
50  MSLane::insertIDs(ids);
51  return ids;
52 }
53 
54 
55 int
57  return (int)getIDList().size();
58 }
59 
60 
61 std::string
62 Lane::getEdgeID(std::string laneID) {
63  return getLane(laneID)->getEdge().getID();
64 }
65 
66 
67 double
68 Lane::getLength(std::string laneID) {
69  return getLane(laneID)->getLength();
70 }
71 
72 
73 double
74 Lane::getMaxSpeed(std::string laneID) {
75  return getLane(laneID)->getSpeedLimit();
76 }
77 
78 
79 int
80 Lane::getLinkNumber(std::string laneID) {
81  return (int)getLane(laneID)->getLinkCont().size();
82 }
83 
84 
85 std::vector<TraCIConnection>
86 Lane::getLinks(std::string laneID) {
87  std::vector<TraCIConnection> v;
88  const MSLane* const lane = getLane(laneID);
89  const SUMOTime currTime = MSNet::getInstance()->getCurrentTimeStep();
90  for (const MSLink* const link : lane->getLinkCont()) {
91  const std::string approachedLane = link->getLane() != nullptr ? link->getLane()->getID() : "";
92  const bool hasPrio = link->havePriority();
93  const double speed = MIN2(lane->getSpeedLimit(), link->getLane()->getSpeedLimit());
94  const bool isOpen = link->opened(currTime, speed, speed, SUMOVTypeParameter::getDefault().length,
96  const bool hasFoe = link->hasApproachingFoe(currTime, currTime, 0, SUMOVTypeParameter::getDefaultDecel());
97  const std::string approachedInternal = link->getViaLane() != nullptr ? link->getViaLane()->getID() : "";
98  const std::string state = SUMOXMLDefinitions::LinkStates.getString(link->getState());
99  const std::string direction = SUMOXMLDefinitions::LinkDirections.getString(link->getDirection());
100  const double length = link->getLength();
101  v.push_back(TraCIConnection(approachedLane, hasPrio, isOpen, hasFoe, approachedInternal, state, direction, length));
102  }
103  return v;
104 }
105 
106 
107 std::vector<std::string>
108 Lane::getAllowed(std::string laneID) {
109  SVCPermissions permissions = getLane(laneID)->getPermissions();
110  if (permissions == SVCAll) { // special case: write nothing
111  permissions = 0;
112  }
113  return getVehicleClassNamesList(permissions);
114 }
115 
116 
117 std::vector<std::string>
118 Lane::getDisallowed(std::string laneID) {
119  return getVehicleClassNamesList(invertPermissions((getLane(laneID)->getPermissions()))); // negation yields disallowed
120 }
121 
122 
124 Lane::getShape(std::string laneID) {
126  const PositionVector& shp = getLane(laneID)->getShape();
127  for (PositionVector::const_iterator pi = shp.begin(); pi != shp.end(); ++pi) {
128  TraCIPosition p;
129  p.x = pi->x();
130  p.y = pi->y();
131  p.z = pi->z();
132  pv.push_back(p);
133  }
134  return pv;
135 }
136 
137 
138 double
139 Lane::getWidth(std::string laneID) {
140  return getLane(laneID)->getWidth();
141 }
142 
143 
144 double
145 Lane::getCO2Emission(std::string laneID) {
146  return getLane(laneID)->getCO2Emissions();
147 }
148 
149 
150 double
151 Lane::getCOEmission(std::string laneID) {
152  return getLane(laneID)->getCOEmissions();
153 }
154 
155 
156 double
157 Lane::getHCEmission(std::string laneID) {
158  return getLane(laneID)->getHCEmissions();
159 }
160 
161 
162 double
163 Lane::getPMxEmission(std::string laneID) {
164  return getLane(laneID)->getPMxEmissions();
165 }
166 
167 
168 double
169 Lane::getNOxEmission(std::string laneID) {
170  return getLane(laneID)->getNOxEmissions();
171 }
172 
173 double
174 Lane::getFuelConsumption(std::string laneID) {
175  return getLane(laneID)->getFuelConsumption();
176 }
177 
178 
179 double
180 Lane::getNoiseEmission(std::string laneID) {
181  return getLane(laneID)->getHarmonoise_NoiseEmissions();
182 }
183 
184 
185 double
186 Lane::getElectricityConsumption(std::string laneID) {
187  return getLane(laneID)->getElectricityConsumption();
188 }
189 
190 
191 double
192 Lane::getLastStepMeanSpeed(std::string laneID) {
193  return getLane(laneID)->getMeanSpeed();
194 }
195 
196 
197 double
198 Lane::getLastStepOccupancy(std::string laneID) {
199  return getLane(laneID)->getNettoOccupancy();
200 }
201 
202 
203 double
204 Lane::getLastStepLength(std::string laneID) {
205  const MSLane* lane = getLane(laneID);
206  double length = 0;
207  const MSLane::VehCont& vehs = lane->getVehiclesSecure();
208  for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
209  length += (*j)->getVehicleType().getLength();
210  }
211  if (vehs.size() > 0) {
212  length = length / (double)vehs.size();
213  }
214  lane->releaseVehicles();
215  return length;
216 }
217 
218 
219 double
220 Lane::getWaitingTime(std::string laneID) {
221  return getLane(laneID)->getWaitingSeconds();
222 }
223 
224 
225 double
226 Lane::getTraveltime(std::string laneID) {
227  const MSLane* lane = getLane(laneID);
228  double meanSpeed = lane->getMeanSpeed();
229  if (meanSpeed != 0) {
230  return lane->getLength() / meanSpeed;
231  } else {
232  return 1000000.;
233  }
234 }
235 
236 
237 int
238 Lane::getLastStepVehicleNumber(std::string laneID) {
239  return (int)getLane(laneID)->getVehicleNumber();
240 }
241 
242 int
243 Lane::getLastStepHaltingNumber(std::string laneID) {
244  const MSLane* lane = getLane(laneID);
245  int halting = 0;
246  const MSLane::VehCont& vehs = lane->getVehiclesSecure();
247  for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
248  if ((*j)->getSpeed() < SUMO_const_haltingSpeed) {
249  ++halting;
250  }
251  }
252  lane->releaseVehicles();
253  return halting;
254 }
255 
256 
257 std::vector<std::string>
258 Lane::getLastStepVehicleIDs(std::string laneID) {
259  const MSLane* lane = getLane(laneID);
260  std::vector<std::string> vehIDs;
261  const MSLane::VehCont& vehs = lane->getVehiclesSecure();
262  for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
263  vehIDs.push_back((*j)->getID());
264  }
265  lane->releaseVehicles();
266  return vehIDs;
267 }
268 
269 
270 std::vector<std::string>
271 Lane::getFoes(const std::string& laneID, const std::string& toLaneID) {
272  std::vector<std::string> foeIDs;
273  const MSLane* from = getLane(laneID);
274  const MSLane* to = getLane(toLaneID);
275  const MSLink* link = MSLinkContHelper::getConnectingLink(*from, *to);
276  if (link == nullptr) {
277  throw TraCIException("No connection from lane '" + laneID + "' to lane '" + toLaneID + "'");
278  }
279  for (MSLink* foe : link->getFoeLinks()) {
280  foeIDs.push_back(foe->getLaneBefore()->getID());
281  }
282  return foeIDs;
283 }
284 
285 
286 std::vector<std::string>
287 Lane::getInternalFoes(const std::string& laneID) {
288  const MSLane* lane = getLane(laneID);
289  const std::vector<const MSLane*>* foeLanes;
290  std::vector<const MSLane*>::const_iterator it;
291  std::vector<std::string> foeIDs;
292 
293  if (lane->isInternal()) {
294  MSLink* link = lane->getLinkCont().front();
295  foeLanes = &link->getFoeLanes();
296 
297  for (it = foeLanes->begin(); foeLanes->end() != it; ++it) {
298  foeIDs.push_back((*it)->getID());
299  }
300  }
301  return foeIDs;
302 }
303 
304 
305 void
306 Lane::setAllowed(std::string laneID, std::vector<std::string> allowedClasses) {
307  MSLane* l = const_cast<MSLane*>(getLane(laneID));
310  for (MSEdge* const pred : l->getEdge().getPredecessors()) {
311  pred->rebuildAllowedTargets();
312  }
313 }
314 
315 
316 void
317 Lane::setDisallowed(std::string laneID, std::vector<std::string> disallowedClasses) {
318  MSLane* l = const_cast<MSLane*>(getLane(laneID));
319  l->setPermissions(invertPermissions(parseVehicleClasses(disallowedClasses)), MSLane::CHANGE_PERMISSIONS_PERMANENT); // negation yields allowed
321  for (MSEdge* const pred : l->getEdge().getPredecessors()) {
322  pred->rebuildAllowedTargets();
323  }
324 }
325 
326 
327 void
328 Lane::setMaxSpeed(std::string laneID, double speed) {
329  MSLane* l = const_cast<MSLane*>(getLane(laneID));
330  l->setMaxSpeed(speed);
331 }
332 
333 
334 void
335 Lane::setLength(std::string laneID, double length) {
336  MSLane* l = const_cast<MSLane*>(getLane(laneID));
337  l->setLength(length);
338 }
339 
340 
341 std::string
342 Lane::getParameter(const std::string& laneID, const std::string& param) {
343  return getLane(laneID)->getParameter(param, "");
344 }
345 
346 
347 void
348 Lane::setParameter(const std::string& laneID, const std::string& key, const std::string& value) {
349  MSLane* l = const_cast<MSLane*>(getLane(laneID));
350  l->setParameter(key, value);
351 }
352 
353 
355 
356 
357 const MSLane*
358 Lane::getLane(const std::string& id) {
359  const MSLane* r = MSLane::dictionary(id);
360  if (r == nullptr) {
361  throw TraCIException("Lane '" + id + "' is not known");
362  }
363  return r;
364 }
365 
366 
367 void
368 Lane::storeShape(const std::string& id, PositionVector& shape) {
369  shape = getLane(id)->getShape();
370 }
371 
372 
373 std::shared_ptr<VariableWrapper>
375  return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
376 }
377 
378 
379 bool
380 Lane::handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper) {
381  switch (variable) {
382  case TRACI_ID_LIST:
383  return wrapper->wrapStringList(objID, variable, getIDList());
384  case ID_COUNT:
385  return wrapper->wrapInt(objID, variable, getIDCount());
386  case LANE_LINK_NUMBER:
387  return wrapper->wrapInt(objID, variable, getLinkNumber(objID));
388  case LANE_EDGE_ID:
389  return wrapper->wrapString(objID, variable, getEdgeID(objID));
390  case VAR_LENGTH:
391  return wrapper->wrapDouble(objID, variable, getLength(objID));
392  case VAR_MAXSPEED:
393  return wrapper->wrapDouble(objID, variable, getMaxSpeed(objID));
394  case LANE_ALLOWED:
395  return wrapper->wrapStringList(objID, variable, getAllowed(objID));
396  case LANE_DISALLOWED:
397  return wrapper->wrapStringList(objID, variable, getDisallowed(objID));
398  case VAR_CO2EMISSION:
399  return wrapper->wrapDouble(objID, variable, getCO2Emission(objID));
400  case VAR_COEMISSION:
401  return wrapper->wrapDouble(objID, variable, getCOEmission(objID));
402  case VAR_HCEMISSION:
403  return wrapper->wrapDouble(objID, variable, getHCEmission(objID));
404  case VAR_PMXEMISSION:
405  return wrapper->wrapDouble(objID, variable, getPMxEmission(objID));
406  case VAR_NOXEMISSION:
407  return wrapper->wrapDouble(objID, variable, getNOxEmission(objID));
408  case VAR_FUELCONSUMPTION:
409  return wrapper->wrapDouble(objID, variable, getFuelConsumption(objID));
410  case VAR_NOISEEMISSION:
411  return wrapper->wrapDouble(objID, variable, getNoiseEmission(objID));
413  return wrapper->wrapDouble(objID, variable, getElectricityConsumption(objID));
415  return wrapper->wrapInt(objID, variable, getLastStepVehicleNumber(objID));
417  return wrapper->wrapDouble(objID, variable, getLastStepMeanSpeed(objID));
419  return wrapper->wrapStringList(objID, variable, getLastStepVehicleIDs(objID));
420  case LAST_STEP_OCCUPANCY:
421  return wrapper->wrapDouble(objID, variable, getLastStepOccupancy(objID));
423  return wrapper->wrapInt(objID, variable, getLastStepHaltingNumber(objID));
424  case LAST_STEP_LENGTH:
425  return wrapper->wrapDouble(objID, variable, getLastStepLength(objID));
426  case VAR_WAITING_TIME:
427  return wrapper->wrapDouble(objID, variable, getWaitingTime(objID));
429  return wrapper->wrapDouble(objID, variable, getTraveltime(objID));
430  case VAR_WIDTH:
431  return wrapper->wrapDouble(objID, variable, getWidth(objID));
432  default:
433  return false;
434  }
435 }
436 
437 
438 }
439 
440 
441 /****************************************************************************/
MSLane::releaseVehicles
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: MSLane.h:457
MSLane::getWaitingSeconds
double getWaitingSeconds() const
Returns the overall waiting time on this lane.
Definition: MSLane.cpp:2707
MSLane::getVehiclesSecure
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: MSLane.h:427
libsumo::Lane::getInternalFoes
static std::vector< std::string > getInternalFoes(const std::string &laneID)
Definition: Lane.cpp:287
libsumo::LAST_STEP_VEHICLE_HALTING_NUMBER
TRACI_CONST int LAST_STEP_VEHICLE_HALTING_NUMBER
Definition: TraCIConstants.h:525
MSLane::dictionary
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1866
MSLane::getCOEmissions
double getCOEmissions() const
Returns the sum of last step CO emissions.
Definition: MSLane.cpp:2748
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:73
libsumo::Lane::setMaxSpeed
static void setMaxSpeed(std::string laneID, double speed)
Definition: Lane.cpp:328
getVehicleClassNamesList
const std::vector< std::string > & getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
Definition: SUMOVehicleClass.cpp:181
TraCIPositionVector
A list of positions.
libsumo::Lane::getLastStepHaltingNumber
static int getLastStepHaltingNumber(std::string laneID)
Definition: Lane.cpp:243
SUMOXMLDefinitions::LinkStates
static StringBijection< LinkState > LinkStates
link states
Definition: SUMOXMLDefinitions.h:1386
MSNet.h
libsumo::Lane::getCOEmission
static double getCOEmission(std::string laneID)
Definition: Lane.cpp:151
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
libsumo::VariableWrapper::wrapString
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
libsumo::VAR_FUELCONSUMPTION
TRACI_CONST int VAR_FUELCONSUMPTION
Definition: TraCIConstants.h:799
libsumo::Lane::getTraveltime
static double getTraveltime(std::string laneID)
Definition: Lane.cpp:226
libsumo::TraCIPosition
A 3D-position.
Definition: TraCIDefs.h:109
StringBijection::getString
const std::string & getString(const T key) const
Definition: StringBijection.h:106
libsumo::VAR_MAXSPEED
TRACI_CONST int VAR_MAXSPEED
Definition: TraCIConstants.h:615
libsumo::TraCIPosition::x
double x
Definition: TraCIDefs.h:115
libsumo::VariableWrapper
Definition: Subscription.h:132
libsumo::VAR_WAITING_TIME
TRACI_CONST int VAR_WAITING_TIME
Definition: TraCIConstants.h:825
libsumo::VAR_WIDTH
TRACI_CONST int VAR_WIDTH
Definition: TraCIConstants.h:666
libsumo::Lane::getCO2Emission
static double getCO2Emission(std::string laneID)
Definition: Lane.cpp:145
MSLane::getPermissions
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:548
libsumo::Lane::getLastStepMeanSpeed
static double getLastStepMeanSpeed(std::string laneID)
Definition: Lane.cpp:192
libsumo::Lane::getLastStepLength
static double getLastStepLength(std::string laneID)
Definition: Lane.cpp:204
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
libsumo::Lane::storeShape
static LIBSUMO_SUBSCRIPTION_API void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
Definition: Lane.cpp:368
MSLane::VehCont
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:92
libsumo::LANE_DISALLOWED
TRACI_CONST int LANE_DISALLOWED
Definition: TraCIConstants.h:600
libsumo::VAR_COEMISSION
TRACI_CONST int VAR_COEMISSION
Definition: TraCIConstants.h:787
libsumo::Lane::getFoes
static std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID)
Definition: Lane.cpp:271
MSLane::getHarmonoise_NoiseEmissions
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
Definition: MSLane.cpp:2820
libsumo::ContextSubscriptionResults
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:204
libsumo::Lane::setParameter
static void setParameter(const std::string &routeID, const std::string &key, const std::string &value)
Definition: Lane.cpp:348
libsumo::Lane::setLength
static void setLength(std::string laneID, double length)
Definition: Lane.cpp:335
MSLane::getHCEmissions
double getHCEmissions() const
Returns the sum of last step HC emissions.
Definition: MSLane.cpp:2784
libsumo::LAST_STEP_VEHICLE_ID_LIST
TRACI_CONST int LAST_STEP_VEHICLE_ID_LIST
Definition: TraCIConstants.h:519
MSEdge.h
libsumo::VAR_NOISEEMISSION
TRACI_CONST int VAR_NOISEEMISSION
Definition: TraCIConstants.h:802
PositionVector
A list of positions.
Definition: PositionVector.h:45
MSLane::setMaxSpeed
void setMaxSpeed(double val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
Definition: MSLane.cpp:2155
SUMOXMLDefinitions::LinkDirections
static StringBijection< LinkDirection > LinkDirections
link directions
Definition: SUMOXMLDefinitions.h:1389
SUMO_const_haltingSpeed
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:60
libsumo::Lane::setAllowed
static void setAllowed(std::string laneID, std::vector< std::string > allowedClasses)
Definition: Lane.cpp:306
Parameterised::getParameter
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
Definition: Parameterised.cpp:72
libsumo::Lane::getShape
static TraCIPositionVector getShape(std::string laneID)
Definition: Lane.cpp:124
MSVehicle.h
libsumo
Definition: Edge.cpp:29
MSLane::getVehicleNumber
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
Definition: MSLane.h:400
libsumo::Lane::getLastStepVehicleIDs
static std::vector< std::string > getLastStepVehicleIDs(std::string laneID)
Definition: Lane.cpp:258
libsumo::Lane::getIDCount
static int getIDCount()
Definition: Lane.cpp:56
libsumo::VAR_NOXEMISSION
TRACI_CONST int VAR_NOXEMISSION
Definition: TraCIConstants.h:796
libsumo::Lane::getParameter
static std::string getParameter(const std::string &laneID, const std::string &param)
Definition: Lane.cpp:342
parseVehicleClasses
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
Definition: SUMOVehicleClass.cpp:222
libsumo::VAR_CURRENT_TRAVELTIME
TRACI_CONST int VAR_CURRENT_TRAVELTIME
Definition: TraCIConstants.h:711
MSLane::insertIDs
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
Definition: MSLane.cpp:1898
MSLane::getCO2Emissions
double getCO2Emissions() const
Returns the sum of last step CO2 emissions.
Definition: MSLane.cpp:2736
libsumo::VariableWrapper::wrapDouble
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
MSLane::getElectricityConsumption
double getElectricityConsumption() const
Returns the sum of last step electricity consumption.
Definition: MSLane.cpp:2808
MSLane::setPermissions
void setPermissions(SVCPermissions permissions, long long transientID)
Sets the permissions to the given value. If a transientID is given, the permissions are recored as te...
Definition: MSLane.cpp:3630
TraCIConstants.h
MSLane::CHANGE_PERMISSIONS_PERMANENT
static const long CHANGE_PERMISSIONS_PERMANENT
Definition: MSLane.h:1205
libsumo::Lane::getElectricityConsumption
static double getElectricityConsumption(std::string laneID)
Definition: Lane.cpp:186
libsumo::Lane::getNOxEmission
static double getNOxEmission(std::string laneID)
Definition: Lane.cpp:169
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:218
libsumo::Lane::getFuelConsumption
static double getFuelConsumption(std::string laneID)
Definition: Lane.cpp:174
libsumo::VariableWrapper::wrapStringList
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:283
libsumo::Lane::getLastStepVehicleNumber
static int getLastStepVehicleNumber(std::string laneID)
Definition: Lane.cpp:238
libsumo::TraCIConnection
Definition: TraCIDefs.h:265
libsumo::VAR_PMXEMISSION
TRACI_CONST int VAR_PMXEMISSION
Definition: TraCIConstants.h:793
MSLane::getNOxEmissions
double getNOxEmissions() const
Returns the sum of last step NOx emissions.
Definition: MSLane.cpp:2772
libsumo::Lane::getMaxSpeed
static double getMaxSpeed(std::string laneID)
Definition: Lane.cpp:74
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:540
SUMOVTypeParameter::getDefaultDecel
static double getDefaultDecel(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default deceleration for the given vehicle class This needs to be a function because the ...
Definition: SUMOVTypeParameter.cpp:610
libsumo::Lane::makeWrapper
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: Lane.cpp:374
libsumo::TraCIPosition::z
double z
Definition: TraCIDefs.h:115
MSLane::getMeanSpeed
double getMeanSpeed() const
Returns the mean speed on this lane.
Definition: MSLane.cpp:2720
libsumo::Lane::myContextSubscriptionResults
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Lane.h:110
libsumo::TRACI_ID_LIST
TRACI_CONST int TRACI_ID_LIST
Definition: TraCIConstants.h:498
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
LIBSUMO_SUBSCRIPTION_IMPLEMENTATION
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
Definition: TraCIDefs.h:50
libsumo::Lane::getEdgeID
static std::string getEdgeID(std::string laneID)
Definition: Lane.cpp:62
libsumo::Lane::mySubscriptionResults
static SubscriptionResults mySubscriptionResults
Definition: Lane.h:109
libsumo::Lane::getWaitingTime
static double getWaitingTime(std::string laneID)
Definition: Lane.cpp:220
libsumo::ID_COUNT
TRACI_CONST int ID_COUNT
Definition: TraCIConstants.h:501
MSLane::getNettoOccupancy
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)
Definition: MSLane.cpp:2692
MSLane::getLinkCont
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
Definition: MSLane.cpp:2110
libsumo::VAR_LENGTH
TRACI_CONST int VAR_LENGTH
Definition: TraCIConstants.h:627
libsumo::TraCIException
Definition: TraCIDefs.h:89
libsumo::Lane::handleVariable
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: Lane.cpp:380
MSLane::getPMxEmissions
double getPMxEmissions() const
Returns the sum of last step PMx emissions.
Definition: MSLane.cpp:2760
libsumo::LANE_EDGE_ID
TRACI_CONST int LANE_EDGE_ID
Definition: TraCIConstants.h:591
libsumo::Lane::getLinks
static std::vector< TraCIConnection > getLinks(std::string laneID)
Definition: Lane.cpp:86
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:669
MSLane::getShape
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:477
libsumo::VAR_CO2EMISSION
TRACI_CONST int VAR_CO2EMISSION
Definition: TraCIConstants.h:784
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
libsumo::LANE_LINK_NUMBER
TRACI_CONST int LANE_LINK_NUMBER
Definition: TraCIConstants.h:588
libsumo::Lane::getLinkNumber
static int getLinkNumber(std::string laneID)
Definition: Lane.cpp:80
libsumo::Lane::getAllowed
static std::vector< std::string > getAllowed(std::string laneID)
Definition: Lane.cpp:108
libsumo::LANE_ALLOWED
TRACI_CONST int LANE_ALLOWED
Definition: TraCIConstants.h:597
libsumo::Lane::getLength
static double getLength(std::string laneID)
Definition: Lane.cpp:68
libsumo::LAST_STEP_MEAN_SPEED
TRACI_CONST int LAST_STEP_MEAN_SPEED
Definition: TraCIConstants.h:516
SVCAll
const SVCPermissions SVCAll
all VClasses are allowed
Definition: SUMOVehicleClass.cpp:146
libsumo::VariableWrapper::wrapInt
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
libsumo::Lane::getNoiseEmission
static double getNoiseEmission(std::string laneID)
Definition: Lane.cpp:180
libsumo::Lane::getHCEmission
static double getHCEmission(std::string laneID)
Definition: Lane.cpp:157
MSLane::setLength
void setLength(double val)
Sets a new length for the lane (used by TraCI only)
Definition: MSLane.cpp:2162
Lane.h
Parameterised::setParameter
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: Parameterised.cpp:46
libsumo::Lane::getDisallowed
static std::vector< std::string > getDisallowed(std::string laneID)
Definition: Lane.cpp:118
libsumo::Lane::getWidth
static double getWidth(std::string laneID)
Definition: Lane.cpp:139
libsumo::Lane::getIDList
static std::vector< std::string > getIDList()
Definition: Lane.cpp:48
MSLane::getWidth
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:556
libsumo::VAR_ELECTRICITYCONSUMPTION
TRACI_CONST int VAR_ELECTRICITYCONSUMPTION
Definition: TraCIConstants.h:849
libsumo::Lane::getLane
static const MSLane * getLane(const std::string &id)
Definition: Lane.cpp:358
config.h
libsumo::VAR_HCEMISSION
TRACI_CONST int VAR_HCEMISSION
Definition: TraCIConstants.h:790
MSLane::isInternal
bool isInternal() const
Definition: MSLane.cpp:2010
libsumo::Lane
Definition: Lane.h:50
libsumo::LAST_STEP_VEHICLE_NUMBER
TRACI_CONST int LAST_STEP_VEHICLE_NUMBER
Definition: TraCIConstants.h:513
libsumo::Lane::getLastStepOccupancy
static double getLastStepOccupancy(std::string laneID)
Definition: Lane.cpp:198
MSLane.h
MSLane::getSpeedLimit
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:532
libsumo::LAST_STEP_OCCUPANCY
TRACI_CONST int LAST_STEP_OCCUPANCY
Definition: TraCIConstants.h:522
MSLane::getFuelConsumption
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
Definition: MSLane.cpp:2796
invertPermissions
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
Definition: SUMOVehicleClass.cpp:285
libsumo::Lane::getPMxEmission
static double getPMxEmission(std::string laneID)
Definition: Lane.cpp:163
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
libsumo::LAST_STEP_LENGTH
TRACI_CONST int LAST_STEP_LENGTH
Definition: TraCIConstants.h:528
libsumo::SubscriptionResults
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:203
MSEdge::rebuildAllowedLanes
void rebuildAllowedLanes()
Definition: MSEdge.cpp:243
libsumo::Lane::setDisallowed
static void setDisallowed(std::string laneID, std::vector< std::string > disallowedClasses)
Definition: Lane.cpp:317
SUMOVTypeParameter::getDefault
static const SUMOVTypeParameter & getDefault()
return the default parameters, this is a function due to the http://www.parashift....
Definition: SUMOVTypeParameter.cpp:702
MSEdge::getPredecessors
const MSEdgeVector & getPredecessors() const
Definition: MSEdge.h:354
libsumo::TraCIPosition::y
double y
Definition: TraCIDefs.h:115