Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Brake gap Euler calculation

- in the quoted formula, the terms 'egoBrakeGap' and 'leaderBrakeGap' denote the instant brake-gap (headway=0). The term 'egoSpeed * tau + egoBrakeGap' is what the function brakeGapEuler returns when given headway=tau
- the safety condition is actually an inequality: egoSpeed * tau + egoBrakeGap < secureGap + leaderBrakeGap.  Phrased differently: If the brakeGap of the leader is much larger than  the brakeGap of the follower, the secureGap does not turn negative
- the safety condition is only safe as long as the follower cannot brake stronger than the leader ( applies to Krauss as well) For this reason, the function MSCFModel::getSecureGap artificially increases to leader braking capability up to the value of the follower deceleration. (so don't be surprised when calling traci.vehicle.getSecureGap)

Am Di., 26. Apr. 2022 um 12:33 Uhr schrieb Hriday Sanghvi via sumo-user <sumo-user@xxxxxxxxxxx>:


def brakeGapEuler(speed, decel, headwayTime):
speedReduction = STEP_LENGTH * decel
steps = int(speed/speedReduction)
return STEP_LENGTH * (steps * speed - speedReduction * steps * (steps + 1) / 2) + speed * headwayTime

In the original definition, ACCEL2SPEED is defined in where the relevant lines to calculate TS in the same file: 

// the step length in ms
extern SUMOTime DELTA_T;
// the step length in seconds as double
#define TS (static_cast<double>(DELTA_T/1000.))

would mean that if my step length is the default value of 1 second, DELTA_T will hold the same value in milliseconds (ms), that is, 1000 ms? And hence, TS will hold a value of 1000/1000 = 1s. So the first line const double speedReduction = ACCEL2SPEED(decel); will be a speedReduction = decel * 1, that is, the value of maximum deceleration ability of a vehicle?

I was told that in general, egoSpeed * tau + egoBrakeGap = secureGap + leaderBrakeGap so I am trying to verify my calculation of brake gap using that (Since there is no other way to get brakeGap using TraCI?)

# egoSpeed * tau + egoBrakeGap = secureGap + leaderBrakeGap
egoBrakeGap = brakeGapEuler(speed=speed, decel=traci.vehicle.getDecel(vh), headwayTime=1)
leaderBrakeGap = brakeGapEuler(speed=traci.vehicle.getSpeed(rel_veh), decel=traci.vehicle.getDecel(rel_veh), headwayTime=1)

print('{} * {} + {} = {} + {}'.format(speed, 1, egoBrakeGap, secureGap, leaderBrakeGap))

that prints:

3.2317 * 1 + 3.2317 = 0.15779999999999994 + 10.6478

which is False. I am not sure where I am going wrong here in this case. From my understanding headwayTime = tau = 1 second? Please advise.

Thank you.

sumo-user mailing list
To unsubscribe from this list, visit

Back to the top