17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-13 10:42:25 +01:00

AI braking: smaller steps, earlier, while approaching a stop or a lower speed

Changes to how the AI works the train brake on the way to a lower speed
or a stop, so that it uses few, early applications instead of a late
deep one:

- Approaching a lower speed, the deceleration may fall short of the
  demand by only half of a step (fBrake_a1) before the brake is applied
  harder. With a full step the demand crept up meanwhile and a long G
  train got its next step many seconds too late.
- The shortfall is checked every 3 s. If it keeps growing at a handle
  left alone for longer than the brake takes to respond, the AI adds a
  small step at once instead of waiting until the margin calls for a
  deep one. A shortfall that shrinks on its own (brake still filling,
  blocks gripping harder at lower speed) does not trigger it.
- Releasing, a position short of the first one counts as giving the
  minimum stage of the distributor, not less.
- Holding the speed on a descent, the predicted excess speed is taken
  off over the time the brake takes to respond, not at once, so a slow
  brake does not get a deep application that then takes as long to
  release.
This commit is contained in:
pwarszawski
2026-11-07 18:10:47 +01:00
parent 439e892abd
commit 8d1d9eec9b
2 changed files with 65 additions and 9 deletions

View File

@@ -311,6 +311,8 @@ private:
double DirectionalVel() const {
return mvOccupied->Vel * sign( iDirection * mvOccupied->V ); }
double brake_increase_margin() const;
void update_timers( double const dt );
void update_logs( double const dt );
void determine_consist_state();
@@ -401,6 +403,9 @@ 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
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
double fAccDesiredGravity = 0.0; // część AccDesired odjęta na spadku jako kompensacja pochylenia; AbsAccS zawiera ją już sam
double VelforDriver = -1.0; // prędkość, używana przy zmianie kierunku (ograniczenie przy nieznajmości szlaku?)
double VelSignal = 0.0; // ograniczenie prędkości z kompilacji znaków i sygnałów // normalnie na początku ma stać, no chyba że jedzie