Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSLCM_DK2008.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2005-2024 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/****************************************************************************/
22// A lane change model developed by D. Krajzewicz between 2004 and 2010
23/****************************************************************************/
24#pragma once
25#include <config.h>
26
28#include <vector>
29
30// ===========================================================================
31// class definitions
32// ===========================================================================
38public:
39
41
42 virtual ~MSLCM_DK2008();
43
48
53 int wantsChange(
54 int laneOffset,
55 MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
56 const std::pair<MSVehicle*, double>& leader,
57 const std::pair<MSVehicle*, double>& follower,
58 const std::pair<MSVehicle*, double>& neighLead,
59 const std::pair<MSVehicle*, double>& neighFollow,
60 const MSLane& neighLane,
61 const std::vector<MSVehicle::LaneQ>& preb,
62 MSVehicle** lastBlocked,
63 MSVehicle** firstBlocked);
64
65 virtual void* inform(void* info, MSVehicle* sender);
66
75 virtual double patchSpeed(const double min, const double wanted, const double max,
76 const MSCFModel& cfModel);
77
78 virtual void changed();
79
80 virtual void prepareStep();
81
82
83protected:
87 virtual int wantsChangeToRight(
88 MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
89 const std::pair<MSVehicle*, double>& leader,
90 const std::pair<MSVehicle*, double>& neighLead,
91 const std::pair<MSVehicle*, double>& neighFollow,
92 const MSLane& neighLane,
93 const std::vector<MSVehicle::LaneQ>& preb,
94 MSVehicle** lastBlocked,
95 MSVehicle** firstBlocked);
96
100 virtual int wantsChangeToLeft(
101 MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
102 const std::pair<MSVehicle*, double>& leader,
103 const std::pair<MSVehicle*, double>& neighLead,
104 const std::pair<MSVehicle*, double>& neighFollow,
105 const MSLane& neighLane,
106 const std::vector<MSVehicle::LaneQ>& preb,
107 MSVehicle** lastBlocked,
108 MSVehicle** firstBlocked);
109
111 int& blocked, int dir,
112 const std::pair<MSVehicle*, double>& neighLead,
113 const std::pair<MSVehicle*, double>& neighFollow);
114
115 inline bool amBlockingLeader() {
116 return (myOwnState & LCA_AMBLOCKINGLEADER) != 0;
117 }
118 inline bool amBlockingFollower() {
119 return (myOwnState & LCA_AMBLOCKINGFOLLOWER) != 0;
120 }
121 inline bool amBlockingFollowerNB() {
123 }
127 inline bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist) {
128 return dist / (abs(laneOffset)) < lookForwardDist;
129 }
130 inline bool currentDistAllows(double dist, int laneOffset, double lookForwardDist) {
131 return dist / abs(laneOffset) > lookForwardDist;
132 }
133
134 typedef std::pair<double, int> Info;
135
136
137
138protected:
140
143
144 std::vector<double> myVSafes;
146
147};
@ LCA_AMBLOCKINGLEADER
@ LCA_AMBLOCKINGFOLLOWER_DONTBRAKE
@ LCA_AMBLOCKINGFOLLOWER
A class responsible for exchanging messages between cars involved in lane-change interaction.
Interface for lane-change models.
int myOwnState
The current state of the vehicle.
The car-following model abstraction.
Definition MSCFModel.h:55
A lane change model developed by D. Krajzewicz between 2004 and 2010.
double myLeftSpace
LaneChangeModel getModelID() const
Returns the model's id.
std::vector< double > myVSafes
std::pair< double, int > Info
bool amBlockingLeader()
virtual ~MSLCM_DK2008()
bool amBlockingFollowerPlusNB()
virtual void changed()
virtual int wantsChangeToRight(MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, double > &leader, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)
Called to examine whether the vehicle wants to change to right This method gets the information about...
bool amBlockingFollowerNB()
double myChangeProbability
bool amBlockingFollower()
int wantsChange(int laneOffset, MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, double > &leader, const std::pair< MSVehicle *, double > &follower, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)
Called to examine whether the vehicle wants to change using the given laneOffset. This method gets th...
void informBlocker(MSAbstractLaneChangeModel::MSLCMessager &msgPass, int &blocked, int dir, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow)
bool currentDistAllows(double dist, int laneOffset, double lookForwardDist)
double myLeadingBlockerLength
virtual void * inform(void *info, MSVehicle *sender)
virtual void prepareStep()
virtual int wantsChangeToLeft(MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, double > &leader, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)
Called to examine whether the vehicle wants to change to left This method gets the information about ...
virtual double patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)
Called to adapt the speed in order to allow a lane change.
bool currentDistDisallows(double dist, int laneOffset, double lookForwardDist)
Representation of a lane in the micro simulation.
Definition MSLane.h:84
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77