SUMO - Simulation of Urban MObility
SUMOVehicleParserHelper.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2008-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // Helper methods for parsing vehicle attributes
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
30 #include <utils/common/ToString.h>
38 
39 
40 // ===========================================================================
41 // static members
42 // ===========================================================================
45 std::set<SumoXMLAttr> SUMOVehicleParserHelper::allowedJMAttrs;
46 
47 
48 // ===========================================================================
49 // method definitions
50 // ===========================================================================
52 SUMOVehicleParserHelper::parseFlowAttributes(const SUMOSAXAttributes& attrs, const SUMOTime beginDefault, const SUMOTime endDefault) {
53  bool ok = true;
54  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
56  throw ProcessError("Invalid flow id '" + id + "'.");
57  }
59  throw ProcessError("At most one of '" + attrs.getName(SUMO_ATTR_PERIOD) +
60  "' and '" + attrs.getName(SUMO_ATTR_VEHSPERHOUR) +
61  "' has to be given in the definition of flow '" + id + "'.");
62  }
64  throw ProcessError("At most one of '" + attrs.getName(SUMO_ATTR_PERIOD) +
65  "' and '" + attrs.getName(SUMO_ATTR_PROB) +
66  "' has to be given in the definition of flow '" + id + "'.");
67  }
69  throw ProcessError("At most one of '" + attrs.getName(SUMO_ATTR_PROB) +
70  "' and '" + attrs.getName(SUMO_ATTR_VEHSPERHOUR) +
71  "' has to be given in the definition of flow '" + id + "'.");
72  }
75  throw ProcessError("If '" + attrs.getName(SUMO_ATTR_PERIOD) +
76  "', '" + attrs.getName(SUMO_ATTR_VEHSPERHOUR) +
77  "' or '" + attrs.getName(SUMO_ATTR_PROB) +
78  "' are given at most one of '" + attrs.getName(SUMO_ATTR_END) +
79  "' and '" + attrs.getName(SUMO_ATTR_NUMBER) +
80  "' are allowed in flow '" + id + "'.");
81  }
82  } else {
83  if (!attrs.hasAttribute(SUMO_ATTR_NUMBER)) {
84  throw ProcessError("At least one of '" + attrs.getName(SUMO_ATTR_PERIOD) +
85  "', '" + attrs.getName(SUMO_ATTR_VEHSPERHOUR) +
86  "', '" + attrs.getName(SUMO_ATTR_PROB) +
87  "', and '" + attrs.getName(SUMO_ATTR_NUMBER) +
88  "' is needed in flow '" + id + "'.");
89  }
90  }
92  ret->id = id;
93  try {
94  parseCommonAttributes(attrs, ret, "flow");
95  } catch (ProcessError&) {
96  delete ret;
97  throw;
98  }
99 
100  // parse repetition information
101  if (attrs.hasAttribute(SUMO_ATTR_PERIOD)) {
102  ret->parametersSet |= VEHPARS_PERIODFREQ_SET;
103  ret->repetitionOffset = attrs.getSUMOTimeReporting(SUMO_ATTR_PERIOD, id.c_str(), ok);
104  }
105  if (attrs.hasAttribute(SUMO_ATTR_VEHSPERHOUR)) {
106  ret->parametersSet |= VEHPARS_PERIODFREQ_SET;
107  const double vph = attrs.get<double>(SUMO_ATTR_VEHSPERHOUR, id.c_str(), ok);
108  if (ok && vph <= 0) {
109  delete ret;
110  throw ProcessError("Invalid repetition rate in the definition of flow '" + id + "'.");
111  }
112  if (ok && vph != 0) {
113  ret->repetitionOffset = TIME2STEPS(3600. / vph);
114  }
115  }
116  if (attrs.hasAttribute(SUMO_ATTR_PROB)) {
117  ret->repetitionProbability = attrs.get<double>(SUMO_ATTR_PROB, id.c_str(), ok);
118  if (ok && (ret->repetitionProbability <= 0 || ret->repetitionProbability > 1)) {
119  delete ret;
120  throw ProcessError("Invalid repetition probability in the definition of flow '" + id + "'.");
121  }
122  }
123 
124  ret->depart = beginDefault;
125  if (attrs.hasAttribute(SUMO_ATTR_BEGIN)) {
126  ret->depart = attrs.getSUMOTimeReporting(SUMO_ATTR_BEGIN, id.c_str(), ok);
127  }
128  if (ok && ret->depart < 0) {
129  delete ret;
130  throw ProcessError("Negative begin time in the definition of flow '" + id + "'.");
131  }
132  ret->repetitionEnd = endDefault;
133  if (ret->repetitionEnd < 0) {
134  ret->repetitionEnd = SUMOTime_MAX;
135  }
136  if (attrs.hasAttribute(SUMO_ATTR_END)) {
137  ret->repetitionEnd = attrs.getSUMOTimeReporting(SUMO_ATTR_END, id.c_str(), ok);
138  } else if (!attrs.hasAttribute(SUMO_ATTR_NUMBER) &&
139  // see SUMOTIME_MAXSTRING (which differs slightly from SUMOTime_MAX)
140  (endDefault >= TIME2STEPS(9223372036854773) || endDefault < 0)) {
141  WRITE_WARNING("Undefined end for flow '" + id + "', defaulting to 24hour duration.");
142  ret->repetitionEnd = ret->depart + TIME2STEPS(24 * 3600);
143  }
144  if (ok && ret->repetitionEnd < ret->depart) {
145  delete ret;
146  throw ProcessError("Flow '" + id + "' ends before its begin time.");
147  }
148  if (attrs.hasAttribute(SUMO_ATTR_NUMBER)) {
149  ret->repetitionNumber = attrs.get<int>(SUMO_ATTR_NUMBER, id.c_str(), ok);
150  ret->parametersSet |= VEHPARS_PERIODFREQ_SET;
151  if (ret->repetitionNumber == 0) {
152  WRITE_WARNING("Flow '" + id + "' has 0 vehicles; will skip it.");
153  } else {
154  if (ok && ret->repetitionNumber < 0) {
155  delete ret;
156  throw ProcessError("Negative repetition number in the definition of flow '" + id + "'.");
157  }
158  if (ok && ret->repetitionOffset < 0) {
159  ret->repetitionOffset = (ret->repetitionEnd - ret->depart) / ret->repetitionNumber;
160  }
161  }
162  ret->repetitionEnd = ret->depart + ret->repetitionNumber * ret->repetitionOffset;
163  } else {
164  // interpret repetitionNumber
165  if (ok && ret->repetitionProbability > 0) {
166  ret->repetitionNumber = std::numeric_limits<int>::max();
167  } else {
168  if (ok && ret->repetitionOffset <= 0) {
169  delete ret;
170  throw ProcessError("Invalid repetition rate in the definition of flow '" + id + "'.");
171  }
172  if (ret->repetitionEnd == SUMOTime_MAX) {
173  ret->repetitionNumber = std::numeric_limits<int>::max();
174  } else {
175  const double repLength = (double)(ret->repetitionEnd - ret->depart);
176  ret->repetitionNumber = (int)ceil(repLength / ret->repetitionOffset);
177  }
178  }
179  }
180  if (!ok) {
181  delete ret;
182  throw ProcessError();
183  }
184  return ret;
185 }
186 
187 
190  const bool optionalID, const bool skipDepart, const bool isPerson) {
191  bool ok = true;
192  std::string id, errorMsg;
193  if (optionalID) {
194  id = attrs.getOpt<std::string>(SUMO_ATTR_ID, 0, ok, "");
195  } else {
196  id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
198  throw ProcessError("Invalid vehicle id '" + id + "'.");
199  }
200  }
202  ret->id = id;
203  if (isPerson) {
205  }
206  try {
207  parseCommonAttributes(attrs, ret, "vehicle");
208  if (!skipDepart) {
209  const std::string helper = attrs.get<std::string>(SUMO_ATTR_DEPART, ret->id.c_str(), ok);
210  if (!ok || !SUMOVehicleParameter::parseDepart(helper, "vehicle", ret->id, ret->depart, ret->departProcedure, errorMsg)) {
211  throw ProcessError(errorMsg);
212  }
213  }
214  } catch (ProcessError&) {
215  delete ret;
216  throw;
217  }
218  return ret;
219 }
220 
221 
222 void
224  SUMOVehicleParameter* ret, std::string element) {
225  //ret->refid = attrs.getStringSecure(SUMO_ATTR_REFID, "");
226  bool ok = true;
227  // parse route information
228  if (attrs.hasAttribute(SUMO_ATTR_ROUTE)) {
229  ret->parametersSet |= VEHPARS_ROUTE_SET; // !!! needed?
230  ret->routeid = attrs.get<std::string>(SUMO_ATTR_ROUTE, ret->id.c_str(), ok);
231  }
232  // parse type information
233  if (attrs.hasAttribute(SUMO_ATTR_TYPE)) {
234  ret->parametersSet |= VEHPARS_VTYPE_SET; // !!! needed?
235  ret->vtypeid = attrs.get<std::string>(SUMO_ATTR_TYPE, ret->id.c_str(), ok);
236  }
237  // parse line information
238  if (attrs.hasAttribute(SUMO_ATTR_LINE)) {
239  ret->parametersSet |= VEHPARS_LINE_SET; // !!! needed?
240  ret->line = attrs.get<std::string>(SUMO_ATTR_LINE, ret->id.c_str(), ok);
241  }
242  // parse zone information
243  if (attrs.hasAttribute(SUMO_ATTR_FROM_TAZ)) {
245  ret->fromTaz = attrs.get<std::string>(SUMO_ATTR_FROM_TAZ, ret->id.c_str(), ok);
246  }
247  if (attrs.hasAttribute(SUMO_ATTR_TO_TAZ)) {
249  ret->toTaz = attrs.get<std::string>(SUMO_ATTR_TO_TAZ, ret->id.c_str(), ok);
250  }
251  // parse reroute information
252  if (attrs.getOpt<bool>(SUMO_ATTR_REROUTE, 0, ok, false)) {
254  }
255 
256  std::string error;
257  // parse depart lane information
258  if (attrs.hasAttribute(SUMO_ATTR_DEPARTLANE)) {
260  const std::string helper = attrs.get<std::string>(SUMO_ATTR_DEPARTLANE, ret->id.c_str(), ok);
261  if (!SUMOVehicleParameter::parseDepartLane(helper, element, ret->id, ret->departLane, ret->departLaneProcedure, error)) {
262  throw ProcessError(error);
263  }
264  }
265  // parse depart position information
266  if (attrs.hasAttribute(SUMO_ATTR_DEPARTPOS)) {
268  const std::string helper = attrs.get<std::string>(SUMO_ATTR_DEPARTPOS, ret->id.c_str(), ok);
269  if (!SUMOVehicleParameter::parseDepartPos(helper, element, ret->id, ret->departPos, ret->departPosProcedure, error)) {
270  throw ProcessError(error);
271  }
272  }
273  // parse lateral depart position information
276  const std::string helper = attrs.get<std::string>(SUMO_ATTR_DEPARTPOS_LAT, ret->id.c_str(), ok);
277  if (!SUMOVehicleParameter::parseDepartPosLat(helper, element, ret->id, ret->departPosLat, ret->departPosLatProcedure, error)) {
278  throw ProcessError(error);
279  }
280  }
281  // parse depart speed information
282  if (attrs.hasAttribute(SUMO_ATTR_DEPARTSPEED)) {
284  std::string helper = attrs.get<std::string>(SUMO_ATTR_DEPARTSPEED, ret->id.c_str(), ok);
285  if (!SUMOVehicleParameter::parseDepartSpeed(helper, element, ret->id, ret->departSpeed, ret->departSpeedProcedure, error)) {
286  throw ProcessError(error);
287  }
288  }
289 
290  // parse arrival lane information
291  if (attrs.hasAttribute(SUMO_ATTR_ARRIVALLANE)) {
293  std::string helper = attrs.get<std::string>(SUMO_ATTR_ARRIVALLANE, ret->id.c_str(), ok);
294  if (!SUMOVehicleParameter::parseArrivalLane(helper, element, ret->id, ret->arrivalLane, ret->arrivalLaneProcedure, error)) {
295  throw ProcessError(error);
296  }
297  }
298  // parse arrival position information
299  if (attrs.hasAttribute(SUMO_ATTR_ARRIVALPOS)) {
301  std::string helper = attrs.get<std::string>(SUMO_ATTR_ARRIVALPOS, ret->id.c_str(), ok);
302  if (!SUMOVehicleParameter::parseArrivalPos(helper, element, ret->id, ret->arrivalPos, ret->arrivalPosProcedure, error)) {
303  throw ProcessError(error);
304  }
305  }
306  // parse lateral arrival position information
309  std::string helper = attrs.get<std::string>(SUMO_ATTR_ARRIVALPOS_LAT, ret->id.c_str(), ok);
310  if (!SUMOVehicleParameter::parseArrivalPosLat(helper, element, ret->id, ret->arrivalPosLat, ret->arrivalPosLatProcedure, error)) {
311  throw ProcessError(error);
312  }
313  }
314  // parse arrival speed information
317  std::string helper = attrs.get<std::string>(SUMO_ATTR_ARRIVALSPEED, ret->id.c_str(), ok);
318  if (!SUMOVehicleParameter::parseArrivalSpeed(helper, element, ret->id, ret->arrivalSpeed, ret->arrivalSpeedProcedure, error)) {
319  throw ProcessError(error);
320  }
321  }
322 
323  // parse color
324  if (attrs.hasAttribute(SUMO_ATTR_COLOR)) {
326  ret->color = attrs.get<RGBColor>(SUMO_ATTR_COLOR, ret->id.c_str(), ok);
327  } else {
329  }
330  // parse person number
333  ret->personNumber = attrs.get<int>(SUMO_ATTR_PERSON_NUMBER, ret->id.c_str(), ok);
334  }
335  // parse container number
338  ret->containerNumber = attrs.get<int>(SUMO_ATTR_CONTAINER_NUMBER, ret->id.c_str(), ok);
339  }
340  /*/ parse via
341  if (attrs.hasAttribute(SUMO_ATTR_VIA)) {
342  ret->setParameter |= VEHPARS_VIA_SET;
343  SUMOSAXAttributes::parseStringVector(attrs.get<std::string>(SUMO_ATTR_VIA, ret->id.c_str(), ok), ret->via);
344  }
345  */
346 }
347 
348 
350 SUMOVehicleParserHelper::beginVTypeParsing(const SUMOSAXAttributes& attrs, const std::string& file) {
351  bool ok = true;
352  std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
354  throw ProcessError("Invalid vType id '" + id + "'.");
355  }
357  if (attrs.hasAttribute(SUMO_ATTR_VCLASS)) {
358  vClass = parseVehicleClass(attrs, id);
359  }
360  SUMOVTypeParameter* vtype = new SUMOVTypeParameter(id, vClass);
361  if (attrs.hasAttribute(SUMO_ATTR_VCLASS)) {
363  }
364  if (attrs.hasAttribute(SUMO_ATTR_LENGTH)) {
365  vtype->length = attrs.get<double>(SUMO_ATTR_LENGTH, vtype->id.c_str(), ok);
367  }
368  if (attrs.hasAttribute(SUMO_ATTR_MINGAP)) {
369  vtype->minGap = attrs.get<double>(SUMO_ATTR_MINGAP, vtype->id.c_str(), ok);
371  }
372  if (attrs.hasAttribute(SUMO_ATTR_MAXSPEED)) {
373  vtype->maxSpeed = attrs.get<double>(SUMO_ATTR_MAXSPEED, vtype->id.c_str(), ok);
375  }
376  if (attrs.hasAttribute(SUMO_ATTR_SPEEDFACTOR)) {
377  vtype->speedFactor.parse(attrs.get<std::string>(SUMO_ATTR_SPEEDFACTOR, vtype->id.c_str(), ok));
379  }
380  if (attrs.hasAttribute(SUMO_ATTR_SPEEDDEV)) {
381  vtype->speedFactor.getParameter()[1] = attrs.get<double>(SUMO_ATTR_SPEEDDEV, vtype->id.c_str(), ok);
383  }
384  // validate speed distribution
385  std::string error;
386  if (!vtype->speedFactor.isValid(error)) {
387  WRITE_ERROR("Invalid speed distribution when parsing vType '" + vtype->id + "' (" + error + ")");
388  throw ProcessError();
389  }
391  double actionStepLengthSecs = attrs.get<double>(SUMO_ATTR_ACTIONSTEPLENGTH, vtype->id.c_str(), ok);
392  vtype->actionStepLength = processActionStepLength(actionStepLengthSecs);
394  }
396  vtype->hasDriverState = attrs.get<bool>(SUMO_ATTR_HASDRIVERSTATE, vtype->id.c_str(), ok);
398  }
400  vtype->emissionClass = PollutantsInterface::getClassByName(attrs.getOpt<std::string>(SUMO_ATTR_EMISSIONCLASS, id.c_str(), ok, ""));
402  }
403  if (attrs.hasAttribute(SUMO_ATTR_IMPATIENCE)) {
404  // allow empty attribute because .sbx saves this only as float
405  bool ok2;
406  if (attrs.get<std::string>(SUMO_ATTR_IMPATIENCE, vtype->id.c_str(), ok2, false) == "off") {
407  vtype->impatience = -std::numeric_limits<double>::max();
408  } else {
409  vtype->impatience = attrs.get<double>(SUMO_ATTR_IMPATIENCE, vtype->id.c_str(), ok);
410  }
412  }
413  if (attrs.hasAttribute(SUMO_ATTR_WIDTH)) {
414  vtype->width = attrs.get<double>(SUMO_ATTR_WIDTH, vtype->id.c_str(), ok);
416  }
417  if (attrs.hasAttribute(SUMO_ATTR_HEIGHT)) {
418  vtype->height = attrs.get<double>(SUMO_ATTR_HEIGHT, vtype->id.c_str(), ok);
420  }
421  if (attrs.hasAttribute(SUMO_ATTR_GUISHAPE)) {
422  vtype->shape = parseGuiShape(attrs, vtype->id);
424  }
425  if (attrs.hasAttribute(SUMO_ATTR_OSGFILE)) {
426  vtype->osgFile = attrs.get<std::string>(SUMO_ATTR_OSGFILE, vtype->id.c_str(), ok);
428  }
429  if (attrs.hasAttribute(SUMO_ATTR_IMGFILE)) {
430  vtype->imgFile = attrs.get<std::string>(SUMO_ATTR_IMGFILE, vtype->id.c_str(), ok);
431  if (vtype->imgFile != "" && !FileHelpers::isAbsolute(vtype->imgFile)) {
433  }
435  }
436  if (attrs.hasAttribute(SUMO_ATTR_COLOR)) {
437  vtype->color = attrs.get<RGBColor>(SUMO_ATTR_COLOR, vtype->id.c_str(), ok);
439  } else {
440  vtype->color = RGBColor::YELLOW;
441  }
442  if (attrs.hasAttribute(SUMO_ATTR_PROB)) {
443  vtype->defaultProbability = attrs.get<double>(SUMO_ATTR_PROB, vtype->id.c_str(), ok);
445  }
448  std::string lcmS = attrs.get<std::string>(SUMO_ATTR_LANE_CHANGE_MODEL, vtype->id.c_str(), ok);
449  if (lcmS == "JE2013") {
450  WRITE_WARNING("Lane change model 'JE2013' is deprecated. Using default model instead.");
451  lcmS = "default";
452  }
453  if (SUMOXMLDefinitions::LaneChangeModels.hasString(lcmS)) {
455  } else {
456  WRITE_ERROR("Unknown lane change model '" + lcmS + "' when parsing vType '" + vtype->id + "'");
457  throw ProcessError();
458  }
459  }
461  const std::string cfmS = attrs.get<std::string>(SUMO_ATTR_CAR_FOLLOW_MODEL, vtype->id.c_str(), ok);
462  if (SUMOXMLDefinitions::CarFollowModels.hasString(cfmS)) {
465  } else {
466  WRITE_ERROR("Unknown car following model '" + cfmS + "' when parsing vType '" + vtype->id + "'");
467  throw ProcessError();
468  }
469  }
471  vtype->personCapacity = attrs.get<int>(SUMO_ATTR_PERSON_CAPACITY, vtype->id.c_str(), ok);
473  }
475  vtype->containerCapacity = attrs.get<int>(SUMO_ATTR_CONTAINER_CAPACITY, vtype->id.c_str(), ok);
477  }
479  vtype->boardingDuration = attrs.getSUMOTimeReporting(SUMO_ATTR_BOARDING_DURATION, vtype->id.c_str(), ok);
481  }
483  vtype->loadingDuration = attrs.getSUMOTimeReporting(SUMO_ATTR_LOADING_DURATION, vtype->id.c_str(), ok);
485  }
487  vtype->maxSpeedLat = attrs.get<double>(SUMO_ATTR_MAXSPEED_LAT, vtype->id.c_str(), ok);
489  }
490  if (attrs.hasAttribute(SUMO_ATTR_MINGAP_LAT)) {
491  vtype->minGapLat = attrs.get<double>(SUMO_ATTR_MINGAP_LAT, vtype->id.c_str(), ok);
493  }
495  const std::string alignS = attrs.get<std::string>(SUMO_ATTR_LATALIGNMENT, vtype->id.c_str(), ok);
496  if (SUMOXMLDefinitions::LateralAlignments.hasString(alignS)) {
499  } else {
500  WRITE_ERROR("Unknown lateral alignment '" + alignS + "' when parsing vType '" + vtype->id + "'");
501  throw ProcessError();
502  }
503  }
504  parseVTypeEmbedded(*vtype, vtype->cfModel, attrs, true);
505  parseLCParams(*vtype, vtype->lcModel, attrs);
506  parseJMParams(*vtype, attrs);
507  if (!ok) {
508  delete vtype;
509  throw ProcessError();
510  }
511  return vtype;
512 }
513 
514 
515 void
517  const SumoXMLTag element, const SUMOSAXAttributes& attrs,
518  const bool fromVType) {
519  const CFAttrMap& allowedAttrs = getAllowedCFModelAttrs();
520  CFAttrMap::const_iterator cf_it = allowedAttrs.find(element);
521  if (cf_it == allowedAttrs.end()) {
522  if (SUMOXMLDefinitions::Tags.has((int)element)) {
523  WRITE_ERROR("Unknown car following model " + toString(element) + " when parsing vType '" + into.id + "'");
524  } else {
525  WRITE_ERROR("Unknown car following model when parsing vType '" + into.id + "'");
526  }
527  throw ProcessError();
528  return;
529  }
530  if (!fromVType) {
531  into.cfModel = cf_it->first;
533  }
534  bool ok = true;
535  for (std::set<SumoXMLAttr>::const_iterator it = cf_it->second.begin(); it != cf_it->second.end(); ++it) {
536  if (attrs.hasAttribute(*it)) {
537  into.cfParameter[*it] = attrs.get<std::string>(*it, into.id.c_str(), ok);
538  if (*it == SUMO_ATTR_TAU && string2time(into.cfParameter[*it]) < DELTA_T && gSimulation) {
539  WRITE_WARNING("Value of tau=" + toString(into.cfParameter[*it])
540  + " in car following model '" + toString(into.cfModel) + "' lower than simulation step size may cause collisions");
541  }
542  }
543  }
544  if (!ok) {
545  throw ProcessError();
546  }
547 }
548 
549 
552  // init on first use
553  if (allowedCFModelAttrs.size() == 0) {
554  std::set<SumoXMLAttr> kraussParams;
555  kraussParams.insert(SUMO_ATTR_ACCEL);
556  kraussParams.insert(SUMO_ATTR_DECEL);
557  kraussParams.insert(SUMO_ATTR_APPARENTDECEL);
558  kraussParams.insert(SUMO_ATTR_EMERGENCYDECEL);
559  kraussParams.insert(SUMO_ATTR_SIGMA);
560  kraussParams.insert(SUMO_ATTR_TAU);
561  allowedCFModelAttrs[SUMO_TAG_CF_KRAUSS] = kraussParams;
564  std::set<SumoXMLAttr> allParams(kraussParams);
565 
566  std::set<SumoXMLAttr> kraussXParams(kraussParams);
567  kraussXParams.insert(SUMO_ATTR_TMP1);
568  kraussXParams.insert(SUMO_ATTR_TMP2);
569  kraussXParams.insert(SUMO_ATTR_TMP3);
570  kraussXParams.insert(SUMO_ATTR_TMP4);
571  kraussXParams.insert(SUMO_ATTR_TMP5);
572  allowedCFModelAttrs[SUMO_TAG_CF_KRAUSSX] = kraussXParams;
573  allParams.insert(kraussXParams.begin(), kraussXParams.end());
574 
575  std::set<SumoXMLAttr> smartSKParams;
576  smartSKParams.insert(SUMO_ATTR_ACCEL);
577  smartSKParams.insert(SUMO_ATTR_DECEL);
578  smartSKParams.insert(SUMO_ATTR_EMERGENCYDECEL);
579  smartSKParams.insert(SUMO_ATTR_SIGMA);
580  smartSKParams.insert(SUMO_ATTR_TAU);
581  smartSKParams.insert(SUMO_ATTR_TMP1);
582  smartSKParams.insert(SUMO_ATTR_TMP2);
583  smartSKParams.insert(SUMO_ATTR_TMP3);
584  smartSKParams.insert(SUMO_ATTR_TMP4);
585  smartSKParams.insert(SUMO_ATTR_TMP5);
586  allowedCFModelAttrs[SUMO_TAG_CF_SMART_SK] = smartSKParams;
587  allParams.insert(smartSKParams.begin(), smartSKParams.end());
588 
589  std::set<SumoXMLAttr> daniel1Params;
590  daniel1Params.insert(SUMO_ATTR_ACCEL);
591  daniel1Params.insert(SUMO_ATTR_DECEL);
592  daniel1Params.insert(SUMO_ATTR_EMERGENCYDECEL);
593  daniel1Params.insert(SUMO_ATTR_SIGMA);
594  daniel1Params.insert(SUMO_ATTR_TAU);
595  daniel1Params.insert(SUMO_ATTR_TMP1);
596  daniel1Params.insert(SUMO_ATTR_TMP2);
597  daniel1Params.insert(SUMO_ATTR_TMP3);
598  daniel1Params.insert(SUMO_ATTR_TMP4);
599  daniel1Params.insert(SUMO_ATTR_TMP5);
600  allowedCFModelAttrs[SUMO_TAG_CF_DANIEL1] = daniel1Params;
601  allParams.insert(daniel1Params.begin(), daniel1Params.end());
602 
603  std::set<SumoXMLAttr> pwagParams;
604  pwagParams.insert(SUMO_ATTR_ACCEL);
605  pwagParams.insert(SUMO_ATTR_DECEL);
606  pwagParams.insert(SUMO_ATTR_EMERGENCYDECEL);
607  pwagParams.insert(SUMO_ATTR_SIGMA);
608  pwagParams.insert(SUMO_ATTR_TAU);
609  pwagParams.insert(SUMO_ATTR_CF_PWAGNER2009_TAULAST);
610  pwagParams.insert(SUMO_ATTR_CF_PWAGNER2009_APPROB);
612  allParams.insert(pwagParams.begin(), pwagParams.end());
613 
614  std::set<SumoXMLAttr> idmParams;
615  idmParams.insert(SUMO_ATTR_ACCEL);
616  idmParams.insert(SUMO_ATTR_DECEL);
617  idmParams.insert(SUMO_ATTR_EMERGENCYDECEL);
618  idmParams.insert(SUMO_ATTR_TAU);
619  idmParams.insert(SUMO_ATTR_CF_IDM_DELTA);
620  idmParams.insert(SUMO_ATTR_CF_IDM_STEPPING);
622  allParams.insert(idmParams.begin(), idmParams.end());
623 
624  std::set<SumoXMLAttr> idmmParams;
625  idmmParams.insert(SUMO_ATTR_ACCEL);
626  idmmParams.insert(SUMO_ATTR_DECEL);
627  idmmParams.insert(SUMO_ATTR_EMERGENCYDECEL);
628  idmmParams.insert(SUMO_ATTR_TAU);
629  idmmParams.insert(SUMO_ATTR_CF_IDMM_ADAPT_FACTOR);
630  idmmParams.insert(SUMO_ATTR_CF_IDMM_ADAPT_TIME);
631  idmmParams.insert(SUMO_ATTR_CF_IDM_STEPPING);
633  allParams.insert(idmmParams.begin(), idmmParams.end());
634 
635  std::set<SumoXMLAttr> bkernerParams;
636  bkernerParams.insert(SUMO_ATTR_ACCEL);
637  bkernerParams.insert(SUMO_ATTR_DECEL);
638  bkernerParams.insert(SUMO_ATTR_EMERGENCYDECEL);
639  bkernerParams.insert(SUMO_ATTR_TAU);
640  bkernerParams.insert(SUMO_ATTR_K);
641  bkernerParams.insert(SUMO_ATTR_CF_KERNER_PHI);
642  allowedCFModelAttrs[SUMO_TAG_CF_BKERNER] = bkernerParams;
643  allParams.insert(bkernerParams.begin(), bkernerParams.end());
644 
645  std::set<SumoXMLAttr> wiedemannParams;
646  wiedemannParams.insert(SUMO_ATTR_ACCEL);
647  wiedemannParams.insert(SUMO_ATTR_DECEL);
648  wiedemannParams.insert(SUMO_ATTR_EMERGENCYDECEL);
649  wiedemannParams.insert(SUMO_ATTR_CF_WIEDEMANN_SECURITY);
650  wiedemannParams.insert(SUMO_ATTR_CF_WIEDEMANN_ESTIMATION);
651  allowedCFModelAttrs[SUMO_TAG_CF_WIEDEMANN] = wiedemannParams;
652  allParams.insert(wiedemannParams.begin(), wiedemannParams.end());
653 
654  std::set<SumoXMLAttr> railParams;
655  railParams.insert(SUMO_ATTR_TRAIN_TYPE);
657  allParams.insert(railParams.begin(), railParams.end());
658 
659  std::set<SumoXMLAttr> ACCParams;
660  ACCParams.insert(SUMO_ATTR_ACCEL);
661  ACCParams.insert(SUMO_ATTR_DECEL);
662  ACCParams.insert(SUMO_ATTR_EMERGENCYDECEL);
663  ACCParams.insert(SUMO_ATTR_TAU);
664  ACCParams.insert(SUMO_ATTR_SC_GAIN);
665  ACCParams.insert(SUMO_ATTR_GCC_GAIN_SPEED);
666  ACCParams.insert(SUMO_ATTR_GCC_GAIN_SPACE);
667  ACCParams.insert(SUMO_ATTR_GC_GAIN_SPEED);
668  ACCParams.insert(SUMO_ATTR_GC_GAIN_SPACE);
669  ACCParams.insert(SUMO_ATTR_CA_GAIN_SPEED);
670  ACCParams.insert(SUMO_ATTR_CA_GAIN_SPACE);
672  allParams.insert(ACCParams.begin(), ACCParams.end());
673 
675  }
676  return allowedCFModelAttrs;
677 }
678 
679 
680 void
682  if (allowedLCModelAttrs.size() == 0) {
683  // init static map
684  std::set<SumoXMLAttr> lc2013Params;
685  lc2013Params.insert(SUMO_ATTR_LCA_STRATEGIC_PARAM);
686  lc2013Params.insert(SUMO_ATTR_LCA_COOPERATIVE_PARAM);
687  lc2013Params.insert(SUMO_ATTR_LCA_SPEEDGAIN_PARAM);
688  lc2013Params.insert(SUMO_ATTR_LCA_KEEPRIGHT_PARAM);
689  lc2013Params.insert(SUMO_ATTR_LCA_LOOKAHEADLEFT);
690  lc2013Params.insert(SUMO_ATTR_LCA_SPEEDGAINRIGHT);
691  lc2013Params.insert(SUMO_ATTR_LCA_MAXSPEEDLATSTANDING);
692  lc2013Params.insert(SUMO_ATTR_LCA_MAXSPEEDLATFACTOR);
693  lc2013Params.insert(SUMO_ATTR_LCA_ASSERTIVE);
694  lc2013Params.insert(SUMO_ATTR_LCA_EXPERIMENTAL1);
695  allowedLCModelAttrs[LCM_LC2013] = lc2013Params;
696 
697  std::set<SumoXMLAttr> sl2015Params = lc2013Params;
698  sl2015Params.insert(SUMO_ATTR_LCA_PUSHY);
699  sl2015Params.insert(SUMO_ATTR_LCA_PUSHYGAP);
700  sl2015Params.insert(SUMO_ATTR_LCA_SUBLANE_PARAM);
701  sl2015Params.insert(SUMO_ATTR_LCA_IMPATIENCE);
702  sl2015Params.insert(SUMO_ATTR_LCA_TIME_TO_IMPATIENCE);
703  sl2015Params.insert(SUMO_ATTR_LCA_ACCEL_LAT);
704  sl2015Params.insert(SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE);
705  allowedLCModelAttrs[LCM_SL2015] = sl2015Params;
706 
707  std::set<SumoXMLAttr> noParams;
708  allowedLCModelAttrs[LCM_DK2008] = noParams;
709 
710  // default model may be either LC2013 or SL2015
711  // we allow both sets (sl2015 is a superset of lc2013Params)
712  allowedLCModelAttrs[LCM_DEFAULT] = sl2015Params;
713  }
714  bool ok = true;
715  std::set<SumoXMLAttr> allowed = allowedLCModelAttrs[model];
716  for (std::set<SumoXMLAttr>::const_iterator it = allowed.begin(); it != allowed.end(); it++) {
717  if (attrs.hasAttribute(*it)) {
718  into.lcParameter[*it] = attrs.get<std::string>(*it, into.id.c_str(), ok);
719  }
720  }
721  if (!ok) {
722  throw ProcessError();
723  }
724 }
725 
726 
727 void
729  if (allowedJMAttrs.size() == 0) {
730  // init static set (there is only one model)
739  }
740  bool ok = true;
741  for (std::set<SumoXMLAttr>::const_iterator it = allowedJMAttrs.begin(); it != allowedJMAttrs.end(); it++) {
742  if (attrs.hasAttribute(*it)) {
743  into.jmParameter[*it] = attrs.get<std::string>(*it, into.id.c_str(), ok);
744  }
745  }
746  if (!ok) {
747  throw ProcessError();
748  }
749 }
750 
751 
754  const std::string& id) {
756  try {
757  bool ok = true;
758  std::string vclassS = attrs.getOpt<std::string>(SUMO_ATTR_VCLASS, id.c_str(), ok, "");
759  if (vclassS == "") {
760  return vclass;
761  }
762  const SUMOVehicleClass result = getVehicleClassID(vclassS);
763  const std::string& realName = SumoVehicleClassStrings.getString(result);
764  if (realName != vclassS) {
765  WRITE_WARNING("The vehicle class '" + vclassS + "' for " + attrs.getObjectType() + " '" + id + "' is deprecated, use '" + realName + "' instead.");
766  }
767  return result;
768  } catch (...) {
769  WRITE_ERROR("The class for " + attrs.getObjectType() + " '" + id + "' is not known.");
770  }
771  return vclass;
772 }
773 
774 
776 SUMOVehicleParserHelper::parseGuiShape(const SUMOSAXAttributes& attrs, const std::string& id) {
777  bool ok = true;
778  std::string vclassS = attrs.getOpt<std::string>(SUMO_ATTR_GUISHAPE, id.c_str(), ok, "");
779  if (SumoVehicleShapeStrings.hasString(vclassS)) {
780  const SUMOVehicleShape result = SumoVehicleShapeStrings.get(vclassS);
781  const std::string& realName = SumoVehicleShapeStrings.getString(result);
782  if (realName != vclassS) {
783  WRITE_WARNING("The shape '" + vclassS + "' for " + attrs.getObjectType() + " '" + id + "' is deprecated, use '" + realName + "' instead.");
784  }
785  return result;
786  } else {
787  WRITE_ERROR("The shape '" + vclassS + "' for " + attrs.getObjectType() + " '" + id + "' is not known.");
788  return SVS_UNKNOWN;
789  }
790 }
791 
792 
793 double
794 SUMOVehicleParserHelper::parseWalkPos(SumoXMLAttr attr, const std::string& id, double maxPos, const std::string& val, std::mt19937* rng) {
795  double result;
796  std::string error;
798  // only supports 'random' and 'max'
799  if (!SUMOVehicleParameter::parseArrivalPos(val, toString(SUMO_TAG_WALK), id, result, proc, error)) {
800  throw ProcessError(error);
801  }
802  if (proc == ARRIVAL_POS_RANDOM) {
803  result = RandHelper::rand(maxPos, rng);
804  } else if (proc == ARRIVAL_POS_CENTER) {
805  result = maxPos / 2.;
806  } else if (proc == ARRIVAL_POS_MAX) {
807  result = maxPos;
808  }
809  return SUMOVehicleParameter::interpretEdgePos(result, maxPos, attr, id);
810 }
811 
812 
813 SUMOTime
815  SUMOTime result = TIME2STEPS(given);
816  if (result <= 0) {
817  if (result < 0) {
818  std::stringstream ss;
819  ss << "The parameter action-step-length must be a non-negative multiple of the simulation step-length. Ignoring given value (="
820  << STEPS2TIME(result) << " s.)";
821  WRITE_WARNING(ss.str());
822  }
823  result = DELTA_T;
824  } else if (result % DELTA_T != 0) {
825  std::stringstream ss;
826  result = (SUMOTime)(DELTA_T * floor(double(result) / double(DELTA_T)));
827  result = MAX2(DELTA_T, result);
828  if (fabs(given * 1000. - double(result)) > NUMERICAL_EPS) {
829  ss << "The parameter action-step-length must be a non-negative multiple of the simulation step-length. Parsing given value ("
830  << given << " s.) to the adjusted value "
831  << STEPS2TIME(result) << " s.";
832  WRITE_WARNING(ss.str());
833  }
834  }
835  return result;
836 }
837 
838 
839 /****************************************************************************/
840 
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
const int VTYPEPARS_MAXSPEED_SET
const int VEHPARS_TO_TAZ_SET
const int VTYPEPARS_MINGAP_SET
static StringBijection< SumoXMLTag > CarFollowModels
car following models
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLTag cfModel
The enum-representation of the car-following model to use.
RGBColor color
The vehicle&#39;s color, TraCI may change this.
const int VTYPEPARS_LATALIGNMENT_SET
long long int SUMOTime
Definition: SUMOTime.h:36
const int VEHPARS_FORCE_REROUTE
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
Definition: FileHelpers.cpp:75
static bool parseArrivalPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosLatDefinition &apd, std::string &error)
Validates a given arrivalPosLat value.
double impatience
The vehicle&#39;s impatience (willingness to obstruct others)
const int VTYPEPARS_HASDRIVERSTATE_SET
std::string vtypeid
The vehicle&#39;s type id.
static std::set< SumoXMLAttr > allowedJMAttrs
static SUMOVehicleShape parseGuiShape(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle class.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings(sumoVehicleShapeStringInitializer, SVS_UNKNOWN, false)
virtual std::string getName(int attr) const =0
Converts the given attribute id into a man readable string.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
SUMOVehicleShape shape
This class&#39; shape.
Structure representing possible vehicle parameter.
const int VTYPEPARS_MINGAP_LAT_SET
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
double defaultProbability
The probability when being added to a distribution without an explicit probability.
std::vector< double > & getParameter()
Returns the parameters of this distribution.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle&#39;s attributes.
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
Definition: RandHelper.h:61
static void parseVTypeEmbedded(SUMOVTypeParameter &into, const SumoXMLTag element, const SUMOSAXAttributes &attrs, const bool fromVType=false)
Parses an element embedded in vtype definition.
int containerCapacity
The container capacity of the vehicle.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
const int VTYPEPARS_BOARDING_DURATION
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
weights: time range begin
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
static SUMOTime processActionStepLength(double given)
Checks and converts given value for the action step length from seconds to miliseconds assuring it be...
T MAX2(T a, T b)
Definition: StdDefs.h:68
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
const int VEHPARS_ARRIVALLANE_SET
const std::string & getObjectType() const
return the objecttype to which these attributes belong
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle&#39;s end speed shall be chosen.
const int VTYPEPARS_CAR_FOLLOW_MODEL
#define TIME2STEPS(x)
Definition: SUMOTime.h:60
const int VTYPEPARS_OSGFILE_SET
const int VTYPEPARS_MAXSPEED_LAT_SET
const int VTYPEPARS_PROBABILITY_SET
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
static double parseWalkPos(SumoXMLAttr attr, const std::string &id, double maxPos, const std::string &val, std::mt19937 *rng=0)
parse departPos or arrivalPos for a walk
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:242
void parse(const std::string &description)
Overwrite by parsable distribution description.
static SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle class.
static void parseLCParams(SUMOVTypeParameter &into, LaneChangeModel model, const SUMOSAXAttributes &attrs)
Parses lane change model attributes.
double height
This class&#39; height.
std::string toTaz
The vehicle&#39;s destination zone (district)
const int VTYPEPARS_LANE_CHANGE_MODEL_SET
bool gSimulation
Definition: StdDefs.cpp:30
const int VEHPARS_ARRIVALSPEED_SET
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
double departSpeed
(optional) The initial speed of the vehicle
static const CFAttrMap & getAllowedCFModelAttrs()
LaneChangeModel
Half the road length.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle&#39;s initial speed shall be chosen.
double maxSpeed
The vehicle type&#39;s maximum speed [m/s].
double width
This class&#39; width.
SUMOTime boardingDuration
The time a person needs to board the vehicle.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
const int VTYPEPARS_ACTIONSTEPLENGTH_SET
std::string routeid
The vehicle&#39;s route id.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Encapsulated SAX-Attributes.
static SUMOVehicleParameter * parseFlowAttributes(const SUMOSAXAttributes &attrs, const SUMOTime beginDefault, const SUMOTime endDefault)
Parses a flow&#39;s attributes.
const int VEHPARS_DEPARTSPEED_SET
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
Definition: FileHelpers.cpp:90
std::string osgFile
3D model file for this class
static void parseCommonAttributes(const SUMOSAXAttributes &attrs, SUMOVehicleParameter *ret, std::string element)
Parses attributes common to vehicles and flows.
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
Definition: RGBColor.h:185
not defined
std::map< SumoXMLTag, std::set< SumoXMLAttr > > CFAttrMap
T get(const std::string &str) const
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
std::string imgFile
Image file for this class.
const int VEHPARS_DEPARTPOSLAT_SET
SUMOTime depart
The vehicle&#39;s departure time.
#define STEPS2TIME(x)
Definition: SUMOTime.h:58
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:42
const int VEHPARS_ROUTE_SET
std::string fromTaz
The vehicle&#39;s origin zone (district)
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
const int VTYPEPARS_LOADING_DURATION
const int VTYPEPARS_CONTAINER_CAPACITY
const int VEHPARS_COLOR_SET
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
vehicle is a passenger car (a "normal" car)
const int VEHPARS_FROM_TAZ_SET
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
std::string line
The vehicle&#39;s line (mainly for public transport)
const int VTYPEPARS_SPEEDFACTOR_SET
double arrivalPos
(optional) The position the vehicle shall arrive on
double maxSpeedLat
The vehicle type&#39;s maximum lateral speed [m/s].
int parametersSet
Information for the router which parameter were set.
const int VEHPARS_ARRIVALPOSLAT_SET
double departPosLat
(optional) The lateral position the vehicle shall depart from
const int VEHPARS_LINE_SET
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:248
const int VEHPARS_ARRIVALPOS_SET
int personCapacity
The person capacity of the vehicle.
bool hasDriverState
Whether vehicles of this type are equipped with a driver (i.e. MSDriverState))
static StringBijection< LateralAlignment > LateralAlignments
lateral alignments
double departPos
(optional) The position the vehicle shall depart from
double minGapLat
The vehicle type&#39;s minimum lateral gap [m].
static const RGBColor YELLOW
Definition: RGBColor.h:175
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
Structure representing possible vehicle parameter.
#define SUMOTime_MAX
Definition: SUMOTime.h:37
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
const int VEHPARS_PERIODFREQ_SET
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
const std::string DEFAULT_PEDTYPE_ID
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
static void parseJMParams(SUMOVTypeParameter &into, const SUMOSAXAttributes &attrs)
Parses junction model attributes.
weights: time range end
SubParams jmParameter
Junction-model parameter.
const int VTYPEPARS_IMGFILE_SET
static bool parseDepartPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosLatDefinition &dpd, std::string &error)
Validates a given departPosLat value.
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
SubParams cfParameter
Car-following parameter.
SUMOTime loadingDuration
The time a container needs to get loaded on the vehicle.
RGBColor color
The color.
const int VEHPARS_DEPARTLANE_SET
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
int containerNumber
The static number of containers in the vehicle when it departs.
std::string id
The vehicle type&#39;s id.
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
const int VTYPEPARS_PERSON_CAPACITY
LateralAlignment latAlignment
The vehicles desired lateral alignment.
SUMOTime actionStepLength
The vehicle type&#39;s default actionStepLength [ms], i.e. the interval between two control actions...
const int VEHPARS_VTYPE_SET
double minGap
This class&#39; free space in front of the vehicle itself.
const int VTYPEPARS_HEIGHT_SET
ArrivalPosDefinition
Possible ways to choose the arrival position.
#define NUMERICAL_EPS
Definition: config.h:148
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
const int VTYPEPARS_WIDTH_SET
static StringBijection< int > Tags
The names of SUMO-XML elements for use in netbuild.
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_PERSON_NUMBER_SET
LaneChangeModel lcModel
The lane-change model to use.
const int VTYPEPARS_LENGTH_SET
const int VTYPEPARS_VEHICLECLASS_SET
static SUMOVTypeParameter * beginVTypeParsing(const SUMOSAXAttributes &attrs, const std::string &file)
Starts to parse a vehicle type.
const int VEHPARS_CONTAINER_NUMBER_SET
A color information.
const int VTYPEPARS_EMISSIONCLASS_SET
The maximum arrival position is used.
const int VTYPEPARS_COLOR_SET
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street...
const int VTYPEPARS_SHAPE_SET
double length
The physical vehicle length.
SubParams lcParameter
Lane-changing parameter.
static StringBijection< LaneChangeModel > LaneChangeModels
lane change models
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
SUMOEmissionClass emissionClass
The emission class of this vehicle.
vehicles ignoring classes
std::map< LaneChangeModel, std::set< SumoXMLAttr > > LCAttrMap
bool isValid(std::string &error)
check whether the distribution is valid
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
std::string id
The vehicle&#39;s id.
const int VTYPEPARS_IMPATIENCE_SET
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
The arrival position is chosen randomly.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.