SUMO - Simulation of Urban MObility
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 
71  friend class GUIEdge; // dynamic instantiation
72 
73 public:
81  MSTriggeredRerouter(const std::string& id,
82  const MSEdgeVector& edges,
83  SUMOReal prob, const std::string& file, bool off);
84 
85 
87  virtual ~MSTriggeredRerouter();
88 
89 
94  struct RerouteInterval {
108  std::vector<SVCPermissions> prevPermissions;
109  };
110 
126 
128  const RerouteInterval* getCurrentReroute(SUMOTime time, SUMOVehicle& veh) const;
129 
131  SUMOTime setPermissions(const SUMOTime currentTime);
132 
134  const RerouteInterval* getCurrentReroute(SUMOTime time) const;
135 
137  void setUserMode(bool val);
138 
141 
143  bool inUserMode() const;
144 
146  SUMOReal getProbability() const;
147 
150 
151 protected:
153 
154 
162  virtual void myStartElement(int element,
163  const SUMOSAXAttributes& attrs);
164 
165 
172  virtual void myEndElement(int element);
174 
175 protected:
177  std::vector<RerouteInterval> myIntervals;
178 
181 
184 
186 
187 
199 
200 
204 
205 private:
208 
211 
212 
213 };
214 
215 
216 #endif
217 
218 /****************************************************************************/
219 
MSEdgeVector closed
The list of closed edges.
long long int SUMOTime
Definition: SUMOTime.h:43
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 (gui-version)
Definition: GUIEdge.h:62
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.
MSTriggeredRerouter(const std::string &id, const MSEdgeVector &edges, SUMOReal prob, const std::string &file, bool off)
Constructor.
#define SUMOReal
Definition: config.h:214
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.