-
Notifications
You must be signed in to change notification settings - Fork 0
/
LaneChange.h
113 lines (106 loc) · 4.5 KB
/
LaneChange.h
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
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005-2009 Old Dominion University [ARBABI]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Hadi Arbabi <[email protected]>
*/
#ifndef CLASS_LANECHANGE_
#define CLASS_LANECHANGE_
#include "ns3/ptr.h"
#include "ns3/object.h"
#include "Vehicle.h"
namespace ns3 {
class Vehicle;
/**
* \brief IDM/MOBIL LaneChange Model.
*
* A Vehicle mobiliy and its acceleration in a particular lane of the roadway can be determined by IDM Car Following Model.
* Sometimes a Vehicle can have opportunity to switch its current lane to a desird adjacent lane.
* LaneChange Model can check the possibility of changing lane for a particular Vehicle based on several factors such as:
* Driver Politeness Factor, Minimum Safe Distance and Breaking Deceleration to the Vehicle(s).
* in front and back (the same lane) and in the desired (target) lane.
* see: http://www.vwi.tu-dresden.de/~treiber/MicroApplet/IDM.html
* see: http://www.vwi.tu-dresden.de/~treiber/MicroApplet/MOBIL.html
*/
class LaneChange : public ns3::Object {
private:
double m_politenessFactor; // politeness factor.
double m_dbThreshold; // changing threshold.
double m_gapMin; // minimum safe (net) distance.
double m_maxSafeBreakingDeceleration; // maximum safe braking deceleration.
double m_biasRight; // bias to right/left.
public:
/// Override TypeId
static TypeId GetTypeId(void);
/// Constructor.
LaneChange();
/**
* \returns the Politness Factor.
*/
double GetPolitenessFactor();
/**
* \param value a Politeness Factor.
*/
void SetPolitenessFactor(double value);
/**
* \returns the Db Threshold for changing lanes.
*/
double GetDbThreshold();
/**
* \param value the Db Threshold for changing lanes.
*/
void SetDbThreshold(double value);
/**
* \returns the Gap Minimum which is equivalent to Minimum Safe Distance.
*/
double GetGapMin();
/**
* \param value a Gap Minimum which is equivalent to Minimum Safe Distance.
*/
void SetGapMin(double value);
/**
* \returns the Maximum Safe Breaking Deceleration.
*/
double GetMaxSafeBreakingDeceleration();
/**
* \param value the Maximum Safe Breaking Distance.
*/
void SetMaxSafeBreakingDeceleration(double value);
/**
* \returns the Bias to Right.
*/
double GetBiasRight();
/**
* \param value the Bias to Right.
*/
void SetBiasRight(double value);
/**
* \param me the current considered Vehicle.
* \param fOld the front Vehicle in the current lane.
* \param distanceFOld the distance from the current vehicle to fOld
* \param fNew the front Vehicle in the target lane (left or right) based on value of toLeft.
* \param distanceFNew the distance from where the current vehicle would be in the target lane to fNew
* \param bNew the back Vehicle in the target lane (left or right) based on value of toLeft.
* \param distanceBNew the distance where where the current vehicle would be in the taget lane to bNew
* \param toLeft true if the adjacent target lane is on the left, false if the adjacent target lane is on the right.
* \returns true if changing lane for the Vehicle (me) to the target lane is possible, false otherwise.
*
* see: http://www.vwi.tu-dresden.de/~treiber/MicroApplet/MOBIL.html
*/
bool CheckLaneChange(Ptr<Vehicle> me, Ptr<Vehicle> fOld, double distanceFOld, Ptr<Vehicle> fNew, double distanceFNew, Ptr<Vehicle> bNew, double distanceBNew, bool toLeft);
};
};
#endif