48std::vector<std::string>
51 std::vector<std::string> ids;
59 return (
int)getIDList().size();
64Edge::getAdaptedTraveltime(
const std::string& edgeID,
double time) {
65 const MSEdge* e = getEdge(edgeID);
67 if (!
MSNet::getInstance()->getWeightsStorage().retrieveExistingTravelTime(e, time, value)) {
75Edge::getEffort(
const std::string& edgeID,
double time) {
76 const MSEdge* e = getEdge(edgeID);
78 if (!
MSNet::getInstance()->getWeightsStorage().retrieveExistingEffort(e, time, value)) {
86Edge::getTraveltime(
const std::string& edgeID) {
87 return getEdge(edgeID)->getCurrentTravelTime();
92Edge::getEdge(
const std::string& edgeID) {
95 throw TraCIException(
"Edge '" + edgeID +
"' is not known");
102Edge::getWaitingTime(
const std::string& edgeID) {
107const std::vector<std::string>
108Edge::getLastStepPersonIDs(
const std::string& edgeID) {
109 std::vector<std::string> personIDs;
110 std::vector<MSTransportable*> persons = getEdge(edgeID)->getSortedPersons(
MSNet::getInstance()->getCurrentTimeStep(),
true);
111 personIDs.reserve(persons.size());
113 personIDs.push_back(p->getID());
119const std::vector<std::string>
120Edge::getLastStepVehicleIDs(
const std::string& edgeID) {
121 std::vector<std::string> vehIDs;
122 for (
const SUMOVehicle* veh : getEdge(edgeID)->getVehicles()) {
123 vehIDs.push_back(veh->getID());
130Edge::getCO2Emission(
const std::string& edgeID) {
132 for (
MSLane* lane : getEdge(edgeID)->getLanes()) {
140Edge::getCOEmission(
const std::string& edgeID) {
142 for (
MSLane* lane : getEdge(edgeID)->getLanes()) {
150Edge::getHCEmission(
const std::string& edgeID) {
152 for (
MSLane* lane : getEdge(edgeID)->getLanes()) {
160Edge::getPMxEmission(
const std::string& edgeID) {
162 for (
MSLane* lane : getEdge(edgeID)->getLanes()) {
170Edge::getNOxEmission(
const std::string& edgeID) {
172 for (
MSLane* lane : getEdge(edgeID)->getLanes()) {
180Edge::getFuelConsumption(
const std::string& edgeID) {
182 for (
MSLane* lane : getEdge(edgeID)->getLanes()) {
190Edge::getNoiseEmission(
const std::string& edgeID) {
192 for (
MSLane* lane : getEdge(edgeID)->getLanes()) {
193 sum += pow(10., (lane->getHarmonoise_NoiseEmissions() / 10.));
203Edge::getElectricityConsumption(
const std::string& edgeID) {
205 for (
MSLane* lane : getEdge(edgeID)->getLanes()) {
213Edge::getLastStepVehicleNumber(
const std::string& edgeID) {
214 return getEdge(edgeID)->getVehicleNumber();
219Edge::getLastStepMeanSpeed(
const std::string& edgeID) {
220 return getEdge(edgeID)->getMeanSpeed();
224Edge::getMeanFriction(
const std::string& edgeID) {
225 return getEdge(edgeID)->getMeanFriction();
230Edge::getLastStepOccupancy(
const std::string& edgeID) {
231 return getEdge(edgeID)->getOccupancy();
236Edge::getLastStepHaltingNumber(
const std::string& edgeID) {
238 for (
const SUMOVehicle* veh : getEdge(edgeID)->getVehicles()) {
248Edge::getLastStepLength(
const std::string& edgeID) {
249 double lengthSum = 0;
251 for (
const SUMOVehicle* veh : getEdge(edgeID)->getVehicles()) {
255 if (numVehicles == 0) {
258 return lengthSum / numVehicles;
263Edge::getLaneNumber(
const std::string& edgeID) {
264 return (
int)getEdge(edgeID)->getLanes().size();
269Edge::getStreetName(
const std::string& edgeID) {
270 return getEdge(edgeID)->getStreetName();
274const std::vector<std::string>
275Edge::getPendingVehicles(
const std::string& edgeID) {
277 std::vector<std::string> vehIDs;
279 if (veh->getEdge()->getID() == edgeID) {
280 vehIDs.push_back(veh->getID());
288Edge::getAngle(
const std::string& edgeID,
double relativePosition) {
289 const std::vector<MSLane*>& lanes = getEdge(edgeID)->getLanes();
294Edge::getFromJunction(
const std::string& edgeID) {
295 return getEdge(edgeID)->getFromJunction()->getID();
299Edge::getToJunction(
const std::string& edgeID) {
300 return getEdge(edgeID)->getToJunction()->getID();
304Edge::getBidiEdge(
const std::string& edgeID) {
306 return bidi ==
nullptr ?
"" : bidi->
getID();
310Edge::getParameter(
const std::string& edgeID,
const std::string& param) {
311 return getEdge(edgeID)->getParameter(param,
"");
319Edge::setAllowed(
const std::string& edgeID, std::string allowedClasses) {
325Edge::setAllowed(
const std::string& edgeID, std::vector<std::string> allowedClasses) {
331Edge::setDisallowed(
const std::string& edgeID, std::string disallowedClasses) {
337Edge::setDisallowed(
const std::string& edgeID, std::vector<std::string> disallowedClasses) {
343Edge::setAllowedSVCPermissions(
const std::string& edgeID,
long long int permissions) {
344 MSEdge* e = getEdge(edgeID);
353Edge::adaptTraveltime(
const std::string& edgeID,
double time,
double beginSeconds,
double endSeconds) {
359Edge::setEffort(
const std::string& edgeID,
double effort,
double beginSeconds,
double endSeconds) {
365Edge::setMaxSpeed(
const std::string& edgeID,
double speed) {
366 getEdge(edgeID)->setMaxSpeed(speed);
370Edge::setFriction(
const std::string& edgeID,
double friction) {
371 for (
MSLane* lane : getEdge(edgeID)->getLanes()) {
372 lane->setFrictionCoefficient(friction);
377Edge::setParameter(
const std::string& edgeID,
const std::string& name,
const std::string& value) {
378 getEdge(edgeID)->setParameter(name, value);
387 const MSEdge*
const e = getEdge(edgeID);
388 const std::vector<MSLane*>& lanes = e->
getLanes();
389 shape = lanes.front()->getShape();
390 if (lanes.size() > 1) {
391 copy(lanes.back()->getShape().begin(), lanes.back()->getShape().end(), back_inserter(shape));
396std::shared_ptr<VariableWrapper>
398 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
403Edge::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
406 return wrapper->wrapStringList(objID, variable, getIDList());
408 return wrapper->wrapInt(objID, variable, getIDCount());
410 return wrapper->wrapDouble(objID, variable, getTraveltime(objID));
412 return wrapper->wrapDouble(objID, variable, getWaitingTime(objID));
414 return wrapper->wrapStringList(objID, variable, getLastStepPersonIDs(objID));
416 return wrapper->wrapStringList(objID, variable, getLastStepVehicleIDs(objID));
418 return wrapper->wrapDouble(objID, variable, getCO2Emission(objID));
420 return wrapper->wrapDouble(objID, variable, getCOEmission(objID));
422 return wrapper->wrapDouble(objID, variable, getHCEmission(objID));
424 return wrapper->wrapDouble(objID, variable, getPMxEmission(objID));
426 return wrapper->wrapDouble(objID, variable, getNOxEmission(objID));
428 return wrapper->wrapDouble(objID, variable, getFuelConsumption(objID));
430 return wrapper->wrapDouble(objID, variable, getNoiseEmission(objID));
432 return wrapper->wrapDouble(objID, variable, getElectricityConsumption(objID));
434 return wrapper->wrapInt(objID, variable, getLastStepVehicleNumber(objID));
436 return wrapper->wrapDouble(objID, variable, getLastStepMeanSpeed(objID));
438 return wrapper->wrapDouble(objID, variable, getMeanFriction(objID));
440 return wrapper->wrapDouble(objID, variable, getLastStepOccupancy(objID));
442 return wrapper->wrapInt(objID, variable, getLastStepHaltingNumber(objID));
444 return wrapper->wrapDouble(objID, variable, getLastStepLength(objID));
446 return wrapper->wrapInt(objID, variable, getLaneNumber(objID));
448 return wrapper->wrapString(objID, variable, getStreetName(objID));
450 return wrapper->wrapStringList(objID, variable, getPendingVehicles(objID));
453 return wrapper->wrapDouble(objID, variable, getAngle(objID, paramData->
readDouble()));
455 return wrapper->wrapString(objID, variable, getFromJunction(objID));
457 return wrapper->wrapString(objID, variable, getToJunction(objID));
459 return wrapper->wrapString(objID, variable, getBidiEdge(objID));
462 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
465 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
SVCPermissions invertPermissions(SVCPermissions permissions)
negate the given permissions and ensure that only relevant bits are set
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
C++ TraCI client API implementation.
static double sum(double val)
Computes the resulting noise.
The base class for microscopic and mesoscopic vehicles.
double getLength() const
Returns the vehicle's length.
A road/street connecting two junctions.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
void rebuildAllowedLanes(const bool onInit=false)
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
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....
static void insertIDs(std::vector< std::string > &into)
Inserts IDs of all known edges into the given vector.
double getWaitingSeconds() const
return accumated waiting time for all vehicles on this edges lanes or segments
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
const MSVehicleContainer::VehicleVector & getPendingVehicles() const
retrieve vehicles waiting for insertion
Representation of a lane in the micro simulation.
static const long CHANGE_PERMISSIONS_PERMANENT
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
const std::string & getID() const
Returns the id.
Representation of a vehicle.
virtual std::string readString()
virtual int readUnsignedByte()
virtual double readDouble()
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 LAST_STEP_PERSON_ID_LIST
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int VAR_WAITING_TIME
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int LAST_STEP_LENGTH
TRACI_CONST int VAR_ANGLE
TRACI_CONST int VAR_LANE_INDEX
TRACI_CONST int VAR_PMXEMISSION
TRACI_CONST int VAR_COEMISSION
TRACI_CONST int LAST_STEP_MEAN_SPEED
TRACI_CONST int VAR_CO2EMISSION
TRACI_CONST int VAR_PENDING_VEHICLES
TRACI_CONST int VAR_FUELCONSUMPTION
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int LAST_STEP_VEHICLE_HALTING_NUMBER
TRACI_CONST int VAR_HCEMISSION
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int LAST_STEP_OCCUPANCY
TRACI_CONST int VAR_NOISEEMISSION
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int VAR_FRICTION
TRACI_CONST int FROM_JUNCTION
TRACI_CONST int VAR_CURRENT_TRAVELTIME
TRACI_CONST int VAR_ELECTRICITYCONSUMPTION
TRACI_CONST int TO_JUNCTION