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, nullptr, 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, nullptr, ok, "");
195  } else {
196  id = attrs.get<std::string>(SUMO_ATTR_ID, nullptr, 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, nullptr, 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, nullptr, 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_EMERGENCYDECEL);
560  kraussParams.insert(SUMO_ATTR_SIGMA);
561  kraussParams.insert(SUMO_ATTR_TAU);
562  allowedCFModelAttrs[SUMO_TAG_CF_KRAUSS] = kraussParams;
565  std::set<SumoXMLAttr> allParams(kraussParams);
566 
567  std::set<SumoXMLAttr> kraussXParams(kraussParams);
568  kraussXParams.insert(SUMO_ATTR_TMP1);
569  kraussXParams.insert(SUMO_ATTR_TMP2);
570  kraussXParams.insert(SUMO_ATTR_TMP3);
571  kraussXParams.insert(SUMO_ATTR_TMP4);
572  kraussXParams.insert(SUMO_ATTR_TMP5);
573  allowedCFModelAttrs[SUMO_TAG_CF_KRAUSSX] = kraussXParams;
574  allParams.insert(kraussXParams.begin(), kraussXParams.end());
575 
576  std::set<SumoXMLAttr> smartSKParams;
577  smartSKParams.insert(SUMO_ATTR_ACCEL);
578  smartSKParams.insert(SUMO_ATTR_DECEL);
579  smartSKParams.insert(SUMO_ATTR_EMERGENCYDECEL);
580  smartSKParams.insert(SUMO_ATTR_COLLISION_MINGAP_FACTOR);
581  smartSKParams.insert(SUMO_ATTR_SIGMA);
582  smartSKParams.insert(SUMO_ATTR_TAU);
583  smartSKParams.insert(SUMO_ATTR_TMP1);
584  smartSKParams.insert(SUMO_ATTR_TMP2);
585  smartSKParams.insert(SUMO_ATTR_TMP3);
586  smartSKParams.insert(SUMO_ATTR_TMP4);
587  smartSKParams.insert(SUMO_ATTR_TMP5);
588  allowedCFModelAttrs[SUMO_TAG_CF_SMART_SK] = smartSKParams;
589  allParams.insert(smartSKParams.begin(), smartSKParams.end());
590 
591  std::set<SumoXMLAttr> daniel1Params;
592  daniel1Params.insert(SUMO_ATTR_ACCEL);
593  daniel1Params.insert(SUMO_ATTR_DECEL);
594  daniel1Params.insert(SUMO_ATTR_EMERGENCYDECEL);
595  daniel1Params.insert(SUMO_ATTR_COLLISION_MINGAP_FACTOR);
596  daniel1Params.insert(SUMO_ATTR_SIGMA);
597  daniel1Params.insert(SUMO_ATTR_TAU);
598  daniel1Params.insert(SUMO_ATTR_TMP1);
599  daniel1Params.insert(SUMO_ATTR_TMP2);
600  daniel1Params.insert(SUMO_ATTR_TMP3);
601  daniel1Params.insert(SUMO_ATTR_TMP4);
602  daniel1Params.insert(SUMO_ATTR_TMP5);
603  allowedCFModelAttrs[SUMO_TAG_CF_DANIEL1] = daniel1Params;
604  allParams.insert(daniel1Params.begin(), daniel1Params.end());
605 
606  std::set<SumoXMLAttr> pwagParams;
607  pwagParams.insert(SUMO_ATTR_ACCEL);
608  pwagParams.insert(SUMO_ATTR_DECEL);
609  pwagParams.insert(SUMO_ATTR_EMERGENCYDECEL);
610  pwagParams.insert(SUMO_ATTR_COLLISION_MINGAP_FACTOR);
611  pwagParams.insert(SUMO_ATTR_SIGMA);
612  pwagParams.insert(SUMO_ATTR_TAU);
613  pwagParams.insert(SUMO_ATTR_CF_PWAGNER2009_TAULAST);
614  pwagParams.insert(SUMO_ATTR_CF_PWAGNER2009_APPROB);
616  allParams.insert(pwagParams.begin(), pwagParams.end());
617 
618  std::set<SumoXMLAttr> idmParams;
619  idmParams.insert(SUMO_ATTR_ACCEL);
620  idmParams.insert(SUMO_ATTR_DECEL);
621  idmParams.insert(SUMO_ATTR_EMERGENCYDECEL);
622  idmParams.insert(SUMO_ATTR_COLLISION_MINGAP_FACTOR);
623  idmParams.insert(SUMO_ATTR_TAU);
624  idmParams.insert(SUMO_ATTR_CF_IDM_DELTA);
625  idmParams.insert(SUMO_ATTR_CF_IDM_STEPPING);
627  allParams.insert(idmParams.begin(), idmParams.end());
628 
629  std::set<SumoXMLAttr> idmmParams;
630  idmmParams.insert(SUMO_ATTR_ACCEL);
631  idmmParams.insert(SUMO_ATTR_DECEL);
632  idmmParams.insert(SUMO_ATTR_EMERGENCYDECEL);
633  idmmParams.insert(SUMO_ATTR_COLLISION_MINGAP_FACTOR);
634  idmmParams.insert(SUMO_ATTR_TAU);
635  idmmParams.insert(SUMO_ATTR_CF_IDMM_ADAPT_FACTOR);
636  idmmParams.insert(SUMO_ATTR_CF_IDMM_ADAPT_TIME);
637  idmmParams.insert(SUMO_ATTR_CF_IDM_STEPPING);
639  allParams.insert(idmmParams.begin(), idmmParams.end());
640 
641  std::set<SumoXMLAttr> bkernerParams;
642  bkernerParams.insert(SUMO_ATTR_ACCEL);
643  bkernerParams.insert(SUMO_ATTR_DECEL);
644  bkernerParams.insert(SUMO_ATTR_EMERGENCYDECEL);
645  bkernerParams.insert(SUMO_ATTR_COLLISION_MINGAP_FACTOR);
646  bkernerParams.insert(SUMO_ATTR_TAU);
647  bkernerParams.insert(SUMO_ATTR_K);
648  bkernerParams.insert(SUMO_ATTR_CF_KERNER_PHI);
649  allowedCFModelAttrs[SUMO_TAG_CF_BKERNER] = bkernerParams;
650  allParams.insert(bkernerParams.begin(), bkernerParams.end());
651 
652  std::set<SumoXMLAttr> wiedemannParams;
653  wiedemannParams.insert(SUMO_ATTR_ACCEL);
654  wiedemannParams.insert(SUMO_ATTR_DECEL);
655  wiedemannParams.insert(SUMO_ATTR_EMERGENCYDECEL);
656  wiedemannParams.insert(SUMO_ATTR_COLLISION_MINGAP_FACTOR);
657  wiedemannParams.insert(SUMO_ATTR_CF_WIEDEMANN_SECURITY);
658  wiedemannParams.insert(SUMO_ATTR_CF_WIEDEMANN_ESTIMATION);
659  allowedCFModelAttrs[SUMO_TAG_CF_WIEDEMANN] = wiedemannParams;
660  allParams.insert(wiedemannParams.begin(), wiedemannParams.end());
661 
662  std::set<SumoXMLAttr> railParams;
663  railParams.insert(SUMO_ATTR_TRAIN_TYPE);
665  allParams.insert(railParams.begin(), railParams.end());
666 
667  std::set<SumoXMLAttr> ACCParams;
668  ACCParams.insert(SUMO_ATTR_ACCEL);
669  ACCParams.insert(SUMO_ATTR_DECEL);
670  ACCParams.insert(SUMO_ATTR_EMERGENCYDECEL);
671  ACCParams.insert(SUMO_ATTR_COLLISION_MINGAP_FACTOR);
672  ACCParams.insert(SUMO_ATTR_TAU);
673  ACCParams.insert(SUMO_ATTR_SC_GAIN);
674  ACCParams.insert(SUMO_ATTR_GCC_GAIN_SPEED);
675  ACCParams.insert(SUMO_ATTR_GCC_GAIN_SPACE);
676  ACCParams.insert(SUMO_ATTR_GC_GAIN_SPEED);
677  ACCParams.insert(SUMO_ATTR_GC_GAIN_SPACE);
678  ACCParams.insert(SUMO_ATTR_CA_GAIN_SPEED);
679  ACCParams.insert(SUMO_ATTR_CA_GAIN_SPACE);
681  allParams.insert(ACCParams.begin(), ACCParams.end());
682 
683  std::set<SumoXMLAttr> CACCParams;
684  CACCParams.insert(SUMO_ATTR_ACCEL);
685  CACCParams.insert(SUMO_ATTR_DECEL);
686  CACCParams.insert(SUMO_ATTR_EMERGENCYDECEL);
687  CACCParams.insert(SUMO_ATTR_COLLISION_MINGAP_FACTOR);
688  CACCParams.insert(SUMO_ATTR_TAU);
689  CACCParams.insert(SUMO_ATTR_SC_GAIN_CACC);
690  CACCParams.insert(SUMO_ATTR_GCC_GAIN_GAP_CACC);
691  CACCParams.insert(SUMO_ATTR_GCC_GAIN_GAP_DOT_CACC);
692  CACCParams.insert(SUMO_ATTR_GC_GAIN_GAP_CACC);
693  CACCParams.insert(SUMO_ATTR_GC_GAIN_GAP_DOT_CACC);
694  CACCParams.insert(SUMO_ATTR_CA_GAIN_GAP_CACC);
695  CACCParams.insert(SUMO_ATTR_CA_GAIN_GAP_DOT_CACC);
696  CACCParams.insert(SUMO_ATTR_GCC_GAIN_SPEED);
697  CACCParams.insert(SUMO_ATTR_GCC_GAIN_SPACE);
698  CACCParams.insert(SUMO_ATTR_GC_GAIN_SPEED);
699  CACCParams.insert(SUMO_ATTR_GC_GAIN_SPACE);
700  CACCParams.insert(SUMO_ATTR_CA_GAIN_SPEED);
701  CACCParams.insert(SUMO_ATTR_CA_GAIN_SPACE);
703  allParams.insert(CACCParams.begin(), CACCParams.end());
704 
706  }
707  return allowedCFModelAttrs;
708 }
709 
710 
711 void
713  if (allowedLCModelAttrs.size() == 0) {
714  // init static map
715  std::set<SumoXMLAttr> lc2013Params;
716  lc2013Params.insert(SUMO_ATTR_LCA_STRATEGIC_PARAM);
717  lc2013Params.insert(SUMO_ATTR_LCA_COOPERATIVE_PARAM);
718  lc2013Params.insert(SUMO_ATTR_LCA_SPEEDGAIN_PARAM);
719  lc2013Params.insert(SUMO_ATTR_LCA_KEEPRIGHT_PARAM);
720  lc2013Params.insert(SUMO_ATTR_LCA_OPPOSITE_PARAM);
721  lc2013Params.insert(SUMO_ATTR_LCA_LOOKAHEADLEFT);
722  lc2013Params.insert(SUMO_ATTR_LCA_SPEEDGAINRIGHT);
723  lc2013Params.insert(SUMO_ATTR_LCA_MAXSPEEDLATSTANDING);
724  lc2013Params.insert(SUMO_ATTR_LCA_MAXSPEEDLATFACTOR);
725  lc2013Params.insert(SUMO_ATTR_LCA_ASSERTIVE);
726  lc2013Params.insert(SUMO_ATTR_LCA_EXPERIMENTAL1);
727  allowedLCModelAttrs[LCM_LC2013] = lc2013Params;
728 
729  std::set<SumoXMLAttr> sl2015Params = lc2013Params;
730  sl2015Params.insert(SUMO_ATTR_LCA_PUSHY);
731  sl2015Params.insert(SUMO_ATTR_LCA_PUSHYGAP);
732  sl2015Params.insert(SUMO_ATTR_LCA_SUBLANE_PARAM);
733  sl2015Params.insert(SUMO_ATTR_LCA_IMPATIENCE);
734  sl2015Params.insert(SUMO_ATTR_LCA_TIME_TO_IMPATIENCE);
735  sl2015Params.insert(SUMO_ATTR_LCA_ACCEL_LAT);
736  sl2015Params.insert(SUMO_ATTR_LCA_TURN_ALIGNMENT_DISTANCE);
737  allowedLCModelAttrs[LCM_SL2015] = sl2015Params;
738 
739  std::set<SumoXMLAttr> noParams;
740  allowedLCModelAttrs[LCM_DK2008] = noParams;
741 
742  // default model may be either LC2013 or SL2015
743  // we allow both sets (sl2015 is a superset of lc2013Params)
744  allowedLCModelAttrs[LCM_DEFAULT] = sl2015Params;
745  }
746  bool ok = true;
747  std::set<SumoXMLAttr> allowed = allowedLCModelAttrs[model];
748  for (std::set<SumoXMLAttr>::const_iterator it = allowed.begin(); it != allowed.end(); it++) {
749  if (attrs.hasAttribute(*it)) {
750  into.lcParameter[*it] = attrs.get<std::string>(*it, into.id.c_str(), ok);
751  }
752  }
753  if (!ok) {
754  throw ProcessError();
755  }
756 }
757 
758 
759 void
761  if (allowedJMAttrs.size() == 0) {
762  // init static set (there is only one model)
771  }
772  bool ok = true;
773  for (std::set<SumoXMLAttr>::const_iterator it = allowedJMAttrs.begin(); it != allowedJMAttrs.end(); it++) {
774  if (attrs.hasAttribute(*it)) {
775  into.jmParameter[*it] = attrs.get<std::string>(*it, into.id.c_str(), ok);
776  }
777  }
778  if (!ok) {
779  throw ProcessError();
780  }
781 }
782 
783 
786  const std::string& id) {
788  try {
789  bool ok = true;
790  std::string vclassS = attrs.getOpt<std::string>(SUMO_ATTR_VCLASS, id.c_str(), ok, "");
791  if (vclassS == "") {
792  return vclass;
793  }
794  const SUMOVehicleClass result = getVehicleClassID(vclassS);
795  const std::string& realName = SumoVehicleClassStrings.getString(result);
796  if (realName != vclassS) {
797  WRITE_WARNING("The vehicle class '" + vclassS + "' for " + attrs.getObjectType() + " '" + id + "' is deprecated, use '" + realName + "' instead.");
798  }
799  return result;
800  } catch (...) {
801  WRITE_ERROR("The class for " + attrs.getObjectType() + " '" + id + "' is not known.");
802  }
803  return vclass;
804 }
805 
806 
808 SUMOVehicleParserHelper::parseGuiShape(const SUMOSAXAttributes& attrs, const std::string& id) {
809  bool ok = true;
810  std::string vclassS = attrs.getOpt<std::string>(SUMO_ATTR_GUISHAPE, id.c_str(), ok, "");
811  if (SumoVehicleShapeStrings.hasString(vclassS)) {
812  const SUMOVehicleShape result = SumoVehicleShapeStrings.get(vclassS);
813  const std::string& realName = SumoVehicleShapeStrings.getString(result);
814  if (realName != vclassS) {
815  WRITE_WARNING("The shape '" + vclassS + "' for " + attrs.getObjectType() + " '" + id + "' is deprecated, use '" + realName + "' instead.");
816  }
817  return result;
818  } else {
819  WRITE_ERROR("The shape '" + vclassS + "' for " + attrs.getObjectType() + " '" + id + "' is not known.");
820  return SVS_UNKNOWN;
821  }
822 }
823 
824 
825 double
826 SUMOVehicleParserHelper::parseWalkPos(SumoXMLAttr attr, const std::string& id, double maxPos, const std::string& val, std::mt19937* rng) {
827  double result;
828  std::string error;
830  // only supports 'random' and 'max'
831  if (!SUMOVehicleParameter::parseArrivalPos(val, toString(SUMO_TAG_WALK), id, result, proc, error)) {
832  throw ProcessError(error);
833  }
834  if (proc == ARRIVAL_POS_RANDOM) {
835  result = RandHelper::rand(maxPos, rng);
836  } else if (proc == ARRIVAL_POS_CENTER) {
837  result = maxPos / 2.;
838  } else if (proc == ARRIVAL_POS_MAX) {
839  result = maxPos;
840  }
841  return SUMOVehicleParameter::interpretEdgePos(result, maxPos, attr, id);
842 }
843 
844 
845 SUMOTime
847  SUMOTime result = TIME2STEPS(given);
848  if (result <= 0) {
849  if (result < 0) {
850  std::stringstream ss;
851  ss << "The parameter action-step-length must be a non-negative multiple of the simulation step-length. Ignoring given value (="
852  << STEPS2TIME(result) << " s.)";
853  WRITE_WARNING(ss.str());
854  }
855  result = DELTA_T;
856  } else if (result % DELTA_T != 0) {
857  std::stringstream ss;
858  result = (SUMOTime)(DELTA_T * floor(double(result) / double(DELTA_T)));
859  result = MAX2(DELTA_T, result);
860  if (fabs(given * 1000. - double(result)) > NUMERICAL_EPS) {
861  ss << "The parameter action-step-length must be a non-negative multiple of the simulation step-length. Parsing given value ("
862  << given << " s.) to the adjusted value "
863  << STEPS2TIME(result) << " s.";
864  WRITE_WARNING(ss.str());
865  }
866  }
867  return result;
868 }
869 
870 
871 /****************************************************************************/
872 
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:76
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:241
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:198
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:247
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:187
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.