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

Merge master into fix/et42-fans-compressor-lamps-et22-louvre

Resolves the MOVER.h conflict (both sides add independent helpers) so the
pull request builds run again.
This commit is contained in:
jerrrrycho
2026-11-08 03:11:17 +01:00
19 changed files with 827 additions and 101 deletions

View File

@@ -2473,9 +2473,15 @@ class TMoverParameters
{
return false == ControlPressureSwitch && (HasControlPressureSwitch || BrakePress < 1.0);
}
// whether the lamp of the open line contactors is lit, telling the start can be made
// whether the lamp of the open line contactors is lit. on the electric locomotives it tells the start can be made, so
// it goes out with the start cut off; on the diesel-electric ones (the SU45 and SU46 family) it just tells the
// contactors are open, whatever opened them: the master controller at 0, or the pressure switch (eu07/maszyna#263)
bool LineContactorsLampLit() const
{
if (EngineType == TEngineType::DieselElectric)
{
return false == StLinFlag;
}
return false == StLinFlag && MainCircuitLampsEnabled();
}
// whether the pneumatic louvres of the motor fans are still closed, the main reservoir short of the pressure that opens them
@@ -2485,6 +2491,13 @@ class TMoverParameters
}
// whether the devices the line contactors are interlocked with (LineContactorsInterlock) let them close
bool LineContactorsInterlockReleased() const;
// whether the cab command opening the main circuit opens it where the only cab switch of the circuit is the button
// closing it: on a diesel that's the starter button, and the command is the one way to stop an engine whose fuel pump
// starts on its own (eu07/maszyna#427). the other vehicles with such a button keep ignoring the command
bool MainCircuitOpensWithStarterOnly() const
{
return EngineType == TEngineType::DieselEngine || EngineType == TEngineType::DieselElectric;
}
// whether the pumps a joint oil and fuel pump switch works, those not started automatically, are all switched on
bool OilFuelPumpsEnabled() const
{

View File

@@ -5147,6 +5147,7 @@ void TMoverParameters::ComputeTotalForce(double dt)
double TMoverParameters::BrakeForceR(double ratio, double velocity) const
{
double press = 0;
ratio = Hamulec->GetBrakeRatio(ratio);
if (MBPM > 2)
{
press = MaxBrakePress[1] + (MaxBrakePress[3] - MaxBrakePress[1]) * std::min(1.0, (TotalMass - Mass) / (MBPM - Mass));
@@ -5162,8 +5163,8 @@ double TMoverParameters::BrakeForceR(double ratio, double velocity) const
press = MaxBrakePress[3];
if (DynamicBrakeType == dbrake_automatic)
ratio = ratio + (1.5 - ratio) * std::min(1.0, Vel * 0.02);
if (BrakeDelayFlag & bdelay_R && BrakeMethod % 128 != bp_Cosid && BrakeMethod % 128 != bp_D1 && BrakeMethod % 128 != bp_D2 && Power < 1 && velocity < 40)
ratio = ratio / 2;
if (BrakeDelayFlag & bdelay_R && BrakeMethod % 128 != bp_Cosid && BrakeMethod % 128 != bp_D1 && BrakeMethod % 128 != bp_D2 && Power < 1)
ratio *= Hamulec->GetRapidRatio(velocity);
if (TrainType == dt_DMU && velocity < 30.0)
{
ratio -= 0.3;

View File

@@ -16,6 +16,11 @@ Copyright (C) 2007-2014 Maciej Cierniak
#include "Oerlikon_ESt.h"
#include "utilities/utilities.h"
// wstepny nacisk sprezyn na glowny przyrzad rozrzadczy, wyrazony jako roznica cisnien ZS - PG [bar]
static double const dPSprezyny = 0.21;
// najmniejszy stopien hamowania w cylindrze [bar] (tablica 3-9, proby 12 i 22: 0,25-0,30)
static double const pStopnia = 0.28;
double d2A( double const d )
{
return d * d * 0.7854 / 1000.0;
@@ -218,10 +223,11 @@ double TNESt3::GetPF( double const PP, double const dt, double const Vel ) // pr
CheckReleaser(dt);
// luzowanie
double const cel{ CelBCP( CVP, VVP ) };
if ((BrakeStatus & b_hld) == b_off)
dV =
PF(0.0, BCP, Nozzles[dTO] * nastG + (1.0 - nastG) * Nozzles[dOO])
* dt * (0.1 + 4.9 * std::min(0.2, BCP - ((CVP - 0.05 - VVP) * BVM + 0.1)));
* dt * (0.1 + 4.9 * std::min(0.2, BCP - (cel > 0.0 ? cel + 0.1 : 0.0))); // bez stopnia luzuje do zera
else
dV = 0.0;
// BrakeCyl.Flow(-dV);
@@ -229,7 +235,7 @@ double TNESt3::GetPF( double const PP, double const dt, double const Vel ) // pr
if ( (BrakeStatus & b_on) == b_on && Przekladniki[1]->P() * HBG300 < MaxBP )
dV =
PF( BVP, BCP, Nozzles[dTN] * (nastG + 2.0 * (BCP < Podskok ? 1.0 : 0.0)) + Nozzles[dON] * (1.0 - nastG) )
* dt * (0.1 + 4.9 * std::min( 0.2, (CVP - 0.05 - VVP) * BVM - BCP ) );
* dt * (0.1 + 4.9 * std::min( 0.2, cel - BCP ) );
else
dV = 0;
// BrakeCyl.Flow(-dV);
@@ -313,7 +319,7 @@ void TNESt3::Init( double const PP, double const HPP, double const LPP, double c
Miedzypoj->CreateCap(5.0);
Miedzypoj->CreatePress(PP);
BVM = 1.0 / (HPP - 0.05 - LPP) * MaxBP;
BVM = 1.0 / (HPP - dPSprezyny - LPP) * MaxBP;
BrakeDelayFlag = BDF;
@@ -327,6 +333,17 @@ void TNESt3::Init( double const PP, double const HPP, double const LPP, double c
RapidStaly = false;
}
double TNESt3::GetRapidRatio(double const Vel) const
{
// ESt3 has no rapid relay, and with disc brakes the rapid step stays engaged at all speeds
if( ( PrzekRapid == nullptr ) || RapidStaly ) {
return 1.0;
}
// a braking vehicle comes from above, so the step is still engaged down to the speed
// at which GetPF() drops it, not the one at which it engages
return ( Vel < 50.0 ? 1.0 / PrzekRapid->GetRapidMult() : 1.0 );
}
double TNESt3::GetCRP()
{
return CntrlRes->P();
@@ -334,6 +351,24 @@ double TNESt3::GetCRP()
// return Miedzypoj.P;
}
double TNESt3::GetBrakeRatio( double const Ratio ) const // udzial cisnienia w cylindrze dla udzialu spadku w PG
{
if( MaxBP <= 0.0 || BVM <= 0.0 ) {
return Ratio;
}
// pelny spadek sluzbowy w PG (HPP - LPP), odtworzony z przelozenia
double const spadek{ MaxBP / BVM + dPSprezyny };
double const cel{ ( Ratio * spadek - dPSprezyny ) * BVM };
return ( cel > 0.0 ? std::max( cel, pStopnia ) / MaxBP : 0.0 );
}
double TNESt3::CelBCP( double const CVP, double const VVP ) const // docelowe cisnienie w cylindrze
{
double const cel{ ( CVP - dPSprezyny - VVP ) * BVM };
// gdy zawor hamuje, nie daje mniej niz najmniejszy stopien
return ( cel > 0.0 ? std::max( cel, pStopnia ) : cel );
}
void TNESt3::CheckState(double const BCP, double & /*dV1*/) // glowny przyrzad rozrzadczy
{
double const VVP{ ValveRes->P() };
@@ -344,14 +379,14 @@ void TNESt3::CheckState(double const BCP, double & /*dV1*/) // glowny przyrzad r
Przys_blok = false;
// sprawdzanie stanu
// if ((BrakeStatus and 1)=1)and(BCP>0.25)then
if (VVP + 0.01 + BCP / BVM < CVP - 0.05 && Przys_blok)
double const cel{ CelBCP( CVP, VVP ) };
if (BCP < cel - 0.01 * BVM && Przys_blok)
BrakeStatus |= b_on | b_hld; // hamowanie stopniowe;
else if (VVP - 0.01 + (BCP - 0.1) / BVM > CVP - 0.05)
else if (BCP - 0.1 > cel + 0.01 * BVM)
BrakeStatus &= ~( b_on | b_hld ); // luzowanie;
else if (VVP + BCP / BVM > CVP - 0.05)
else if (BCP > cel)
BrakeStatus &= ~b_on; // zatrzymanie napelaniania;
else if (VVP + (BCP - 0.1) / BVM < CVP - 0.05 && BCP > 0.25) // zatrzymanie luzowania
else if (BCP - 0.1 < cel && BCP > 0.25) // zatrzymanie luzowania
BrakeStatus |= b_hld;
if( ( BrakeStatus & b_hld ) == 0 )
@@ -380,7 +415,7 @@ void TNESt3::CheckReleaser(double const dt) // odluzniacz
// odluzniacz automatyczny
if ((BrakeStatus & b_rls) == b_rls)
{
CntrlRes->Flow(PF(CVP, 0, 0.02) * dt);
CntrlRes->Flow(PF(CVP, 0, 0.0049) * dt); // ZS 15 l z 5,0 do 0,4 bar w 23 s (proba odbioru nr 27)
if (CVP < VVP + 0.3 || false == autom)
BrakeStatus &= ~b_rls;
}
@@ -549,7 +584,7 @@ void TNESt3::SetSize( int const size, std::string const &params ) // ustawianie
{ // dON,dOO,dTN,dTO,dP,dS
Nozzles[dON] = 3.7;
Nozzles[dOO] = 2.50;
Nozzles[dTN] = 1.65;
Nozzles[dTN] = 1.62;
Nozzles[dTO] = 1.39;
Nozzles[dP] = 2.65;
Nozzles[dPd] = 1.80;
@@ -638,6 +673,14 @@ void TNESt3::SetSize( int const size, std::string const &params ) // ustawianie
Nozzles[dSd] = 1.1;
Nozzles[dSm] = 0.9;
if( PrzekCiagly != nullptr ) {
// dysze cylindra skalibrowane na komore impulsowa przekladnika AL2 (1 l) wg czasow z tablicy 3-9
Nozzles[dON] *= 0.914;
Nozzles[dTN] *= 0.885;
Nozzles[dOO] *= 0.82;
Nozzles[dTO] *= 0.8;
}
// przeliczanie z mm^2 na l/m
for (auto &nozzle : Nozzles)
{
@@ -646,7 +689,8 @@ void TNESt3::SetSize( int const size, std::string const &params ) // ustawianie
for (int i = 1; i < 4; ++i)
{
Przekladniki[i]->BrakeRes = BrakeRes;
Przekladniki[i]->CreateCap(i);
// komora impulsowa przekladnika AL2 ma 1 l
Przekladniki[i]->CreateCap( ( Przekladniki[i] == PrzekCiagly ) ? 1.0 : i );
Przekladniki[i]->CreatePress(BrakeCyl->P());
if (i < 3)
Przekladniki[i]->Next = Przekladniki[i + 1];

View File

@@ -111,6 +111,7 @@ class TRapid : public TPrzekladnik {
public:
void SetRapidParams(double mult, double size);
void SetRapidStatus(bool rs);
double GetRapidMult() const { return RapidMult; }
void Update(double dt) override;
using TPrzekladnik::TPrzekladnik;
};
@@ -194,6 +195,9 @@ class TNESt3 : public TBrake {
double GetPF( double const PP, double const dt, double const Vel ) override; // przeplyw miedzy komora wstepna i PG
void EStParams(double i_crc) const; // parametry charakterystyczne dla ESt
double GetCRP() override;
double GetRapidRatio(double const Vel) const override;
double CelBCP(double const CVP, double const VVP) const; // docelowe cisnienie w cylindrze
double GetBrakeRatio(double const Ratio) const override; // udzial cisnienia w cylindrze dla udzialu spadku w PG
void CheckState(double const BCP, double &dV1); // glowny przyrzad rozrzadczy
void CheckReleaser(double const dt); // odluzniacz
double CVs(double const BP) const; // napelniacz sterujacego

View File

@@ -421,6 +421,10 @@ class TBrake
double GetVRP() const; // cisnienie komory wstepnej rozdzielacza
/// <summary>Returns control reservoir (ZS) pressure [bar]; defaults to the auxiliary reservoir for valves without a dedicated ZS.</summary>
virtual double GetCRP(); // cisnienie zbiornika sterujacego
/// <summary>Share of the full cylinder pressure the distributor settles at for the given share
/// of the full service pipe drop. Used only to predict the brake force; the default is proportional.</summary>
/// <param name="Ratio">Share of the full service brake pipe drop.</param>
virtual double GetBrakeRatio(double const Ratio) const { return Ratio; }
/// <summary>
/// Sets the brake delay (G/P/R/M) selector if requested mode is supported.
/// </summary>
@@ -443,6 +447,11 @@ class TBrake
/// <summary>Sets the rapid step ratio. Default no-op; overridden where supported.</summary>
/// <param name="RMR">Rapid ratio.</param>
virtual void SetRM(double const RMR) { /* no effect for this device type */ } // ustalenie przelozenia rapida
/// <summary>Share of the full cylinder pressure the distributor delivers at the given speed
/// while the vehicle is slowing down through it, for a vehicle set to R. Used only to predict
/// the brake force; the default is the approximation BrakeForceR() has always used.</summary>
/// <param name="Vel">Vehicle velocity [km/h].</param>
virtual double GetRapidRatio(double const Vel) const { return Vel < 40.0 ? 0.5 : 1.0; }
/// <summary>Sets the velocity threshold for the rapid step.</summary>
/// <param name="RVR">Velocity threshold (same unit as Vel passed to GetPF).</param>
virtual void SetRV(double const RVR)