diff --git a/Driver.cpp b/Driver.cpp index 12af005a..ee8d8e2d 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -1707,7 +1707,7 @@ void TController::AutoRewident() } if (mvOccupied->TrainType == dt_EZT) { - fAccThreshold = -fBrake_a0[BrakeAccTableSize] - 8 * fBrake_a1[BrakeAccTableSize]; + fAccThreshold = std::max(-fBrake_a0[BrakeAccTableSize] - 8 * fBrake_a1[BrakeAccTableSize], -0.75); fBrakeReaction = 0.25; } else if (ustaw > 16) diff --git a/DynObj.cpp b/DynObj.cpp index 2a5c9254..5a7f852c 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -2784,9 +2784,9 @@ bool TDynamicObject::Update(double dt, double dt1) 1000; // chwilowy max ED -> do rozdzialu sil FfulED = Min0R(p->MoverParameters->eimv[eimv_Fful], 0) * 1000; // chwilowy max ED -> do rozdzialu sil - FrED -= Min0R(p->MoverParameters->eimv[eimv_Fr], 0) * + FrED -= Min0R(p->MoverParameters->eimv[eimv_Fmax], 0) * 1000; // chwilowo realizowane ED -> do pneumatyki - Frj += Max0R(p->MoverParameters->eimv[eimv_Fr], 0) * + Frj += Max0R(p->MoverParameters->eimv[eimv_Fmax], 0) * 1000;// chwilowo realizowany napęd -> do utrzymującego masa += p->MoverParameters->TotalMass; osie += p->MoverParameters->NAxles; @@ -2880,10 +2880,10 @@ bool TDynamicObject::Update(double dt, double dt1) if ((FzEP[i] > 0.01) && (FzEP[i] > p->MoverParameters->TotalMass * p->MoverParameters->eimc[eimc_p_eped] + - Min0R(p->MoverParameters->eimv[eimv_Fr], 0) * 1000) && + Min0R(p->MoverParameters->eimv[eimv_Fmax], 0) * 1000) && (!PrzekrF[i])) { - float przek1 = -Min0R(p->MoverParameters->eimv[eimv_Fr], 0) * 1000 + + float przek1 = -Min0R(p->MoverParameters->eimv[eimv_Fmax], 0) * 1000 + FzEP[i] - p->MoverParameters->TotalMass * p->MoverParameters->eimc[eimc_p_eped] * 0.999; diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 19e14c7d..073ac37b 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -780,6 +780,7 @@ public: double Ftmax = 0.0; /*- dla lokomotyw z silnikami indukcyjnymi -*/ double eimc[26]; + bool EIMCLogForce; // static std::vector const eimc_labels; /*-dla wagonow*/ double MaxLoad = 0.0; /*masa w T lub ilosc w sztukach - ladownosc*/ @@ -823,6 +824,7 @@ public: double AccN = 0.0; //przyspieszenie normalne w [m/s^2] double AccV = 0.0; double nrot = 0.0; + double WheelFlat = 0.0; /*! rotacja kol [obr/s]*/ double EnginePower = 0.0; /*! chwilowa moc silnikow*/ double dL = 0.0; double Fb = 0.0; double Ff = 0.0; /*przesuniecie, sila hamowania i tarcia*/ diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index d7799a8b..06bc5830 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -3734,6 +3734,10 @@ void TMoverParameters::ComputeTotalForce(double dt, double dt1, bool FullVer) Fb = -Fwheels*Sign(V); FTrain = 0; } + if (nrot < 0.1) + { + WheelFlat = sqrt(sqr(WheelFlat) + abs(Fwheels) / NAxles*Vel*0.000002); + } if (Sign(nrot * M_PI * WheelDiameter - V)*Sign(temp_nrot * M_PI * WheelDiameter - V) < 0) { SlippingWheels = false; @@ -4684,23 +4688,23 @@ double TMoverParameters::TractionForce(double dt) if ((abs((PosRatio + 9.66 * dizel_fill) * dmoment * 100) > 0.95 * Adhesive(RunningTrack.friction) * TotalMassxg)) { - PosRatio = 0; - tmp = 4; - Sandbox( true, range::local ); + //PosRatio = 0; + //tmp = 4; + //Sandbox( true, range::local ); } // przeciwposlizg if ((abs((PosRatio + 9.80 * dizel_fill) * dmoment * 100) > 0.95 * Adhesive(RunningTrack.friction) * TotalMassxg)) { - PosRatio = 0; - tmp = 9; - Sandbox( true, range::local ); + //PosRatio = 0; + //tmp = 9; + //Sandbox( true, range::local ); } // przeciwposlizg if ((SlippingWheels)) { // PosRatio = -PosRatio * 0; // serio -0 ??? PosRatio = 0; tmp = 9; - Sandbox( true, range::local ); + Sandbox( true, range::unit ); } // przeciwposlizg dizel_fill += Max0R(Min0R(PosRatio - dizel_fill, 0.1), -0.1) * 2 * @@ -4737,6 +4741,13 @@ double TMoverParameters::TractionForce(double dt) -Sign(V) * (DirAbsolute)*std::min( eimc[eimc_p_Ph] * 3.6 / (Vel != 0.0 ? Vel : 0.001), std::min(-eimc[eimc_p_Fh] * dizel_fill, eimv[eimv_FMAXMAX])); + double pr = dizel_fill; + if (EIMCLogForce) + pr = -log(1 - 4 * pr) / log(5); + eimv[eimv_Fr] = + -Sign(V) * (DirAbsolute)*std::min( + eimc[eimc_p_Ph] * 3.6 / (Vel != 0.0 ? Vel : 0.001), + std::min(-eimc[eimc_p_Fh] * pr, eimv[eimv_FMAXMAX])); //*Min0R(1,(Vel-eimc[eimc_p_Vh0])/(eimc[eimc_p_Vh1]-eimc[eimc_p_Vh0])) } else @@ -4748,9 +4759,13 @@ double TMoverParameters::TractionForce(double dt) eimv[eimv_Fmax] = eimv[eimv_Fful] * dizel_fill; // else // eimv[eimv_Fmax]:=Min0R(eimc[eimc_p_F0]*dizel_fill,eimv[eimv_Fful]); + double pr = dizel_fill; + if (EIMCLogForce) + pr = log(1 + 4 * pr) / log(5); + eimv[eimv_Fr] = eimv[eimv_Fful] * pr; } - eimv[eimv_ks] = eimv[eimv_Fmax] / eimv[eimv_FMAXMAX]; + eimv[eimv_ks] = eimv[eimv_Fr] / eimv[eimv_FMAXMAX]; eimv[eimv_df] = eimv[eimv_ks] * eimc[eimc_s_dfmax]; eimv[eimv_fp] = DirAbsolute * enrot * eimc[eimc_s_p] + eimv[eimv_df]; // do przemyslenia dzialanie pp z tmpV @@ -4921,7 +4936,7 @@ double TMoverParameters::v2n(void) n = V / (M_PI * WheelDiameter); // predkosc obrotowa wynikajaca z liniowej [obr/s] deltan = n - nrot; //"pochodna" prędkości obrotowej if (SlippingWheels) - if (std::abs(deltan) < 0.01) + if (std::abs(deltan) < 0.001) SlippingWheels = false; // wygaszenie poslizgu if (SlippingWheels) // nie ma zwiazku z predkoscia liniowa V { // McZapkie-221103: uszkodzenia kol podczas poslizgu @@ -7136,6 +7151,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) { if( asb == "Manual" ) { ASBType = 1; } else if( asb == "Automatic" ) { ASBType = 2; } + else if (asb == "Yes") { ASBType = 128; } } else { @@ -7384,6 +7400,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) { extract_value( eimc[ eimc_p_Imax ], "Imax", Input, "" ); extract_value( eimc[ eimc_p_abed ], "abed", Input, "" ); extract_value( eimc[ eimc_p_eped ], "edep", Input, "" ); + EIMCLogForce = ( extract_value( "eimclf", Input ) == "Yes" ); Flat = ( extract_value( "Flat", Input ) == "1" ); diff --git a/McZapkie/hamulce.cpp b/McZapkie/hamulce.cpp index 06e45445..a1156baf 100644 --- a/McZapkie/hamulce.cpp +++ b/McZapkie/hamulce.cpp @@ -1462,9 +1462,15 @@ 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)) + { + temp = 0; + speed = 3; + } if ((BrakeCyl->P() > temp)) - dv = -PFVd(BrakeCyl->P(), 0, 0.02 * SizeBC, temp) * dt; + dv = -PFVd(BrakeCyl->P(), 0, 0.02 * SizeBC * speed, temp) * dt; else if ((BrakeCyl->P() < temp)) dv = PFVa(BVP, BrakeCyl->P(), 0.02 * SizeBC, temp) * dt; else @@ -1995,7 +2001,8 @@ double TKE::GetPF( double const PP, double const dt, double const Vel ) // luzowanie CH // temp:=Max0R(BCP,LBP); IMP = Max0R(IMP / temp, Max0R(LBP, ASBP * int((BrakeStatus & b_asb) == b_asb))); - + if ((ASBP < 0.1) && ((BrakeStatus & b_asb) == b_asb)) + IMP = 0; // luzowanie CH if ((BCP > IMP + 0.005) || (Max0R(ImplsRes->P(), 8 * LBP) < 0.25)) dv = PFVd(BCP, 0, 0.05, IMP) * dt; diff --git a/Train.cpp b/Train.cpp index e6f4902b..a9aba82f 100644 --- a/Train.cpp +++ b/Train.cpp @@ -478,7 +478,7 @@ PyObject *TTrain::GetTrainState() { PyDict_SetItemString( dict, "velocity", PyGetFloat( mover->Vel ) ); PyDict_SetItemString( dict, "tractionforce", PyGetFloat( mover->Ft ) ); PyDict_SetItemString( dict, "slipping_wheels", PyGetBool( mover->SlippingWheels ) ); - PyDict_SetItemString( dict, "sanding", PyGetBool( mover->SlippingWheels )); + PyDict_SetItemString( dict, "sanding", PyGetBool( mover->SandDose )); // electric current data PyDict_SetItemString( dict, "traction_voltage", PyGetFloat( mover->RunningTraction.TractionVoltage ) ); PyDict_SetItemString( dict, "voltage", PyGetFloat( mover->Voltage ) ); @@ -4205,10 +4205,10 @@ bool TTrain::Update( double const Deltatime ) } if ((in < 8) && (p->MoverParameters->eimc[eimc_p_Pmax] > 1)) { - fEIMParams[1 + in][0] = p->MoverParameters->eimv[eimv_Fr]; + fEIMParams[1 + in][0] = p->MoverParameters->eimv[eimv_Fmax]; fEIMParams[1 + in][1] = Max0R(fEIMParams[1 + in][0], 0); fEIMParams[1 + in][2] = -Min0R(fEIMParams[1 + in][0], 0); - fEIMParams[1 + in][3] = p->MoverParameters->eimv[eimv_Fr] / + fEIMParams[1 + in][3] = p->MoverParameters->eimv[eimv_Fmax] / Max0R(p->MoverParameters->eimv[eimv_Fful], 1); fEIMParams[1 + in][4] = Max0R(fEIMParams[1 + in][3], 0); fEIMParams[1 + in][5] = -Min0R(fEIMParams[1 + in][3], 0); diff --git a/World.cpp b/World.cpp index 127a4aa6..f077fa2f 100644 --- a/World.cpp +++ b/World.cpp @@ -1061,12 +1061,12 @@ bool TWorld::Update() /* if (DebugModeFlag) if (Global::bActive) // nie przyspieszać, gdy jedzie w tle :) - if( Console::Pressed( GLFW_KEY_ESCAPE ) ) { + if (glfwGetKey(window, GLFW_KEY_PAUSE) == GLFW_PRESS) { // yB dodał przyspieszacz fizyki - Ground.Update(dt, n); - Ground.Update(dt, n); - Ground.Update(dt, n); - Ground.Update(dt, n); // 5 razy + Ground.Update(dt / updatecount, updatecount); + Ground.Update(dt / updatecount, updatecount); + Ground.Update(dt / updatecount, updatecount); + Ground.Update(dt / updatecount, updatecount); // 5 razy } */ // secondary fixed step simulation time routines @@ -1481,7 +1481,7 @@ TWorld::Update_UI() { uitextline2 += "; Ft: " + to_string( tmp->MoverParameters->Ft * 0.001f * tmp->MoverParameters->ActiveCab, 1 ) + ", Fb: " + to_string( tmp->MoverParameters->Fb * 0.001f, 1 ) - + ", Fr: " + to_string( tmp->MoverParameters->RunningTrack.friction, 2 ) + + ", Fr: " + to_string( tmp->MoverParameters->Adhesive(tmp->MoverParameters->RunningTrack.friction), 2 ) + ( tmp->MoverParameters->SlippingWheels ? " (!)" : "" ); uitextline2 += @@ -1680,15 +1680,15 @@ TWorld::Update_UI() { if( tmp == nullptr ) { break; } - - uitextline1 = - "vel: " + to_string( tmp->GetVelocity(), 2 ) + " km/h" + ( tmp->MoverParameters->SlippingWheels ? " (!)" : "" ) - + "; dist: " + to_string( tmp->MoverParameters->DistCounter, 2 ) + " km" - + "; pos: (" - + to_string( tmp->GetPosition().x, 2 ) + ", " - + to_string( tmp->GetPosition().y, 2 ) + ", " - + to_string( tmp->GetPosition().z, 2 ) - + ")"; + uitextline1 = + "vel: " + to_string(tmp->GetVelocity(), 2) + "/" + to_string(tmp->MoverParameters->nrot* M_PI * tmp->MoverParameters->WheelDiameter * 3.6, 2) + + " km/h" + (tmp->MoverParameters->SlippingWheels ? " (!)" : " ") + + "; dist: " + to_string(tmp->MoverParameters->DistCounter, 2) + " km" + + "; pos: (" + + to_string(tmp->GetPosition().x, 2) + ", " + + to_string(tmp->GetPosition().y, 2) + ", " + + to_string(tmp->GetPosition().z, 2) + "), PM=" + + to_string(tmp->MoverParameters->WheelFlat, 1) + " mm"; uitextline2 = "HamZ=" + to_string( tmp->MoverParameters->fBrakeCtrlPos, 1 )