From 3edc5dd216be8e5fe18362a631a13db7f5a38ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Tue, 11 Jan 2022 19:39:41 +0100 Subject: [PATCH 1/3] Added increased flow factor for filling stroke positions for handles K5P and 6P --- McZapkie/hamulce.cpp | 32 +++++++++++++++++++++++++++----- McZapkie/hamulce.h | 2 ++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/McZapkie/hamulce.cpp b/McZapkie/hamulce.cpp index f0207ac8..f5c642d0 100644 --- a/McZapkie/hamulce.cpp +++ b/McZapkie/hamulce.cpp @@ -2800,6 +2800,19 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep) dpPipe = Min0R(HP, CP + TP + RedAdj); + if (EQ(i_bcp, -1)) + { + if (Fala) + { + dpPipe = 5.0 + TP + RedAdj + uop; + ActFlowSpeed = 12; + } + else + { + ActFlowSpeed *= FillingStrokeFactor; + } + } + if (dpPipe > PP) dpMainValve = -PFVa(HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4); else @@ -2866,7 +2879,7 @@ double TMHZ_K5P::GetRP() return 5.0 + TP + RedAdj; } -void TMHZ_K5P::SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD) +void TMHZ_K5P::SetParams(bool AO, bool MO, double OverP, double FSF, double OMP, double OPD) { AutoOvrld = AO; ManualOvrld = MO; @@ -2874,6 +2887,7 @@ void TMHZ_K5P::SetParams(bool AO, bool MO, double OverP, double, double OMP, dou Fala = (OverP > 0.01); OverloadMaxPressure = OMP; OverloadPressureDecrease = OPD; + FillingStrokeFactor = 1 + FSF; } @@ -2935,10 +2949,17 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep) if (ManualOvrld && !ManualOvrldActive) //no overpressure for not pressed button if it does not exists uop = 0; - if (Fala && EQ(i_bcp, -1)) + if (EQ(i_bcp, -1)) { - dpPipe = 5.0 + TP + RedAdj + uop; - ActFlowSpeed = 12; + if (Fala) + { + dpPipe = 5.0 + TP + RedAdj + uop; + ActFlowSpeed = 12; + } + else + { + ActFlowSpeed *= FillingStrokeFactor; + } } if (dpPipe > PP) @@ -3007,7 +3028,7 @@ double TMHZ_6P::GetRP() return 5.0 + TP + RedAdj; } -void TMHZ_6P::SetParams(bool AO, bool MO, double OverP, double, double OMP, double OPD) +void TMHZ_6P::SetParams(bool AO, bool MO, double OverP, double FSF, double OMP, double OPD) { AutoOvrld = AO; ManualOvrld = MO; @@ -3015,6 +3036,7 @@ void TMHZ_6P::SetParams(bool AO, bool MO, double OverP, double, double OMP, doub Fala = (OverP > 0.01); OverloadMaxPressure = OMP; OverloadPressureDecrease = OPD; + FillingStrokeFactor = 1 + FSF; } diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h index 4e78b920..b18280cb 100644 --- a/McZapkie/hamulce.h +++ b/McZapkie/hamulce.h @@ -639,6 +639,7 @@ private: double UnbrakeOverPressure = 0.0; double OverloadMaxPressure = 1.0; //maksymalne zwiekszenie cisnienia przy asymilacji double OverloadPressureDecrease = 0.002; //predkosc spadku cisnienia przy asymilacji + double FillingStrokeFactor = 1.0; //mnożnik otwarcia zaworu przy uderzeniowym (bez fali) static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 }; bool EQ(double pos, double i_pos); @@ -669,6 +670,7 @@ private: double UnbrakeOverPressure = 0.0; //wartosc napelniania uderzeniowego double OverloadMaxPressure = 1.0; //maksymalne zwiekszenie cisnienia przy asymilacji double OverloadPressureDecrease = 0.002; //predkosc spadku cisnienia przy asymilacji + double FillingStrokeFactor = 1.0; //mnożnik otwarcia zaworu przy uderzeniowym (bez fali) static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 }; bool EQ(double pos, double i_pos); From 9a97289f27bcf0b5fe2d0c17d8f6c92882d49639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Tue, 11 Jan 2022 19:40:16 +0100 Subject: [PATCH 2/3] Added amplitude offset for airsounds of brake handle --- Train.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Train.cpp b/Train.cpp index dee4cd86..f6683b1c 100644 --- a/Train.cpp +++ b/Train.cpp @@ -7558,7 +7558,7 @@ TTrain::update_sounds( double const Deltatime ) { fPPress = interpolate( fPPress, static_cast( mvOccupied->Handle->GetSound( s_fv4a_b ) ), 0.05f ); volume = ( fPPress > 0 ? - rsHiss->m_amplitudefactor * fPPress * 0.25 : + rsHiss->m_amplitudefactor * fPPress * 0.25 + rsHiss->m_amplitudeoffset : 0 ); if( volume * brakevolumescale > 0.05 ) { rsHiss->gain( volume * brakevolumescale ); @@ -7573,7 +7573,7 @@ TTrain::update_sounds( double const Deltatime ) { fNPress = interpolate( fNPress, static_cast( mvOccupied->Handle->GetSound( s_fv4a_u ) ), 0.25f ); volume = ( fNPress > 0 ? - rsHissU->m_amplitudefactor * fNPress : + rsHissU->m_amplitudefactor * fNPress + rsHissU->m_amplitudeoffset : 0 ); if( volume * brakevolumescale > 0.05 ) { rsHissU->gain( volume * brakevolumescale ); @@ -7585,7 +7585,7 @@ TTrain::update_sounds( double const Deltatime ) { } // upuszczanie przy naglym if( rsHissE ) { - volume = mvOccupied->Handle->GetSound( s_fv4a_e ) * rsHissE->m_amplitudefactor; + volume = mvOccupied->Handle->GetSound( s_fv4a_e ) * rsHissE->m_amplitudefactor + rsHissE->m_amplitudeoffset; if( volume * brakevolumescale > 0.05 ) { rsHissE->gain( volume * brakevolumescale ); rsHissE->play( sound_flags::exclusive | sound_flags::looping ); @@ -7596,7 +7596,7 @@ TTrain::update_sounds( double const Deltatime ) { } // upuszczanie sterujacego fala if( rsHissX ) { - volume = mvOccupied->Handle->GetSound( s_fv4a_x ) * rsHissX->m_amplitudefactor; + volume = mvOccupied->Handle->GetSound( s_fv4a_x ) * rsHissX->m_amplitudefactor + rsHissX->m_amplitudeoffset; if( volume * brakevolumescale > 0.05 ) { rsHissX->gain( volume * brakevolumescale ); rsHissX->play( sound_flags::exclusive | sound_flags::looping ); @@ -7607,7 +7607,7 @@ TTrain::update_sounds( double const Deltatime ) { } // upuszczanie z czasowego if( rsHissT ) { - volume = mvOccupied->Handle->GetSound( s_fv4a_t ) * rsHissT->m_amplitudefactor; + volume = mvOccupied->Handle->GetSound( s_fv4a_t ) * rsHissT->m_amplitudefactor + +rsHissT->m_amplitudeoffset; if( volume * brakevolumescale > 0.05 ) { rsHissT->gain( volume * brakevolumescale ); rsHissT->play( sound_flags::exclusive | sound_flags::looping ); @@ -7624,7 +7624,7 @@ TTrain::update_sounds( double const Deltatime ) { fPPress = ( 4.0f * fPPress + std::max( 0.0, mvOccupied->dpMainValve ) ) / ( 4.0f + 1.0f ); volume = ( fPPress > 0.0f ? - 2.0 * rsHiss->m_amplitudefactor * fPPress : + 2.0 * rsHiss->m_amplitudefactor * fPPress + rsHiss->m_amplitudeoffset : 0.0 ); if( volume > 0.05 ) { rsHiss->gain( volume ); @@ -7639,7 +7639,7 @@ TTrain::update_sounds( double const Deltatime ) { fNPress = ( 4.0f * fNPress + Min0R( 0.0, mvOccupied->dpMainValve ) ) / ( 4.0f + 1.0f ); volume = ( fNPress < 0.0f ? - -1.0 * rsHissU->m_amplitudefactor * fNPress : + -1.0 * rsHissU->m_amplitudefactor * fNPress + rsHissU->m_amplitudeoffset : 0.0 ); if( volume > 0.01 ) { rsHissU->gain( volume ); From 80cb1a0c2f61de1405e43c4fda532098711fe36c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Thu, 13 Jan 2022 23:32:58 +0100 Subject: [PATCH 3/3] Fixed ventilators for ESM when going backwards --- McZapkie/Mover.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 0f3ac21e..701d3493 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -2058,8 +2058,8 @@ void TMoverParameters::MotorBlowersCheck( double const Timestep ) { // activation check for( auto &blower : MotorBlowers ) { auto disable = blower.is_disabled; - auto const start { ( Vel >= blower.min_start_velocity && Im > 0.5 ) }; - auto const stop { ( Vel < 0.5 && Im < 0.5 ) }; + auto const start { ( Vel >= blower.min_start_velocity && std::abs(Im) > 0.5 ) }; + auto const stop { ( Vel < 0.5 && std::abs(Im) < 0.5 ) }; if (blower.min_start_velocity >= 0) { if ( stop )