SUMO - Simulation of Urban MObility

MSDevice_Routing.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A device that performs vehicle rerouting based on current edge speeds
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef MSDevice_Routing_h
00020 #define MSDevice_Routing_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <set>
00033 #include <vector>
00034 #include <map>
00035 #include "MSDevice.h"
00036 #include <utils/common/SUMOTime.h>
00037 #include <microsim/MSVehicle.h>
00038 #include <utils/common/WrappingCommand.h>
00039 
00040 
00041 // ===========================================================================
00042 // class declarations
00043 // ===========================================================================
00044 class MSLane;
00045 
00046 
00047 // ===========================================================================
00048 // class definitions
00049 // ===========================================================================
00068 class MSDevice_Routing : public MSDevice {
00069 public:
00072     static void insertOptions() throw();
00073 
00074 
00092     static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*> &into) throw();
00093 
00094 
00095 public:
00098 
00117     bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) throw();
00119 
00120 
00122     ~MSDevice_Routing() throw();
00123 
00124 
00125 private:
00133     MSDevice_Routing(SUMOVehicle& holder, const std::string& id, SUMOTime period,
00134                      SUMOTime preInsertionPeriod) throw();
00135 
00136 
00148     SUMOTime preInsertionReroute(SUMOTime currentTime) throw(ProcessError);
00149 
00150 
00165     SUMOTime wrappedRerouteCommandExecute(SUMOTime currentTime) throw(ProcessError);
00166 
00167 
00182     SUMOReal getEffort(const MSEdge* const e, const SUMOVehicle* const v, SUMOReal t) const;
00183 
00184 
00187 
00199     static SUMOTime adaptEdgeEfforts(SUMOTime currentTime) throw(ProcessError);
00201 
00202 
00203 private:
00205     SUMOTime myPeriod;
00206 
00208     SUMOTime myPreInsertionPeriod;
00209 
00211     WrappingCommand< MSDevice_Routing >* myRerouteCommand;
00212 
00214     static Command* myEdgeWeightSettingCommand;
00215 
00217     static std::map<const MSEdge*, SUMOReal> myEdgeEfforts;
00218 
00220     static SUMOReal myAdaptationWeight;
00221 
00223     static SUMOTime myAdaptationInterval;
00224 
00226     static bool myWithTaz;
00227 
00229     static std::map<std::pair<const MSEdge*, const MSEdge*>, const MSRoute*> myCachedRoutes;
00230 
00231 
00232 private:
00234     MSDevice_Routing(const MSDevice_Routing&);
00235 
00237     MSDevice_Routing& operator=(const MSDevice_Routing&);
00238 
00239 
00240 };
00241 
00242 
00243 #endif
00244 
00245 /****************************************************************************/
00246 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines