From 72fa1c22a2676df122a0551defe2e72ac0eaece5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Thu, 21 Mar 2019 09:50:40 +0100 Subject: [PATCH] Vehicles with EIMCtrlType>0 use integrated controller instead of localbrake handle --- Driver.cpp | 39 +++++++++++++++++++++++++++++++++++---- Driver.h | 2 ++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Driver.cpp b/Driver.cpp index f14e01ac..2fdb2f99 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -2707,7 +2707,7 @@ bool TController::IncBrake() } } - standalone = standalone && ( mvControlling->EIMCtrlType == 0 ); + //standalone = standalone && ( mvControlling->EIMCtrlType == 0 ); if( true == standalone ) { if( mvControlling->EIMCtrlType > 0 ) { @@ -2855,9 +2855,11 @@ bool TController::DecBrake() } } if( !OK ) { - OK = DecBrakeEIM(); -// OK = mvOccupied->DecLocalBrakeLevel(2); + OK = mvOccupied->DecLocalBrakeLevel(2); } + if (!OK) { + OK = DecBrakeEIM(); + } if (mvOccupied->PipePress < 3.0) Need_BrakeRelease = true; break; @@ -3352,6 +3354,33 @@ void TController::SpeedCntrl(double DesiredSpeed) } }; +void TController::SetTimeControllers() +{ + +}; + +void TController::CheckTimeControllers() +{ + //1. Check the type of Main Brake Handle + + //2. Check the type of Secondary Brake Handle + + //3. Check the type od EIMCtrlType + if (mvOccupied->EIMCtrlType > 0) + { + if (mvOccupied->EIMCtrlType == 1) //traxx + { + if (mvOccupied->MainCtrlPos > 3) mvOccupied->MainCtrlPos = 5; + if (mvOccupied->MainCtrlPos < 3) mvOccupied->MainCtrlPos = 1; + } + else if (mvOccupied->EIMCtrlType == 2) //elf + { + if (mvOccupied->eimic > 0) mvOccupied->MainCtrlPos = 3; + if (mvOccupied->eimic < 0) mvOccupied->MainCtrlPos = 2; + } + } +}; + // otwieranie/zamykanie drzwi w składzie albo (tylko AI) EZT void TController::Doors( bool const Open, int const Side ) { @@ -4291,6 +4320,8 @@ TController::UpdateSituation(double dt) { auto const reactiontime = std::min( ReactionTime, 2.0 ); if( LastReactionTime < reactiontime ) { return; } + CheckTimeControllers(); + LastReactionTime -= reactiontime; // Ra: nie wiem czemu ReactionTime potrafi dostać 12 sekund, to jest przegięcie, bo przeżyna STÓJ // yB: otóż jest to jedna trzecia czasu napełniania na towarowym; może się przydać przy @@ -5509,7 +5540,7 @@ TController::UpdateSituation(double dt) { } } if (mvOccupied->BrakeSystem == TBrakeSystem::Pneumatic) // napełnianie uderzeniowe - if (mvOccupied->BrakeHandle == TBrakeHandle::FV4a) + if (mvOccupied->BrakeHandle == TBrakeHandle::FV4a || mvOccupied->BrakeHandle == TBrakeHandle::MHZ_6P) { if( mvOccupied->BrakeCtrlPos == -2 ) { mvOccupied->BrakeLevelSet( 0 ); diff --git a/Driver.h b/Driver.h index 0c0188e4..1b7c32bd 100644 --- a/Driver.h +++ b/Driver.h @@ -218,6 +218,8 @@ private: bool DecSpeedEIM(); void SpeedSet(); void SpeedCntrl(double DesiredSpeed); + void SetTimeControllers(); /*setting state of time controllers depending of desired action*/ + void CheckTimeControllers(); /*checking state of time controllers to reset them to stable position*/ double ESMVelocity(bool Main); bool UpdateHeating(); // uaktualnia informacje o prędkości