SUMO - Simulation of Urban MObility
MSDevice_Routing.h
Go to the documentation of this file.
00001 /****************************************************************************/
00008 // A device that performs vehicle rerouting based on current edge speeds
00009 /****************************************************************************/
00010 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00011 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00012 /****************************************************************************/
00013 //
00014 //   This file is part of SUMO.
00015 //   SUMO is free software: you can redistribute it and/or modify
00016 //   it under the terms of the GNU General Public License as published by
00017 //   the Free Software Foundation, either version 3 of the License, or
00018 //   (at your option) any later version.
00019 //
00020 /****************************************************************************/
00021 #ifndef MSDevice_Routing_h
00022 #define MSDevice_Routing_h
00023 
00024 
00025 // ===========================================================================
00026 // included modules
00027 // ===========================================================================
00028 #ifdef _MSC_VER
00029 #include <windows_config.h>
00030 #else
00031 #include <config.h>
00032 #endif
00033 
00034 #include <set>
00035 #include <vector>
00036 #include <map>
00037 #include "MSDevice.h"
00038 #include <utils/common/SUMOTime.h>
00039 #include <microsim/MSVehicle.h>
00040 #include <utils/common/WrappingCommand.h>
00041 
00042 
00043 // ===========================================================================
00044 // class declarations
00045 // ===========================================================================
00046 class MSLane;
00047 
00048 
00049 // ===========================================================================
00050 // class definitions
00051 // ===========================================================================
00070 class MSDevice_Routing : public MSDevice {
00071 public:
00074     static void insertOptions() ;
00075 
00076 
00094     static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSDevice*> &into) ;
00095 
00096 
00097 public:
00100 
00119     bool notifyEnter(SUMOVehicle& veh, MSMoveReminder::Notification reason) ;
00121 
00122 
00124     ~MSDevice_Routing() ;
00125 
00126 
00127 private:
00135     MSDevice_Routing(SUMOVehicle& holder, const std::string& id, SUMOTime period,
00136                      SUMOTime preInsertionPeriod) ;
00137 
00138 
00150     SUMOTime preInsertionReroute(SUMOTime currentTime) ;
00151 
00152 
00167     SUMOTime wrappedRerouteCommandExecute(SUMOTime currentTime) ;
00168 
00169 
00184     SUMOReal getEffort(const MSEdge* const e, const SUMOVehicle* const v, SUMOReal t) const;
00185 
00186 
00189 
00201     static SUMOTime adaptEdgeEfforts(SUMOTime currentTime) ;
00203 
00204 
00205 private:
00207     SUMOTime myPeriod;
00208 
00210     SUMOTime myPreInsertionPeriod;
00211 
00213     WrappingCommand< MSDevice_Routing >* myRerouteCommand;
00214 
00216     static Command* myEdgeWeightSettingCommand;
00217 
00219     static std::map<const MSEdge*, SUMOReal> myEdgeEfforts;
00220 
00222     static SUMOReal myAdaptationWeight;
00223 
00225     static SUMOTime myAdaptationInterval;
00226 
00228     static bool myWithTaz;
00229 
00231     static std::map<std::pair<const MSEdge*, const MSEdge*>, const MSRoute*> myCachedRoutes;
00232 
00233 
00234 private:
00236     MSDevice_Routing(const MSDevice_Routing&);
00237 
00239     MSDevice_Routing& operator=(const MSDevice_Routing&);
00240 
00241 
00242 };
00243 
00244 
00245 #endif
00246 
00247 /****************************************************************************/
00248 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines