46 #ifdef DEBUG_WANTS_CHANGE
49 std::cout <<
SIMTIME <<
" veh=" << veh.
getID() <<
" getRoundaboutDistBonus bonusParam=" << bonusParam
60 int roundaboutJunctionsAhead = 0;
61 bool enteredRoundabout =
false;
67 if (lane ==
nullptr) {
72 #ifdef DEBUG_WANTS_CHANGE
74 std::cout <<
" noBonus: inner does not continue (lane=" << lane->
getID() <<
")\n";
81 #ifdef DEBUG_WANTS_CHANGE
83 std::cout <<
" noBonus: seen=" << seen <<
" (lane=" << lane->
getID() <<
")\n";
90 enteredRoundabout =
true;
92 roundaboutJunctionsAhead++;
94 }
else if (enteredRoundabout) {
101 if (roundaboutJunctionsAhead < 2) {
107 double occupancyOuter = 0;
108 double occupancyInner = 0;
109 double distanceInRoundabout = 0;
110 MSLane* prevNormal =
nullptr;
111 MSLane* prevInner =
nullptr;
112 enteredRoundabout =
false;
115 if (lane ==
nullptr) {
119 enteredRoundabout =
true;
120 }
else if (enteredRoundabout) {
125 if (prevNormal !=
nullptr) {
127 if (link->getLane() == lane) {
128 via = link->getViaLane();
132 if (enteredRoundabout) {
133 distanceInRoundabout += lane->
getLength();
134 if (via !=
nullptr) {
135 distanceInRoundabout += via->
getLength();
143 #ifdef DEBUG_WANTS_CHANGE
145 std::cout <<
" lane=" << lane->
getID() <<
" occ=" << lane->
getBruttoVehLenSum() <<
" discount=" << upstreamDiscount <<
" outer=" << occupancyOuter <<
"\n";
148 if (via !=
nullptr) {
150 #ifdef DEBUG_WANTS_CHANGE
152 std::cout <<
" via=" << via->
getID() <<
" occ=" << via->
getBruttoVehLenSum() <<
" outer=" << occupancyOuter <<
"\n";
159 #ifdef DEBUG_WANTS_CHANGE
161 std::cout <<
" inner=" << innerLane->
getID() <<
" occ=" << innerLane->
getBruttoVehLenSum() <<
" discount=" << upstreamDiscount <<
" inner=" << occupancyInner <<
"\n";
164 if (prevInner !=
nullptr) {
166 if (link->getLane() == innerLane && link->getViaLane() !=
nullptr) {
167 occupancyInner += link->getViaLane()->getBruttoVehLenSum();
168 #ifdef DEBUG_WANTS_CHANGE
170 std::cout <<
" innerVia=" << link->getViaLane()->getID() <<
" occ=" << link->getViaLane()->getBruttoVehLenSum() <<
" inner=" << occupancyInner <<
"\n";
176 prevInner = innerLane;
180 #ifdef DEBUG_WANTS_CHANGE
182 std::cout <<
" distanceInRoundabout=" << distanceInRoundabout
183 <<
" roundaboutJunctionsAhead=" << roundaboutJunctionsAhead
184 <<
" occupancyInner=" << occupancyInner
185 <<
" occupancyOuter=" << occupancyOuter
190 const double maxOccupancy =
MAX2(occupancyInner, occupancyOuter);
191 if (maxOccupancy == 0) {
196 const double bonus = roundaboutJunctionsAhead * 7.5;
197 const double relativeJam = (occupancyOuter - occupancyInner + bonus) / (maxOccupancy + bonus);
199 const double jamFactor =
MAX2(0.0, relativeJam);
200 const double result = distanceInRoundabout * jamFactor * bonusParam * 9;
201 #ifdef DEBUG_WANTS_CHANGE
203 std::cout <<
" relativeJam=" << relativeJam
204 <<
" jamFactor=" << jamFactor
205 <<
" 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.