51std::vector<std::string>
54 std::vector<std::string> ids;
62 return (
int)getIDList().size();
68 return getLane(laneID)->getEdge().getID();
74 return getLane(laneID)->getLength();
80 return getLane(laneID)->getSpeedLimit();
85 return getLane(laneID)->getFrictionCoefficient();
90 return (
int)
getLane(laneID)->getLinkCont().size();
94std::vector<TraCIConnection>
96 std::vector<TraCIConnection> v;
100 const std::string approachedLane = link->getLane() !=
nullptr ? link->getLane()->getID() :
"";
101 const bool hasPrio = link->havePriority();
102 const double speed =
MIN2(lane->
getSpeedLimit(), link->getLane()->getSpeedLimit());
106 const std::string approachedInternal = link->getViaLane() !=
nullptr ? link->getViaLane()->getID() :
"";
109 const double length = link->getLength();
110 v.push_back(TraCIConnection(approachedLane, hasPrio, isOpen, hasFoe, approachedInternal, state, direction, length));
116std::vector<std::string>
119 if (permissions ==
SVCAll) {
126std::vector<std::string>
132std::vector<std::string>
146 TraCIPositionVector pv;
148 for (PositionVector::const_iterator pi = shp.begin(); pi != shp.end(); ++pi) {
153 pv.value.push_back(p);
161 return getLane(laneID)->getWidth();
167 return getLane(laneID)->getEmissions<PollutantsInterface::CO2>();
173 return getLane(laneID)->getEmissions<PollutantsInterface::CO>();
179 return getLane(laneID)->getEmissions<PollutantsInterface::HC>();
185 return getLane(laneID)->getEmissions<PollutantsInterface::PM_X>();
191 return getLane(laneID)->getEmissions<PollutantsInterface::NO_X>();
196 return getLane(laneID)->getEmissions<PollutantsInterface::FUEL>();
202 return getLane(laneID)->getHarmonoise_NoiseEmissions();
208 return getLane(laneID)->getEmissions<PollutantsInterface::ELEC>();
214 return getLane(laneID)->getMeanSpeed();
220 return getLane(laneID)->getNettoOccupancy();
229 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
230 length += (*j)->getVehicleType().getLength();
232 if (vehs.size() > 0) {
233 length = length / (double)vehs.size();
242 return getLane(laneID)->getWaitingSeconds();
250 if (meanSpeed != 0) {
260 return (
int)
getLane(laneID)->getVehicleNumber();
269 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
279std::vector<std::string>
282 std::vector<std::string> vehIDs;
284 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
285 vehIDs.push_back((*j)->getID());
292std::vector<std::string>
294 if (toLaneID ==
"") {
297 std::vector<std::string> foeIDs;
299 if (link ==
nullptr) {
300 throw TraCIException(
"No connection from lane '" + laneID +
"' to lane '" + toLaneID +
"'");
303 foeIDs.push_back(foe->getLaneBefore()->getID());
309std::vector<std::string>
312 const std::vector<const MSLane*>* foeLanes;
313 std::vector<const MSLane*>::const_iterator it;
314 std::vector<std::string> foeIDs;
320 for (it = foeLanes->begin(); foeLanes->end() != it; ++it) {
321 foeIDs.push_back((*it)->getID());
328const std::vector<std::string>
331 std::vector<std::string> vehIDs;
333 if (veh->getLane() == l) {
334 vehIDs.push_back(veh->getID());
360 return bidi ==
nullptr ?
"" : bidi->
getID();
365 setAllowed(laneID, std::vector<std::string>({allowedClass}));
379 setDisallowed(laneID, std::vector<std::string>({disallowedClasses}));
406 getLane(laneID)->setMaxSpeed(speed,
false,
true);
412 getLane(laneID)->setLength(length);
418 getLane(laneID)->setFrictionCoefficient(friction);
423Lane::getParameter(
const std::string& laneID,
const std::string& param) {
424 return getLane(laneID)->getParameter(param,
"");
432Lane::setParameter(
const std::string& laneID,
const std::string& key,
const std::string&
value) {
433 getLane(laneID)->setParameter(key,
value);
443 if (lane ==
nullptr) {
444 throw TraCIException(
"Lane '" +
id +
"' is not known");
452 shape =
getLane(
id)->getShape();
456std::shared_ptr<VariableWrapper>
466 return wrapper->wrapStringList(objID, variable, getIDList());
468 return wrapper->wrapInt(objID, variable, getIDCount());
470 return wrapper->wrapInt(objID, variable,
getLinkNumber(objID));
472 return wrapper->wrapString(objID, variable,
getEdgeID(objID));
474 return wrapper->wrapDouble(objID, variable,
getLength(objID));
476 return wrapper->wrapDouble(objID, variable,
getMaxSpeed(objID));
478 return wrapper->wrapDouble(objID, variable,
getFriction(objID));
480 return wrapper->wrapStringList(objID, variable,
getAllowed(objID));
482 return wrapper->wrapStringList(objID, variable,
getDisallowed(objID));
486 return wrapper->wrapDouble(objID, variable,
getCO2Emission(objID));
488 return wrapper->wrapDouble(objID, variable,
getCOEmission(objID));
490 return wrapper->wrapDouble(objID, variable,
getHCEmission(objID));
492 return wrapper->wrapDouble(objID, variable,
getPMxEmission(objID));
494 return wrapper->wrapDouble(objID, variable,
getNOxEmission(objID));
514 return wrapper->wrapDouble(objID, variable,
getWaitingTime(objID));
516 return wrapper->wrapDouble(objID, variable,
getTraveltime(objID));
518 return wrapper->wrapDouble(objID, variable,
getWidth(objID));
520 return wrapper->wrapPositionVector(objID, variable,
getShape(objID));
526 return wrapper->wrapString(objID, variable,
getBidiLane(objID));
530 return wrapper->wrapConnectionVector(objID, variable,
getLinks(objID));
const std::string invalid_return< std::string >::value
const SVCPermissions SVCAll
all VClasses are allowed
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
const std::vector< std::string > & getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
static double naviDegree(const double angle)
static libsumo::TraCIPositionVector getShape(const std::string &laneID)
static int getLinkNumber(const std::string &laneID)
static int getLastStepVehicleNumber(const std::string &laneID)
static double getCOEmission(const std::string &laneID)
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setAllowed(const std::string &laneID, std::string allowedClasses)
static std::vector< std::string > getChangePermissions(const std::string &laneID, const int direction)
static double getWaitingTime(const std::string &laneID)
static double getFuelConsumption(const std::string &laneID)
static ContextSubscriptionResults myContextSubscriptionResults
static double getLastStepOccupancy(const std::string &laneID)
static double getNoiseEmission(const std::string &laneID)
static double getElectricityConsumption(const std::string &laneID)
static std::vector< std::string > getInternalFoes(const std::string &laneID)
static std::string getBidiLane(const std::string &laneID)
static std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID)
static SubscriptionResults mySubscriptionResults
static double getHCEmission(const std::string &laneID)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static void setLength(const std::string &laneID, double length)
static double getCO2Emission(const std::string &laneID)
static std::shared_ptr< VariableWrapper > makeWrapper()
static void setDisallowed(const std::string &laneID, std::string disallowedClasses)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static double getMaxSpeed(const std::string &laneID)
static void setFriction(const std::string &laneID, double friction)
static double getPMxEmission(const std::string &laneID)
static const std::vector< std::string > getPendingVehicles(const std::string &laneID)
static double getLastStepLength(const std::string &laneID)
static int getLastStepHaltingNumber(const std::string &laneID)
static MSLane * getLane(const std::string &id)
static std::vector< libsumo::TraCIConnection > getLinks(const std::string &laneID)
static double getLength(const std::string &laneID)
static double getAngle(const std::string &laneID, double relativePosition=libsumo::INVALID_DOUBLE_VALUE)
static double getTraveltime(const std::string &laneID)
static double getWidth(const std::string &laneID)
static void setChangePermissions(const std::string &laneID, std::vector< std::string > allowedClasses, const int direction)
static double getNOxEmission(const std::string &laneID)
static std::vector< std::string > getLastStepVehicleIDs(const std::string &laneID)
static std::vector< std::string > getAllowed(const std::string &laneID)
static double getLastStepMeanSpeed(const std::string &laneID)
static void setMaxSpeed(const std::string &laneID, double speed)
static std::string getEdgeID(const std::string &laneID)
static std::vector< std::string > getDisallowed(const std::string &laneID)
static double getFriction(const std::string &laneID)
C++ TraCI client API implementation.
void rebuildAllowedLanes(const bool onInit=false, bool updateVehicles=false)
Representation of a lane in the micro simulation.
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
void setChangeRight(SVCPermissions permissions)
Sets the permissions for changing to the right neighbour lane.
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
std::vector< MSVehicle * > VehCont
Container for vehicles.
static const long CHANGE_PERMISSIONS_PERMANENT
double getLength() const
Returns the lane's length.
void setChangeLeft(SVCPermissions permissions)
Sets the permissions for changing to the left neighbour lane.
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...
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
double interpolateLanePosToGeometryPos(double lanePos) const
virtual const PositionVector & getShape(bool) const
MSEdge & getEdge() const
Returns the lane's edge.
const std::vector< MSLink * > & getLinkCont() const
returns the container with all links !!!
double getMeanSpeed() const
Returns the mean speed on this lane.
const std::vector< const MSLane * > & getFoeLanes() const
const std::vector< MSLink * > & getFoeLinks() const
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
const std::string & getID() const
Returns the id.
A point in 2D or 3D with translation and scaling methods.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position (in radians bet...
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
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 ...
static const SUMOVTypeParameter & getDefault()
return the default parameters, this is a function due to the http://www.parashift....
Representation of a vehicle.
static StringBijection< LinkState > LinkStates
link states
static StringBijection< LinkDirection > LinkDirections
link directions
static int readTypedByte(tcpip::Storage &ret, const std::string &error="")
static std::string readTypedString(tcpip::Storage &ret, const std::string &error="")
static double readTypedDouble(tcpip::Storage &ret, const std::string &error="")
TRACI_CONST double INVALID_DOUBLE_VALUE
TRACI_CONST int LAST_STEP_VEHICLE_ID_LIST
TRACI_CONST int LAST_STEP_VEHICLE_NUMBER
TRACI_CONST int VAR_NOXEMISSION
TRACI_CONST int LANE_LINKS
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int VAR_WAITING_TIME
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int LANE_LINK_NUMBER
TRACI_CONST int LANE_CHANGES
TRACI_CONST int LAST_STEP_LENGTH
TRACI_CONST int VAR_ANGLE
TRACI_CONST int LANE_EDGE_ID
TRACI_CONST int VAR_PMXEMISSION
TRACI_CONST int VAR_COEMISSION
TRACI_CONST int VAR_WIDTH
TRACI_CONST int VAR_MAXSPEED
TRACI_CONST int LAST_STEP_MEAN_SPEED
TRACI_CONST int VAR_CO2EMISSION
TRACI_CONST int LANECHANGE_RIGHT
TRACI_CONST int VAR_PENDING_VEHICLES
TRACI_CONST int VAR_FUELCONSUMPTION
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_SHAPE
TRACI_CONST int LAST_STEP_VEHICLE_HALTING_NUMBER
TRACI_CONST int VAR_LENGTH
TRACI_CONST int VAR_HCEMISSION
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int LANECHANGE_LEFT
TRACI_CONST int LAST_STEP_OCCUPANCY
TRACI_CONST int VAR_NOISEEMISSION
TRACI_CONST int LANE_DISALLOWED
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int VAR_FRICTION
TRACI_CONST int VAR_CURRENT_TRAVELTIME
TRACI_CONST int LANE_ALLOWED
TRACI_CONST int VAR_ELECTRICITYCONSUMPTION