mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-16 13:24:09 +01:00
AI: making for a passenger stop, leave room only for the brake's own fill time
Since #187 the braking curve towards a stop or a lower speed leaves room for the time the brake takes to respond, as long as the train brake handle is still in the running position. The horizon it takes has the AI's old look-ahead, (1 - a0) * 30/3.6 s, about 7-8 s, as its floor; at 60 km/h that is over 100 m, up to half of the braking distance. Stops at signals were tuned with it. A vehicle that brakes with its independent brake (an SN61, a light engine) leaves the train brake handle where it is, so it kept that room the whole way in: it braked early and gently, came down to 10 km/h some 50 m out and crawled the rest, applying power and the brake in turn. Making for a passenger stop (the point the train is to stop at, found by the scan of the route, is a W4), the room now covers only the time the brake takes to fill (half its application time), without the look-ahead floor. Stops at signals and anything else keep the room as it was. When a vehicle ahead is closer than the stop the scan found, the train makes for that vehicle, so the room is the full one again.
This commit is contained in:
@@ -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<double>(
|
||||
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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user