From 6374e2d32e7ef00bb938d7b79763b1aae1d57779 Mon Sep 17 00:00:00 2001
From: pwarszawski
Date: Mon, 2 Nov 2026 17:01:32 +0100
Subject: [PATCH] AI braking: predict the ESt3 brake force from the distributor
characteristic
---
McZapkie/Mover.cpp | 1 +
McZapkie/Oerlikon_ESt.cpp | 11 +++++++++++
McZapkie/Oerlikon_ESt.h | 1 +
McZapkie/hamulce.h | 4 ++++
4 files changed, 17 insertions(+)
diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp
index 429c2df17..2b2275112 100644
--- a/McZapkie/Mover.cpp
+++ b/McZapkie/Mover.cpp
@@ -5091,6 +5091,7 @@ void TMoverParameters::ComputeTotalForce(double dt)
double TMoverParameters::BrakeForceR(double ratio, double velocity)
{
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));
diff --git a/McZapkie/Oerlikon_ESt.cpp b/McZapkie/Oerlikon_ESt.cpp
index f37dc69f9..1e7a5be66 100644
--- a/McZapkie/Oerlikon_ESt.cpp
+++ b/McZapkie/Oerlikon_ESt.cpp
@@ -351,6 +351,17 @@ 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 };
diff --git a/McZapkie/Oerlikon_ESt.h b/McZapkie/Oerlikon_ESt.h
index 01aefb7f2..02d65a285 100644
--- a/McZapkie/Oerlikon_ESt.h
+++ b/McZapkie/Oerlikon_ESt.h
@@ -197,6 +197,7 @@ class TNESt3 : public TBrake {
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
diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h
index 5b5f8933c..37b9b6a4d 100644
--- a/McZapkie/hamulce.h
+++ b/McZapkie/hamulce.h
@@ -421,6 +421,10 @@ class TBrake
double GetVRP() const; // cisnienie komory wstepnej rozdzielacza
/// Returns control reservoir (ZS) pressure [bar]; defaults to the auxiliary reservoir for valves without a dedicated ZS.
virtual double GetCRP(); // cisnienie zbiornika sterujacego
+ /// 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.
+ /// Share of the full service brake pipe drop.
+ virtual double GetBrakeRatio(double const Ratio) const { return Ratio; }
///
/// Sets the brake delay (G/P/R/M) selector if requested mode is supported.
///