Eclipse SUMO - Simulation of Urban MObility
LIBSUMO_NAMESPACE::Simulation Class Reference

C++ TraCI client API implementation. More...

#include <Simulation.h>

Static Public Member Functions

static void clearPending (const std::string &routeID="")
 
static void close (const std::string &reason="Libsumo requested termination.")
 close simulation More...
 
static libsumo::TraCIPosition convert2D (const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false)
 
static libsumo::TraCIPosition convert3D (const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false)
 
static libsumo::TraCIPosition convertGeo (double x, double y, bool fromGeo=false)
 
static libsumo::TraCIRoadPosition convertRoad (double x, double y, bool isGeo=false, const std::string &vClass="ignoring")
 
static void executeMove ()
 Advances a "half" step. More...
 
static std::vector< libsumo::TraCIStagefindIntermodalRoute (const std::string &fromEdge, const std::string &toEdge, const std::string &modes="", double depart=-1., const int routingMode=0, double speed=-1., double walkFactor=-1., double departPos=0, double arrivalPos=libsumo::INVALID_DOUBLE_VALUE, const double departPosLat=0, const std::string &pType="", const std::string &vType="", const std::string &destStop="")
 
static libsumo::TraCIStage findRoute (const std::string &fromEdge, const std::string &toEdge, const std::string &vType="", const double depart=-1., const int routingMode=0)
 
static std::vector< std::string > getArrivedIDList ()
 
static int getArrivedNumber ()
 
static std::vector< std::string > getArrivedPersonIDList ()
 
static int getArrivedPersonNumber ()
 
static std::vector< std::string > getBusStopIDList ()
 
static int getBusStopWaiting (const std::string &stopID)
 
static std::vector< std::string > getBusStopWaitingIDList (const std::string &stopID)
 Returns the IDs of the transportables on a given bus stop. More...
 
static std::vector< std::string > getCollidingVehiclesIDList ()
 
static int getCollidingVehiclesNumber ()
 
static std::vector< libsumo::TraCICollisiongetCollisions ()
 
static int getCurrentTime ()
 
static double getDeltaT ()
 
static std::vector< std::string > getDepartedIDList ()
 
static int getDepartedNumber ()
 
static std::vector< std::string > getDepartedPersonIDList ()
 
static int getDepartedPersonNumber ()
 
static double getDistance2D (double x1, double y1, double x2, double y2, bool isGeo=false, bool isDriving=false)
 
static double getDistanceRoad (const std::string &edgeID1, double pos1, const std::string &edgeID2, double pos2, bool isDriving=false)
 
static std::vector< std::string > getEmergencyStoppingVehiclesIDList ()
 
static int getEmergencyStoppingVehiclesNumber ()
 
static std::vector< std::string > getEndingTeleportIDList ()
 
static int getEndingTeleportNumber ()
 
static double getEndTime ()
 return configured end time More...
 
static std::vector< std::string > getLoadedIDList ()
 
static int getLoadedNumber ()
 
static int getMinExpectedNumber ()
 
static libsumo::TraCIPositionVector getNetBoundary ()
 
static std::string getOption (const std::string &option)
 return the SUMO option value More...
 
static std::string getParameter (const std::string &objectID, const std::string &key)
 
static const std::pair< std::string, std::string > getParameterWithKey (const std::string &objectID, const std::string &key)
 
static std::vector< std::string > getParkingEndingVehiclesIDList ()
 
static int getParkingEndingVehiclesNumber ()
 
static std::vector< std::string > getParkingStartingVehiclesIDList ()
 
static int getParkingStartingVehiclesNumber ()
 
static std::vector< std::string > getPendingVehicles ()
 
static double getScale ()
 
static std::vector< std::string > getStartingTeleportIDList ()
 
static int getStartingTeleportNumber ()
 
static std::vector< std::string > getStopEndingVehiclesIDList ()
 
static int getStopEndingVehiclesNumber ()
 
static std::vector< std::string > getStopStartingVehiclesIDList ()
 
static int getStopStartingVehiclesNumber ()
 
static const libsumo::TraCIResults getSubscriptionResults ()
 
static double getTime ()
 
static std::pair< int, std::string > getVersion ()
 return TraCI API and SUMO version More...
 
static bool handleVariable (const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
 
static bool hasGUI ()
 whether we run with graphical user interface (sumo-gui) More...
 
static bool isLoaded ()
 return whether a simulation (network) is present More...
 
static void load (const std::vector< std::string > &args)
 load a simulation with the given arguments More...
 
static double loadState (const std::string &fileName)
 quick-load simulation state from file and return the state time More...
 
static std::shared_ptr< VariableWrapper > makeWrapper ()
 
static void saveState (const std::string &fileName)
 
static void setParameter (const std::string &objectID, const std::string &key, const std::string &value)
 
static void setScale (double value)
 
static std::pair< int, std::string > start (const std::vector< std::string > &cmd, int port=-1, int numRetries=libsumo::DEFAULT_NUM_RETRIES, const std::string &label="default", const bool verbose=false, const std::string &traceFile="", bool traceGetters=true, void *_stdout=nullptr)
 
static void step (const double time=0.)
 Advances by one step (or up to the given time) More...
 
static LIBSUMO_SUBSCRIPTION_API void storeShape (PositionVector &shape)
 
static void subscribe (const std::vector< int > &varIDs=std::vector< int >(), double begin=libsumo::INVALID_DOUBLE_VALUE, double end=libsumo::INVALID_DOUBLE_VALUE, const libsumo::TraCIResults &params=libsumo::TraCIResults())
 
static void writeMessage (const std::string &msg)
 

Private Member Functions

 Simulation ()=delete
 invalidated standard constructor More...
 

Static Private Attributes

static ContextSubscriptionResults myContextSubscriptionResults
 
static SubscriptionResults mySubscriptionResults
 

Detailed Description

C++ TraCI client API implementation.

Definition at line 41 of file Simulation.h.

Constructor & Destructor Documentation

◆ Simulation()

LIBSUMO_NAMESPACE::Simulation::Simulation ( )
privatedelete

invalidated standard constructor

Member Function Documentation

◆ clearPending()

void libtraci::Simulation::clearPending ( const std::string &  routeID = "")
static

◆ close()

void libtraci::Simulation::close ( const std::string &  reason = "Libsumo requested termination.")
static

◆ convert2D()

libsumo::TraCIPosition libtraci::Simulation::convert2D ( const std::string &  edgeID,
double  pos,
int  laneIndex = 0,
bool  toGeo = false 
)
static

◆ convert3D()

libsumo::TraCIPosition libtraci::Simulation::convert3D ( const std::string &  edgeID,
double  pos,
int  laneIndex = 0,
bool  toGeo = false 
)
static

◆ convertGeo()

libsumo::TraCIPosition libtraci::Simulation::convertGeo ( double  x,
double  y,
bool  fromGeo = false 
)
static

◆ convertRoad()

libsumo::TraCIRoadPosition libtraci::Simulation::convertRoad ( double  x,
double  y,
bool  isGeo = false,
const std::string &  vClass = "ignoring" 
)
static

◆ executeMove()

void libtraci::Simulation::executeMove ( )
static

Advances a "half" step.

Definition at line 151 of file libsumo/Simulation.cpp.

References MSNet::getInstance(), and MSNet::simulationStep().

◆ findIntermodalRoute()

std::vector< libsumo::TraCIStage > libtraci::Simulation::findIntermodalRoute ( const std::string &  fromEdge,
const std::string &  toEdge,
const std::string &  modes = "",
double  depart = -1.,
const int  routingMode = 0,
double  speed = -1.,
double  walkFactor = -1.,
double  departPos = 0,
double  arrivalPos = libsumo::INVALID_DOUBLE_VALUE,
const double  departPosLat = 0,
const std::string &  pType = "",
const std::string &  vType = "",
const std::string &  destStop = "" 
)
static

◆ findRoute()

◆ getArrivedIDList()

std::vector< std::string > libtraci::Simulation::getArrivedIDList ( )
static

◆ getArrivedNumber()

int libtraci::Simulation::getArrivedNumber ( )
static

◆ getArrivedPersonIDList()

std::vector< std::string > libtraci::Simulation::getArrivedPersonIDList ( )
static

◆ getArrivedPersonNumber()

int libtraci::Simulation::getArrivedPersonNumber ( )
static

◆ getBusStopIDList()

std::vector< std::string > libtraci::Simulation::getBusStopIDList ( )
static

Definition at line 374 of file libsumo/Simulation.cpp.

References MSNet::getInstance(), and SUMO_TAG_BUS_STOP.

◆ getBusStopWaiting()

int libtraci::Simulation::getBusStopWaiting ( const std::string &  stopID)
static

◆ getBusStopWaitingIDList()

std::vector< std::string > libtraci::Simulation::getBusStopWaitingIDList ( const std::string &  stopID)
static

Returns the IDs of the transportables on a given bus stop.

Definition at line 392 of file libsumo/Simulation.cpp.

References MSNet::getInstance(), MSNet::getStoppingPlace(), MSStoppingPlace::getTransportables(), and SUMO_TAG_BUS_STOP.

◆ getCollidingVehiclesIDList()

std::vector< std::string > libtraci::Simulation::getCollidingVehiclesIDList ( )
static

◆ getCollidingVehiclesNumber()

int libtraci::Simulation::getCollidingVehiclesNumber ( )
static

◆ getCollisions()

◆ getCurrentTime()

int libtraci::Simulation::getCurrentTime ( )
static

Definition at line 203 of file libsumo/Simulation.cpp.

References MSNet::getCurrentTimeStep(), and MSNet::getInstance().

◆ getDeltaT()

double libtraci::Simulation::getDeltaT ( )
static

Definition at line 442 of file libsumo/Simulation.cpp.

References TS.

◆ getDepartedIDList()

std::vector< std::string > libtraci::Simulation::getDepartedIDList ( )
static

◆ getDepartedNumber()

int libtraci::Simulation::getDepartedNumber ( )
static

◆ getDepartedPersonIDList()

std::vector< std::string > libtraci::Simulation::getDepartedPersonIDList ( )
static

◆ getDepartedPersonNumber()

int libtraci::Simulation::getDepartedPersonNumber ( )
static

◆ getDistance2D()

double libtraci::Simulation::getDistance2D ( double  x1,
double  y1,
double  x2,
double  y2,
bool  isGeo = false,
bool  isDriving = false 
)
static

◆ getDistanceRoad()

double libtraci::Simulation::getDistanceRoad ( const std::string &  edgeID1,
double  pos1,
const std::string &  edgeID2,
double  pos2,
bool  isDriving = false 
)
static

◆ getEmergencyStoppingVehiclesIDList()

std::vector< std::string > libtraci::Simulation::getEmergencyStoppingVehiclesIDList ( )
static

◆ getEmergencyStoppingVehiclesNumber()

int libtraci::Simulation::getEmergencyStoppingVehiclesNumber ( )
static

◆ getEndingTeleportIDList()

std::vector< std::string > libtraci::Simulation::getEndingTeleportIDList ( )
static

◆ getEndingTeleportNumber()

int libtraci::Simulation::getEndingTeleportNumber ( )
static

◆ getEndTime()

double libtraci::Simulation::getEndTime ( )
static

return configured end time

Definition at line 214 of file libsumo/Simulation.cpp.

References OptionsCont::getOptions(), STEPS2TIME, and string2time().

◆ getLoadedIDList()

std::vector< std::string > libtraci::Simulation::getLoadedIDList ( )
static

◆ getLoadedNumber()

int libtraci::Simulation::getLoadedNumber ( )
static

◆ getMinExpectedNumber()

◆ getNetBoundary()

◆ getOption()

std::string libtraci::Simulation::getOption ( const std::string &  option)
static

return the SUMO option value

Definition at line 193 of file libsumo/Simulation.cpp.

References OptionsCont::exists(), OptionsCont::getOptions(), and OptionsCont::getValueString().

◆ getParameter()

◆ getParameterWithKey()

static const std::pair<std::string, std::string> LIBSUMO_NAMESPACE::Simulation::getParameterWithKey ( const std::string &  objectID,
const std::string &  key 
)
static

◆ getParkingEndingVehiclesIDList()

std::vector< std::string > libtraci::Simulation::getParkingEndingVehiclesIDList ( )
static

◆ getParkingEndingVehiclesNumber()

int libtraci::Simulation::getParkingEndingVehiclesNumber ( )
static

◆ getParkingStartingVehiclesIDList()

std::vector< std::string > libtraci::Simulation::getParkingStartingVehiclesIDList ( )
static

◆ getParkingStartingVehiclesNumber()

int libtraci::Simulation::getParkingStartingVehiclesNumber ( )
static

◆ getPendingVehicles()

std::vector< std::string > libtraci::Simulation::getPendingVehicles ( )
static

Definition at line 406 of file libsumo/Simulation.cpp.

References MSNet::getInstance().

◆ getScale()

double libtraci::Simulation::getScale ( )
static

◆ getStartingTeleportIDList()

std::vector< std::string > libtraci::Simulation::getStartingTeleportIDList ( )
static

◆ getStartingTeleportNumber()

int libtraci::Simulation::getStartingTeleportNumber ( )
static

◆ getStopEndingVehiclesIDList()

std::vector< std::string > libtraci::Simulation::getStopEndingVehiclesIDList ( )
static

◆ getStopEndingVehiclesNumber()

int libtraci::Simulation::getStopEndingVehiclesNumber ( )
static

◆ getStopStartingVehiclesIDList()

std::vector< std::string > libtraci::Simulation::getStopStartingVehiclesIDList ( )
static

◆ getStopStartingVehiclesNumber()

int libtraci::Simulation::getStopStartingVehiclesNumber ( )
static

◆ getSubscriptionResults()

const libsumo::TraCIResults libtraci::Simulation::getSubscriptionResults ( )
static

Definition at line 178 of file libsumo/Simulation.cpp.

◆ getTime()

double libtraci::Simulation::getTime ( )
static

Definition at line 209 of file libsumo/Simulation.cpp.

References SIMTIME.

◆ getVersion()

std::pair< int, std::string > libtraci::Simulation::getVersion ( )
static

return TraCI API and SUMO version

Definition at line 187 of file libsumo/Simulation.cpp.

References libsumo::TRACI_VERSION.

◆ handleVariable()

bool libsumo::Simulation::handleVariable ( const std::string &  objID,
const int  variable,
VariableWrapper *  wrapper,
tcpip::Storage paramData 
)
static

Definition at line 892 of file libsumo/Simulation.cpp.

References tcpip::Storage::readString(), tcpip::Storage::readUnsignedByte(), libsumo::VAR_ARRIVED_PERSONS_IDS, libsumo::VAR_ARRIVED_PERSONS_NUMBER, libsumo::VAR_ARRIVED_VEHICLES_IDS, libsumo::VAR_ARRIVED_VEHICLES_NUMBER, libsumo::VAR_BUS_STOP_ID_LIST, libsumo::VAR_BUS_STOP_WAITING, libsumo::VAR_BUS_STOP_WAITING_IDS, libsumo::VAR_COLLIDING_VEHICLES_IDS, libsumo::VAR_COLLIDING_VEHICLES_NUMBER, libsumo::VAR_DELTA_T, libsumo::VAR_DEPARTED_PERSONS_IDS, libsumo::VAR_DEPARTED_PERSONS_NUMBER, libsumo::VAR_DEPARTED_VEHICLES_IDS, libsumo::VAR_DEPARTED_VEHICLES_NUMBER, libsumo::VAR_EMERGENCYSTOPPING_VEHICLES_IDS, libsumo::VAR_EMERGENCYSTOPPING_VEHICLES_NUMBER, libsumo::VAR_END, libsumo::VAR_LOADED_VEHICLES_IDS, libsumo::VAR_LOADED_VEHICLES_NUMBER, libsumo::VAR_MIN_EXPECTED_VEHICLES, libsumo::VAR_OPTION, libsumo::VAR_PARAMETER, libsumo::VAR_PARAMETER_WITH_KEY, libsumo::VAR_PARKING_ENDING_VEHICLES_IDS, libsumo::VAR_PARKING_ENDING_VEHICLES_NUMBER, libsumo::VAR_PARKING_STARTING_VEHICLES_IDS, libsumo::VAR_PARKING_STARTING_VEHICLES_NUMBER, libsumo::VAR_PENDING_VEHICLES, libsumo::VAR_SCALE, libsumo::VAR_STOP_ENDING_VEHICLES_IDS, libsumo::VAR_STOP_ENDING_VEHICLES_NUMBER, libsumo::VAR_STOP_STARTING_VEHICLES_IDS, libsumo::VAR_STOP_STARTING_VEHICLES_NUMBER, libsumo::VAR_TELEPORT_ENDING_VEHICLES_IDS, libsumo::VAR_TELEPORT_ENDING_VEHICLES_NUMBER, libsumo::VAR_TELEPORT_STARTING_VEHICLES_IDS, libsumo::VAR_TELEPORT_STARTING_VEHICLES_NUMBER, libsumo::VAR_TIME, and libsumo::VAR_TIME_STEP.

◆ hasGUI()

bool libtraci::Simulation::hasGUI ( )
static

whether we run with graphical user interface (sumo-gui)

Definition at line 114 of file libsumo/Simulation.cpp.

◆ isLoaded()

bool libtraci::Simulation::isLoaded ( )
static

return whether a simulation (network) is present

Definition at line 124 of file libsumo/Simulation.cpp.

References MSNet::hasInstance().

◆ load()

void libtraci::Simulation::load ( const std::vector< std::string > &  args)
static

◆ loadState()

double libtraci::Simulation::loadState ( const std::string &  fileName)
static

◆ makeWrapper()

std::shared_ptr< VariableWrapper > libsumo::Simulation::makeWrapper ( )
static

Definition at line 886 of file libsumo/Simulation.cpp.

◆ saveState()

void libtraci::Simulation::saveState ( const std::string &  fileName)
static

Definition at line 853 of file libsumo/Simulation.cpp.

References MSNet::getInstance(), and MSStateHandler::saveState().

◆ setParameter()

void libsumo::Simulation::setParameter ( const std::string &  objectID,
const std::string &  key,
const std::string &  value 
)
static

Definition at line 833 of file libsumo/Simulation.cpp.

References MSNet::getInstance(), and Parameterised::setParameter().

◆ setScale()

void libtraci::Simulation::setScale ( double  value)
static

◆ start()

std::pair< int, std::string > libtraci::Simulation::start ( const std::vector< std::string > &  cmd,
int  port = -1,
int  numRetries = libsumo::DEFAULT_NUM_RETRIES,
const std::string &  label = "default",
const bool  verbose = false,
const std::string &  traceFile = "",
bool  traceGetters = true,
void *  _stdout = nullptr 
)
static

Definition at line 77 of file libsumo/Simulation.cpp.

◆ step()

void libtraci::Simulation::step ( const double  time = 0.)
static

Advances by one step (or up to the given time)

Definition at line 130 of file libsumo/Simulation.cpp.

References libsumo::Helper::clearStateChanges(), MSNet::getInstance(), libsumo::Helper::handleSubscriptions(), MSNet::simulationStep(), and TIME2STEPS.

◆ storeShape()

void libsumo::Simulation::storeShape ( PositionVector shape)
static

◆ subscribe()

void libtraci::Simulation::subscribe ( const std::vector< int > &  varIDs = std::vector<int>(),
double  begin = libsumo::INVALID_DOUBLE_VALUE,
double  end = libsumo::INVALID_DOUBLE_VALUE,
const libsumo::TraCIResults params = libsumo::TraCIResults() 
)
static

◆ writeMessage()

void libtraci::Simulation::writeMessage ( const std::string &  msg)
static

Definition at line 874 of file libsumo/Simulation.cpp.

References WRITE_MESSAGE.

Field Documentation

◆ myContextSubscriptionResults

ContextSubscriptionResults libsumo::Simulation::myContextSubscriptionResults
staticprivate

Definition at line 187 of file Simulation.h.

◆ mySubscriptionResults

SubscriptionResults libsumo::Simulation::mySubscriptionResults
staticprivate

Definition at line 186 of file Simulation.h.


The documentation for this class was generated from the following files: