18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-24 13:09:16 +01:00

fix(ai): an uphill start keeps the power on until the train brake is off (#396)

* fix(ai): an uphill start keeps the power on until the train brake is off

The uphill start of #265 ended as soon as the power held the train (or the head of the
train moved back 0.5 km/h). From then on the brake still on in the wagons made Ready false,
the power went off, the train rolled back, was braked again and the start began anew; only
the cylinders falling below 0.8 bar let the train get away.

- Once the power holds the train, the start goes on while the train brake is released:
  Ready holds, the power stays on, bounded to 1.5 x the grade force. It ends when the
  consist is released (the same test as Ready, without the hold) or after 60 s.
- A start is given up for rolling back on the mass-weighted speed of the consist, not on
  the speed of the locomotive, which runs back into the slack of the train held by its brake.
- A train slipping back uphill is not released by the rule for a train to go on.

* fix(ai): an uphill start begins only with the whole train at a stand

* fix(ai): an uphill start applies the train brake further while it doesn't hold the train without the locomotive brake

* fix(ai): the speed and the tractive force of an uphill start in the direction of travel also from cab 2

* fix(ai): an uphill start tops up the train brake a full application time a step, at most to full service, and keeps the power between 1.1 and 1.5 times the grade force while the brake releases

* fix(ai): an uphill start no longer takes a notch back in the release phase: the notch below doesn't hold the train

* refactor(ai): the train brake top-up of an uphill start in uphill_start::brake_top_up(), with unit tests
This commit is contained in:
pawelw
2026-11-22 12:27:18 +01:00
committed by GitHub
parent 65d3c020eb
commit 7c12b83ba4
6 changed files with 312 additions and 31 deletions

View File

@@ -19,6 +19,7 @@ http://mozilla.org/MPL/2.0/.
#include "world/mtable.h"
#include "utilities/translation.h"
#include "application/driverhints.h"
#include "vehicle/uphillstart.h"
#include "vehicle/blackbox.h"
auto const EU07_AI_ACCELERATION = 0.05;
@@ -27,6 +28,7 @@ auto const EU07_AI_BRAKINGTESTACCELERATION = -0.06;
auto const EU07_AI_NOMOVEMENT = 0.05; // standstill velocity threshold
auto const EU07_AI_MOVEMENT = 1.0; // deliberate movement velocity threshold
auto const EU07_AI_UPHILLGRAVITY = -0.025; // [m/s2] about 2.5 per mille up: the gradient that rolls a standing train back
auto const EU07_AI_UPHILLRELEASETIME = 60.0; // [s] the longest an uphill start keeps the power on while the train brake releases
auto const EU07_AI_SPEEDLIMITEXTENDSBEYONDSCANRANGE = 10000.0;
enum TOrders
@@ -337,6 +339,8 @@ private:
bool uphill_stop_hold() const;
bool uphill_brake_committed( double const Velocity ) const;
void control_uphill_start();
void end_uphill_start();
bool uphill_brake_top_up();
std::pair<double, double> train_proximity_margins( bool const Passengerstop ) const;
void update_timers( double const dt );
@@ -441,6 +445,14 @@ private:
int iShortfallGrowth = 0; // how many checks in a row the shortfall has grown
bool bUphillStart = false; // starting uphill: the train brake holds the train until the power does
double fUphillStartTime = 0.0; // when the uphill start began
bool bUphillRelease = false; // starting uphill, the power holds the train and the train brake is being released
bool bUphillBrakeTopUp = false; // starting uphill, the train brake is applied further before the locomotive brake comes off
uphill_start::top_up UphillTopUp; // starting uphill, what has been done to apply the train brake further
double fUphillReleaseTime = 0.0; // when the release began
double fUphillTractiveForce = 0.0; // the tractive force of the consist while starting uphill [N]
double fUphillHoldingForce = 0.0; // the grade force on the consist while starting uphill [N]
bool IsConsistReleased = true; // the brakes of the consist are off, the hold of an uphill start not counted
double fConsistVelocity = 0.0; // the mass-weighted speed of the consist, positive in the direction of travel [km/h]
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