 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
78 template<
class E,
class L,
class N,
class V>
80 template<
class E,
class L,
class N,
class V>
189 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles,
221 const std::map<SUMOVehicleClass, double>*
getRestrictions(
const std::string&
id)
const;
673 bool warnOnce(
const std::string& typeAndID);
816 FXMutex myStateListenerMutex;
828 mutable std::map<int, SUMOAbstractRouter<MSEdge, SUMOVehicle>*>
myRouterTT;
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
MSNet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents, ShapeContainer *shapeCont=0)
Constructor.
bool hasInternalLinks() const
return whether the network contains internal links
Stores time-dependant events and executes them at the proper time.
virtual void createTLWrapper(MSTrafficLightLogic *)
creates a wrapper for the given logic (see GUINet)
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
VehicleStateListener()
Constructor.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
A lane area vehicles can halt at.
bool myHasElevation
Whether the network contains elevation data.
bool hasPermissions() const
Returns whether the network has specific vehicle class permissions.
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
@ VEHICLE_STATE_DEPARTED
The vehicle has departed (was inserted into the network)
MSDetectorControl & getDetectorControl()
Returns the detector control.
bool hasContainers() const
Returns whether containers are simulated.
void preSimStepOutput() const
Prints the current step number.
Representation of a lane in the micro simulation.
static const std::string STAGE_INSERTIONS
void simulationStep()
Performs a single simulation step.
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
MSDynamicShapeUpdater * getDynamicShapeUpdater()
Returns the dynamic shapes updater.
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
long long int myPersonsMoved
ShapeContainer & getShapeContainer()
Returns the shapes container.
static MSNet * myInstance
Unique instance of MSNet.
void writeOutput()
Write netstate, summary and detector output.
SimulationState simulationState(SUMOTime stopTime) const
Called after a simulation step, this method returns the current simulation state.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
Interface for objects listening to vehicle state changes.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Detectors container; responsible for string and output generation.
The simulated network and simulation perfomer.
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
MSInsertionControl & getInsertionControl()
Returns the insertion control.
bool warnOnce(const std::string &typeAndID)
return whether a warning regarding the given object shall be issued
int myMaxTeleports
Maximum number of teleports.
static const std::string STAGE_LANECHANGE
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Representation of a vehicle.
void postSimStepOutput() const
Prints the statistics of the step at its end.
IntermodalRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSIntermodalRouter
Storage for geometrical objects.
double myVersion
the network version
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
bool hasPersons() const
Returns whether persons are simulated.
static void clearAll()
Clears all dictionaries.
bool logSimulationDuration() const
Returns whether duration shall be logged.
std::map< int, MSPedestrianRouter * > myPedestrianRouter
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
@ VEHICLE_STATE_ARRIVED
The vehicle arrived at his destination (is deleted)
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
std::string getStoppingPlaceID(const MSLane *lane, const double pos, const SumoXMLTag category) const
Returns the stop of the given category close to the given position.
@ VEHICLE_STATE_NEWROUTE
The vehicle got a new route.
virtual bool isGUINet() const
Returns whether this is a GUI Net.
void closeSimulation(SUMOTime start)
Closes the simulation (all files, connections, etc.)
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::vector< std::string > myStateDumpFiles
The names for the state files.
A storage for edge travel times and efforts.
@ VEHICLE_STATE_EMERGENCYSTOP
The vehicle had to brake harder than permitted.
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
void writeChargingStationOutput() const
write charging station output
long long int myVehiclesMoved
The overall number of vehicle movements.
const std::map< SUMOVehicleClass, double > * getRestrictions(const std::string &id) const
Returns the restrictions for an edge type If no restrictions are present, 0 is returned.
@ SIMSTATE_NO_FURTHER_VEHICLES
The simulation does not contain further vehicles.
Container for junctions; performs operations on all stored junctions.
long mySimBeginMillis
The overall simulation duration.
bool myAmInterrupted
whether an interrupt occured
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
SimulationState
Possible states of a simulation - running or stopped with different reasons.
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
@ VEHICLE_STATE_STARTING_PARKING
The vehicles starts to park.
MSIntermodalRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
@ SIMSTATE_END_STEP_REACHED
The final simulation step has been performed.
A map of named object pointers.
SUMOTime myStep
Current time step.
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
void setPermissionsFound()
Labels the network to contain vehicle class permissions.
VehicleState
Definition of a vehicle state.
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
bool lefthand() const
return whether the network was built for lefthand traffic
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
long myTraCIStepDuration
The last simulation step duration.
virtual ~MSNet()
Destructor.
MSNet & operator=(const MSNet &)
Invalidated assignment operator.
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Inserts vehicles into the network when their departure time is reached.
std::string myStateDumpPrefix
name components for periodic state
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterEffort
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
MSInsertionControl * myInserter
Controls vehicle insertion;.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
virtual ~VehicleStateListener()
Destructor.
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
@ VEHICLE_STATE_COLLISION
The vehicle is involved in a collision.
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
@ VEHICLE_STATE_STARTING_TELEPORT
The vehicle started to teleport.
@ VEHICLE_STATE_BUILT
The vehicle was built, but has not yet departed.
@ VEHICLE_STATE_STARTING_STOP
The vehicles starts to stop.
@ SIMSTATE_LOADING
The simulation is loading.
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
A storage for options typed value containers)
A road/street connecting two junctions.
void loadRoutes()
loads routes for the next few steps
bool checkWalkingarea()
check all lanes for type walkingArea
The parent class for traffic light logics.
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
SUMOTime myStateDumpPeriod
The period for writing state.
bool hasElevation() const
return whether the network contains elevation data
static const std::string STAGE_MOVEMENTS
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
@ SIMSTATE_CONNECTION_CLOSED
The connection to a client was closed by the client.
PedestrianRouter< MSEdge, MSLane, MSJunction, MSVehicle > MSPedestrianRouter
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
static const std::string STAGE_EVENTS
string constants for simstep stages
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
@ VEHICLE_STATE_MANEUVERING
Vehicle maneuvering either entering or exiting a parking space.
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterTT
virtual bool isSelected(const MSTrafficLightLogic *) const
return wheter the given logic (or rather it's wrapper) is selected in the GUI
std::string myStateDumpSuffix
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual MSTransportableControl & getPersonControl()
Returns the person control.
@ SIMSTATE_RUNNING
The simulation is running.
virtual void vehicleStateChanged(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")=0
Called if a vehicle changes its state.
bool isInterrupted() const
std::vector< MSEdge * > MSEdgeVector
bool myLefthand
Whether the network was built for left-hand traffic.
MSTransportableControl * myContainerControl
Controls container building and deletion;.
MSEventControl * getInsertionEvents()
Returns the event control for insertion events.
@ VEHICLE_STATE_ENDING_PARKING
The vehicle ends to park.
void writeRailSignalBlocks() const
write rail signal block output
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
@ VEHICLE_STATE_ENDING_TELEPORT
The vehicle ended being teleported.
const std::string generateStatistics(SUMOTime start)
Writes performance output and running vehicle stats.
static bool hasInstance()
Returns whether the network was already constructed.
static void initStatic()
Place for static initializations of simulation components (called after successful net build)
The class responsible for building and deletion of vehicles.
Stores edges and lanes, performs moving of vehicle.
MSDetectorControl * myDetectorControl
Controls detectors;.
A class that stores and controls tls and switching of their programs.
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
bool checkBidiEdges()
check wether bidirectional edges occur in the network
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
std::map< int, MSIntermodalRouter * > myIntermodalRouter
void closeBuilding(const OptionsCont &oc, MSEdgeControl *edges, MSJunctionControl *junctions, SUMORouteLoaderControl *routeLoaders, MSTLLogicControl *tlc, std::vector< SUMOTime > stateDumpTimes, std::vector< std::string > stateDumpFiles, bool hasInternalLinks, bool hasNeighs, bool lefthand, double version)
Closes the network's building process.
MSEventControl * myInsertionEvents
Controls insertion events;.
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
double getNetworkVersion() const
return the network version
@ SIMSTATE_INTERRUPTED
An external interrupt occured.
MSEdgeControl & getEdgeControl()
Returns the edge control.
static void adaptIntermodalRouter(MSIntermodalRouter &router)
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
bool checkElevation()
check all lanes for elevation data
@ SIMSTATE_TOO_MANY_TELEPORTS
The simulation had too many teleports.
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
bool myHavePermissions
Whether the network contains edges which not all vehicles may pass.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterEffort(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
@ VEHICLE_STATE_ENDING_STOP
The vehicle ends to stop.
MSJunctionControl & getJunctionControl()
Returns the junctions control.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
MSTransportableControl * myPersonControl
Controls person building and deletion;.
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
Representation of a vehicle in the micro simulation.