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 2001-2010 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(MSVehicle &v, std::vector<MSDevice*> &into) throw();
00093 
00094 
00095 public:
00098 
00112     void onTryEmit();
00113 
00129     void enterLaneAtEmit(MSLane* enteredLane, const MSVehicle::State &state);
00131 
00132 
00133 private:
00141     MSDevice_Routing(MSVehicle &holder, const std::string &id, SUMOTime period,
00142                      SUMOTime preEmitPeriod) throw();
00143 
00144 
00146     ~MSDevice_Routing() throw();
00147 
00148 
00163     SUMOTime wrappedRerouteCommandExecute(SUMOTime currentTime) throw(ProcessError);
00164 
00165 
00180     SUMOReal getEffort(const MSEdge * const e, const SUMOVehicle * const v, SUMOReal t) const;
00181 
00182 
00185 
00197     static SUMOTime adaptEdgeEfforts(SUMOTime currentTime) throw(ProcessError);
00199 
00200 
00201 private:
00203     SUMOTime myPeriod;
00204 
00206     SUMOTime myPreEmitPeriod;
00207 
00209     SUMOTime myLastPreEmitReroute;
00210 
00212     static int myVehicleIndex;
00213 
00215     WrappingCommand< MSDevice_Routing >* myRerouteCommand;
00216 
00218     static Command* myEdgeWeightSettingCommand;
00219 
00221     static std::map<const MSEdge*, SUMOReal> myEdgeEfforts;
00222 
00224     static SUMOReal myAdaptationWeight;
00225 
00227     static SUMOTime myAdaptationInterval;
00228 
00230     static bool myWithTaz;
00231 
00232 
00233 private:
00235     MSDevice_Routing(const MSDevice_Routing&);
00236 
00238     MSDevice_Routing& operator=(const MSDevice_Routing&);
00239 
00240 
00241 };
00242 
00243 
00244 #endif
00245 
00246 /****************************************************************************/
00247 

Generated on Wed May 5 00:06:31 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6