Skip to main content

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


I copied the calculation of brake gap from: line by line:


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.


Back to the top