SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MSTriggeredRerouter.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Reroutes vehicles passing an edge
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef MSTriggeredRerouter_h
23 #define MSTriggeredRerouter_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
36 #include <vector>
37 #include <utils/common/Command.h>
39 #include "MSTrigger.h"
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
47 class MSNet;
48 class MSLane;
49 class MSRoute;
50 class SUMOVehicle;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
68  public MSTrigger, public MSMoveReminder,
69  public SUMOSAXHandler {
70 public:
78  MSTriggeredRerouter(const std::string& id,
79  const MSEdgeVector& edges,
80  SUMOReal prob, const std::string& file, bool off);
81 
82 
84  virtual ~MSTriggeredRerouter();
85 
86 
91  struct RerouteInterval {
105  std::vector<SVCPermissions> prevPermissions;
106  };
107 
123 
125  const RerouteInterval* getCurrentReroute(SUMOTime time, SUMOVehicle& veh) const;
126 
128  SUMOTime setPermissions(const SUMOTime currentTime);
129 
131  const RerouteInterval* getCurrentReroute(SUMOTime time) const;
132 
134  void setUserMode(bool val);
135 
138 
140  bool inUserMode() const;
141 
143  SUMOReal getProbability() const;
144 
147 
148 protected:
150 
151 
159  virtual void myStartElement(int element,
160  const SUMOSAXAttributes& attrs);
161 
162 
169  virtual void myEndElement(int element);
171 
172 protected:
174  std::vector<RerouteInterval> myIntervals;
175 
178 
181 
183 
184 
196 
197 
201 
202 private:
205 
208 
209 
210 };
211 
212 
213 #endif
214 
215 /****************************************************************************/
216 
MSEdgeVector closed
The list of closed edges.
SUMOTime setPermissions(const SUMOTime currentTime)
Sets the edge permission if there are any defined in the closingEdge.
SVCPermissions myCurrentPermissions
List of permissions for closed edges.
RandomDistributor< MSEdge * > edgeProbs
The distributions of new destinations to use.
SUMOTime myCurrentIntervalBegin
The first and the last time steps of the interval.
int SVCPermissions
Notification
Definition of a vehicle state.
void setUserUsageProbability(SUMOReal prob)
Sets the probability with which a vehicle is rerouted given by the user.
SUMOReal getUserProbability() const
Returns the rerouting probability given by the user.
void setUserMode(bool val)
Sets whether the process is currently steered by the user.
SAX-handler base for SUMO-files.
The simulated network and simulation perfomer.
Definition: MSNet.h:94
SUMOReal myProbability
The probability and the user-given probability.
A road/street connecting two junctions.
Definition: MSEdge.h:81
MSTriggeredRerouter & operator=(const MSTriggeredRerouter &)
Invalidated assignment operator.
virtual void myEndElement(int element)
Called when a closing tag occurs.
An abstract device that changes the state of the micro simulation.
Definition: MSTrigger.h:48
Representation of a vehicle.
Definition: SUMOVehicle.h:65
Encapsulated SAX-Attributes.
virtual ~MSTriggeredRerouter()
Destructor.
SUMOTime begin
The begin time these definitions are valid.
RandomDistributor< const MSRoute * > myCurrentRouteProb
new routes with probabilities
static MSEdge mySpecialDest_keepDestination
special destination values
SUMOReal getProbability() const
Returns the rerouting probability.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Tries to reroute the vehicle.
Something on a lane to be noticed about vehicle movement.
static MSEdge mySpecialDest_terminateRoute
const RerouteInterval * getCurrentReroute(SUMOTime time, SUMOVehicle &veh) const
Returns the rerouting definition valid for the given time and vehicle, 0 if none. ...
RandomDistributor< MSEdge * > myCurrentEdgeProb
new destinations with probabilities
Reroutes vehicles passing an edge.
bool inUserMode() const
Returns whether the user is setting the rerouting probability.
SUMOTime end
The end time these definitions are valid.
RandomDistributor< const MSRoute * > routeProbs
The distributions of new routes to use.
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
MSEdgeVector myCurrentClosed
List of closed edges.
bool myAmInUserMode
Information whether the current rerouting probability is the user-given.
int SUMOTime
Definition: SUMOTime.h:43
MSTriggeredRerouter(const std::string &id, const MSEdgeVector &edges, SUMOReal prob, const std::string &file, bool off)
Constructor.
#define SUMOReal
Definition: config.h:218
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:78
SVCPermissions permissions
The permissions to use.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
std::vector< SVCPermissions > prevPermissions
The old permissions for all lanes.