mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Preparation for rework of main brake handle usage by AI
This commit is contained in:
committed by
tmj-fstate
parent
3f12f9231f
commit
019a0c2cf6
51
Driver.cpp
51
Driver.cpp
@@ -3181,6 +3181,16 @@ bool TController::DecSpeedEIM()
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool TController::BrakeLevelSet(double b)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TController::BrakeLevelAdd(double b)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void TController::SpeedSet()
|
||||
{ // Ra: regulacja prędkości, wykonywana w każdym przebłysku świadomości AI
|
||||
// ma dokręcać do bezoporowych i zdejmować pozycje w przypadku przekroczenia prądu
|
||||
@@ -3356,13 +3366,52 @@ void TController::SpeedCntrl(double DesiredSpeed)
|
||||
|
||||
void TController::SetTimeControllers()
|
||||
{
|
||||
//1. Check the type of Main Brake Handle
|
||||
if (mvOccupied->BrakeSystem == TBrakeSystem::Pneumatic)
|
||||
{
|
||||
if (mvOccupied->Handle->Time)
|
||||
{
|
||||
if ((BrakeCtrlPosition > 0) && (mvOccupied->PipePress - 0.05 > mvOccupied->HighPipePress - BrakeCtrlPosition*0.25*mvOccupied->DeltaPipePress))
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_MB));
|
||||
else if ((BrakeCtrlPosition > 0) && (mvOccupied->PipePress + 0.05 < mvOccupied->HighPipePress - BrakeCtrlPosition*0.25*mvOccupied->DeltaPipePress))
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_RP));
|
||||
else if (BrakeCtrlPosition == 0)
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_RP));
|
||||
else if (BrakeCtrlPosition == -1)
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_FS));
|
||||
}
|
||||
if (mvOccupied->BrakeHandle == TBrakeHandle::FV4a) mvOccupied->BrakeLevelSet(BrakeCtrlPosition);
|
||||
}
|
||||
//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->LocalBrakePosA > 0.95 * LocalBrakePosNo) mvOccupied->MainCtrlPos = 0;
|
||||
}
|
||||
else if (mvOccupied->EIMCtrlType == 2) //elf
|
||||
{
|
||||
if (mvOccupied->LocalBrakePosA > 0.95 * LocalBrakePosNo) mvOccupied->MainCtrlPos = 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void TController::CheckTimeControllers()
|
||||
{
|
||||
//1. Check the type of Main Brake Handle
|
||||
|
||||
if (mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic && mvOccupied->Handle->TimeEP)
|
||||
{
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_EPN));
|
||||
}
|
||||
if (mvOccupied->BrakeSystem == TBrakeSystem::Pneumatic && mvOccupied->Handle->Time)
|
||||
{
|
||||
if (BrakeCtrlPosition > 0)
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_MB));
|
||||
else
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_RP));
|
||||
}
|
||||
//2. Check the type of Secondary Brake Handle
|
||||
|
||||
//3. Check the type od EIMCtrlType
|
||||
|
||||
3
Driver.h
3
Driver.h
@@ -216,6 +216,8 @@ private:
|
||||
bool DecBrakeEIM();
|
||||
bool IncSpeedEIM();
|
||||
bool DecSpeedEIM();
|
||||
bool BrakeLevelSet(double b);
|
||||
bool BrakeLevelAdd(double b);
|
||||
void SpeedSet();
|
||||
void SpeedCntrl(double DesiredSpeed);
|
||||
void SetTimeControllers(); /*setting state of time controllers depending of desired action*/
|
||||
@@ -310,6 +312,7 @@ private:
|
||||
double ReactionTime = 0.0; // czas reakcji Ra: czego i na co? świadomości AI
|
||||
double fBrakeTime = 0.0; // wpisana wartość jest zmniejszana do 0, gdy ujemna należy zmienić nastawę hamulca
|
||||
double BrakeChargingCooldown {}; // prevents the ai from trying to charge the train brake too frequently
|
||||
double BrakeCtrlPosition = 0.0; // intermediate position of main brake controller
|
||||
double LastReactionTime = 0.0;
|
||||
double fActionTime = 0.0; // czas używany przy regulacji prędkości i zamykaniu drzwi
|
||||
double m_radiocontroltime{ 0.0 }; // timer used to control speed of radio operations
|
||||
|
||||
Reference in New Issue
Block a user