|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // Class for loading trip amount definitions and route generation 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 #ifndef RORDGenerator_ODAmounts_h 00023 #define RORDGenerator_ODAmounts_h 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif 00034 00035 #include <string> 00036 #include <set> 00037 #include <utils/options/OptionsCont.h> 00038 #include <utils/common/IDSupplier.h> 00039 #include <utils/xml/SUMOXMLDefinitions.h> 00040 #include "RORDLoader_TripDefs.h" 00041 #include "RONet.h" 00042 #include <utils/common/SUMOTime.h> 00043 00044 00045 // =========================================================================== 00046 // class definitions 00047 // =========================================================================== 00054 class RORDGenerator_ODAmounts : public RORDLoader_TripDefs { 00055 public: 00057 RORDGenerator_ODAmounts(RONet& net, 00058 SUMOTime begin, SUMOTime end, bool emptyDestinationsAllowed, 00059 bool randomize, const std::string& file = "") ; 00060 00062 ~RORDGenerator_ODAmounts() ; 00063 00064 00066 00067 00076 bool readRoutesAtLeastUntil(SUMOTime until, bool skipping) ; 00078 00079 00080 protected: 00082 00083 00091 void myStartElement(int element, 00092 const SUMOSAXAttributes& attrs) ; 00093 00094 00101 void myEndElement(int element) ; 00103 00105 void parseInterval(const SUMOSAXAttributes& attrs); 00106 00108 void parseFlowAmountDef(const SUMOSAXAttributes& attrs) ; 00109 00111 void myEndInterval(); 00112 00114 void myEndFlowAmountDef(); 00115 00120 class FlowDef { 00121 public: 00123 FlowDef(ROVehicle* vehicle, SUMOVTypeParameter* type, RORouteDef* route, 00124 SUMOTime intBegin, SUMOTime intEnd, 00125 unsigned int vehicles2insert, bool randomize); 00126 00128 ~FlowDef(); 00129 00131 bool applicableForTime(SUMOTime time) const; 00132 00134 void addRoutes(RONet& net, SUMOTime time); 00135 00137 void addSingleRoute(RONet& net, SUMOTime time); 00138 00140 SUMOTime getIntervalEnd() const; 00141 00142 private: 00144 ROVehicle* myVehicle; 00145 00147 SUMOVTypeParameter* myVehicleType; 00148 00150 RORouteDef* myRoute; 00151 00153 SUMOTime myIntervalBegin; 00154 00156 SUMOTime myIntervalEnd; 00157 00159 unsigned int myVehicle2InsertNumber; 00160 00162 unsigned int myInserted; 00163 00165 std::vector<SUMOTime> myDepartures; 00166 00168 bool myRandom; 00169 00170 }; 00171 00172 private: 00174 void buildRoutes(SUMOTime until) ; 00175 00177 void buildForTimeStep(SUMOTime time) ; 00178 00179 private: 00181 SUMOTime myIntervalBegin; 00182 00184 SUMOTime myIntervalEnd; 00185 00187 SUMOTime myUpperIntervalBegin; 00188 00190 SUMOTime myUpperIntervalEnd; 00191 00193 unsigned int myVehicle2InsertNumber; 00194 00196 SUMOTime myCurrentTimeStep; 00197 00199 typedef std::vector<FlowDef*> FlowDefV; 00200 00202 FlowDefV myFlows; 00203 00205 std::set<std::string> myKnownIDs; 00206 00208 bool myRandom; 00209 00210 00211 bool myHaveWarnedAboutDeprecatedNumber; 00212 00213 private: 00215 RORDGenerator_ODAmounts(const RORDGenerator_ODAmounts& src); 00216 00218 RORDGenerator_ODAmounts& operator=(const RORDGenerator_ODAmounts& src); 00219 00220 }; 00221 00222 00223 #endif 00224 00225 /****************************************************************************/ 00226