From ce0cd764ec03f7385655115307ec8b90cd7d0c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Sun, 3 Jun 2018 21:24:48 +0200 Subject: [PATCH] Added MHZ_K5P brake handle for new EMUs/DMUs --- McZapkie/MOVER.h | 2 +- McZapkie/Mover.cpp | 4 ++ McZapkie/hamulce.cpp | 116 ++++++++++++++++++++++++++++++++++++++++++- McZapkie/hamulce.h | 25 ++++++++++ 4 files changed, 145 insertions(+), 2 deletions(-) diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 47017c54..fa217caf 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -355,7 +355,7 @@ enum TBrakeSystem { Individual, Pneumatic, ElectroPneumatic }; /*podtypy hamulcow zespolonych*/ enum TBrakeSubSystem { ss_None, ss_W, ss_K, ss_KK, ss_Hik, ss_ESt, ss_KE, ss_LSt, ss_MT, ss_Dako }; enum TBrakeValve { NoValve, W, W_Lu_VI, W_Lu_L, W_Lu_XR, K, Kg, Kp, Kss, Kkg, Kkp, Kks, Hikg1, Hikss, Hikp1, KE, SW, EStED, NESt3, ESt3, LSt, ESt4, ESt3AL2, EP1, EP2, M483, CV1_L_TR, CV1, CV1_R, Other }; -enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113, MHZ_P, MHZ_T, MHZ_EN57 }; +enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113, MHZ_P, MHZ_T, MHZ_EN57, MHZ_K5P }; /*typy hamulcow indywidualnych*/ enum TLocalBrake { NoBrake, ManualBrake, PneumaticBrake, HydraulicBrake }; /*dla osob/towar: opoznienie hamowania/odhamowania*/ diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 47368df9..0179d83f 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -8088,6 +8088,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) { { "test", testH }, { "D2", D2 }, { "MHZ_EN57", MHZ_EN57 }, + { "MHZ_K5P", MHZ_K5P }, { "M394", M394 }, { "Knorr", Knorr }, { "Westinghouse", West }, @@ -8895,6 +8896,9 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir) case St113: Handle = std::make_shared(); break; + case MHZ_K5P: + Handle = std::make_shared(); + break; default: Handle = std::make_shared(); } diff --git a/McZapkie/hamulce.cpp b/McZapkie/hamulce.cpp index ee414c1d..454f58c2 100644 --- a/McZapkie/hamulce.cpp +++ b/McZapkie/hamulce.cpp @@ -23,6 +23,7 @@ Copyright (C) 2007-2014 Maciej Cierniak static double const DPL = 0.25; double const TFV4aM::pos_table[11] = {-2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0}; double const TMHZ_EN57::pos_table[11] = {-1, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0}; +double const TMHZ_K5P::pos_table[11] = { -1, 3, -1, 0, 1, 1, 2, 3, 0, 0, 0 }; double const TM394::pos_table[11] = {-1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0}; double const TH14K1::BPT_K[6][2] = {{10, 0}, {4, 1}, {0, 1}, {4, 0}, {4, -1}, {15, -1}}; double const TH14K1::pos_table[11] = {-1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0}; @@ -2516,7 +2517,7 @@ bool TFV4aM::EQ(double pos, double i_pos) return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5); } -//---FV4a/M--- nowonapisany kran bez poprawki IC +//---MHZ_EN57--- manipulator hamulca zespolonego do EN57 double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double ep ) { static int const LBDelay = 100; @@ -2656,6 +2657,119 @@ bool TMHZ_EN57::EQ(double pos, double i_pos) return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5); } +//---MHZ_K5P--- manipulator hamulca zespolonego Knorr 5-ciopozycyjny + +double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep) { + static int const LBDelay = 100; + + double LimPP; + double dpPipe; + double dpMainValve; + double ActFlowSpeed; + double DP; + double pom; + + for (int idx = 0; idx < 5; ++idx) { + Sounds[idx] = 0; + } + + DP = 0; + + i_bcp = Max0R(Min0R(i_bcp, 2.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres + + if ((TP > 0)) + { + DP = 0.004; + TP = TP - DP * dt; + Sounds[s_fv4a_t] = DP; + } + else + { + TP = 0; + } + + if (EQ(i_bcp, 1)) //odcięcie - nie rób nic + LimPP = CP; + else if (i_bcp > 1) //hamowanie + LimPP = 3.4; + else //luzowanie + LimPP = 5.0; + pom = CP; + LimPP = Min0R(LimPP + TP + RedAdj, HP); // pozycja + czasowy lub zasilanie + ActFlowSpeed = 4; + + if ((LimPP > CP)) // podwyzszanie szybkie + CP = CP + 9 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy; + else + CP = CP + 9 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy + + LimPP = pom; // cp + dpPipe = Min0R(HP, LimPP); + + if (dpPipe > PP) + dpMainValve = -PFVa(HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4); + else + dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4); + + if (EQ(i_bcp, -1)) + { + if ((TP < 1)) + TP = TP + 0.03 * dt; + } + + if (EQ(i_bcp, 3)) + { + DP = PF(0, PP, 2 * ActFlowSpeed / LBDelay); + dpMainValve = DP; + Sounds[s_fv4a_e] = DP; + Sounds[s_fv4a_u] = 0; + Sounds[s_fv4a_b] = 0; + Sounds[s_fv4a_x] = 0; + } + else + { + if (dpMainValve > 0) + Sounds[s_fv4a_b] = dpMainValve; + else + Sounds[s_fv4a_u] = -dpMainValve; + } + + return dpMainValve * dt; +} + +void TMHZ_K5P::Init(double Press) +{ + CP = Press; +} + +void TMHZ_K5P::SetReductor(double nAdj) +{ + RedAdj = nAdj; +} + +double TMHZ_K5P::GetSound(int i) +{ + if (i > 4) + return 0; + else + return Sounds[i]; +} + +double TMHZ_K5P::GetPos(int i) +{ + return pos_table[i]; +} + +double TMHZ_K5P::GetCP() +{ + return RP; +} + +bool TMHZ_K5P::EQ(double pos, double i_pos) +{ + return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5); +} + //---M394--- Matrosow double TM394::GetPF(double i_bcp, double PP, double HP, double dt, double ep) diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h index 93e89d37..07134e18 100644 --- a/McZapkie/hamulce.h +++ b/McZapkie/hamulce.h @@ -591,6 +591,31 @@ class TMHZ_EN57 : public TDriverHandle { {} }; +class TMHZ_K5P : public TDriverHandle { + +private: + double CP = 0.0; //zbiornik sterujący + double TP = 0.0; //zbiornik czasowy + double RP = 0.0; //zbiornik redukcyjny + double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem) + bool Fala = false; + static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 }; + + bool EQ(double pos, double i_pos); + +public: + double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/; + void Init(double Press)/*override*/; + void SetReductor(double nAdj)/*override*/; + double GetSound(int i)/*override*/; + double GetPos(int i)/*override*/; + double GetCP()/*override*/; + + inline TMHZ_K5P(void) : + TDriverHandle() + {} +}; + /* FBS2= class(TTDriverHandle) private CP, TP, RP: real; //zbiornik sterujący, czasowy, redukcyjny