diff --git a/vehicle/Driver.cpp b/vehicle/Driver.cpp index 21aed82a..bf0e1831 100644 --- a/vehicle/Driver.cpp +++ b/vehicle/Driver.cpp @@ -882,6 +882,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN auto speedlimitiscontinuous { true }; // stays true if potential active speed limit is unbroken to the last (relevant) point in scan table eSignNext = nullptr; IsAtPassengerStop = false; + bStopTargetIsPassengerStop = false; IsScheduledPassengerStopVisible = false; mvOccupied->SecuritySystem.set_cabsignal_lock(false); // te flagi są ustawiane tutaj, w razie potrzeby @@ -1001,6 +1002,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN fAcc = a; // zalecane przyspieszenie (nie musi być uwzględniane przez AI) fNext = v; // istotna jest prędkość na końcu tego odcinka fDist = d; // dlugość odcinka + bStopTargetIsPassengerStop = ( v == 0.0 ) && ( ( point.iFlags & spPassengerStopPoint ) != 0 ); } /* else if ((fAcc > 0) && (v >= 0) && (v > fNext)) { @@ -1015,6 +1017,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN fAcc = a; fNext = v; fDist = d; + bStopTargetIsPassengerStop = ( v == 0.0 ) && ( ( point.iFlags & spPassengerStopPoint ) != 0 ); } // potentially update our current speed limit if( v < VelLimitLastDist.first @@ -7377,6 +7380,10 @@ TController::adjust_desired_speed_for_obstacles() { if( k - vel < 5 ) { // porównanie modułów prędkości [km/h] // zatroszczyć się trzeba, jeśli tamten nie jedzie znacząco szybciej + if( Obstacle.distance < ActualProximityDist ) { + // the vehicle ahead, not the stop found by the scan, is what the train is now to stop short of + bStopTargetIsPassengerStop = false; + } ActualProximityDist = std::min( ActualProximityDist, Obstacle.distance ); @@ -7720,9 +7727,14 @@ TController::adjust_desired_speed_for_target_speed( double const Range ) { auto room { brakingroom }; if( ( AbsAccS <= 0.0 ) && ( BrakeCtrlPosition <= 0.0 ) ) { // only while the brake is still to be applied: once it acts, the room it needs to respond is behind + // making for a passenger stop only the time the brake takes to fill: the look-ahead the horizon + // keeps as its floor was set for the stops at a signal, and a vehicle that brakes with its + // independent brake, which leaves the train brake handle where it is, kept braking earlier + // and earlier the whole way in, to crawl the last tens of metres to the stop point + auto const brakea0 { bStopTargetIsPassengerStop ? 1.0 : fBrake_a0[ 0 ] }; room = std::max( 0.5 * brakingroom, - brakingroom - vel / 3.6 * brake_response_horizon( mvOccupied, BrakeSystem, 1.0, fBrake_a0[ 0 ] ) ); + brakingroom - vel / 3.6 * brake_response_horizon( mvOccupied, BrakeSystem, 1.0, brakea0 ) ); } deceleration = shaped_braking_demand( velocity, VelNext, room + 0.1 / 25.92, fAccGravity, diff --git a/vehicle/Driver.h b/vehicle/Driver.h index 68964711..dd540378 100644 --- a/vehicle/Driver.h +++ b/vehicle/Driver.h @@ -404,6 +404,7 @@ private: double VelDesired = 0.0; // predkość, z jaką ma jechać, wynikająca z analizy tableki; <=VelSignal double fAccDesiredAv = 0.0; // uśrednione przyspieszenie z kolejnych przebłysków świadomości, żeby ograniczyć migotanie double fBrakeHeldTime = 0.0; // czas od ostatniego przestawienia kranu hamulca zasadniczego + bool bStopTargetIsPassengerStop = false; // the point the train is to stop at, found by the last scan of the route, is a passenger stop double fShortfall = 0.0; // how far the train fell short of the braking demand at the last check [m/s2] double fShortfallTime = 0.0; // when that was checked int iShortfallGrowth = 0; // how many checks in a row the shortfall has grown