75 template<
class E,
class L,
class N,
class V>
77 template<
class E,
class L,
class N,
class V>
199 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles,
231 const std::map<SUMOVehicleClass, double>*
getRestrictions(
const std::string&
id)
const;
237 void addMesoType(
const std::string& typeID,
const MesoEdgeType& edgeType);
242 const MesoEdgeType&
getMesoType(
const std::string& typeID);
720 bool warnOnce(
const std::string& typeAndID);
878 FXMutex myStateListenerMutex;
889 mutable std::map<int, SUMOAbstractRouter<MSEdge, SUMOVehicle>*>
myRouterTT;
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.
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 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.
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
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterEffort
MSIntermodalRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
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.
SUMOTime myStateDumpPeriod
The period for writing state.
const std::string generateStatistics(SUMOTime start)
Writes performance output and running vehicle stats.
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.
@ VEHICLE_STATE_NEWROUTE
The vehicle got a new route.
@ VEHICLE_STATE_ENDING_TELEPORT
The vehicle ended being teleported.
@ VEHICLE_STATE_DEPARTED
The vehicle has departed (was inserted into the network)
@ VEHICLE_STATE_STARTING_PARKING
The vehicles starts to park.
@ VEHICLE_STATE_MANEUVERING
Vehicle maneuvering either entering or exiting a parking space.
@ VEHICLE_STATE_ENDING_STOP
The vehicle ends to stop.
@ VEHICLE_STATE_ARRIVED
The vehicle arrived at his destination (is deleted)
@ VEHICLE_STATE_COLLISION
The vehicle is involved in a collision.
@ VEHICLE_STATE_EMERGENCYSTOP
The vehicle had to brake harder than permitted.
@ VEHICLE_STATE_STARTING_TELEPORT
The vehicle started to teleport.
@ VEHICLE_STATE_STARTING_STOP
The vehicles starts to stop.
@ VEHICLE_STATE_ENDING_PARKING
The vehicle ends to park.
@ VEHICLE_STATE_BUILT
The vehicle was built, but has not yet departed.
int myLogStepPeriod
Period between successive step-log outputs.
SUMOTime myStep
Current time step.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSDetectorControl & getDetectorControl()
Returns the detector control.
virtual bool isSelected(const MSTrafficLightLogic *) const
return wheter the given logic (or rather it's wrapper) is selected in the GUI
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
MSEventControl * myBeginOfTimestepEvents
Controls events executed at the begin of a time step;.
bool addTractionSubstation(MSTractionSubstation *substation)
Adds a traction substation.
const MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
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)
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
ShapeContainer * myShapeContainer
A container for geometrical shapes;.
bool hasBidiEdges() const
return whether the network contains bidirectional rail edges
double myVersion
the network version
std::string myStateDumpSuffix
MSDynamicShapeUpdater * getDynamicShapeUpdater()
Returns the dynamic shapes updater.
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
bool myLogStepNumber
Information whether the number of the simulation step shall be logged.
MSEventControl * myInsertionEvents
Controls insertion events;.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
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.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
std::map< int, MSPedestrianRouter * > myPedestrianRouter
static const std::string STAGE_MOVEMENTS
int myMaxTeleports
Maximum number of teleports.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
PedestrianRouter< MSEdge, MSLane, MSJunction, MSVehicle > MSPedestrianRouter
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.
double getNetworkVersion() const
return the network version
SimulationState adaptToState(const SimulationState state) const
Called after a simulation step, this method adapts the current simulation state if necessary.
void writeSubstationOutput() const
write electrical substation output
static const std::string STAGE_INSERTIONS
long long int myPersonsMoved
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
std::map< std::string, MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
ShapeContainer & getShapeContainer()
Returns the shapes container.
void addMesoType(const std::string &typeID, const MesoEdgeType &edgeType)
Adds edge type specific meso parameters.
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.
MSJunctionControl & getJunctionControl()
Returns the junctions control.
IntermodalRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSIntermodalRouter
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
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.)
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
void simulationStep()
Performs a single simulation step.
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;.
void writeOutput()
Write netstate, summary and detector output.
void setCurrentTimeStep(const SUMOTime step)
Sets the current simulation step (used by state loading)
bool myAmInterrupted
whether an interrupt occured
void addVehicleStateListener(VehicleStateListener *listener)
Adds a vehicle states listener.
void preSimStepOutput() const
Prints the current step number.
MSEdgeControl & getEdgeControl()
Returns the edge control.
std::vector< SUMOTime > myStateDumpTimes
Times at which a state shall be written.
bool hasContainers() const
Returns whether containers are simulated.
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 writeRailSignalBlocks() const
write rail signal block output
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSEventControl * getInsertionEvents()
Returns the event control for insertion events.
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.
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
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
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.
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, double version)
Closes the network's building process.
bool hasPersons() const
Returns whether persons are simulated.
long myTraCIStepDuration
The last simulation step duration.
MSDetectorControl * myDetectorControl
Controls detectors;.
static const std::string STAGE_LANECHANGE
MSNet(const MSNet &)
Invalidated copy constructor.
MSNet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents, ShapeContainer *shapeCont=0)
Constructor.
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const double speed)
Adds a restriction for an edge type.
bool hasPermissions() const
Returns whether the network has specific vehicle class permissions.
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterTT
static void adaptIntermodalRouter(MSIntermodalRouter &router)
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.
MSNet & operator=(const MSNet &)
Invalidated assignment operator.
std::map< int, MSIntermodalRouter * > myIntermodalRouter
virtual ~MSNet()
Destructor.
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
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)
MSInsertionControl * myInserter
Controls vehicle insertion;.
void postSimStepOutput() const
Prints the statistics of the step at its end.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
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
void clearState(const SUMOTime step)
Resets events when quick-loading state.
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.
void writeStatistics() const
write statistic output to (xml) file
bool hasInternalLinks() const
return whether the network contains internal links
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterEffort(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
bool checkWalkingarea()
check all lanes for type walkingArea
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.
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)
Representation of a vehicle.
Storage for geometrical objects.
edge type specific meso parameters