Skip to content

Commit

Permalink
MSCFModel_CC: add isLeader() method. To be better defined
Browse files Browse the repository at this point in the history
  • Loading branch information
michele-segata authored and namdre committed May 2, 2024
1 parent 8f1cd86 commit 280bd4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/microsim/cfmodels/MSCFModel_CC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,3 +1119,10 @@ MSCFModel*
MSCFModel_CC::duplicate(const MSVehicleType* vtype) const {
return new MSCFModel_CC(vtype);
}

bool
MSCFModel_CC::isLeader(const MSVehicle *veh) const {
auto vars = (CC_VehicleVariables*)veh->getCarFollowVariables();
// TODO: this condition might not be enough
return vars->activeController == Plexe::ACC;
}
2 changes: 2 additions & 0 deletions src/microsim/cfmodels/MSCFModel_CC.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ class MSCFModel_CC : public MSCFModel {

void setLeader(MSVehicle* veh, MSVehicle* const leader) const;

bool isLeader(const MSVehicle* veh) const;

/**
* @brief returns the number of lanes set in the configuration file
*/
Expand Down

0 comments on commit 280bd4e

Please sign in to comment.