Eclipse SUMO - Simulation of Urban MObility
CC_VehicleVariables.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 /****************************************************************************/
15 #include "CC_VehicleVariables.h"
16 
17 //initialize default L and K matrices
19  {0, 0, 0, 0, 0, 0, 0, 0},
20  {1, 0, 0, 0, 0, 0, 0, 0},
21  {1, 1, 0, 0, 0, 0, 0, 0},
22  {1, 0, 1, 0, 0, 0, 0, 0},
23  {1, 0, 0, 1, 0, 0, 0, 0},
24  {1, 0, 0, 0, 1, 0, 0, 0},
25  {1, 0, 0, 0, 0, 1, 0, 0},
26  {1, 0, 0, 0, 0, 0, 1, 0}
27 };
28 const double CC_VehicleVariables::defaultK[][MAX_N_CARS] = {
29  {0, 0, 0, 0, 0, 0, 0, 0},
30  {460, 0, 0, 0, 0, 0, 0, 0},
31  {80, 860, 0, 0, 0, 0, 0, 0},
32  {80, 0, 860, 0, 0, 0, 0, 0},
33  {80, 0, 0, 860, 0, 0, 0, 0},
34  {80, 0, 0, 0, 860, 0, 0, 0},
35  {80, 0, 0, 0, 0, 860, 0, 0},
36  {80, 0, 0, 0, 0, 0, 860, 0}
37 };
38 const double CC_VehicleVariables::defaultB[MAX_N_CARS] = {1800, 1800, 1800, 1800, 1800, 1800, 1800, 1800};
39 const double CC_VehicleVariables::defaultH[MAX_N_CARS] = {0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8};
40 
42  controllerAcceleration(0), frontSpeed(0), frontAcceleration(0),
43  frontControllerAcceleration(0), frontDataReadTime(0), frontAngle(0), frontInitialized(false),
44  autoFeed(false), leaderVehicle(0), frontVehicle(0),
45  accHeadwayTime(1.5), accLambda(0.1),
46  useControllerAcceleration(true), leaderSpeed(0),
47  leaderAcceleration(0), leaderControllerAcceleration(0), leaderDataReadTime(0), leaderAngle(0),
48  leaderInitialized(false), caccInitialized(false),
49  useFixedAcceleration(0), fixedAcceleration(0),
50  crashed(false),
51  ccDesiredSpeed(14), ccKp(1), activeController(Plexe::DRIVER),
52  nInitialized(0), position(-1), nCars(8),
53  caccXi(-1), caccOmegaN(-1), caccC1(-1), caccAlpha1(-1), caccAlpha2(-1),
54  caccAlpha3(-1), caccAlpha4(-1), caccAlpha5(-1), caccSpacing(5),
55  engineTau(0.5),
56  uMin(-1e6), uMax(1e6),
57  ploegH(0.5), ploegKp(0.2), ploegKd(0.7),
58  flatbedKa(2.4), flatbedKv(0.6), flatbedKp(12), flatbedD(5), flatbedH(4),
59  engine(0), engineModel(CC_ENGINE_MODEL_FOLM),
60  usePrediction(false),
61  autoLaneChange(false) {
65  fakeData.frontSpeed = 0;
69  leaderPosition.set(0, 0);
70  frontPosition.set(0, 0);
71  //init L, K, b, and h with default values
72  memcpy(L, defaultL, sizeof(int)*MAX_N_CARS * MAX_N_CARS);
73  memcpy(K, defaultK, sizeof(double)*MAX_N_CARS * MAX_N_CARS);
74  memcpy(b, defaultB, sizeof(double)*MAX_N_CARS);
75  memcpy(h, defaultH, sizeof(double)*MAX_N_CARS);
76  //no data about any vehicle has been set
77  for (int i = 0; i < MAX_N_CARS; i++) {
78  initialized[i] = false;
79  }
80 }
81 
83  if (engine) {
84  delete engine;
85  }
86 }
CC_VehicleVariables::K
double K[MAX_N_CARS][MAX_N_CARS]
K matrix.
Definition: CC_VehicleVariables.h:158
CC_VehicleVariables::frontPosition
Position frontPosition
current front vehicle position
Definition: CC_VehicleVariables.h:96
Plexe
Definition: CC_Const.h:22
CC_VehicleVariables::leaderPosition
Position leaderPosition
platoon's leader position
Definition: CC_VehicleVariables.h:127
CC_VehicleVariables::FAKE_CONTROLLER_DATA::frontDistance
double frontDistance
Definition: CC_VehicleVariables.h:54
CC_VehicleVariables::FAKE_CONTROLLER_DATA::leaderSpeed
double leaderSpeed
Definition: CC_VehicleVariables.h:58
CC_VehicleVariables::defaultK
const static double defaultK[MAX_N_CARS][MAX_N_CARS]
Definition: CC_VehicleVariables.h:71
CC_VehicleVariables::FAKE_CONTROLLER_DATA::leaderControllerAcceleration
double leaderControllerAcceleration
Definition: CC_VehicleVariables.h:60
CC_VehicleVariables::engine
GenericEngineModel * engine
engine model employed by this car
Definition: CC_VehicleVariables.h:195
CC_VehicleVariables::h
double h[MAX_N_CARS]
vector of time headways h
Definition: CC_VehicleVariables.h:162
CC_VehicleVariables::fakeData
struct FAKE_CONTROLLER_DATA fakeData
fake controller data.
Definition: CC_VehicleVariables.h:153
CC_VehicleVariables::FAKE_CONTROLLER_DATA::frontControllerAcceleration
double frontControllerAcceleration
Definition: CC_VehicleVariables.h:57
CC_ENGINE_MODEL_FOLM
#define CC_ENGINE_MODEL_FOLM
Definition: CC_Const.h:75
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
CC_VehicleVariables::initialized
bool initialized[MAX_N_CARS]
tells whether data about a certain vehicle has been initialized
Definition: CC_VehicleVariables.h:167
CC_VehicleVariables::defaultB
const static double defaultB[]
Definition: CC_VehicleVariables.h:76
CC_VehicleVariables::L
int L[MAX_N_CARS][MAX_N_CARS]
L matrix.
Definition: CC_VehicleVariables.h:156
CC_VehicleVariables::~CC_VehicleVariables
~CC_VehicleVariables()
Definition: CC_VehicleVariables.cpp:82
CC_VehicleVariables::FAKE_CONTROLLER_DATA::frontSpeed
double frontSpeed
Definition: CC_VehicleVariables.h:55
CC_VehicleVariables::b
double b[MAX_N_CARS]
vector of damping ratios b
Definition: CC_VehicleVariables.h:160
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
CC_VehicleVariables.h
CC_VehicleVariables::defaultH
const static double defaultH[]
Definition: CC_VehicleVariables.h:81
CC_VehicleVariables::defaultL
const static int defaultL[MAX_N_CARS][MAX_N_CARS]
Definition: CC_VehicleVariables.h:66
Plexe::DRIVER
Definition: CC_Const.h:45
CC_VehicleVariables::CC_VehicleVariables
CC_VehicleVariables()
Definition: CC_VehicleVariables.cpp:41