From a82040b097cc27ca9c263bdf2231af39e7b491f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Sat, 19 Oct 2019 22:15:04 +0200 Subject: [PATCH] Added velocity for brake intervention of speed control --- McZapkie/MOVER.h | 1 + McZapkie/Mover.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 8b8b9678..ca896909 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -706,6 +706,7 @@ struct speed_control { double FactorPneg = 0.5; double FactorIpos = 0.0; double FactorIneg = 0.0; + double BrakeInterventionVel = 30.0; }; class TMoverParameters diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 41edac64..f6a0a1d3 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -3987,7 +3987,7 @@ void TMoverParameters::UpdatePipePressure(double dt) || ( ( BrakeHandle != TBrakeHandle::MHZ_EN57 ) && ( BrakeHandle != TBrakeHandle::MHZ_K8P ) ) ) { double pos = BrakeCtrlPosR; - if (SpeedCtrlUnit.IsActive && SpeedCtrlUnit.BrakeIntervention && !SpeedCtrlUnit.Standby && (BrakeCtrlPos != Handle->GetPos(bh_EB))) { + if (SpeedCtrlUnit.IsActive && !SpeedCtrlUnit.Standby && SpeedCtrlUnit.BrakeIntervention && !SpeedCtrlUnit.Standby && (BrakeCtrlPos != Handle->GetPos(bh_EB))) { pos = Handle->GetPos(bh_NP); if (SpeedCtrlUnit.BrakeInterventionBraking) pos = Handle->GetPos(bh_FB); @@ -6670,10 +6670,10 @@ void TMoverParameters::CheckSpeedCtrl(double dt) double error = (std::max(SpeedCtrlValue + SpeedCtrlUnit.Offset, 0.0) - Vel); double factorP = error > 0 ? SpeedCtrlUnit.FactorPpos : SpeedCtrlUnit.FactorPneg; double eSCP = clamp(factorP * error, -1.2, 1.0); //P module - bool hydrounlock = (EngineType != TEngineType::DieselEngine) || (Vel < hydro_TC_UnlockSpeed); + bool retarder_not_work = (EngineType != TEngineType::DieselEngine) || (Vel < SpeedCtrlUnit.BrakeInterventionVel); if (eSCP < -1.0) { - SpeedCtrlUnit.BrakeInterventionBraking = (eSCP < -1.1) && hydrounlock; + SpeedCtrlUnit.BrakeInterventionBraking = (eSCP < -1.1) && retarder_not_work; eSCP = -1.0; } SpeedCtrlUnit.BrakeInterventionUnbraking = (eSCP > 0.0) || (Vel == 0.0); @@ -9741,6 +9741,8 @@ void TMoverParameters::LoadFIZ_SpeedControl(std::string const &Line) { extract_value(SpeedCtrlUnit.FactorPneg, "kPneg", Line, ""); extract_value(SpeedCtrlUnit.FactorIpos, "kIpos", Line, ""); extract_value(SpeedCtrlUnit.FactorIneg, "kIneg", Line, ""); + extract_value(SpeedCtrlUnit.BrakeInterventionVel, "BrakeIntMaxVel", Line, ""); + }