Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
libsumo::Simulation Class Reference

#include <Simulation.h>

Static Public Member Functions

static LIBSUMO_GET_PARAMETER_WITH_KEY_API void clearPending (const std::string &routeID="")
 
static void close (const std::string &reason="Libsumo requested termination.")
 close simulation More...
 
static TraCIPosition convert2D (const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false)
 
static TraCIPosition convert3D (const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false)
 
static TraCIPosition convertGeo (double x, double y, bool fromGeo=false)
 
static TraCIRoadPosition convertRoad (double x, double y, bool isGeo=false, const std::string &vClass="ignoring")
 
static std::vector< 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=INVALID_DOUBLE_VALUE, const double departPosLat=0, const std::string &pType="", const std::string &vType="", const std::string &destStop="")
 
static 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 > getBusStopIDList ()
 
static int getBusStopWaiting (const std::string &id)
 
static std::vector< std::string > getBusStopWaitingIDList (const std::string &id)
 Returns the IDs of the transportables on a given bus stop. More...
 
static std::vector< std::string > getCollidingVehiclesIDList ()
 
static int getCollidingVehiclesNumber ()
 
static int getCurrentTime ()
 
static double getDeltaT ()
 
static std::vector< std::string > getDepartedIDList ()
 
static int getDepartedNumber ()
 
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 std::vector< std::string > getLoadedIDList ()
 
static int getLoadedNumber ()
 
static int getMinExpectedNumber ()
 
static TraCIPositionVector getNetBoundary ()
 
static std::string getParameter (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 > getStartingTeleportIDList ()
 
static int getStartingTeleportNumber ()
 
static std::vector< std::string > getStopEndingVehiclesIDList ()
 
static int getStopEndingVehiclesNumber ()
 
static std::vector< std::string > getStopStartingVehiclesIDList ()
 
static int getStopStartingVehiclesNumber ()
 
static const 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)
 
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< VariableWrappermakeWrapper ()
 
static void saveState (const std::string &fileName)
 
static void step (const double time=0.)
 Advances by one step (or up to the given time) More...
 
static void subscribe (const std::vector< int > &varIDs=std::vector< int >(), double begin=INVALID_DOUBLE_VALUE, double end=INVALID_DOUBLE_VALUE)
 
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

Definition at line 44 of file Simulation.h.

Constructor & Destructor Documentation

◆ Simulation()

libsumo::Simulation::Simulation ( )
privatedelete

invalidated standard constructor

Member Function Documentation

◆ clearPending()

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

Definition at line 679 of file Simulation.cpp.

References MSInsertionControl::clearPendingVehicles(), MSNet::getInsertionControl(), and MSNet::getInstance().

Referenced by TraCIServerAPI_Simulation::processSet().

Here is the caller graph for this function:

◆ close()

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

close simulation

Definition at line 110 of file Simulation.cpp.

References libsumo::Helper::clearSubscriptions(), SystemFrame::close(), XMLSubSys::close(), MSNet::closeSimulation(), MSNet::getInstance(), and MSNet::hasInstance().

Referenced by libsumo_close(), and load().

Here is the caller graph for this function:

◆ convert2D()

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

◆ convert3D()

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

◆ convertGeo()

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

◆ convertRoad()

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

◆ findIntermodalRoute()

std::vector< TraCIStage > 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 = 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 > Simulation::getArrivedIDList ( )
static

Definition at line 182 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_ARRIVED.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getArrivedNumber()

int Simulation::getArrivedNumber ( )
static

Definition at line 176 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_ARRIVED.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getBusStopIDList()

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

Definition at line 283 of file Simulation.cpp.

References MSNet::getInstance(), and SUMO_TAG_BUS_STOP.

Referenced by TraCIServerAPI_Simulation::processGet().

Here is the caller graph for this function:

◆ getBusStopWaiting()

int Simulation::getBusStopWaiting ( const std::string &  id)
static

Definition at line 292 of file Simulation.cpp.

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

Referenced by handleVariable(), and TraCIServerAPI_Simulation::processGet().

Here is the caller graph for this function:

◆ getBusStopWaitingIDList()

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

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

Definition at line 301 of file Simulation.cpp.

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

Referenced by TraCIServerAPI_Simulation::processGet().

Here is the caller graph for this function:

◆ getCollidingVehiclesIDList()

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

Definition at line 242 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_COLLISION.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getCollidingVehiclesNumber()

int Simulation::getCollidingVehiclesNumber ( )
static

Definition at line 236 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_COLLISION.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getCurrentTime()

int Simulation::getCurrentTime ( )
static

Definition at line 140 of file Simulation.cpp.

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

Referenced by handleVariable(), and TraCIServerAPI_Simulation::processGet().

Here is the caller graph for this function:

◆ getDeltaT()

double Simulation::getDeltaT ( )
static

Definition at line 313 of file Simulation.cpp.

References TS.

Referenced by handleVariable(), and TraCIServerAPI_Simulation::processGet().

Here is the caller graph for this function:

◆ getDepartedIDList()

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

Definition at line 170 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_DEPARTED.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getDepartedNumber()

int Simulation::getDepartedNumber ( )
static

Definition at line 164 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_DEPARTED.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getDistance2D()

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

◆ getDistanceRoad()

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

◆ getEmergencyStoppingVehiclesIDList()

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

Definition at line 254 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_EMERGENCYSTOP.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getEmergencyStoppingVehiclesNumber()

int Simulation::getEmergencyStoppingVehiclesNumber ( )
static

Definition at line 248 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_EMERGENCYSTOP.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getEndingTeleportIDList()

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

Definition at line 278 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_ENDING_TELEPORT.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getEndingTeleportNumber()

int Simulation::getEndingTeleportNumber ( )
static

Definition at line 272 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_ENDING_TELEPORT.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getLoadedIDList()

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

Definition at line 158 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_BUILT.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getLoadedNumber()

int Simulation::getLoadedNumber ( )
static

Definition at line 152 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_BUILT.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getMinExpectedNumber()

int Simulation::getMinExpectedNumber ( )
static

◆ getNetBoundary()

TraCIPositionVector Simulation::getNetBoundary ( )
static

Definition at line 319 of file Simulation.cpp.

References GeoConvHelper::getConvBoundary(), GeoConvHelper::getFinal(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), Boundary::ymin(), Boundary::zmax(), and Boundary::zmin().

Referenced by TraCIServerAPI_Simulation::processGet().

Here is the caller graph for this function:

◆ getParameter()

◆ getParkingEndingVehiclesIDList()

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

Definition at line 206 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_ENDING_PARKING.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getParkingEndingVehiclesNumber()

int Simulation::getParkingEndingVehiclesNumber ( )
static

Definition at line 200 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_ENDING_PARKING.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getParkingStartingVehiclesIDList()

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

Definition at line 194 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_STARTING_PARKING.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getParkingStartingVehiclesNumber()

int Simulation::getParkingStartingVehiclesNumber ( )
static

Definition at line 188 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_STARTING_PARKING.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getStartingTeleportIDList()

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

Definition at line 266 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_STARTING_TELEPORT.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getStartingTeleportNumber()

int Simulation::getStartingTeleportNumber ( )
static

Definition at line 260 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_STARTING_TELEPORT.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getStopEndingVehiclesIDList()

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

Definition at line 230 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_ENDING_STOP.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getStopEndingVehiclesNumber()

int Simulation::getStopEndingVehiclesNumber ( )
static

Definition at line 224 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_ENDING_STOP.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getStopStartingVehiclesIDList()

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

Definition at line 218 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_STARTING_STOP.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getStopStartingVehiclesNumber()

int Simulation::getStopStartingVehiclesNumber ( )
static

Definition at line 212 of file Simulation.cpp.

References libsumo::Helper::getVehicleStateChanges(), and MSNet::VEHICLE_STATE_STARTING_STOP.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getSubscriptionResults()

const TraCIResults Simulation::getSubscriptionResults ( )
static

Definition at line 128 of file Simulation.cpp.

References mySubscriptionResults.

◆ getTime()

double Simulation::getTime ( )
static

Definition at line 146 of file Simulation.cpp.

References SIMTIME.

Referenced by handleVariable().

Here is the caller graph for this function:

◆ getVersion()

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

return TraCI API and SUMO version

Definition at line 134 of file Simulation.cpp.

References libsumo::TRACI_VERSION, and VERSION_STRING.

◆ handleVariable()

bool Simulation::handleVariable ( const std::string &  objID,
const int  variable,
VariableWrapper wrapper 
)
static

Definition at line 723 of file Simulation.cpp.

References getArrivedIDList(), getArrivedNumber(), getBusStopWaiting(), getCollidingVehiclesIDList(), getCollidingVehiclesNumber(), getCurrentTime(), getDeltaT(), getDepartedIDList(), getDepartedNumber(), getEmergencyStoppingVehiclesIDList(), getEmergencyStoppingVehiclesNumber(), getEndingTeleportIDList(), getEndingTeleportNumber(), getLoadedIDList(), getLoadedNumber(), getMinExpectedNumber(), getParkingEndingVehiclesIDList(), getParkingEndingVehiclesNumber(), getParkingStartingVehiclesIDList(), getParkingStartingVehiclesNumber(), getStartingTeleportIDList(), getStartingTeleportNumber(), getStopEndingVehiclesIDList(), getStopEndingVehiclesNumber(), getStopStartingVehiclesIDList(), getStopStartingVehiclesNumber(), getTime(), libsumo::VAR_ARRIVED_VEHICLES_IDS, libsumo::VAR_ARRIVED_VEHICLES_NUMBER, libsumo::VAR_BUS_STOP_WAITING, libsumo::VAR_COLLIDING_VEHICLES_IDS, libsumo::VAR_COLLIDING_VEHICLES_NUMBER, libsumo::VAR_DELTA_T, libsumo::VAR_DEPARTED_VEHICLES_IDS, libsumo::VAR_DEPARTED_VEHICLES_NUMBER, libsumo::VAR_EMERGENCYSTOPPING_VEHICLES_IDS, libsumo::VAR_EMERGENCYSTOPPING_VEHICLES_NUMBER, libsumo::VAR_LOADED_VEHICLES_IDS, libsumo::VAR_LOADED_VEHICLES_NUMBER, libsumo::VAR_MIN_EXPECTED_VEHICLES, 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_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, libsumo::VAR_TIME_STEP, libsumo::VariableWrapper::wrapDouble(), libsumo::VariableWrapper::wrapInt(), and libsumo::VariableWrapper::wrapStringList().

Referenced by makeWrapper().

Here is the caller graph for this function:

◆ isLoaded()

bool Simulation::isLoaded ( )
static

return whether a simulation (network) is present

Definition at line 89 of file Simulation.cpp.

References MSNet::hasInstance().

◆ load()

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

load a simulation with the given arguments

Definition at line 71 of file Simulation.cpp.

References close(), MSNet::getInstance(), OptionsCont::getOptions(), gSimulation, XMLSubSys::init(), NLBuilder::init(), OptionsIO::setArgs(), MSNet::setCurrentTimeStep(), string2time(), time2string(), and WRITE_MESSAGE.

Referenced by libsumo_load(), and main().

Here is the caller graph for this function:

◆ loadState()

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

quick-load simulation state from file and return the state time

Definition at line 690 of file Simulation.cpp.

References MSNet::clearState(), libsumo::Helper::clearVehicleStates(), MsgHandler::getErrorInstance(), MSNet::getInstance(), MSStateHandler::getTime(), PROGRESS_BEGIN_TIME_MESSAGE, PROGRESS_TIME_MESSAGE, XMLSubSys::runParser(), and STEPS2TIME.

Referenced by TraCIServerAPI_Simulation::processSet().

Here is the caller graph for this function:

◆ makeWrapper()

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

◆ saveState()

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

Definition at line 685 of file Simulation.cpp.

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

Referenced by TraCIServerAPI_Simulation::processSet().

Here is the caller graph for this function:

◆ step()

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

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

Definition at line 95 of file Simulation.cpp.

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

Referenced by libsumo_step().

Here is the caller graph for this function:

◆ subscribe()

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

◆ writeMessage()

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

Definition at line 711 of file Simulation.cpp.

References WRITE_MESSAGE.

Referenced by TraCIServerAPI_Simulation::processSet().

Here is the caller graph for this function:

Field Documentation

◆ myContextSubscriptionResults

ContextSubscriptionResults Simulation::myContextSubscriptionResults
staticprivate

Definition at line 140 of file Simulation.h.

Referenced by makeWrapper().

◆ mySubscriptionResults

SubscriptionResults Simulation::mySubscriptionResults
staticprivate

Definition at line 139 of file Simulation.h.

Referenced by getSubscriptionResults(), and makeWrapper().


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