SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SUMOVehicleParameter.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // Structure representing possible vehicle parameter
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef SUMOVehicleParameter_h
24 #define SUMOVehicleParameter_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
38 #include <utils/common/RGBColor.h>
39 #include <utils/common/SUMOTime.h>
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 class OutputDevice;
47 class OptionsCont;
48 
49 
50 // ===========================================================================
51 // value definitions
52 // ===========================================================================
53 const int VEHPARS_COLOR_SET = 1;
54 const int VEHPARS_VTYPE_SET = 2;
55 const int VEHPARS_DEPARTLANE_SET = 2 << 1;
56 const int VEHPARS_DEPARTPOS_SET = 2 << 2;
57 const int VEHPARS_DEPARTSPEED_SET = 2 << 3;
58 const int VEHPARS_PERIODNUM_SET = 2 << 4;
59 const int VEHPARS_PERIODFREQ_SET = 2 << 5;
60 const int VEHPARS_ROUTE_SET = 2 << 6;
61 const int VEHPARS_ARRIVALLANE_SET = 2 << 7;
62 const int VEHPARS_ARRIVALPOS_SET = 2 << 8;
63 const int VEHPARS_ARRIVALSPEED_SET = 2 << 9;
64 const int VEHPARS_LINE_SET = 2 << 10;
65 const int VEHPARS_FROM_TAZ_SET = 2 << 11;
66 const int VEHPARS_TO_TAZ_SET = 2 << 12;
67 const int VEHPARS_FORCE_REROUTE = 2 << 13;
68 const int VEHPARS_PERSON_CAPACITY_SET = 2 << 14;
69 const int VEHPARS_PERSON_NUMBER_SET = 2 << 15;
70 const int VEHPARS_CONTAINER_NUMBER_SET = 2 << 15;
71 
72 const int STOP_INDEX_END = -1;
73 const int STOP_INDEX_FIT = -2;
74 
75 const int STOP_END_SET = 1;
76 const int STOP_START_SET = 2;
77 const int STOP_TRIGGER_SET = 2 << 1;
78 const int STOP_PARKING_SET = 2 << 2;
79 const int STOP_EXPECTED_SET = 2 << 3;
80 const int STOP_CONTAINER_TRIGGER_SET = 2 << 4;
81 const int STOP_EXPECTED_CONTAINERS_SET = 2 << 5;
82 
83 
84 // ===========================================================================
85 // enum definitions
86 // ===========================================================================
102 };
103 
104 
126 };
127 
128 
154 };
155 
156 
172 };
173 
174 
188 };
189 
190 
206 };
207 
208 
222 };
223 
224 
225 // ===========================================================================
226 // struct definitions
227 // ===========================================================================
239 public:
245 
246 
251  bool wasSet(int what) const {
252  return (setParameter & what) != 0;
253  }
254 
255 
262  void write(OutputDevice& dev, const OptionsCont& oc) const;
263 
264 
270  void writeStops(OutputDevice& dev) const;
271 
277  bool defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const;
278 
279 
280 
283 
293  static bool parseDepart(const std::string& val, const std::string& element, const std::string& id,
294  SUMOTime& depart, DepartDefinition& dd, std::string& error);
295 
296 
306  static bool parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
307  int& lane, DepartLaneDefinition& dld, std::string& error);
308 
309 
319  static bool parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
320  SUMOReal& pos, DepartPosDefinition& dpd, std::string& error);
321 
322 
332  static bool parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
333  SUMOReal& speed, DepartSpeedDefinition& dsd, std::string& error);
334 
335 
345  static bool parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
346  int& lane, ArrivalLaneDefinition& ald, std::string& error);
347 
348 
358  static bool parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
359  SUMOReal& pos, ArrivalPosDefinition& apd, std::string& error);
360 
361 
371  static bool parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
372  SUMOReal& speed, ArrivalSpeedDefinition& asd, std::string& error);
374 
375 
383  static SUMOReal interpretEdgePos(SUMOReal pos, SUMOReal maximumValue, SumoXMLAttr attr, const std::string& id);
384 
386  std::string id;
387 
389  std::string routeid;
391  std::string vtypeid;
393  mutable RGBColor color;
394 
395 
398 
416 
417 
420 
434 
435 
438 
444 #ifdef HAVE_SUBSECOND_TIMESTEPS
446 #else
448 #endif
454 
455 
457  std::string line;
458 
460  std::string fromTaz;
461 
463  std::string toTaz;
464 
468  struct Stop {
470  std::string lane;
472  std::string busstop;
474  std::string containerstop;
484  bool triggered;
488  bool parking;
490  std::set<std::string> awaitedPersons;
492  std::set<std::string> awaitedContainers;
494  int index;
497  };
498 
500  std::vector<Stop> stops;
501 
503  unsigned int personCapacity;
504 
506  unsigned int personNumber;
507 
509  unsigned int containerNumber;
510 
512  mutable int setParameter;
513 
514 
515 };
516 
517 #endif
518 
519 /****************************************************************************/
520 
521 
The departure is person triggered.
const int VEHPARS_TO_TAZ_SET
The current lane shall be used.
const int STOP_CONTAINER_TRIGGER_SET
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
No information given; use default.
SUMOReal repetitionProbability
The probability for emitting a vehicle per second.
RGBColor color
The vehicle's color.
const int VEHPARS_FORCE_REROUTE
The time is given.
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, SUMOReal &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
std::string containerstop
(Optional) container stop if one is assigned to the stop
The vehicle is discarded if emission fails (not fully implemented yet)
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
std::string vtypeid
The vehicle's type id.
bool parking
whether the vehicle is removed from the net while stopping
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, SUMOReal &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
void writeStops(OutputDevice &dev) const
Writes the enclosed stops.
SUMOTime duration
The stopping duration.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
The speed is given.
The departure is container triggered.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
SUMOReal departSpeed
(optional) The initial speed of the vehicle
The position is given.
unsigned int personCapacity
The vehicle's capacity (persons)
Tag for the last element in the enum for safe int casting.
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
The least occupied lane is used.
int repetitionsDone
The number of times the vehicle was already inserted.
const int VEHPARS_PERIODNUM_SET
SUMOReal arrivalPos
(optional) The position the vehicle shall arrive on
const int VEHPARS_ARRIVALLANE_SET
The speed is chosen randomly.
Tag for the last element in the enum for safe int casting.
SUMOTime until
The time at which the vehicle may continue its journey.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const int STOP_INDEX_FIT
The lane is chosen randomly.
unsigned int personNumber
The number of persons in the vehicle.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
The arrival position is given.
SUMOReal repetitionOffset
The time offset between vehicle reinsertions.
The least occupied lane from best lanes.
The position is chosen randomly.
Tag for the last element in the enum for safe int casting.
Generic max-flow insertion by P.Wagner.
The speed is given.
A gap is chosen where the maximum speed may be achieved.
std::string toTaz
The vehicle's destination zone (district)
The lane is given.
std::vector< Stop > stops
List of the stops the vehicle will make.
const int VEHPARS_ARRIVALSPEED_SET
static SUMOReal interpretEdgePos(SUMOReal pos, SUMOReal maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
std::string busstop
(Optional) bus stop if one is assigned to the stop
SUMOVehicleParameter()
Constructor.
const int STOP_START_SET
bool defaultOptionOverrides(const OptionsCont &oc, const std::string &optionName) const
Returns whether the defaults shall be used.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
SUMOReal startPos
The stopping position start.
DepartLaneDefinition
Possible ways to choose a lane on depart.
std::string routeid
The vehicle's route id.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
The least occupied lane from lanes which allow the continuation.
bool wasSet(int what) const
Returns whether the given parameter was set.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
const int VEHPARS_DEPARTSPEED_SET
SUMOReal endPos
The stopping position end.
The current speed is used.
bool triggered
whether an arriving person lets the vehicle continue
const int STOP_INDEX_END
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
SUMOTime depart
The vehicle's departure time.
The maximum speed is used.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
const int VEHPARS_ROUTE_SET
std::string fromTaz
The vehicle's origin zone (district)
No information given; use default.
Tag for the last element in the enum for safe int casting.
const int STOP_EXPECTED_SET
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
An upper class for objects with additional parameters.
Definition: Parameterised.h:47
const int VEHPARS_COLOR_SET
If a fixed number of random choices fails, a free position is chosen.
bool containerTriggered
whether an arriving container lets the vehicle continue
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, SUMOReal &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
const int VEHPARS_FROM_TAZ_SET
The rightmost lane the vehicle may use.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
std::string line
The vehicle's line (mainly for public transport)
DepartSpeedDefinition
Possible ways to choose the departure speed.
std::string lane
The lane to stop at.
const int STOP_END_SET
const int VEHPARS_LINE_SET
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, SUMOReal &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
const int VEHPARS_ARRIVALPOS_SET
No information given; use default.
const int STOP_PARKING_SET
const int STOP_TRIGGER_SET
Structure representing possible vehicle parameter.
const int VEHPARS_PERIODFREQ_SET
const int STOP_EXPECTED_CONTAINERS_SET
int setParameter
Information for the router which parameter were set.
Definition of vehicle stop (position and duration)
A storage for options typed value containers)
Definition: OptionsCont.h:108
Tag for the last element in the enum for safe int casting.
const int VEHPARS_DEPARTLANE_SET
int index
at which position in the stops list
No information given; use default.
The arrival lane is given.
int setParameter
Information for the output which parameter were set.
int SUMOTime
Definition: SUMOTime.h:43
SUMOReal departPos
(optional) The position the vehicle shall depart from
void write(OutputDevice &dev, const OptionsCont &oc) const
Writes the parameters as a beginning element.
const int VEHPARS_VTYPE_SET
No information given; use default.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
#define SUMOReal
Definition: config.h:218
ArrivalPosDefinition
Possible ways to choose the arrival position.
No information given; use default.
A free position is chosen.
const int VEHPARS_DEPARTPOS_SET
Simple max-flow insertion by P.Wagner.
const int VEHPARS_PERSON_NUMBER_SET
unsigned int containerNumber
The number of containers in the vehicle.
ArrivalSpeedDefinition
Possible ways to choose the arrival speed.
Tag for the last element in the enum for safe int casting.
Tag for the last element in the enum for safe int casting.
DepartPosDefinition
Possible ways to choose the departure position.
const int VEHPARS_CONTAINER_NUMBER_SET
The maximum arrival position is used.
Back-at-zero position.
const int VEHPARS_PERSON_CAPACITY_SET
DepartDefinition
Possible ways to depart.
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
std::string id
The vehicle's id.
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
The arrival position is chosen randomly.