LCOV - code coverage report
Current view: top level - src/utils/vehicle - SUMOVTypeParameter.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 91.9 % 596 548
Test Date: 2024-11-20 15:55:46 Functions: 88.0 % 25 22

            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    SUMOVTypeParameter.cpp
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Jakob Erdmann
      17              : /// @author  Michael Behrisch
      18              : /// @date    10.09.2009
      19              : ///
      20              : // Structure representing possible vehicle parameter
      21              : /****************************************************************************/
      22              : #include <config.h>
      23              : 
      24              : #include <algorithm>
      25              : #include <utils/vehicle/SUMOVTypeParameter.h>
      26              : #include <utils/common/ToString.h>
      27              : #include <utils/common/StringUtils.h>
      28              : #include <utils/common/MsgHandler.h>
      29              : #include <utils/iodevices/OutputDevice.h>
      30              : #include <utils/options/OptionsCont.h>
      31              : #include <utils/xml/SUMOXMLDefinitions.h>
      32              : #include <utils/emissions/PollutantsInterface.h>
      33              : 
      34              : #define EMPREFIX std::string("HBEFA3/")
      35              : #define TTT_UNSET SUMOTime_MIN
      36              : 
      37              : // ===========================================================================
      38              : // static value definitions
      39              : // ===========================================================================
      40              : std::set<SumoXMLAttr> SUMOVTypeParameter::AllowedJMAttrs({
      41              :     SUMO_ATTR_JM_CROSSING_GAP,
      42              :     SUMO_ATTR_JM_DRIVE_AFTER_YELLOW_TIME,
      43              :     SUMO_ATTR_JM_DRIVE_AFTER_RED_TIME,
      44              :     SUMO_ATTR_JM_DRIVE_RED_SPEED,
      45              :     SUMO_ATTR_JM_IGNORE_KEEPCLEAR_TIME,
      46              :     SUMO_ATTR_JM_IGNORE_FOE_SPEED,
      47              :     SUMO_ATTR_JM_IGNORE_FOE_PROB,
      48              :     SUMO_ATTR_JM_IGNORE_JUNCTION_FOE_PROB,
      49              :     SUMO_ATTR_JM_SIGMA_MINOR,
      50              :     SUMO_ATTR_JM_STOPLINE_GAP,
      51              :     SUMO_ATTR_JM_STOPLINE_GAP_MINOR,
      52              :     SUMO_ATTR_JM_TIMEGAP_MINOR,
      53              :     SUMO_ATTR_JM_EXTRA_GAP,
      54              :     SUMO_ATTR_JM_ADVANCE,
      55              :     SUMO_ATTR_JM_STOPSIGN_WAIT,
      56              :     SUMO_ATTR_JM_ALLWAYSTOP_WAIT,
      57              : });
      58              : 
      59              : 
      60              : // ===========================================================================
      61              : // member method definitions
      62              : // ===========================================================================
      63              : 
      64       718851 : SUMOVTypeParameter::VClassDefaultValues::VClassDefaultValues(SUMOVehicleClass vclass) :
      65       718851 :     length(getDefaultVehicleLength(vclass)),
      66       718851 :     minGap(2.5),
      67       718851 :     minGapLat(0.6),
      68       718851 :     maxSpeed(200. / 3.6),
      69       718851 :     desiredMaxSpeed(10000 / 3.6), // backward-compatibility: do not influence speeds by default
      70       718851 :     width(1.8),
      71       718851 :     height(1.5),
      72       718851 :     shape(SUMOVehicleShape::UNKNOWN),
      73      1437702 :     emissionClass(PollutantsInterface::getClassByName(EMPREFIX + "PC_G_EU4", vclass)),
      74       718851 :     mass(1500.),
      75       718851 :     speedFactor("normc", 1.0, 0.0, 0.2, 2.0),
      76       718851 :     personCapacity(4),
      77       718851 :     containerCapacity(0),
      78       718851 :     osgFile("car-normal-citrus.obj"),
      79       718851 :     carriageLength(-1),
      80       718851 :     locomotiveLength(-1),
      81       718851 :     carriageDoors(2),
      82       718851 :     latAlignmentProcedure(LatAlignmentDefinition::CENTER) {
      83              :     // update default values
      84       718851 :     switch (vclass) {
      85       105370 :         case SVC_PEDESTRIAN:
      86       105370 :             minGap = 0.25;
      87       105370 :             maxSpeed = 37.58 / 3.6; // Usain Bolt
      88       105370 :             desiredMaxSpeed = DEFAULT_PEDESTRIAN_SPEED;
      89       105370 :             width = 0.478;
      90       105370 :             height = 1.719;
      91       105370 :             shape = SUMOVehicleShape::PEDESTRIAN;
      92              :             osgFile = "humanResting.obj";
      93       210740 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass);
      94       105370 :             mass = 70.; // https://en.wikipedia.org/wiki/Human_body_weight for Europe
      95       105370 :             speedFactor.getParameter()[1] = 0.1;
      96       105370 :             break;
      97           24 :         case SVC_WHEELCHAIR:
      98           24 :             minGap = 0.5;
      99           24 :             maxSpeed = 30.0 / 3.6; // https://en.wikipedia.org/wiki/Wheelchair_racing
     100           24 :             desiredMaxSpeed = DEFAULT_PEDESTRIAN_SPEED;
     101           24 :             width = 0.8;
     102           24 :             height = 1.5;
     103           24 :             shape = SUMOVehicleShape::PEDESTRIAN;
     104              :             osgFile = "humanResting.obj";
     105           48 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass);
     106           24 :             mass = 90.; //
     107           24 :             speedFactor.getParameter()[1] = 0.1;
     108           24 :             break;
     109        53559 :         case SVC_BICYCLE:
     110        53559 :             minGap = 0.5;
     111        53559 :             minGapLat = 0.35;
     112        53559 :             maxSpeed = 50. / 3.6;
     113        53559 :             desiredMaxSpeed = DEFAULT_BICYCLE_SPEED;
     114        53559 :             width = 0.65;
     115        53559 :             height = 1.7;
     116        53559 :             shape = SUMOVehicleShape::BICYCLE;
     117        53559 :             personCapacity = 1;
     118       107118 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass);
     119        53559 :             mass = 10.;
     120        53559 :             speedFactor.getParameter()[1] = 0.1;
     121        53559 :             latAlignmentProcedure = LatAlignmentDefinition::RIGHT;
     122        53559 :             break;
     123           24 :         case SVC_SCOOTER:
     124           24 :             minGap = 0.5;
     125           24 :             minGapLat = 0.35;
     126           24 :             maxSpeed = 25 / 3.6;
     127           24 :             desiredMaxSpeed = DEFAULT_BICYCLE_SPEED;
     128           24 :             width = 0.5;
     129           24 :             height = 1.7;
     130           24 :             shape = SUMOVehicleShape::SCOOTER;
     131           24 :             personCapacity = 1;
     132           48 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass);
     133           24 :             mass = 10.;
     134           24 :             speedFactor.getParameter()[1] = 0.1;
     135           24 :             latAlignmentProcedure = LatAlignmentDefinition::RIGHT;
     136           24 :             break;
     137          118 :         case SVC_MOPED:
     138          118 :             maxSpeed = 60. / 3.6;
     139          118 :             width = 0.78;
     140          118 :             height = 1.7;
     141          118 :             shape = SUMOVehicleShape::MOPED;
     142          118 :             personCapacity = 1;
     143          236 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "LDV_G_EU6", vclass);
     144          118 :             mass = 80.;
     145          118 :             speedFactor.getParameter()[1] = 0.1;
     146          118 :             break;
     147          139 :         case SVC_MOTORCYCLE:
     148          139 :             width = 0.9;
     149          139 :             height = 1.5;
     150          139 :             shape = SUMOVehicleShape::MOTORCYCLE;
     151          139 :             personCapacity = 1;
     152          278 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "LDV_G_EU6", vclass);
     153          139 :             mass = 200.;
     154          139 :             speedFactor.getParameter()[1] = 0.1;
     155          139 :             break;
     156          481 :         case SVC_TRUCK:
     157          481 :             maxSpeed = 130. / 3.6;
     158          481 :             width = 2.4;
     159          481 :             height = 2.4;
     160          481 :             shape = SUMOVehicleShape::TRUCK;
     161              :             osgFile = "car-microcargo-citrus.obj";
     162          481 :             personCapacity = 2;
     163          481 :             containerCapacity = 1;
     164          962 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "HDV", vclass);
     165          481 :             mass = 12000.;
     166          481 :             speedFactor.getParameter()[1] = 0.05;
     167          481 :             break;
     168           58 :         case SVC_TRAILER:
     169           58 :             maxSpeed = 130. / 3.6;
     170           58 :             width = 2.55;
     171           58 :             height = 4.;
     172           58 :             shape = SUMOVehicleShape::TRUCK_1TRAILER;
     173              :             osgFile = "car-microcargo-citrus.obj";
     174           58 :             personCapacity = 2;
     175           58 :             containerCapacity = 2;
     176          116 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "HDV", vclass);
     177           58 :             mass = 15000.;
     178           58 :             speedFactor.getParameter()[1] = 0.05;
     179           58 :             break;
     180          983 :         case SVC_BUS:
     181          983 :             maxSpeed = 100. / 3.6;
     182          983 :             width = 2.5;
     183          983 :             height = 3.4;
     184          983 :             shape = SUMOVehicleShape::BUS;
     185              :             osgFile = "car-minibus-citrus.obj";
     186          983 :             personCapacity = 85;
     187         1966 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "Bus", vclass);
     188          983 :             mass = 7500.;
     189          983 :             break;
     190           41 :         case SVC_COACH:
     191           41 :             maxSpeed = 100. / 3.6;
     192           41 :             width = 2.6;
     193           41 :             height = 4.;
     194           41 :             shape = SUMOVehicleShape::BUS_COACH;
     195              :             osgFile = "car-minibus-citrus.obj";
     196           41 :             personCapacity = 70;
     197           82 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "Coach", vclass);
     198           41 :             mass = 12000.;
     199           41 :             speedFactor.getParameter()[1] = 0.05;
     200           41 :             break;
     201          180 :         case SVC_TRAM:
     202          180 :             maxSpeed = 80. / 3.6;
     203          180 :             width = 2.4;
     204          180 :             height = 3.2;
     205          180 :             shape = SUMOVehicleShape::RAIL_CAR;
     206              :             osgFile = "tram.obj";
     207          180 :             personCapacity = 120;
     208          360 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass);
     209          180 :             mass = 37900.;
     210          180 :             break;
     211          568 :         case SVC_RAIL_URBAN:
     212              :         case SVC_SUBWAY:
     213          568 :             maxSpeed = 100. / 3.6;
     214          568 :             minGap = 5;
     215          568 :             width = 3.0;
     216          568 :             height = 3.6;
     217          568 :             shape = SUMOVehicleShape::RAIL_CAR;
     218          568 :             personCapacity = 300;
     219         1136 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass);
     220          568 :             mass = 59000.;
     221          568 :             break;
     222        54742 :         case SVC_RAIL:
     223        54742 :             maxSpeed = 160. / 3.6;
     224        54742 :             minGap = 5;
     225        54742 :             width = 2.84;
     226        54742 :             height = 3.75;
     227        54742 :             shape = SUMOVehicleShape::RAIL;
     228        54742 :             personCapacity = 434;
     229              :             // slight understatement (-:
     230       109484 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "HDV_D_EU0", vclass);
     231        54742 :             mass = 79500.; // only locomotive
     232        54742 :             break;
     233           24 :         case SVC_RAIL_ELECTRIC:
     234           24 :             maxSpeed = 220. / 3.6;
     235           24 :             minGap = 5;
     236           24 :             width = 2.95;
     237           24 :             height = 3.89;
     238           24 :             shape = SUMOVehicleShape::RAIL;
     239           24 :             personCapacity = 425;
     240           48 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass);
     241           24 :             mass = 83000.; // only locomotive
     242           24 :             break;
     243           24 :         case SVC_RAIL_FAST:
     244           24 :             maxSpeed = 330. / 3.6;
     245           24 :             minGap = 5;
     246           24 :             width = 2.95;
     247           24 :             height = 3.89;
     248           24 :             shape = SUMOVehicleShape::RAIL;
     249           24 :             personCapacity = 425;
     250           48 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass);
     251           24 :             mass = 409000.;
     252           24 :             break;
     253           99 :         case SVC_DELIVERY:
     254           99 :             width = 2.16;
     255           99 :             height = 2.86;
     256           99 :             shape = SUMOVehicleShape::DELIVERY;
     257           99 :             personCapacity = 2;
     258          198 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "LDV", vclass);
     259           99 :             mass = 5000.;
     260           99 :             speedFactor.getParameter()[1] = 0.05;
     261           99 :             break;
     262          233 :         case SVC_EMERGENCY:
     263          233 :             width = 2.16;
     264          233 :             height = 2.86;
     265          233 :             shape = SUMOVehicleShape::DELIVERY;
     266          233 :             personCapacity = 2;
     267          466 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "LDV", vclass);
     268          233 :             mass = 5000.;
     269          233 :             break;
     270       399641 :         case SVC_PRIVATE:
     271              :         case SVC_VIP:
     272              :         case SVC_PASSENGER:
     273              :         case SVC_HOV:
     274              :         case SVC_CUSTOM1:
     275              :         case SVC_CUSTOM2:
     276       399641 :             shape = SUMOVehicleShape::PASSENGER;
     277       399641 :             speedFactor.getParameter()[1] = 0.1;
     278       399641 :             break;
     279        53581 :         case SVC_TAXI:
     280        53581 :             shape = SUMOVehicleShape::TAXI;
     281        53581 :             speedFactor.getParameter()[1] = 0.05;
     282        53581 :             break;
     283           24 :         case SVC_E_VEHICLE:
     284           24 :             shape = SUMOVehicleShape::E_VEHICLE;
     285           48 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "zero", vclass);
     286           24 :             speedFactor.getParameter()[1] = 0.1;
     287           24 :             break;
     288        42985 :         case SVC_CONTAINER:
     289        42985 :             width = 2.5908;
     290        42985 :             break;
     291           24 :         case SVC_DRONE:
     292           24 :             width = 0.5;
     293           24 :             break;
     294           24 :         case SVC_AIRCRAFT:
     295              :             // Airbus A380
     296           24 :             shape = SUMOVehicleShape::AIRCRAFT;
     297           24 :             width = 79.8;
     298           24 :             break;
     299          294 :         case SVC_SHIP:
     300          294 :             width = 4;
     301          294 :             maxSpeed = 8 / 1.94; // 8 knots
     302          294 :             height = 4;
     303          294 :             shape = SUMOVehicleShape::SHIP;
     304              :             // slight understatement (-:
     305          588 :             emissionClass = PollutantsInterface::getClassByName(EMPREFIX + "HDV_D_EU0", vclass);
     306          294 :             mass = 100000.;
     307          294 :             speedFactor.getParameter()[1] = 0.1;
     308          294 :             break;
     309              :         default:
     310              :             break;
     311              :     }
     312       718851 : }
     313              : 
     314              : 
     315            0 : SUMOVTypeParameter::VClassDefaultValues::VClassDefaultValues() :
     316            0 :     speedFactor("normc", 1.0, 0.0, 0.2, 2.0) {}
     317              : 
     318       373522 : SUMOVTypeParameter::SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vclass)
     319       373522 :     : id(vtid),
     320       373522 :       actionStepLength(0),
     321       373522 :       defaultProbability(DEFAULT_VEH_PROB),
     322       373522 :       speedFactor("normc", 1.0, 0.0, 0.2, 2.0),
     323       747044 :       emissionClass(PollutantsInterface::getClassByName(EMPREFIX + "PC_G_EU4", vclass)),
     324       373522 :       color(RGBColor::DEFAULT_COLOR),
     325       373522 :       vehicleClass(vclass),
     326       373522 :       impatience(0.0),
     327       373522 :       personCapacity(4),
     328       373522 :       containerCapacity(0),
     329       373522 :       boardingDuration(500),
     330       373522 :       loadingDuration(90000),
     331       373522 :       scale(1),
     332       373522 :       width(1.8),
     333       373522 :       height(1.5),
     334       373522 :       shape(SUMOVehicleShape::UNKNOWN),
     335       373522 :       osgFile("car-normal-citrus.obj"),
     336       373522 :       cfModel(SUMO_TAG_CF_KRAUSS),
     337       373522 :       lcModel(LaneChangeModel::DEFAULT),
     338       373522 :       maxSpeedLat(1.0),
     339       373522 :       latAlignmentOffset(0.0),
     340       373522 :       latAlignmentProcedure(LatAlignmentDefinition::CENTER),
     341       373522 :       carriageLength(-1),
     342       373522 :       locomotiveLength(-1),
     343       373522 :       carriageGap(1),
     344       373522 :       carriageDoors(2),
     345       373522 :       timeToTeleport(TTT_UNSET),
     346       373522 :       timeToTeleportBidi(TTT_UNSET),
     347       373522 :       speedFactorPremature(-1),
     348       373522 :       frontSeatPos(1.7),
     349       373522 :       seatingWidth(-1),
     350       373522 :       boardingFactor(1),
     351       373522 :       parametersSet(0),
     352       373522 :       saved(false),
     353       373522 :       onlyReferenced(false) {
     354       373522 :     const OptionsCont& oc = OptionsCont::getOptions();
     355       747044 :     if (oc.exists("carfollow.model")) {
     356              :         // check for valid value has been performed in MSFrame
     357       643550 :         cfModel = SUMOXMLDefinitions::CarFollowModels.get(oc.getString("carfollow.model"));
     358              :     }
     359              :     // obtain default values depending of vclass
     360       373522 :     VClassDefaultValues defaultValues(vclass);
     361              :     // overwrite SUMOVTypeParameter with VClassDefaultValues
     362       373522 :     length = defaultValues.length;
     363       373522 :     minGap = defaultValues.minGap;
     364       373522 :     minGapLat = defaultValues.minGapLat;
     365       373522 :     maxSpeed = defaultValues.maxSpeed;
     366       373522 :     desiredMaxSpeed = defaultValues.desiredMaxSpeed;
     367       373522 :     width = defaultValues.width;
     368       373522 :     height = defaultValues.height;
     369       373522 :     shape = defaultValues.shape;
     370       373522 :     emissionClass = defaultValues.emissionClass;
     371       373522 :     mass = defaultValues.mass;
     372              :     speedFactor = defaultValues.speedFactor;
     373       373522 :     personCapacity = defaultValues.personCapacity;
     374       373522 :     containerCapacity = defaultValues.containerCapacity;
     375              :     osgFile = defaultValues.osgFile;
     376       373522 :     carriageLength = defaultValues.carriageLength;
     377       373522 :     locomotiveLength = defaultValues.locomotiveLength;
     378       373522 :     carriageDoors = defaultValues.carriageDoors;
     379       373522 :     latAlignmentProcedure = defaultValues.latAlignmentProcedure;
     380              :     // check if default speeddev was defined
     381       747044 :     if (oc.exists("default.speeddev")) {
     382       321775 :         const double defaultSpeedDev = oc.getFloat("default.speeddev");
     383       321775 :         if (defaultSpeedDev >= 0) {
     384       201626 :             speedFactor.getParameter()[1] = defaultSpeedDev;
     385              :         }
     386              :     } else {
     387        51747 :         speedFactor.getParameter()[1] = -1;
     388              :     }
     389       373522 :     setManoeuverAngleTimes(vclass);
     390       373522 : }
     391              : 
     392              : void
     393       373522 : SUMOVTypeParameter::setManoeuverAngleTimes(const SUMOVehicleClass vclass) {
     394              : 
     395              :     myManoeuverAngleTimes.clear();
     396              :     /**
     397              :      * Defaults assume:   approaching at angles between 0-10 and 171-180 (will never be > 180) are approaching a space roughly parallel to the road
     398              :      *                    approaching at angles between 11-80 are approaching an acute angled space that is easiest to drive straight in
     399              :      *                    approaching at angles between 81-110 are approaching a space at approximately right angles to the road so the driver has a choice
     400              :      *                    approaching at angles between 111 and 170 are approaching an obtuse angled space that is easiest to drive past and reverse in
     401              :      *              More (or less) granular angle ranges can be used - configurable as a vType parameter
     402              :      */
     403       373522 :     switch (vclass) {
     404       133529 :         case SVC_PASSENGER:
     405              :         case SVC_HOV:
     406              :         case SVC_TAXI:
     407              :         case SVC_E_VEHICLE:
     408       133529 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(10, std::pair< SUMOTime, SUMOTime>(3000, 4000)));     // straight in but potentially needing parallel parking
     409       133529 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(80, std::pair< SUMOTime, SUMOTime>(1000, 11000)));    // straight in
     410       133529 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(110, std::pair< SUMOTime, SUMOTime>(11000, 2000)));   // optional forwards/backwards
     411       133529 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(170, std::pair< SUMOTime, SUMOTime>(8000, 3000)));    // backwards into obtuse space
     412       133529 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(181, std::pair< SUMOTime, SUMOTime>(3000, 4000)));    // straight in but potentially needing parallel parking
     413       133529 :             break;
     414         1662 :         case SVC_TRUCK:
     415              :         case SVC_TRAILER:
     416              :         case SVC_BUS:
     417              :         case SVC_COACH:
     418              :         case SVC_DELIVERY:
     419         1662 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(10, std::pair< SUMOTime, SUMOTime>(6000, 8000)));    // straight in but potentially needing parallel parking
     420         1662 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(80, std::pair< SUMOTime, SUMOTime>(2000, 21000)));   // straight in
     421         1662 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(110, std::pair< SUMOTime, SUMOTime>(21000, 2000)));  // optional forwards/backwards
     422         1662 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(170, std::pair< SUMOTime, SUMOTime>(14000, 5000)));  // backwards into obtuse space
     423         1662 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(181, std::pair< SUMOTime, SUMOTime>(6000, 8000)));   // straight in but potentially needing parallel parking
     424         1662 :             break;
     425       133179 :         case SVC_PEDESTRIAN:
     426              :         case SVC_MOPED:
     427              :         case SVC_BICYCLE:
     428       133179 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(181, std::pair< SUMOTime, SUMOTime>(1000, 1000)));  // no dependence on angle
     429       133179 :             break;
     430       105152 :         default:
     431       105152 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(10, std::pair< SUMOTime, SUMOTime>(3000, 4000)));    // straight in but potentially needing parallel parking
     432       105152 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(80, std::pair< SUMOTime, SUMOTime>(1000, 11000)));   // straight in
     433       105152 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(110, std::pair< SUMOTime, SUMOTime>(11000, 2000)));  // optional forwards/backwards
     434       105152 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(170, std::pair< SUMOTime, SUMOTime>(8000, 3000)));   // backwards into obtuse space
     435       105152 :             myManoeuverAngleTimes.insert(std::pair<int, std::pair<SUMOTime, SUMOTime>>(181, std::pair< SUMOTime, SUMOTime>(3000, 4000)));   // straight in but potentially needing parallel parking
     436       105152 :             break;
     437              :     }
     438       373522 : }
     439              : 
     440              : void
     441        13358 : SUMOVTypeParameter::write(OutputDevice& dev) const {
     442              :     // first check if vehicle type can be written
     443        13358 :     if (onlyReferenced) {
     444              :         return;
     445              :     }
     446              :     // open vehicle tag
     447         2775 :     dev.openTag(SUMO_TAG_VTYPE);
     448              :     // write ID (always needed)
     449         2775 :     dev.writeAttr(SUMO_ATTR_ID, id);
     450              :     // write parameters depending if is set
     451         2775 :     if (wasSet(VTYPEPARS_LENGTH_SET)) {
     452          783 :         dev.writeAttr(SUMO_ATTR_LENGTH, length);
     453              :     }
     454         2775 :     if (wasSet(VTYPEPARS_MINGAP_SET)) {
     455          677 :         dev.writeAttr(SUMO_ATTR_MINGAP, minGap);
     456              :     }
     457         2775 :     if (wasSet(VTYPEPARS_MAXSPEED_SET)) {
     458          717 :         dev.writeAttr(SUMO_ATTR_MAXSPEED, maxSpeed);
     459              :     }
     460         2775 :     if (wasSet(VTYPEPARS_DESIRED_MAXSPEED_SET)) {
     461            0 :         dev.writeAttr(SUMO_ATTR_DESIRED_MAXSPEED, desiredMaxSpeed);
     462              :     }
     463         2775 :     if (wasSet(VTYPEPARS_PROBABILITY_SET)) {
     464           92 :         dev.writeAttr(SUMO_ATTR_PROB, defaultProbability);
     465              :     }
     466         2775 :     if (wasSet(VTYPEPARS_SPEEDFACTOR_SET)) {
     467          428 :         dev.writeAttr(SUMO_ATTR_SPEEDFACTOR, speedFactor);
     468              :     }
     469         2775 :     if (wasSet(VTYPEPARS_ACTIONSTEPLENGTH_SET)) {
     470              :         // Note: action step length is only exposed in seconds to the user
     471          210 :         dev.writeAttr(SUMO_ATTR_ACTIONSTEPLENGTH, STEPS2TIME(actionStepLength));
     472              :     }
     473         2775 :     if (wasSet(VTYPEPARS_VEHICLECLASS_SET)) {
     474          932 :         dev.writeAttr(SUMO_ATTR_VCLASS, toString(vehicleClass));
     475              :     }
     476         2775 :     if (wasSet(VTYPEPARS_EMISSIONCLASS_SET)) {
     477           96 :         dev.writeAttr(SUMO_ATTR_EMISSIONCLASS, PollutantsInterface::getName(emissionClass));
     478              :     }
     479         2775 :     if (wasSet(VTYPEPARS_MASS_SET)) {
     480            0 :         dev.writeAttr(SUMO_ATTR_MASS, mass);
     481              :     }
     482         2775 :     if (wasSet(VTYPEPARS_IMPATIENCE_SET)) {
     483           32 :         if (impatience == -std::numeric_limits<double>::max()) {
     484              :             dev.writeAttr(SUMO_ATTR_IMPATIENCE, "off");
     485              :         } else {
     486           32 :             dev.writeAttr(SUMO_ATTR_IMPATIENCE, impatience);
     487              :         }
     488              :     }
     489         2775 :     if (wasSet(VTYPEPARS_SHAPE_SET)) {
     490          102 :         dev.writeAttr(SUMO_ATTR_GUISHAPE, getVehicleShapeName(shape));
     491              :     }
     492         2775 :     if (wasSet(VTYPEPARS_WIDTH_SET)) {
     493           40 :         dev.writeAttr(SUMO_ATTR_WIDTH, width);
     494              :     }
     495         2775 :     if (wasSet(VTYPEPARS_HEIGHT_SET)) {
     496            0 :         dev.writeAttr(SUMO_ATTR_HEIGHT, height);
     497              :     }
     498         2775 :     if (wasSet(VTYPEPARS_COLOR_SET)) {
     499          396 :         dev.writeAttr(SUMO_ATTR_COLOR, color);
     500              :     }
     501         2775 :     if (wasSet(VTYPEPARS_OSGFILE_SET)) {
     502            0 :         dev.writeAttr(SUMO_ATTR_OSGFILE, osgFile);
     503              :     }
     504         2775 :     if (wasSet(VTYPEPARS_IMGFILE_SET)) {
     505            0 :         dev.writeAttr(SUMO_ATTR_IMGFILE, imgFile);
     506              :     }
     507         2775 :     if (wasSet(VTYPEPARS_PERSON_CAPACITY)) {
     508            0 :         dev.writeAttr(SUMO_ATTR_PERSON_CAPACITY, personCapacity);
     509              :     }
     510         2775 :     if (wasSet(VTYPEPARS_CONTAINER_CAPACITY)) {
     511            0 :         dev.writeAttr(SUMO_ATTR_CONTAINER_CAPACITY, containerCapacity);
     512              :     }
     513         2775 :     if (wasSet(VTYPEPARS_BOARDING_DURATION)) {
     514           16 :         dev.writeAttr(SUMO_ATTR_BOARDING_DURATION, time2string(boardingDuration));
     515              :     }
     516         2775 :     if (wasSet(VTYPEPARS_LOADING_DURATION)) {
     517           16 :         dev.writeAttr(SUMO_ATTR_LOADING_DURATION, time2string(loadingDuration));
     518              :     }
     519         2775 :     if (wasSet(VTYPEPARS_MAXSPEED_LAT_SET)) {
     520            8 :         dev.writeAttr(SUMO_ATTR_MAXSPEED_LAT, maxSpeedLat);
     521              :     }
     522         2775 :     if (wasSet(VTYPEPARS_LATALIGNMENT_SET)) {
     523            8 :         switch (latAlignmentProcedure) {
     524            0 :             case LatAlignmentDefinition::GIVEN:
     525            0 :                 dev.writeAttr(SUMO_ATTR_LATALIGNMENT, latAlignmentOffset);
     526              :                 break;
     527              :             case LatAlignmentDefinition::RIGHT:
     528              :                 dev.writeAttr(SUMO_ATTR_LATALIGNMENT, "right");
     529              :                 break;
     530              :             case LatAlignmentDefinition::CENTER:
     531              :                 dev.writeAttr(SUMO_ATTR_LATALIGNMENT, "center");
     532              :                 break;
     533              :             case LatAlignmentDefinition::ARBITRARY:
     534              :                 dev.writeAttr(SUMO_ATTR_LATALIGNMENT, "arbitrary");
     535              :                 break;
     536              :             case LatAlignmentDefinition::NICE:
     537              :                 dev.writeAttr(SUMO_ATTR_LATALIGNMENT, "nice");
     538              :                 break;
     539              :             case LatAlignmentDefinition::COMPACT:
     540              :                 dev.writeAttr(SUMO_ATTR_LATALIGNMENT, "compact");
     541              :                 break;
     542              :             case LatAlignmentDefinition::LEFT:
     543              :                 dev.writeAttr(SUMO_ATTR_LATALIGNMENT, "left");
     544              :                 break;
     545              :             case LatAlignmentDefinition::DEFAULT:
     546              :             default:
     547              :                 break;
     548              :         }
     549              :     }
     550         2775 :     if (wasSet(VTYPEPARS_MINGAP_LAT_SET)) {
     551            8 :         dev.writeAttr(SUMO_ATTR_MINGAP_LAT, minGapLat);
     552              :     }
     553         2775 :     if (wasSet(VTYPEPARS_MANEUVER_ANGLE_TIMES_SET)) {
     554            0 :         dev.writeAttr(SUMO_ATTR_MANEUVER_ANGLE_TIMES, getManoeuverAngleTimesS());
     555              :     }
     556         2775 :     if (wasSet(VTYPEPARS_SCALE_SET)) {
     557            0 :         dev.writeAttr(SUMO_ATTR_SCALE, scale);
     558              :     }
     559         2775 :     if (wasSet(VTYPEPARS_TTT_SET)) {
     560           16 :         dev.writeAttr(SUMO_ATTR_TIME_TO_TELEPORT, time2string(timeToTeleport));
     561              :     }
     562         2775 :     if (wasSet(VTYPEPARS_TTT_BIDI_SET)) {
     563            0 :         dev.writeAttr(SUMO_ATTR_TIME_TO_TELEPORT_BIDI, time2string(timeToTeleportBidi));
     564              :     }
     565         2775 :     if (wasSet(VTYPEPARS_SPEEDFACTOR_PREMATURE_SET)) {
     566            0 :         dev.writeAttr(SUMO_ATTR_SPEEDFACTOR_PREMATURE, speedFactorPremature);
     567              :     }
     568         2775 :     if (wasSet(VTYPEPARS_BOARDING_FACTOR_SET)) {
     569            0 :         dev.writeAttr(SUMO_ATTR_BOARDING_FACTOR, boardingFactor);
     570              :     }
     571         2775 :     if (wasSet(VTYPEPARS_LANE_CHANGE_MODEL_SET)) {
     572            0 :         dev.writeAttr(SUMO_ATTR_LANE_CHANGE_MODEL, lcModel);
     573              :     }
     574              :     // Write Lane Change Model parameters
     575         2775 :     for (const auto& lcParam : lcParameter) {
     576            0 :         dev.writeAttr(lcParam.first, lcParam.second);
     577              :     }
     578              :     // Write Junction Model parameter
     579         2775 :     for (const auto& jmParam : jmParameter) {
     580            0 :         dev.writeAttr(jmParam.first, jmParam.second);
     581              :     }
     582         2775 :     if (wasSet(VTYPEPARS_CAR_FOLLOW_MODEL)) {
     583           52 :         dev.writeAttr(SUMO_ATTR_CAR_FOLLOW_MODEL, SUMOXMLDefinitions::CarFollowModels.getString(cfModel));
     584              :     }
     585              :     // Write Car Following Model parameters
     586         6034 :     for (const auto& cfParam : cfParameter) {
     587         3259 :         dev.writeAttr(cfParam.first, cfParam.second);
     588              :     }
     589              :     // Write carriage length
     590         2775 :     if (wasSet(VTYPEPARS_CARRIAGE_LENGTH_SET)) {
     591            0 :         dev.openTag(SUMO_TAG_PARAM);
     592            0 :         dev.writeAttr(SUMO_ATTR_KEY, toString(SUMO_ATTR_CARRIAGE_LENGTH));
     593            0 :         dev.writeAttr(SUMO_ATTR_VALUE, toString(carriageLength));
     594            0 :         dev.closeTag();
     595              :     }
     596              :     // Write locomotive length
     597         2775 :     if (wasSet(VTYPEPARS_LOCOMOTIVE_LENGTH_SET)) {
     598            0 :         dev.openTag(SUMO_TAG_PARAM);
     599            0 :         dev.writeAttr(SUMO_ATTR_KEY, toString(SUMO_ATTR_LOCOMOTIVE_LENGTH));
     600            0 :         dev.writeAttr(SUMO_ATTR_VALUE, toString(locomotiveLength));
     601            0 :         dev.closeTag();
     602              :     }
     603              :     // Write carriage gap
     604         2775 :     if (wasSet(VTYPEPARS_CARRIAGE_GAP_SET)) {
     605            0 :         dev.openTag(SUMO_TAG_PARAM);
     606            0 :         dev.writeAttr(SUMO_ATTR_KEY, toString(SUMO_ATTR_CARRIAGE_GAP));
     607            0 :         dev.writeAttr(SUMO_ATTR_VALUE, toString(carriageGap));
     608            0 :         dev.closeTag();
     609              :     }
     610              :     // Write carriage doors
     611         2775 :     if (wasSet(VTYPEPARS_CARRIAGE_DOORS_SET)) {
     612            0 :         dev.openTag(SUMO_TAG_PARAM);
     613            0 :         dev.writeAttr(SUMO_ATTR_KEY, toString(SUMO_ATTR_CARRIAGE_DOORS));
     614            0 :         dev.writeAttr(SUMO_ATTR_VALUE, toString(carriageDoors));
     615            0 :         dev.closeTag();
     616              :     }
     617              :     // Write rest of parameters
     618         2775 :     writeParams(dev);
     619              :     // close tag
     620         5550 :     dev.closeTag();
     621              : }
     622              : 
     623              : 
     624              : double
     625      4464006 : SUMOVTypeParameter::getCFParam(const SumoXMLAttr attr, const double defaultValue) const {
     626              :     if (cfParameter.count(attr)) {
     627        52587 :         return StringUtils::toDouble(cfParameter.find(attr)->second);
     628              :     } else {
     629              :         return defaultValue;
     630              :     }
     631              : }
     632              : 
     633              : 
     634              : std::string
     635         1352 : SUMOVTypeParameter::getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const {
     636              :     if (cfParameter.count(attr)) {
     637              :         return cfParameter.find(attr)->second;
     638              :     } else {
     639              :         return defaultValue;
     640              :     }
     641              : }
     642              : 
     643              : 
     644              : double
     645     89371374 : SUMOVTypeParameter::getLCParam(const SumoXMLAttr attr, const double defaultValue) const {
     646              :     if (lcParameter.count(attr)) {
     647       332644 :         return StringUtils::toDouble(lcParameter.find(attr)->second);
     648              :     } else {
     649              :         return defaultValue;
     650              :     }
     651              : }
     652              : 
     653              : 
     654              : std::string
     655        67386 : SUMOVTypeParameter::getLCParamString(const SumoXMLAttr attr, const std::string& defaultValue) const {
     656              :     if (lcParameter.count(attr)) {
     657              :         return lcParameter.find(attr)->second;
     658              :     } else {
     659              :         return defaultValue;
     660              :     }
     661              : }
     662              : 
     663              : 
     664              : const SUMOVTypeParameter::SubParams&
     665       140348 : SUMOVTypeParameter::getLCParams() const {
     666       140348 :     return lcParameter;
     667              : }
     668              : 
     669              : 
     670              : double
     671   2781685114 : SUMOVTypeParameter::getJMParam(const SumoXMLAttr attr, const double defaultValue) const {
     672              :     if (jmParameter.count(attr)) {
     673     18397434 :         return StringUtils::toDouble(jmParameter.find(attr)->second);
     674              :     } else {
     675              :         return defaultValue;
     676              :     }
     677              : }
     678              : 
     679              : 
     680              : std::string
     681            0 : SUMOVTypeParameter::getJMParamString(const SumoXMLAttr attr, const std::string defaultValue) const {
     682              :     if (jmParameter.count(attr)) {
     683              :         return jmParameter.find(attr)->second;
     684              :     } else {
     685              :         return defaultValue;
     686              :     }
     687              : }
     688              : 
     689              : SUMOTime
     690           30 : SUMOVTypeParameter::getEntryManoeuvreTime(const int angle) const {
     691              :     SUMOTime last = 0;
     692           90 :     for (std::pair<int, std::pair<SUMOTime, SUMOTime>> angleTime : myManoeuverAngleTimes) {
     693           90 :         if (angle <= angleTime.first) {
     694              :             return (angleTime.second.first);
     695              :         } else {
     696              :             last = angleTime.second.first;
     697              :         }
     698              :     }
     699            0 :     return (last);
     700              : }
     701              : 
     702              : SUMOTime
     703           30 : SUMOVTypeParameter::getExitManoeuvreTime(const int angle) const {
     704              :     SUMOTime last = 0;
     705           90 :     for (std::pair<int, std::pair<SUMOTime, SUMOTime>> angleTime : myManoeuverAngleTimes) {
     706           90 :         if (angle <= angleTime.first) {
     707              :             return (angleTime.second.second);
     708              :         } else {
     709              :             last = angleTime.second.second;
     710              :         }
     711              :     }
     712            0 :     return (last);
     713              : }
     714              : 
     715              : std::string
     716            0 : SUMOVTypeParameter::getManoeuverAngleTimesS() const {
     717            0 :     std::stringstream stream;
     718              : 
     719              :     stream << std::fixed << std::setprecision(1);
     720              :     int count = 0;
     721            0 :     for (std::pair<int, std::pair<SUMOTime, SUMOTime>> angleTime : myManoeuverAngleTimes) {
     722            0 :         if (count++ > 0) {
     723            0 :             stream << ",";
     724              :         }
     725            0 :         stream << toString(angleTime.first) + " " << STEPS2TIME(angleTime.second.first) << " " << STEPS2TIME(angleTime.second.second);
     726              :     }
     727              :     std::string triplets = stream.str();
     728            0 :     return triplets;
     729            0 : }
     730              : 
     731              : 
     732              : void
     733           12 : SUMOVTypeParameter::cacheParamRestrictions(const std::vector<std::string>& restrictionKeys) {
     734           24 :     for (const std::string& key : restrictionKeys) {
     735           24 :         paramRestrictions.push_back(StringUtils::toDouble(getParameter(key, "0")));
     736              :     }
     737           12 : }
     738              : 
     739              : 
     740              : void
     741       316323 : SUMOVTypeParameter::initRailVisualizationParameters() {
     742       632646 :     if (hasParameter("carriageLength")) {
     743          114 :         carriageLength = StringUtils::toDouble(getParameter("carriageLength"));
     744           57 :         parametersSet |= VTYPEPARS_CARRIAGE_LENGTH_SET;
     745              :     } else {
     746       316266 :         switch (shape) {
     747            6 :             case SUMOVehicleShape::BUS_FLEXIBLE:
     748            6 :                 carriageLength = 8.25; // 16.5 overall, 2 modules http://de.wikipedia.org/wiki/Ikarus_180
     749            6 :                 carriageGap = 0;
     750            6 :                 break;
     751        44651 :             case SUMOVehicleShape::RAIL:
     752        44651 :                 if (vehicleClass == SVC_RAIL_ELECTRIC) {
     753           24 :                     carriageLength = 24.5;
     754           24 :                     locomotiveLength = 19.100; // https://en.wikipedia.org/wiki/DB_Class_101
     755        44627 :                 } else if (vehicleClass == SVC_RAIL_FAST) {
     756           24 :                     carriageLength = 24.775; // http://de.wikipedia.org/wiki/ICE_3
     757           24 :                     locomotiveLength = 25.835;
     758              :                 } else {
     759        44603 :                     carriageLength = 24.5; // http://de.wikipedia.org/wiki/UIC-Y-Wagen_%28DR%29
     760        44603 :                     locomotiveLength = 16.4; // https://en.wikipedia.org/wiki/DB_Class_218
     761              :                 }
     762              :                 break;
     763          530 :             case SUMOVehicleShape::RAIL_CAR:
     764          530 :                 if (vehicleClass == SVC_TRAM) {
     765          125 :                     carriageLength = 5.71; // http://de.wikipedia.org/wiki/Bombardier_Flexity_Berlin
     766          125 :                     locomotiveLength = 5.71;
     767          405 :                 } else if (vehicleClass == SVC_RAIL_URBAN) {
     768          357 :                     carriageLength = 18.4;  // https://en.wikipedia.org/wiki/DBAG_Class_481
     769          357 :                     locomotiveLength = 18.4;
     770              :                 } else {
     771           48 :                     carriageLength = 16.85;  // 67.4m overall, 4 carriages http://de.wikipedia.org/wiki/DB-Baureihe_423
     772              :                 }
     773              :                 break;
     774            8 :             case SUMOVehicleShape::RAIL_CARGO:
     775            8 :                 carriageLength = 13.86; // UIC 571-1 http://de.wikipedia.org/wiki/Flachwagen
     776            8 :                 break;
     777            7 :             case SUMOVehicleShape::TRUCK_SEMITRAILER:
     778            7 :                 carriageLength = 13.5;
     779            7 :                 locomotiveLength = 2.5;
     780            7 :                 carriageGap = 0.5;
     781            7 :                 break;
     782           81 :             case SUMOVehicleShape::TRUCK_1TRAILER:
     783           81 :                 carriageLength = 6.75;
     784           81 :                 locomotiveLength = 2.5 + 6.75;
     785           81 :                 carriageGap = 0.5;
     786           81 :                 break;
     787              :             default:
     788              :                 break;
     789              :         }
     790              :     }
     791       632646 :     if (hasParameter("locomotiveLength")) {
     792           58 :         locomotiveLength = StringUtils::toDouble(getParameter("locomotiveLength"));
     793           29 :         parametersSet |= VTYPEPARS_LOCOMOTIVE_LENGTH_SET;
     794       316294 :     } else if (locomotiveLength < 0) {
     795       271073 :         locomotiveLength = carriageLength;
     796              :     }
     797       632646 :     if (hasParameter("carriageGap")) {
     798            8 :         carriageGap = StringUtils::toDouble(getParameter("carriageGap"));
     799            4 :         parametersSet |= VTYPEPARS_CARRIAGE_GAP_SET;
     800              :     }
     801       632646 :     if (hasParameter("carriageDoors")) {
     802           24 :         carriageDoors = StringUtils::toInt(getParameter("carriageDoors"));
     803           12 :         parametersSet |= VTYPEPARS_CARRIAGE_DOORS_SET;
     804              :     }
     805       632646 :     if (hasParameter("frontSeatPos")) {
     806           30 :         frontSeatPos = StringUtils::toDouble(getParameter("frontSeatPos"));
     807           15 :         parametersSet |= VTYPEPARS_FRONT_SEAT_POS_SET;
     808              :     } else {
     809       316308 :         switch (shape) {
     810          223 :             case SUMOVehicleShape::SHIP:
     811          223 :                 frontSeatPos = 5;
     812          223 :                 break;
     813          200 :             case SUMOVehicleShape::DELIVERY:
     814          200 :                 frontSeatPos = 1.2;
     815          200 :                 break;
     816        43588 :             case SUMOVehicleShape::BICYCLE:
     817        43588 :                 frontSeatPos = 0.6;
     818        43588 :                 break;
     819          262 :             case SUMOVehicleShape::MOPED:
     820              :             case SUMOVehicleShape::MOTORCYCLE:
     821          262 :                 frontSeatPos = 0.9;
     822          262 :                 break;
     823          911 :             case SUMOVehicleShape::BUS:
     824              :             case SUMOVehicleShape::BUS_COACH:
     825              :             case SUMOVehicleShape::BUS_FLEXIBLE:
     826              :             case SUMOVehicleShape::BUS_TROLLEY:
     827          911 :                 frontSeatPos = 0.5;
     828          911 :                 break;
     829          600 :             case SUMOVehicleShape::TRUCK:
     830              :             case SUMOVehicleShape::TRUCK_1TRAILER:
     831              :             case SUMOVehicleShape::TRUCK_SEMITRAILER:
     832          600 :                 frontSeatPos = 0.8;
     833          600 :                 break;
     834              :             default:
     835              :                 break;
     836              :         }
     837              :     }
     838              : 
     839       632646 :     if (hasParameter("seatingWidth")) {
     840           14 :         seatingWidth = StringUtils::toDouble(getParameter("seatingWidth"));
     841            7 :         parametersSet |= VTYPEPARS_SEATING_WIDTH_SET;
     842              :     }
     843       316323 : }
     844              : 
     845              : 
     846              : double
     847       318127 : SUMOVTypeParameter::getDefaultAccel(const SUMOVehicleClass vc) {
     848       318127 :     switch (vc) {
     849              :         case SVC_PEDESTRIAN:
     850              :         case SVC_WHEELCHAIR:
     851              :             return 1.5;
     852              :         case SVC_BICYCLE:
     853              :         case SVC_SCOOTER:
     854              :             return 1.2;
     855          139 :         case SVC_MOTORCYCLE:
     856          139 :             return 6.;
     857              :         case SVC_MOPED:
     858              :             return 1.1;
     859          493 :         case SVC_TRUCK:
     860          493 :             return 1.3;
     861              :         case SVC_TRAILER:
     862              :             return 1.1;
     863              :         case SVC_BUS:
     864              :             return 1.2;
     865           41 :         case SVC_COACH:
     866           41 :             return 2.;
     867              :         case SVC_TRAM:
     868              :             return 1.;
     869              :         case SVC_RAIL_URBAN:
     870              :             return 1.;
     871        44745 :         case SVC_RAIL:
     872        44745 :             return 0.25;
     873           48 :         case SVC_RAIL_ELECTRIC:
     874              :         case SVC_RAIL_FAST:
     875           48 :             return 0.5;
     876          223 :         case SVC_SHIP:
     877          223 :             return 0.1;
     878       157698 :         default:
     879       157698 :             return 2.6;//2.9;
     880              :     }
     881              : }
     882              : 
     883              : 
     884              : double
     885       720098 : SUMOVTypeParameter::getDefaultDecel(const SUMOVehicleClass vc) {
     886       720098 :     switch (vc) {
     887              :         case SVC_PEDESTRIAN:
     888              :         case SVC_WHEELCHAIR:
     889              :             return 2.;
     890              :         case SVC_BICYCLE:
     891              :         case SVC_SCOOTER:
     892              :             return 3.;
     893          236 :         case SVC_MOPED:
     894          236 :             return 7.;
     895          278 :         case SVC_MOTORCYCLE:
     896          278 :             return 10.;
     897         2722 :         case SVC_TRUCK:
     898              :         case SVC_TRAILER:
     899              :         case SVC_BUS:
     900              :         case SVC_COACH:
     901         2722 :             return 4.;
     902              :         case SVC_TRAM:
     903              :         case SVC_RAIL_URBAN:
     904              :             return 3.;
     905       132258 :         case SVC_RAIL:
     906              :         case SVC_RAIL_ELECTRIC:
     907              :         case SVC_RAIL_FAST:
     908       132258 :             return 1.3;
     909          446 :         case SVC_SHIP:
     910          446 :             return 0.15;
     911       356739 :         default:
     912       356739 :             return 4.5;//7.5;
     913              :     }
     914              : }
     915              : 
     916              : 
     917              : double
     918       634374 : SUMOVTypeParameter::getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption) {
     919       634374 :     if (defaultOption == VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT) {
     920              :         double vcDecel;
     921       628966 :         switch (vc) {
     922              :             case SVC_PEDESTRIAN:
     923              :             case SVC_WHEELCHAIR:
     924              :                 vcDecel = 5.;
     925              :                 break;
     926              :             case SVC_BICYCLE:
     927              :             case SVC_SCOOTER:
     928              :                 vcDecel = 7.;
     929              :                 break;
     930          514 :             case SVC_MOPED:
     931              :             case SVC_MOTORCYCLE:
     932              :                 vcDecel = 10.;
     933          514 :                 break;
     934              :             case SVC_TRUCK:
     935              :             case SVC_TRAILER:
     936              :             case SVC_BUS:
     937              :             case SVC_COACH:
     938              :             case SVC_TRAM:
     939              :             case SVC_RAIL_URBAN:
     940              :                 vcDecel = 7.;
     941              :                 break;
     942              :             case SVC_RAIL:
     943              :             case SVC_RAIL_ELECTRIC:
     944              :             case SVC_RAIL_FAST:
     945              :                 vcDecel = 5.;
     946              :                 break;
     947          446 :             case SVC_SHIP:
     948              :                 vcDecel = 1.;
     949          446 :                 break;
     950       310589 :             default:
     951              :                 vcDecel = 9.;
     952              :         }
     953              :         return MAX2(decel, vcDecel);
     954         5408 :     } else if (defaultOption == VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL) {
     955              :         return decel;
     956              :     } else {
     957              :         // value already checked in MSFrame::checkOptions
     958              :         return MAX2(decel, defaultOption);
     959              :     }
     960              : }
     961              : 
     962              : 
     963              : 
     964              : double
     965       307688 : SUMOVTypeParameter::getDefaultImperfection(const SUMOVehicleClass vc) {
     966       307688 :     switch (vc) {
     967              :         case SVC_TRAM:
     968              :         case SVC_RAIL_URBAN:
     969              :         case SVC_RAIL:
     970              :         case SVC_RAIL_ELECTRIC:
     971              :         case SVC_RAIL_FAST:
     972              :         case SVC_SHIP:
     973              :             return 0.;
     974       263728 :         default:
     975       263728 :             return 0.5;
     976              :     }
     977              : }
     978              : 
     979              : const SUMOVTypeParameter&
     980     16314260 : SUMOVTypeParameter::getDefault() {
     981     16319682 :     static SUMOVTypeParameter defaultParams("");
     982     16314260 :     return defaultParams;
     983              : }
     984              : 
     985              : bool
     986         1719 : SUMOVTypeParameter::parseLatAlignment(const std::string& val, double& lao, LatAlignmentDefinition& lad) {
     987              :     bool ok = true;
     988         1719 :     lao = 0.0;
     989         1719 :     lad = LatAlignmentDefinition::GIVEN;
     990         1719 :     if (val == "right") {
     991          315 :         lad = LatAlignmentDefinition::RIGHT;
     992         1404 :     } else if (val == "center") {
     993          677 :         lad = LatAlignmentDefinition::CENTER;
     994          727 :     } else if (val == "arbitrary") {
     995          336 :         lad = LatAlignmentDefinition::ARBITRARY;
     996          391 :     } else if (val == "nice") {
     997           46 :         lad = LatAlignmentDefinition::NICE;
     998          345 :     } else if (val == "compact") {
     999          244 :         lad = LatAlignmentDefinition::COMPACT;
    1000          101 :     } else if (val == "left") {
    1001           86 :         lad = LatAlignmentDefinition::LEFT;
    1002              :     } else {
    1003              :         try {
    1004           15 :             lao = StringUtils::toDouble(val);
    1005            0 :         } catch (...) {
    1006              :             ok = false;
    1007            0 :         }
    1008              :     }
    1009         1719 :     return ok;
    1010              : }
    1011              : 
    1012              : 
    1013              : SUMOTime
    1014     69156822 : SUMOVTypeParameter::getTimeToTeleport(SUMOTime defaultValue) const {
    1015     69156822 :     return timeToTeleport == TTT_UNSET ? defaultValue : timeToTeleport;
    1016              : }
    1017              : 
    1018              : SUMOTime
    1019     69156822 : SUMOVTypeParameter::getTimeToTeleportBidi(SUMOTime defaultValue) const {
    1020     69156822 :     return timeToTeleportBidi == TTT_UNSET ? defaultValue : timeToTeleportBidi;
    1021              : }
    1022              : 
    1023              : /****************************************************************************/
        

Generated by: LCOV version 2.0-1