SUMO - Simulation of Urban MObility
libsumo::Simulation Class Reference

#include <Simulation.h>

Collaboration diagram for libsumo::Simulation:
Collaboration graph

Static Public Member Functions

static void clearPending (const std::string &routeID="")
 
static void close ()
 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)
 
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 int getBusStopWaiting (const std::string &id)
 
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 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 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 LIBSUMO_SUBSCRIPTION_API void subscribe (const std::vector< int > &vars=std::vector< int >(), double beginTime=INVALID_DOUBLE_VALUE, double endTime=INVALID_DOUBLE_VALUE)
 

Private Member Functions

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

Static Private Attributes

static ContextSubscriptionResults myContextSubscriptionResults
 
static SubscriptionResults mySubscriptionResults
 

Detailed Description

Definition at line 47 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

◆ close()

void Simulation::close ( )
static

◆ 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()

◆ 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

◆ getArrivedNumber()

int Simulation::getArrivedNumber ( )
static

◆ getBusStopWaiting()

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

◆ getCollidingVehiclesIDList()

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

◆ getCollidingVehiclesNumber()

int Simulation::getCollidingVehiclesNumber ( )
static

◆ getCurrentTime()

int Simulation::getCurrentTime ( )
static

◆ getDeltaT()

double Simulation::getDeltaT ( )
static

Definition at line 275 of file Simulation.cpp.

References TS.

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

◆ getDepartedIDList()

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

◆ getDepartedNumber()

int Simulation::getDepartedNumber ( )
static

◆ 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

◆ getEmergencyStoppingVehiclesNumber()

int Simulation::getEmergencyStoppingVehiclesNumber ( )
static

◆ getEndingTeleportIDList()

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

◆ getEndingTeleportNumber()

int Simulation::getEndingTeleportNumber ( )
static

◆ getLoadedIDList()

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

◆ getLoadedNumber()

int Simulation::getLoadedNumber ( )
static

◆ getMinExpectedNumber()

◆ getNetBoundary()

◆ getParameter()

◆ getParkingEndingVehiclesIDList()

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

◆ getParkingEndingVehiclesNumber()

int Simulation::getParkingEndingVehiclesNumber ( )
static

◆ getParkingStartingVehiclesIDList()

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

◆ getParkingStartingVehiclesNumber()

int Simulation::getParkingStartingVehiclesNumber ( )
static

◆ getStartingTeleportIDList()

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

◆ getStartingTeleportNumber()

int Simulation::getStartingTeleportNumber ( )
static

◆ getStopEndingVehiclesIDList()

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

◆ getStopEndingVehiclesNumber()

int Simulation::getStopEndingVehiclesNumber ( )
static

◆ getStopStartingVehiclesIDList()

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

◆ getStopStartingVehiclesNumber()

int Simulation::getStopStartingVehiclesNumber ( )
static

◆ getSubscriptionResults()

const TraCIResults Simulation::getSubscriptionResults ( )
static

Definition at line 115 of file Simulation.cpp.

References mySubscriptionResults.

◆ getTime()

double Simulation::getTime ( )
static

Definition at line 127 of file Simulation.cpp.

References SIMTIME.

Referenced by handleVariable().

◆ handleVariable()

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

Definition at line 656 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(), VAR_ARRIVED_VEHICLES_IDS, VAR_ARRIVED_VEHICLES_NUMBER, VAR_BUS_STOP_WAITING, VAR_COLLIDING_VEHICLES_IDS, VAR_COLLIDING_VEHICLES_NUMBER, VAR_DELTA_T, VAR_DEPARTED_VEHICLES_IDS, VAR_DEPARTED_VEHICLES_NUMBER, VAR_EMERGENCYSTOPPING_VEHICLES_IDS, VAR_EMERGENCYSTOPPING_VEHICLES_NUMBER, VAR_LOADED_VEHICLES_IDS, VAR_LOADED_VEHICLES_NUMBER, VAR_MIN_EXPECTED_VEHICLES, VAR_PARKING_ENDING_VEHICLES_IDS, VAR_PARKING_ENDING_VEHICLES_NUMBER, VAR_PARKING_STARTING_VEHICLES_IDS, VAR_PARKING_STARTING_VEHICLES_NUMBER, VAR_STOP_ENDING_VEHICLES_IDS, VAR_STOP_ENDING_VEHICLES_NUMBER, VAR_STOP_STARTING_VEHICLES_IDS, VAR_STOP_STARTING_VEHICLES_NUMBER, VAR_TELEPORT_ENDING_VEHICLES_IDS, VAR_TELEPORT_ENDING_VEHICLES_NUMBER, VAR_TELEPORT_STARTING_VEHICLES_IDS, VAR_TELEPORT_STARTING_VEHICLES_NUMBER, VAR_TIME, VAR_TIME_STEP, libsumo::VariableWrapper::wrapDouble(), libsumo::VariableWrapper::wrapInt(), and libsumo::VariableWrapper::wrapStringList().

Referenced by makeWrapper().

◆ isLoaded()

bool Simulation::isLoaded ( )
static

return whether a simulation (network) is present

Definition at line 74 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 64 of file Simulation.cpp.

References close(), XMLSubSys::init(), NLBuilder::init(), libsumo::Helper::registerVehicleStateListener(), and OptionsIO::setArgs().

Referenced by main().

◆ makeWrapper()

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

◆ saveState()

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

◆ step()

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

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

Definition at line 80 of file Simulation.cpp.

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

◆ subscribe()

void Simulation::subscribe ( const std::vector< int > &  vars = std::vector<int>(),
double  beginTime = INVALID_DOUBLE_VALUE,
double  endTime = INVALID_DOUBLE_VALUE 
)
static

Definition at line 109 of file Simulation.cpp.

References CMD_SUBSCRIBE_SIM_VARIABLE, and libsumo::Helper::subscribe().

Field Documentation

◆ myContextSubscriptionResults

ContextSubscriptionResults Simulation::myContextSubscriptionResults
staticprivate

Definition at line 131 of file Simulation.h.

Referenced by makeWrapper().

◆ mySubscriptionResults

SubscriptionResults Simulation::mySubscriptionResults
staticprivate

Definition at line 130 of file Simulation.h.

Referenced by getSubscriptionResults(), and makeWrapper().


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