48 std::vector<std::string>
50 std::vector<std::string> ids;
86 std::vector<TraCIConnection>
88 std::vector<TraCIConnection> v;
92 const std::string approachedLane = link->getLane() !=
nullptr ? link->getLane()->getID() :
"";
93 const bool hasPrio = link->havePriority();
94 const double speed =
MIN2(lane->
getSpeedLimit(), link->getLane()->getSpeedLimit());
98 const std::string approachedInternal = link->getViaLane() !=
nullptr ? link->getViaLane()->getID() :
"";
101 const double length = link->getLength();
102 v.push_back(
TraCIConnection(approachedLane, hasPrio, isOpen, hasFoe, approachedInternal, state, direction, length));
108 std::vector<std::string>
111 if (permissions ==
SVCAll) {
118 std::vector<std::string>
128 for (PositionVector::const_iterator pi = shp.begin(); pi != shp.end(); ++pi) {
209 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
210 length += (*j)->getVehicleType().getLength();
212 if (vehs.size() > 0) {
213 length = length / (double)vehs.size();
230 if (meanSpeed != 0) {
248 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
258 std::vector<std::string>
261 std::vector<std::string> vehIDs;
263 for (MSLane::VehCont::const_iterator j = vehs.begin(); j != vehs.end(); ++j) {
264 vehIDs.push_back((*j)->getID());
271 std::vector<std::string>
273 std::vector<std::string> foeIDs;
277 if (link ==
nullptr) {
278 throw TraCIException(
"No connection from lane '" + laneID +
"' to lane '" + toLaneID +
"'");
281 foeIDs.push_back(foe->getLaneBefore()->getID());
287 std::vector<std::string>
290 const std::vector<const MSLane*>* foeLanes;
291 std::vector<const MSLane*>::const_iterator it;
292 std::vector<std::string> foeIDs;
298 for (it = foeLanes->begin(); foeLanes->end() != it; ++it) {
299 foeIDs.push_back((*it)->getID());
312 pred->rebuildAllowedTargets();
323 pred->rebuildAllowedTargets();
374 std::shared_ptr<VariableWrapper>
static double getCO2Emission(std::string laneID)
#define LAST_STEP_MEAN_SPEED
static double getLength(std::string laneID)
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
static double getNOxEmission(std::string laneID)
static void setAllowed(std::string laneID, std::vector< std::string > allowedClasses)
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
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.
#define VAR_CURRENT_TRAVELTIME
static LIBSUMO_SUBSCRIPTION_API void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
double getFuelConsumption() const
Returns the sum of last step fuel consumption.
static void setParameter(const std::string &routeID, const std::string &key, const std::string &value)
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
std::vector< std::string > getVehicleClassNamesList(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
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.
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.
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)
#define VAR_NOISEEMISSION
#define VAR_FUELCONSUMPTION
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
A road/street connecting two junctions.
static double getLastStepLength(std::string laneID)
void rebuildAllowedLanes()
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)
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.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static void setMaxSpeed(std::string laneID, double speed)
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
static std::string getParameter(const std::string &laneID, const std::string ¶m)
#define LAST_STEP_VEHICLE_NUMBER
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.
#define LAST_STEP_VEHICLE_ID_LIST
static MSLink * getConnectingLink(const MSLane &from, const MSLane &to)
Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no co...
static SubscriptionResults mySubscriptionResults
static std::vector< std::string > getLastStepVehicleIDs(std::string laneID)
#define VAR_ELECTRICITYCONSUMPTION
static double getWaitingTime(std::string laneID)
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
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)
#define LAST_STEP_OCCUPANCY
static void setLength(std::string laneID, double length)
double getMeanSpeed() const
Returns the mean speed on this lane.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
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)...
Representation of a lane in the micro simulation.
double getWaitingSeconds() const
Returns the overall waiting time on this lane.
static double getNoiseEmission(std::string laneID)
#define LAST_STEP_VEHICLE_HALTING_NUMBER
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)
static std::vector< std::string > getIDList()