46 std::vector<std::string>
48 std::vector<std::string> ids;
56 return (
int)getIDList().size();
84 std::vector<TraCIConnection>
86 std::vector<TraCIConnection> v;
90 const std::string approachedLane = link->getLane() !=
nullptr ? link->getLane()->getID() :
"";
91 const bool hasPrio = link->havePriority();
92 const double speed =
MIN2(lane->
getSpeedLimit(), link->getLane()->getSpeedLimit());
96 const std::string approachedInternal = link->getViaLane() !=
nullptr ? link->getViaLane()->getID() :
"";
99 const double length = link->getLength();
100 v.push_back(
TraCIConnection(approachedLane, hasPrio, isOpen, hasFoe, approachedInternal, state, direction, length));
106 std::vector<std::string>
109 if (permissions ==
SVCAll) {
116 std::vector<std::string>
126 for (PositionVector::const_iterator pi = shp.begin(); pi != shp.end(); ++pi) {
207 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
208 length += (*j)->getVehicleType().getLength();
210 if (vehs.size() > 0) {
211 length = length / (double)vehs.size();
228 if (meanSpeed != 0) {
246 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
256 std::vector<std::string>
259 std::vector<std::string> vehIDs;
261 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
262 vehIDs.push_back((*j)->getID());
269 std::vector<std::string>
271 std::vector<std::string> foeIDs;
273 if (link ==
nullptr) {
274 throw TraCIException(
"No connection from lane '" + laneID +
"' to lane '" + toLaneID +
"'");
277 foeIDs.push_back(foe->getLaneBefore()->getID());
283 std::vector<std::string>
286 const std::vector<const MSLane*>* foeLanes;
287 std::vector<const MSLane*>::const_iterator it;
288 std::vector<std::string> foeIDs;
294 for (it = foeLanes->begin(); foeLanes->end() != it; ++it) {
295 foeIDs.push_back((*it)->getID());
304 setAllowed(laneID, std::vector<std::string>({allowedClass}));
314 pred->rebuildAllowedTargets();
325 pred->rebuildAllowedTargets();
345 Lane::getParameter(
const std::string& laneID,
const std::string& param) {
354 Lane::setParameter(
const std::string& laneID,
const std::string& key,
const std::string& value) {
379 std::shared_ptr<VariableWrapper>
391 return wrapper->
wrapInt(objID, variable, getIDCount());
static double getCO2Emission(std::string laneID)
static double getLength(std::string laneID)
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
static double getNOxEmission(std::string laneID)
static std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID)
static std::vector< TraCIConnection > getLinks(std::string laneID)
double getNOxEmissions() const
Returns the sum of last step NOx emissions.
MSEdge & getEdge() const
Returns the lane's edge.
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
TRACI_CONST int VAR_COEMISSION
static std::string getEdgeID(std::string laneID)
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
TRACI_CONST int LAST_STEP_LENGTH
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
TRACI_CONST int VAR_WIDTH
TRACI_CONST int VAR_WAITING_TIME
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
void setMaxSpeed(double val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
const MSEdgeVector & getPredecessors() const
const std::string & getString(const T key) const
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
static std::vector< std::string > getAllowed(std::string laneID)
static std::shared_ptr< VariableWrapper > makeWrapper()
static std::vector< std::string > getInternalFoes(const std::string &laneID)
static double getElectricityConsumption(std::string laneID)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static double getFuelConsumption(std::string laneID)
double getPMxEmissions() const
Returns the sum of last step PMx emissions.
TRACI_CONST int VAR_FUELCONSUMPTION
double getLength() const
Returns the lane's length.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
const PositionVector & getShape() const
Returns this lane's shape.
TRACI_CONST int LANE_DISALLOWED
static int getLastStepHaltingNumber(std::string laneID)
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
static double getWidth(std::string laneID)
static int getLastStepVehicleNumber(std::string laneID)
const std::string & getID() const
Returns the id.
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
static StringBijection< LinkState > LinkStates
link states
const SVCPermissions SVCAll
all VClasses are allowed
static double getMaxSpeed(std::string laneID)
TRACI_CONST int VAR_MAXSPEED
TRACI_CONST int VAR_NOXEMISSION
double getWidth() const
Returns the lane's width.
static double getPMxEmission(std::string laneID)
static ContextSubscriptionResults myContextSubscriptionResults
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
static StringBijection< LinkDirection > LinkDirections
link directions
TRACI_CONST int TRACI_ID_LIST
A road/street connecting two junctions.
static double getLastStepLength(std::string laneID)
TRACI_CONST int LAST_STEP_VEHICLE_ID_LIST
TRACI_CONST int VAR_CURRENT_TRAVELTIME
void rebuildAllowedLanes()
TRACI_CONST int VAR_NOISEEMISSION
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 double getHCEmission(std::string laneID)
double getCO2Emissions() const
Returns the sum of last step CO2 emissions.
void setLength(double val)
Sets a new length for the lane (used by TraCI only)
const std::vector< const MSLane * > & getFoeLanes() const
static double getLastStepMeanSpeed(std::string laneID)
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
TRACI_CONST int VAR_PMXEMISSION
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
static TraCIPositionVector getShape(std::string laneID)
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
TRACI_CONST int VAR_LENGTH
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static void setMaxSpeed(std::string laneID, double speed)
const std::vector< MSLink * > & getLinkCont() const
returns the container with all links !!!
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
static void setDisallowed(std::string laneID, std::vector< std::string > disallowedClasses)
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 ...
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
double getHCEmissions() const
Returns the sum of last step HC emissions.
std::vector< MSVehicle * > VehCont
Container for vehicles.
static const MSLane * getLane(const std::string &id)
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
TRACI_CONST int LAST_STEP_MEAN_SPEED
TRACI_CONST int LANE_ALLOWED
TRACI_CONST int LANE_EDGE_ID
double getElectricityConsumption() const
Returns the sum of last step electricity consumption.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
const std::vector< MSLink * > & getFoeLinks() const
double getCOEmissions() const
Returns the sum of last step CO emissions.
TRACI_CONST int LAST_STEP_OCCUPANCY
static SubscriptionResults mySubscriptionResults
static std::vector< std::string > getLastStepVehicleIDs(std::string laneID)
static double getWaitingTime(std::string laneID)
TRACI_CONST int LANE_LINK_NUMBER
TRACI_CONST int LAST_STEP_VEHICLE_NUMBER
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
static double getTraveltime(std::string laneID)
const MSLink * getLinkTo(const MSLane *const) const
returns the link to the given lane or nullptr, if it is not connected
TRACI_CONST int VAR_CO2EMISSION
static void setLength(std::string laneID, double length)
double getMeanSpeed() const
Returns the mean speed on this lane.
TRACI_CONST int LAST_STEP_VEHICLE_HALTING_NUMBER
TRACI_CONST int VAR_HCEMISSION
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
static const long CHANGE_PERMISSIONS_PERMANENT
static const SUMOVTypeParameter & getDefault()
return the default parameters, this is a function due to the http://www.parashift.com/c++-faq/static-init-order.html
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setAllowed(std::string laneID, std::string allowedClass)
Representation of a lane in the micro simulation.
const std::vector< std::string > & getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
double getWaitingSeconds() const
Returns the overall waiting time on this lane.
static double getNoiseEmission(std::string laneID)
TRACI_CONST int VAR_ELECTRICITYCONSUMPTION
static double getLastStepOccupancy(std::string laneID)
static std::vector< std::string > getDisallowed(std::string laneID)
static int getLinkNumber(std::string laneID)
static double getCOEmission(std::string laneID)