48 #ifdef DEBUG_WANTS_CHANGE
51 std::cout <<
SIMTIME <<
" veh=" << veh.
getID() <<
" getRoundaboutDistBonus bonusParam=" << bonusParam
62 int roundaboutJunctionsAhead = 0;
63 bool enteredRoundabout =
false;
69 if (lane ==
nullptr) {
74 #ifdef DEBUG_WANTS_CHANGE
76 std::cout <<
" noBonus: inner does not continue (lane=" << lane->
getID() <<
")\n";
83 #ifdef DEBUG_WANTS_CHANGE
85 std::cout <<
" noBonus: seen=" << seen <<
" (lane=" << lane->
getID() <<
")\n";
92 enteredRoundabout =
true;
94 roundaboutJunctionsAhead++;
96 }
else if (enteredRoundabout) {
103 if (roundaboutJunctionsAhead < 2) {
109 double occupancyOuter = 0;
110 double occupancyInner = 0;
111 double distanceInRoundabout = 0;
112 MSLane* prevNormal =
nullptr;
113 MSLane* prevInner =
nullptr;
114 enteredRoundabout =
false;
117 if (lane ==
nullptr) {
121 enteredRoundabout =
true;
122 }
else if (enteredRoundabout) {
127 if (prevNormal !=
nullptr) {
129 if (link->getLane() == lane) {
130 via = link->getViaLane();
134 if (enteredRoundabout) {
135 distanceInRoundabout += lane->
getLength();
136 if (via !=
nullptr) {
137 distanceInRoundabout += via->
getLength();
145 #ifdef DEBUG_WANTS_CHANGE
147 std::cout <<
" lane=" << lane->
getID() <<
" occ=" << lane->
getBruttoVehLenSum() <<
" discount=" << upstreamDiscount <<
" outer=" << occupancyOuter <<
"\n";
150 if (via !=
nullptr) {
152 #ifdef DEBUG_WANTS_CHANGE
154 std::cout <<
" via=" << via->
getID() <<
" occ=" << via->
getBruttoVehLenSum() <<
" outer=" << occupancyOuter <<
"\n";
161 #ifdef DEBUG_WANTS_CHANGE
163 std::cout <<
" inner=" << innerLane->
getID() <<
" occ=" << innerLane->
getBruttoVehLenSum() <<
" discount=" << upstreamDiscount <<
" inner=" << occupancyInner <<
"\n";
166 if (prevInner !=
nullptr) {
168 if (link->getLane() == innerLane && link->getViaLane() !=
nullptr) {
169 occupancyInner += link->getViaLane()->getBruttoVehLenSum();
170 #ifdef DEBUG_WANTS_CHANGE
172 std::cout <<
" innerVia=" << link->getViaLane()->getID() <<
" occ=" << link->getViaLane()->getBruttoVehLenSum() <<
" inner=" << occupancyInner <<
"\n";
178 prevInner = innerLane;
182 #ifdef DEBUG_WANTS_CHANGE
184 std::cout <<
" distanceInRoundabout=" << distanceInRoundabout
185 <<
" roundaboutJunctionsAhead=" << roundaboutJunctionsAhead
186 <<
" occupancyInner=" << occupancyInner
187 <<
" occupancyOuter=" << occupancyOuter
192 const double maxOccupancy =
MAX2(occupancyInner, occupancyOuter);
193 if (maxOccupancy == 0) {
198 const double bonus = roundaboutJunctionsAhead * 7.5;
199 const double relativeJam = (occupancyOuter - occupancyInner + bonus) / (maxOccupancy + bonus);
201 const double jamFactor =
MAX2(0.0, relativeJam);
202 const double result = distanceInRoundabout * jamFactor * bonusParam * 9;
203 #ifdef DEBUG_WANTS_CHANGE
205 std::cout <<
" relativeJam=" << relativeJam
206 <<
" jamFactor=" << jamFactor
207 <<
" distanceBonus=" << result
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
virtual bool debugVehicle() const
whether the current vehicles shall be debugged
bool isRoundabout() const
const MSJunction * getToJunction() const
The base class for an intersection.
const ConstMSEdgeVector & getIncoming() const
const ConstMSEdgeVector & getOutgoing() const
static double getRoundaboutDistBonus(const MSVehicle &veh, double bonusParam, const MSVehicle::LaneQ &curr, const MSVehicle::LaneQ &neigh, const MSVehicle::LaneQ &best)
Computes the artificial bonus distance for roundabout lanes this additional distance reduces the sens...
Representation of a lane in the micro simulation.
const std::vector< MSLink * > & getLinkCont() const
returns the container with all links !!!
double getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
double getLength() const
Returns the lane's length.
int getIndex() const
Returns the lane's index.
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
MSAbstractLaneChangeModel & getLaneChangeModel()
double getPositionOnLane() const
Get the vehicle's position along the lane.
const MSLane * getLane() const
Returns the lane the vehicle is on.
const std::string & getID() const
Returns the id.
A structure representing the best lanes for continuing the current route starting at 'lane'.
std::vector< MSLane * > bestContinuations
MSLane * lane
The described lane.