From 913cfc8ae86fcb251055c99a471b3714c112f855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Tue, 2 Apr 2019 21:12:46 +0200 Subject: [PATCH] Better antislipping system in EStED --- McZapkie/MOVER.h | 1 + McZapkie/Mover.cpp | 9 ++++++--- McZapkie/hamulce.cpp | 7 ++++--- McZapkie/hamulce.h | 3 ++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index f02bd64d..fd311d9e 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -1130,6 +1130,7 @@ public: double AccN = 0.0; // przyspieszenie normalne w [m/s^2] double AccVert = 0.0; // vertical acceleration double nrot = 0.0; + double nrot_eps = 0.0; //przyspieszenie kątowe kół (bez kierunku) double WheelFlat = 0.0; bool TruckHunting { true }; // enable/disable truck hunting calculation /*! rotacja kol [obr/s]*/ diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index dd61392d..320451a8 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -3708,7 +3708,7 @@ void TMoverParameters::UpdatePipePressure(double dt) Pipe->Flow( temp * Hamulec->GetPF( temp * PipePress, dt, Vel ) + GetDVc( dt ) ); if (ASBType == 128) - Hamulec->ASB(int(SlippingWheels)); + Hamulec->ASB(int(SlippingWheels && (Vel>1))*(1+2*int(nrot_eps<-0.01))); dpPipe = 0; @@ -3956,6 +3956,7 @@ void TMoverParameters::ComputeTotalForce(double dt) { // juz zoptymalizowane: FStand = FrictionForce(RunningShape.R, RunningTrack.DamageFlag); // siła oporów ruchu + double old_nrot = abs(nrot); nrot = v2n(); // przeliczenie prędkości liniowej na obrotową if( ( true == TestFlag( BrakeMethod, bp_MHS ) ) @@ -4028,8 +4029,9 @@ void TMoverParameters::ComputeTotalForce(double dt) { } else { - Fb = -Fwheels*Sign(V); - FTrain = 0; + double factor = (FTrain - Fb * Sign(V) != 0 ? Fwheels/(FTrain - Fb * Sign(V)) : 1.0); + Fb *= factor; + FTrain *= factor; } if (nrot < 0.1) { @@ -4038,6 +4040,7 @@ void TMoverParameters::ComputeTotalForce(double dt) { nrot = temp_nrot; } + nrot_eps = (abs(nrot) - (old_nrot))/dt; // doliczenie sił z innych pojazdów for( int end = end::front; end <= end::rear; ++end ) { if( Neighbours[ end ].vehicle != nullptr ) { diff --git a/McZapkie/hamulce.cpp b/McZapkie/hamulce.cpp index 6d258f8e..5cc3dd02 100644 --- a/McZapkie/hamulce.cpp +++ b/McZapkie/hamulce.cpp @@ -391,7 +391,8 @@ void TBrake::SetEPS( double const nEPS ) void TBrake::ASB( int const state ) { // 255-b_asb(32) - BrakeStatus = (BrakeStatus & ~b_asb) | ( state * b_asb ); + BrakeStatus = (BrakeStatus & ~b_asb) | ( (state / 2) * b_asb ); + BrakeStatus = (BrakeStatus & ~b_asb_unbrake) | ( (state % 2) * b_asb_unbrake); } int TBrake::GetStatus() @@ -1551,7 +1552,7 @@ double TEStED::GetPF( double const PP, double const dt, double const Vel ) // powtarzacz — podwojny zawor zwrotny temp = Max0R(LoadC * BCP / temp * Min0R(Max0R(1 - EDFlag, 0), 1), LBP); double speed = 1; - if ((ASBP < 0.1) && ((BrakeStatus & b_asb) == b_asb)) + if ((ASBP < 0.1) && ((BrakeStatus & b_asb_unbrake) == b_asb_unbrake)) { temp = 0; speed = 3; @@ -1559,7 +1560,7 @@ double TEStED::GetPF( double const PP, double const dt, double const Vel ) if ((BrakeCyl->P() > temp)) dv = -PFVd(BrakeCyl->P(), 0, 0.02 * SizeBC * speed, temp) * dt; - else if ((BrakeCyl->P() < temp)) + else if ((BrakeCyl->P() < temp) && ((BrakeStatus & b_asb) == 0)) dv = PFVa(BVP, BrakeCyl->P(), 0.02 * SizeBC, temp) * dt; else dv = 0; diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h index d09427c5..6ae70eca 100644 --- a/McZapkie/hamulce.h +++ b/McZapkie/hamulce.h @@ -53,7 +53,8 @@ static int const b_on = 2; //napelnianie static int const b_rfl = 4; //uzupelnianie static int const b_rls = 8; //odluzniacz static int const b_ep = 16; //elektropneumatyczny -static int const b_asb = 32; //elektropneumatyczny +static int const b_asb = 32; //przeciwposlizg-wstrzymanie +static int const b_asb_unbrake = 64; //przeciwposlizg-luzowanie static int const b_dmg = 128; //wylaczony z dzialania /*uszkodzenia hamulca*/