1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file MSNet.h 11 /// @author Christian Roessel 12 /// @author Jakob Erdmann 13 /// @author Daniel Krajzewicz 14 /// @author Thimor Bohn 15 /// @author Eric Nicolay 16 /// @author Clemens Honomichl 17 /// @author Michael Behrisch 18 /// @author Leonhard Luecken 19 /// @date Mon, 12 Mar 2001 20 /// @version $Id$ 21 /// 22 // The simulated network and simulation performer 23 /****************************************************************************/ 24 #ifndef MSNet_h 25 #define MSNet_h 26 27 28 // =========================================================================== 29 // included modules 30 // =========================================================================== 31 #include <config.h> 32 33 #include <typeinfo> 34 #include <vector> 35 #include <map> 36 #include <string> 37 #include <fstream> 38 #include <iostream> 39 #include <cmath> 40 #include <iomanip> 41 #include <memory> 42 #include <utils/common/SUMOTime.h> 43 #include <utils/common/UtilExceptions.h> 44 #include <utils/common/NamedObjectCont.h> 45 #include <utils/common/NamedRTree.h> 46 #include <utils/router/SUMOAbstractRouter.h> 47 #include <microsim/trigger/MSChargingStation.h> 48 #include "MSJunction.h" 49 50 51 // =========================================================================== 52 // class declarations 53 // =========================================================================== 54 class MSEdge; 55 class MSEdgeControl; 56 class MSEventControl; 57 class MSVehicleControl; 58 class MSJunctionControl; 59 class MSInsertionControl; 60 class SUMORouteLoaderControl; 61 class MSTransportableControl; 62 class MSVehicle; 63 class MSRoute; 64 class MSLane; 65 class MSTLLogicControl; 66 class MSTrafficLightLogic; 67 class MSDetectorControl; 68 class ShapeContainer; 69 class MSDynamicShapeUpdater; 70 class PolygonDynamics; 71 class BinaryInputDevice; 72 class MSEdgeWeightsStorage; 73 class SUMOVehicle; 74 class MSStoppingPlace; 75 template<class E, class L, class N, class V> 76 class IntermodalRouter; 77 template<class E, class L, class N, class V> 78 class PedestrianRouter; 79 80 81 // =========================================================================== 82 // class definitions 83 // =========================================================================== 84 /** 85 * @class MSNet 86 * @brief The simulated network and simulation perfomer 87 */ 88 class MSNet { 89 public: 90 /** @enum SimulationState 91 * @brief Possible states of a simulation - running or stopped with different reasons 92 */ 93 enum SimulationState { 94 /// @brief The simulation is loading 95 SIMSTATE_LOADING, 96 /// @brief The simulation is running 97 SIMSTATE_RUNNING, 98 /// @brief The final simulation step has been performed 99 SIMSTATE_END_STEP_REACHED, 100 /// @brief The simulation does not contain further vehicles 101 SIMSTATE_NO_FURTHER_VEHICLES, 102 /// @brief The connection to a client was closed by the client 103 SIMSTATE_CONNECTION_CLOSED, 104 /// @brief An error occurred during the simulation step 105 SIMSTATE_ERROR_IN_SIM, 106 /// @brief An external interrupt occured 107 SIMSTATE_INTERRUPTED, 108 /// @brief The simulation had too many teleports 109 SIMSTATE_TOO_MANY_TELEPORTS 110 }; 111 112 typedef PedestrianRouter<MSEdge, MSLane, MSJunction, MSVehicle> MSPedestrianRouter; 113 typedef IntermodalRouter<MSEdge, MSLane, MSJunction, SUMOVehicle> MSIntermodalRouter; 114 115 116 public: 117 /** @brief Returns the pointer to the unique instance of MSNet (singleton). 118 * @return Pointer to the unique MSNet-instance 119 * @exception ProcessError If a network was not yet constructed 120 */ 121 static MSNet* getInstance(); 122 123 /** 124 * @brief Returns whether this is a GUI Net 125 */ isGUINet()126 virtual bool isGUINet() const { 127 return false; 128 } 129 130 /// @brief Place for static initializations of simulation components (called after successful net build) 131 static void initStatic(); 132 133 /// @brief Place for static initializations of simulation components (called after successful net build) 134 static void cleanupStatic(); 135 136 137 /** @brief Returns whether the network was already constructed 138 * @return whether the network was already constructed 139 */ hasInstance()140 static bool hasInstance() { 141 return myInstance != nullptr; 142 } 143 144 145 /** @brief Constructor 146 * 147 * This constructor builds a net of which only some basic structures are initialised. 148 * It prepares the network for being filled while loading. 149 * As soon as all edge/junction/traffic lights and other containers are build, they 150 * must be initialised using "closeBuilding". 151 * @param[in] vc The vehicle control to use 152 * @param[in] beginOfTimestepEvents The event control to use for simulation step begin events 153 * @param[in] endOfTimestepEvents The event control to use for simulation step end events 154 * @param[in] insertionEvents The event control to use for insertion events 155 * @param[in] shapeCont The shape container to use 156 * @exception ProcessError If a network was already constructed 157 * @see closeBuilding 158 */ 159 MSNet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents, 160 MSEventControl* endOfTimestepEvents, 161 MSEventControl* insertionEvents, 162 ShapeContainer* shapeCont = 0); 163 164 165 /// @brief Destructor 166 virtual ~MSNet(); 167 168 169 /** @brief Closes the network's building process 170 * 171 * Assigns the structures built while loading to this network. 172 * @param[in] oc The options to use 173 * @param[in] edges The control of edges which belong to this network 174 * @param[in] junctions The control of junctions which belong to this network 175 * @param[in] routeLoaders The route loaders used 176 * @param[in] tlc The control of traffic lights which belong to this network 177 * @param[in] stateDumpTimes List of time steps at which state shall be written 178 * @param[in] stateDumpFiles Filenames for states 179 * @param[in] hasInternalLinks Whether the network actually contains internal links 180 * @param[in] lefthand Whether the network was built for left-hand traffic 181 * @param[in] version The network version 182 * @todo Try to move all this to the constructor? 183 */ 184 void closeBuilding(const OptionsCont& oc, MSEdgeControl* edges, MSJunctionControl* junctions, 185 SUMORouteLoaderControl* routeLoaders, MSTLLogicControl* tlc, 186 std::vector<SUMOTime> stateDumpTimes, std::vector<std::string> stateDumpFiles, 187 bool hasInternalLinks, bool hasNeighs, bool lefthand, 188 double version); 189 190 191 /** @brief Returns whether the network has specific vehicle class permissions 192 * @return whether permissions are present 193 */ hasPermissions()194 bool hasPermissions() const { 195 return myHavePermissions; 196 } 197 198 199 /// @brief Labels the network to contain vehicle class permissions setPermissionsFound()200 void setPermissionsFound() { 201 myHavePermissions = true; 202 } 203 204 205 /** @brief Adds a restriction for an edge type 206 * @param[in] id The id of the type 207 * @param[in] svc The vehicle class the restriction refers to 208 * @param[in] speed The restricted speed 209 */ 210 void addRestriction(const std::string& id, const SUMOVehicleClass svc, const double speed); 211 212 213 /** @brief Returns the restrictions for an edge type 214 * If no restrictions are present, 0 is returned. 215 * @param[in] id The id of the type 216 * @return The mapping of vehicle classes to maximum speeds 217 */ 218 const std::map<SUMOVehicleClass, double>* getRestrictions(const std::string& id) const; 219 220 221 /** @brief Clears all dictionaries 222 * @todo Try to move all this to the destructor 223 */ 224 static void clearAll(); 225 226 227 /** @brief Simulates from timestep start to stop 228 * @param[in] start The begin time step of the simulation 229 * @param[in] stop The end time step of the simulation 230 * @return Returns always 0 231 * @todo Recheck return value 232 * @todo What exceptions may occure? 233 */ 234 SimulationState simulate(SUMOTime start, SUMOTime stop); 235 236 237 /** @brief Performs a single simulation step 238 * @todo Which exceptions may occur? 239 */ 240 void simulationStep(); 241 242 243 /** @brief loads routes for the next few steps */ 244 void loadRoutes(); 245 246 247 /** @brief Writes performance output and running vehicle stats 248 * 249 * @param[in] start The step the simulation was started with 250 */ 251 const std::string generateStatistics(SUMOTime start); 252 253 254 /** @brief Closes the simulation (all files, connections, etc.) 255 * 256 * Writes also performance output 257 * 258 * @param[in] start The step the simulation was started with 259 */ 260 void closeSimulation(SUMOTime start); 261 262 263 /** @brief Called after a simulation step, this method returns the current simulation state 264 * @param[in] stopTime The time the simulation shall stop at 265 * @return The current simulation state 266 * @see SimulationState 267 */ 268 SimulationState simulationState(SUMOTime stopTime) const; 269 270 271 /** @brief Returns the message to show if a certain state occurs 272 * @return Readable description of the state 273 */ 274 static std::string getStateMessage(SimulationState state); 275 276 277 /** @brief Returns the current simulation step 278 * @return the current simulation step 279 */ getCurrentTimeStep()280 inline SUMOTime getCurrentTimeStep() const { 281 return myStep; 282 } 283 284 285 /** @brief Sets the current simulation step (used by state loading) 286 * @param step the current simulation step 287 */ setCurrentTimeStep(const SUMOTime step)288 inline void setCurrentTimeStep(const SUMOTime step) { 289 myStep = step; 290 } 291 292 293 /** @brief Write netstate, summary and detector output 294 * @todo Which exceptions may occur? 295 */ 296 void writeOutput(); 297 298 299 /** @brief Returns whether duration shall be logged 300 * @return Whether duration shall be logged 301 */ 302 bool logSimulationDuration() const; 303 304 305 306 /// @name Output during the simulation 307 //@{ 308 309 /** @brief Prints the current step number 310 * 311 * Called on the begin of a simulation step 312 */ 313 void preSimStepOutput() const; 314 315 316 /** @brief Prints the statistics of the step at its end 317 * 318 * Called on the end of a simulation step 319 */ 320 void postSimStepOutput() const; 321 //} 322 323 324 325 /// @name Retrieval of references to substructures 326 /// @{ 327 328 /** @brief Returns the vehicle control 329 * @return The vehicle control 330 * @see MSVehicleControl 331 * @see myVehicleControl 332 */ getVehicleControl()333 MSVehicleControl& getVehicleControl() { 334 return *myVehicleControl; 335 } 336 337 338 /** @brief Returns the person control 339 * 340 * If the person control does not exist, yet, it is created. 341 * 342 * @return The person control 343 * @see MSPersonControl 344 * @see myPersonControl 345 */ 346 virtual MSTransportableControl& getPersonControl(); 347 348 /** @brief Returns whether persons are simulated 349 */ hasPersons()350 bool hasPersons() const { 351 return myPersonControl != 0; 352 } 353 354 /** @brief Returns the container control 355 * 356 * If the container control does not exist, yet, it is created. 357 * 358 * @return The container control 359 * @see MSContainerControl 360 * @see myContainerControl 361 */ 362 virtual MSTransportableControl& getContainerControl(); 363 364 /** @brief Returns whether containers are simulated 365 */ hasContainers()366 bool hasContainers() const { 367 return myContainerControl != 0; 368 } 369 370 371 /** @brief Returns the edge control 372 * @return The edge control 373 * @see MSEdgeControl 374 * @see myEdges 375 */ getEdgeControl()376 MSEdgeControl& getEdgeControl() { 377 return *myEdges; 378 } 379 380 381 /** @brief Returns the insertion control 382 * @return The insertion control 383 * @see MSInsertionControl 384 * @see myInserter 385 */ getInsertionControl()386 MSInsertionControl& getInsertionControl() { 387 return *myInserter; 388 } 389 390 391 /** @brief Returns the detector control 392 * @return The detector control 393 * @see MSDetectorControl 394 * @see myDetectorControl 395 */ getDetectorControl()396 MSDetectorControl& getDetectorControl() { 397 return *myDetectorControl; 398 } 399 400 401 /** @brief Returns the tls logics control 402 * @return The tls logics control 403 * @see MSTLLogicControl 404 * @see myLogics 405 */ getTLSControl()406 MSTLLogicControl& getTLSControl() { 407 return *myLogics; 408 } 409 410 411 /** @brief Returns the junctions control 412 * @return The junctions control 413 * @see MSJunctionControl 414 * @see myJunctions 415 */ getJunctionControl()416 MSJunctionControl& getJunctionControl() { 417 return *myJunctions; 418 } 419 420 421 /** @brief Returns the event control for events executed at the begin of a time step 422 * @return The control responsible for events that are executed at the begin of a time step 423 * @see MSEventControl 424 * @see myBeginOfTimestepEvents 425 */ getBeginOfTimestepEvents()426 MSEventControl* getBeginOfTimestepEvents() { 427 return myBeginOfTimestepEvents; 428 } 429 430 431 /** @brief Returns the event control for events executed at the end of a time step 432 * @return The control responsible for events that are executed at the end of a time step 433 * @see MSEventControl 434 * @see myEndOfTimestepEvents 435 */ getEndOfTimestepEvents()436 MSEventControl* getEndOfTimestepEvents() { 437 return myEndOfTimestepEvents; 438 } 439 440 441 /** @brief Returns the event control for insertion events 442 * @return The control responsible for insertion events 443 * @see MSEventControl 444 * @see myInsertionEvents 445 */ getInsertionEvents()446 MSEventControl* getInsertionEvents() { 447 return myInsertionEvents; 448 } 449 450 451 /** @brief Returns the shapes container 452 * @return The shapes container 453 * @see ShapeContainer 454 * @see myShapeContainer 455 */ getShapeContainer()456 ShapeContainer& getShapeContainer() { 457 return *myShapeContainer; 458 } 459 460 /** @brief Returns the dynamic shapes updater 461 * @see PolygonDynamics 462 */ getDynamicShapeUpdater()463 MSDynamicShapeUpdater* getDynamicShapeUpdater() { 464 return myDynamicShapeUpdater.get(); 465 } 466 467 /** @brief Creates and returns a dynamic shapes updater 468 * @see PolygonDynamics 469 */ 470 MSDynamicShapeUpdater* makeDynamicShapeUpdater(); 471 472 /** @brief Returns the net's internal edge travel times/efforts container 473 * 474 * If the net does not have such a container, it is built. 475 * @return The net's knowledge about edge weights 476 */ 477 MSEdgeWeightsStorage& getWeightsStorage(); 478 /// @} 479 480 /// @name Insertion and retrieval of stopping places 481 /// @{ 482 483 /** @brief Adds a stopping place 484 * 485 * If another stop with the same id and category exists, false is returned. 486 * Otherwise, the stop is added to the internal stopping place container. 487 * 488 * This control gets responsible for deletion of the added stop. 489 * 490 * @param[in] stop The stop to add 491 * @return Whether the stop could be added 492 */ 493 bool addStoppingPlace(const SumoXMLTag category, MSStoppingPlace* stop); 494 495 496 /** @brief Returns the named stopping place of the given category 497 * @param[in] id The id of the stop to return. 498 * @param[in] category The type of stop 499 * @return The named stop, or 0 if no such stop exists 500 */ 501 MSStoppingPlace* getStoppingPlace(const std::string& id, const SumoXMLTag category) const; 502 503 /** @brief Returns the stop of the given category close to the given position 504 * @param[in] lane the lane of the stop to return. 505 * @param[in] pos the position of the stop to return. 506 * @param[in] category The type of stop 507 * @return The stop id on the location, or "" if no such stop exists 508 */ 509 std::string getStoppingPlaceID(const MSLane* lane, const double pos, const SumoXMLTag category) const; 510 /// @} 511 512 const NamedObjectCont<MSStoppingPlace*>& getStoppingPlaces(SumoXMLTag category) const; 513 514 /// @brief write charging station output 515 void writeChargingStationOutput() const; 516 517 /// @brief creates a wrapper for the given logic (see GUINet) createTLWrapper(MSTrafficLightLogic *)518 virtual void createTLWrapper(MSTrafficLightLogic*) {}; 519 520 /// @brief return wheter the given logic (or rather it's wrapper) is selected in the GUI isSelected(const MSTrafficLightLogic *)521 virtual bool isSelected(const MSTrafficLightLogic*) const { 522 return false; 523 } 524 525 /// @name Notification about vehicle state changes 526 /// @{ 527 528 /// @brief Definition of a vehicle state 529 enum VehicleState { 530 /// @brief The vehicle was built, but has not yet departed 531 VEHICLE_STATE_BUILT, 532 /// @brief The vehicle has departed (was inserted into the network) 533 VEHICLE_STATE_DEPARTED, 534 /// @brief The vehicle started to teleport 535 VEHICLE_STATE_STARTING_TELEPORT, 536 /// @brief The vehicle ended being teleported 537 VEHICLE_STATE_ENDING_TELEPORT, 538 /// @brief The vehicle arrived at his destination (is deleted) 539 VEHICLE_STATE_ARRIVED, 540 /// @brief The vehicle got a new route 541 VEHICLE_STATE_NEWROUTE, 542 /// @brief The vehicles starts to park 543 VEHICLE_STATE_STARTING_PARKING, 544 /// @brief The vehicle ends to park 545 VEHICLE_STATE_ENDING_PARKING, 546 /// @brief The vehicles starts to stop 547 VEHICLE_STATE_STARTING_STOP, 548 /// @brief The vehicle ends to stop 549 VEHICLE_STATE_ENDING_STOP, 550 /// @brief The vehicle is involved in a collision 551 VEHICLE_STATE_COLLISION, 552 /// @brief The vehicle had to brake harder than permitted 553 VEHICLE_STATE_EMERGENCYSTOP 554 }; 555 556 557 /** @class VehicleStateListener 558 * @brief Interface for objects listening to vehicle state changes 559 */ 560 class VehicleStateListener { 561 public: 562 /// @brief Constructor VehicleStateListener()563 VehicleStateListener() { } 564 565 /// @brief Destructor ~VehicleStateListener()566 virtual ~VehicleStateListener() { } 567 568 /** @brief Called if a vehicle changes its state 569 * @param[in] vehicle The vehicle which changed its state 570 * @param[in] to The state the vehicle has changed to 571 * @param[in] info Additional information on the state change 572 */ 573 virtual void vehicleStateChanged(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = "") = 0; 574 575 }; 576 577 578 /** @brief Adds a vehicle states listener 579 * @param[in] listener The listener to add 580 */ 581 void addVehicleStateListener(VehicleStateListener* listener); 582 583 584 /** @brief Removes a vehicle states listener 585 * @param[in] listener The listener to remove 586 */ 587 void removeVehicleStateListener(VehicleStateListener* listener); 588 589 590 /** @brief Informs all added listeners about a vehicle's state change 591 * @param[in] vehicle The vehicle which changed its state 592 * @param[in] to The state the vehicle has changed to 593 * @param[in] info Information regarding the replacement 594 * @see VehicleStateListener:vehicleStateChanged 595 */ 596 void informVehicleStateListener(const SUMOVehicle* const vehicle, VehicleState to, const std::string& info = ""); 597 /// @} 598 599 600 601 /** @brief Returns the travel time to pass an edge 602 * @param[in] e The edge for which the travel time to be passed shall be returned 603 * @param[in] v The vehicle that is rerouted 604 * @param[in] t The time for which the travel time shall be returned [s] 605 * @return The travel time for an edge 606 * @see DijkstraRouter_ByProxi 607 */ 608 static double getTravelTime(const MSEdge* const e, const SUMOVehicle* const v, double t); 609 610 611 /** @brief Returns the effort to pass an edge 612 * @param[in] e The edge for which the effort to be passed shall be returned 613 * @param[in] v The vehicle that is rerouted 614 * @param[in] t The time for which the effort shall be returned [s] 615 * @return The effort (abstract) for an edge 616 * @see DijkstraRouter_ByProxi 617 */ 618 static double getEffort(const MSEdge* const e, const SUMOVehicle* const v, double t); 619 620 621 /* @brief get the router, initialize on first use 622 * @param[in] prohibited The vector of forbidden edges (optional) 623 */ 624 SUMOAbstractRouter<MSEdge, SUMOVehicle>& getRouterTT( 625 const MSEdgeVector& prohibited = MSEdgeVector()) const; 626 SUMOAbstractRouter<MSEdge, SUMOVehicle>& getRouterEffort( 627 const MSEdgeVector& prohibited = MSEdgeVector()) const; 628 MSPedestrianRouter& getPedestrianRouter(const MSEdgeVector& prohibited = MSEdgeVector()) const; 629 MSIntermodalRouter& getIntermodalRouter(const int routingMode = 0, const MSEdgeVector& prohibited = MSEdgeVector()) const; 630 631 static void adaptIntermodalRouter(MSIntermodalRouter& router); 632 633 634 /// @brief return whether the network contains internal links hasInternalLinks()635 bool hasInternalLinks() const { 636 return myHasInternalLinks; 637 } 638 639 /// @brief return whether the network contains elevation data hasElevation()640 bool hasElevation() const { 641 return myHasElevation; 642 } 643 644 /// @brief return whether the network contains walkingareas and crossings hasPedestrianNetwork()645 bool hasPedestrianNetwork() const { 646 return myHasPedestrianNetwork; 647 } 648 649 /// @brief return whether the network was built for lefthand traffic lefthand()650 bool lefthand() const { 651 return myLefthand; 652 } 653 654 /// @brief return the network version getNetworkVersion()655 double getNetworkVersion() const { 656 return myVersion; 657 } 658 659 /// @brief return whether a warning regarding the given object shall be issued 660 bool warnOnce(const std::string& typeAndID); 661 interrupt()662 void interrupt() { 663 myAmInterrupted = true; 664 } 665 isInterrupted()666 bool isInterrupted() const { 667 return myAmInterrupted; 668 } 669 670 protected: 671 /// @brief check all lanes for elevation data 672 bool checkElevation(); 673 674 /// @brief check all lanes for type walkingArea 675 bool checkWalkingarea(); 676 677 protected: 678 /// @brief Unique instance of MSNet 679 static MSNet* myInstance; 680 681 /// @brief Route loader for dynamic loading of routes 682 SUMORouteLoaderControl* myRouteLoaders; 683 684 /// @brief Current time step. 685 SUMOTime myStep; 686 687 /// @brief Maximum number of teleports. 688 int myMaxTeleports; 689 690 /// @brief whether an interrupt occured 691 bool myAmInterrupted; 692 693 694 695 /// @name Substructures 696 /// @{ 697 698 /// @brief Controls vehicle building and deletion; @see MSVehicleControl 699 MSVehicleControl* myVehicleControl; 700 /// @brief Controls person building and deletion; @see MSTransportableControl 701 MSTransportableControl* myPersonControl; 702 /// @brief Controls container building and deletion; @see MSTransportableControl 703 MSTransportableControl* myContainerControl; 704 /// @brief Controls edges, performs vehicle movement; @see MSEdgeControl 705 MSEdgeControl* myEdges; 706 /// @brief Controls junctions, realizes right-of-way rules; @see MSJunctionControl 707 MSJunctionControl* myJunctions; 708 /// @brief Controls tls logics, realizes waiting on tls rules; @see MSJunctionControl 709 MSTLLogicControl* myLogics; 710 /// @brief Controls vehicle insertion; @see MSInsertionControl 711 MSInsertionControl* myInserter; 712 /// @brief Controls detectors; @see MSDetectorControl 713 MSDetectorControl* myDetectorControl; 714 /// @brief Controls events executed at the begin of a time step; @see MSEventControl 715 MSEventControl* myBeginOfTimestepEvents; 716 /// @brief Controls events executed at the end of a time step; @see MSEventControl 717 MSEventControl* myEndOfTimestepEvents; 718 /// @brief Controls insertion events; @see MSEventControl 719 MSEventControl* myInsertionEvents; 720 /// @brief A container for geometrical shapes; @see ShapeContainer 721 ShapeContainer* myShapeContainer; 722 /// @brief The net's knowledge about edge efforts/travel times; @see MSEdgeWeightsStorage 723 MSEdgeWeightsStorage* myEdgeWeights; 724 /// @} 725 726 727 728 /// @name data needed for computing performance values 729 /// @{ 730 731 /// @brief Information whether the simulation duration shall be logged 732 bool myLogExecutionTime; 733 734 /// @brief Information whether the number of the simulation step shall be logged 735 bool myLogStepNumber; 736 737 /// @brief The last simulation step duration 738 long myTraCIStepDuration, mySimStepDuration; 739 740 /// @brief The overall simulation duration 741 long mySimBeginMillis; 742 743 /// @brief The overall number of vehicle movements 744 long long int myVehiclesMoved; 745 //} 746 747 748 749 /// @name State output variables 750 /// @{ 751 752 /// @brief Times at which a state shall be written 753 std::vector<SUMOTime> myStateDumpTimes; 754 /// @brief The names for the state files 755 std::vector<std::string> myStateDumpFiles; 756 /// @brief The period for writing state 757 SUMOTime myStateDumpPeriod; 758 /// @brief name components for periodic state 759 std::string myStateDumpPrefix; 760 std::string myStateDumpSuffix; 761 /// @} 762 763 764 765 /// @brief Whether the network contains edges which not all vehicles may pass 766 bool myHavePermissions; 767 768 /// @brief The vehicle class specific speed restrictions 769 std::map<std::string, std::map<SUMOVehicleClass, double> > myRestrictions; 770 771 /// @brief Whether the network contains internal links/lanes/edges 772 bool myHasInternalLinks; 773 774 /// @brief Whether the network contains elevation data 775 bool myHasElevation; 776 777 /// @brief Whether the network contains pedestrian network elements 778 bool myHasPedestrianNetwork; 779 780 /// @brief Whether the network was built for left-hand traffic 781 bool myLefthand; 782 783 /// @brief the network version 784 double myVersion; 785 786 /// @brief end of loaded edgeData 787 SUMOTime myEdgeDataEndTime; 788 789 /// @brief Dictionary of bus / container stops 790 std::map<SumoXMLTag, NamedObjectCont<MSStoppingPlace*> > myStoppingPlaces; 791 792 /// @brief Container for vehicle state listener 793 std::vector<VehicleStateListener*> myVehicleStateListeners; 794 795 /// @brief container to record warnings that shall only be issued once 796 std::map<std::string, bool> myWarnedOnce; 797 798 /* @brief The router instance for routing by trigger and by traci 799 * @note MSDevice_Routing has its own instance since it uses a different weight function 800 * @note we provide one member for every switchable router type 801 * because the class structure makes it inconvenient to use a superclass*/ 802 mutable SUMOAbstractRouter<MSEdge, SUMOVehicle>* myRouterTT; 803 mutable SUMOAbstractRouter<MSEdge, SUMOVehicle>* myRouterEffort; 804 mutable MSPedestrianRouter* myPedestrianRouter; 805 mutable std::map<int, MSIntermodalRouter*> myIntermodalRouter; 806 807 /// @brief An RTree structure holding lane IDs 808 mutable std::pair<bool, NamedRTree> myLanesRTree; 809 810 /// @brief Updater for dynamic shapes that are tracking traffic objects 811 /// (ensures removal of shape dynamics when the objects are removed) 812 /// @see utils/shapes/PolygonDynamics 813 std::unique_ptr<MSDynamicShapeUpdater> myDynamicShapeUpdater; 814 815 816 /// @brief string constants for simstep stages 817 static const std::string STAGE_EVENTS; 818 static const std::string STAGE_MOVEMENTS; 819 static const std::string STAGE_LANECHANGE; 820 static const std::string STAGE_INSERTIONS; 821 822 private: 823 /// @brief Invalidated copy constructor. 824 MSNet(const MSNet&); 825 826 /// @brief Invalidated assignment operator. 827 MSNet& operator=(const MSNet&); 828 829 830 }; 831 832 833 #endif 834 835 /****************************************************************************/ 836 837