mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 19:05:00 +01:00
fix: automatic coupler crashes, horns, compressor start delay, radio and cab lever sounds
- automatic couplers don't catch above the safe collision speed (#86): with crash damage on they couple at a closing speed of 15 km/h at most, a faster hit locks the coupling until the vehicles part and the collision runs its course. On the way: CollisionVelocity() read a head-on 10 + 10 km/h as 14.1 km/h (quaternions turn by half the angle), it's now taken from the touching ends; CollisionDetect() took the other vehicle's speed the wrong way round for vehicles facing each other. Head-on hits now derail sooner, at the intended limit, - a single horn lever can't sound both tones at once (eu07/maszyna#392), - a skid ends once the vehicle stops on locked wheels (eu07/maszyna#479), - electronic destination signs are blanked at the end of the timetable (eu07/maszyna#446), - horns need the air or the voltage to sound (eu07/maszyna#290, #76): HornType=[Pneumatic]|Electric and Horn3Type in Cntrl.; a pneumatic horn needs 0.2 MPa in the main reservoir (or the main pipe without one), an electric one the low voltage; the lever stays where it was put, - compressor start delay (#67): CompressorStartDelay [s] in Brake., counted from the compressor getting its power, after the engine starts say; none by default, - the channel and volume buttons of a radio without power do nothing (eu07/maszyna#429); the power check of the radio is TMoverParameters::RadioPowered(), - a lever moved smoothly sounds the positions it passes (#83). Sonar findings in the functions changed: nesting, nested conditionals, commented-out code, std::format, references to const. Unit tests: test::pair for two vehicles running into each other, test_couplers, test_horn, test_wheelslip, test_compressor, test_radio, test_gauge_positions.
This commit is contained in:
@@ -676,6 +676,13 @@ struct TTractionParam
|
||||
};
|
||||
/*powyzsze parametry zwiazane sa z torem po ktorym aktualnie pojazd jedzie*/
|
||||
|
||||
// what a horn needs to sound: air from the main reservoir, or the low voltage
|
||||
enum class horn_supply
|
||||
{
|
||||
pneumatic,
|
||||
electric
|
||||
};
|
||||
|
||||
/// <summary>High-level brake-system family.</summary>
|
||||
enum class TBrakeSystem
|
||||
{
|
||||
@@ -1710,6 +1717,10 @@ class TMoverParameters
|
||||
float DistanceCounterDoublePressPeriod = {1.f}; // czas w jakim nalezy podwojnie wcisnac przycisk, aby rozpoczac pomiar odleglosci
|
||||
TSecuritySystem SecuritySystem;
|
||||
int EmergencyBrakeWarningSignal{0}; // combined with basic WarningSignal when manual emergency brake is active
|
||||
horn_supply HornSupply{horn_supply::pneumatic}; // of the low and high tone horns (WarningSignal 1 and 2)
|
||||
horn_supply Horn3Supply{horn_supply::pneumatic}; // of the third horn (WarningSignal 4)
|
||||
// main reservoir pressure [MPa] below which a pneumatic horn stays silent
|
||||
static constexpr double HornMinPressure{0.2};
|
||||
TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/
|
||||
int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/
|
||||
bool UniCtrlIntegratedBrakePNCtrl = false; /*zintegrowany nastawnik JH obsluguje hamulec PN*/
|
||||
@@ -2001,6 +2012,8 @@ class TMoverParameters
|
||||
bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/
|
||||
bool CompressorAllowLocal{true}; // local device state override (most units don't have this fitted so it's set to true not to intefere)
|
||||
bool CompressorGovernorLock{false}; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure
|
||||
double CompressorStartDelay{0.0}; // time [s] the compressor waits after getting its power before it can start, after the engine starts say
|
||||
double CompressorPowerTime{0.0}; // time [s] since the compressor got its power
|
||||
bool CompressorTankValve{false}; // indicates excessive pressure is vented from compressor tank directly and instantly
|
||||
start_t CompressorStart{start_t::manual}; // whether the compressor is started manually, or another way
|
||||
start_t PantographCompressorStart{start_t::manual};
|
||||
@@ -2428,6 +2441,21 @@ class TMoverParameters
|
||||
double BrakeForce(const TTrackParam &Track);
|
||||
double CouplerForce(int const End, double dt);
|
||||
void CollisionDetect(int const End, double const dt);
|
||||
// closing speed of a collision [km/h] above which the vehicles involved may derail, adjusted for their mass ratio
|
||||
static constexpr double SafeCollisionVelocity{15.0};
|
||||
// closing speed [km/h] of the End of this vehicle and the OtherEnd of the other vehicle it touches, along the coupler
|
||||
// axis: the sum of the speeds in a head-on collision, the difference in a rear-end one, negative when they part
|
||||
double CollisionVelocity(int const End, TMoverParameters const &Other, int const OtherEnd) const;
|
||||
// whether the automatic couplers at the End of this vehicle and the OtherEnd of the other one can catch each other on
|
||||
// contact, rather than the vehicles colliding (with crash damage enabled, only at a closing speed which doesn't derail them)
|
||||
bool AutomaticCouplingSafe(int const End, TMoverParameters const &Other, int const OtherEnd) const;
|
||||
// the horns of the Signal (WarningSignal bits) which have the air or the voltage they need to sound
|
||||
int SoundingHorns(int const Signal) const;
|
||||
// whether the radio is switched on and has the low voltage to work
|
||||
bool RadioPowered() const
|
||||
{
|
||||
return Radio && (Power24vIsAvailable || Power110vIsAvailable);
|
||||
}
|
||||
/*obrot kol uwzgledniajacy poslizg*/
|
||||
double ComputeRotatingWheel(double WForce, double dt, double n) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user