LCOV - code coverage report
Current view: top level - src/utils/vehicle - SUMOVehicleParameter.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 2 2
Test Date: 2024-11-20 15:55:46 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    SUMOVehicleParameter.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Jakob Erdmann
      17              : /// @author  Axel Wegener
      18              : /// @author  Michael Behrisch
      19              : /// @date    2006-01-24
      20              : ///
      21              : // Structure representing possible vehicle parameter
      22              : /****************************************************************************/
      23              : #pragma once
      24              : #include <config.h>
      25              : 
      26              : #include <string>
      27              : #include <utils/common/Parameterised.h>
      28              : #include <utils/common/RGBColor.h>
      29              : #include <utils/common/SUMOTime.h>
      30              : #include <utils/common/SUMOVehicleClass.h>
      31              : 
      32              : 
      33              : // ===========================================================================
      34              : // class declarations
      35              : // ===========================================================================
      36              : class OutputDevice;
      37              : class OptionsCont;
      38              : 
      39              : 
      40              : // ===========================================================================
      41              : // value definitions
      42              : // ===========================================================================
      43              : const long long int VEHPARS_COLOR_SET = 1;
      44              : const long long int VEHPARS_VTYPE_SET = 2;
      45              : const long long int VEHPARS_DEPARTLANE_SET = 2 << 1;
      46              : const long long int VEHPARS_DEPARTPOS_SET = 2 << 2;
      47              : const long long int VEHPARS_DEPARTSPEED_SET = 2 << 3;
      48              : const long long int VEHPARS_END_SET = 2 << 4;
      49              : const long long int VEHPARS_NUMBER_SET = 2 << 5;
      50              : const long long int VEHPARS_PERIOD_SET = 2 << 6;
      51              : const long long int VEHPARS_VPH_SET = 2 << 7;
      52              : const long long int VEHPARS_PROB_SET = 2 << 8;
      53              : const long long int VEHPARS_POISSON_SET = 2 << 9;
      54              : const long long int VEHPARS_ROUTE_SET = 2 << 10;
      55              : const long long int VEHPARS_ARRIVALLANE_SET = 2 << 11;
      56              : const long long int VEHPARS_ARRIVALPOS_SET = 2 << 12;
      57              : const long long int VEHPARS_ARRIVALSPEED_SET = 2 << 13;
      58              : const long long int VEHPARS_LINE_SET = 2 << 14;
      59              : const long long int VEHPARS_FROM_TAZ_SET = 2 << 15;
      60              : const long long int VEHPARS_TO_TAZ_SET = 2 << 16;
      61              : const long long int VEHPARS_FORCE_REROUTE = 2 << 17;
      62              : const long long int VEHPARS_PERSON_CAPACITY_SET = 2 << 18;
      63              : const long long int VEHPARS_PERSON_NUMBER_SET = 2 << 19;
      64              : const long long int VEHPARS_CONTAINER_NUMBER_SET = 2 << 20;
      65              : const long long int VEHPARS_DEPARTPOSLAT_SET = 2 << 21;
      66              : const long long int VEHPARS_ARRIVALPOSLAT_SET = 2 << 22;
      67              : const long long int VEHPARS_VIA_SET = 2 << 23;
      68              : const long long int VEHPARS_SPEEDFACTOR_SET = 2 << 24;
      69              : const long long int VEHPARS_DEPARTEDGE_SET = 2 << 25;
      70              : const long long int VEHPARS_ARRIVALEDGE_SET = 2 << 26;
      71              : const long long int VEHPARS_CALIBRATORSPEED_SET = 2 << 27;
      72              : const long long int VEHPARS_JUNCTIONMODEL_PARAMS_SET = 2 << 28;
      73              : const long long int VEHPARS_CFMODEL_PARAMS_SET = 2 << 29;
      74              : const long long int VEHPARS_PARKING_BADGES_SET = (long long int)2 << 30;
      75              : const long long int VEHPARS_INSERTION_CHECKS_SET = (long long int)2 << 31;
      76              : 
      77              : const int STOP_INDEX_END = -1;
      78              : const int STOP_INDEX_FIT = -2;
      79              : const int STOP_INDEX_REPEAT = -3;
      80              : 
      81              : const int STOP_START_SET = 1;
      82              : const int STOP_END_SET = 2;
      83              : const int STOP_DURATION_SET = 2 << 1;
      84              : const int STOP_UNTIL_SET = 2 << 2;
      85              : const int STOP_EXTENSION_SET = 2 << 3;
      86              : const int STOP_TRIGGER_SET = 2 << 4;
      87              : const int STOP_PARKING_SET = 2 << 5;
      88              : const int STOP_EXPECTED_SET = 2 << 6;
      89              : const int STOP_CONTAINER_TRIGGER_SET = 2 << 7;
      90              : const int STOP_EXPECTED_CONTAINERS_SET = 2 << 8;
      91              : const int STOP_TRIP_ID_SET = 2 << 9;
      92              : const int STOP_LINE_SET = 2 << 10;
      93              : const int STOP_SPEED_SET = 2 << 11;
      94              : const int STOP_SPLIT_SET = 2 << 12;
      95              : const int STOP_JOIN_SET = 2 << 13;
      96              : const int STOP_ARRIVAL_SET = 2 << 14;
      97              : const int STOP_PERMITTED_SET = 2 << 15;
      98              : const int STOP_ENDED_SET = 2 << 16;
      99              : const int STOP_STARTED_SET = 2 << 17;
     100              : const int STOP_POSLAT_SET = 2 << 18;
     101              : const int STOP_ONDEMAND_SET = 2 << 19;
     102              : const int STOP_JUMP_SET = 2 << 20;
     103              : 
     104              : const double MIN_STOP_LENGTH = 2 * POSITION_EPS;
     105              : 
     106              : 
     107              : // ===========================================================================
     108              : // enum definitions
     109              : // ===========================================================================
     110              : /**
     111              :  * @enum DepartDefinition
     112              :  * @brief Possible ways to depart
     113              :  */
     114              : enum class DepartDefinition {
     115              :     /// @brief The time is given
     116              :     GIVEN,
     117              :     /// @brief The departure is person triggered
     118              :     TRIGGERED,
     119              :     /// @brief The departure is container triggered
     120              :     CONTAINER_TRIGGERED,
     121              :     /// @brief The vehicle is discarded if emission fails (not fully implemented yet)
     122              :     NOW,
     123              :     /// @brief The departure is triggered by a train split
     124              :     SPLIT,
     125              :     /// @brief The departure is at simulation start
     126              :     BEGIN,
     127              :     /// @brief Tag for the last element in the enum for safe int casting
     128              :     DEF_MAX
     129              : };
     130              : 
     131              : 
     132              : /**
     133              :  * @enum DepartLaneDefinition
     134              :  * @brief Possible ways to choose a lane on depart
     135              :  */
     136              : enum class DepartLaneDefinition {
     137              :     /// @brief No information given; use default
     138              :     DEFAULT,
     139              :     /// @brief The lane is given
     140              :     GIVEN,
     141              :     /// @brief The lane is chosen randomly
     142              :     RANDOM,
     143              :     /// @brief The least occupied lane is used
     144              :     FREE,
     145              :     /// @brief The least occupied lane from lanes which allow the continuation
     146              :     ALLOWED_FREE,
     147              :     /// @brief The least occupied lane from best lanes
     148              :     BEST_FREE,
     149              :     /// @brief The lane most likely according the speedFactor (from best lanes)
     150              :     BEST_PROB,
     151              :     /// @brief The rightmost lane the vehicle may use
     152              :     FIRST_ALLOWED
     153              : };
     154              : 
     155              : 
     156              : /**
     157              :  * @enum DepartPosDefinition
     158              :  * @brief Possible ways to choose the departure position
     159              :  */
     160              : enum class DepartPosDefinition {
     161              :     /// @brief No information given; use default
     162              :     DEFAULT,
     163              :     /// @brief The position is given
     164              :     GIVEN,
     165              :     /// @brief The position is set by the vehroute device
     166              :     GIVEN_VEHROUTE,
     167              :     /// @brief A random position is chosen
     168              :     RANDOM,
     169              :     /// @brief A free position is chosen
     170              :     FREE,
     171              :     /// @brief Back-at-zero position
     172              :     BASE,
     173              :     /// @brief Insert behind the last vehicle as close as possible to still allow the specified departSpeed. Fallback to DepartPosDefinition::BASE if there is no vehicle on the departLane yet.
     174              :     LAST,
     175              :     /// @brief If a fixed number of random choices fails, a free position is chosen
     176              :     RANDOM_FREE,
     177              :     /// @brief The position may be chosen freely in a polygon defined by a taz
     178              :     RANDOM_LOCATION,
     179              :     /// @brief depart position for a split vehicle is in front of the continuing vehicle
     180              :     SPLIT_FRONT,
     181              :     /// @brief depart position is endPos of first stop
     182              :     STOP
     183              : };
     184              : 
     185              : 
     186              : /**
     187              :  * @enum DepartPosLatDefinition
     188              :  * @brief Possible ways to choose the lateral departure position
     189              :  */
     190              : enum class DepartPosLatDefinition {
     191              :     /// @brief No information given; use default
     192              :     DEFAULT,
     193              :     /// @brief The position is given
     194              :     GIVEN,
     195              :     /// @brief The position is set by the vehroute device
     196              :     GIVEN_VEHROUTE,
     197              :     /// @brief At the rightmost side of the lane
     198              :     RIGHT,
     199              :     /// @brief At the center of the lane
     200              :     CENTER,
     201              :     /// @brief At the leftmost side of the lane
     202              :     LEFT,
     203              :     /// @brief The lateral position is chosen randomly
     204              :     RANDOM,
     205              :     /// @brief A free lateral position is chosen
     206              :     FREE,
     207              :     /// @brief If a fixed number of random choices fails, a free lateral position is chosen
     208              :     RANDOM_FREE
     209              : };
     210              : 
     211              : 
     212              : /**
     213              :  * @enum DepartSpeedDefinition
     214              :  * @brief Possible ways to choose the departure speed
     215              :  */
     216              : enum class DepartSpeedDefinition {
     217              :     /// @brief No information given; use default
     218              :     DEFAULT,
     219              :     /// @brief The speed is given
     220              :     GIVEN,
     221              :     /// @brief The speed is set by the vehroute device
     222              :     GIVEN_VEHROUTE,
     223              :     /// @brief The speed is chosen randomly
     224              :     RANDOM,
     225              :     /// @brief The maximum safe speed is used
     226              :     MAX,
     227              :     /// @brief The maximum lane speed is used (speedLimit * speedFactor)
     228              :     DESIRED,
     229              :     /// @brief The maximum lane speed is used (speedLimit)
     230              :     LIMIT,
     231              :     /// @brief The speed of the last vehicle. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on the departLane yet.
     232              :     LAST,
     233              :     /// @brief The average speed on the lane. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on the departLane yet.
     234              :     AVG
     235              : };
     236              : 
     237              : 
     238              : /**
     239              :  * @enum RouteIndexDefinition
     240              :  * @brief Possible ways to choose the departure and arrival edge
     241              :  */
     242              : enum class RouteIndexDefinition {
     243              :     /// @brief No information given; use default
     244              :     DEFAULT,
     245              :     /// @brief The edge index is given
     246              :     GIVEN,
     247              :     /// @brief The edge is chosen randomly
     248              :     RANDOM,
     249              : };
     250              : 
     251              : 
     252              : /**
     253              :  * @enum ArrivalLaneDefinition
     254              :  * @brief Possible ways to choose the arrival lane
     255              :  */
     256              : enum class ArrivalLaneDefinition {
     257              :     /// @brief No information given; use default
     258              :     DEFAULT = 0,
     259              :     /// @brief The current lane shall be used
     260              :     CURRENT = 1,
     261              :     /// @brief The arrival lane is given
     262              :     GIVEN = 2,
     263              :     /// @brief The lane is chosen randomly
     264              :     RANDOM = 3,
     265              :     /// @brief The rightmost lane the vehicle may use
     266              :     FIRST_ALLOWED = 4
     267              : };
     268              : 
     269              : 
     270              : /**
     271              :  * @enum ArrivalPosDefinition
     272              :  * @brief Possible ways to choose the arrival position
     273              :  */
     274              : enum class ArrivalPosDefinition {
     275              :     /// @brief No information given; use default
     276              :     DEFAULT,
     277              :     /// @brief The arrival position is given
     278              :     GIVEN,
     279              :     /// @brief The arrival position is chosen randomly
     280              :     RANDOM,
     281              :     /// @brief Half the road length
     282              :     CENTER,
     283              :     /// @brief The maximum arrival position is used
     284              :     MAX
     285              : };
     286              : 
     287              : 
     288              : /**
     289              :  * @enum ArrivalPosLatDefinition
     290              :  * @brief Possible ways to choose the lateral arrival position
     291              :  */
     292              : enum class ArrivalPosLatDefinition {
     293              :     /// @brief No information given; use default
     294              :     DEFAULT,
     295              :     /// @brief The position is given
     296              :     GIVEN,
     297              :     /// @brief At the rightmost side of the lane
     298              :     RIGHT,
     299              :     /// @brief At the center of the lane
     300              :     CENTER,
     301              :     /// @brief At the leftmost side of the lane
     302              :     LEFT
     303              : };
     304              : 
     305              : 
     306              : /**
     307              :  * @enum ArrivalSpeedDefinition
     308              :  * @brief Possible ways to choose the arrival speed
     309              :  */
     310              : enum class ArrivalSpeedDefinition {
     311              :     /// @brief No information given; use default
     312              :     DEFAULT,
     313              :     /// @brief The speed is given
     314              :     GIVEN,
     315              :     /// @brief The current speed is used
     316              :     CURRENT
     317              : };
     318              : 
     319              : 
     320              : // ===========================================================================
     321              : // struct definitions
     322              : // ===========================================================================
     323              : /**
     324              :  * @class SUMOVehicleParameter
     325              :  * @brief Structure representing possible vehicle parameter
     326              :  *
     327              :  * When used within a vehicle, parameter are usually const except for selected items
     328              :  *  adaptable via TraCI which are flagged as mutable below
     329              :  * The fields yielding with "Procedure" describe whether the according value
     330              :  *  shall be used or another procedure is used to choose the value.
     331              :  * @see DepartLaneDefinition
     332              :  * @see DepartPosDefinition
     333              :  * @see DepartSpeedDefinition
     334              :  */
     335              : class SUMOVehicleParameter : public Parameterised {
     336              : public:
     337              :     /** @brief Constructor
     338              :      *
     339              :      * Initialises the structure with default values
     340              :      */
     341              :     SUMOVehicleParameter();
     342              : 
     343              :     /// @brief Destructor
     344              :     virtual ~SUMOVehicleParameter();
     345              : 
     346              :     /** @struct Stop
     347              :      * @brief Definition of vehicle stop (position and duration)
     348              :      */
     349              :     class Stop : public Parameterised {
     350              :     public:
     351              :         /// @brief Destructor
     352      1978470 :         virtual ~Stop() {}
     353              : 
     354              :         /** @brief Writes the stop as XML
     355              :          *
     356              :          * @param[in, out] dev The device to write into
     357              :          * @exception IOError not yet implemented
     358              :          */
     359              :         void write(OutputDevice& dev, const bool close = true, const bool writeTagAndParents = true) const;
     360              : 
     361              :         /// @brief return list of stopping place ids
     362              :         std::vector<std::string> getStoppingPlaceIDs() const;
     363              : 
     364              :         /// @brief write trigger attribute
     365              :         std::vector<std::string> getTriggers() const;
     366              : 
     367              :         /// @brief The edge to stop at
     368              :         std::string edge;
     369              : 
     370              :         /// @brief The lane to stop at
     371              :         std::string lane;
     372              : 
     373              :         /// @brief (Optional) bus stop if one is assigned to the stop
     374              :         std::string busstop;
     375              : 
     376              :         /// @brief (Optional) container stop if one is assigned to the stop
     377              :         std::string containerstop;
     378              : 
     379              :         /// @brief (Optional) parking area if one is assigned to the stop
     380              :         std::string parkingarea;
     381              : 
     382              :         /// @brief (Optional) charging station if one is assigned to the stop
     383              :         std::string chargingStation;
     384              : 
     385              :         /// @brief (Optional) overhead line segment if one is assigned to the stop
     386              :         std::string overheadWireSegment;
     387              : 
     388              :         /// @brief The stopping position start
     389              :         double startPos = 0.;
     390              : 
     391              :         /// @brief The stopping position end
     392              :         double endPos = 0.;
     393              : 
     394              :         /// @brief The (expected) time at which the vehicle reaches the stop
     395              :         SUMOTime arrival = -1;
     396              : 
     397              :         /// @brief The stopping duration
     398              :         SUMOTime duration = -1;
     399              : 
     400              :         /// @brief The time at which the vehicle may continue its journey
     401              :         SUMOTime until = -1;
     402              : 
     403              :         /// @brief The maximum time extension for boarding / loading
     404              :         SUMOTime extension = -1;
     405              : 
     406              :         /// @brief The earliest pickup time for a taxi stop
     407              :         SUMOTime waitUntil = -1;
     408              : 
     409              :         /// @brief whether an arriving person lets the vehicle continue
     410              :         bool triggered = false;
     411              : 
     412              :         /// @brief whether an arriving container lets the vehicle continue
     413              :         bool containerTriggered = false;
     414              : 
     415              :         /// @brief whether an joined vehicle lets this vehicle continue
     416              :         bool joinTriggered = false;
     417              : 
     418              :         /// @brief whether the vehicle is removed from the net while stopping
     419              :         ParkingType parking = ParkingType::ONROAD;
     420              : 
     421              :         /// @brief IDs of persons the vehicle has to wait for until departing
     422              :         std::set<std::string> awaitedPersons;
     423              : 
     424              :         /// @brief IDs of persons or containers that may board/load at this stop
     425              :         std::set<std::string> permitted;
     426              : 
     427              :         /// @brief IDs of containers the vehicle has to wait for until departing
     428              :         std::set<std::string> awaitedContainers;
     429              : 
     430              :         /// @brief enable or disable friendly position (used by netedit)
     431              :         bool friendlyPos = false;
     432              : 
     433              :         /// @brief act Type (only used by Persons) (used by netedit)
     434              :         std::string actType;
     435              : 
     436              :         /// @brief id of the trip within a cyclical public transport route
     437              :         std::string tripId;
     438              : 
     439              :         /// @brief the new line id of the trip within a cyclical public transport route
     440              :         std::string line;
     441              : 
     442              :         /// @brief the id of the vehicle (train portion) that splits of upon reaching this stop
     443              :         std::string split;
     444              : 
     445              :         /// @brief the id of the vehicle (train portion) to which this vehicle shall be joined
     446              :         std::string join;
     447              : 
     448              :         /// @brief the speed at which this stop counts as reached (waypoint mode)
     449              :         double speed = 0.;
     450              : 
     451              :         /// @brief the lateral offset when stopping
     452              :         double posLat = INVALID_DOUBLE;
     453              : 
     454              :         /// @brief whether the stop may be skipped
     455              :         bool onDemand = false;
     456              : 
     457              :         /// @brief transfer time if there shall be a jump from this stop to the next route edge
     458              :         SUMOTime jump = -1;
     459              : 
     460              :         /// @brief the time at which this stop was reached
     461              :         mutable SUMOTime started = -1;
     462              : 
     463              :         /// @brief the time at which this stop was ended
     464              :         mutable SUMOTime ended = -1;
     465              : 
     466              :         /// @brief lanes and positions connected to this stop (only used by duarouter where Stop is used to store stopping places)
     467              :         std::vector<std::tuple<std::string, double, double> > accessPos;
     468              : 
     469              :         /// @brief at which position in the stops list
     470              :         int index = 0;
     471              : 
     472              :         /// @brief at which position within the route (only used for state saving)
     473              :         mutable int routeIndex = 0;
     474              : 
     475              :         /// @brief Information for the output which parameter were set
     476              :         int parametersSet = 0;
     477              : 
     478              :         /// @brief Whether this stop was triggered by a collision
     479              :         bool collision = false;
     480              : 
     481              :         /// @brief Whether this stop was triggered by a car failure / mechanical problem / lack of energy
     482              :         bool breakDown = false;
     483              : 
     484              :         /// @brief return flags as per Vehicle::getStops
     485              :         int getFlags() const;
     486              :     };
     487              : 
     488              : 
     489              :     /** @brief Returns whether the given parameter was set
     490              :      * @param[in] what The parameter which one asks for
     491              :      * @return Whether the given parameter was set
     492              :      */
     493              :     bool wasSet(long long int what) const {
     494   1366989995 :         return (parametersSet & what) != 0;
     495              :     }
     496              : 
     497              :     /** @brief Writes the parameters as a beginning element
     498              :      *
     499              :      * @param[in, out] dev The device to write into
     500              :      * @param[in] oc The options to get defaults from
     501              :      * @param[in] altTag The "root" tag to write (defaults to vehicle)
     502              :      * @param[in] typeID The typeID to write (defaults to member vtypeid)
     503              :      * @exception IOError not yet implemented
     504              :      */
     505              :     void write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag altTag = SUMO_TAG_VEHICLE, const std::string& typeID = "") const;
     506              : 
     507              :     /** @brief Returns whether the defaults shall be used
     508              :      * @param[in] oc The options to get the options from
     509              :      * @param[in] optionName The name of the option to determine whether its value shall be used
     510              :      * @return Whether the option is set and --defaults-override was set
     511              :      */
     512              :     bool defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const;
     513              : 
     514              :     /// @name Depart/arrival-attributes verification
     515              :     /// @{
     516              :     /** @brief Validates a given depart value
     517              :      * @param[in] val The depart value to parse
     518              :      * @param[in] element The name of the type of the parsed element, for building the error message
     519              :      * @param[in] id The id of the parsed element, for building the error message
     520              :      * @param[out] depart The parsed depart time, if given
     521              :      * @param[out] dd The parsed departProcedure definition
     522              :      * @param[out] error Error message, if an error occures
     523              :      * @return Whether the given value is a valid depart definition
     524              :      */
     525              :     static bool parseDepart(const std::string& val, const std::string& element, const std::string& id,
     526              :                             SUMOTime& depart, DepartDefinition& dd, std::string& error, const std::string& attr = "departure");
     527              : 
     528              :     /** @brief Validates a given departLane value
     529              :      * @param[in] val The departLane value to parse
     530              :      * @param[in] element The name of the type of the parsed element, for building the error message
     531              :      * @param[in] id The id of the parsed element, for building the error message
     532              :      * @param[out] lane The parsed lane, if given
     533              :      * @param[out] dld The parsed departLane definition
     534              :      * @param[out] error Error message, if an error occures
     535              :      * @return Whether the given value is a valid departLane definition
     536              :      */
     537              :     static bool parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
     538              :                                 int& lane, DepartLaneDefinition& dld, std::string& error);
     539              : 
     540              :     /** @brief Validates a given departPos value
     541              :      * @param[in] val The departPos value to parse
     542              :      * @param[in] element The name of the type of the parsed element, for building the error message
     543              :      * @param[in] id The id of the parsed element, for building the error message
     544              :      * @param[out] pos The parsed position, if given
     545              :      * @param[out] dpd The parsed departPos definition
     546              :      * @param[out] error Error message, if an error occures
     547              :      * @return Whether the given value is a valid departPos definition
     548              :      */
     549              :     static bool parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
     550              :                                double& pos, DepartPosDefinition& dpd, std::string& error);
     551              : 
     552              :     /** @brief Validates a given departPosLat value
     553              :      * @param[in] val The departPosLat value to parse
     554              :      * @param[in] element The name of the type of the parsed element, for building the error message
     555              :      * @param[in] id The id of the parsed element, for building the error message
     556              :      * @param[out] pos The parsed position, if given
     557              :      * @param[out] dpd The parsed departPosLat definition
     558              :      * @param[out] error Error message, if an error occures
     559              :      * @return Whether the given value is a valid departPosLat definition
     560              :      */
     561              :     static bool parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
     562              :                                   double& pos, DepartPosLatDefinition& dpd, std::string& error);
     563              : 
     564              :     /** @brief Validates a given departSpeed value
     565              :      * @param[in] val The departSpeed value to parse
     566              :      * @param[in] element The name of the type of the parsed element, for building the error message
     567              :      * @param[in] id The id of the parsed element, for building the error message
     568              :      * @param[out] speed The parsed speed, if given
     569              :      * @param[out] dsd The parsed departSpeed definition
     570              :      * @param[out] error Error message, if an error occures
     571              :      * @return Whether the given value is a valid departSpeed definition
     572              :      */
     573              :     static bool parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
     574              :                                  double& speed, DepartSpeedDefinition& dsd, std::string& error);
     575              : 
     576              :     /** @brief Validates a given departEdge or arrivalEdge value
     577              :      * @param[in] val The departEdge value to parse
     578              :      * @param[in] element The name of the type of the parsed element, for building the error message
     579              :      * @param[in] id The id of the parsed element, for building the error message
     580              :      * @param[out] edgeIndex The parsed edge index, if given
     581              :      * @param[out] ded The parsed departEdge definition
     582              :      * @param[out] error Error message, if an error occures
     583              :      * @return Whether the given value is a valid departEdge definition
     584              :      */
     585              :     static bool parseRouteIndex(const std::string& val, const std::string& element, const std::string& id,
     586              :                                 const SumoXMLAttr attr,
     587              :                                 int& edgeIndex, RouteIndexDefinition& rid, std::string& error);
     588              : 
     589              :     /** @brief Validates a given arrivalLane value
     590              :      * @param[in] val The arrivalLane value to parse
     591              :      * @param[in] element The name of the type of the parsed element, for building the error message
     592              :      * @param[in] id The id of the parsed element, for building the error message
     593              :      * @param[out] lane The parsed lane, if given
     594              :      * @param[out] ald The parsed arrivalLane definition
     595              :      * @param[out] error Error message, if an error occures
     596              :      * @return Whether the given value is a valid arrivalLane definition
     597              :      */
     598              :     static bool parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
     599              :                                  int& lane, ArrivalLaneDefinition& ald, std::string& error);
     600              : 
     601              :     /** @brief Validates a given arrivalPos value
     602              :      * @param[in] val The arrivalPos value to parse
     603              :      * @param[in] element The name of the type of the parsed element, for building the error message
     604              :      * @param[in] id The id of the parsed element, for building the error message
     605              :      * @param[out] pos The parsed position, if given
     606              :      * @param[out] apd The parsed arrivalPos definition
     607              :      * @param[out] error Error message, if an error occures
     608              :      * @return Whether the given value is a valid arrivalPos definition
     609              :      */
     610              :     static bool parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
     611              :                                 double& pos, ArrivalPosDefinition& apd, std::string& error);
     612              : 
     613              :     /** @brief Validates a given arrivalPosLat value
     614              :      * @param[in] val The arrivalPosLat value to parse
     615              :      * @param[in] element The name of the type of the parsed element, for building the error message
     616              :      * @param[in] id The id of the parsed element, for building the error message
     617              :      * @param[out] pos The parsed position, if given
     618              :      * @param[out] apd The parsed arrivalPosLat definition
     619              :      * @param[out] error Error message, if an error occures
     620              :      * @return Whether the given value is a valid arrivalPosLat definition
     621              :      */
     622              :     static bool parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
     623              :                                    double& pos, ArrivalPosLatDefinition& apd, std::string& error);
     624              : 
     625              : 
     626              :     /** @brief Validates a given arrivalSpeed value
     627              :      * @param[in] val The arrivalSpeed value to parse
     628              :      * @param[in] element The name of the type of the parsed element, for building the error message
     629              :      * @param[in] id The id of the parsed element, for building the error message
     630              :      * @param[out] speed The parsed speed, if given
     631              :      * @param[out] asd The parsed arrivalSpeed definition
     632              :      * @param[out] error Error message, if an error occures
     633              :      * @return Whether the given value is a valid arrivalSpeed definition
     634              :      */
     635              :     static bool parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
     636              :                                   double& speed, ArrivalSpeedDefinition& asd, std::string& error);
     637              :     /// @}
     638              : 
     639              :     /** @brief Interprets negative edge positions and fits them onto a given edge
     640              :      * @param[in] pos The position to be interpreted
     641              :      * @param[in] maximumValue The maximum allowed value (edge length)
     642              :      * @param[in] attr The attribute from which the value originated
     643              :      * @param[in] id The id of the object to which this attribute belongs
     644              :      * @return Whether the interpreted position
     645              :      */
     646              :     static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id, bool silent = false);
     647              : 
     648              :     /** @brief Validates a given person modes value
     649              :      * @param[in] modes The modes value to parse
     650              :      * @param[in] element The name of the type of the parsed element, for building the error message
     651              :      * @param[in] id The id of the parsed element, for building the error message
     652              :      * @param[out] modeSet The parsed modes definition
     653              :      * @param[out] error Error message, if an error occures
     654              :      * @return Whether the given value is a valid arrivalSpeed definition
     655              :      */
     656              :     static bool parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error);
     657              : 
     658              :     /// @brief parses stop trigger values
     659              :     static void parseStopTriggers(const std::vector<std::string>& triggers, bool expectTrigger, Stop& stop);
     660              : 
     661              :     /// @brief parses parking type value
     662              :     static ParkingType parseParkingType(const std::string& value);
     663              : 
     664              :     /// @brief parses insertion checks
     665              :     static int parseInsertionChecks(const std::string& value);
     666              : 
     667              :     /// @brief The vehicle tag
     668              :     SumoXMLTag tag;
     669              : 
     670              :     /// @brief The vehicle's id
     671              :     std::string id;
     672              : 
     673              :     /// @brief The vehicle's route id
     674              :     std::string routeid;
     675              : 
     676              :     /// @brief The vehicle's type id
     677              :     std::string vtypeid;
     678              : 
     679              :     /// @brief The vehicle's color, TraCI may change this
     680              :     mutable RGBColor color;
     681              : 
     682              :     /// @name Departure definition
     683              :     /// @{
     684              :     /// @brief The vehicle's departure time
     685              :     SUMOTime depart;
     686              : 
     687              :     /// @brief Information how the vehicle shall choose the depart time
     688              :     DepartDefinition departProcedure;
     689              : 
     690              :     /// @brief (optional) The lane the vehicle shall depart from (index in edge)
     691              :     int departLane;
     692              : 
     693              :     /// @brief Information how the vehicle shall choose the lane to depart from
     694              :     DepartLaneDefinition departLaneProcedure;
     695              : 
     696              :     /// @brief (optional) The position the vehicle shall depart from
     697              :     double departPos;
     698              : 
     699              :     /// @brief Information how the vehicle shall choose the departure position
     700              :     DepartPosDefinition departPosProcedure;
     701              : 
     702              :     /// @brief (optional) The lateral position the vehicle shall depart from
     703              :     double departPosLat;
     704              : 
     705              :     /// @brief Information how the vehicle shall choose the lateral departure position
     706              :     DepartPosLatDefinition departPosLatProcedure;
     707              : 
     708              :     /// @brief (optional) The initial speed of the vehicle
     709              :     double departSpeed;
     710              : 
     711              :     /// @brief Information how the vehicle's initial speed shall be chosen
     712              :     DepartSpeedDefinition departSpeedProcedure;
     713              : 
     714              :     /// @brief (optional) The initial edge within the route of the vehicle
     715              :     int departEdge;
     716              : 
     717              :     /// @brief Information how the vehicle's initial edge shall be chosen
     718              :     RouteIndexDefinition departEdgeProcedure;
     719              : 
     720              :     /// @}
     721              : 
     722              :     /// @name Arrival definition
     723              :     /// @{
     724              :     /// @brief (optional) The lane the vehicle shall arrive on (not used yet)
     725              :     int arrivalLane;
     726              : 
     727              :     /// @brief Information how the vehicle shall choose the lane to arrive on
     728              :     ArrivalLaneDefinition arrivalLaneProcedure;
     729              : 
     730              :     /// @brief (optional) The position the vehicle shall arrive on
     731              :     double arrivalPos;
     732              : 
     733              :     /// @brief Information how the vehicle shall choose the arrival position
     734              :     ArrivalPosDefinition arrivalPosProcedure;
     735              : 
     736              :     /// @brief (optional) The lateral position the vehicle shall arrive on
     737              :     double arrivalPosLat;
     738              : 
     739              :     /// @brief Information how the vehicle shall choose the lateral arrival position
     740              :     ArrivalPosLatDefinition arrivalPosLatProcedure;
     741              : 
     742              :     /// @brief (optional) The final speed of the vehicle (not used yet)
     743              :     double arrivalSpeed;
     744              : 
     745              :     /// @brief Information how the vehicle's end speed shall be chosen
     746              :     ArrivalSpeedDefinition arrivalSpeedProcedure;
     747              : 
     748              :     /// @brief (optional) The final edge within the route of the vehicle
     749              :     int arrivalEdge;
     750              : 
     751              :     /// @brief Information how the vehicle's final edge shall be chosen
     752              :     RouteIndexDefinition arrivalEdgeProcedure;
     753              : 
     754              :     /// @}
     755              : 
     756              :     /// @name Repetition definition
     757              :     /// @{
     758              :     /// @brief The number of times the vehicle shall be repeatedly inserted
     759              :     int repetitionNumber;
     760              : 
     761              :     /// @brief The number of times the vehicle was already inserted
     762              :     int repetitionsDone;
     763              : 
     764              :     /// @brief The time offset between vehicle reinsertions
     765              :     SUMOTime repetitionOffset;
     766              : 
     767              :     /// @brief The offset between depart and the time for the next vehicle insertions
     768              :     SUMOTime repetitionTotalOffset;
     769              : 
     770              :     /// @brief The probability for emitting a vehicle per second
     771              :     double repetitionProbability;
     772              : 
     773              :     /// @brief The rate for emitting vehicles with a poisson distribution
     774              :     double poissonRate;
     775              : 
     776              :     /// @brief The time at which the flow ends (only needed when using repetitionProbability)
     777              :     SUMOTime repetitionEnd;
     778              : 
     779              :     /// @}
     780              : 
     781              :     /// @brief The vehicle's line (mainly for public transport)
     782              :     mutable std::string line;
     783              : 
     784              :     /// @brief The vehicle's origin zone (district)
     785              :     std::string fromTaz;
     786              : 
     787              :     /// @brief The vehicle's destination zone (district)
     788              :     std::string toTaz;
     789              : 
     790              :     /// @brief List of the stops the vehicle will make, TraCI may add entries here
     791              :     mutable std::vector<Stop> stops;
     792              : 
     793              :     /// @brief List of the via-edges the vehicle must visit
     794              :     mutable std::vector<std::string> via;
     795              : 
     796              :     /// @brief The parking access rights
     797              :     std::vector<std::string> parkingBadges;
     798              : 
     799              :     /// @brief The modes a person or container can use
     800              :     SVCPermissions modes;
     801              : 
     802              :     /// @brief The types of usable (auto-generated) vehicles for a person / container
     803              :     std::string vTypes;
     804              : 
     805              :     /// @brief The static number of persons in the vehicle when it departs (not including boarding persons)
     806              :     int personNumber;
     807              : 
     808              :     /// @brief The static number of containers in the vehicle when it departs
     809              :     int containerNumber;
     810              : 
     811              :     /// @brief individual speedFactor (overriding distribution from vType)
     812              :     double speedFactor;
     813              : 
     814              :     /// @brief speed (used by calibrator flows
     815              :     double calibratorSpeed;
     816              : 
     817              :     /// @brief bitset of InsertionCheck
     818              :     int insertionChecks;
     819              : 
     820              :     /// @brief Information for the router which parameter were set, TraCI may modify this (when changing color)
     821              :     mutable long long int parametersSet;
     822              : 
     823              : public:
     824              :     /// @brief increment flow
     825              :     void incrementFlow(double scale, SumoRNG* rng = nullptr);
     826              : 
     827              : protected:
     828              :     /// @brief obtain depart parameter in string format
     829              :     std::string getDepart() const;
     830              : 
     831              :     /// @brief obtain depart lane parameter in string format
     832              :     std::string getDepartLane() const;
     833              : 
     834              :     /// @brief obtain depart pos parameter in string format
     835              :     std::string getDepartPos() const;
     836              : 
     837              :     /// @brief obtain depart pos lat parameter in string format
     838              :     std::string getDepartPosLat() const;
     839              : 
     840              :     /// @brief obtain depart speed parameter in string format
     841              :     std::string getDepartSpeed() const;
     842              : 
     843              :     /// @brief obtain depart edge parameter in string format
     844              :     std::string getDepartEdge() const;
     845              : 
     846              :     /// @brief obtain arrival lane parameter in string format
     847              :     std::string getArrivalLane() const;
     848              : 
     849              :     /// @brief obtain arrival pos parameter in string format
     850              :     std::string getArrivalPos() const;
     851              : 
     852              :     /// @brief obtain arrival pos lat parameter in string format
     853              :     std::string getArrivalPosLat() const;
     854              : 
     855              :     /// @brief obtain arrival speed parameter in string format
     856              :     std::string getArrivalSpeed() const;
     857              : 
     858              :     /// @brief obtain arrival edge parameter in string format
     859              :     std::string getArrivalEdge() const;
     860              : 
     861              :     /// @brief get insertion checks in string format
     862              :     std::string getInsertionChecks() const;
     863              : 
     864              :     /// @brief check if given insertion checks are valid
     865              :     bool areInsertionChecksValid(const std::string& value) const;
     866              : 
     867              : };
        

Generated by: LCOV version 2.0-1