|
SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00007 // Structure representing possible vehicle parameter 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 SUMOVehicleParameter_h 00020 #define SUMOVehicleParameter_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 <string> 00033 #include "SUMOVehicleClass.h" 00034 #include "RGBColor.h" 00035 #include "SUMOTime.h" 00036 00037 00038 // =========================================================================== 00039 // class declarations 00040 // =========================================================================== 00041 class OutputDevice; 00042 class OptionsCont; 00043 00044 // =========================================================================== 00045 // value definitions 00046 // =========================================================================== 00047 const int VEHPARS_COLOR_SET = 1; 00048 const int VEHPARS_VTYPE_SET = 2; 00049 const int VEHPARS_DEPARTLANE_SET = 2 << 2; 00050 const int VEHPARS_DEPARTPOS_SET = 2 << 3; 00051 const int VEHPARS_DEPARTSPEED_SET = 2 << 4; 00052 const int VEHPARS_PERIODNUM_SET = 2 << 5; 00053 const int VEHPARS_PERIODFREQ_SET = 2 << 6; 00054 const int VEHPARS_ROUTE_SET = 2 << 7; 00055 const int VEHPARS_ARRIVALLANE_SET = 2 << 8; 00056 const int VEHPARS_ARRIVALPOS_SET = 2 << 9; 00057 const int VEHPARS_ARRIVALSPEED_SET = 2 << 10; 00058 const int VEHPARS_LINE_SET = 2 << 11; 00059 const int VEHPARS_TAZ_SET = 2 << 12; 00060 const int VEHPARS_FORCE_REROUTE = 2 << 13; 00061 00062 const int STOP_INDEX_END = -1; 00063 const int STOP_INDEX_FIT = -2; 00064 00065 00066 // =========================================================================== 00067 // enum definitions 00068 // =========================================================================== 00074 enum DepartDefinition { 00076 DEPART_GIVEN, 00078 DEPART_TRIGGERED, 00080 DEPART_NOW 00081 }; 00082 00083 00089 enum DepartLaneDefinition { 00091 DEPART_LANE_DEFAULT, 00093 DEPART_LANE_GIVEN, 00095 DEPART_LANE_RANDOM, 00097 DEPART_LANE_FREE, 00099 DEPART_LANE_ALLOWED_FREE, 00101 DEPART_LANE_BEST_FREE 00102 }; 00103 00104 00109 enum DepartPosDefinition { 00111 DEPART_POS_DEFAULT, 00113 DEPART_POS_GIVEN, 00115 DEPART_POS_RANDOM, 00117 DEPART_POS_FREE, 00119 DEPART_POS_BASE, 00121 DEPART_POS_PWAG_SIMPLE, 00123 DEPART_POS_PWAG_GENERIC, 00125 DEPART_POS_MAX_SPEED_GAP, 00127 DEPART_POS_RANDOM_FREE 00128 }; 00129 00130 00136 enum DepartSpeedDefinition { 00138 DEPART_SPEED_DEFAULT, 00140 DEPART_SPEED_GIVEN, 00142 DEPART_SPEED_RANDOM, 00144 DEPART_SPEED_MAX 00145 }; 00146 00147 00153 enum ArrivalLaneDefinition { 00155 ARRIVAL_LANE_DEFAULT, 00157 ARRIVAL_LANE_GIVEN, 00159 ARRIVAL_LANE_CURRENT 00160 }; 00161 00162 00168 enum ArrivalPosDefinition { 00170 ARRIVAL_POS_DEFAULT, 00172 ARRIVAL_POS_GIVEN, 00174 ARRIVAL_POS_RANDOM, 00176 ARRIVAL_POS_MAX 00177 }; 00178 00179 00185 enum ArrivalSpeedDefinition { 00187 ARRIVAL_SPEED_DEFAULT, 00189 ARRIVAL_SPEED_GIVEN, 00191 ARRIVAL_SPEED_CURRENT 00192 }; 00193 00194 00195 // =========================================================================== 00196 // struct definitions 00197 // =========================================================================== 00208 class SUMOVehicleParameter { 00209 public: 00214 SUMOVehicleParameter() throw(); 00215 00216 00221 bool wasSet(int what) const throw() { 00222 return (setParameter&what)!=0; 00223 } 00224 00225 00233 void writeAs(const std::string& xmlElem, OutputDevice& dev, 00234 const OptionsCont& oc) const throw(IOError); 00235 00236 00242 bool defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const throw(); 00243 00244 00245 00248 00253 static bool departlaneValidate(const std::string& val) throw(); 00254 00255 00260 static bool departposValidate(const std::string& val) throw(); 00261 00262 00267 static bool departspeedValidate(const std::string& val) throw(); 00268 00269 00274 static bool arrivallaneValidate(const std::string& val) throw(); 00275 00276 00281 static bool arrivalposValidate(const std::string& val) throw(); 00282 00283 00288 static bool arrivalspeedValidate(const std::string& val) throw(); 00290 00291 00292 00294 std::string id; 00295 00297 std::string routeid; 00299 std::string vtypeid; 00301 mutable RGBColor color; 00302 00303 00306 00308 SUMOTime depart; 00310 DepartDefinition departProcedure; 00312 int departLane; 00314 DepartLaneDefinition departLaneProcedure; 00316 SUMOReal departPos; 00318 DepartPosDefinition departPosProcedure; 00320 SUMOReal departSpeed; 00322 DepartSpeedDefinition departSpeedProcedure; 00324 00325 00328 00330 int arrivalLane; 00332 ArrivalLaneDefinition arrivalLaneProcedure; 00334 SUMOReal arrivalPos; 00336 ArrivalPosDefinition arrivalPosProcedure; 00338 SUMOReal arrivalSpeed; 00340 ArrivalSpeedDefinition arrivalSpeedProcedure; 00342 00343 00346 00348 int repetitionNumber; 00350 int repetitionsDone; 00352 #ifdef HAVE_SUBSECOND_TIMESTEPS 00353 SUMOTime repetitionOffset; 00354 #else 00355 SUMOReal repetitionOffset; 00356 #endif 00357 00358 00359 00361 std::string line; 00362 00364 std::string fromTaz; 00365 00367 std::string toTaz; 00368 00372 struct Stop { 00374 std::string lane; 00376 std::string busstop; 00378 SUMOReal startPos; 00380 SUMOReal endPos; 00382 SUMOTime duration; 00384 SUMOTime until; 00386 bool triggered; 00388 bool parking; 00390 int index; 00391 }; 00392 00394 std::vector<Stop> stops; 00395 00397 int setParameter; 00398 00399 }; 00400 00401 #endif 00402 00403 /****************************************************************************/ 00404