mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-24 15:29:14 +01:00
* fix(ai): a standing train starts only with its brakes charged, held on the locomotive brake while it charges Prepared from cold, the AI filled the brake pipe at once with the locomotive brake off: the distributors released while the auxiliary reservoirs were still empty, so the train had no air to brake with, and on a gradient it rolled as it released. The train counted as ready as soon as it was released. A train placed cold with its pipe below the lock of the FV4a driver's brake valve (2.75 bar) wasn't unlocked until the order to go, and went on what its reservoirs got meanwhile (TMS77185 in linia_107_objazdy: 40 minutes at 1.2-1.9 bar, the last wagon at 4.3 bar at the start). - Standing, PrepareEngine() applies the locomotive brake first, then fills the pipe. Where the locomotive brake alone doesn't hold the train (1.1 x the grade force), the train brake goes to the first service position instead, so the reservoirs charge with the train held. Multiple units with the electro-pneumatic brake are released as before. - Standing to charge, the AI unlocks the pipe as it does to go (the releaser, or the unlock button). A handle which has to be moved to unlock is left where the light application holds the train. - A train is ready only once the pipe and the auxiliary reservoir of every vehicle with a working brake are within 0.5 bar of the working pressure (4.5 of 5.0: the last wagon of a long train stays at about 4.6-4.7 from what leaks along the pipe), with the pipe fed at the head of the train. Brakes cut out don't count. - The locomotive brake comes off only once the train is charged, also against DecBrakeEIM(), which for a vehicle without the integrated handle releases it too; an uphill start begins only then. - A human driver gets the same wait as a hint: "Wait for the train brakes to charge" (driver_hint::waitbrakecharge), and the hint to release the brakes waits with it once the train brake is off (brake_charge::release_waits()). The train brake may still come off: released, it fills the pipe. - A charge that rises by less than 0.02 bar in 60 s lets the train go all the same, with a line in the log. The time counts only while there is air to charge with (the engine prepared, the main reservoir above what the pipe charges to, the pipe fed at the head): a train with its compressor not running yet or a locked pipe is waited out. Once let go, a train stays so until it is to stand again: otherwise the pipe refilling behind the release held it at a crawl (et22-1075 with 36 wagons, baltyk_interregio). - The check applies to the pneumatic brake only, to the first start of a train that hasn't run (above 1 km/h) since it was placed, and to a start with the pipe below 2.5 bar (near empty, after an emergency application). A start after an ordinary stop, a service stop (3.0-3.5 bar), a change of direction or a shunting move isn't held: waiting there only delayed the train, and the scenery set the routes of the others later. - The release of the train brake in PrepareEngine() had a stray semicolon after its condition; the condition applies again in motion. - Unit tests for the charge check (brake_charge::charged(), locomotive_brake_holds(), release_waits()). Run on all 174 shipped sceneries (20 minutes each, against master): no train stuck that moved on master, 466 timetable departures compared, 459 within 15 s, mean -1.2 s. Waits for the charge: median 4 s, 90% 39 s, longest 106 s (a heavy freight train charged from 2.2 bar). * test(ai): the brake charge test counts its looks in whole numbers, not in a floating-point time SonarCloud took the loop of the test of a train with nothing to charge with yet for a bug (cpp:S2193, a counter of type double). The same 120 looks, 5 s apart. * fix(ai): the light application that holds a charging train stays on, and an empty pipe is no charge Runs of a cold train on a gradient (P33000 at Lupkow in linia_107_objazdy, 13-16 per mille, with an SM42 and 32 wagons, 1556 t) showed three faults of the charged-brakes start: - The locomotive brake was taken to hold the train with the force of its brake blocks alone, 1031 kN for an ST43: several times what its wheels pass on to the rails. It is limited to a quarter of the locomotive's weight (brake_charge::adhesion), so a light locomotive with a heavy train gets the light application of the train brake. - That application was taken off again as soon as the order to go came, by the rule that puts the handle back to running with the main reservoir below 5 bar, and by DecBrake(). The train then stood on the locomotive brake that doesn't hold it, and moved as its wagons let go (to 0.3 km/h). It stays on until the train is charged (brake_charge::holds_application()). - With the train brake applied the train counted as charged to what the head of the pipe has, which is nothing with the pipe empty: charged at 0.02 bar the moment the brake was applied. The pipe at the head counts no lower than a full service application leaves (brake_charge::reference()). The SM42 with the 32 wagons now stands still while it charges and starts without rolling back, 2 min 30 s after it was prepared (4 min 40 s before, with a start that rolled back at 0.3 km/h). An ST43 with 33 wagons and a 754 with 8 coaches there are as before, their locomotive brake holds them. In eight of the sceneries run before (l053_poranek, calkowo_v2_cementa, calkowo_v2_ctl-wegiela, calkowo_v2_osoba_jar_poranek, calkowo_retro_zima, linia61_towarowy2, l053-sluzba-brutto-posp, baltyk_interregio) the 60 timetable departures compared are the same, within 15 s, mean 0.0 s. Unit tests for the two new decisions. * fix(ai): the locomotive brake counted of the occupied vehicle alone locomotive_brake_force() added the brake of every powered vehicle of the train. The locomotive brake handle acts on the occupied vehicle only (LocalBrakePosA is set on mvOccupied and passed to no other vehicle), so a second locomotive, in multiple control or hauled dead, made the brake count as holding a train it doesn't hold, and the train brake was released on a gradient with the leading locomotive alone holding. The estimate of one vehicle is brake_charge::locomotive_brake_force(), with a test. brakecharge.h named TController::control_brake_charge(), which doesn't exist: the logic is in determine_consist_state().
77 lines
4.9 KiB
C++
77 lines
4.9 KiB
C++
/*
|
|
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/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// a standing train starts only with its brakes charged, as a driver checks before setting off: the brake pipe and the
|
|
// auxiliary reservoir of every vehicle with a working brake close to the working pressure. released alone isn't enough:
|
|
// a train prepared from cold is released at once, its pipe still filling, and has no air to brake with
|
|
// (TController::PrepareEngine(), TController::determine_consist_state())
|
|
namespace brake_charge {
|
|
|
|
// [bar] below the working pressure the pipe and the reservoir count as charged: 4.5 of 5.0. the last wagon of a long
|
|
// train stays at about 4.6-4.7 for good, from what leaks along the pipe
|
|
auto const margin{0.5};
|
|
// below this the pipe counts as near empty (after an emergency application): the next start waits for the charge
|
|
// whatever came before. well below what a service application leaves: the AI stops at a station with the handle past
|
|
// the full service position, the pipe at 3.0-3.5 bar, and wagons coupled from cold come with about 3 bar. waiting there
|
|
// only delays the train, and the scenery sets the routes of the others later (calkowo_v2_osoba_jar_poranek, l053_poranek)
|
|
auto const empty_level{2.5}; // [bar]
|
|
// a charge that rises by less than this in stall_time has stopped (a leak, a hose not connected, a pipe cock shut): the
|
|
// train goes all the same, rather than stand for good
|
|
auto const stall_gain{0.02}; // [bar]
|
|
auto const stall_time{60.0}; // [s]
|
|
// standing, the locomotive brake alone has to give this multiple of the grade force to hold the train while it charges
|
|
auto const holding_force{1.1};
|
|
// the share of a locomotive's weight its brake can hold the train with at most: what the wheels pass on to the rails,
|
|
// taken low (a wet rail). the force of the brake blocks alone is several times that
|
|
auto const adhesion{0.25};
|
|
// [bar] how far below the working pressure the pipe is at a full service application: with the train brake applied the
|
|
// train charges to what the head of the pipe has, but a pipe below this (emptied, or just being filled) is no charge
|
|
auto const service_drop{1.5};
|
|
|
|
struct state {
|
|
double best{-1.0}; // the highest charge seen while it still rose [bar], -1 before the first look
|
|
double best_time{0.0}; // when it was seen [s]
|
|
bool stalled{false}; // the charge stopped rising short of charged
|
|
// the train was let go: it stays so until the driver clears this, when the train is to stand again. otherwise a
|
|
// charge rising again as the train starts (the pipe refilling behind the release) would stop it at a crawl
|
|
bool going{false};
|
|
};
|
|
|
|
// Level: the lowest pressure of the brake pipes and auxiliary reservoirs among the vehicles with a working brake [bar];
|
|
// Reference: the pressure they charge to [bar]; Time: now [s]; Supplied: there is air to charge with (the engine
|
|
// prepared, the main reservoir above the reference): without it the charge can't rise, and that isn't a stall.
|
|
// true once the train may start, and from then on
|
|
bool charged(state &State, double Level, double Reference, double Time, bool Supplied = true);
|
|
|
|
// what the locomotive brake of a vehicle holds with at full application [N]: the force of its brake blocks (Blockforce),
|
|
// but no more than its wheels pass on to the rails, the adhesion share of its Weight [N]
|
|
double locomotive_brake_force(double Blockforce, double Weight);
|
|
|
|
// whether the locomotive brake, Locomotivebrakeforce at full application [N], holds the standing train against its
|
|
// Gradeforce [N] on its own; when it doesn't, the train brake is applied lightly while the train charges
|
|
bool locomotive_brake_holds(double Locomotivebrakeforce, double Gradeforce);
|
|
|
|
// the pressure the train is to be charged to [bar]: the working pressure with the train brake released; with it applied
|
|
// what the head of the pipe has (Headpipe), as the reservoirs get no more, though no less than a full service
|
|
// application leaves, or a pipe emptied by an emergency application would count as charged at once
|
|
double reference(double Headpipe, double Working, bool Trainbrakeapplied);
|
|
|
|
// whether a light application of the train brake (Position, up to the first service position) stays on: the train
|
|
// stands on it while it charges (Hold), the locomotive brake not holding it alone
|
|
bool holds_application(bool Hold, bool Charged, bool Standing, double Position);
|
|
|
|
// whether a release of the brakes waits for the charge: standing, a train not charged yet keeps its locomotive brake
|
|
// on. the train brake (Trainbrakeapplied) may come off all the same: released, it fills the pipe, which is what charges
|
|
// the train. the hint a human driver gets to release the brakes waits with it (driver_hint::waitbrakecharge instead)
|
|
bool release_waits(bool Charged, bool Standing, bool Trainbrakeapplied);
|
|
|
|
} // namespace brake_charge
|