SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00010 // Structure representing possible vehicle parameter 00011 /****************************************************************************/ 00012 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00013 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00014 /****************************************************************************/ 00015 // 00016 // This file is part of SUMO. 00017 // SUMO is free software: you can redistribute it and/or modify 00018 // it under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation, either version 3 of the License, or 00020 // (at your option) any later version. 00021 // 00022 /****************************************************************************/ 00023 #ifndef SUMOVehicleParameter_h 00024 #define SUMOVehicleParameter_h 00025 00026 00027 // =========================================================================== 00028 // included modules 00029 // =========================================================================== 00030 #ifdef _MSC_VER 00031 #include <windows_config.h> 00032 #else 00033 #include <config.h> 00034 #endif 00035 00036 #include <string> 00037 #include "SUMOVehicleClass.h" 00038 #include "RGBColor.h" 00039 #include "SUMOTime.h" 00040 00041 00042 // =========================================================================== 00043 // class declarations 00044 // =========================================================================== 00045 class OutputDevice; 00046 class OptionsCont; 00047 00048 // =========================================================================== 00049 // value definitions 00050 // =========================================================================== 00051 const int VEHPARS_COLOR_SET = 1; 00052 const int VEHPARS_VTYPE_SET = 2; 00053 const int VEHPARS_DEPARTLANE_SET = 2 << 2; 00054 const int VEHPARS_DEPARTPOS_SET = 2 << 3; 00055 const int VEHPARS_DEPARTSPEED_SET = 2 << 4; 00056 const int VEHPARS_PERIODNUM_SET = 2 << 5; 00057 const int VEHPARS_PERIODFREQ_SET = 2 << 6; 00058 const int VEHPARS_ROUTE_SET = 2 << 7; 00059 const int VEHPARS_ARRIVALLANE_SET = 2 << 8; 00060 const int VEHPARS_ARRIVALPOS_SET = 2 << 9; 00061 const int VEHPARS_ARRIVALSPEED_SET = 2 << 10; 00062 const int VEHPARS_LINE_SET = 2 << 11; 00063 const int VEHPARS_TAZ_SET = 2 << 12; 00064 const int VEHPARS_FORCE_REROUTE = 2 << 13; 00065 00066 const int STOP_INDEX_END = -1; 00067 const int STOP_INDEX_FIT = -2; 00068 00069 00070 // =========================================================================== 00071 // enum definitions 00072 // =========================================================================== 00077 enum DepartDefinition { 00079 DEPART_GIVEN, 00081 DEPART_TRIGGERED, 00083 DEPART_NOW, 00085 DEPART_DEF_MAX 00086 }; 00087 00088 00093 enum DepartLaneDefinition { 00095 DEPART_LANE_DEFAULT, 00097 DEPART_LANE_GIVEN, 00099 DEPART_LANE_RANDOM, 00101 DEPART_LANE_FREE, 00103 DEPART_LANE_ALLOWED_FREE, 00105 DEPART_LANE_BEST_FREE, 00107 DEPART_LANE_DEF_MAX 00108 }; 00109 00110 00115 enum DepartPosDefinition { 00117 DEPART_POS_DEFAULT, 00119 DEPART_POS_GIVEN, 00121 DEPART_POS_RANDOM, 00123 DEPART_POS_FREE, 00125 DEPART_POS_BASE, 00127 DEPART_POS_PWAG_SIMPLE, 00129 DEPART_POS_PWAG_GENERIC, 00131 DEPART_POS_MAX_SPEED_GAP, 00133 DEPART_POS_RANDOM_FREE, 00135 DEPART_POS_DEF_MAX 00136 }; 00137 00138 00143 enum DepartSpeedDefinition { 00145 DEPART_SPEED_DEFAULT, 00147 DEPART_SPEED_GIVEN, 00149 DEPART_SPEED_RANDOM, 00151 DEPART_SPEED_MAX, 00153 DEPART_SPEED_DEF_MAX 00154 }; 00155 00156 00161 enum ArrivalLaneDefinition { 00163 ARRIVAL_LANE_DEFAULT, 00165 ARRIVAL_LANE_GIVEN, 00167 ARRIVAL_LANE_CURRENT, 00169 ARRIVAL_LANE_DEF_MAX 00170 }; 00171 00172 00177 enum ArrivalPosDefinition { 00179 ARRIVAL_POS_DEFAULT, 00181 ARRIVAL_POS_GIVEN, 00183 ARRIVAL_POS_RANDOM, 00185 ARRIVAL_POS_MAX, 00187 ARRIVAL_POS_DEF_MAX 00188 }; 00189 00190 00195 enum ArrivalSpeedDefinition { 00197 ARRIVAL_SPEED_DEFAULT, 00199 ARRIVAL_SPEED_GIVEN, 00201 ARRIVAL_SPEED_CURRENT, 00203 ARRIVAL_SPEED_DEF_MAX 00204 }; 00205 00206 00207 // =========================================================================== 00208 // struct definitions 00209 // =========================================================================== 00220 class SUMOVehicleParameter { 00221 public: 00226 SUMOVehicleParameter() ; 00227 00228 00233 bool wasSet(int what) const { 00234 return (setParameter & what) != 0; 00235 } 00236 00237 00245 void writeAs(const std::string& xmlElem, OutputDevice& dev, 00246 const OptionsCont& oc) const; 00247 00248 00254 bool defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const ; 00255 00256 00257 00260 00265 static bool departlaneValidate(const std::string& val) ; 00266 00267 00272 static bool departposValidate(const std::string& val) ; 00273 00274 00279 static bool departspeedValidate(const std::string& val) ; 00280 00281 00286 static bool arrivallaneValidate(const std::string& val) ; 00287 00288 00293 static bool arrivalposValidate(const std::string& val) ; 00294 00295 00300 static bool arrivalspeedValidate(const std::string& val) ; 00302 00303 00304 00306 std::string id; 00307 00309 std::string routeid; 00311 std::string vtypeid; 00313 mutable RGBColor color; 00314 00315 00318 00320 SUMOTime depart; 00322 DepartDefinition departProcedure; 00324 int departLane; 00326 DepartLaneDefinition departLaneProcedure; 00328 SUMOReal departPos; 00330 DepartPosDefinition departPosProcedure; 00332 SUMOReal departSpeed; 00334 DepartSpeedDefinition departSpeedProcedure; 00336 00337 00340 00342 int arrivalLane; 00344 ArrivalLaneDefinition arrivalLaneProcedure; 00346 SUMOReal arrivalPos; 00348 ArrivalPosDefinition arrivalPosProcedure; 00350 SUMOReal arrivalSpeed; 00352 ArrivalSpeedDefinition arrivalSpeedProcedure; 00354 00355 00358 00360 int repetitionNumber; 00362 int repetitionsDone; 00364 #ifdef HAVE_SUBSECOND_TIMESTEPS 00365 SUMOTime repetitionOffset; 00366 #else 00367 SUMOReal repetitionOffset; 00368 #endif 00369 00370 00371 00373 std::string line; 00374 00376 std::string fromTaz; 00377 00379 std::string toTaz; 00380 00384 struct Stop { 00386 std::string lane; 00388 std::string busstop; 00390 SUMOReal startPos; 00392 SUMOReal endPos; 00394 SUMOTime duration; 00396 SUMOTime until; 00398 bool triggered; 00400 bool parking; 00402 int index; 00403 }; 00404 00406 std::vector<Stop> stops; 00407 00409 int setParameter; 00410 00411 }; 00412 00413 #endif 00414 00415 /****************************************************************************/ 00416