SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSNet Class Reference

The simulated network and simulation perfomer. More...

#include <MSNet.h>

Inheritance diagram for MSNet:
GUINet

Data Structures

class  EdgeWeightsProxi
 A proxi for edge weights known by a vehicle/known globally. More...
class  VehicleStateListener
 Interface for objects listening to vehicle state changes. More...

Public Types

enum  SimulationState {
  SIMSTATE_RUNNING, SIMSTATE_END_STEP_REACHED, SIMSTATE_NO_FURTHER_VEHICLES, SIMSTATE_CONNECTION_CLOSED,
  SIMSTATE_ERROR_IN_SIM, SIMSTATE_TOO_MANY_VEHICLES
}
 Possible states of a simulation - running or stopped with different reasons. More...

Public Member Functions

void closeBuilding (MSEdgeControl *edges, MSJunctionControl *junctions, MSRouteLoaderControl *routeLoaders, MSTLLogicControl *tlc, std::vector< SUMOTime > stateDumpTimes, std::vector< std::string > stateDumpFiles)
 Closes the network's building process.
void closeSimulation (SUMOTime start)
 Closes the simulation (all files, connections, etc.)
SUMOTime getCurrentTimeStep () const
 Returns the current simulation step (in s)
bool logSimulationDuration () const
 Returns whether duration shall be logged.
 MSNet (MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents, ShapeContainer *shapeCont=0)
 Constructor.
int simulate (SUMOTime start, SUMOTime stop)
 Simulates from timestep start to stop.
SimulationState simulationState (SUMOTime stopTime) const
 Called after a simulation step, this method returns the current simulation state.
void simulationStep ()
 Performs a single simulation step.
void writeOutput ()
 Write netstate, emission and detector output.
virtual ~MSNet ()
 Destructor.
Output during the simulation
void preSimStepOutput () const
 Prints the current step number.
void postSimStepOutput () const
 Prints the statistics of the step at its end.
Retrieval of references to substructures
MSVehicleControlgetVehicleControl ()
 Returns the vehicle control.
MSPersonControlgetPersonControl ()
 Returns the person control.
MSEdgeControlgetEdgeControl ()
 Returns the edge control.
MSInsertionControlgetInsertionControl ()
 Returns the insertion control.
MSDetectorControlgetDetectorControl ()
 Returns the detector control.
MSTLLogicControlgetTLSControl ()
 Returns the tls logics control.
MSJunctionControlgetJunctionControl ()
 Returns the junctions control.
MSEventControlgetBeginOfTimestepEvents ()
 Returns the event control for events executed at the begin of a time step.
MSEventControlgetEndOfTimestepEvents ()
 Returns the event control for events executed at the end of a time step.
MSEventControlgetInsertionEvents ()
 Returns the event control for insertion events.
ShapeContainergetShapeContainer ()
 Returns the shapes container.
MSEdgeWeightsStoragegetWeightsStorage ()
 Returns the net's internal edge travel times/efforts container.
Insertion and retrieval of bus stops
bool addBusStop (MSBusStop *busStop)
 Adds a bus stop.
MSBusStopgetBusStop (const std::string &id) const
 Returns the named bus stop.
std::string getBusStopID (const MSLane *lane, const SUMOReal pos) const
 Returns the bus stop close to the given position.

Static Public Member Functions

static void clearAll ()
 Clears all dictionaries.
static MSNetgetInstance ()
 Returns the pointer to the unique instance of MSNet (singleton).
static std::string getStateMessage (SimulationState state)
 Returns the message to show if a certain state occurs.

Protected Attributes

NamedObjectCont< MSBusStop * > myBusStopDict
 Dictionary of bus stops.
MSRouteLoaderControlmyRouteLoaders
 Route loader for dynamic loading of routes.
SUMOTime myStep
 Current time step.
int myTooManyVehicles
 Storage for maximum vehicle number.
std::vector
< VehicleStateListener * > 
myVehicleStateListeners
 Container for vehicle state listener.
Substructures
MSVehicleControlmyVehicleControl
 Controls vehicle building and deletion;.
MSPersonControlmyPersonControl
 Controls person building and deletion;.
MSEdgeControlmyEdges
 Controls edges, performs vehicle movement;.
MSJunctionControlmyJunctions
 Controls junctions, realizes right-of-way rules;.
MSTLLogicControlmyLogics
 Controls tls logics, realizes waiting on tls rules;.
MSInsertionControlmyInserter
 Controls vehicle insertion;.
MSDetectorControlmyDetectorControl
 Controls detectors;.
MSEventControlmyBeginOfTimestepEvents
 Controls events executed at the begin of a time step;.
MSEventControlmyEndOfTimestepEvents
 Controls events executed at the end of a time step;.
MSEventControlmyInsertionEvents
 Controls insertion events;.
ShapeContainermyShapeContainer
 A container for geometrical shapes;.
MSEdgeWeightsStoragemyEdgeWeights
 The net's knowledge about edge efforts/travel times;.
data needed for computing performance values
bool myLogExecutionTime
 Information whether the simulation duration shall be logged.
bool myLogStepNumber
 Information whether the number of the simulation step shall be logged.
long mySimStepBegin
 The last simulation step begin, end and duration.
long mySimStepEnd
long mySimStepDuration
long mySimBeginMillis
 The overall simulation duration.
long myVehiclesMoved
 The overall number of vehicle movements.
State output variables
std::vector< SUMOTimemyStateDumpTimes
 Times at which a state shall be written.
std::vector< std::string > myStateDumpFiles
 The names for the state files.

Static Protected Attributes

static MSNetmyInstance = 0
 Unique instance of MSNet.

Private Member Functions

 MSNet (const MSNet &)
 Invalidated copy constructor.
MSNetoperator= (const MSNet &)
 Invalidated assignment operator.

Notification about vehicle state changes

enum  VehicleState {
  VEHICLE_STATE_BUILT, VEHICLE_STATE_DEPARTED, VEHICLE_STATE_STARTING_TELEPORT, VEHICLE_STATE_ENDING_TELEPORT,
  VEHICLE_STATE_ARRIVED, VEHICLE_STATE_NEWROUTE
}
 Definition of a vehicle state. More...
void addVehicleStateListener (VehicleStateListener *listener)
 Adds a vehicle states listener.
void removeVehicleStateListener (VehicleStateListener *listener)
 Removes a vehicle states listener.
void informVehicleStateListener (const SUMOVehicle *const vehicle, VehicleState to)
 Informs all added listeners about a vehicle's state change.

Detailed Description

The simulated network and simulation perfomer.

Definition at line 87 of file MSNet.h.

Member Enumeration Documentation

Possible states of a simulation - running or stopped with different reasons.

Enumerator:
SIMSTATE_RUNNING 

The simulation is running.

SIMSTATE_END_STEP_REACHED 

The final simulation step has been performed.

SIMSTATE_NO_FURTHER_VEHICLES 

The simulation does not contain further vehicles.

SIMSTATE_CONNECTION_CLOSED 

The connection to a client was closed by the client.

SIMSTATE_ERROR_IN_SIM 

An error occured during the simulation step.

SIMSTATE_TOO_MANY_VEHICLES 

The simulation contains too many vehicles (.

Deprecated:
)

Definition at line 92 of file MSNet.h.

Definition of a vehicle state.

Enumerator:
VEHICLE_STATE_BUILT 

The vehicle was built, but has not yet departed.

VEHICLE_STATE_DEPARTED 

The vehicle has departed (was inserted into the network)

VEHICLE_STATE_STARTING_TELEPORT 

The vehicle started to teleport.

VEHICLE_STATE_ENDING_TELEPORT 

The vehicle ended being teleported.

VEHICLE_STATE_ARRIVED 

The vehicle arrived at his destination (is deleted)

VEHICLE_STATE_NEWROUTE 

The vehicle got a new route.

Definition at line 422 of file MSNet.h.

Constructor & Destructor Documentation

MSNet::MSNet ( MSVehicleControl vc,
MSEventControl beginOfTimestepEvents,
MSEventControl endOfTimestepEvents,
MSEventControl insertionEvents,
ShapeContainer shapeCont = 0 
)

Constructor.

This constructor builds a net of which only some basic structures are initialised. It prepares the network for being filled while loading. As soon as all edge/junction/traffic lights and other containers are build, they must be initialised using "closeBuilding".

Parameters
[in]vcThe vehicle control to use
[in]beginOfTimestepEventsThe event control to use for simulation step begin events
[in]endOfTimestepEventsThe event control to use for simulation step end events
[in]insertionEventsThe event control to use for insertion events
[in]shapeContThe shape container to use
Exceptions
ProcessErrorIf a network was already constructed
See Also
closeBuilding

Definition at line 156 of file MSNet.cpp.

References OptionsCont::getBool(), OptionsCont::getInt(), OptionsCont::getOptions(), OptionsCont::getString(), MSGlobals::gUseMesoSim, myBeginOfTimestepEvents, myDetectorControl, myEdges, myEdgeWeights, myEndOfTimestepEvents, myInserter, myInsertionEvents, myInstance, myJunctions, myLogExecutionTime, myLogics, myLogStepNumber, myPersonControl, myRouteLoaders, myShapeContainer, myStep, myTooManyVehicles, myVehicleControl, and string2time().

MSNet::MSNet ( const MSNet )
private

Invalidated copy constructor.

Member Function Documentation

bool MSNet::addBusStop ( MSBusStop busStop)

Adds a bus stop.

If another bus stop with the same id exists, false is returned. Otherwise, the bus stop is added to the internal bus stop container "myBusStopDict".

This control gets responsible for deletion of the added bus stop.

Parameters
[in]busStopThe bus stop to add
Returns
Whether the bus stop could be added

Definition at line 639 of file MSNet.cpp.

References NamedObjectCont< T >::add(), Named::getID(), and myBusStopDict.

void MSNet::addVehicleStateListener ( VehicleStateListener listener)

Adds a vehicle states listener.

Parameters
[in]listenerThe listener to add

Definition at line 612 of file MSNet.cpp.

References myVehicleStateListeners.

Referenced by MSDevice_Vehroutes::init(), and traci::TraCIServer::TraCIServer().

void MSNet::clearAll ( )
static

Clears all dictionaries.

Todo:
Try to move all this to the destructor

Definition at line 461 of file MSNet.cpp.

References MSRoute::clear(), MSEdge::clear(), MSLane::clear(), and getInstance().

Referenced by GUILoadThread::run(), and ~MSNet().

void MSNet::closeBuilding ( MSEdgeControl edges,
MSJunctionControl junctions,
MSRouteLoaderControl routeLoaders,
MSTLLogicControl tlc,
std::vector< SUMOTime stateDumpTimes,
std::vector< std::string >  stateDumpFiles 
)

Closes the network's building process.

Assigns the structures built while loading to this network.

Parameters
[in]edgesThe control of edges which belong to this network
[in]junctionsThe control of junctions which belong to this network
[in]routeLoadersThe route loaders used
[in]tlcThe control of traffic lights which belong to this network
[in]stateDumpTimesList of time steps at which state shall be written
[in]stateDumpFilesFilenames for states
Todo:
Try to move all this to the constructor?

Definition at line 194 of file MSNet.cpp.

References SysUtils::getCurrentMillis(), myEdges, myJunctions, myLogExecutionTime, myLogics, myRouteLoaders, mySimBeginMillis, myStateDumpFiles, myStateDumpTimes, and MSJunctionControl::postloadInitContainer().

Referenced by NLBuilder::buildNet().

void MSNet::closeSimulation ( SUMOTime  start)
MSEventControl& MSNet::getBeginOfTimestepEvents ( )
inline

Returns the event control for events executed at the begin of a time step.

Returns
The control reponsible for events that are executed at the begin of a time step
See Also
MSEventControl
myBeginOfTimestepEvents

Definition at line 336 of file MSNet.h.

References myBeginOfTimestepEvents.

Referenced by NLTriggerBuilder::buildVaporizer(), MSSimpleTrafficLightLogic::changeStepAndDuration(), MSTLLogicControl::closeWAUT(), MSLaneSpeedTrigger::init(), MSTrafficLightLogic::MSTrafficLightLogic(), and MSDevice_Routing::notifyEnter().

MSBusStop * MSNet::getBusStop ( const std::string &  id) const

Returns the named bus stop.

Parameters
[in]idThe id of the bus stop to return.
Returns
The named bus stop, or 0 if no such stop exists

Definition at line 645 of file MSNet.cpp.

References NamedObjectCont< T >::get(), and myBusStopDict.

Referenced by MSRouteHandler::addStop(), and MSVehicle::addStop().

std::string MSNet::getBusStopID ( const MSLane lane,
const SUMOReal  pos 
) const

Returns the bus stop close to the given position.

Parameters
[in]lanethe lane of the bus stop to return.
[in]posthe position of the bus stop to return.
Returns
The bus stop id on the location, or "" if no such stop exists

Definition at line 651 of file MSNet.cpp.

References MSBusStop::getEndLanePosition(), Named::getID(), MSBusStop::getLane(), NamedObjectCont< T >::getMyMap(), myBusStopDict, and POSITION_EPS.

Referenced by MSVehicle::addTraciStop().

SUMOTime MSNet::getCurrentTimeStep ( ) const

Returns the current simulation step (in s)

Returns
the current simulation step

Definition at line 471 of file MSNet.cpp.

References myStep.

Referenced by MSDevice_Vehroutes::addRoute(), traci::TraCIServer::addSubscription(), MSTLLogicControl::addWAUTJunction(), MSVehicle::checkRewindLinkLanes(), NLJunctionControlBuilder::closeTrafficLightLogic(), MSTLLogicControl::closeWAUT(), MSInductLoop::collectVehiclesOnDet(), traci::TraCIServer::commandAddVehicle(), TraCIServerAPI_Simulation::commandDistanceRequest(), MSVehicle::enterLaneAtLaneChange(), MSVehicle::enterLaneAtMove(), MSPersonControl::erase(), Command_SaveTLCoupledLaneDet::execute(), Command_SaveTLCoupledDet::execute(), MSActuatedTrafficLightLogic::gapControl(), MSInductLoop::getCurrentOccupancy(), GUIApplicationWindow::getCurrentSimTime(), MSLaneSpeedTrigger::getCurrentSpeed(), GUIViewTraffic::getCurrentTimeStep(), MSEventControl::getCurrentTimeStep(), MSLane::getLeaderOnConsecutive(), GUIApplicationWindow::handleEvent_SimulationLoaded(), GUIApplicationWindow::handleEvent_SimulationStep(), MSLaneSpeedTrigger::init(), MSTLLogicControl::initWautSwitch(), MSLane::isInsertionSuccess(), GUIRunThread::makeStep(), MSVehicle::moveChecked(), MSVehicle::moveRegardingCritical(), MSTriggeredXMLReader::MSTriggeredXMLReader(), MSTriggeredXMLReader::myInit(), MSDevice_Vehroutes::notifyEnter(), MSTriggeredRerouter::notifyEnter(), MSDevice_Vehroutes::notifyLeave(), MSDevice_Tripinfo::notifyLeave(), MSBaseVehicle::onDepart(), traci::TraCIServer::postProcessSimulationStep2(), TraCIServerAPI_Lane::processGet(), MSVehicle::processNextStop(), TraCIServerAPI_TLS::processSet(), MSTrafficLightLogic::resetLinkStates(), GUIRunThread::run(), simulate(), MSSimpleTrafficLightLogic::trySwitch(), and MSActuatedTrafficLightLogic::trySwitch().

MSDetectorControl& MSNet::getDetectorControl ( )
inline
MSEdgeControl& MSNet::getEdgeControl ( )
inline
MSEventControl& MSNet::getEndOfTimestepEvents ( )
inline

Returns the event control for events executed at the end of a time step.

Returns
The control reponsible for events that are executed at the end of a time step
See Also
MSEventControl
myEndOfTimestepEvents

Definition at line 346 of file MSNet.h.

References myEndOfTimestepEvents.

Referenced by MSDevice_Routing::buildVehicleDevices(), Command_SaveTLSState::Command_SaveTLSState(), Command_SaveTLSSwitches::Command_SaveTLSSwitches(), Command_SaveTLSSwitchStates::Command_SaveTLSSwitchStates(), and MSVTypeProbe::MSVTypeProbe().

MSInsertionControl& MSNet::getInsertionControl ( )
inline

Returns the insertion control.

Returns
The insertion control
See Also
MSInsertionControl
myInserter

Definition at line 296 of file MSNet.h.

References myInserter.

Referenced by MSRouteHandler::closeFlow(), MSRouteHandler::closeVehicle(), GUINet::getParameterWindow(), MSPerson::MSPersonStage_Driving::proceed(), and TraCIServerAPI_Vehicle::processSet().

MSEventControl& MSNet::getInsertionEvents ( )
inline

Returns the event control for insertion events.

Returns
The control reponsible for insertion events
See Also
MSEventControl
myInsertionEvents

Definition at line 356 of file MSNet.h.

References myInsertionEvents.

Referenced by MSDevice_Routing::MSDevice_Routing(), and MSTriggeredXMLReader::MSTriggeredXMLReader().

MSNet * MSNet::getInstance ( void  )
static

Returns the pointer to the unique instance of MSNet (singleton).

Returns
Pointer to the unique MSNet-instance
Exceptions
ProcessErrorIf a network was not yet constructed

Definition at line 148 of file MSNet.cpp.

References myInstance.

Referenced by MSDevice_Routing::adaptEdgeEfforts(), MSInsertionControl::add(), MSTrafficLightLogic::addLink(), MSTLLogicControl::TLSLogicVariants::addLogic(), MSDevice_Vehroutes::addRoute(), MSRouteHandler::addStop(), MSVehicle::addStop(), traci::TraCIServer::addSubscription(), MSVehicle::addTraciStop(), MSTLLogicControl::addWAUTJunction(), GUITrafficLightLogicWrapper::begin2TrackPhases(), NLTriggerBuilder::buildVaporizer(), GUIVehicleControl::buildVehicle(), MSVehicleControl::buildVehicle(), MSDevice_HBEFA::buildVehicleDevices(), MSDevice_Routing::buildVehicleDevices(), MSSimpleTrafficLightLogic::changeStepAndDuration(), MSInsertionControl::checkFlows(), MSVehicleTransfer::checkInsertions(), MSVehicle::checkRewindLinkLanes(), clearAll(), MSRouteHandler::closeFlow(), MSRouteHandler::closePerson(), MSRouteHandler::closeRoute(), MSRouteHandler::closeVehicle(), MSRouteHandler::closeVehicleTypeDistribution(), MSTLLogicControl::closeWAUT(), MSInductLoop::collectVehiclesOnDet(), Command_SaveTLSState::Command_SaveTLSState(), Command_SaveTLSSwitches::Command_SaveTLSSwitches(), Command_SaveTLSSwitchStates::Command_SaveTLSSwitchStates(), traci::TraCIServer::commandAddVehicle(), TraCIServerAPI_Simulation::commandDistanceRequest(), TraCIServerAPI_Simulation::convertCartesianToRoadMap(), NLDetectorBuilder::createEdgeLaneMeanData(), MSLane::detectCollisions(), traci::TraCIServer::dispatchCommand(), GUITrafficLightLogicWrapper::drawGL(), GUITriggeredRerouter::drawGL(), GUILaneWrapper::drawGL(), MSVehicle::enterLaneAtLaneChange(), MSVehicle::enterLaneAtMove(), MSPersonControl::erase(), Command_SaveTLCoupledLaneDet::execute(), Command_SaveTLCoupledDet::execute(), MSVTypeProbe::execute(), MSActuatedTrafficLightLogic::gapControl(), MSDevice_Vehroutes::generateOutput(), GUILaneWrapper::getColorValue(), MSInductLoop::getCurrentLength(), MSInductLoop::getCurrentOccupancy(), MSInductLoop::getCurrentPassedNumber(), MSLaneSpeedTrigger::getCurrentSpeed(), MSInductLoop::getCurrentSpeed(), GUIViewTraffic::getCurrentTimeStep(), MSEventControl::getCurrentTimeStep(), MSInductLoop::getCurrentVehicleIDs(), TraCIDijkstraRouter< E >::getEffort(), GUINet::getGUIInstance(), MSLane::getLeaderOnConsecutive(), MSTLLogicControl::getPhaseDef(), MSInductLoop::getTimestepsSinceLastDetection(), MSLane::incorporateVehicle(), MSDevice_Vehroutes::init(), MSLaneSpeedTrigger::init(), MSMeanData::init(), MSTLLogicControl::initWautSwitch(), MSLane::isInsertionSuccess(), MSVehicle::moveChecked(), MSLane::moveCritical(), MSVehicle::moveRegardingCritical(), MSDevice_Routing::MSDevice_Routing(), MSInductLoop::MSInductLoop(), MSTrafficLightLogic::MSTrafficLightLogic(), MSTriggeredXMLReader::MSTriggeredXMLReader(), MSVehicle::MSVehicle(), MSVTypeProbe::MSVTypeProbe(), MSRouteHandler::myEndElement(), MSTriggeredXMLReader::myInit(), MSDevice_Vehroutes::notifyEnter(), MSDevice_Person::notifyEnter(), MSTriggeredRerouter::notifyEnter(), MSDevice_Routing::notifyEnter(), MSDevice_Vehroutes::notifyLeave(), MSDevice_Tripinfo::notifyLeave(), MSDevice_Person::notifyLeave(), MSInstantInductLoop::notifyLeave(), MSDevice_Person::notifyMove(), MSInstantInductLoop::notifyMove(), MSE3Collector::MSE3EntryReminder::notifyMove(), MSInductLoop::notifyMove(), MSE3Collector::MSE3LeaveReminder::notifyMove(), GUISUMOViewParent::onCmdLocate(), MSBaseVehicle::onDepart(), GUIViewTraffic::onGamingClick(), MSRouteHandler::openVehicleTypeDistribution(), traci::TraCIServer::postProcessSimulationStep2(), TraCIServerAPI_Edge::processGet(), TraCIServerAPI_MeMeDetector::processGet(), TraCIServerAPI_Junction::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_InductionLoop::processGet(), TraCIServerAPI_POI::processGet(), TraCIServerAPI_Lane::processGet(), TraCIServerAPI_VehicleType::processGet(), TraCIServerAPI_Polygon::processGet(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Simulation::processGet(), MSVehicle::processNextStop(), TraCIServerAPI_Edge::processSet(), TraCIServerAPI_TLS::processSet(), TraCIServerAPI_POI::processSet(), TraCIServerAPI_Polygon::processSet(), TraCIServerAPI_Vehicle::processSet(), TraCIServerAPI_GUI::processSet(), TraCIServerAPI_VehicleType::processSet(), MSVehicle::replaceRoute(), MSTrafficLightLogic::resetLinkStates(), MSVehicleControl::scheduleVehicleRemoval(), MSLane::setCritical(), GUIVehicle::setFunctionalColor(), MSLaneSpeedTrigger::setOverriding(), MSLaneSpeedTrigger::setOverridingValue(), simulationStep(), traci::TraCIServer::TraCIServer(), MSSimpleTrafficLightLogic::trySwitch(), MSActuatedTrafficLightLogic::trySwitch(), MSVehicleControl::vehicleDeparted(), MSVehicle::vsafeCriticalCont(), MSMeanData_HBEFA::MSLaneMeanDataValues::write(), and traci::TraCIServer::~TraCIServer().

MSJunctionControl& MSNet::getJunctionControl ( )
inline

Returns the junctions control.

Returns
The junctions control
See Also
MSJunctionControl
myJunctions

Definition at line 326 of file MSNet.h.

References myJunctions.

Referenced by TraCIServerAPI_Junction::processGet().

MSPersonControl & MSNet::getPersonControl ( )

Returns the person control.

If the person control does not exist, yet, it is created.

Returns
The person control
See Also
MSPersonControl
myPersonControl

Definition at line 563 of file MSNet.cpp.

References myPersonControl.

Referenced by MSRouteHandler::closePerson(), MSPerson::MSPersonStage_Walking::proceed(), MSPerson::MSPersonStage_Driving::proceed(), MSPerson::MSPersonStage_Waiting::proceed(), MSPerson::proceed(), and MSVehicle::processNextStop().

std::string MSNet::getStateMessage ( MSNet::SimulationState  state)
static

Returns the message to show if a certain state occurs.

Returns
Readable description of the state

Definition at line 440 of file MSNet.cpp.

References SIMSTATE_CONNECTION_CLOSED, SIMSTATE_END_STEP_REACHED, SIMSTATE_ERROR_IN_SIM, SIMSTATE_NO_FURTHER_VEHICLES, SIMSTATE_RUNNING, and SIMSTATE_TOO_MANY_VEHICLES.

Referenced by GUIApplicationWindow::handleEvent_SimulationEnded(), GUIRunThread::makeStep(), and simulate().

MSEdgeWeightsStorage & MSNet::getWeightsStorage ( )

Returns the net's internal edge travel times/efforts container.

If the net does not have such a container, it is built.

Returns
The net's knowledge about edge weights

Definition at line 572 of file MSNet.cpp.

References myEdgeWeights.

Referenced by NLBuilder::EdgeFloatTimeLineRetriever_EdgeEffort::addEdgeWeight(), NLBuilder::EdgeFloatTimeLineRetriever_EdgeTravelTime::addEdgeWeight(), GUILaneWrapper::getColorValue(), and TraCIServerAPI_Edge::processSet().

void MSNet::informVehicleStateListener ( const SUMOVehicle *const  vehicle,
VehicleState  to 
)

Informs all added listeners about a vehicle's state change.

Parameters
[in]vehicleThe vehicle which changed its state
[in]toThe state the vehicle has changed to
See Also
VehicleStateListener:vehicleStateChanged

Definition at line 629 of file MSNet.cpp.

References myVehicleStateListeners.

Referenced by GUIVehicleControl::buildVehicle(), MSVehicleControl::buildVehicle(), MSVehicle::replaceRoute(), MSVehicleControl::scheduleVehicleRemoval(), and MSVehicleControl::vehicleDeparted().

bool MSNet::logSimulationDuration ( ) const

Returns whether duration shall be logged.

Returns
Whether duration shall be logged

Definition at line 509 of file MSNet.cpp.

References myLogExecutionTime.

Referenced by GUINet::getParameterWindow().

MSNet& MSNet::operator= ( const MSNet )
private

Invalidated assignment operator.

void MSNet::postSimStepOutput ( ) const

Prints the statistics of the step at its end.

Called on the end of a simulation step

Definition at line 587 of file MSNet.cpp.

References DELTA_T, MSVehicleControl::getDepartedVehicleNo(), MSVehicleControl::getRunningVehicleNo(), myLogExecutionTime, mySimStepDuration, myStep, myVehicleControl, OUTPUT_ACCURACY, SUMOReal, and time2string().

Referenced by simulate().

void MSNet::preSimStepOutput ( ) const

Prints the current step number.

Called on the begin of a simulation step

Definition at line 581 of file MSNet.cpp.

References myStep, and time2string().

Referenced by simulate().

void MSNet::removeVehicleStateListener ( VehicleStateListener listener)

Removes a vehicle states listener.

Parameters
[in]listenerThe listener to remove

Definition at line 620 of file MSNet.cpp.

References myVehicleStateListeners.

Referenced by traci::TraCIServer::~TraCIServer().

int MSNet::simulate ( SUMOTime  start,
SUMOTime  stop 
)

Simulates from timestep start to stop.

Parameters
[in]startThe begin time step of the simulation
[in]stopThe end time step of the simulation
Returns
Returns always 0
Todo:

Recheck return value

What exceptions may occure?

Definition at line 251 of file MSNet.cpp.

References closeSimulation(), getCurrentTimeStep(), OptionsCont::getOptions(), getStateMessage(), myLogStepNumber, myStep, postSimStepOutput(), preSimStepOutput(), SIMSTATE_RUNNING, simulationState(), simulationStep(), time2string(), traci::TraCIServer::wasClosed(), and WRITE_MESSAGE.

Referenced by main().

Field Documentation

MSEventControl* MSNet::myBeginOfTimestepEvents
protected

Controls events executed at the begin of a time step;.

See Also
MSEventControl

Definition at line 592 of file MSNet.h.

Referenced by getBeginOfTimestepEvents(), MSNet(), simulationStep(), and ~MSNet().

NamedObjectCont<MSBusStop*> MSNet::myBusStopDict
protected

Dictionary of bus stops.

Definition at line 641 of file MSNet.h.

Referenced by addBusStop(), getBusStop(), and getBusStopID().

MSDetectorControl* MSNet::myDetectorControl
protected

Controls detectors;.

See Also
MSDetectorControl

Definition at line 590 of file MSNet.h.

Referenced by closeSimulation(), getDetectorControl(), GUINet::initGUIStructures(), MSNet(), writeOutput(), and ~MSNet().

MSEdgeControl* MSNet::myEdges
protected

Controls edges, performs vehicle movement;.

See Also
MSEdgeControl

Definition at line 582 of file MSNet.h.

Referenced by closeBuilding(), getEdgeControl(), MSNet(), simulationStep(), writeOutput(), and ~MSNet().

MSEdgeWeightsStorage* MSNet::myEdgeWeights
protected

The net's knowledge about edge efforts/travel times;.

See Also
MSEdgeWeightsStorage

Definition at line 600 of file MSNet.h.

Referenced by getWeightsStorage(), MSNet(), and ~MSNet().

MSEventControl* MSNet::myEndOfTimestepEvents
protected

Controls events executed at the end of a time step;.

See Also
MSEventControl

Definition at line 594 of file MSNet.h.

Referenced by getEndOfTimestepEvents(), MSNet(), simulationStep(), and ~MSNet().

MSInsertionControl* MSNet::myInserter
protected

Controls vehicle insertion;.

See Also
MSInsertionControl

Definition at line 588 of file MSNet.h.

Referenced by closeSimulation(), getInsertionControl(), MSNet(), simulationState(), simulationStep(), writeOutput(), and ~MSNet().

MSEventControl* MSNet::myInsertionEvents
protected

Controls insertion events;.

See Also
MSEventControl

Definition at line 596 of file MSNet.h.

Referenced by getInsertionEvents(), MSNet(), simulationState(), simulationStep(), and ~MSNet().

MSNet * MSNet::myInstance = 0
staticprotected

Unique instance of MSNet.

Definition at line 564 of file MSNet.h.

Referenced by getInstance(), MSNet(), and ~MSNet().

MSJunctionControl* MSNet::myJunctions
protected

Controls junctions, realizes right-of-way rules;.

See Also
MSJunctionControl

Definition at line 584 of file MSNet.h.

Referenced by closeBuilding(), getJunctionControl(), GUINet::getJunctionPosition(), GUINet::initGUIStructures(), MSNet(), and ~MSNet().

bool MSNet::myLogExecutionTime
protected

Information whether the simulation duration shall be logged.

Definition at line 609 of file MSNet.h.

Referenced by closeBuilding(), closeSimulation(), logSimulationDuration(), MSNet(), postSimStepOutput(), simulationStep(), and writeOutput().

MSTLLogicControl* MSNet::myLogics
protected

Controls tls logics, realizes waiting on tls rules;.

See Also
MSJunctionControl

Definition at line 586 of file MSNet.h.

Referenced by closeBuilding(), GUINet::createTLWrapper(), GUINet::getLinkTLID(), GUINet::getLinkTLIndex(), getTLSControl(), MSNet(), simulationStep(), and ~MSNet().

bool MSNet::myLogStepNumber
protected

Information whether the number of the simulation step shall be logged.

Definition at line 612 of file MSNet.h.

Referenced by MSNet(), and simulate().

MSPersonControl* MSNet::myPersonControl
protected

Controls person building and deletion;.

See Also
MSPersonControl

Definition at line 580 of file MSNet.h.

Referenced by getPersonControl(), MSNet(), simulationState(), simulationStep(), and ~MSNet().

MSRouteLoaderControl* MSNet::myRouteLoaders
protected

Route loader for dynamic loading of routes.

Definition at line 567 of file MSNet.h.

Referenced by closeBuilding(), MSNet(), simulationStep(), and ~MSNet().

ShapeContainer* MSNet::myShapeContainer
protected

A container for geometrical shapes;.

See Also
ShapeContainer

Definition at line 598 of file MSNet.h.

Referenced by getShapeContainer(), MSNet(), and ~MSNet().

long MSNet::mySimBeginMillis
protected

The overall simulation duration.

Definition at line 618 of file MSNet.h.

Referenced by closeBuilding(), and closeSimulation().

long MSNet::mySimStepBegin
protected

The last simulation step begin, end and duration.

Definition at line 615 of file MSNet.h.

Referenced by simulationStep().

long MSNet::mySimStepDuration
protected

Definition at line 615 of file MSNet.h.

Referenced by postSimStepOutput(), simulationStep(), and writeOutput().

long MSNet::mySimStepEnd
protected

Definition at line 615 of file MSNet.h.

Referenced by simulationStep().

std::vector<std::string> MSNet::myStateDumpFiles
protected

The names for the state files.

Definition at line 632 of file MSNet.h.

Referenced by closeBuilding(), and simulationStep().

std::vector<SUMOTime> MSNet::myStateDumpTimes
protected

Times at which a state shall be written.

Definition at line 630 of file MSNet.h.

Referenced by closeBuilding(), and simulationStep().

SUMOTime MSNet::myStep
protected
int MSNet::myTooManyVehicles
protected

Storage for maximum vehicle number.

Definition at line 637 of file MSNet.h.

Referenced by MSNet(), and simulationState().

MSVehicleControl* MSNet::myVehicleControl
protected

Controls vehicle building and deletion;.

See Also
MSVehicleControl

Definition at line 578 of file MSNet.h.

Referenced by closeSimulation(), getVehicleControl(), MSNet(), postSimStepOutput(), simulationState(), simulationStep(), GUINet::vehicleExists(), writeOutput(), and ~MSNet().

long MSNet::myVehiclesMoved
protected

The overall number of vehicle movements.

Definition at line 621 of file MSNet.h.

Referenced by closeSimulation(), GUINet::getMeanUPS(), and simulationStep().

std::vector<VehicleStateListener*> MSNet::myVehicleStateListeners
protected

Container for vehicle state listener.

Definition at line 644 of file MSNet.h.

Referenced by addVehicleStateListener(), informVehicleStateListener(), and removeVehicleStateListener().


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