Eclipse SUMO - Simulation of Urban MObility
MSCFModel_CC.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 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 /****************************************************************************/
14 // A series of automatic Cruise Controllers (CC, ACC, CACC)
15 /****************************************************************************/
16 
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include "MSCFModel_CC.h"
22 #include <microsim/MSVehicle.h>
24 #include <microsim/MSNet.h>
25 #include <microsim/MSEdge.h>
27 #include <utils/common/SUMOTime.h>
30 #include <libsumo/Vehicle.h>
31 #include <libsumo/TraCIDefs.h>
32 #include <algorithm>
33 
34 #ifndef sgn
35 #define sgn(x) ((x > 0) - (x < 0))
36 #endif
37 
38 // ===========================================================================
39 // method definitions
40 // ===========================================================================
42  myCcDecel(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_CCDECEL, 1.5)),
43  myCcAccel(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_CCACCEL, 1.5)),
44  myConstantSpacing(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_CONSTSPACING, 5.0)),
45  myKp(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_KP, 1.0)),
46  myLambda(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_LAMBDA, 0.1)),
47  myC1(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_C1, 0.5)),
48  myXi(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_XI, 1.0)),
49  myOmegaN(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_OMEGAN, 0.2)),
50  myTau(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_TAU, 0.5)),
51  myLanesCount((int)vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_LANES_COUNT, -1)),
52  myPloegH(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_PLOEG_H, 0.5)),
53  myPloegKp(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_PLOEG_KP, 0.2)),
54  myPloegKd(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_PLOEG_KD, 0.7)),
55  myFlatbedKa(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_FLATBED_KA, 2.4)),
56  myFlatbedKv(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_FLATBED_KV, 0.6)),
57  myFlatbedKp(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_FLATBED_KP, 12.0)),
58  myFlatbedH(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_FLATBED_H, 4.0)),
59  myFlatbedD(vtype->getParameter().getCFParam(SUMO_ATTR_CF_CC_FLATBED_D, 5.0)) {
60 
61  //if the lanes count has not been specified in the attributes of the model, lane changing cannot properly work
62  if (myLanesCount == -1) {
63  std::cerr << "The number of lanes needs to be specified in the attributes of carFollowing-CC with the \"lanesCount\" attribute\n";
64  WRITE_ERROR("The number of lanes needs to be specified in the attributes of carFollowing-CC with the \"lanesCount\" attribute");
65  assert(false);
66  }
67 
68  //instantiate the driver model. For now, use Krauss as default, then needs to be parameterized
69  myHumanDriver = new MSCFModel_Krauss(vtype);
70 
71 }
72 
74 
78  vars->ccKp = myKp;
79  vars->accLambda = myLambda;
81  vars->caccC1 = myC1;
82  vars->caccXi = myXi;
83  vars->caccOmegaN = myOmegaN;
84  vars->engineTau = myTau;
85  //we cannot invoke recomputeParameters() because we have no pointer to the MSVehicle class
86  vars->caccAlpha1 = 1 - vars->caccC1;
87  vars->caccAlpha2 = vars->caccC1;
88  vars->caccAlpha3 = -(2 * vars->caccXi - vars->caccC1 * (vars->caccXi + sqrt(vars->caccXi * vars->caccXi - 1))) * vars->caccOmegaN;
89  vars->caccAlpha4 = -(vars->caccXi + sqrt(vars->caccXi * vars->caccXi - 1)) * vars->caccOmegaN * vars->caccC1;
90  vars->caccAlpha5 = -vars->caccOmegaN * vars->caccOmegaN;
91 
92  vars->ploegH = myPloegH;
93  vars->ploegKp = myPloegKp;
94  vars->ploegKd = myPloegKd;
95  vars->flatbedKa = myFlatbedKa;
96  vars->flatbedKv = myFlatbedKv;
97  vars->flatbedKp = myFlatbedKp;
98  vars->flatbedD = myFlatbedD;
99  vars->flatbedH = myFlatbedH;
100  //by default use a first order lag model for the engine
101  vars->engine = new FirstOrderLagModel();
102  vars->engine->setParameter(FOLM_PAR_TAU, vars->engineTau);
107  return (VehicleVariables*)vars;
108 }
109 
110 void
112  bool canChange;
114  // check for left lane change
115  std::pair<int, int> state = libsumo::Vehicle::getLaneChangeState(veh->getID(), +1);
116  int traciState = state.first;
117  if (traciState & LCA_LEFT && traciState & LCA_SPEEDGAIN) {
118  // we can gain by moving left. check that all vehicles can move left
119  if (!(state.first & LCA_BLOCKED)) {
120  // leader is not blocked. check all the members
121  canChange = true;
122  for (auto m = vars->members.begin(); m != vars->members.end(); m++) {
123  const std::pair<int, int> mState = libsumo::Vehicle::getLaneChangeState(m->second, +1);
124  if (mState.first & LCA_BLOCKED) {
125  canChange = false;
126  break;
127  }
128  }
129  if (canChange) {
130  libsumo::Vehicle::changeLane(veh->getID(), veh->getLaneIndex() + 1, 0);
131  for (auto m = vars->members.begin(); m != vars->members.end(); m++) {
132  libsumo::Vehicle::changeLane(m->second, veh->getLaneIndex() + 1, 0);
133  }
134  }
135 
136  }
137  }
138  state = libsumo::Vehicle::getLaneChangeState(veh->getID(), -1);
139  traciState = state.first;
140  if (traciState & LCA_RIGHT && traciState & LCA_KEEPRIGHT) {
141  // we should move back right. check that all vehicles can move right
142  if (!(state.first & LCA_BLOCKED)) {
143  // leader is not blocked. check all the members
144  canChange = true;
145  for (auto m = vars->members.begin(); m != vars->members.end(); m++) {
146  const std::pair<int, int> mState = libsumo::Vehicle::getLaneChangeState(m->second, -1);
147  if (mState.first & LCA_BLOCKED) {
148  canChange = false;
149  break;
150  }
151  }
152  if (canChange) {
153  libsumo::Vehicle::changeLane(veh->getID(), veh->getLaneIndex() - 1, 1);
154  for (auto m = vars->members.begin(); m != vars->members.end(); m++) {
155  libsumo::Vehicle::changeLane(m->second, veh->getLaneIndex() - 1, 1);
156  }
157  }
158 
159  }
160  }
161 
162 }
163 
164 double
165 MSCFModel_CC::finalizeSpeed(MSVehicle* const veh, double vPos) const {
166  double vNext;
167  //acceleration computed by the controller
168  double controllerAcceleration;
169  //acceleration after engine actuation
170  double engineAcceleration;
171 
173 
174  //call processNextStop() to ensure vehicle removal in case of crash
175  veh->processNextStop(vPos);
176 
177  //check whether the vehicle has collided and set the flag in case
178  if (!vars->crashed) {
179  for (const MSVehicle::Stop& s : veh->getMyStops()) {
180  if (s.collision) {
181  vars->crashed = true;
182  }
183  }
184  }
185 
186  if (vars->activeController != Plexe::DRIVER) {
188  }
189 
190  if (vars->autoLaneChange) {
192  }
193 
194  if (vars->activeController != Plexe::DRIVER) {
195  controllerAcceleration = SPEED2ACCEL(vPos - veh->getSpeed());
196  controllerAcceleration = std::min(vars->uMax, std::max(vars->uMin, controllerAcceleration));
197  //compute the actual acceleration applied by the engine
198  engineAcceleration = vars->engine->getRealAcceleration(veh->getSpeed(), veh->getAcceleration(), controllerAcceleration, MSNet::getInstance()->getCurrentTimeStep());
199  vNext = MAX2(double(0), veh->getSpeed() + ACCEL2SPEED(engineAcceleration));
200  vars->controllerAcceleration = controllerAcceleration;
201  } else {
202  vNext = myHumanDriver->finalizeSpeed(veh, vPos);
203  }
204 
205  return vNext;
206 }
207 
208 
209 double
210 MSCFModel_CC::followSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const pred) const {
211 
212  UNUSED_PARAMETER(pred);
214 
215  if (vars->activeController != Plexe::DRIVER) {
216  return _v(veh, gap2pred, speed, predSpeed);
217  } else {
218  return myHumanDriver->followSpeed(veh, speed, gap2pred, predSpeed, predMaxDecel);
219  }
220 }
221 
222 double
223 MSCFModel_CC::insertionFollowSpeed(const MSVehicle* const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle* const /*pred*/) const {
224  UNUSED_PARAMETER(veh);
225  UNUSED_PARAMETER(gap2pred);
226  UNUSED_PARAMETER(predSpeed);
227  UNUSED_PARAMETER(predMaxDecel);
228  //by returning speed + 1, we tell sumo that "speed" is always a safe speed
229  return speed + 1;
230 }
231 
232 double
233 MSCFModel_CC::stopSpeed(const MSVehicle* const veh, double speed, double gap2pred) const {
234 
236  if (vars->activeController != Plexe::DRIVER) {
237  double gap2pred, relSpeed;
238  getRadarMeasurements(veh, gap2pred, relSpeed);
239  if (gap2pred == -1) {
240  gap2pred = std::numeric_limits<double>().max();
241  }
242  return _v(veh, gap2pred, speed, speed + relSpeed);
243  } else {
244  return myHumanDriver->stopSpeed(veh, speed, gap2pred);
245  }
246 }
247 
248 double MSCFModel_CC::freeSpeed(const MSVehicle* const veh, double speed, double seen, double maxSpeed, const bool onInsertion) const {
250  if (vars->activeController != Plexe::DRIVER) {
251  double gap2pred, relSpeed;
252  getRadarMeasurements(veh, gap2pred, relSpeed);
253  if (gap2pred == -1) {
254  gap2pred = std::numeric_limits<double>().max();
255  }
256  return _v(veh, gap2pred, speed, speed + relSpeed);
257  } else {
258  return MSCFModel::freeSpeed(veh, speed, seen, maxSpeed, onInsertion);
259  }
260 }
261 
262 double
263 MSCFModel_CC::interactionGap(const MSVehicle* const veh, double vL) const {
264 
266  if (vars->activeController != Plexe::DRIVER) {
267  //maximum radar range is CC is enabled
268  return 250;
269  } else {
270  return myHumanDriver->interactionGap(veh, vL);
271  }
272 
273 }
274 
275 double
276 MSCFModel_CC::maxNextSpeed(double speed, const MSVehicle* const veh) const {
278  if (vars->engineModel == CC_ENGINE_MODEL_FOLM) {
279  return speed + (double) ACCEL2SPEED(getMaxAccel());
280  } else {
281  return speed + (double) ACCEL2SPEED(20);
282  }
283 }
284 
285 double
286 MSCFModel_CC::minNextSpeed(double speed, const MSVehicle* const veh) const {
288  if (vars->engineModel == CC_ENGINE_MODEL_FOLM) {
289  return MSCFModel::minNextSpeed(speed, veh);
290  } else {
291  return MAX2((double)0, speed - (double) ACCEL2SPEED(20));
292  }
293 }
294 
295 double
296 MSCFModel_CC::_v(const MSVehicle* const veh, double gap2pred, double egoSpeed, double predSpeed) const {
297 
299 
300  //acceleration computed by the controller
301  double controllerAcceleration = vars->fixedAcceleration;
302  //speed computed by the model
303  double speed;
304  //acceleration computed by the Cruise Control
305  double ccAcceleration;
306  //acceleration computed by the Adaptive Cruise Control
307  double accAcceleration;
308  //acceleration computed by the Cooperative Adaptive Cruise Control
309  double caccAcceleration;
310  //variables needed by CACC
311  double predAcceleration, leaderAcceleration, leaderSpeed;
312  //dummy variables used for auto feeding
313  Position pos;
314  double time;
315  const double currentTime = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep() + DELTA_T);
316 
317  if (vars->crashed) {
318  return 0;
319  }
320  if (vars->activeController == Plexe::DRIVER || !vars->useFixedAcceleration) {
321  switch (vars->activeController) {
322  case Plexe::ACC:
323  ccAcceleration = _cc(veh, egoSpeed, vars->ccDesiredSpeed);
324  accAcceleration = _acc(veh, egoSpeed, predSpeed, gap2pred, vars->accHeadwayTime);
325  if (gap2pred > 250 || ccAcceleration < accAcceleration) {
326  controllerAcceleration = ccAcceleration;
327  } else {
328  controllerAcceleration = accAcceleration;
329  }
330  break;
331 
332  case Plexe::CACC:
333  if (vars->autoFeed) {
336  }
337 
338  if (vars->useControllerAcceleration) {
339  predAcceleration = vars->frontControllerAcceleration;
340  leaderAcceleration = vars->leaderControllerAcceleration;
341  } else {
342  predAcceleration = vars->frontAcceleration;
343  leaderAcceleration = vars->leaderAcceleration;
344  }
345  //overwrite pred speed using data obtained through wireless communication
346  predSpeed = vars->frontSpeed;
347  leaderSpeed = vars->leaderSpeed;
348  if (vars->usePrediction) {
349  predSpeed += (currentTime - vars->frontDataReadTime) * vars->frontAcceleration;
350  leaderSpeed += (currentTime - vars->leaderDataReadTime) * vars->leaderAcceleration;
351  }
352 
353  if (vars->caccInitialized) {
354  controllerAcceleration = _cacc(veh, egoSpeed, predSpeed, predAcceleration, gap2pred, leaderSpeed, leaderAcceleration, vars->caccSpacing);
355  } else
356  //do not let CACC take decisions until at least one packet has been received
357  {
358  controllerAcceleration = 0;
359  }
360 
361  break;
362 
363  case Plexe::FAKED_CACC:
364 
365  if (vars->autoFeed) {
368  vars->fakeData.frontDistance = pos.distanceTo2D(veh->getPosition());
369  }
370 
371  if (vars->useControllerAcceleration) {
372  predAcceleration = vars->fakeData.frontControllerAcceleration;
373  leaderAcceleration = vars->fakeData.leaderControllerAcceleration;
374  } else {
375  predAcceleration = vars->fakeData.frontAcceleration;
376  leaderAcceleration = vars->fakeData.leaderAcceleration;
377  }
378  ccAcceleration = _cc(veh, egoSpeed, vars->ccDesiredSpeed);
379  caccAcceleration = _cacc(veh, egoSpeed, vars->fakeData.frontSpeed, predAcceleration, vars->fakeData.frontDistance, vars->fakeData.leaderSpeed, leaderAcceleration, vars->caccSpacing);
380  //faked CACC can be used to get closer to a platoon for joining
381  //using the minimum acceleration ensures that we do not exceed
382  //the CC desired speed
383  controllerAcceleration = std::min(ccAcceleration, caccAcceleration);
384 
385  break;
386 
387  case Plexe::PLOEG:
388 
389  if (vars->autoFeed) {
391  }
392 
393  if (vars->useControllerAcceleration) {
394  predAcceleration = vars->frontControllerAcceleration;
395  } else {
396  predAcceleration = vars->frontAcceleration;
397  }
398  //check if we received at least one packet
399  if (vars->frontInitialized)
400  //ploeg's controller computes \dot{u}_i, so we need to sum such value to the previously computed u_i
401  {
402  controllerAcceleration = vars->controllerAcceleration + _ploeg(veh, egoSpeed, predSpeed, predAcceleration, gap2pred);
403  } else {
404  controllerAcceleration = 0;
405  }
406 
407  break;
408 
409  case Plexe::CONSENSUS:
410  controllerAcceleration = _consensus(veh, egoSpeed, veh->getPosition(), currentTime);
411  break;
412 
413  case Plexe::FLATBED:
414 
415  if (vars->autoFeed) {
418  }
419 
420  //overwrite pred speed using data obtained through wireless communication
421  predSpeed = vars->frontSpeed;
422  leaderSpeed = vars->leaderSpeed;
423  if (vars->usePrediction) {
424  predSpeed += (currentTime - vars->frontDataReadTime) * vars->frontAcceleration;
425  leaderSpeed += (currentTime - vars->leaderDataReadTime) * vars->leaderAcceleration;
426  }
427 
428  if (vars->caccInitialized) {
429  controllerAcceleration = _flatbed(veh, veh->getAcceleration(), egoSpeed, predSpeed, gap2pred, leaderSpeed);
430  } else
431  //do not let CACC take decisions until at least one packet has been received
432  {
433  controllerAcceleration = 0;
434  }
435 
436  break;
437 
438  case Plexe::DRIVER:
439  std::cerr << "Switching to normal driver behavior still not implemented in MSCFModel_CC\n";
440  assert(false);
441  break;
442 
443  default:
444  std::cerr << "Invalid controller selected in MSCFModel_CC\n";
445  assert(false);
446  break;
447 
448  }
449 
450  }
451 
452  speed = MAX2(double(0), egoSpeed + ACCEL2SPEED(controllerAcceleration));
453 
454  return speed;
455 }
456 
457 double
458 MSCFModel_CC::_cc(const MSVehicle* veh, double egoSpeed, double desSpeed) const {
459 
461  //Eq. 5.5 of the Rajamani book, with Ki = 0 and bounds on max and min acceleration
462  return std::min(myCcAccel, std::max(-myCcDecel, -vars->ccKp * (egoSpeed - desSpeed)));
463 
464 }
465 
466 double
467 MSCFModel_CC::_acc(const MSVehicle* veh, double egoSpeed, double predSpeed, double gap2pred, double headwayTime) const {
468 
470  //Eq. 6.18 of the Rajamani book
471  return -1.0 / headwayTime * (egoSpeed - predSpeed + vars->accLambda * (-gap2pred + headwayTime * egoSpeed + 2));
472 
473 }
474 
475 double
476 MSCFModel_CC::_cacc(const MSVehicle* veh, double egoSpeed, double predSpeed, double predAcceleration, double gap2pred, double leaderSpeed, double leaderAcceleration, double spacing) const {
478  //compute epsilon, i.e., the desired distance error
479  double epsilon = -gap2pred + spacing; //NOTICE: error (if any) should already be included in gap2pred
480  //compute epsilon_dot, i.e., the desired speed error
481  double epsilon_dot = egoSpeed - predSpeed;
482  //Eq. 7.39 of the Rajamani book
483  return vars->caccAlpha1 * predAcceleration + vars->caccAlpha2 * leaderAcceleration +
484  vars->caccAlpha3 * epsilon_dot + vars->caccAlpha4 * (egoSpeed - leaderSpeed) + vars->caccAlpha5 * epsilon;
485 }
486 
487 
488 double
489 MSCFModel_CC::_ploeg(const MSVehicle* veh, double egoSpeed, double predSpeed, double predAcceleration, double gap2pred) const {
491  return (1 / vars->ploegH * (
492  -vars->controllerAcceleration +
493  vars->ploegKp * (gap2pred - (2 + vars->ploegH * egoSpeed)) +
494  vars->ploegKd * (predSpeed - egoSpeed - vars->ploegH * veh->getAcceleration()) +
495  predAcceleration
496  )) * TS ;
497 }
498 
499 double
500 MSCFModel_CC::d_i_j(const struct Plexe::VEHICLE_DATA* vehicles, const double h[MAX_N_CARS], int i, int j) const {
501 
502  int k, min_i, max_i;
503  double d = 0;
504  //compute indexes of the summation
505  if (j < i) {
506  min_i = j;
507  max_i = i - 1;
508  } else {
509  min_i = i;
510  max_i = j - 1;
511  }
512  //compute distance
513  for (k = min_i; k <= max_i; k++) {
514  d += h[k] * vehicles[0].speed + vehicles[k].length + 15;
515  }
516 
517  if (j < i) {
518  return d;
519  } else {
520  return -d;
521  }
522 
523 }
524 
525 double
526 MSCFModel_CC::_consensus(const MSVehicle* veh, double egoSpeed, Position egoPosition, double time) const {
527  //TODO: this controller, by using real GPS coordinates, does only work
528  //when vehicles are traveling west-to-east on a straight line, basically
529  //on the X axis. This needs to be fixed to consider direction as well
531  int index = vars->position;
532  int nCars = vars->nCars;
533  struct Plexe::VEHICLE_DATA* vehicles = vars->vehicles;
534 
535  //loop variable
536  int j;
537  //control input
538  double u_i = 0;
539  //actual distance term
540  double actualDistance = 0;
541  //desired distance term
542  double desiredDistance = 0;
543  //speed error term
544  double speedError = 0;
545  //degree of agent i
546  double d_i = 0;
547 
548  //compensate my position: compute prediction of what will be my position at time of actuation
549  Position egoVelocity = veh->getVelocityVector();
550  egoPosition.set(egoPosition.x() + egoVelocity.x() * STEPS2TIME(DELTA_T),
551  egoPosition.y() + egoVelocity.y() * STEPS2TIME(DELTA_T));
552  vehicles[index].speed = egoSpeed;
553  vehicles[index].positionX = egoPosition.x();
554  vehicles[index].positionY = egoPosition.y();
555 
556  //check that data from all vehicles have been received. the control
557  //law might actually need a subset of all the data, but d_i_j needs
558  //the lengths of all vehicles. uninitialized values might cause problems
559  if (vars->nInitialized != vars->nCars - 1) {
560  return 0;
561  }
562 
563  //compute speed error.
564  speedError = -vars->b[index] * (egoSpeed - vehicles[0].speed);
565 
566  //compute desired distance term
567  for (j = 0; j < nCars; j++) {
568  if (j == index) {
569  continue;
570  }
571  d_i += vars->L[index][j];
572  desiredDistance -= vars->K[index][j] * vars->L[index][j] * d_i_j(vehicles, vars->h, index, j);
573  }
574  desiredDistance = desiredDistance / d_i;
575 
576  //compute actual distance term
577  for (j = 0; j < nCars; j++) {
578  if (j == index) {
579  continue;
580  }
581  //distance error for consensus with GPS equipped
582  Position otherPosition;
583  double dt = time - vehicles[j].time;
584  //predict the position of the other vehicle
585  otherPosition.setx(vehicles[j].positionX + dt * vehicles[j].speedX);
586  otherPosition.sety(vehicles[j].positionY + dt * vehicles[j].speedY);
587  double distance = egoPosition.distanceTo2D(otherPosition) * sgn(j - index);
588  actualDistance -= vars->K[index][j] * vars->L[index][j] * distance;
589  }
590 
591  actualDistance = actualDistance / (d_i);
592 
593  //original paper formula
594  u_i = (speedError + desiredDistance + actualDistance) / 1000;
595 
596  return u_i;
597 }
598 
599 double
600 MSCFModel_CC::_flatbed(const MSVehicle* veh, double egoAcceleration, double egoSpeed, double predSpeed,
601  double gap2pred, double leaderSpeed) const {
603  return (
604  -vars->flatbedKa * egoAcceleration +
605  vars->flatbedKv * (predSpeed - egoSpeed) +
606  vars->flatbedKp * (gap2pred - vars->flatbedD - vars->flatbedH * (egoSpeed - leaderSpeed))
607  );
608 }
609 
610 double
613  return vars->caccSpacing;
614 }
615 
616 void
617 MSCFModel_CC::getVehicleInformation(const MSVehicle* veh, double& speed, double& acceleration, double& controllerAcceleration, Position& position, double& time) const {
619  speed = veh->getSpeed();
620  acceleration = veh->getAcceleration();
621  controllerAcceleration = vars->controllerAcceleration;
622  position = veh->getPosition();
623  time = STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep());
624 }
625 
626 void MSCFModel_CC::setParameter(MSVehicle* veh, const std::string& key, const std::string& value) const {
627  // vehicle variables used to set the parameter
628  CC_VehicleVariables* vars;
629 
630  ParBuffer buf(value);
631 
633  try {
634  if (key.compare(PAR_LEADER_SPEED_AND_ACCELERATION) == 0) {
635  double x, y, vx, vy;
636  buf >> vars->leaderSpeed >> vars->leaderAcceleration >> x >> y >> vars->leaderDataReadTime
637  >> vars->leaderControllerAcceleration >> vx >> vy >> vars->leaderAngle;
638  vars->leaderPosition = Position(x, y);
639  vars->leaderVelocity = Position(vx, vy);
640  vars->leaderInitialized = true;
641  if (vars->frontInitialized) {
642  vars->caccInitialized = true;
643  }
644  return;
645  }
646  if (key.compare(PAR_PRECEDING_SPEED_AND_ACCELERATION) == 0) {
647  double x, y, vx, vy;
648  buf >> vars->frontSpeed >> vars->frontAcceleration >> x >> y >> vars->frontDataReadTime
649  >> vars->frontControllerAcceleration >> vx >> vy >> vars->frontAngle;
650  vars->frontPosition = Position(x, y);
651  vars->frontVelocity = Position(vx, vy);
652  vars->frontInitialized = true;
653  if (vars->leaderInitialized) {
654  vars->caccInitialized = true;
655  }
656  return;
657  }
658  if (key.compare(CC_PAR_VEHICLE_DATA) == 0) {
659  struct Plexe::VEHICLE_DATA vehicle;
660  buf >> vehicle.index >> vehicle.speed >> vehicle.acceleration >>
661  vehicle.positionX >> vehicle.positionY >> vehicle.time >>
662  vehicle.length >> vehicle.u >> vehicle.speedX >>
663  vehicle.speedY >> vehicle.angle;
664  //if the index is larger than the number of cars, simply ignore the data
665  if (vehicle.index >= vars->nCars || vehicle.index == -1) {
666  return;
667  }
668  vars->vehicles[vehicle.index] = vehicle;
669  if (!vars->initialized[vehicle.index] && vehicle.index != vars->position) {
670  vars->nInitialized++;
671  }
672  vars->initialized[vehicle.index] = true;
673  return;
674  }
675  if (key.compare(PAR_LEADER_FAKE_DATA) == 0) {
676  buf >> vars->fakeData.leaderSpeed >> vars->fakeData.leaderAcceleration
678  if (buf.last_empty()) {
679  vars->useControllerAcceleration = false;
680  }
681  return;
682  }
683  if (key.compare(PAR_FRONT_FAKE_DATA) == 0) {
684  buf >> vars->fakeData.frontSpeed >> vars->fakeData.frontAcceleration >> vars->fakeData.frontDistance
686  if (buf.last_empty()) {
687  vars->useControllerAcceleration = false;
688  }
689  return;
690  }
691  if (key.compare(CC_PAR_VEHICLE_POSITION) == 0) {
692  vars->position = StringUtils::toInt(value.c_str());
693  return;
694  }
695  if (key.compare(CC_PAR_PLATOON_SIZE) == 0) {
696  vars->nCars = StringUtils::toInt(value.c_str());
697  // given that we have a static matrix, check that we're not
698  // setting a number of cars larger than the size of that matrix
699  if (vars->nCars > MAX_N_CARS) {
700  vars->nCars = MAX_N_CARS;
701  std::stringstream warn;
702  warn << "MSCFModel_CC: setting a number of cars of " << vars->nCars << " out of a maximum of " << MAX_N_CARS <<
703  ". The CONSENSUS controller will not work properly if chosen. If you are using a different controller " <<
704  "you can ignore this warning";
705  WRITE_WARNING(warn.str());
706  }
707  return;
708  }
709  if (key.compare(PAR_ADD_MEMBER) == 0) {
710  std::string id;
711  int position;
712  buf >> id >> position;
713  vars->members[position] = id;
714  return;
715  }
716  if (key.compare(PAR_REMOVE_MEMBER) == 0) {
717  for (auto item = vars->members.begin(); item != vars->members.end(); item++)
718  if (item->second.compare(value) == 0) {
719  vars->members.erase(item);
720  break;
721  }
722  return;
723  }
724  if (key.compare(PAR_ENABLE_AUTO_LANE_CHANGE) == 0) {
725  vars->autoLaneChange = StringUtils::toInt(value.c_str()) == 1;
726  return;
727  }
728  if (key.compare(CC_PAR_CACC_XI) == 0) {
729  vars->caccXi = StringUtils::toDouble(value.c_str());
730  recomputeParameters(veh);
731  return;
732  }
733  if (key.compare(CC_PAR_CACC_OMEGA_N) == 0) {
734  vars->caccOmegaN = StringUtils::toDouble(value.c_str());
735  recomputeParameters(veh);
736  return;
737  }
738  if (key.compare(CC_PAR_CACC_C1) == 0) {
739  vars->caccC1 = StringUtils::toDouble(value.c_str());
740  recomputeParameters(veh);
741  return;
742  }
743  if (key.compare(CC_PAR_ENGINE_TAU) == 0) {
744  vars->engineTau = StringUtils::toDouble(value.c_str());
745  vars->engine->setParameter(FOLM_PAR_TAU, vars->engineTau);
746  recomputeParameters(veh);
747  vars->engine->setParameter(FOLM_PAR_TAU, vars->engineTau);
748  }
749  if (key.compare(CC_PAR_UMIN) == 0) {
750  vars->uMin = StringUtils::toDouble(value.c_str());
751  return;
752  }
753  if (key.compare(CC_PAR_UMAX) == 0) {
754  vars->uMax = StringUtils::toDouble(value.c_str());
755  return;
756  }
757  if (key.compare(CC_PAR_PLOEG_H) == 0) {
758  vars->ploegH = StringUtils::toDouble(value.c_str());
759  return;
760  }
761  if (key.compare(CC_PAR_PLOEG_KP) == 0) {
762  vars->ploegKp = StringUtils::toDouble(value.c_str());
763  return;
764  }
765  if (key.compare(CC_PAR_PLOEG_KD) == 0) {
766  vars->ploegKd = StringUtils::toDouble(value.c_str());
767  return;
768  }
769  if (key.compare(CC_PAR_FLATBED_KA) == 0) {
770  vars->flatbedKa = StringUtils::toDouble(value.c_str());
771  return;
772  }
773  if (key.compare(CC_PAR_FLATBED_KV) == 0) {
774  vars->flatbedKv = StringUtils::toDouble(value.c_str());
775  return;
776  }
777  if (key.compare(CC_PAR_FLATBED_KP) == 0) {
778  vars->flatbedKp = StringUtils::toDouble(value.c_str());
779  return;
780  }
781  if (key.compare(CC_PAR_FLATBED_H) == 0) {
782  vars->flatbedH = StringUtils::toDouble(value.c_str());
783  return;
784  }
785  if (key.compare(CC_PAR_FLATBED_D) == 0) {
786  vars->flatbedD = StringUtils::toDouble(value.c_str());
787  return;
788  }
789  if (key.compare(CC_PAR_VEHICLE_ENGINE_MODEL) == 0) {
790  if (vars->engine) {
791  delete vars->engine;
792  }
793  int engineModel = StringUtils::toInt(value.c_str());
794  switch (engineModel) {
796  vars->engine = new RealisticEngineModel();
798  veh->getInfluencer().setSpeedMode(0);
800  break;
801  }
803  default: {
804  vars->engine = new FirstOrderLagModel();
806  vars->engine->setParameter(FOLM_PAR_TAU, vars->engineTau);
808  break;
809  }
810  }
813  return;
814  }
815  if (key.compare(CC_PAR_VEHICLE_MODEL) == 0) {
816  vars->engine->setParameter(ENGINE_PAR_VEHICLE, value);
817  return;
818  }
819  if (key.compare(CC_PAR_VEHICLES_FILE) == 0) {
820  vars->engine->setParameter(ENGINE_PAR_XMLFILE, value);
821  return;
822  }
823  if (key.compare(PAR_CACC_SPACING) == 0) {
824  vars->caccSpacing = StringUtils::toDouble(value.c_str());
825  return;
826  }
827  if (key.compare(PAR_FIXED_ACCELERATION) == 0) {
828  buf >> vars->useFixedAcceleration >> vars->fixedAcceleration;
829  return;
830  }
831  if (key.compare(PAR_CC_DESIRED_SPEED) == 0) {
832  vars->ccDesiredSpeed = StringUtils::toDouble(value.c_str());
833  return;
834  }
835  if (key.compare(PAR_ACTIVE_CONTROLLER) == 0) {
836  vars->activeController = (enum Plexe::ACTIVE_CONTROLLER) StringUtils::toInt(value.c_str());
837  return;
838  }
839  if (key.compare(PAR_ACC_HEADWAY_TIME) == 0) {
840  vars->accHeadwayTime = StringUtils::toDouble(value.c_str());
841  return;
842  }
843  if (key.compare(PAR_USE_CONTROLLER_ACCELERATION) == 0) {
844  vars->useControllerAcceleration = StringUtils::toInt(value.c_str()) != 0;
845  return;
846  }
847  if (key.compare(PAR_USE_AUTO_FEEDING) == 0) {
848  int af;
849  std::string leaderId, frontId;
850  buf >> af;
851  vars->autoFeed = af == 1;
852  if (vars->autoFeed) {
853  vars->usePrediction = false;
854  buf >> leaderId;
855  if (buf.last_empty()) {
856  throw InvalidArgument("Trying to enable auto feeding without providing leader vehicle id");
857  }
858  vars->leaderVehicle = dynamic_cast<MSVehicle*>(MSNet::getInstance()->getVehicleControl().getVehicle(leaderId));
859  if (vars->leaderVehicle == 0) {
860  throw libsumo::TraCIException("Vehicle '" + leaderId + "' is not known");
861  }
862  buf >> frontId;
863  if (buf.last_empty()) {
864  throw InvalidArgument("Trying to enable auto feeding without providing front vehicle id");
865  }
866  vars->frontVehicle = dynamic_cast<MSVehicle*>(MSNet::getInstance()->getVehicleControl().getVehicle(frontId));
867  if (vars->frontVehicle == 0) {
868  throw libsumo::TraCIException("Vehicle '" + frontId + "' is not known");
869  }
870  vars->leaderInitialized = true;
871  vars->frontInitialized = true;
872  vars->caccInitialized = true;
873  }
874  return;
875  }
876  if (key.compare(PAR_USE_PREDICTION) == 0) {
877  vars->usePrediction = StringUtils::toInt(value.c_str()) == 1;
878  return;
879  }
880  } catch (NumberFormatException&) {
881  throw InvalidArgument("Invalid value '" + value + "' for parameter '" + key + "' for vehicle '" + veh->getID() + "'");
882  }
883 
884 }
885 
886 std::string MSCFModel_CC::getParameter(const MSVehicle* veh, const std::string& key) const {
887  // vehicle variables used to set the parameter
888  CC_VehicleVariables* vars;
889  ParBuffer buf;
890 
892  if (key.compare(PAR_SPEED_AND_ACCELERATION) == 0) {
893  Position velocity = veh->getVelocityVector();
894  buf << veh->getSpeed() << veh->getAcceleration() <<
895  vars->controllerAcceleration << veh->getPosition().x() <<
896  veh->getPosition().y() <<
897  STEPS2TIME(MSNet::getInstance()->getCurrentTimeStep()) <<
898  velocity.x() << velocity.y() << veh->getAngle();
899  return buf.str();
900  }
901  if (key.compare(PAR_CRASHED) == 0) {
902  return vars->crashed ? "1" : "0";
903  }
904  if (key.compare(PAR_RADAR_DATA) == 0) {
905  double distance, relSpeed;
906  getRadarMeasurements(veh, distance, relSpeed);
907  buf << distance << relSpeed;
908  return buf.str();
909  }
910  if (key.compare(PAR_LANES_COUNT) == 0) {
911  buf << veh->getLane()->getEdge().getLanes().size();
912  return buf.str();
913  }
914  if (key.compare(PAR_DISTANCE_TO_END) == 0) {
915  //route of the vehicle
916  const MSRoute* route;
917  //edge the vehicle is currently traveling on
918  const MSEdge* currentEdge;
919  //last edge of the route of this vehicle
920  const MSEdge* lastEdge;
921  //current position of the vehicle on the edge its traveling in
922  double positionOnEdge;
923  //distance to trip end using
924  double distanceToEnd;
925 
926  route = &veh->getRoute();
927  currentEdge = veh->getEdge();
928  lastEdge = route->getEdges().back();
929  positionOnEdge = veh->getPositionOnLane();
930  distanceToEnd = route->getDistanceBetween(positionOnEdge, lastEdge->getLanes()[0]->getLength(), currentEdge, lastEdge);
931 
932  buf << distanceToEnd;
933  return buf.str();
934  }
935  if (key.compare(PAR_DISTANCE_FROM_BEGIN) == 0) {
936  //route of the vehicle
937  const MSRoute* route;
938  //edge the vehicle is currently traveling on
939  const MSEdge* currentEdge;
940  //last edge of the route of this vehicle
941  const MSEdge* firstEdge;
942  //current position of the vehicle on the edge its traveling in
943  double positionOnEdge;
944  //distance to trip end using
945  double distanceFromBegin;
946 
947  route = &veh->getRoute();
948  currentEdge = veh->getEdge();
949  firstEdge = route->getEdges().front();
950  positionOnEdge = veh->getPositionOnLane();
951  distanceFromBegin = route->getDistanceBetween(0, positionOnEdge, firstEdge, currentEdge);
952 
953  buf << distanceFromBegin;
954  return buf.str();
955  }
956  if (key.compare(PAR_CC_DESIRED_SPEED) == 0) {
957  buf << (double)vars->ccDesiredSpeed;
958  return buf.str();
959  }
960  if (key.compare(PAR_ACTIVE_CONTROLLER) == 0) {
961  buf << (int)vars->activeController;
962  return buf.str();
963  }
964  if (key.compare(PAR_ACC_HEADWAY_TIME) == 0) {
965  buf << (double)vars->accHeadwayTime;
966  return buf.str();
967  }
968  if (key.compare(PAR_ACC_ACCELERATION) == 0) {
969  buf << getACCAcceleration(veh);
970  return buf.str();
971  }
972  if (key.compare(PAR_CACC_SPACING) == 0) {
973  buf << vars->caccSpacing;
974  return buf.str();
975  }
976  if (key.find(CC_PAR_VEHICLE_DATA) == 0) {
977  ParBuffer inBuf(key);
978  int index;
979  inBuf >> index;
980  struct Plexe::VEHICLE_DATA vehicle;
981  if (index >= vars->nCars || index < 0) {
982  vehicle.index = -1;
983  } else {
984  vehicle = vars->vehicles[index];
985  }
986  buf << vehicle.index << vehicle.speed << vehicle.acceleration <<
987  vehicle.positionX << vehicle.positionY << vehicle.time <<
988  vehicle.length << vehicle.u << vehicle.speedX <<
989  vehicle.speedY << vehicle.angle;
990  return buf.str();
991  }
992  if (key.compare(PAR_ENGINE_DATA) == 0) {
993  int gear;
994  double rpm;
995  RealisticEngineModel* engine = dynamic_cast<RealisticEngineModel*>(vars->engine);
996  if (engine) {
997  engine->getEngineData(veh->getSpeed(), gear, rpm);
998  } else {
999  gear = -1;
1000  rpm = 0;
1001  }
1002  buf << (gear + 1) << rpm;
1003  return buf.str();
1004  }
1005  return "";
1006 }
1007 
1010  vars->caccAlpha1 = 1 - vars->caccC1;
1011  vars->caccAlpha2 = vars->caccC1;
1012  vars->caccAlpha3 = -(2 * vars->caccXi - vars->caccC1 * (vars->caccXi + sqrt(vars->caccXi * vars->caccXi - 1))) * vars->caccOmegaN;
1013  vars->caccAlpha4 = -(vars->caccXi + sqrt(vars->caccXi * vars->caccXi - 1)) * vars->caccOmegaN * vars->caccC1;
1014  vars->caccAlpha5 = -vars->caccOmegaN * vars->caccOmegaN;
1015 }
1016 
1017 void MSCFModel_CC::resetConsensus(const MSVehicle* veh) const {
1019  for (int i = 0; i < MAX_N_CARS; i++) {
1020  vars->initialized[i] = false;
1021  vars->nInitialized = 0;
1022  }
1023 }
1024 
1025 void MSCFModel_CC::switchOnACC(const MSVehicle* veh, double ccDesiredSpeed) const {
1027  vars->ccDesiredSpeed = ccDesiredSpeed;
1028  vars->activeController = Plexe::ACC;
1029 }
1030 
1033  return vars->activeController;
1034 }
1035 
1036 void MSCFModel_CC::getRadarMeasurements(const MSVehicle* veh, double& distance, double& relativeSpeed) const {
1037  std::pair<std::string, double> l = libsumo::Vehicle::getLeader(veh->getID(), 250);
1038  if (l.second < 0) {
1039  distance = -1;
1040  relativeSpeed = 0;
1041  } else {
1042  distance = l.second;
1044  relativeSpeed = leader->getSpeed() - veh->getSpeed();
1045  }
1046 }
1047 
1050  double distance, relSpeed;
1051  getRadarMeasurements(veh, distance, relSpeed);
1052  if (distance < 0) {
1053  return 0;
1054  } else {
1055  return _acc(veh, veh->getSpeed(), relSpeed + veh->getSpeed(), distance, vars->accHeadwayTime);
1056  }
1057 }
1058 
1060  return myLanesCount;
1061 }
1062 
1063 MSCFModel*
1065  return new MSCFModel_CC(vtype);
1066 }
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
MSCFModel_CC::myFlatbedKv
const double myFlatbedKv
Definition: MSCFModel_CC.h:393
MSVehicle::processNextStop
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:1806
CC_VehicleVariables::controllerAcceleration
double controllerAcceleration
acceleration as computed by the controller, to be sent to other vehicles
Definition: CC_VehicleVariables.h:87
CC_VehicleVariables::frontDataReadTime
double frontDataReadTime
when front vehicle data has been readed from GPS
Definition: CC_VehicleVariables.h:98
CC_VehicleVariables::K
double K[MAX_N_CARS][MAX_N_CARS]
K matrix.
Definition: CC_VehicleVariables.h:158
CC_VehicleVariables::accHeadwayTime
double accHeadwayTime
headway time for ACC
Definition: CC_VehicleVariables.h:114
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:31
CC_VehicleVariables::frontPosition
Position frontPosition
current front vehicle position
Definition: CC_VehicleVariables.h:96
RealisticEngineModel::getEngineData
void getEngineData(double speed_mps, int &gear, double &rpm)
Definition: RealisticEngineModel.cpp:220
PAR_RADAR_DATA
#define PAR_RADAR_DATA
Definition: CC_Const.h:145
CC_VehicleVariables::frontSpeed
double frontSpeed
current front vehicle speed
Definition: CC_VehicleVariables.h:90
CC_VehicleVariables::leaderAngle
double leaderAngle
platoon's leader angle in radians
Definition: CC_VehicleVariables.h:133
CC_VehicleVariables::useFixedAcceleration
int useFixedAcceleration
Definition: CC_VehicleVariables.h:139
Plexe::VEHICLE_DATA::speedY
double speedY
Definition: CC_Const.h:69
CC_PAR_VEHICLES_FILE
#define CC_PAR_VEHICLES_FILE
Definition: CC_Const.h:112
MSCFModel::getMaxAccel
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition: MSCFModel.h:209
MSCFModel_CC::getParameter
virtual std::string getParameter(const MSVehicle *veh, const std::string &key) const
set the information about a generic car. This method should be invoked by TraCI when a wireless messa...
Definition: MSCFModel_CC.cpp:886
MSCFModel_CC::minNextSpeed
virtual double minNextSpeed(double speed, const MSVehicle *const veh=0) const
Returns the minimum speed given the current speed (depends on the numerical update scheme and its ste...
Definition: MSCFModel_CC.cpp:286
CC_VehicleVariables::leaderInitialized
bool leaderInitialized
@did we receive at least one packet?
Definition: CC_VehicleVariables.h:135
SUMO_ATTR_CF_CC_CCDECEL
Definition: SUMOXMLDefinitions.h:853
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
MSCFModel_CC::getActiveController
enum Plexe::ACTIVE_CONTROLLER getActiveController(const MSVehicle *veh) const
return the currently active controller
Definition: MSCFModel_CC.cpp:1031
MSVehicle::getMyStops
std::list< Stop > getMyStops()
Definition: MSVehicle.cpp:5895
MSCFModel_CC::freeSpeed
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
Definition: MSCFModel_CC.cpp:248
SUMOTime.h
CC_VehicleVariables::leaderPosition
Position leaderPosition
platoon's leader position
Definition: CC_VehicleVariables.h:127
MSNet.h
SUMO_ATTR_CF_CC_KP
Definition: SUMOXMLDefinitions.h:855
CC_PAR_FLATBED_KV
#define CC_PAR_FLATBED_KV
Definition: CC_Const.h:104
CC_VehicleVariables::autoFeed
bool autoFeed
determines whether CACC should automatically fetch data about other vehicles
Definition: CC_VehicleVariables.h:107
CC_VehicleVariables::uMin
double uMin
limits for u
Definition: CC_VehicleVariables.h:184
CC_VehicleVariables::leaderDataReadTime
double leaderDataReadTime
when leader data has been readed from GPS
Definition: CC_VehicleVariables.h:129
CC_VehicleVariables::caccSpacing
double caccSpacing
fixed spacing for CACC
Definition: CC_VehicleVariables.h:181
libsumo::Vehicle::getLaneChangeState
static std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction)
Definition: Vehicle.cpp:582
LCA_LEFT
Wants go to the left.
Definition: SUMOXMLDefinitions.h:1226
MSCFModel_CC::_flatbed
double _flatbed(const MSVehicle *veh, double egoAcceleration, double egoSpeed, double predSpeed, double gap2pred, double leaderSpeed) const
flatbed platoon towing model
Definition: MSCFModel_CC.cpp:600
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:36
SUMO_ATTR_CF_CC_C1
Definition: SUMOXMLDefinitions.h:857
MSCFModel_CC::getRadarMeasurements
void getRadarMeasurements(const MSVehicle *veh, double &distance, double &relativeSpeed) const
return the data that is currently being measured by the radar
Definition: MSCFModel_CC.cpp:1036
Plexe::VEHICLE_DATA::positionY
double positionY
Definition: CC_Const.h:64
CC_PAR_ENGINE_TAU
#define CC_PAR_ENGINE_TAU
Definition: CC_Const.h:94
Plexe::VEHICLE_DATA::index
int index
Definition: CC_Const.h:60
StringUtils::toDouble
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
Definition: StringUtils.cpp:345
CC_VehicleVariables::FAKE_CONTROLLER_DATA::frontDistance
double frontDistance
Definition: CC_VehicleVariables.h:54
Position::setx
void setx(double x)
set position x
Definition: Position.h:71
ACCEL2SPEED
#define ACCEL2SPEED(x)
Definition: SUMOTime.h:52
ParBuffer::last_empty
bool last_empty()
Definition: ParBuffer.h:134
CC_PAR_PLOEG_H
#define CC_PAR_PLOEG_H
Definition: CC_Const.h:99
SPEED2ACCEL
#define SPEED2ACCEL(x)
Definition: SUMOTime.h:54
MSCFModel_CC::getVehicleInformation
void getVehicleInformation(const MSVehicle *veh, double &speed, double &acceleration, double &controllerAcceleration, Position &position, double &time) const
get the information about a vehicle. This can be used by TraCI in order to get speed and acceleration...
Definition: MSCFModel_CC.cpp:617
CC_VehicleVariables::crashed
bool crashed
Definition: CC_VehicleVariables.h:144
MSCFModel_CC::resetConsensus
void resetConsensus(const MSVehicle *veh) const
Resets the consensus controller. In particular, sets the "initialized" vector all to false....
Definition: MSCFModel_CC.cpp:1017
PAR_ENGINE_DATA
#define PAR_ENGINE_DATA
Definition: CC_Const.h:166
MSCFModel_Krauss
Krauss car-following model, with acceleration decrease and faster start.
Definition: MSCFModel_Krauss.h:38
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
CC_VehicleVariables::caccXi
double caccXi
controller related parameters
Definition: CC_VehicleVariables.h:176
CC_VehicleVariables::flatbedKp
double flatbedKp
Definition: CC_VehicleVariables.h:190
MSBaseVehicle::getRoute
const MSRoute & getRoute() const
Returns the current route.
Definition: MSBaseVehicle.h:115
MSCFModel_CC::d_i_j
double d_i_j(const struct Plexe::VEHICLE_DATA *vehicles, const double h[MAX_N_CARS], int i, int j) const
computes the desired distance between vehicle i and vehicle j
Definition: MSCFModel_CC.cpp:500
CC_VehicleVariables::FAKE_CONTROLLER_DATA::leaderSpeed
double leaderSpeed
Definition: CC_VehicleVariables.h:58
CC_VehicleVariables::frontInitialized
bool frontInitialized
@did we receive at least one packet?
Definition: CC_VehicleVariables.h:104
LCA_SPEEDGAIN
The action is due to the wish to be faster (tactical lc)
Definition: SUMOXMLDefinitions.h:1234
PAR_DISTANCE_FROM_BEGIN
#define PAR_DISTANCE_FROM_BEGIN
Definition: CC_Const.h:157
PAR_USE_CONTROLLER_ACCELERATION
#define PAR_USE_CONTROLLER_ACCELERATION
Definition: CC_Const.h:133
Plexe::FLATBED
Definition: CC_Const.h:45
CC_VehicleVariables::FAKE_CONTROLLER_DATA::leaderControllerAcceleration
double leaderControllerAcceleration
Definition: CC_VehicleVariables.h:60
MSRoute::getEdges
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:120
Plexe::PLOEG
Definition: CC_Const.h:45
CC_PAR_PLOEG_KD
#define CC_PAR_PLOEG_KD
Definition: CC_Const.h:101
MSCFModel_CC::myPloegH
const double myPloegH
Ploeg's CACC parameters.
Definition: MSCFModel_CC.h:387
MSCFModel_CC::myOmegaN
const double myOmegaN
design constant for CACC
Definition: MSCFModel_CC.h:377
MSCFModel_CC::recomputeParameters
void recomputeParameters(const MSVehicle *veh) const
Recomputes controller related parameters after setting them.
Definition: MSCFModel_CC.cpp:1008
CC_VehicleVariables
Definition: CC_VehicleVariables.h:34
MSEdge.h
CC_VehicleVariables::flatbedH
double flatbedH
Definition: CC_VehicleVariables.h:192
CC_VehicleVariables::caccAlpha4
double caccAlpha4
Definition: CC_VehicleVariables.h:179
Plexe::VEHICLE_DATA::time
double time
Definition: CC_Const.h:65
MSCFModel_CC::myLanesCount
const int myLanesCount
number of lanes in the highway, in the absence of on-/off-ramps. This is used to move to the correct ...
Definition: MSCFModel_CC.h:384
MSCFModel_CC.h
SUMO_ATTR_CF_CC_FLATBED_KA
Definition: SUMOXMLDefinitions.h:866
CC_VehicleVariables::flatbedKv
double flatbedKv
Definition: CC_VehicleVariables.h:189
Plexe::CACC
Definition: CC_Const.h:45
MSVehicle::getCarFollowVariables
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
Definition: MSVehicle.h:910
Vehicle.h
CC_VehicleVariables::ploegH
double ploegH
Definition: CC_VehicleVariables.h:185
CC_VehicleVariables::frontAcceleration
double frontAcceleration
current front vehicle acceleration (used by CACC)
Definition: CC_VehicleVariables.h:92
CC_VehicleVariables::ccDesiredSpeed
double ccDesiredSpeed
CC desired speed.
Definition: CC_VehicleVariables.h:147
MSCFModel::finalizeSpeed
virtual double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences. Called at most once per simulation...
Definition: MSCFModel.cpp:164
CC_VehicleVariables::nCars
int nCars
number of cars in the platoon
Definition: CC_VehicleVariables.h:173
MSCFModel_CC::myC1
const double myC1
design constant for CACC
Definition: MSCFModel_CC.h:371
CC_VehicleVariables::engine
GenericEngineModel * engine
engine model employed by this car
Definition: CC_VehicleVariables.h:195
CC_PAR_UMAX
#define CC_PAR_UMAX
Definition: CC_Const.h:97
MSRoute
Definition: MSRoute.h:66
SUMO_ATTR_CF_CC_FLATBED_KP
Definition: SUMOXMLDefinitions.h:868
GenericEngineModel::setMaximumDeceleration
void setMaximumDeceleration(double maxAcceleration_mpsps)
Definition: GenericEngineModel.cpp:57
GenericEngineModel::getRealAcceleration
virtual double getRealAcceleration(double speed_mps, double accel_mps2, double reqAccel_mps2, SUMOTime timeStep=0)=0
MSCFModel_CC::myKp
const double myKp
design constant for CC
Definition: MSCFModel_CC.h:365
MSCFModel_CC::_v
double _v(const MSVehicle *const veh, double gap2pred, double egoSpeed, double predSpeed) const
Definition: MSCFModel_CC.cpp:296
MSVehicle.h
PAR_ACC_ACCELERATION
#define PAR_ACC_ACCELERATION
Definition: CC_Const.h:118
MSCFModel::interactionGap
virtual double interactionGap(const MSVehicle *const veh, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
Definition: MSCFModel.cpp:223
MSCFModel_CC::myConstantSpacing
const double myConstantSpacing
the constant gap for CACC
Definition: MSCFModel_CC.h:362
CC_VehicleVariables::h
double h[MAX_N_CARS]
vector of time headways h
Definition: CC_VehicleVariables.h:162
MSBaseVehicle::getEdge
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
Definition: MSBaseVehicle.cpp:181
CC_VehicleVariables::activeController
enum Plexe::ACTIVE_CONTROLLER activeController
currently active controller
Definition: CC_VehicleVariables.h:150
CC_VehicleVariables::caccOmegaN
double caccOmegaN
Definition: CC_VehicleVariables.h:177
CC_VehicleVariables::vehicles
struct Plexe::VEHICLE_DATA vehicles[MAX_N_CARS]
data about vehicles in the platoon
Definition: CC_VehicleVariables.h:165
MSCFModel_CC::myLambda
const double myLambda
design constant for ACC
Definition: MSCFModel_CC.h:368
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
ENGINE_PAR_DT
#define ENGINE_PAR_DT
Definition: CC_Const.h:84
MSVehicle::getPosition
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1269
CC_VehicleVariables::flatbedD
double flatbedD
Definition: CC_VehicleVariables.h:191
NumberFormatException
Definition: UtilExceptions.h:95
MSCFModel_CC::insertionFollowSpeed
virtual double insertionFollowSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Overload base MSCFModel::insertionFollowSpeed method to inject automated vehicles as soon as they are...
Definition: MSCFModel_CC.cpp:223
ENGINE_PAR_VEHICLE
#define ENGINE_PAR_VEHICLE
Definition: CC_Const.h:82
CC_VehicleVariables::ploegKp
double ploegKp
Definition: CC_VehicleVariables.h:186
CC_VehicleVariables::useControllerAcceleration
bool useControllerAcceleration
determines whether PATH's CACC should use the real vehicle acceleration or the controller computed on...
Definition: CC_VehicleVariables.h:119
CC_PAR_CACC_OMEGA_N
#define CC_PAR_CACC_OMEGA_N
Definition: CC_Const.h:92
FOLM_PAR_DT
#define FOLM_PAR_DT
Definition: CC_Const.h:80
CC_VehicleVariables::caccAlpha1
double caccAlpha1
Definition: CC_VehicleVariables.h:179
MSCFModel_CC::myFlatbedKa
const double myFlatbedKa
flatbed CACC parameters
Definition: MSCFModel_CC.h:392
MSCFModel_CC::myFlatbedKp
const double myFlatbedKp
Definition: MSCFModel_CC.h:394
CC_VehicleVariables::fakeData
struct FAKE_CONTROLLER_DATA fakeData
fake controller data.
Definition: CC_VehicleVariables.h:153
CC_VehicleVariables::caccInitialized
bool caccInitialized
Definition: CC_VehicleVariables.h:136
MSCFModel::freeSpeed
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
Definition: MSCFModel.cpp:267
SUMO_ATTR_CF_CC_CONSTSPACING
Definition: SUMOXMLDefinitions.h:854
MSVehicleControl::getVehicle
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
Definition: MSVehicleControl.cpp:240
CC_VehicleVariables::FAKE_CONTROLLER_DATA::frontControllerAcceleration
double frontControllerAcceleration
Definition: CC_VehicleVariables.h:57
ParBuffer.h
CC_VehicleVariables::caccAlpha2
double caccAlpha2
Definition: CC_VehicleVariables.h:179
MSCFModel_CC::maxNextSpeed
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
Definition: MSCFModel_CC.cpp:276
MSVehicle::getPositionOnLane
double getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MSVehicle.h:392
MSCFModel_CC::_cc
double _cc(const MSVehicle *veh, double egoSpeed, double desSpeed) const
controller for the CC which computes the acceleration to be applied. the value needs to be passed to ...
Definition: MSCFModel_CC.cpp:458
GenericEngineModel::setMaximumAcceleration
void setMaximumAcceleration(double maxAcceleration_mpsps)
Definition: GenericEngineModel.cpp:54
PAR_CACC_SPACING
#define PAR_CACC_SPACING
Definition: CC_Const.h:115
CC_VehicleVariables::frontAngle
double frontAngle
front vehicle angle in radians
Definition: CC_VehicleVariables.h:102
CC_ENGINE_MODEL_FOLM
#define CC_ENGINE_MODEL_FOLM
Definition: CC_Const.h:75
Plexe::VEHICLE_DATA::speed
double speed
Definition: CC_Const.h:61
CC_VehicleVariables::accLambda
double accLambda
Definition: CC_VehicleVariables.h:115
CC_PAR_CACC_C1
#define CC_PAR_CACC_C1
Definition: CC_Const.h:93
CC_PAR_FLATBED_KP
#define CC_PAR_FLATBED_KP
Definition: CC_Const.h:105
MSBaseVehicle::setChosenSpeedFactor
void setChosenSpeedFactor(const double factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
Definition: MSBaseVehicle.h:433
CC_PAR_VEHICLE_POSITION
#define CC_PAR_VEHICLE_POSITION
Definition: CC_Const.h:87
CC_VehicleVariables::ccKp
double ccKp
Definition: CC_VehicleVariables.h:148
SUMO_ATTR_CF_CC_FLATBED_H
Definition: SUMOXMLDefinitions.h:870
TS
#define TS
Definition: SUMOTime.h:43
MSCFModel_CC::followSpeed
double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle's safe speed (no dawdling)
Definition: MSCFModel_CC.cpp:210
CC_VehicleVariables::position
int position
my position within the platoon (0 = first car)
Definition: CC_VehicleVariables.h:171
MSCFModel_CC::myFlatbedD
const double myFlatbedD
Definition: MSCFModel_CC.h:396
sgn
#define sgn(x)
Definition: MSCFModel_CC.cpp:35
MAX_N_CARS
#define MAX_N_CARS
Definition: CC_Const.h:73
Position::set
void set(double x, double y)
set positions x and y
Definition: Position.h:86
PAR_LANES_COUNT
#define PAR_LANES_COUNT
Definition: CC_Const.h:136
MSCFModel_CC::myPloegKp
const double myPloegKp
Definition: MSCFModel_CC.h:388
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:283
CC_VehicleVariables::uMax
double uMax
Definition: CC_VehicleVariables.h:184
CC_VehicleVariables::caccC1
double caccC1
Definition: CC_VehicleVariables.h:178
Plexe::VEHICLE_DATA
Definition: CC_Const.h:59
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:56
PAR_REMOVE_MEMBER
#define PAR_REMOVE_MEMBER
Definition: CC_Const.h:176
CC_VehicleVariables::initialized
bool initialized[MAX_N_CARS]
tells whether data about a certain vehicle has been initialized
Definition: CC_VehicleVariables.h:167
MSCFModel_CC::_consensus
double _consensus(const MSVehicle *veh, double egoSpeed, Position egoPosition, double time) const
controller based on consensus strategy
Definition: MSCFModel_CC.cpp:526
SUMO_ATTR_CF_CC_PLOEG_KP
Definition: SUMOXMLDefinitions.h:863
MSVehicle::getVelocityVector
Position getVelocityVector() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:688
SUMO_ATTR_CF_CC_LAMBDA
Definition: SUMOXMLDefinitions.h:856
MSCFModel_CC::myCcAccel
const double myCcAccel
The maximum acceleration that the CC can output.
Definition: MSCFModel_CC.h:359
MSCFModel_CC::~MSCFModel_CC
~MSCFModel_CC()
Destructor.
Definition: MSCFModel_CC.cpp:73
MSCFModel_CC::myTau
const double myTau
engine time constant used for actuation lag
Definition: MSCFModel_CC.h:380
MSVehicle::getAngle
double getAngle() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:680
FOLM_PAR_TAU
#define FOLM_PAR_TAU
Definition: CC_Const.h:79
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
CC_VehicleVariables::frontVelocity
Position frontVelocity
front vehicle velocity vector
Definition: CC_VehicleVariables.h:100
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
PAR_USE_AUTO_FEEDING
#define PAR_USE_AUTO_FEEDING
Definition: CC_Const.h:169
CC_VehicleVariables::L
int L[MAX_N_CARS][MAX_N_CARS]
L matrix.
Definition: CC_VehicleVariables.h:156
PAR_ENABLE_AUTO_LANE_CHANGE
#define PAR_ENABLE_AUTO_LANE_CHANGE
Definition: CC_Const.h:179
CC_PAR_VEHICLE_MODEL
#define CC_PAR_VEHICLE_MODEL
Definition: CC_Const.h:111
MSCFModel_CC::switchOnACC
void switchOnACC(const MSVehicle *veh, double ccDesiredSpeed) const
switch on the ACC, so disabling the human driver car control
Definition: MSCFModel_CC.cpp:1025
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
MSCFModel_CC::myPloegKd
const double myPloegKd
Definition: MSCFModel_CC.h:389
PAR_SPEED_AND_ACCELERATION
#define PAR_SPEED_AND_ACCELERATION
Definition: CC_Const.h:127
CC_VehicleVariables::frontVehicle
MSVehicle * frontVehicle
front sumo id, used for auto feeding
Definition: CC_VehicleVariables.h:111
CC_VehicleVariables::engineTau
double engineTau
Definition: CC_VehicleVariables.h:182
PAR_CC_DESIRED_SPEED
#define PAR_CC_DESIRED_SPEED
Definition: CC_Const.h:139
GenericEngineModel::setParameter
virtual void setParameter(const std::string parameter, const std::string &value)=0
PAR_ADD_MEMBER
#define PAR_ADD_MEMBER
Definition: CC_Const.h:175
MSVehicle::getLaneIndex
int getLaneIndex() const
Definition: MSVehicle.cpp:5304
CC_PAR_FLATBED_D
#define CC_PAR_FLATBED_D
Definition: CC_Const.h:107
libsumo::Vehicle::changeLane
static void changeLane(const std::string &vehicleID, int laneIndex, double duration)
Definition: Vehicle.cpp:936
Plexe::ACC
Definition: CC_Const.h:45
CC_VehicleVariables::FAKE_CONTROLLER_DATA::frontSpeed
double frontSpeed
Definition: CC_VehicleVariables.h:55
libsumo::TraCIException
Definition: TraCIDefs.h:89
Plexe::FAKED_CACC
Definition: CC_Const.h:45
ParBuffer
Definition: ParBuffer.h:25
MSCFModel_CC::duplicate
MSCFModel * duplicate(const MSVehicleType *vtype) const
Duplicates the car-following model.
Definition: MSCFModel_CC.cpp:1064
RealisticEngineModel
Definition: RealisticEngineModel.h:43
SUMO_ATTR_CF_CC_LANES_COUNT
Definition: SUMOXMLDefinitions.h:861
SUMO_ATTR_CF_CC_FLATBED_D
Definition: SUMOXMLDefinitions.h:869
SUMO_ATTR_CF_CC_TAU
Definition: SUMOXMLDefinitions.h:860
PAR_ACTIVE_CONTROLLER
#define PAR_ACTIVE_CONTROLLER
Definition: CC_Const.h:142
MSVehicle::Stop
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:920
MSVehicle::getLane
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:560
CC_PAR_PLOEG_KP
#define CC_PAR_PLOEG_KP
Definition: CC_Const.h:100
ParBuffer::str
std::string str() const
Definition: ParBuffer.h:144
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:669
SUMO_ATTR_CF_CC_XI
Definition: SUMOXMLDefinitions.h:858
MSCFModel_CC::createVehicleVariables
VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting.
Definition: MSCFModel_CC.cpp:76
Position::distanceTo2D
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:243
MSCFModel_CC::_ploeg
double _ploeg(const MSVehicle *veh, double egoSpeed, double predSpeed, double predAcceleration, double gap2pred) const
controller for the Ploeg's CACC which computes the control input variation. Opposed to other controll...
Definition: MSCFModel_CC.cpp:489
CC_VehicleVariables::b
double b[MAX_N_CARS]
vector of damping ratios b
Definition: CC_VehicleVariables.h:160
MSVehicle::getInfluencer
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:5900
MSCFModel_CC::myCcDecel
const double myCcDecel
The maximum deceleration that the CC can output.
Definition: MSCFModel_CC.h:356
CC_PAR_FLATBED_KA
#define CC_PAR_FLATBED_KA
Definition: CC_Const.h:103
StringUtils.h
LCA_RIGHT
Wants go to the right.
Definition: SUMOXMLDefinitions.h:1228
StringUtils::toInt
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
Definition: StringUtils.cpp:278
CC_PAR_FLATBED_H
#define CC_PAR_FLATBED_H
Definition: CC_Const.h:106
MSCFModel::minNextSpeed
virtual double minNextSpeed(double speed, const MSVehicle *const veh=0) const
Returns the minimum speed given the current speed (depends on the numerical update scheme and its ste...
Definition: MSCFModel.cpp:244
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
SUMO_ATTR_CF_CC_FLATBED_KV
Definition: SUMOXMLDefinitions.h:867
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
SUMO_ATTR_CF_CC_PLOEG_H
Definition: SUMOXMLDefinitions.h:865
PAR_DISTANCE_TO_END
#define PAR_DISTANCE_TO_END
Definition: CC_Const.h:154
MSCFModel::VehicleVariables
Definition: MSCFModel.h:60
ENGINE_PAR_XMLFILE
#define ENGINE_PAR_XMLFILE
Definition: CC_Const.h:83
MSCFModel_CC::getCACCConstantSpacing
double getCACCConstantSpacing(const MSVehicle *veh) const
returns CACC desired constant spacing
Definition: MSCFModel_CC.cpp:611
CC_VehicleVariables::ploegKd
double ploegKd
Definition: CC_VehicleVariables.h:187
CC_VehicleVariables::autoLaneChange
bool autoLaneChange
automatic whole platoon lane change
Definition: CC_VehicleVariables.h:206
Plexe::VEHICLE_DATA::acceleration
double acceleration
Definition: CC_Const.h:62
InvalidArgument
Definition: UtilExceptions.h:56
MSCFModel::stopSpeed
virtual double stopSpeed(const MSVehicle *const veh, const double speed, double gap) const =0
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
MSCFModel::myDecel
double myDecel
The vehicle's maximum deceleration [m/s^2].
Definition: MSCFModel.h:620
CC_VehicleVariables::FAKE_CONTROLLER_DATA::leaderAcceleration
double leaderAcceleration
Definition: CC_VehicleVariables.h:59
CC_VehicleVariables::FAKE_CONTROLLER_DATA::frontAcceleration
double frontAcceleration
Definition: CC_VehicleVariables.h:56
MSCFModel_CC::finalizeSpeed
virtual double finalizeSpeed(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
Definition: MSCFModel_CC.cpp:165
CC_VehicleVariables::caccAlpha3
double caccAlpha3
Definition: CC_VehicleVariables.h:179
Plexe::VEHICLE_DATA::speedX
double speedX
Definition: CC_Const.h:68
MSCFModel_CC::_cacc
double _cacc(const MSVehicle *veh, double egoSpeed, double predSpeed, double predAcceleration, double gap2pred, double leaderSpeed, double leaderAcceleration, double spacing) const
controller for the CACC which computes the acceleration to be applied. the value needs to be passed t...
Definition: MSCFModel_CC.cpp:476
PAR_ACC_HEADWAY_TIME
#define PAR_ACC_HEADWAY_TIME
Definition: CC_Const.h:163
MSBaseVehicle::getID
const std::string & getID() const
Returns the name of the vehicle.
Definition: MSBaseVehicle.cpp:138
CC_ENGINE_MODEL_REALISTIC
#define CC_ENGINE_MODEL_REALISTIC
Definition: CC_Const.h:76
PAR_CRASHED
#define PAR_CRASHED
Definition: CC_Const.h:121
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:167
SUMO_ATTR_CF_CC_PLOEG_KD
Definition: SUMOXMLDefinitions.h:864
CC_VehicleVariables::caccAlpha5
double caccAlpha5
Definition: CC_VehicleVariables.h:179
MSCFModel_CC::myXi
const double myXi
design constant for CACC
Definition: MSCFModel_CC.h:374
MSVehicle::getAcceleration
double getAcceleration() const
Returns the vehicle's acceleration in m/s (this is computed as the last step's mean acceleration in c...
Definition: MSVehicle.h:493
MSCFModel
The car-following model abstraction.
Definition: MSCFModel.h:56
CC_VehicleVariables::leaderAcceleration
double leaderAcceleration
platoon's leader acceleration (used by CACC)
Definition: CC_VehicleVariables.h:123
CC_VehicleVariables::leaderVelocity
Position leaderVelocity
platoon's leader velocity vector
Definition: CC_VehicleVariables.h:131
CC_VehicleVariables::members
std::map< int, std::string > members
list of members belonging to my platoon
Definition: CC_VehicleVariables.h:203
Plexe::ACTIVE_CONTROLLER
ACTIVE_CONTROLLER
Determines the currently active controller, i.e., ACC, CACC, or the driver. In future we might need t...
Definition: CC_Const.h:44
Plexe::VEHICLE_DATA::positionX
double positionX
Definition: CC_Const.h:63
CC_PAR_VEHICLE_DATA
#define CC_PAR_VEHICLE_DATA
Definition: CC_Const.h:86
MSCFModel_CC::_acc
double _acc(const MSVehicle *veh, double egoSpeed, double predSpeed, double gap2pred, double headwayTime) const
controller for the ACC which computes the acceleration to be applied. the value needs to be passed to...
Definition: MSCFModel_CC.cpp:467
Plexe::CONSENSUS
Definition: CC_Const.h:45
MSCFModel_CC::interactionGap
double interactionGap(const MSVehicle *const, double vL) const
Returns the maximum gap at which an interaction between both vehicles occurs.
Definition: MSCFModel_CC.cpp:263
MSVehicle::getSpeed
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:476
RandHelper.h
CC_VehicleVariables::leaderControllerAcceleration
double leaderControllerAcceleration
platoon's leader controller acceleration (used by CACC)
Definition: CC_VehicleVariables.h:125
CC_VehicleVariables::engineModel
int engineModel
numeric value indicating the employed model
Definition: CC_VehicleVariables.h:197
MSCFModel_CC::getACCAcceleration
double getACCAcceleration(const MSVehicle *veh) const
returns the ACC computed acceleration when the faked CACC is controlling the car. This can be used to...
Definition: MSCFModel_CC.cpp:1048
LCA_KEEPRIGHT
The action is due to the default of keeping right "Rechtsfahrgebot".
Definition: SUMOXMLDefinitions.h:1236
CC_PAR_VEHICLE_ENGINE_MODEL
#define CC_PAR_VEHICLE_ENGINE_MODEL
Definition: CC_Const.h:109
CC_VehicleVariables::usePrediction
bool usePrediction
enable/disable data prediction (interpolation) for missing data
Definition: CC_VehicleVariables.h:200
PAR_LEADER_FAKE_DATA
#define PAR_LEADER_FAKE_DATA
Definition: CC_Const.h:150
PAR_FRONT_FAKE_DATA
#define PAR_FRONT_FAKE_DATA
Definition: CC_Const.h:151
Plexe::VEHICLE_DATA::length
double length
Definition: CC_Const.h:66
CC_PAR_PLATOON_SIZE
#define CC_PAR_PLATOON_SIZE
Definition: CC_Const.h:88
MSCFModel::myAccel
double myAccel
The vehicle's maximum acceleration [m/s^2].
Definition: MSCFModel.h:617
PAR_LEADER_SPEED_AND_ACCELERATION
#define PAR_LEADER_SPEED_AND_ACCELERATION
Definition: CC_Const.h:130
CC_VehicleVariables::nInitialized
int nInitialized
count of initialized vehicles
Definition: CC_VehicleVariables.h:169
FirstOrderLagModel
Definition: FirstOrderLagModel.h:26
MSLane::getSpeedLimit
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:532
Position::sety
void sety(double y)
set position y
Definition: Position.h:76
MSCFModel_CC::MSCFModel_CC
MSCFModel_CC(const MSVehicleType *vtype)
Constructor.
Definition: MSCFModel_CC.cpp:41
MSCFModel_CC::myHumanDriver
MSCFModel * myHumanDriver
the car following model which drives the car when automated cruising is disabled, i....
Definition: MSCFModel_CC.h:353
MSVehicle::Influencer::setSpeedMode
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
Definition: MSVehicle.cpp:757
MSRoute::getDistanceBetween
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true, int routePosition=0) const
Compute the distance between 2 given edges on this route, including the length of internal lanes....
Definition: MSRoute.cpp:278
Plexe::VEHICLE_DATA::u
double u
Definition: CC_Const.h:67
MSCFModel_CC::myFlatbedH
const double myFlatbedH
Definition: MSCFModel_CC.h:395
MSVehicleControl.h
TraCIDefs.h
CC_VehicleVariables::frontControllerAcceleration
double frontControllerAcceleration
front vehicle controller acceleration (used by CACC)
Definition: CC_VehicleVariables.h:94
CC_VehicleVariables::flatbedKa
double flatbedKa
Definition: CC_VehicleVariables.h:188
libsumo::Vehicle::getLeader
static std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist=0.)
Definition: Vehicle.cpp:278
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
PAR_PRECEDING_SPEED_AND_ACCELERATION
#define PAR_PRECEDING_SPEED_AND_ACCELERATION
Definition: CC_Const.h:160
MSCFModel::followSpeed
virtual double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const =0
Computes the vehicle's follow speed (no dawdling)
CC_PAR_CACC_XI
#define CC_PAR_CACC_XI
Definition: CC_Const.h:91
PAR_USE_PREDICTION
#define PAR_USE_PREDICTION
Definition: CC_Const.h:172
MSNet::getVehicleControl
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:336
Plexe::DRIVER
Definition: CC_Const.h:45
Plexe::VEHICLE_DATA::angle
double angle
Definition: CC_Const.h:70
MSCFModel_CC::performAutoLaneChange
void performAutoLaneChange(MSVehicle *const veh) const
Definition: MSCFModel_CC.cpp:111
MSCFModel_CC::setParameter
virtual void setParameter(MSVehicle *veh, const std::string &key, const std::string &value) const
try to set the given parameter for this carFollowingModel
Definition: MSCFModel_CC.cpp:626
CC_VehicleVariables::fixedAcceleration
double fixedAcceleration
Definition: CC_VehicleVariables.h:141
MSCFModel_CC::getMyLanesCount
int getMyLanesCount() const
returns the number of lanes set in the configuration file
Definition: MSCFModel_CC.cpp:1059
SUMOTrafficObject::getSpeed
virtual double getSpeed() const =0
Returns the vehicle's current speed.
LCA_BLOCKED
blocked in all directions
Definition: SUMOXMLDefinitions.h:1276
CC_VehicleVariables::leaderSpeed
double leaderSpeed
platoon's leader speed (used by CACC)
Definition: CC_VehicleVariables.h:121
SUMO_ATTR_CF_CC_CCACCEL
Definition: SUMOXMLDefinitions.h:862
MSCFModel_CC::stopSpeed
double stopSpeed(const MSVehicle *const veh, const double speed, double gap2pred) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
Definition: MSCFModel_CC.cpp:233
CC_PAR_UMIN
#define CC_PAR_UMIN
Definition: CC_Const.h:96
SUMO_ATTR_CF_CC_OMEGAN
Definition: SUMOXMLDefinitions.h:859
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
CC_VehicleVariables::leaderVehicle
MSVehicle * leaderVehicle
leader vehicle, used for auto feeding
Definition: CC_VehicleVariables.h:109
PAR_FIXED_ACCELERATION
#define PAR_FIXED_ACCELERATION
Definition: CC_Const.h:124