mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 20:29:17 +02:00
Improved speed controller - speed can be selected by SecondControlPosition
This commit is contained in:
committed by
tmj-fstate
parent
aac16c55be
commit
0cb90a4e9a
20
Driver.cpp
20
Driver.cpp
@@ -2728,13 +2728,14 @@ bool TController::IncSpeed()
|
||||
{
|
||||
OK = mvControlling->IncMainCtrl(std::max(1,mvOccupied->MainCtrlPosNo/10));
|
||||
//tutaj jeszcze powinien być tempomat
|
||||
mvControlling->IncScndCtrl(1);
|
||||
|
||||
double SpeedCntrl = VelDesired;
|
||||
if (fProximityDist < 50)
|
||||
{
|
||||
SpeedCntrl = std::min(SpeedCntrl, VelNext);
|
||||
}
|
||||
mvControlling->RunCommand("SpeedCntrl", VelDesired, mvControlling->CabNo);
|
||||
this->SpeedCntrl(SpeedCntrl);
|
||||
|
||||
}
|
||||
break;
|
||||
case WheelsDriven:
|
||||
@@ -3011,6 +3012,21 @@ void TController::SpeedSet()
|
||||
}
|
||||
};
|
||||
|
||||
void TController::SpeedCntrl(double DesiredSpeed)
|
||||
{
|
||||
if (mvControlling->ScndCtrlPosNo == 1)
|
||||
{
|
||||
mvControlling->IncScndCtrl(1);
|
||||
mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabNo);
|
||||
}
|
||||
else if (mvControlling->ScndCtrlPosNo > 1)
|
||||
{
|
||||
int DesiredPos = 1 + mvControlling->ScndCtrlPosNo * ((DesiredSpeed - 1.0) / mvControlling->Vmax);
|
||||
while (mvControlling->ScndCtrlPos > DesiredPos) mvControlling->DecScndCtrl(1);
|
||||
while (mvControlling->ScndCtrlPos < DesiredPos) mvControlling->IncScndCtrl(1);
|
||||
}
|
||||
};
|
||||
|
||||
// otwieranie/zamykanie drzwi w składzie albo (tylko AI) EZT
|
||||
void TController::Doors( bool const Open, int const Side ) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user