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-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18/****************************************************************************/
19#include "CC_VehicleVariables.h"
20
21//initialize default L and K matrices
23 {0, 0, 0, 0, 0, 0, 0, 0},
24 {1, 0, 0, 0, 0, 0, 0, 0},
25 {1, 1, 0, 0, 0, 0, 0, 0},
26 {1, 0, 1, 0, 0, 0, 0, 0},
27 {1, 0, 0, 1, 0, 0, 0, 0},
28 {1, 0, 0, 0, 1, 0, 0, 0},
29 {1, 0, 0, 0, 0, 1, 0, 0},
30 {1, 0, 0, 0, 0, 0, 1, 0}
31};
33 {0, 0, 0, 0, 0, 0, 0, 0},
34 {460, 0, 0, 0, 0, 0, 0, 0},
35 {80, 860, 0, 0, 0, 0, 0, 0},
36 {80, 0, 860, 0, 0, 0, 0, 0},
37 {80, 0, 0, 860, 0, 0, 0, 0},
38 {80, 0, 0, 0, 860, 0, 0, 0},
39 {80, 0, 0, 0, 0, 860, 0, 0},
40 {80, 0, 0, 0, 0, 0, 860, 0}
41};
42const double CC_VehicleVariables::defaultB[MAX_N_CARS] = {1800, 1800, 1800, 1800, 1800, 1800, 1800, 1800};
43const double CC_VehicleVariables::defaultH[MAX_N_CARS] = {0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8};
44
46 controllerAcceleration(0), frontSpeed(0), frontAcceleration(0),
47 frontControllerAcceleration(0), frontDataReadTime(0), frontAngle(0), frontInitialized(false),
48 autoFeed(false), leaderVehicle(0), frontVehicle(0),
49 accHeadwayTime(1.5), accLambda(0.1),
50 useControllerAcceleration(true), leaderSpeed(0),
51 leaderAcceleration(0), leaderControllerAcceleration(0), leaderDataReadTime(0), leaderAngle(0),
52 leaderInitialized(false), caccInitialized(false),
53 useFixedAcceleration(0), fixedAcceleration(0),
54 crashed(false),
55 ccDesiredSpeed(14), ccKp(1), activeController(Plexe::DRIVER),
56 nInitialized(0), position(-1), nCars(8),
57 caccXi(-1), caccOmegaN(-1), caccC1(-1), caccAlpha1(-1), caccAlpha2(-1),
58 caccAlpha3(-1), caccAlpha4(-1), caccAlpha5(-1), caccSpacing(5),
59 engineTau(0.5),
60 uMin(-1e6), uMax(1e6),
61 ploegH(0.5), ploegKp(0.2), ploegKd(0.7),
62 flatbedKa(2.4), flatbedKv(0.6), flatbedKp(12), flatbedD(5), flatbedH(4),
63 engine(0), engineModel(CC_ENGINE_MODEL_FOLM),
64 usePrediction(false),
65 autoLaneChange(false) {
73 leaderPosition.set(0, 0);
74 frontPosition.set(0, 0);
75 //init L, K, b, and h with default values
76 memcpy(L, defaultL, sizeof(int)*MAX_N_CARS * MAX_N_CARS);
77 memcpy(K, defaultK, sizeof(double)*MAX_N_CARS * MAX_N_CARS);
78 memcpy(b, defaultB, sizeof(double)*MAX_N_CARS);
79 memcpy(h, defaultH, sizeof(double)*MAX_N_CARS);
80 //no data about any vehicle has been set
81 for (int i = 0; i < MAX_N_CARS; i++) {
82 initialized[i] = false;
83 }
84}
85
87 if (engine) {
88 delete engine;
89 }
90}
#define MAX_N_CARS
Definition: CC_Const.h:77
#define CC_ENGINE_MODEL_FOLM
Definition: CC_Const.h:79
struct FAKE_CONTROLLER_DATA fakeData
fake controller data.
bool initialized[MAX_N_CARS]
tells whether data about a certain vehicle has been initialized
double K[MAX_N_CARS][MAX_N_CARS]
K matrix.
int L[MAX_N_CARS][MAX_N_CARS]
L matrix.
static const double defaultH[]
static const double defaultB[]
double b[MAX_N_CARS]
vector of damping ratios b
GenericEngineModel * engine
engine model employed by this car
double h[MAX_N_CARS]
vector of time headways h
Position frontPosition
current front vehicle position
static const double defaultK[MAX_N_CARS][MAX_N_CARS]
static const int defaultL[MAX_N_CARS][MAX_N_CARS]
Position leaderPosition
platoon's leader position
void set(double x, double y)
set positions x and y
Definition: Position.h:85
Definition: CC_Const.h:26
@ DRIVER
Definition: CC_Const.h:49