75template<
class E,
class L,
class N,
class V>
77template<
class E,
class L,
class N,
class V>
198 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles,
200 bool junctionHigherSpeeds,
231 const std::map<SUMOVehicleClass, double>*
getRestrictions(
const std::string&
id)
const;
250 bool hasFlow(
const std::string&
id)
const;
810 bool warnOnce(
const std::string& typeAndID);
1004 FXMutex myVehicleStateListenerMutex;
1007 FXMutex myTransportableStateListenerMutex;
std::vector< MSEdge * > MSEdgeVector
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
Detectors container; responsible for string and output generation.
Stores edges and lanes, performs moving of vehicle.
A road/street connecting two junctions.
A storage for edge travel times and efforts.
Stores time-dependant events and executes them at the proper time.
Inserts vehicles into the network when their departure time is reached.
Container for junctions; performs operations on all stored junctions.
Representation of a lane in the micro simulation.
Interface for objects listening to transportable state changes.
virtual void transportableStateChanged(const MSTransportable *const transportable, TransportableState to, const std::string &info="")=0
Called if a transportable changes its state.
TransportableStateListener()
Constructor.
virtual ~TransportableStateListener()
Destructor.
Interface for objects listening to vehicle state changes.
virtual ~VehicleStateListener()
Destructor.
virtual void vehicleStateChanged(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")=0
Called if a vehicle changes its state.
VehicleStateListener()
Constructor.
The simulated network and simulation perfomer.
std::map< SumoXMLTag, NamedObjectCont< MSStoppingPlace * > > myStoppingPlaces
Dictionary of bus / container stops.
long myTraCIMillis
The overall time spent waiting for traci operations including.
static double getEffort(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the effort to pass an edge.
bool warnOnce(const std::string &typeAndID)
return whether a warning regarding the given object shall be issued
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
bool myLogExecutionTime
Information whether the simulation duration shall be logged.
MSTransportableControl * myPersonControl
Controls person building and deletion;.
void removeVehicleStateListener(VehicleStateListener *listener)
Removes a vehicle states listener.
SUMORouteLoaderControl * myRouteLoaders
Route loader for dynamic loading of routes.
bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace *stop)
Adds a stopping place.
void informTransportableStateListener(const MSTransportable *const transportable, TransportableState to, const std::string &info="")
Informs all added listeners about a transportable's state change.
SUMOTime myStateDumpPeriod
The period for writing state.
static const NamedObjectCont< MSStoppingPlace * > myEmptyStoppingPlaceCont
void writeOverheadWireSegmentOutput() const
write the output generated by an overhead wire segment
void writeChargingStationOutput() const
write charging station output
std::pair< bool, NamedRTree > myLanesRTree
An RTree structure holding lane IDs.
bool checkBidiEdges()
check wether bidirectional edges occur in the network
VehicleState
Definition of a vehicle state.
@ ENDING_PARKING
The vehicle ends to park.
@ STARTING_STOP
The vehicles starts to stop.
@ BUILT
The vehicle was built, but has not yet departed.
@ STARTING_PARKING
The vehicles starts to park.
@ NEWROUTE
The vehicle got a new route.
@ STARTING_TELEPORT
The vehicle started to teleport.
@ ENDING_STOP
The vehicle ends to stop.
@ ENDING_TELEPORT
The vehicle ended being teleported.
@ ARRIVED
The vehicle arrived at his destination (is deleted)
@ DEPARTED
The vehicle has departed (was inserted into the network)
@ COLLISION
The vehicle is involved in a collision.
@ EMERGENCYSTOP
The vehicle had to brake harder than permitted.
@ MANEUVERING
Vehicle maneuvering either entering or exiting a parking space.
int myLogStepPeriod
Period between successive step-log outputs.
MSDetectorControl & getDetectorControl()
Returns the detector control.
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
SUMOTime myStep
Current time step.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual bool isSelected(const MSTrafficLightLogic *) const
return wheter the given logic (or rather its wrapper) is selected in the GUI
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
const CollisionMap & getCollisions() const
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
std::map< std::string, bool > myWarnedOnce
container to record warnings that shall only be issued once
static void initStatic()
Place for static initializations of simulation components (called after successful net build)
void removeOutdatedCollisions()
remove collisions from the previous simulation step
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
MSVehicleRouter & getRouterEffort(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
std::vector< std::string > myPeriodicStateFiles
The names of the last K periodic state files (only only K shall be kept)
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
std::string myStateDumpSuffix
bool checkElevation()
check all lanes for elevation data
bool myHavePermissions
Whether the network contains edges which not all vehicles may pass.
bool existTractionSubstation(const std::string &substationId)
return whether given electrical substation exists in the network
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
void removeTransportableStateListener(TransportableStateListener *listener)
Removes a transportable states listener.
SimulationState adaptToState(const SimulationState state, const bool isLibsumo=false) const
Called after a simulation step, this method adapts the current simulation state if necessary.
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 junctionHigherSpeeds, const MMVersion &version)
Closes the network's building process.
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
MMVersion myVersion
the network version
MSEventControl * myInsertionEvents
Controls insertion events;.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
MMVersion getNetworkVersion() const
return the network version
SimulationState
Possible states of a simulation - running or stopped with different reasons.
@ SIMSTATE_TOO_MANY_TELEPORTS
The simulation had too many teleports.
@ SIMSTATE_NO_FURTHER_VEHICLES
The simulation does not contain further vehicles.
@ SIMSTATE_LOADING
The simulation is loading.
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
@ SIMSTATE_CONNECTION_CLOSED
The connection to a client was closed by the client.
@ SIMSTATE_INTERRUPTED
An external interrupt occured.
@ SIMSTATE_RUNNING
The simulation is running.
@ SIMSTATE_END_STEP_REACHED
The final simulation step has been performed.
MSEventControl * getInsertionEvents()
Returns the event control for insertion events.
std::map< int, MSPedestrianRouter * > myPedestrianRouter
static const std::string STAGE_MOVEMENTS
bool hasFlow(const std::string &id) const
return whether the given flow is known
int myMaxTeleports
Maximum number of teleports.
MSEventControl * myEndOfTimestepEvents
Controls events executed at the end of a time step;.
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
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.
bool myHasInternalLinks
Whether the network contains internal links/lanes/edges.
void writeSubstationOutput() const
write electrical substation output
static const std::string STAGE_INSERTIONS
MSJunctionControl & getJunctionControl()
Returns the junctions control.
long long int myPersonsMoved
void quickReload()
reset state to the beginning without reloading the network
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
bool hasJunctionHigherSpeeds() const
return whether the network was built with higher junction speeds
MSTransportableRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
static void clearAll()
Clears all dictionaries.
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
void setPermissionsFound()
Labels the network to contain vehicle class permissions.
void writeStatistics(const SUMOTime start, const long now) const
write statistic output to (xml) file
void writeSummaryOutput()
write summary-output to (xml) file
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
std::map< std::string, std::vector< Collision > > CollisionMap
MSEdgeControl * myEdges
Controls edges, performs vehicle movement;.
std::unique_ptr< MSDynamicShapeUpdater > myDynamicShapeUpdater
Updater for dynamic shapes that are tracking traffic objects (ensures removal of shape dynamics when ...
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.
static bool hasInstance()
Returns whether the network was already constructed.
void closeSimulation(SUMOTime start, const std::string &reason="")
Closes the simulation (all files, connections, etc.)
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
bool myHasElevation
Whether the network contains elevation data.
static double getTravelTime(const MSEdge *const e, const SUMOVehicle *const v, double t)
Returns the travel time to pass an edge.
MSTransportableControl * myContainerControl
Controls container building and deletion;.
std::vector< TransportableStateListener * > myTransportableStateListeners
Container for transportable state listener.
void writeOutput()
Write netstate, summary and detector output.
virtual void updateGUI() const
update view after simulation.loadState
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
bool myAmInterrupted
whether an interrupt occured
void simulationStep(const bool onlyMove=false)
Performs a single simulation step.
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
void clearState(const SUMOTime step, bool quickReload=false)
Resets events when quick-loading state.
void preSimStepOutput() const
Prints the current step number.
void writeCollisions() const
write collision output to (xml) file
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
MSDynamicShapeUpdater * getDynamicShapeUpdater()
Returns the dynamic shapes updater.
bool hasContainers() const
Returns whether containers are simulated.
void addTransportableStateListener(TransportableStateListener *listener)
Adds a transportable states listener.
std::vector< MSTractionSubstation * > myTractionSubstations
Dictionary of traction substations.
SUMOTime myEdgeDataEndTime
end of loaded edgeData
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
std::map< std::string, std::map< SUMOVehicleClass, double > > myRestrictions
The vehicle class specific speed restrictions.
std::vector< std::string > myStateDumpFiles
The names for the state files.
void addMesoType(const std::string &typeID, const MESegment::MesoEdgeType &edgeType)
Adds edge type specific meso parameters.
void writeRailSignalBlocks() const
write rail signal block output
MSNet & operator=(const MSNet &)
Invalidated assignment operator.
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
bool logSimulationDuration() const
Returns whether duration shall be logged.
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
long long int myVehiclesMoved
The overall number of vehicle movements.
static const std::string STAGE_REMOTECONTROL
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
bool isInterrupted() const
std::map< int, MSTransportableRouter * > myIntermodalRouter
std::vector< VehicleStateListener * > myVehicleStateListeners
Container for vehicle state listener.
SimulationState simulationState(SUMOTime stopTime) const
This method returns the current simulation state. It should not modify status.
bool hasPersons() const
Returns whether persons are simulated.
long myTraCIStepDuration
The last simulation step duration.
TransportableState
Definition of a transportable state.
@ CONTAINER_DEPARTED
The transportable container has departed (was inserted into the network)
@ PERSON_DEPARTED
The transportable person has departed (was inserted into the network)
@ PERSON_ARRIVED
The transportable person arrived at his destination (is deleted)
@ CONTAINER_ARRIVED
The transportable container arrived at his destination (is deleted)
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSDetectorControl * myDetectorControl
Controls detectors;.
ShapeContainer & getShapeContainer()
Returns the shapes container.
bool myStepCompletionMissing
whether libsumo triggered a partial step (executeMove)
static const std::string STAGE_LANECHANGE
MSNet(const MSNet &)
Invalidated copy constructor.
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
MSVehicleRouter & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
bool hasPermissions() const
Returns whether the network has specific vehicle class permissions.
virtual bool skipFinalReset() const
gui may prevent final meanData reset to keep live data visible
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
bool myLefthand
Whether the network was built for left-hand traffic.
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
virtual ~MSNet()
Destructor.
std::map< int, MSVehicleRouter * > myRouterEffort
MSTractionSubstation * findTractionSubstation(const std::string &substationId)
find electrical substation by its id
static MSNet * myInstance
Unique instance of MSNet.
virtual void createTLWrapper(MSTrafficLightLogic *)
creates a wrapper for the given logic (see GUINet)
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
MSInsertionControl * myInserter
Controls vehicle insertion;.
void postSimStepOutput() const
Prints the statistics of the step at its end.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
bool registerCollision(const SUMOTrafficObject *collider, const SUMOTrafficObject *victim, const std::string &collisionType, const MSLane *lane, double pos)
register collision and return whether it was the first one involving these vehicles
static const std::string STAGE_EVENTS
string constants for simstep stages
void loadRoutes()
loads routes for the next few steps
std::string myStateDumpPrefix
name components for periodic state
bool myJunctionHigherSpeeds
Whether the network was built with higher speed on junctions.
MSEdgeControl & getEdgeControl()
Returns the edge control.
long mySimBeginMillis
The overall simulation duration.
virtual bool isGUINet() const
Returns whether this is a GUI Net.
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
std::map< int, MSVehicleRouter * > myRouterTT
const MESegment::MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
void postMoveStep()
Performs the parts of the simulation step which happen after the move.
bool hasInternalLinks() const
return whether the network contains internal links
const std::string generateStatistics(const SUMOTime start, const long now)
Writes performance output and running vehicle stats.
bool checkWalkingarea()
check all lanes for type walkingArea
static void adaptIntermodalRouter(MSTransportableRouter &router)
CollisionMap myCollisions
collisions in the current time step
bool hasElevation() const
return whether the network contains elevation data
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
A lane area vehicles can halt at.
A class that stores and controls tls and switching of their programs.
Traction substation powering one or more overhead wire sections.
The parent class for traffic light logics.
The class responsible for building and deletion of vehicles.
Representation of a vehicle in the micro simulation.
A map of named object pointers.
A storage for options typed value containers)
An upper class for objects with additional parameters.
Representation of a vehicle, person, or container.
Representation of a vehicle.
Storage for geometrical objects.
edge type specific meso parameters