210 myAmInterrupted(false),
213 myHavePermissions(false),
214 myHasInternalLinks(false),
215 myJunctionHigherSpeeds(false),
216 myHasElevation(false),
217 myHasPedestrianNetwork(false),
218 myHasBidiEdges(false),
219 myEdgeDataEndTime(-1),
220 myDynamicShapeUpdater(nullptr) {
260 std::vector<SUMOTime> stateDumpTimes,
261 std::vector<std::string> stateDumpFiles,
262 bool hasInternalLinks,
263 bool junctionHigherSpeeds,
287 throw ProcessError(
TL(
"Option weights.separate-turns is only supported when simulating with internal lanes"));
322 delete router.second;
326 delete router.second;
330 delete router.second;
334 delete router.second;
352const std::map<SUMOVehicleClass, double>*
354 std::map<std::string, std::map<SUMOVehicleClass, double> >::const_iterator i =
myRestrictions.find(
id);
404 bool doStepLog =
false;
416 std::cout <<
SIMTIME <<
" MSNet::simulate(" << start <<
", " << stop <<
")"
445 std::ostringstream msg;
449 msg <<
"Performance:\n" <<
" Duration: " <<
elapsedMs2string(duration) <<
"\n";
454 msg <<
" Real time factor: " << (
STEPS2TIME(
myStep - start) * 1000. / (double)duration) <<
"\n";
455 msg.setf(std::ios::fixed, std::ios::floatfield);
456 msg.setf(std::ios::showpoint);
457 msg <<
" UPS: " << ((double)
myVehiclesMoved / ((
double)duration / 1000)) <<
"\n";
459 msg <<
" UPS-Persons: " << ((double)
myPersonsMoved / ((
double)duration / 1000)) <<
"\n";
472 std::vector<std::string> reasons;
501 std::vector<std::string> reasons;
512 msg <<
"Containers:\n"
519 std::vector<std::string> reasons;
533 std::string result = msg.str();
534 result.erase(result.end() - 1);
543 for (
const auto& c : item.second) {
551 od.
writeAttr(
"colliderType", c.colliderType);
552 od.
writeAttr(
"victimType", c.victimType);
553 od.
writeAttr(
"colliderSpeed", c.colliderSpeed);
554 od.
writeAttr(
"victimSpeed", c.victimSpeed);
570 od.
writeAttr(
"realTimeFactor", duration != 0 ? (
double)(
myStep - start) / (
double)duration : -1);
572 od.
writeAttr(
"personUpdatesPerSecond", duration != 0 ? (
double)
myPersonsMoved / ((double)duration / 1000) : -1);
615 const bool hasOutput = oc.
isSet(
"summary-output");
616 const bool hasPersonOutput = oc.
isSet(
"person-summary-output");
617 if (hasOutput || hasPersonOutput) {
620 if (period > 0 && (
myStep - begin) % period != 0) {
642 od.
writeAttr(
"meanWaitingTime", meanWaitingTime);
643 od.
writeAttr(
"meanTravelTime", meanTravelTime);
645 od.
writeAttr(
"meanSpeed", meanSpeed.first);
646 od.
writeAttr(
"meanSpeedRelative", meanSpeed.second);
652 if (hasPersonOutput) {
722 std::cout <<
SIMTIME <<
": MSNet::simulationStep() called"
723 <<
", myStep = " <<
myStep
727 int lastTraCICmd = 0;
734 bool loadRequested = !TraCI::getLoadArgs().empty();
759 std::replace(timeStamp.begin(), timeStamp.end(),
':',
'-');
774 MSRoutingEngine::waitForAll();
828 MSRoutingEngine::waitForAll();
900 if (stopTime >= 0 &&
myStep >= stopTime) {
940 return TL(
"The final simulation step has been reached.");
942 return TL(
"All vehicles have left the simulation.");
944 return TL(
"TraCI requested termination.");
946 return TL(
"An error occurred (see log).");
948 return TL(
"Interrupted.");
950 return TL(
"Too many teleports.");
952 return TL(
"TraCI issued load command.");
954 return TL(
"Unknown reason.");
1002 for (
MSLane*
const lane : edge->getLanes()) {
1003 lane->getVehiclesSecure();
1005 lane->releaseVehicles();
1029 for (
auto& item2 : item.second) {
1030 item2.second->clearState();
1051 if (oc.
isSet(
"netstate-dump")) {
1053 oc.
getInt(
"netstate-dump.precision"));
1064 oc.
getInt(
"emission-output.precision"));
1070 oc.
getInt(
"battery-output.precision"));
1082 if (oc.
getBool(
"elechybrid-output.aggregated")) {
1085 oc.
getInt(
"elechybrid-output.precision"));
1096 std::string vehID = veh->
getID();
1097 std::string filename2 = output +
"_" + vehID +
".xml";
1099 std::map<SumoXMLAttr, std::string> attrs;
1132 timestep = timestep.substr(0, timestep.length() - 3);
1134 std::string filename = output +
"_" + timestep +
".vtp";
1156 for (
const MSLane*
const lane : edge->getLanes()) {
1157 for (
const MSLink*
const link : lane->getLinkCont()) {
1158 link->writeApproaching(od, lane->getID());
1167 dev->updateAndWriteOutput();
1172 if (dev->generatesOutput()) {
1230 std::ostringstream oss;
1231 oss.setf(std::ios::fixed, std::ios::floatfield);
1232 oss.setf(std::ios::showpoint);
1237 << (
TS / durationSec) <<
"*RT, ~"
1240 oss <<
" (0ms ?*RT. ?";
1251 std::cout << oss.str().substr(0, 90 - prev.length());
1280 listener->vehicleStateChanged(vehicle, to, info);
1308 listener->transportableStateChanged(transportable, to, info);
1318 if (old.victim == victim->
getID()) {
1320 old.colliderSpeed = collider->
getSpeed();
1321 old.victimSpeed = victim->
getSpeed();
1322 old.type = collisionType;
1336 c.
type = collisionType;
1348 for (
auto it2 = it->second.begin(); it2 != it->second.end();) {
1349 if (it2->time !=
myStep) {
1350 it2 = it->second.erase(it2);
1355 if (it->second.size() == 0) {
1393 if (result !=
nullptr) {
1407 return stop->
getID();
1443 if (rs !=
nullptr) {
1453 if (rs !=
nullptr) {
1479 it->writeTractionSubstationOutput(output);
1488 if ((*it)->getID() == substationId) {
1499 if ((*it)->getID() == substationId) {
1511 if (routingAlgorithm ==
"dijkstra") {
1514 if (routingAlgorithm !=
"astar") {
1515 WRITE_WARNINGF(
TL(
"TraCI and Triggers cannot use routing algorithm '%'. using 'astar' instead."), routingAlgorithm);
1548 const int key = rngIndex * oc.
getInt(
"thread-rngs") + routingMode;
1572 for (
const auto& i : stopType.second) {
1573 const MSEdge*
const edge = &i.second->getLane().getEdge();
1574 router.
getNetwork()->
addAccess(i.first, edge, i.second->getBeginLanePosition(), i.second->getEndLanePosition(),
1575 0., element,
false, taxiWait);
1578 for (
const auto& a : i.second->getAllAccessPos()) {
1579 router.
getNetwork()->
addAccess(i.first, &a.lane->getEdge(), a.startPos, a.endPos, a.length, element,
true, taxiWait);
1581 if (external !=
nullptr) {
1603 for (MSEdgeVector::const_iterator e = edges.begin(); e != edges.end(); ++e) {
1604 for (std::vector<MSLane*>::const_iterator i = (*e)->getLanes().begin(); i != (*e)->getLanes().end(); ++i) {
1605 if ((*i)->getShape().hasElevation()) {
1628 if (e->getBidiEdge() !=
nullptr) {
1648 if (loader !=
nullptr) {
1649 return dynamic_cast<MSMapMatcher*
>(loader->getRouteHandler());
@ TAXI_PICKUP_ANYWHERE
taxi customer may be picked up anywhere
std::vector< MSEdge * > MSEdgeVector
IntermodalRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSTransportableRouter
PedestrianRouter< MSEdge, MSLane, MSJunction, SUMOVehicle > MSPedestrianRouter
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGEF(...)
#define WRITE_MESSAGE(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
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
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_CONTAINER_STOP
A container stop.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_PARKING_AREA
A parking area.
@ 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::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
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.
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.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
int getRoutingMode() const
return routing mode (configures router choice but also handling of transient permission changes)
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
static void write(OutputDevice &of, bool end=false)
Writes the recently completed charging events.
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 writePendingOutput(const bool includeUnfinished)
generate vehroute output for pending vehicles at sim end, either due to sorting or because they are s...
static void cleanupAll()
perform cleanup for all devices
static void writeDepatureBlocks(OutputDevice &od, bool writeVehicles)
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.
void adaptIntermodalRouter(MSTransportableRouter &router) const
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
int emitVehicles(SUMOTime time)
Emits vehicles that want to depart at the given time.
bool hasFlow(const std::string &id) const
checks whether the given flow still exists
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 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.
MSMapMatcher * getMapMatcher() const
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.
int myLogStepPeriod
Period between successive step-log outputs.
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).
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;.
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;.
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.
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.
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.
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
long long int myPersonsMoved
void quickReload()
reset state to the beginning without reloading the network
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
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 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.
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.
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 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.
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::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.
long myTraCIStepDuration
The last simulation step duration.
TransportableState
Definition of a transportable state.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSDetectorControl * myDetectorControl
Controls detectors;.
bool myStepCompletionMissing
whether libsumo triggered a partial step (executeMove)
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.
MSVehicleRouter & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
std::map< std::string, MESegment::MesoEdgeType > myMesoEdgeTypes
The edge type specific meso parameters.
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.
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.
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
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 bool hasInstance()
static MSRailSignalControl & getInstance()
void updateSignals(SUMOTime t)
update active rail signals
static void clearState()
Perform resets events when quick-loading state.
void resetWaitRelations()
reset all waiting-for relationships at the start of the simulation step
void writeBlocks(OutputDevice &od, bool writeVehicles) const
write rail signal block output for all links and driveways
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.
double getEndLanePosition() const
Returns the end 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 substation 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 getTeleportCount() const
Returns the number of teleports transportables did.
int getLoadedNumber() const
Returns the number of build transportables.
int getWaitingUntilNumber() const
Returns the number of transportables waiting for a specified amount of time.
int getTeleportsWrongDest() const
return the number of teleports of transportables riding to the wrong destination
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 getTeleportsAbortWait() const
return the number of teleports due to excessive waiting for a ride
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 cleanup()
Static cleanup.
The class responsible for building and deletion of vehicles.
void adaptIntermodalRouter(MSTransportableRouter &router) const
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.
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 getEmergencyBrakingCount() const
return the number of emergency stops
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.
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 map of named object pointers.
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)
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.
SUMORouteLoader * getFirstLoader() const
return a route loader
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 MSDevice * getDevice(const std::type_info &type) const =0
Returns a device of the given type if it exists or nullptr if not.
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)
static int parseCarWalkTransfer(const OptionsCont &oc, const bool hasTaxi=false)
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
int processCommands(const SUMOTime step, const bool afterMove=false)
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, const bool isExternal=false, const bool catchExceptions=true)
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 CMD_EXECUTEMOVE
TRACI_CONST int ROUTING_MODE_AGGREGATED_CUSTOM
TRACI_CONST int ROUTING_MODE_COMBINED
edge type specific meso parameters