mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-11 14:39:00 +01:00
AI braking: don't let the running brake test override a stop ahead
adjust_desired_speed_for_braking_test runs after the target speed was worked out and overwrites AccDesired. In its third phase it holds the deceleration near fAccThreshold until the speed has dropped by 8 km/h. On a 20 per mille descent that application barely holds the speed, so the phase can last minutes, and a stop signal coming up meanwhile is ignored. In one real-time run an E186 with 19 container wagons started the test 1290 m before a stop signal, lost 7 km/h by the signal and overran it by 274 m after the emergency application. While the test runs the AI now uses whichever of the two asks for the harder braking: the test may brake harder than the route needs, never softer. Measured in real time, four runs of 32 consists each on a 20 per mille descent, on the flat and on the descent with half the rail adhesion: the test no longer runs within 600 m of a stop signal (before: down to 414 m on this branch, and 14 m with the overrun above in a build with other brake changes), no overruns, stops 8-15 m short of the signal 86, 117 and 83 of 128 (before 90, 117 and 78).
This commit is contained in:
@@ -7927,6 +7927,10 @@ TController::adjust_desired_speed_for_braking_test() {
|
|||||||
if( false == AIControllFlag ) { return; } // TBD: add notification about braking test and enable it for human driver as well?
|
if( false == AIControllFlag ) { return; } // TBD: add notification about braking test and enable it for human driver as well?
|
||||||
|
|
||||||
auto const vel { DirectionalVel() };
|
auto const vel { DirectionalVel() };
|
||||||
|
// what the route ahead asks for; the test may brake harder than that, never softer
|
||||||
|
auto const routeaccdesired { AccDesired };
|
||||||
|
auto const routeaccdesiredgravity { fAccDesiredGravity };
|
||||||
|
auto const routeveldesired { VelDesired };
|
||||||
|
|
||||||
switch( DynamicBrakeTest ) {
|
switch( DynamicBrakeTest ) {
|
||||||
case 0: {
|
case 0: {
|
||||||
@@ -7993,6 +7997,14 @@ TController::adjust_desired_speed_for_braking_test() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// a stop or a restriction coming up while the test runs takes precedence
|
||||||
|
if( ( DynamicBrakeTest >= 1 )
|
||||||
|
&& ( DynamicBrakeTest <= 3 )
|
||||||
|
&& ( routeaccdesired < AccDesired ) ) {
|
||||||
|
AccDesired = routeaccdesired;
|
||||||
|
fAccDesiredGravity = routeaccdesiredgravity;
|
||||||
|
VelDesired = std::min( VelDesired, routeveldesired );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user