mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-24 06:09:12 +01:00
fix: review findings of PR 217
- the pressures of the mover are in bar (MinCP=7.0 in the vehicle definitions), so the 0.2 the pneumatic horns needed was 0.2 bar; it's 2 bar now, and the tests take their pressures in bar too, - the lamps of the ground relay and of the motor overload relays follow the pressure switch as the line contactors one does, TMoverParameters::MainCircuitLampsEnabled(), so the lamps of one cab go out together, - the joint oil and fuel pump switch leaves out a pump started automatically, which ignores the switching: with one, it couldn't turn the other off, and showed off with both running (OilFuelPumpsEnabled()), - the kind of the train heating switch comes from the occupied vehicle on entering the cab too, as in the switch commands; in a multiple unit these are different vehicles, - CouplerForce() put the force taken back by the other vehicle on its far coupler when the vehicles faced each other (Couplers[1 - End] rather than the coupler it's coupled with), - the velocity difference along the coupler axis computed once, CouplerVelocityDifference(), for CouplerForce() and CollisionVelocity(), - the attachcoupler flag added without the SetFlag() call with 0, the index of the mirror moves noted as by side. Tests: the coupler force of vehicles facing each other, the joint switch with an automatic pump, the lamps of the main circuit, the horn and compressor pressures in bar.
This commit is contained in:
@@ -1719,8 +1719,8 @@ class TMoverParameters
|
||||
int EmergencyBrakeWarningSignal{0}; // combined with basic WarningSignal when manual emergency brake is active
|
||||
horn_supply HornSupply{horn_supply::air}; // of the low and high tone horns (WarningSignal 1 and 2)
|
||||
horn_supply Horn3Supply{horn_supply::air}; // of the third horn (WarningSignal 4)
|
||||
// main reservoir pressure [MPa] below which a pneumatic horn stays silent
|
||||
static constexpr double HornMinPressure{0.2};
|
||||
// main reservoir pressure [bar, as MinCP and MaxCP] below which a pneumatic horn stays silent
|
||||
static constexpr double HornMinPressure{2.0};
|
||||
TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/
|
||||
int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/
|
||||
bool UniCtrlIntegratedBrakePNCtrl = false; /*zintegrowany nastawnik JH obsluguje hamulec PN*/
|
||||
@@ -2447,16 +2447,31 @@ class TMoverParameters
|
||||
// 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;
|
||||
// velocity [m/s] of this vehicle relative to the other vehicle it touches with its End and the OtherEnd of the
|
||||
// other one, along this vehicle's axis
|
||||
double CouplerVelocityDifference(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 lamp of the open line contactors is lit, telling the start can be made: the pressure switch, when
|
||||
// fitted, cuts the start off and so puts out the lamp, otherwise the lamp goes out once the brakes are applied
|
||||
// whether the signal lamps of the main circuit (line contactors, ground relay, motor overload relays) can light:
|
||||
// the pressure switch, when fitted, cuts the start off and puts them out, otherwise they go out once the brakes are applied
|
||||
bool MainCircuitLampsEnabled() const
|
||||
{
|
||||
return false == ControlPressureSwitch && (HasControlPressureSwitch || BrakePress < 1.0);
|
||||
}
|
||||
// whether the lamp of the open line contactors is lit, telling the start can be made
|
||||
bool LineContactorsLampLit() const
|
||||
{
|
||||
return false == StLinFlag && false == ControlPressureSwitch && (HasControlPressureSwitch || BrakePress < 1.0);
|
||||
return false == StLinFlag && MainCircuitLampsEnabled();
|
||||
}
|
||||
// whether the pumps a joint oil and fuel pump switch works, those not started automatically, are all switched on
|
||||
bool OilFuelPumpsEnabled() const
|
||||
{
|
||||
auto const fuelmanual{FuelPump.start_type != start_t::automatic};
|
||||
auto const oilmanual{OilPump.start_type != start_t::automatic};
|
||||
return (fuelmanual || oilmanual) && (false == fuelmanual || FuelPump.is_enabled) && (false == oilmanual || OilPump.is_enabled);
|
||||
}
|
||||
// whether the radio is switched on and has the low voltage to work
|
||||
bool RadioPowered() const
|
||||
|
||||
@@ -1183,13 +1183,18 @@ double TMoverParameters::EngineMaxRPM() const
|
||||
// *************************************************************************************************
|
||||
double TMoverParameters::CollisionVelocity(int const End, TMoverParameters const &Other, int const OtherEnd) const
|
||||
{
|
||||
// V runs along the vehicle's own axis, towards its front; the other vehicle's velocity is turned around when the
|
||||
// vehicles face each other (touch with the same ends), as in CouplerForce()
|
||||
auto const velocitydifference{V - Other.V * DirPatch(End, OtherEnd)};
|
||||
auto const velocitydifference{CouplerVelocityDifference(End, Other, OtherEnd)};
|
||||
// the front end closes in on the other vehicle when this one moves forward faster, the rear end when it's slower
|
||||
return (End == end::front ? velocitydifference : -velocitydifference) * 3.6; // m/s -> km/h
|
||||
}
|
||||
|
||||
double TMoverParameters::CouplerVelocityDifference(int const End, TMoverParameters const &Other, int const OtherEnd) const
|
||||
{
|
||||
// V runs along the vehicle's own axis, towards its front; the other vehicle's velocity is turned around when the
|
||||
// vehicles face each other (touch with the same ends)
|
||||
return V - Other.V * DirPatch(End, OtherEnd);
|
||||
}
|
||||
|
||||
bool TMoverParameters::AutomaticCouplingSafe(int const End, TMoverParameters const &Other, int const OtherEnd) const
|
||||
{
|
||||
return false == Global.crash_damage || CollisionVelocity(End, Other, OtherEnd) <= SafeCollisionVelocity;
|
||||
@@ -5331,7 +5336,7 @@ double TMoverParameters::CouplerForce(int const End, double dt)
|
||||
|
||||
auto const newdistance{initialdistance + 10.0 * distancedelta};
|
||||
|
||||
auto const dV{V - othervehicle->V * DirPatch(End, otherend)};
|
||||
auto const dV{CouplerVelocityDifference(End, *othervehicle, otherend)};
|
||||
auto const absdV{std::abs(dV)};
|
||||
|
||||
// potentially generate sounds on clash or stretch
|
||||
@@ -5448,7 +5453,7 @@ double TMoverParameters::CouplerForce(int const End, double dt)
|
||||
auto const safe{AutomaticCouplingSafe(End, *othervehicle, otherend)};
|
||||
auto const caught{safe && Attach(End, otherend, othervehicle, couplingtype)};
|
||||
// HACK: we're reusing sound enum to mark whether vehicle was connected to another
|
||||
SetFlag(AIFlag, caught ? sound::attachcoupler : 0);
|
||||
AIFlag |= (caught ? sound::attachcoupler : 0);
|
||||
// coupled, or locked until the vehicles part, so they don't couple as soon as the collision slows them down
|
||||
thiscoupler.AutomaticCouplingAllowed = safe && false == caught;
|
||||
othercoupler.AutomaticCouplingAllowed = safe && false == caught;
|
||||
@@ -5458,8 +5463,8 @@ double TMoverParameters::CouplerForce(int const End, double dt)
|
||||
|
||||
if (thiscoupler.CouplingFlag != coupling::faux)
|
||||
{
|
||||
// uzgadnianie prawa Newtona
|
||||
othervehicle->Couplers[1 - End].CForce = -CF;
|
||||
// uzgadnianie prawa Newtona, on the coupler of the other vehicle this one is coupled with
|
||||
othervehicle->Couplers[otherend].CForce = -CF;
|
||||
}
|
||||
|
||||
return CF;
|
||||
|
||||
Reference in New Issue
Block a user