187 throw ProcessError(
"A network was not yet constructed.");
209 myAmInterrupted(false),
212 myHavePermissions(false),
213 myHasInternalLinks(false),
214 myJunctionHigherSpeeds(false),
215 myHasElevation(false),
216 myHasPedestrianNetwork(false),
217 myHasBidiEdges(false),
218 myEdgeDataEndTime(-1),
219 myDynamicShapeUpdater(nullptr) {
221 throw ProcessError(
"A network was already constructed.");
259 std::vector<SUMOTime> stateDumpTimes,
260 std::vector<std::string> stateDumpFiles,
261 bool hasInternalLinks,
262 bool junctionHigherSpeeds,
286 throw ProcessError(
"Option weights.separate-turns is only supported when simulating with internal lanes");
318 delete router.second;
322 delete router.second;
326 delete router.second;
330 delete router.second;
348const std::map<SUMOVehicleClass, double>*
350 std::map<std::string, std::map<SUMOVehicleClass, double> >::const_iterator i =
myRestrictions.find(
id);
392 bool doStepLog =
false;
404 std::cout <<
SIMTIME <<
" MSNet::simulate(" << start <<
", " << stop <<
")"
433 std::ostringstream msg;
437 msg <<
"Performance: " <<
"\n" <<
" Duration: " <<
elapsedMs2string(duration) <<
"\n";
442 msg <<
" Real time factor: " << (
STEPS2TIME(
myStep - start) * 1000. / (double)duration) <<
"\n";
443 msg.setf(std::ios::fixed, std::ios::floatfield);
444 msg.setf(std::ios::showpoint);
445 msg <<
" UPS: " << ((double)
myVehiclesMoved / ((
double)duration / 1000)) <<
"\n";
447 msg <<
" UPS-Persons: " << ((double)
myPersonsMoved / ((
double)duration / 1000)) <<
"\n";
453 msg <<
"Vehicles: " <<
"\n"
460 std::vector<std::string> reasons;
479 msg <<
"Persons: " <<
"\n"
487 msg <<
"Containers: " <<
"\n"
505 for (
const auto& c : item.second) {
513 od.
writeAttr(
"colliderType", c.colliderType);
514 od.
writeAttr(
"victimType", c.victimType);
515 od.
writeAttr(
"colliderSpeed", c.colliderSpeed);
516 od.
writeAttr(
"victimSpeed", c.victimSpeed);
558 const bool hasOutput = oc.
isSet(
"summary-output");
559 const bool hasPersonOutput = oc.
isSet(
"person-summary-output");
560 if (hasOutput || hasPersonOutput) {
563 if (period > 0 && (
myStep - begin) % period != 0) {
585 od.
writeAttr(
"meanWaitingTime", meanWaitingTime);
586 od.
writeAttr(
"meanTravelTime", meanTravelTime);
588 od.
writeAttr(
"meanSpeed", meanSpeed.first);
589 od.
writeAttr(
"meanSpeedRelative", meanSpeed.second);
595 if (hasPersonOutput) {
658 std::cout <<
SIMTIME <<
": MSNet::simulationStep() called"
659 <<
", myStep = " <<
myStep
669 bool loadRequested = !TraCI::getLoadArgs().empty();
694 std::replace(timeStamp.begin(), timeStamp.end(),
':',
'-');
707 MSRoutingEngine::waitForAll();
756 MSRoutingEngine::waitForAll();
815 if (stopTime >= 0 &&
myStep >= stopTime) {
855 return "The final simulation step has been reached.";
857 return "All vehicles have left the simulation.";
859 return "TraCI requested termination.";
861 return "An error occurred (see log).";
863 return "Interrupted.";
865 return "Too many teleports.";
867 return "TraCI issued load command.";
869 return "Unknown reason.";
916 for (
MSLane*
const lane : edge->getLanes()) {
917 lane->getVehiclesSecure();
919 lane->releaseVehicles();
941 for (
auto& item2 : item.second) {
942 item2.second->clearState();
962 if (oc.
isSet(
"netstate-dump")) {
964 oc.
getInt(
"netstate-dump.precision"));
975 oc.
getInt(
"emission-output.precision"));
981 oc.
getInt(
"battery-output.precision"));
988 if (oc.
getBool(
"elechybrid-output.aggregated")) {
991 oc.
getInt(
"elechybrid-output.precision"));
1002 std::string vehID = veh->
getID();
1003 std::string filename2 = output +
"_" + vehID +
".xml";
1005 std::map<SumoXMLAttr, std::string> attrs;
1038 timestep = timestep.substr(0, timestep.length() - 3);
1040 std::string filename = output +
"_" + timestep +
".vtp";
1062 for (
const MSLane*
const lane : edge->getLanes()) {
1063 for (
const MSLink*
const link : lane->getLinkCont()) {
1064 link->writeApproaching(od, lane->getID());
1073 dev->updateAndWriteOutput();
1078 if (dev->generatesOutput()) {
1136 std::ostringstream oss;
1137 oss.setf(std::ios::fixed, std::ios::floatfield);
1138 oss.setf(std::ios::showpoint);
1143 << (
TS / durationSec) <<
"*RT, ~"
1146 oss <<
" (0ms ?*RT. ?";
1157 std::cout << oss.str().substr(0, 90 - prev.length());
1186 listener->vehicleStateChanged(vehicle, to, info);
1214 listener->transportableStateChanged(transportable, to, info);
1228 old.
type = collisionType;
1242 c.
type = collisionType;
1254 for (
auto it2 = it->second.begin(); it2 != it->second.end();) {
1255 if (it2->time !=
myStep) {
1256 it2 = it->second.erase(it2);
1261 if (it->second.size() == 0) {
1300 if (&stop->
getLane() == lane && stop->
getBeginLanePosition() - POSITION_EPS <= pos && stop->getEndLanePosition() + POSITION_EPS >= pos) {
1301 return stop->
getID();
1336 if (rs !=
nullptr) {
1360 it->writeTractionSubstationOutput(output);
1369 if ((*it)->getID() == substationId) {
1380 if ((*it)->getID() == substationId) {
1392 if (routingAlgorithm ==
"dijkstra") {
1395 if (routingAlgorithm !=
"astar") {
1396 WRITE_WARNING(
"TraCI and Triggers cannot use routing algorithm '" + routingAlgorithm +
"'. using 'astar' instead.");
1429 const int key = rngIndex * oc.
getInt(
"thread-rngs") + routingMode;
1432 for (
const std::string& opt : oc.
getStringVector(
"persontrip.transfer.car-walk")) {
1433 if (opt ==
"parkingAreas") {
1435 }
else if (opt ==
"ptStops") {
1437 }
else if (opt ==
"allJunctions") {
1442 const std::string& taxiDropoff = oc.
getValueString(
"persontrip.transfer.taxi-walk");
1443 const std::string& taxiPickup = oc.
getValueString(
"persontrip.transfer.walk-taxi");
1444 if (taxiDropoff ==
"") {
1448 }
else if (taxiDropoff ==
"ptStops") {
1450 }
else if (taxiDropoff ==
"allJunctions") {
1453 if (taxiPickup ==
"") {
1457 }
else if (taxiPickup ==
"ptStops") {
1459 }
else if (taxiPickup ==
"allJunctions") {
1483 for (
const auto& i : stopType.second) {
1484 const MSEdge*
const edge = &i.second->getLane().getEdge();
1485 router.
getNetwork()->
addAccess(i.first, edge, i.second->getBeginLanePosition(), i.second->getEndLanePosition(),
1486 i.second->getAccessDistance(edge), element,
false, taxiWait);
1489 for (
const auto& a : i.second->getAllAccessPos()) {
1490 router.
getNetwork()->
addAccess(i.first, &std::get<0>(a)->getEdge(), std::get<1>(a), std::get<1>(a), std::get<2>(a), element,
true, taxiWait);
1492 if (external !=
nullptr) {
1514 for (MSEdgeVector::const_iterator e = edges.begin(); e != edges.end(); ++e) {
1515 for (std::vector<MSLane*>::const_iterator i = (*e)->getLanes().begin(); i != (*e)->getLanes().end(); ++i) {
1516 if ((*i)->getShape().hasElevation()) {
1539 if (e->getBidiEdge() !=
nullptr) {
1585 throw ProcessError(
"Loading state from '" + fileName +
"' failed.");
std::vector< MSEdge * > MSEdgeVector
#define WRITE_MESSAGEF(...)
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(msg)
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
#define PROGRESS_TIME_MESSAGE(before)
std::string elapsedMs2string(long long int t)
convert ms to string for log output
std::string time2string(SUMOTime t)
convert SUMOTime to string
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_TAXI
vehicle is a taxi
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_OVERHEAD_WIRE_SEGMENT
An overhead wire segment.
@ SUMO_ATTR_MAXIMUMBATTERYCAPACITY
Maxium battery capacity.
@ SUMO_ATTR_RECUPERATIONENABLE
int gPrecision
the precision for floating point outputs
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Computes the shortest path through a network using the A* algorithm.
Computes the shortest path through a network using the Dijkstra algorithm.
the effort calculator interface
virtual void addStop(const int stopEdge, const Parameterised ¶ms)=0
int getNumericalID() const
void addCarAccess(const E *edge, SUMOVehicleClass svc, double traveltime)
Adds access edges for transfering from walking to vehicle use.
void addAccess(const std::string &stopId, const E *stopEdge, const double startPos, const double endPos, const double length, const SumoXMLTag category, bool isAccess, double taxiWait)
Adds access edges for stopping places to the intermodal network.
_IntermodalEdge * getStopEdge(const std::string &stopId) const
Returns the associated stop edge.
@ TAXI_PICKUP_ANYWHERE
taxi customer may be picked up anywhere
@ TAXI_DROPOFF_ANYWHERE
taxi customer may exit anywhere
@ PARKING_AREAS
parking areas
@ ALL_JUNCTIONS
junctions with edges allowing the additional mode
@ TAXI_PICKUP_PT
taxi customer may be picked up at public transport stop
@ PT_STOPS
public transport stops and access
@ TAXI_DROPOFF_PT
taxi customer may be picked up at public transport stop
EffortCalculator * getExternalEffort() const
Network * getNetwork() const
int getCarWalkTransfer() const
The main mesocopic simulation loop.
void simulate(SUMOTime tMax)
Perform simulation up to the given time.
void clearState()
Remove all vehicles before quick-loading state.
A single mesoscopic segment (cell)
static void write(OutputDevice &of, const SUMOTime timestep)
Writes the complete network state into the given device.
int getRoutingMode() const
return the current routing mode
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
static void write(OutputDevice &of, SUMOTime timestep, int precision)
Writes the complete network state of the given edges into the given device.
static void cleanup()
cleanup remaining data structures
Detectors container; responsible for string and output generation.
void writeOutput(SUMOTime step, bool closing)
Writes the output to be generated within the given time step.
void clearState(SUMOTime step)
Remove all vehicles before quick-loading state.
void updateDetectors(const SUMOTime step)
Computes detector values.
void close(SUMOTime step)
Closes the detector outputs.
static void cleanup()
removes remaining vehicleInformation in sVehicles
A device which collects info on the vehicle trip (mainly on departure and arrival)
double getMaximumBatteryCapacity() const
Get the total vehicle's Battery Capacity in kWh.
A device which collects info on the vehicle trip (mainly on departure and arrival)
static const std::set< MSDevice_SSM *, ComparatorNumericalIdLess > & getInstances()
returns all currently existing SSM devices
static void cleanup()
Clean up remaining devices instances.
static bool hasServableReservations()
check whether there are still (servable) reservations in the system
static SUMOVehicle * getTaxi()
returns a taxi if any exist or nullptr
The ToC Device controls transition of control between automated and manual driving.
static void cleanup()
Closes root tags of output files.
static const std::set< MSDevice_ToC *, ComparatorNumericalIdLess > & getInstances()
returns all currently existing ToC devices
static void writeStatistics(OutputDevice &od)
write statistic output to (xml) file
static std::string printStatistics()
get statistics for printing to stdout
static void generateOutputForUnfinished()
generate output for vehicles which are still in the network
static void generateOutputForUnfinished()
generate vehroute output for vehicles which are still in the network
static void cleanupAll()
perform cleanup for all devices
Stores edges and lanes, performs moving of vehicle.
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
void detectCollisions(SUMOTime timestep, const std::string &stage)
Detect collisions.
void setJunctionApproaches(SUMOTime t)
Register junction approaches for all vehicles after velocities have been planned. This is a prerequis...
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
const MSEdgeVector & getEdges() const
Returns loaded edges.
void planMovements(SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step....
void changeLanes(const SUMOTime t)
Moves (precomputes) critical vehicles.
A road/street connecting two junctions.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
static void clear()
Clears the dictionary.
double getMinimumTravelTime(const SUMOVehicle *const veh) const
returns the minimum travel time for the given vehicle
A storage for edge travel times and efforts.
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
static void writeAggregated(OutputDevice &of, SUMOTime timestep, int precision)
static void write(OutputDevice &of, const SUMOVehicle *veh, SUMOTime timestep, int precision)
Writes the complete network state of the given edges into the given device.
static void write(OutputDevice &of, SUMOTime timestep, int precision)
Writes the complete network state of the given edges into the given device.
Stores time-dependant events and executes them at the proper time.
virtual void execute(SUMOTime time)
Executes time-dependant commands.
void clearState(SUMOTime currentTime, SUMOTime newTime)
Remove all events before quick-loading state.
static void write(OutputDevice &of, SUMOTime timestep, bool elevation)
Writes the position and the angle of each vehicle into the given device.
static void write(OutputDevice &of, SUMOTime timestep)
Dumping a hugh List of Parameters available in the Simulation.
static double gWeightsSeparateTurns
Whether turning specific weights are estimated (and how much)
static bool gOverheadWireRecuperation
static MELoop * gMesoNet
mesoscopic simulation infrastructure
static bool gStateLoaded
Information whether a state has been loaded.
static bool gCheck4Accidents
static bool gClearState
whether the simulation is in the process of clearing state (MSNet::clearState)
static bool gHaveEmissions
Whether emission output of some type is needed (files or GUI)
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
static int gNumThreads
how many threads to use
Inserts vehicles into the network when their departure time is reached.
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
int emitVehicles(SUMOTime time)
Emits vehicles that want to depart at the given time.
void determineCandidates(SUMOTime time)
Checks for all vehicles whether they can be emitted.
int getPendingFlowCount() const
Returns the number of flows that are still active.
void adaptIntermodalRouter(MSNet::MSIntermodalRouter &router) const
void clearState()
Remove all vehicles before quick-loading state.
Container for junctions; performs operations on all stored junctions.
Representation of a lane in the micro simulation.
static void clear()
Clears the dictionary.
static const std::map< std::string, MSLaneSpeedTrigger * > & getInstances()
return all MSLaneSpeedTrigger instances
Interface for objects listening to transportable state changes.
Interface for objects listening to vehicle state changes.
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
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.
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
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.
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).
bool myHasBidiEdges
Whether the network contains bidirectional rail edges.
MSEventControl * myBeginOfTimestepEvents
Controls 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;.
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;.
double myVersion
the network version
std::string myStateDumpSuffix
bool checkElevation()
check all lanes for elevation data
bool existTractionSubstation(const std::string &substationId)
return whether given electrical substation exists in the network
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.
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.
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, double version)
Closes the network's building process.
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.
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.
void writeSubstationOutput() const
write electrical substation output
static const std::string STAGE_INSERTIONS
SUMOTime loadState(const std::string &fileName)
load state from file and return new time
long long int myPersonsMoved
void quickReload()
reset state to the beginning without reloading the network
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
static void clearAll()
Clears all dictionaries.
static void cleanupStatic()
Place for static initializations of simulation components (called after successful net build)
IntermodalRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSIntermodalRouter
void writeSummaryOutput()
write summary-output to (xml) file
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.
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.
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;.
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
bool myAmInterrupted
whether an interrupt occured
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.
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
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
bool logSimulationDuration() const
Returns whether duration shall be logged.
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.
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.
long myTraCIStepDuration
The last simulation step duration.
TransportableState
Definition of a transportable state.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSDetectorControl * myDetectorControl
Controls detectors;.
static const std::string STAGE_LANECHANGE
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.
std::map< int, SUMOAbstractRouter< MSEdge, SUMOVehicle > * > myRouterTT
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
static void adaptIntermodalRouter(MSIntermodalRouter &router)
MSEdgeWeightsStorage * myEdgeWeights
The net's knowledge about edge efforts/travel times;.
MSDynamicShapeUpdater * makeDynamicShapeUpdater()
Creates and returns a dynamic shapes updater.
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.
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.
bool myHasPedestrianNetwork
Whether the network contains pedestrian network elements.
const MESegment::MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
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
CollisionMap myCollisions
collisions in the current time step
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
SimulationState simulate(SUMOTime start, SUMOTime stop)
Simulates from timestep start to stop.
Definition of overhead wire segment.
static void write(OutputDevice &of, SUMOTime timestep)
Export the queueing length in front of a junction (very experimental!)
static void cleanup()
clean up state
static void clearState()
Perform resets events when quick-loading state.
void writeBlocks(OutputDevice &od) const
write rail signal block output for all links and driveways
static void recheckGreen()
final check for driveway compatibility of signals that switched green in this step
Parser and container for routes during their loading.
static void dict_clearState()
Decrement all route references before quick-loading state.
static void clear()
Clears the dictionary (delete all known routes, too)
static double getEffortExtra(const MSEdge *const e, const SUMOVehicle *const v, double t)
static SUMOTime getTime(const std::string &fileName)
parse time from state file
Parser and output filter for routes and vehicles state saving and loading.
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
void generateOutputForUnfinished()
generate output for vehicles which are still stopped at simulation end
static MSStopOut * getInstance()
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
A class that stores and controls tls and switching of their programs.
void clearState(SUMOTime time, bool quickReload=false)
Clear all tls states before quick-loading state.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
void check2Switch(SUMOTime step)
Checks whether any WAUT is trying to switch a tls into another program.
Traction substaction powering one or more overhead wire sections.
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
int getDepartedNumber() const
bool hasTransportables() const
checks whether any transportable waits to finish her plan
int getWaitingForVehicleNumber() const
Returns the number of transportables waiting for a ride.
int getEndedNumber() const
Returns the number of transportables that exited the simulation.
void checkWaiting(MSNet *net, const SUMOTime time)
checks whether any transportables waiting time is over
int getArrivedNumber() const
Returns the number of transportables that arrived at their destination.
int getLoadedNumber() const
Returns the number of build transportables.
int getWaitingUntilNumber() const
Returns the number of transportables waiting for a specified amount of time.
void abortAnyWaitingForVehicle()
aborts the plan for any transportable that is still waiting for a ride
bool hasNonWaiting() const
checks whether any transportable is still engaged in walking / stopping
int getMovingNumber() const
Returns the number of transportables moving by themselvs (i.e. walking)
int getJammedNumber() const
Returns the number of times a transportables was jammed.
void clearState()
Resets transportables when quick-loading state.
int getRidingNumber() const
Returns the number of transportables riding a vehicle.
static const std::map< std::string, MSTriggeredRerouter * > & getInstances()
return all rerouter instances
static void write(OutputDevice &of, SUMOTime timestep)
Produce a VTK output to use with Tools like ParaView.
static void init()
Static initalization.
static void cleanup()
Static cleanup.
The class responsible for building and deletion of vehicles.
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
void removePending()
Removes a vehicle after it has ended.
double getTotalTravelTime() const
Returns the total travel time.
void adaptIntermodalRouter(MSNet::MSIntermodalRouter &router) const
int getLoadedVehicleNo() const
Returns the number of build vehicles.
int getCollisionCount() const
return the number of collisions
int getTeleportsWrongLane() const
return the number of teleports due to vehicles stuck on the wrong lane
int getStoppedVehiclesCount() const
return the number of vehicles that are currently stopped
int getTeleportsYield() const
return the number of teleports due to vehicles stuck on a minor road
void clearState(const bool reinit)
Remove all vehicles before quick-loading state.
int getEmergencyStops() const
return the number of emergency stops
double getTotalDepartureDelay() const
Returns the total departure delay.
virtual std::pair< double, double > getVehicleMeanSpeeds() const
get current absolute and relative mean vehicle speed in the network
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
int getArrivedVehicleNo() const
Returns the number of arrived vehicles.
int getActiveVehicleCount() const
Returns the number of build vehicles that have not been removed or need to wait for a passenger or a ...
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
int getTeleportsJam() const
return the number of teleports due to jamming
int getEndedVehicleNo() const
Returns the number of removed vehicles.
virtual int getHaltingVehicleNo() const
Returns the number of halting vehicles.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
int getTeleportCount() const
return the number of teleports (including collisions)
void abortWaiting()
informes about all waiting vehicles (deletion in destructor)
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Representation of a vehicle in the micro simulation.
BaseInfluencer & getBaseInfluencer()
Returns the velocity/lane influencer.
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void checkInsertions(SUMOTime time)
Checks "movement" of stored vehicles.
void clearState()
Remove all vehicles before quick-loading state.
const std::string & getID() const
Returns the name of the vehicle type.
static void write(OutputDevice &of, const MSEdgeControl &ec, SUMOTime timestep, int precision)
Writes the complete network state of the given edges into the given device.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static SUMORouteLoaderControl * buildRouteLoaderControl(const OptionsCont &oc)
Builds the route loader control.
static void initRandomness()
initializes all RNGs
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
std::string getValueString(const std::string &name) const
Returns the string-value of the named option (all options)
static OptionsCont & getOptions()
Retrieves the options.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
An output device that encapsulates an ofstream.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
static void closeAll(bool keepErrorRetrievers=false)
static OutputDevice & getDevice(const std::string &name, bool usePrefix=true)
Returns the described OutputDevice.
bool writeXMLHeader(const std::string &rootElement, const std::string &schemaFile, std::map< SumoXMLAttr, std::string > attrs=std::map< SumoXMLAttr, std::string >(), bool includeConfig=true)
Writes an XML header with optional configuration.
void loadNext(SUMOTime step)
loads the next routes up to and including the given time step
Representation of a vehicle, person, or container.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual double getSpeed() const =0
Returns the object's current speed.
Representation of a vehicle.
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
virtual MSVehicleDevice * getDevice(const std::type_info &type) const =0
Returns a device of the given type if it exists or 0.
A scoped lock which only triggers on condition.
Storage for geometrical objects.
void clearState()
Remove all dynamics before quick-loading state.
static long getCurrentMillis()
Returns the current time in milliseconds.
TraCI server used to control sumo by a remote TraCI client.
static bool wasClosed()
check whether close was requested
SUMOTime getTargetTime() const
static TraCIServer * getInstance()
std::vector< std::string > & getLoadArgs()
void cleanup()
clean up subscriptions
void processCommandsUntilSimStep(SUMOTime step)
process all commands until the next SUMO simulation step. It is guaranteed that t->getTargetTime() >=...
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false)
Runs the given handler on the given file; returns if everything's ok.
static int postProcessRemoteControl()
return number of remote-controlled entities
TRACI_CONST int ROUTING_MODE_AGGREGATED_CUSTOM
TRACI_CONST int ROUTING_MODE_COMBINED
edge type specific meso parameters