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:
36
vehicle/uphillstart.cpp
Normal file
36
vehicle/uphillstart.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
This Source Code Form is subject to the
|
||||
terms of the Mozilla Public License, v.
|
||||
2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can
|
||||
obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "vehicle/uphillstart.h"
|
||||
|
||||
namespace uphill_start {
|
||||
|
||||
top_up_action brake_top_up(
|
||||
top_up &State, double const Brakeforce, double const Holdingforce, double const Brakeposition, double const Heldtime,
|
||||
double const Applicationtime) {
|
||||
|
||||
if (State.done || (Brakeforce >= holding_force * Holdingforce) || (Brakeposition >= top_up_position)) {
|
||||
return top_up_action::none;
|
||||
}
|
||||
// each step is given the full application time of the train brake, for the cylinders along the train to fill
|
||||
if (Heldtime < Applicationtime) {
|
||||
return top_up_action::wait;
|
||||
}
|
||||
if ((State.last_force >= 0.0) && (Brakeforce - State.last_force < top_up_gain * Holdingforce)) {
|
||||
// the last step added next to nothing: the brake of this train can't hold it (brakes cut out, a load setting
|
||||
// too low), and the start goes on without
|
||||
State.done = true;
|
||||
return top_up_action::none;
|
||||
}
|
||||
State.last_force = Brakeforce;
|
||||
return top_up_action::step;
|
||||
}
|
||||
|
||||
} // namespace uphill_start
|
||||
Reference in New Issue
Block a user