Plexe

The Platooning Extension for Veins.

Plexe Examples - Extending Plexe

Warning: As of Plexe 3.0, this example is not included in the sources anymore. This example cannot thus simply be run, but should be first implemented by the user. This guide serves as a tutorial on how to implement a new controller inside SUMO and how to use it within Plexe, and thus requires the developer to modify and re-build both Plexe and SUMO. If you are interested in rebuilding SUMO, please read the SUMO documentation.

Description

This example shows how Plexe can be extended to implement a user-defined control model to be tested against the others. The control law of the custom controller is defined as

\[u_i = k_d (x_{i-1} - x_i - l_{i-1} - 25 \text{m}) + k_s (\dot{x}_{i-1} - \dot{x}_i)\]

The controller tries to maintain a fixed distance of 25 m, and has two gains that acts on the speed (\(k_s\)) and the distance (\(k_d\)) error components. In this example we set \(k_d = 0.2\) and \(k_s = 0.4\).

Changes to the source code

This example requires changes to both Plexe and SUMO. As the tutorial adds a new controller, the main changes are made in SUMO, while the changes in Plexe are only needed to tell the simulator to use this new controller. We thus start describing the changes to SUMO. In particular:

  • CC_Const.h: we change this file in SUMO (and in Plexe as well) to add some constants about the new controller we add to the simulator. In this file we find an enumeration with the list of all available controllers. We add the new one by defining the enum as
enum ACTIVE_CONTROLLER {DRIVER = 0, ACC = 1, CACC = 2, FAKED_CACC = 3, PLOEG = 4, CONSENSUS = 5, FLATBED = 6, MYCC = 7};

According to the control law shown above, the controller has two parameters, \(k_d\) and \(k_s\), so we create two constants for setting the value of those parameters via the TraCI interface, and we do so by adding the following two lines

1 2
#define CC_PAR_MYCC_KD "ccmykd" //k_d constant for new controller #define CC_PAR_MYCC_KS "ccmyks" //k_s constant for new controller

The value of the two constants should clearly be unique within this file.

  • CC_VehicleVariables.h: as this class maintains the state and the variables of a vehicle using automated controller, we add two variables for storing the values of \(k_d\) and \(k_s\). In particular we declare them as
1 2
/// @brief parameters for MYCC double myccKd, myccKs;

and we initialize them in the constructor initialization list (CC_VehicleVariables.cpp):

1 2
flatbedKa(2.4), flatbedKv(0.6), flatbedKp(12), flatbedD(5), flatbedH(4), myccKd(0.2), myccKs(0.4),
  • MSCFModel_CC.h: as described in the documentation, the MSCFModel_CC class is the core of the Plexe extension to SUMO. If you want to introduce a new CACC, you will need to make changes to this file. With respect to the header file, the only thing that we need to do is to define the prototype of the function for our controller, i.e.,
1
double _mycc(const MSVehicle *veh, double egoSpeed, double predSpeed, double gap2pred) const;

where veh is a pointer to the vehicle using the controller, egoSpeed is its current speed, predSpeed is the speed of the vehicle in front, and gap2pred is the distance to the front vehicle.

  • MSCFModel_CC.cpp: the actual implementation goes into the C++ file. First, we edit the _v() function, where the model computes the speed of the vehicle at the next simulation step depending on the current vehicle state and the chosen controller. In the switch statement, we add
1 2 3 4 5 6
case Plexe::MYCC: if (vars->frontInitialized) controllerAcceleration = _mycc(veh, egoSpeed, vars->frontSpeed, gap2pred); else controllerAcceleration = 0; break;

The model first checks whether it has received at least one beacon from the vehicle in front. If that is the case, the model computes the acceleration using our new CACC algorithm. If no front beacon has been received so far, the model cannot compute a valid acceleration value, so the car keeps cruising with a constant speed.

Next, we add the actual implementation of our controller:

1 2 3 4
double MSCFModel_CC::_mycc(const MSVehicle *veh, double egoSpeed, double predSpeed, double gap2pred) const { CC_VehicleVariables* vars = (CC_VehicleVariables*)veh->getCarFollowVariables(); return vars->myccKd * (gap2pred - 25) + vars->myccKs * (predSpeed - egoSpeed); }

Finally, we need to handle the passing of the \(k_d\) and \(k_s\) parameters via the TraCI interface. To do so, we edit the setParameter() function. This function handles data coming from Plexe via TraCI and has the following prototype:

1
void setParameter(MSVehicle *veh, const std::string& key, const std::string& value) const;

The veh variable is the vehicle for which this method has been called, key is the parameter to be set, while value is the value for that parameter.

To handle value passing for our parameters we add two new if statements.

1 2 3 4 5 6 7 8
if (key.compare(CC_PAR_MYCC_KD) == 0) { vars->myccKd = StringUtils::toDouble(value.c_str()); return; } if (key.compare(CC_PAR_MYCC_KS) == 0) { vars->myccKs = StringUtils::toDouble(value.c_str()); return; }

The two constants we are handling are the ones we defined in the CC_Const.h file. Please notice that this example does not change SUMO to parse the parameters of our controller from the vehicle type XML definition. The reason is that this requires to modify the SUMOXMLDefinitions.h file, which causes an almost complete rebuild of SUMO. Without this changes, recompiling is a matter of a few seconds.

Concerning changes to Plexe, we simply need to edit the simulation to use the new controller available in SUMO. The first step is to replicate the changes made to CC_Const.h in SUMO. Then we perform the following changes:

  • BaseScenario.ned: we add the two parameters of our controller to be able to set them within the omnetpp.ini file. To do so we simply add
1 2
double myccKd; double myccKs;
  • BBaseScenario.ned: to reflect the changes into BaseScenario.ned, we add the same parameters to the module defining the default values
1 2
double myccKd = default(0.6); double myccKs = default(1);
  • BaseScenario.h: we create two class variable to store the parameters in the C++ implementation:
1
double myccKd, myccKs;
  • BaseScenario.cc: we change the implementation to load the value of such parameters in the initialize method:
1 2
myccKd = par("myccKd").doubleValue(); myccKs = par("myccKs").doubleValue();

and to pass their value to Plexe-SUMO in the initializeControllers() function:

1 2
traciVehicle->setParameter(CC_PAR_MYCC_KD, myccKd); traciVehicle->setParameter(CC_PAR_MYCC_KS, myccKs);

Finally, we need to enable the use of our new controller when requested, so in the initialize method we add the following lines:

1 2 3
else if (strcmp(strController, "MYCC") == 0) { controller = plexe::MYCC; }
  • omnetpp.ini: the next step is to change the configuration of the simulation in examples/platooning. First, we set the values for our controller parameters:
1 2
*.node[*].scenario.myccKd = 0.2 *.node[*].scenario.myccKs = 0.4

Then, we need to add a new simulation run that uses our new controller:

1 2 3 4 5 6 7
**.numericController = ${controller = 0, 0, 1, 2, 3, 4, 5} *.node[*].scenario.controller = ${sController = "ACC", "ACC", "CACC", "PLOEG", "CONSENSUS", "FLATBED", "MYCC" ! controller} [...] **.headway = ${headway = 0.3, 1.2, 0.1, 0.1, 0.1, 0.1, 0.1 ! controller}s [...] **.traffic.platoonInsertDistance = ${2, 2, 5, 2, 15, 5, 25 ! controller}m **.traffic.platoonInsertHeadway = ${0.3, 1.2, 0, 0.5, 0.8, 0, 0 ! controller}s

The first two lines add a numeric ID to our controller (which adds an additional simulation run) and pass the MYCC string as the controller to be used associated with such ID. The headway parameter is only needed by the ACC, but we need to add a value to respect the cardinality of the controller variable. Any number can be used here. Finally, we need to modify two parameters of the PlatoonsTrafficManager class. As the class inserts platoons at steady state, we need to tell it at which distance vehicles should be inserted for each controller. In our case, we have a fixed distance of 25 m (first line) and there is no headway time (second line).

  • plot-sinusoidal.R and plot-braking.R: finally, we change the plot scripts to plot the behavior of our controller. We change both files and add
1 2 3 4 5 6 7 8 9
cntr = c( "ACC (0.3 s)", "ACC (1.2 s)", "CACC", "PLOEG", "CONSENSUS", "FLATBED", "MYCC" )

Running the example

This example is the same as Example 1, but this time we have the new user-defined controller as well. After re-compiling both Plexe and SUMO (which should be quick as changes are minor), you can just run the two new simulations:

1 2 3
cd ~/src/plexe/examples/platooning plexe_run -u Cmdenv -c SinusoidalNoGui -r 6 plexe_run -u Cmdenv -c BrakingNoGui -r 6

Plotting the results

When the simulation terminates, go into the analysis folder and type

1 2 3
make Rscript plot-sinusoidal.R Rscript plot-braking.R

By typing make the Makefile you already generated for Example 1 parses the result files and merges them into the merged .Rdata files. The older results are untouched, so they are not re-processed. The script generates plots similar to the ones of the first example, but this time they include the user-defined controller. The plots clearly show the instability of the controller (it even leads to a collision in the braking scenario), which could be expected since this is a toy example. This shows, however, how easily Plexe can be extended to test new control algorithms.

Sinusoidal scenario

Figure 1. Control inputs in time.

Figure 2. Accelerations in time.

Figure 3. Speeds in time.

Figure 4. Distances in time.

Braking scenario

Figure 5. Control inputs in time.

Figure 6. Accelerations in time.

Figure 7. Speeds in time.

Figure 8. Distances in time.

Diff

Warning: the following diffs apply to plexe-2.1 (both Plexe-Veins and Plexe-SUMO) and cannot be directly used to patch version 3.0 to implement the experiments. It is left here as an additional resource.

Plexe-SUMO

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
diff --git a/src/microsim/cfmodels/CC_Const.h b/src/microsim/cfmodels/CC_Const.h index 30f2bb61768..0542db58756 100644 --- a/src/microsim/cfmodels/CC_Const.h +++ b/src/microsim/cfmodels/CC_Const.h @@ -43,7 +43,7 @@ enum PLATOONING_LANE_CHANGE_ACTION { * leave the control to the mobility model which reproduces a human driver */ enum ACTIVE_CONTROLLER -{DRIVER = 0, ACC = 1, CACC = 2, FAKED_CACC = 3, PLOEG = 4, CONSENSUS = 5, FLATBED = 6}; +{DRIVER = 0, ACC = 1, CACC = 2, FAKED_CACC = 3, PLOEG = 4, CONSENSUS = 5, FLATBED = 6, MYCC = 7}; /** * @brief struct used as header for generic data passing to this model through @@ -107,6 +107,9 @@ struct VEHICLE_DATA { #define CC_PAR_FLATBED_H "ccfh" //h parameter of flatbed CACC #define CC_PAR_FLATBED_D "ccfd" //distance parameter of flatbed CACC +#define CC_PAR_MYCC_KD "ccmykd" //k_d constant for new controller +#define CC_PAR_MYCC_KS "ccmyks" //k_s constant for new controller + #define CC_PAR_VEHICLE_ENGINE_MODEL "ccem" //set the engine model for a vehicle #define CC_PAR_VEHICLE_MODEL "ccvm" //set the vehicle model, i.e., engine characteristics diff --git a/src/microsim/cfmodels/CC_VehicleVariables.cpp b/src/microsim/cfmodels/CC_VehicleVariables.cpp index 06313632c0d..76c7ca26905 100644 --- a/src/microsim/cfmodels/CC_VehicleVariables.cpp +++ b/src/microsim/cfmodels/CC_VehicleVariables.cpp @@ -59,6 +59,7 @@ CC_VehicleVariables::CC_VehicleVariables() : uMin(-1e6), uMax(1e6), ploegH(0.5), ploegKp(0.2), ploegKd(0.7), flatbedKa(2.4), flatbedKv(0.6), flatbedKp(12), flatbedD(5), flatbedH(4), + myccKd(0.2), myccKs(0.4), engine(0), engineModel(CC_ENGINE_MODEL_FOLM), usePrediction(false), autoLaneChange(false) { diff --git a/src/microsim/cfmodels/CC_VehicleVariables.h b/src/microsim/cfmodels/CC_VehicleVariables.h index 42eb0e18cb9..a697c817b9b 100644 --- a/src/microsim/cfmodels/CC_VehicleVariables.h +++ b/src/microsim/cfmodels/CC_VehicleVariables.h @@ -197,6 +197,9 @@ public: double flatbedD; double flatbedH; + double myccKd; + double myccKs; + /// @brief engine model employed by this car GenericEngineModel *engine; /// @brief numeric value indicating the employed model diff --git a/src/microsim/cfmodels/MSCFModel_CC.cpp b/src/microsim/cfmodels/MSCFModel_CC.cpp index 6d2383bd879..8de634936e2 100644 --- a/src/microsim/cfmodels/MSCFModel_CC.cpp +++ b/src/microsim/cfmodels/MSCFModel_CC.cpp @@ -54,7 +54,8 @@ MSCFModel_CC::MSCFModel_CC(const MSVehicleType* vtype, : MSCFModel(vtype, accel, decel, decel, decel, headwayTime), myCcDecel(ccDecel), myCcAccel(ccAccel), myConstantSpacing(constantSpacing) , myKp(kp), myLambda(lambda), myC1(c1), myXi(xi), myOmegaN(omegaN), myTau(tau), myLanesCount(lanesCount), myPloegH(ploegH), myPloegKp(ploegKp), myPloegKd(ploegKd), - myFlatbedKa(flatbedKa), myFlatbedKv(flatbedKv), myFlatbedKp(flatbedKp), myFlatbedH(flatbedH), myFlatbedD(flatbedD) { + myFlatbedKa(flatbedKa), myFlatbedKv(flatbedKv), myFlatbedKp(flatbedKp), myFlatbedH(flatbedH), myFlatbedD(flatbedD), + myCcKd(0.2), myCcKs(0.4) { //if the lanes count has not been specified in the attributes of the model, lane changing cannot properly work if (lanesCount == -1) { @@ -95,6 +96,8 @@ MSCFModel_CC::createVehicleVariables() const { vars->flatbedKp = myFlatbedKp; vars->flatbedD = myFlatbedD; vars->flatbedH = myFlatbedH; + vars->myccKs = myCcKs; + vars->myccKd = myCcKd; //by default use a first order lag model for the engine vars->engine = new FirstOrderLagModel(); vars->engine->setParameter(FOLM_PAR_TAU, vars->engineTau); @@ -437,6 +440,14 @@ MSCFModel_CC::_v(const MSVehicle* const veh, double gap2pred, double egoSpeed, d break; + case Plexe::MYCC: + + if (vars->frontInitialized) + controllerAcceleration = _mycc(veh, egoSpeed, vars->frontSpeed, gap2pred); + else + controllerAcceleration = 0; + break; + case Plexe::DRIVER: std::cerr << "Switching to normal driver behavior still not implemented in MSCFModel_CC\n"; @@ -611,6 +622,12 @@ MSCFModel_CC::_flatbed(const MSVehicle *veh, double egoAcceleration, double egoS ); } +double +MSCFModel_CC::_mycc(const MSVehicle *veh, double egoSpeed, double predSpeed, double gap2pred) const { + CC_VehicleVariables* vars = (CC_VehicleVariables*)veh->getCarFollowVariables(); + return vars->myccKd * (gap2pred - 25) + vars->myccKs * (predSpeed - egoSpeed); +} + double MSCFModel_CC::getCACCConstantSpacing(const MSVehicle * veh) const { CC_VehicleVariables* vars = (CC_VehicleVariables*) veh->getCarFollowVariables(); @@ -785,6 +802,14 @@ void MSCFModel_CC::setParameter(MSVehicle *veh, const std::string& key, const st vars->flatbedD = StringUtils::toDouble(value.c_str()); return; } + if (key.compare(CC_PAR_MYCC_KD) == 0) { + vars->myccKd = StringUtils::toDouble(value.c_str()); + return; + } + if (key.compare(CC_PAR_MYCC_KS) == 0) { + vars->myccKs = StringUtils::toDouble(value.c_str()); + return; + } if (key.compare(CC_PAR_VEHICLE_ENGINE_MODEL) == 0) { if (vars->engine) { delete vars->engine; diff --git a/src/microsim/cfmodels/MSCFModel_CC.h b/src/microsim/cfmodels/MSCFModel_CC.h index 40849a898ee..5a2894741a3 100644 --- a/src/microsim/cfmodels/MSCFModel_CC.h +++ b/src/microsim/cfmodels/MSCFModel_CC.h @@ -365,6 +365,7 @@ private: double _flatbed(const MSVehicle *veh, double egoAcceleration, double egoSpeed, double predSpeed, double gap2pred, double leaderSpeed) const; + double _mycc(const MSVehicle *veh, double egoSpeed, double predSpeed, double gap2pred) const; private: @@ -414,6 +415,10 @@ private: const double myFlatbedH; const double myFlatbedD; + /// @brief sample MYCC controller parameters + const double myCcKd; + const double myCcKs; + }; #endif /* MSCFMODEL_CC_H */

Plexe-Veins

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
diff --git a/examples/platooning/analysis/plot-braking.R b/examples/platooning/analysis/plot-braking.R index 9f3be5bd..ba6e3ea0 100644 --- a/examples/platooning/analysis/plot-braking.R +++ b/examples/platooning/analysis/plot-braking.R @@ -7,7 +7,8 @@ cntr = c( "CACC", "PLOEG", "CONSENSUS", - "FLATBED" + "FLATBED", + "MYCC" ) #map controller id to name controller <- function(id, headway) { diff --git a/examples/platooning/analysis/plot-sinusoidal.R b/examples/platooning/analysis/plot-sinusoidal.R index 02868be4..d3ad2b98 100644 --- a/examples/platooning/analysis/plot-sinusoidal.R +++ b/examples/platooning/analysis/plot-sinusoidal.R @@ -7,7 +7,8 @@ cntr = c( "CACC", "PLOEG", "CONSENSUS", - "FLATBED" + "FLATBED", + "MYCC" ) #map controller id to name diff --git a/examples/platooning/omnetpp.ini b/examples/platooning/omnetpp.ini index 02a07a15..0c8e5e7d 100644 --- a/examples/platooning/omnetpp.ini +++ b/examples/platooning/omnetpp.ini @@ -126,13 +126,16 @@ seed-set = ${repetition} *.node[*].scenario.useRealisticEngine = false #via wireless send acceleration computed by the controller, not the actual one *.node[*].scenario.useControllerAcceleration = true +#set parameters for MYCC +*.node[*].scenario.myccKd = 0.2 +*.node[*].scenario.myccKs = 0.4 #controllers to be tested -**.numericController = ${controller = 0, 0, 1, 2, 3, 4} -*.node[*].scenario.controller = ${sController = "ACC", "ACC", "CACC", "PLOEG", "CONSENSUS", "FLATBED" ! controller} +**.numericController = ${controller = 0, 0, 1, 2, 3, 4, 5} +*.node[*].scenario.controller = ${sController = "ACC", "ACC", "CACC", "PLOEG", "CONSENSUS", "FLATBED", "MYCC" ! controller} #headway for ACCs -**.headway = ${headway = 0.3, 1.2, 0.1, 0.1, 0.1, 0.1 ! controller}s +**.headway = ${headway = 0.3, 1.2, 0.1, 0.1, 0.1, 0.1, 0.1 ! controller}s *.node[*].scenario.accHeadway = ${headway}s *.node[*].scenario.leaderHeadway = ${leaderHeadway = 1.2}s @@ -183,8 +186,8 @@ seed-set = ${repetition} #SUMO vtype for platooning vehicles **.traffic.platooningVType = "vtypeauto" #insert vehicles already at steady-state. distance depends on controller -**.traffic.platoonInsertDistance = ${2, 2, 5, 2, 15, 5 ! controller}m -**.traffic.platoonInsertHeadway = ${0.3, 1.2, 0, 0.5, 0.8, 0 ! controller}s +**.traffic.platoonInsertDistance = ${2, 2, 5, 2, 15, 5, 25 ! controller}m +**.traffic.platoonInsertHeadway = ${0.3, 1.2, 0, 0.5, 0.8, 0, 0 ! controller}s **.traffic.platoonLeaderHeadway = ${leaderHeadway}s diff --git a/src/veins/modules/application/platooning/CC_Const.h b/src/veins/modules/application/platooning/CC_Const.h index fa0288ba..03494159 100644 --- a/src/veins/modules/application/platooning/CC_Const.h +++ b/src/veins/modules/application/platooning/CC_Const.h @@ -45,7 +45,7 @@ enum PLATOONING_LANE_CHANGE_ACTION { * leave the control to the mobility model which reproduces a human driver */ enum ACTIVE_CONTROLLER -{DRIVER = 0, ACC = 1, CACC = 2, FAKED_CACC = 3, PLOEG = 4, CONSENSUS = 5, FLATBED = 6}; +{DRIVER = 0, ACC = 1, CACC = 2, FAKED_CACC = 3, PLOEG = 4, CONSENSUS = 5, FLATBED = 6, MYCC = 7}; /** * @brief struct used as header for generic data passing to this model through @@ -109,6 +109,9 @@ struct VEHICLE_DATA { #define CC_PAR_FLATBED_H "ccfh" //h parameter of flatbed CACC #define CC_PAR_FLATBED_D "ccfd" //distance parameter of flatbed CACC +#define CC_PAR_MYCC_KD "ccmykd" //k_d constant for new controller +#define CC_PAR_MYCC_KS "ccmyks" //k_s constant for new controller + #define CC_PAR_VEHICLE_ENGINE_MODEL "ccem" //set the engine model for a vehicle #define CC_PAR_VEHICLE_MODEL "ccvm" //set the vehicle model, i.e., engine characteristics diff --git a/src/veins/modules/application/platooning/scenarios/BBaseScenario.ned b/src/veins/modules/application/platooning/scenarios/BBaseScenario.ned index 297a1cc2..008e13b4 100644 --- a/src/veins/modules/application/platooning/scenarios/BBaseScenario.ned +++ b/src/veins/modules/application/platooning/scenarios/BBaseScenario.ned @@ -49,6 +49,8 @@ simple BBaseScenario like BaseScenario double flatbedKp = default(12); double flatbedH = default(4); double flatbedD = default(5); + double myccKd = default(0.6); + double myccKs = default(1); bool useControllerAcceleration = default(true); bool usePrediction = default(true); diff --git a/src/veins/modules/application/platooning/scenarios/BaseScenario.cc b/src/veins/modules/application/platooning/scenarios/BaseScenario.cc index 210a7d35..f44b9443 100644 --- a/src/veins/modules/application/platooning/scenarios/BaseScenario.cc +++ b/src/veins/modules/application/platooning/scenarios/BaseScenario.cc @@ -40,6 +40,8 @@ void BaseScenario::initialize(int stage) { flatbedKp = par("flatbedKp").doubleValue(); flatbedH = par("flatbedH").doubleValue(); flatbedD = par("flatbedD").doubleValue(); + myccKd = par("myccKd").doubleValue(); + myccKs = par("myccKs").doubleValue(); useControllerAcceleration = par("useControllerAcceleration").boolValue(); usePrediction = par("usePrediction").boolValue(); @@ -66,6 +68,9 @@ void BaseScenario::initialize(int stage) { else if (strcmp(strController, "FLATBED") == 0) { controller = plexe::FLATBED; } + else if (strcmp(strController, "MYCC") == 0) { + controller = plexe::MYCC; + } else { throw cRuntimeError("Invalid controller selected"); } @@ -124,6 +129,8 @@ void BaseScenario::initializeControllers() { traciVehicle->setParameter(CC_PAR_FLATBED_KP, flatbedKp); traciVehicle->setParameter(CC_PAR_FLATBED_H, flatbedH); traciVehicle->setParameter(CC_PAR_FLATBED_D, flatbedD); + traciVehicle->setParameter(CC_PAR_MYCC_KD, myccKd); + traciVehicle->setParameter(CC_PAR_MYCC_KS, myccKs); //consensus parameters traciVehicle->setParameter(CC_PAR_VEHICLE_POSITION, positionHelper->getPosition()); traciVehicle->setParameter(CC_PAR_PLATOON_SIZE, positionHelper->getPlatoonSize()); diff --git a/src/veins/modules/application/platooning/scenarios/BaseScenario.h b/src/veins/modules/application/platooning/scenarios/BaseScenario.h index 40f76174..6edf50d9 100644 --- a/src/veins/modules/application/platooning/scenarios/BaseScenario.h +++ b/src/veins/modules/application/platooning/scenarios/BaseScenario.h @@ -65,6 +65,7 @@ class BaseScenario : public BaseApplLayer double flatbedKp; double flatbedH; double flatbedD; + double myccKd, myccKs; bool useControllerAcceleration; bool usePrediction; diff --git a/src/veins/modules/application/platooning/scenarios/BaseScenario.ned b/src/veins/modules/application/platooning/scenarios/BaseScenario.ned index fc8517ae..a4544d36 100644 --- a/src/veins/modules/application/platooning/scenarios/BaseScenario.ned +++ b/src/veins/modules/application/platooning/scenarios/BaseScenario.ned @@ -45,6 +45,8 @@ moduleinterface BaseScenario extends IBaseApplLayer double flatbedKp; double flatbedH; double flatbedD; + double myccKd; + double myccKs; //use the real or the controller acceleration for computing the acceleration bool useControllerAcceleration; //use prediction for computing missing data between successive beacons