Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
CC_VehicleVariables.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 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
48 autoFeed(false), leaderVehicle(nullptr), leaderVehicleId(""), frontVehicle(nullptr), frontVehicleId(""),
49 isLeader(true),
50 accHeadwayTime(1.5), accLambda(0.1),
55 crashed(false),
56 ccDesiredSpeed(14), ccKp(1), activeController(Plexe::DRIVER),
57 nInitialized(0), position(-1), nCars(8),
58 caccXi(-1), caccOmegaN(-1), caccC1(-1), caccAlpha1(-1), caccAlpha2(-1),
60 engineTau(0.5),
61 uMin(-1e6), uMax(1e6),
62 ploegH(0.5), ploegKp(0.2), ploegKd(0.7),
63 flatbedKa(2.4), flatbedKv(0.6), flatbedKp(12), flatbedD(5), flatbedH(4),
65 usePrediction(false),
66 autoLaneChange(false),
69 fakeData.frontAcceleration = 0;
70 fakeData.frontControllerAcceleration = 0;
71 fakeData.frontDistance = 0;
72 fakeData.frontSpeed = 0;
73 fakeData.leaderAcceleration = 0;
74 fakeData.leaderControllerAcceleration = 0;
75 fakeData.leaderSpeed = 0;
76 leaderPosition.set(0, 0);
77 frontPosition.set(0, 0);
78 //init L, K, b, and h with default values
79 memcpy(L, defaultL, sizeof(int)*MAX_N_CARS * MAX_N_CARS);
80 memcpy(K, defaultK, sizeof(double)*MAX_N_CARS * MAX_N_CARS);
81 memcpy(b, defaultB, sizeof(double)*MAX_N_CARS);
82 memcpy(h, defaultH, sizeof(double)*MAX_N_CARS);
83 //no data about any vehicle has been set
84 for (int i = 0; i < MAX_N_CARS; i++) {
85 initialized[i] = false;
86 }
87}
88
#define MAX_N_CARS
Definition CC_Const.h:77
#define CC_ENGINE_MODEL_FOLM
Definition CC_Const.h:79
int nInitialized
count of initialized vehicles
int platoonFixedLane
whole platoon lane change (not automatic). -1 indicates no need to change lane (mechanism disabled)
bool autoFeed
determines whether CACC should automatically fetch data about other vehicles
bool commitToLaneChange
when followers asks whether to actually change lane or not, what should the leader tell them?...
struct FAKE_CONTROLLER_DATA fakeData
fake controller data.
MSVehicle * frontVehicle
front sumo id, used for auto feeding
double accHeadwayTime
headway time for ACC
bool initialized[MAX_N_CARS]
tells whether data about a certain vehicle has been initialized
double frontSpeed
current front vehicle speed
double K[MAX_N_CARS][MAX_N_CARS]
K matrix.
int position
my position within the platoon (0 = first car)
double frontAcceleration
current front vehicle acceleration (used by CACC)
bool frontInitialized
@did we receive at least one packet?
double leaderDataReadTime
when leader data has been readed from GPS
bool usePrediction
enable/disable data prediction (interpolation) for missing data
double leaderControllerAcceleration
platoon's leader controller acceleration (used by CACC)
double controllerAcceleration
acceleration as computed by the controller, to be sent to other vehicles
int L[MAX_N_CARS][MAX_N_CARS]
L matrix.
double caccXi
controller related parameters
static const double defaultH[]
double frontControllerAcceleration
front vehicle controller acceleration (used by CACC)
static const double defaultB[]
double b[MAX_N_CARS]
vector of damping ratios b
GenericEngineModel * engine
engine model employed by this car
int nCars
number of cars in the platoon
double leaderSpeed
platoon's leader speed (used by CACC)
double leaderAngle
platoon's leader angle in radians
enum Plexe::ACTIVE_CONTROLLER activeController
currently active controller
bool leaderInitialized
@did we receive at least one packet?
double caccSpacing
fixed spacing for CACC
double uMin
limits for u
double ccDesiredSpeed
CC desired speed.
double h[MAX_N_CARS]
vector of time headways h
std::string frontVehicleId
sumo id of the front vehicle
Position frontPosition
current front vehicle position
bool isLeader
whether this vehicle is leader of a platoon or not. This is mainly used by the lane change logic....
double leaderAcceleration
platoon's leader acceleration (used by CACC)
static const double defaultK[MAX_N_CARS][MAX_N_CARS]
int noCommitReason
if a follower asks and we don't commit, what should be the blocked state to return?
std::string leaderVehicleId
sumo id of the leader vehicle
static const int defaultL[MAX_N_CARS][MAX_N_CARS]
bool autoLaneChange
automatic whole platoon lane change
SUMOTime laneChangeCommitTime
timestep for which the above commit is valid¬
double frontAngle
front vehicle angle in radians
double frontDataReadTime
when front vehicle data has been readed from GPS
int engineModel
numeric value indicating the employed model
MSVehicle * leaderVehicle
leader vehicle, used for auto feeding
Position leaderPosition
platoon's leader position
bool useControllerAcceleration
determines whether PATH's CACC should use the real vehicle acceleration or the controller computed on...