mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 13:19:19 +02:00
Merge branch 'milek-dev' into gfx-work
This commit is contained in:
354
Driver.cpp
354
Driver.cpp
@@ -1406,9 +1406,12 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
// if (v==0.0) fAcc=-0.9; //hamowanie jeśli stop
|
// if (v==0.0) fAcc=-0.9; //hamowanie jeśli stop
|
||||||
continue; // i tyle wystarczy
|
continue; // i tyle wystarczy
|
||||||
}
|
}
|
||||||
else // event trzyma tylko jeśli VelNext=0, nawet po przejechaniu (nie powinno
|
else // event trzyma tylko jeśli VelNext=0, nawet po przejechaniu (nie powinno dotyczyć samochodów?)
|
||||||
// dotyczyć samochodów?)
|
a = (v > 0.0 ?
|
||||||
a = (v == 0.0 ? -1.0 : fAcc); // ruszanie albo hamowanie
|
fAcc :
|
||||||
|
mvOccupied->Vel < 0.01 ?
|
||||||
|
0.0 : // already standing still so no need to bother with brakes
|
||||||
|
-2.0 ); // ruszanie albo hamowanie
|
||||||
|
|
||||||
if ((a < fAcc) && (v == std::min(v, fNext))) {
|
if ((a < fAcc) && (v == std::min(v, fNext))) {
|
||||||
// mniejsze przyspieszenie to mniejsza możliwość rozpędzenia się albo konieczność hamowania
|
// mniejsze przyspieszenie to mniejsza możliwość rozpędzenia się albo konieczność hamowania
|
||||||
@@ -1763,15 +1766,10 @@ void TController::Activation()
|
|||||||
if (iDirection)
|
if (iDirection)
|
||||||
{ // jeśli jest ustalony kierunek
|
{ // jeśli jest ustalony kierunek
|
||||||
TDynamicObject *old = pVehicle, *d = pVehicle; // w tym siedzi AI
|
TDynamicObject *old = pVehicle, *d = pVehicle; // w tym siedzi AI
|
||||||
TController *drugi; // jakby były dwa, to zamienić miejscami, a nie robić wycieku pamięci
|
TController *drugi; // jakby były dwa, to zamienić miejscami, a nie robić wycieku pamięci poprzez nadpisanie
|
||||||
// poprzez nadpisanie
|
|
||||||
auto const localbrakelevel { mvOccupied->LocalBrakePosA };
|
auto const localbrakelevel { mvOccupied->LocalBrakePosA };
|
||||||
while (mvControlling->MainCtrlPos) // samo zapętlenie DecSpeed() nie wystarcza :/
|
ZeroSpeed();
|
||||||
DecSpeed(true); // wymuszenie zerowania nastawnika jazdy
|
ZeroDirection();
|
||||||
while (mvOccupied->ActiveDir < 0)
|
|
||||||
mvOccupied->DirectionForward(); // kierunek na 0
|
|
||||||
while (mvOccupied->ActiveDir > 0)
|
|
||||||
mvOccupied->DirectionBackward();
|
|
||||||
if (TestFlag(d->MoverParameters->Couplers[iDirectionOrder < 0 ? 1 : 0].CouplingFlag, ctrain_controll)) {
|
if (TestFlag(d->MoverParameters->Couplers[iDirectionOrder < 0 ? 1 : 0].CouplingFlag, ctrain_controll)) {
|
||||||
mvControlling->MainSwitch( false); // dezaktywacja czuwaka, jeśli przejście do innego członu
|
mvControlling->MainSwitch( false); // dezaktywacja czuwaka, jeśli przejście do innego członu
|
||||||
mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo); // zwolnienie hamulca w opuszczanym pojeździe
|
mvOccupied->DecLocalBrakeLevel(LocalBrakePosNo); // zwolnienie hamulca w opuszczanym pojeździe
|
||||||
@@ -1779,6 +1777,7 @@ void TController::Activation()
|
|||||||
// zaworze maszynisty, FVel6 po drugiej stronie nie luzuje
|
// zaworze maszynisty, FVel6 po drugiej stronie nie luzuje
|
||||||
mvOccupied->BrakeLevelSet(
|
mvOccupied->BrakeLevelSet(
|
||||||
mvOccupied->Handle->GetPos(bh_NP)); // odcięcie na zaworze maszynisty
|
mvOccupied->Handle->GetPos(bh_NP)); // odcięcie na zaworze maszynisty
|
||||||
|
BrakeLevelSet(gbh_NP); //ustawienie zmiennej GBH
|
||||||
}
|
}
|
||||||
mvOccupied->ActiveCab = mvOccupied->CabNo; // użytkownik moze zmienić ActiveCab wychodząc
|
mvOccupied->ActiveCab = mvOccupied->CabNo; // użytkownik moze zmienić ActiveCab wychodząc
|
||||||
mvOccupied->CabDeactivisation(); // tak jest w Train.cpp
|
mvOccupied->CabDeactivisation(); // tak jest w Train.cpp
|
||||||
@@ -2357,7 +2356,7 @@ double TController::BrakeAccFactor() const
|
|||||||
double Factor = 1.0;
|
double Factor = 1.0;
|
||||||
if( ( ActualProximityDist > fMinProximityDist )
|
if( ( ActualProximityDist > fMinProximityDist )
|
||||||
|| ( mvOccupied->Vel > VelDesired + fVelPlus ) ) {
|
|| ( mvOccupied->Vel > VelDesired + fVelPlus ) ) {
|
||||||
Factor += ( fBrakeReaction * ( mvOccupied->BrakeCtrlPosR < 0.5 ? 1.5 : 1 ) ) * mvOccupied->Vel / ( std::max( 0.0, ActualProximityDist ) + 1 ) * ( ( AccDesired - AbsAccS_pub ) / fAccThreshold );
|
Factor += ( fBrakeReaction * ( /*mvOccupied->BrakeCtrlPosR*/BrakeCtrlPosition < 0.5 ? 1.5 : 1 ) ) * mvOccupied->Vel / ( std::max( 0.0, ActualProximityDist ) + 1 ) * ( ( AccDesired - AbsAccS_pub ) / fAccThreshold );
|
||||||
}
|
}
|
||||||
return Factor;
|
return Factor;
|
||||||
}
|
}
|
||||||
@@ -2394,9 +2393,9 @@ void TController::SetDriverPsyche()
|
|||||||
}
|
}
|
||||||
if (mvControlling && mvOccupied)
|
if (mvControlling && mvOccupied)
|
||||||
{ // with Controlling do
|
{ // with Controlling do
|
||||||
if (mvControlling->MainCtrlPos < 3)
|
if (mvControlling->MainCtrlPowerPos() < 3)
|
||||||
ReactionTime = mvControlling->InitialCtrlDelay + ReactionTime;
|
ReactionTime = mvControlling->InitialCtrlDelay + ReactionTime;
|
||||||
if (mvOccupied->BrakeCtrlPos > 1)
|
if (/* GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition > 1)
|
||||||
ReactionTime = 0.5 * ReactionTime;
|
ReactionTime = 0.5 * ReactionTime;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -2491,17 +2490,16 @@ bool TController::PrepareEngine()
|
|||||||
{ // część wykonawcza dla sterowania przez komputer
|
{ // część wykonawcza dla sterowania przez komputer
|
||||||
if (mvControlling->ConvOvldFlag)
|
if (mvControlling->ConvOvldFlag)
|
||||||
{ // wywalił bezpiecznik nadmiarowy przetwornicy
|
{ // wywalił bezpiecznik nadmiarowy przetwornicy
|
||||||
while (DecSpeed(true))
|
ZeroSpeed();
|
||||||
; // zerowanie napędu
|
|
||||||
mvControlling->ConvOvldFlag = false; // reset nadmiarowego
|
mvControlling->ConvOvldFlag = false; // reset nadmiarowego
|
||||||
}
|
}
|
||||||
else if (false == IsLineBreakerClosed) {
|
else if (false == IsLineBreakerClosed) {
|
||||||
while (DecSpeed(true))
|
ZeroSpeed();
|
||||||
; // zerowanie napędu
|
|
||||||
if( mvOccupied->TrainType == dt_SN61 ) {
|
if( mvOccupied->TrainType == dt_SN61 ) {
|
||||||
// specjalnie dla SN61 żeby nie zgasł
|
// specjalnie dla SN61 żeby nie zgasł
|
||||||
if( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 ) {
|
while( ( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 )
|
||||||
mvControlling->IncMainCtrl( 1 );
|
&& ( mvControlling->IncMainCtrl( 1 ) ) ) {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( ( mvControlling->EnginePowerSource.SourceType != TPowerSource::CurrentCollector )
|
if( ( mvControlling->EnginePowerSource.SourceType != TPowerSource::CurrentCollector )
|
||||||
@@ -2522,6 +2520,7 @@ bool TController::PrepareEngine()
|
|||||||
// enable train brake if it's off
|
// enable train brake if it's off
|
||||||
if( mvOccupied->fBrakeCtrlPos == mvOccupied->Handle->GetPos( bh_NP ) ) {
|
if( mvOccupied->fBrakeCtrlPos == mvOccupied->Handle->GetPos( bh_NP ) ) {
|
||||||
mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_RP ) );
|
mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_RP ) );
|
||||||
|
BrakeLevelSet(gbh_RP); // GBH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2560,9 +2559,7 @@ bool TController::ReleaseEngine() {
|
|||||||
VelDesired = 0.0;
|
VelDesired = 0.0;
|
||||||
AccDesired = std::min( AccDesired, -1.25 ); // hamuj solidnie
|
AccDesired = std::min( AccDesired, -1.25 ); // hamuj solidnie
|
||||||
ReactionTime = 0.1;
|
ReactionTime = 0.1;
|
||||||
while( DecSpeed( true ) ) {
|
ZeroSpeed();
|
||||||
; // zerowanie nastawników
|
|
||||||
}
|
|
||||||
IncBrake();
|
IncBrake();
|
||||||
// don't bother with the rest until we're standing still
|
// don't bother with the rest until we're standing still
|
||||||
return false;
|
return false;
|
||||||
@@ -2599,12 +2596,8 @@ bool TController::ReleaseEngine() {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while( DecSpeed( true ) ) {
|
ZeroSpeed();
|
||||||
; // zerowanie nastawników
|
ZeroDirection();
|
||||||
}
|
|
||||||
// set direction to neutral
|
|
||||||
while( ( mvOccupied->ActiveDir > 0 ) && ( mvOccupied->DirectionBackward() ) ) { ; }
|
|
||||||
while( ( mvOccupied->ActiveDir < 0 ) && ( mvOccupied->DirectionForward() ) ) { ; }
|
|
||||||
|
|
||||||
// zamykanie drzwi
|
// zamykanie drzwi
|
||||||
mvOccupied->OperateDoors( side::right, false );
|
mvOccupied->OperateDoors( side::right, false );
|
||||||
@@ -2716,14 +2709,22 @@ bool TController::IncBrake()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//standalone = standalone && ( mvControlling->EIMCtrlType == 0 );
|
||||||
|
|
||||||
if( true == standalone ) {
|
if( true == standalone ) {
|
||||||
OK = mvOccupied->IncLocalBrakeLevel(
|
if( mvControlling->EIMCtrlType > 0 ) {
|
||||||
1 + static_cast<int>( std::floor( 0.5 + std::fabs( AccDesired ) ) ) ); // hamowanie lokalnym bo luzem jedzie
|
OK = IncBrakeEIM();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OK = mvOccupied->IncLocalBrakeLevel(
|
||||||
|
1 + static_cast<int>( std::floor( 0.5 + std::fabs( AccDesired ) ) ) ); // hamowanie lokalnym bo luzem jedzie
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if( mvOccupied->BrakeCtrlPos + 1 == mvOccupied->BrakeCtrlPosNo ) {
|
if( /*GBH mvOccupied->BrakeCtrlPos*/ BrakeCtrlPosition + 1 == gbh_MAX ) {
|
||||||
if (AccDesired < -1.5) // hamowanie nagle
|
if (AccDesired < -1.5) // hamowanie nagle
|
||||||
OK = mvOccupied->BrakeLevelAdd(1.0);
|
OK = /*mvOccupied->*/BrakeLevelAdd(1.0); //GBH
|
||||||
else
|
else
|
||||||
OK = false;
|
OK = false;
|
||||||
}
|
}
|
||||||
@@ -2747,12 +2748,12 @@ bool TController::IncBrake()
|
|||||||
pos_corr += mvOccupied->Handle->GetCP()*0.2;
|
pos_corr += mvOccupied->Handle->GetCP()*0.2;
|
||||||
|
|
||||||
}
|
}
|
||||||
double deltaAcc = -AccDesired*BrakeAccFactor() - (fBrake_a0[0] + 4.0 * (mvOccupied->BrakeCtrlPosR - 1 - pos_corr)*fBrake_a1[0]);
|
double deltaAcc = -AccDesired*BrakeAccFactor() - (fBrake_a0[0] + 4.0 * (/*GBH mvOccupied->BrakeCtrlPosR*/BrakeCtrlPosition - 1 - pos_corr)*fBrake_a1[0]);
|
||||||
|
|
||||||
if( deltaAcc > fBrake_a1[0])
|
if( deltaAcc > fBrake_a1[0])
|
||||||
{
|
{
|
||||||
if( mvOccupied->BrakeCtrlPosR < 0.1 ) {
|
if( /*GBH mvOccupied->BrakeCtrlPosR*/BrakeCtrlPosition < 0.1 ) {
|
||||||
OK = mvOccupied->BrakeLevelAdd( BrakingInitialLevel );
|
OK = /*mvOccupied->*/BrakeLevelAdd( BrakingInitialLevel ); //GBH
|
||||||
/*
|
/*
|
||||||
// HACK: stronger braking to overcome SA134 engine behaviour
|
// HACK: stronger braking to overcome SA134 engine behaviour
|
||||||
if( ( mvOccupied->TrainType == dt_DMU )
|
if( ( mvOccupied->TrainType == dt_DMU )
|
||||||
@@ -2767,19 +2768,23 @@ bool TController::IncBrake()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OK = mvOccupied->BrakeLevelAdd( BrakingLevelIncrease );
|
OK = /*mvOccupied->*/BrakeLevelAdd( BrakingLevelIncrease ); //GBH
|
||||||
// brake harder if the acceleration is much higher than desired
|
// brake harder if the acceleration is much higher than desired
|
||||||
if( ( deltaAcc > 2 * fBrake_a1[ 0 ] )
|
/*if( ( deltaAcc > 2 * fBrake_a1[ 0 ] )
|
||||||
&& ( mvOccupied->BrakeCtrlPosR + BrakingLevelIncrease <= 5.0 ) ) {
|
&& ( mvOccupied->BrakeCtrlPosR + BrakingLevelIncrease <= 5.0 ) ) {
|
||||||
mvOccupied->BrakeLevelAdd( BrakingLevelIncrease );
|
mvOccupied->BrakeLevelAdd( BrakingLevelIncrease );
|
||||||
}
|
} GBH */
|
||||||
|
if ((deltaAcc > 2 * fBrake_a1[0])
|
||||||
|
&& (BrakeCtrlPosition + BrakingLevelIncrease <= 5.0)) {
|
||||||
|
/*mvOccupied->*/BrakeLevelAdd(BrakingLevelIncrease);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
OK = false;
|
OK = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( mvOccupied->BrakeCtrlPos > 0 ) {
|
if( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition > 0 ) {
|
||||||
mvOccupied->BrakeReleaser( 0 );
|
mvOccupied->BrakeReleaser( 0 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2844,20 +2849,25 @@ bool TController::DecBrake()
|
|||||||
OK = mvOccupied->DecLocalBrakeLevel(1 + floor(0.5 + fabs(AccDesired)));
|
OK = mvOccupied->DecLocalBrakeLevel(1 + floor(0.5 + fabs(AccDesired)));
|
||||||
break;
|
break;
|
||||||
case TBrakeSystem::Pneumatic:
|
case TBrakeSystem::Pneumatic:
|
||||||
deltaAcc = -AccDesired*BrakeAccFactor() - (fBrake_a0[0] + 4 * (mvOccupied->BrakeCtrlPosR-1.0)*fBrake_a1[0]);
|
deltaAcc = -AccDesired*BrakeAccFactor() - (fBrake_a0[0] + 4 * (/*GBH mvOccupied->BrakeCtrlPosR*/BrakeCtrlPosition -1.0)*fBrake_a1[0]);
|
||||||
if (deltaAcc < 0)
|
if (deltaAcc < 0)
|
||||||
{
|
{
|
||||||
if (mvOccupied->BrakeCtrlPosR > 0)
|
if (/*GBH mvOccupied->BrakeCtrlPosR*/BrakeCtrlPosition > 0)
|
||||||
{
|
{
|
||||||
OK = mvOccupied->BrakeLevelAdd(-0.25);
|
OK = /*mvOccupied->*/BrakeLevelAdd(-0.25);
|
||||||
//if ((deltaAcc < 5 * fBrake_a1[0]) && (mvOccupied->BrakeCtrlPosR >= 1.2))
|
//if ((deltaAcc < 5 * fBrake_a1[0]) && (mvOccupied->BrakeCtrlPosR >= 1.2))
|
||||||
// mvOccupied->BrakeLevelAdd(-1.0);
|
// mvOccupied->BrakeLevelAdd(-1.0);
|
||||||
if (mvOccupied->BrakeCtrlPosR < 0.74)
|
/* if (mvOccupied->BrakeCtrlPosR < 0.74) GBH */
|
||||||
mvOccupied->BrakeLevelSet(0.0);
|
if (BrakeCtrlPosition < 0.74)
|
||||||
|
/*mvOccupied->*/BrakeLevelSet(0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!OK)
|
if( !OK ) {
|
||||||
OK = mvOccupied->DecLocalBrakeLevel(2);
|
OK = mvOccupied->DecLocalBrakeLevel(2);
|
||||||
|
}
|
||||||
|
if (!OK) {
|
||||||
|
OK = DecBrakeEIM();
|
||||||
|
}
|
||||||
if (mvOccupied->PipePress < 3.0)
|
if (mvOccupied->PipePress < 3.0)
|
||||||
Need_BrakeRelease = true;
|
Need_BrakeRelease = true;
|
||||||
break;
|
break;
|
||||||
@@ -2942,7 +2952,7 @@ bool TController::IncSpeed()
|
|||||||
return false; // to nici z ruszania
|
return false; // to nici z ruszania
|
||||||
}
|
}
|
||||||
if (!mvControlling->FuseFlag) //&&mvControlling->StLinFlag) //yBARC
|
if (!mvControlling->FuseFlag) //&&mvControlling->StLinFlag) //yBARC
|
||||||
if ((mvControlling->MainCtrlPos == 0) ||
|
if ((mvControlling->IsMainCtrlNoPowerPos()) ||
|
||||||
(mvControlling->StLinFlag)) // youBy polecił dodać 2012-09-08 v367
|
(mvControlling->StLinFlag)) // youBy polecił dodać 2012-09-08 v367
|
||||||
// na pozycji 0 przejdzie, a na pozostałych będzie czekać, aż się załączą liniowe (zgaśnie DelayCtrlFlag)
|
// na pozycji 0 przejdzie, a na pozostałych będzie czekać, aż się załączą liniowe (zgaśnie DelayCtrlFlag)
|
||||||
if (Ready || (iDrivigFlags & movePress)) {
|
if (Ready || (iDrivigFlags & movePress)) {
|
||||||
@@ -3024,7 +3034,7 @@ bool TController::IncSpeed()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( ( mvControlling->Im == 0 )
|
if( ( mvControlling->Im == 0 )
|
||||||
&& ( mvControlling->MainCtrlPos > 2 ) ) {
|
&& ( mvControlling->MainCtrlPowerPos() > 1 ) ) {
|
||||||
// brak prądu na dalszych pozycjach
|
// brak prądu na dalszych pozycjach
|
||||||
// nie załączona lokomotywa albo wywalił nadmiarowy
|
// nie załączona lokomotywa albo wywalił nadmiarowy
|
||||||
Need_TryAgain = true;
|
Need_TryAgain = true;
|
||||||
@@ -3092,6 +3102,13 @@ bool TController::IncSpeed()
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TController::ZeroSpeed( bool const Enforce ) {
|
||||||
|
|
||||||
|
while( DecSpeed( Enforce ) ) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool TController::DecSpeed(bool force)
|
bool TController::DecSpeed(bool force)
|
||||||
{ // zmniejszenie prędkości (ale nie hamowanie)
|
{ // zmniejszenie prędkości (ale nie hamowanie)
|
||||||
bool OK = false; // domyślnie false, aby wyszło z pętli while
|
bool OK = false; // domyślnie false, aby wyszło z pętli while
|
||||||
@@ -3101,20 +3118,20 @@ bool TController::DecSpeed(bool force)
|
|||||||
iDrivigFlags &= ~moveIncSpeed; // usunięcie flagi jazdy
|
iDrivigFlags &= ~moveIncSpeed; // usunięcie flagi jazdy
|
||||||
if (force) // przy aktywacji kabiny jest potrzeba natychmiastowego wyzerowania
|
if (force) // przy aktywacji kabiny jest potrzeba natychmiastowego wyzerowania
|
||||||
if (mvControlling->MainCtrlPosNo > 0) // McZapkie-041003: wagon sterowniczy, np. EZT
|
if (mvControlling->MainCtrlPosNo > 0) // McZapkie-041003: wagon sterowniczy, np. EZT
|
||||||
mvControlling->DecMainCtrl(1 + (mvControlling->MainCtrlPos > 2 ? 1 : 0));
|
mvControlling->DecMainCtrl((mvControlling->MainCtrlPowerPos() > 1 ? 2 : 1));
|
||||||
mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania
|
mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania
|
||||||
return false;
|
return false;
|
||||||
case TEngineType::ElectricSeriesMotor:
|
case TEngineType::ElectricSeriesMotor:
|
||||||
OK = mvControlling->DecScndCtrl(2); // najpierw bocznik na zero
|
OK = mvControlling->DecScndCtrl(2); // najpierw bocznik na zero
|
||||||
if (!OK)
|
if (!OK)
|
||||||
OK = mvControlling->DecMainCtrl(1 + (mvControlling->MainCtrlPos > 2 ? 1 : 0));
|
OK = mvControlling->DecMainCtrl((mvControlling->MainCtrlPowerPos() > 1 ? 2 : 1));
|
||||||
mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania
|
mvControlling->AutoRelayCheck(); // sprawdzenie logiki sterowania
|
||||||
break;
|
break;
|
||||||
case TEngineType::Dumb:
|
case TEngineType::Dumb:
|
||||||
case TEngineType::DieselElectric:
|
case TEngineType::DieselElectric:
|
||||||
OK = mvControlling->DecScndCtrl(2);
|
OK = mvControlling->DecScndCtrl(2);
|
||||||
if (!OK)
|
if (!OK)
|
||||||
OK = mvControlling->DecMainCtrl(2 + (mvControlling->MainCtrlPos / 2));
|
OK = mvControlling->DecMainCtrl(2 + (mvControlling->MainCtrlPowerPos() / 2));
|
||||||
break;
|
break;
|
||||||
case TEngineType::ElectricInductionMotor:
|
case TEngineType::ElectricInductionMotor:
|
||||||
OK = DecSpeedEIM();
|
OK = DecSpeedEIM();
|
||||||
@@ -3133,12 +3150,14 @@ bool TController::DecSpeed(bool force)
|
|||||||
if (mvControlling->RList[mvControlling->MainCtrlPos].Mn > 0)
|
if (mvControlling->RList[mvControlling->MainCtrlPos].Mn > 0)
|
||||||
OK = mvControlling->DecMainCtrl(1);
|
OK = mvControlling->DecMainCtrl(1);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
while ((mvControlling->RList[mvControlling->MainCtrlPos].Mn > 0) &&
|
while( ( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn > 0 )
|
||||||
(mvControlling->MainCtrlPos > 1))
|
&& ( mvControlling->MainCtrlPowerPos() > 1 ) ) {
|
||||||
OK = mvControlling->DecMainCtrl(1);
|
OK = mvControlling->DecMainCtrl( 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
if (force) // przy aktywacji kabiny jest potrzeba natychmiastowego wyzerowania
|
if (force) // przy aktywacji kabiny jest potrzeba natychmiastowego wyzerowania
|
||||||
OK = mvControlling->DecMainCtrl(1 + (mvControlling->MainCtrlPos > 2 ? 1 : 0));
|
OK = mvControlling->DecMainCtrl((mvControlling->MainCtrlPowerPos() > 2 ? 2 : 1));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@@ -3166,6 +3185,22 @@ bool TController::DecSpeedEIM()
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TController::BrakeLevelSet(double b)
|
||||||
|
{ // ustawienie pozycji hamulca na wartość (b) w zakresie od -2 do BrakeCtrlPosNo
|
||||||
|
// jedyny dopuszczalny sposób przestawienia hamulca zasadniczego
|
||||||
|
if (BrakeCtrlPosition == b)
|
||||||
|
return; // nie przeliczać, jak nie ma zmiany
|
||||||
|
BrakeCtrlPosition = clamp(b, (double)gbh_MIN, (double)gbh_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TController::BrakeLevelAdd(double b)
|
||||||
|
{ // dodanie wartości (b) do pozycji hamulca (w tym ujemnej)
|
||||||
|
// zwraca false, gdy po dodaniu było by poza zakresem
|
||||||
|
BrakeLevelSet(BrakeCtrlPosition + b);
|
||||||
|
return b > 0.0 ? (BrakeCtrlPosition < gbh_MAX) :
|
||||||
|
(BrakeCtrlPosition > -1.0); // true, jeśli można kontynuować
|
||||||
|
}
|
||||||
|
|
||||||
void TController::SpeedSet()
|
void TController::SpeedSet()
|
||||||
{ // Ra: regulacja prędkości, wykonywana w każdym przebłysku świadomości AI
|
{ // 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
|
// ma dokręcać do bezoporowych i zdejmować pozycje w przypadku przekroczenia prądu
|
||||||
@@ -3238,8 +3273,7 @@ void TController::SpeedSet()
|
|||||||
if( ( false == mvControlling->StLinFlag )
|
if( ( false == mvControlling->StLinFlag )
|
||||||
&& ( false == mvControlling->DelayCtrlFlag ) ) {
|
&& ( false == mvControlling->DelayCtrlFlag ) ) {
|
||||||
// styczniki liniowe rozłączone yBARC
|
// styczniki liniowe rozłączone yBARC
|
||||||
while( DecSpeed() )
|
ZeroSpeed();
|
||||||
; // zerowanie napędu
|
|
||||||
}
|
}
|
||||||
else if (Ready || (iDrivigFlags & movePress)) // o ile może jechać
|
else if (Ready || (iDrivigFlags & movePress)) // o ile może jechać
|
||||||
if (fAccGravity < -0.10) // i jedzie pod górę większą niż 10 promil
|
if (fAccGravity < -0.10) // i jedzie pod górę większą niż 10 promil
|
||||||
@@ -3340,6 +3374,74 @@ 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->Handle->GetCP() - 0.05 > mvOccupied->HighPipePress - BrakeCtrlPosition*0.25*mvOccupied->DeltaPipePress))
|
||||||
|
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_FB));
|
||||||
|
else if ((BrakeCtrlPosition > 0) && (mvOccupied->Handle->GetCP() + 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));
|
||||||
|
else if (BrakeCtrlPosition == -2)
|
||||||
|
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_NP));
|
||||||
|
}
|
||||||
|
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) mvOccupied->MainCtrlPos = 0;
|
||||||
|
}
|
||||||
|
else if (mvOccupied->EIMCtrlType == 2) //elf
|
||||||
|
{
|
||||||
|
if (mvOccupied->LocalBrakePosA > 0.95) 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
|
||||||
|
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
|
// otwieranie/zamykanie drzwi w składzie albo (tylko AI) EZT
|
||||||
void TController::Doors( bool const Open, int const Side ) {
|
void TController::Doors( bool const Open, int const Side ) {
|
||||||
|
|
||||||
@@ -4013,7 +4115,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
// Ra: odluźnianie przeładowanych lokomotyw, ciągniętych na zimno - prowizorka...
|
// Ra: odluźnianie przeładowanych lokomotyw, ciągniętych na zimno - prowizorka...
|
||||||
if (AIControllFlag) // skład jak dotąd był wyluzowany
|
if (AIControllFlag) // skład jak dotąd był wyluzowany
|
||||||
{
|
{
|
||||||
if( ( mvOccupied->BrakeCtrlPos == 0 ) // jest pozycja jazdy
|
if( ( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition == 0 ) // jest pozycja jazdy
|
||||||
&& ( ( vehicle->Hamulec->GetBrakeStatus() & b_dmg ) == 0 ) // brake isn't broken
|
&& ( ( vehicle->Hamulec->GetBrakeStatus() & b_dmg ) == 0 ) // brake isn't broken
|
||||||
&& ( vehicle->PipePress - 5.0 > -0.1 ) // jeśli ciśnienie jak dla jazdy
|
&& ( vehicle->PipePress - 5.0 > -0.1 ) // jeśli ciśnienie jak dla jazdy
|
||||||
&& ( vehicle->Hamulec->GetCRP() > vehicle->PipePress + 0.12 ) ) { // za dużo w zbiorniku
|
&& ( vehicle->Hamulec->GetCRP() > vehicle->PipePress + 0.12 ) ) { // za dużo w zbiorniku
|
||||||
@@ -4102,9 +4204,14 @@ TController::UpdateSituation(double dt) {
|
|||||||
// TODO: check if this situation still happens and the hack is still needed
|
// TODO: check if this situation still happens and the hack is still needed
|
||||||
if( ( false == AIControllFlag )
|
if( ( false == AIControllFlag )
|
||||||
&& ( iDrivigFlags & moveDoorOpened )
|
&& ( iDrivigFlags & moveDoorOpened )
|
||||||
&& ( mvOccupied->Doors.close_control != control_t::driver )
|
&& ( mvOccupied->Doors.close_control != control_t::driver ) ) {
|
||||||
&& ( mvControlling->MainCtrlPos > ( mvControlling->EngineType != TEngineType::DieselEngine ? 0 : 1 ) ) ) { // for diesel 1st position is effectively 0
|
// for diesel engines react when engine is put past idle revolutions
|
||||||
Doors( false );
|
// for others straightforward master controller check
|
||||||
|
if( ( mvControlling->EngineType == TEngineType::DieselEngine ?
|
||||||
|
mvControlling->RList[ mvControlling->MainCtrlPos ].Mn > 0 :
|
||||||
|
mvControlling->MainCtrlPowerPos() > 0 ) ) {
|
||||||
|
Doors( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// basic situational ai operations
|
// basic situational ai operations
|
||||||
@@ -4165,7 +4272,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
// is moving
|
// is moving
|
||||||
if( ( fOverhead2 >= 0.0 ) || iOverheadZero ) {
|
if( ( fOverhead2 >= 0.0 ) || iOverheadZero ) {
|
||||||
// jeśli jazda bezprądowa albo z opuszczonym pantografem
|
// jeśli jazda bezprądowa albo z opuszczonym pantografem
|
||||||
while( DecSpeed( true ) ) { ; } // zerowanie napędu
|
ZeroSpeed();
|
||||||
}
|
}
|
||||||
if( ( fOverhead2 > 0.0 ) || iOverheadDown ) {
|
if( ( fOverhead2 > 0.0 ) || iOverheadDown ) {
|
||||||
// jazda z opuszczonymi pantografami
|
// jazda z opuszczonymi pantografami
|
||||||
@@ -4261,7 +4368,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
if( ( true == TestFlag( iDrivigFlags, moveStartHornNow ) )
|
if( ( true == TestFlag( iDrivigFlags, moveStartHornNow ) )
|
||||||
&& ( true == Ready )
|
&& ( true == Ready )
|
||||||
&& ( iEngineActive != 0 )
|
&& ( iEngineActive != 0 )
|
||||||
&& ( mvControlling->MainCtrlPos > 0 ) ) {
|
&& ( mvControlling->MainCtrlPowerPos() > 0 ) ) {
|
||||||
// uruchomienie trąbienia przed ruszeniem
|
// uruchomienie trąbienia przed ruszeniem
|
||||||
fWarningDuration = 0.3; // czas trąbienia
|
fWarningDuration = 0.3; // czas trąbienia
|
||||||
mvOccupied->WarningSignal = pVehicle->iHornWarning; // wysokość tonu (2=wysoki)
|
mvOccupied->WarningSignal = pVehicle->iHornWarning; // wysokość tonu (2=wysoki)
|
||||||
@@ -4274,6 +4381,10 @@ TController::UpdateSituation(double dt) {
|
|||||||
auto const reactiontime = std::min( ReactionTime, 2.0 );
|
auto const reactiontime = std::min( ReactionTime, 2.0 );
|
||||||
if( LastReactionTime < reactiontime ) { return; }
|
if( LastReactionTime < reactiontime ) { return; }
|
||||||
|
|
||||||
|
if (AIControllFlag) {
|
||||||
|
CheckTimeControllers();
|
||||||
|
}
|
||||||
|
|
||||||
LastReactionTime -= reactiontime;
|
LastReactionTime -= reactiontime;
|
||||||
// Ra: nie wiem czemu ReactionTime potrafi dostać 12 sekund, to jest przegięcie, bo przeżyna STÓJ
|
// 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
|
// yB: otóż jest to jedna trzecia czasu napełniania na towarowym; może się przydać przy
|
||||||
@@ -4393,12 +4504,13 @@ TController::UpdateSituation(double dt) {
|
|||||||
if( mvOccupied->SecuritySystem.Status > 1 ) {
|
if( mvOccupied->SecuritySystem.Status > 1 ) {
|
||||||
// jak zadziałało CA/SHP
|
// jak zadziałało CA/SHP
|
||||||
if( !mvOccupied->SecuritySystemReset() ) { // to skasuj
|
if( !mvOccupied->SecuritySystemReset() ) { // to skasuj
|
||||||
if( ( mvOccupied->BrakeCtrlPos == 0 )
|
if( ( /*mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition == 0 )
|
||||||
&& ( AccDesired > 0.0 )
|
&& ( AccDesired > 0.0 )
|
||||||
&& ( ( TestFlag( mvOccupied->SecuritySystem.Status, s_SHPebrake ) )
|
&& ( ( TestFlag( mvOccupied->SecuritySystem.Status, s_SHPebrake ) )
|
||||||
|| ( TestFlag( mvOccupied->SecuritySystem.Status, s_CAebrake ) ) ) ) {
|
|| ( TestFlag( mvOccupied->SecuritySystem.Status, s_CAebrake ) ) ) ) {
|
||||||
//!!! hm, może po prostu normalnie sterować hamulcem?
|
//!!! hm, może po prostu normalnie sterować hamulcem?
|
||||||
mvOccupied->BrakeLevelSet( 0 );
|
//mvOccupied->BrakeLevelSet( 0 ); GBH
|
||||||
|
BrakeLevelSet(gbh_RP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4781,7 +4893,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
// jeśli dociskanie w celu odczepienia
|
// jeśli dociskanie w celu odczepienia
|
||||||
// 3. faza odczepiania.
|
// 3. faza odczepiania.
|
||||||
SetVelocity(2, 0); // jazda w ustawionym kierunku z prędkością 2
|
SetVelocity(2, 0); // jazda w ustawionym kierunku z prędkością 2
|
||||||
if( ( mvControlling->MainCtrlPos > 0 )
|
if( ( mvControlling->MainCtrlPowerPos() > 0 )
|
||||||
|| ( mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic ) ) {
|
|| ( mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic ) ) {
|
||||||
// jeśli jazda
|
// jeśli jazda
|
||||||
WriteLog(mvOccupied->Name + " odczepianie w kierunku " + std::to_string(mvOccupied->DirAbsolute));
|
WriteLog(mvOccupied->Name + " odczepianie w kierunku " + std::to_string(mvOccupied->DirAbsolute));
|
||||||
@@ -4800,7 +4912,8 @@ TController::UpdateSituation(double dt) {
|
|||||||
// (ustalić po czym poznać taki tor)
|
// (ustalić po czym poznać taki tor)
|
||||||
++n; // to liczymy człony jako jeden
|
++n; // to liczymy człony jako jeden
|
||||||
p->MoverParameters->BrakeReleaser(1); // wyluzuj pojazd, aby dało się dopychać
|
p->MoverParameters->BrakeReleaser(1); // wyluzuj pojazd, aby dało się dopychać
|
||||||
p->MoverParameters->BrakeLevelSet(0); // hamulec na zero, aby nie hamował
|
// GBH p->MoverParameters->BrakeLevelSet(0); // hamulec na zero, aby nie hamował
|
||||||
|
BrakeLevelSet(gbh_RP);
|
||||||
if (n)
|
if (n)
|
||||||
{ // jeśli jeszcze nie koniec
|
{ // jeśli jeszcze nie koniec
|
||||||
p = p->Prev(); // kolejny w stronę czoła składu (licząc od tyłu), bo dociskamy
|
p = p->Prev(); // kolejny w stronę czoła składu (licząc od tyłu), bo dociskamy
|
||||||
@@ -4834,10 +4947,12 @@ TController::UpdateSituation(double dt) {
|
|||||||
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach
|
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach
|
||||||
// powino zostać wyłączone)
|
// powino zostać wyłączone)
|
||||||
// WriteLog("Zahamowanie składu");
|
// WriteLog("Zahamowanie składu");
|
||||||
mvOccupied->BrakeLevelSet(
|
if( mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic ) {
|
||||||
mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic ?
|
mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_EPB ) );
|
||||||
1 :
|
}
|
||||||
3 );
|
else {
|
||||||
|
BrakeCtrlPosition = 3;
|
||||||
|
}
|
||||||
double p = mvOccupied->BrakePressureActual.PipePressureVal;
|
double p = mvOccupied->BrakePressureActual.PipePressureVal;
|
||||||
if( p < 3.9 ) {
|
if( p < 3.9 ) {
|
||||||
// tu może być 0 albo -1 nawet
|
// tu może być 0 albo -1 nawet
|
||||||
@@ -4872,16 +4987,15 @@ TController::UpdateSituation(double dt) {
|
|||||||
if (iDrivigFlags & movePress)
|
if (iDrivigFlags & movePress)
|
||||||
{ // 4. faza odczepiania: zwolnij i zmień kierunek
|
{ // 4. faza odczepiania: zwolnij i zmień kierunek
|
||||||
SetVelocity(0, 0, stopJoin); // wyłączyć przyspieszanie
|
SetVelocity(0, 0, stopJoin); // wyłączyć przyspieszanie
|
||||||
if (!DecSpeed()) // jeśli już bardziej wyłączyć się nie da
|
ZeroSpeed();
|
||||||
{ // ponowna zmiana kierunku
|
// ponowna zmiana kierunku
|
||||||
WriteLog( mvOccupied->Name + " ponowna zmiana kierunku" );
|
WriteLog( mvOccupied->Name + " ponowna zmiana kierunku" );
|
||||||
DirectionForward(mvOccupied->ActiveDir < 0); // zmiana kierunku jazdy na właściwy
|
DirectionForward(mvOccupied->ActiveDir < 0); // zmiana kierunku jazdy na właściwy
|
||||||
iDrivigFlags &= ~movePress; // koniec dociskania
|
iDrivigFlags &= ~movePress; // koniec dociskania
|
||||||
JumpToNextOrder(); // zmieni światła
|
JumpToNextOrder(); // zmieni światła
|
||||||
TableClear(); // skanowanie od nowa
|
TableClear(); // skanowanie od nowa
|
||||||
iDrivigFlags &= ~moveStartHorn; // bez trąbienia przed ruszeniem
|
iDrivigFlags &= ~moveStartHorn; // bez trąbienia przed ruszeniem
|
||||||
SetVelocity(fShuntVelocity, fShuntVelocity); // ustawienie prędkości jazdy
|
SetVelocity(fShuntVelocity, fShuntVelocity); // ustawienie prędkości jazdy
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5427,7 +5541,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
// część wykonawcza tylko dla AI, dla człowieka jedynie napisy
|
// część wykonawcza tylko dla AI, dla człowieka jedynie napisy
|
||||||
|
|
||||||
// zapobieganie poslizgowi u nas
|
// zapobieganie poslizgowi u nas
|
||||||
if (mvControlling->SlippingWheels) {
|
if (mvControlling->SlippingWheels && mvControlling->EngineType != TEngineType::ElectricInductionMotor) {
|
||||||
|
|
||||||
if( false == mvControlling->DecScndCtrl( 2 ) ) {
|
if( false == mvControlling->DecScndCtrl( 2 ) ) {
|
||||||
// bocznik na zero
|
// bocznik na zero
|
||||||
@@ -5447,7 +5561,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
if( ( true == mvOccupied->RadioStopFlag ) // radio-stop
|
if( ( true == mvOccupied->RadioStopFlag ) // radio-stop
|
||||||
&& ( mvOccupied->Vel > 0.0 ) ) { // and still moving
|
&& ( mvOccupied->Vel > 0.0 ) ) { // and still moving
|
||||||
// if the radio-stop was issued don't waste effort trying to fight it
|
// if the radio-stop was issued don't waste effort trying to fight it
|
||||||
while( true == DecSpeed() ) { ; } // just throttle down...
|
ZeroSpeed(); // just throttle down...
|
||||||
return; // ...and don't touch any other controls
|
return; // ...and don't touch any other controls
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5493,17 +5607,18 @@ TController::UpdateSituation(double dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mvOccupied->BrakeSystem == TBrakeSystem::Pneumatic) // napełnianie uderzeniowe
|
if (mvOccupied->BrakeSystem == TBrakeSystem::Pneumatic) // napełnianie uderzeniowe
|
||||||
if (mvOccupied->BrakeHandle == TBrakeHandle::FV4a)
|
if (mvOccupied->BrakeHandle == TBrakeHandle::FV4a || mvOccupied->BrakeHandle == TBrakeHandle::MHZ_6P
|
||||||
|
|| mvOccupied->BrakeHandle == TBrakeHandle::M394)
|
||||||
{
|
{
|
||||||
if( mvOccupied->BrakeCtrlPos == -2 ) {
|
if( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition == -2 ) {
|
||||||
mvOccupied->BrakeLevelSet( 0 );
|
/*mvOccupied->*/BrakeLevelSet( gbh_RP );
|
||||||
}
|
}
|
||||||
if( ( mvOccupied->PipePress < 3.0 )
|
if( ( mvOccupied->PipePress < 3.0 )
|
||||||
&& ( AccDesired > -0.03 ) ) {
|
&& ( AccDesired > -0.03 ) ) {
|
||||||
mvOccupied->BrakeReleaser( 1 );
|
mvOccupied->BrakeReleaser( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( mvOccupied->BrakeCtrlPos == 0 )
|
if( ( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition == 0 )
|
||||||
&& ( AbsAccS < 0.03 )
|
&& ( AbsAccS < 0.03 )
|
||||||
&& ( AccDesired > -0.03 )
|
&& ( AccDesired > -0.03 )
|
||||||
&& ( VelDesired - mvOccupied->Vel > 2.0 ) ) {
|
&& ( VelDesired - mvOccupied->Vel > 2.0 ) ) {
|
||||||
@@ -5515,7 +5630,8 @@ TController::UpdateSituation(double dt) {
|
|||||||
if( ( iDrivigFlags & moveOerlikons )
|
if( ( iDrivigFlags & moveOerlikons )
|
||||||
|| ( true == IsCargoTrain ) ) {
|
|| ( true == IsCargoTrain ) ) {
|
||||||
// napełnianie w Oerlikonie
|
// napełnianie w Oerlikonie
|
||||||
mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_FS ) );
|
/* mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_FS ) ); GBH */
|
||||||
|
BrakeLevelSet(gbh_FS);
|
||||||
// don't charge the brakes too often, or we risk overcharging
|
// don't charge the brakes too often, or we risk overcharging
|
||||||
BrakeChargingCooldown = -120.0;
|
BrakeChargingCooldown = -120.0;
|
||||||
}
|
}
|
||||||
@@ -5526,9 +5642,10 @@ TController::UpdateSituation(double dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( mvOccupied->BrakeCtrlPos < 0 )
|
if( ( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition < 0 )
|
||||||
&& ( mvOccupied->EqvtPipePress > ( fReady < 0.25 ? 5.1 : 5.2 ) ) ) {
|
&& ( mvOccupied->EqvtPipePress > ( fReady < 0.25 ? 5.1 : 5.2 ) ) ) {
|
||||||
mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_RP ) );
|
/* GBH mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_RP ) ); */
|
||||||
|
BrakeLevelSet(gbh_RP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if LOGVELOCITY
|
#if LOGVELOCITY
|
||||||
@@ -5611,13 +5728,14 @@ TController::UpdateSituation(double dt) {
|
|||||||
if( false == TestFlag( iDrivigFlags, movePress ) ) {
|
if( false == TestFlag( iDrivigFlags, movePress ) ) {
|
||||||
// jeśli nie dociskanie
|
// jeśli nie dociskanie
|
||||||
if( AccDesired < -0.05 ) {
|
if( AccDesired < -0.05 ) {
|
||||||
while( true == DecSpeed() ) { ; } // jeśli hamujemy, to nie przyspieszamy
|
ZeroSpeed();
|
||||||
}
|
}
|
||||||
else if( ( vel > VelDesired )
|
else if( ( vel > VelDesired )
|
||||||
|| ( fAccGravity < -0.01 ?
|
|| ( fAccGravity < -0.01 ?
|
||||||
AccDesired < 0.0 :
|
AccDesired < 0.0 :
|
||||||
AbsAccS > AccDesired ) ) {
|
(AbsAccS > AccDesired && AccDesired < 0.75) ) ) {
|
||||||
// jak za bardzo przyspiesza albo prędkość przekroczona
|
// jak za bardzo przyspiesza albo prędkość przekroczona
|
||||||
|
// dodany wyjatek na "pelna w przod"
|
||||||
DecSpeed(); // pojedyncze cofnięcie pozycji, bo na zero to przesada
|
DecSpeed(); // pojedyncze cofnięcie pozycji, bo na zero to przesada
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5631,7 +5749,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
std::max( -0.2, fAccThreshold ) ) };
|
std::max( -0.2, fAccThreshold ) ) };
|
||||||
if( ( AccDesired <= accthreshold ) // jeśli hamować - u góry ustawia się hamowanie na fAccThreshold
|
if( ( AccDesired <= accthreshold ) // jeśli hamować - u góry ustawia się hamowanie na fAccThreshold
|
||||||
&& ( ( AbsAccS > AccDesired )
|
&& ( ( AbsAccS > AccDesired )
|
||||||
|| ( mvOccupied->BrakeCtrlPos < 0 ) ) ) {
|
|| ( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition < 0 ) ) ) {
|
||||||
// hamować bardziej, gdy aktualne opóźnienie hamowania mniejsze niż (AccDesired)
|
// hamować bardziej, gdy aktualne opóźnienie hamowania mniejsze niż (AccDesired)
|
||||||
IncBrake();
|
IncBrake();
|
||||||
}
|
}
|
||||||
@@ -5639,7 +5757,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
// przy odłączaniu nie zwalniamy tu hamulca
|
// przy odłączaniu nie zwalniamy tu hamulca
|
||||||
if( AbsAccS < AccDesired - 0.05 ) {
|
if( AbsAccS < AccDesired - 0.05 ) {
|
||||||
// jeśli opóźnienie większe od wymaganego (z histerezą) luzowanie, gdy za dużo
|
// jeśli opóźnienie większe od wymaganego (z histerezą) luzowanie, gdy za dużo
|
||||||
if( mvOccupied->BrakeCtrlPos >= 0 ) {
|
if( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition >= 0 ) {
|
||||||
DecBrake(); // tutaj zmniejszało o 1 przy odczepianiu
|
DecBrake(); // tutaj zmniejszało o 1 przy odczepianiu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5662,7 +5780,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
// u góry ustawia się hamowanie na fAccThreshold
|
// u góry ustawia się hamowanie na fAccThreshold
|
||||||
if( ( fBrakeTime < 0.0 )
|
if( ( fBrakeTime < 0.0 )
|
||||||
|| ( AccDesired < fAccGravity - 0.5 )
|
|| ( AccDesired < fAccGravity - 0.5 )
|
||||||
|| ( mvOccupied->BrakeCtrlPos <= 0 ) ) {
|
|| ( /*GBH mvOccupied->BrakeCtrlPos*/BrakeCtrlPosition <= 0 ) ) {
|
||||||
// jeśli upłynął czas reakcji hamulca, chyba że nagłe albo luzował
|
// jeśli upłynął czas reakcji hamulca, chyba że nagłe albo luzował
|
||||||
if( true == IncBrake() ) {
|
if( true == IncBrake() ) {
|
||||||
fBrakeTime =
|
fBrakeTime =
|
||||||
@@ -5735,13 +5853,15 @@ TController::UpdateSituation(double dt) {
|
|||||||
mvOccupied->IncLocalBrakeLevel( 1 );
|
mvOccupied->IncLocalBrakeLevel( 1 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_RP ) );
|
mvOccupied->BrakeLevelSet( mvOccupied->Handle->GetPos( bh_RP ) ); //GBH
|
||||||
|
BrakeLevelSet(gbh_RP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break; // rzeczy robione przy jezdzie
|
break; // rzeczy robione przy jezdzie
|
||||||
} // switch (OrderList[OrderPos])
|
} // switch (OrderList[OrderPos])
|
||||||
|
if (AIControllFlag) SetTimeControllers();
|
||||||
}
|
}
|
||||||
|
|
||||||
// configures vehicle heating given current situation; returns: true if vehicle can be operated normally, false otherwise
|
// configures vehicle heating given current situation; returns: true if vehicle can be operated normally, false otherwise
|
||||||
@@ -6400,21 +6520,35 @@ void TController::TakeControl(bool yes)
|
|||||||
|
|
||||||
void TController::DirectionForward(bool forward)
|
void TController::DirectionForward(bool forward)
|
||||||
{ // ustawienie jazdy do przodu dla true i do tyłu dla false (zależy od kabiny)
|
{ // ustawienie jazdy do przodu dla true i do tyłu dla false (zależy od kabiny)
|
||||||
while (mvControlling->MainCtrlPos) // samo zapętlenie DecSpeed() nie wystarcza
|
ZeroSpeed( true ); // TODO: check if force switch is needed anymore here
|
||||||
DecSpeed(true); // wymuszenie zerowania nastawnika jazdy, inaczej się może zawiesić
|
if( forward ) {
|
||||||
if (forward)
|
// do przodu w obecnej kabinie
|
||||||
while (mvOccupied->ActiveDir <= 0)
|
while( ( mvOccupied->ActiveDir <= 0 )
|
||||||
mvOccupied->DirectionForward(); // do przodu w obecnej kabinie
|
&& ( mvOccupied->DirectionForward() ) ) {
|
||||||
else
|
; // all work is done in the header
|
||||||
while (mvOccupied->ActiveDir >= 0)
|
|
||||||
mvOccupied->DirectionBackward(); // do tyłu w obecnej kabinie
|
|
||||||
if( mvOccupied->TrainType == dt_SN61 ) {
|
|
||||||
// specjalnie dla SN61 żeby nie zgasł
|
|
||||||
if( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 ) {
|
|
||||||
mvControlling->IncMainCtrl( 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
else {
|
||||||
|
// do tyłu w obecnej kabinie
|
||||||
|
while( ( mvOccupied->ActiveDir >= 0 )
|
||||||
|
&& ( mvOccupied->DirectionBackward() ) ) {
|
||||||
|
; // all work is done in the header
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( mvOccupied->TrainType == dt_SN61 ) {
|
||||||
|
// specjalnie dla SN61 żeby nie zgasł
|
||||||
|
while( ( mvControlling->RList[ mvControlling->MainCtrlPos ].Mn == 0 )
|
||||||
|
&& ( mvControlling->IncMainCtrl( 1 ) ) ) {
|
||||||
|
; // all work is done in the header
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TController::ZeroDirection() {
|
||||||
|
|
||||||
|
while( ( mvOccupied->ActiveDir > 0 ) && ( mvOccupied->DirectionBackward() ) ) { ; }
|
||||||
|
while( ( mvOccupied->ActiveDir < 0 ) && ( mvOccupied->DirectionForward() ) ) { ; }
|
||||||
|
}
|
||||||
|
|
||||||
Mtable::TTrainParameters const *
|
Mtable::TTrainParameters const *
|
||||||
TController::TrainTimetable() const {
|
TController::TrainTimetable() const {
|
||||||
|
|||||||
13
Driver.h
13
Driver.h
@@ -169,6 +169,12 @@ static const int maxorders = 64; // ilość rozkazów w tabelce
|
|||||||
static const int maxdriverfails = 4; // ile błędów może zrobić AI zanim zmieni nastawienie
|
static const int maxdriverfails = 4; // ile błędów może zrobić AI zanim zmieni nastawienie
|
||||||
extern bool WriteLogFlag; // logowanie parametrów fizycznych
|
extern bool WriteLogFlag; // logowanie parametrów fizycznych
|
||||||
static const int BrakeAccTableSize = 20;
|
static const int BrakeAccTableSize = 20;
|
||||||
|
|
||||||
|
static const int gbh_NP = -2; //odciecie w hamulcu ogolnym
|
||||||
|
static const int gbh_RP = 0; //jazda w hamulcu ogolnym
|
||||||
|
static const int gbh_FS = -1; //napelnianie uderzeniowe w hamulcu ogolnym
|
||||||
|
static const int gbh_MIN = -2; //minimalna pozycja w hamulcu ogolnym
|
||||||
|
static const int gbh_MAX = 6; //maksymalna pozycja w hamulcu ogolnym
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
class TController {
|
class TController {
|
||||||
@@ -211,12 +217,17 @@ private:
|
|||||||
bool DecBrake();
|
bool DecBrake();
|
||||||
bool IncSpeed();
|
bool IncSpeed();
|
||||||
bool DecSpeed(bool force = false);
|
bool DecSpeed(bool force = false);
|
||||||
|
void ZeroSpeed( bool const Enforce = false );
|
||||||
bool IncBrakeEIM();
|
bool IncBrakeEIM();
|
||||||
bool DecBrakeEIM();
|
bool DecBrakeEIM();
|
||||||
bool IncSpeedEIM();
|
bool IncSpeedEIM();
|
||||||
bool DecSpeedEIM();
|
bool DecSpeedEIM();
|
||||||
|
void BrakeLevelSet(double b);
|
||||||
|
bool BrakeLevelAdd(double b);
|
||||||
void SpeedSet();
|
void SpeedSet();
|
||||||
void SpeedCntrl(double DesiredSpeed);
|
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);
|
double ESMVelocity(bool Main);
|
||||||
bool UpdateHeating();
|
bool UpdateHeating();
|
||||||
// uaktualnia informacje o prędkości
|
// uaktualnia informacje o prędkości
|
||||||
@@ -224,6 +235,7 @@ private:
|
|||||||
int CheckDirection();
|
int CheckDirection();
|
||||||
void WaitingSet(double Seconds);
|
void WaitingSet(double Seconds);
|
||||||
void DirectionForward(bool forward);
|
void DirectionForward(bool forward);
|
||||||
|
void ZeroDirection();
|
||||||
int OrderDirectionChange(int newdir, TMoverParameters *Vehicle);
|
int OrderDirectionChange(int newdir, TMoverParameters *Vehicle);
|
||||||
void Lights(int head, int rear);
|
void Lights(int head, int rear);
|
||||||
std::string StopReasonText() const;
|
std::string StopReasonText() const;
|
||||||
@@ -306,6 +318,7 @@ private:
|
|||||||
double ReactionTime = 0.0; // czas reakcji Ra: czego i na co? świadomości AI
|
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 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 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 LastReactionTime = 0.0;
|
||||||
double fActionTime = 0.0; // czas używany przy regulacji prędkości i zamykaniu drzwi
|
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
|
double m_radiocontroltime{ 0.0 }; // timer used to control speed of radio operations
|
||||||
|
|||||||
33
DynObj.cpp
33
DynObj.cpp
@@ -1589,6 +1589,8 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
Error("Parameters mismatch: dynamic object " + asName + " from \"" + BaseDir + "/" + Type_Name + "\"" );
|
Error("Parameters mismatch: dynamic object " + asName + " from \"" + BaseDir + "/" + Type_Name + "\"" );
|
||||||
return 0.0; // zerowa długość to brak pojazdu
|
return 0.0; // zerowa długość to brak pojazdu
|
||||||
}
|
}
|
||||||
|
// controller position
|
||||||
|
MoverParameters->MainCtrlPos = MoverParameters->MainCtrlNoPowerPos();
|
||||||
// ustawienie pozycji hamulca
|
// ustawienie pozycji hamulca
|
||||||
MoverParameters->LocalBrakePosA = 0.0;
|
MoverParameters->LocalBrakePosA = 0.0;
|
||||||
if (driveractive)
|
if (driveractive)
|
||||||
@@ -2956,7 +2958,7 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
}
|
}
|
||||||
MEDLogTime += dt1;
|
MEDLogTime += dt1;
|
||||||
|
|
||||||
if ((MoverParameters->Vel < 0.1) || (MoverParameters->MainCtrlPos > 0))
|
if ((MoverParameters->Vel < 0.1) || (MoverParameters->MainCtrlPowerPos() > 0))
|
||||||
{
|
{
|
||||||
MEDLogInactiveTime += dt1;
|
MEDLogInactiveTime += dt1;
|
||||||
}
|
}
|
||||||
@@ -4072,7 +4074,7 @@ void TDynamicObject::RenderSounds() {
|
|||||||
else {
|
else {
|
||||||
// basic clash
|
// basic clash
|
||||||
couplersounds.dsbBufferClamp
|
couplersounds.dsbBufferClamp
|
||||||
.gain( 0.65f )
|
.gain( 1.f )
|
||||||
.play( sound_flags::exclusive );
|
.play( sound_flags::exclusive );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4097,7 +4099,7 @@ void TDynamicObject::RenderSounds() {
|
|||||||
else {
|
else {
|
||||||
// basic clash
|
// basic clash
|
||||||
couplersounds.dsbCouplerStretch
|
couplersounds.dsbCouplerStretch
|
||||||
.gain( 0.65f )
|
.gain( 1.f )
|
||||||
.play( sound_flags::exclusive );
|
.play( sound_flags::exclusive );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4335,6 +4337,20 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co
|
|||||||
mdLowPolyInt = TModelsManager::GetModel(asModel, true);
|
mdLowPolyInt = TModelsManager::GetModel(asModel, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(token == "loads:") {
|
||||||
|
// default load visualization models overrides
|
||||||
|
// content provided as "key: value" pairs together enclosed in "{}"
|
||||||
|
// value can be optionally set of values enclosed in "[]" in which case one value will be picked randomly
|
||||||
|
while( ( ( token = parser.getToken<std::string>() ) != "" )
|
||||||
|
&& ( token != "}" ) ) {
|
||||||
|
if( token[ token.size() - 1 ] == ':' ) {
|
||||||
|
auto loadmodel { deserialize_random_set( parser ) };
|
||||||
|
replace_slashes( loadmodel );
|
||||||
|
LoadModelOverrides.emplace( token.erase( token.size() - 1 ), loadmodel );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else if( token == "brakemode:" ) {
|
else if( token == "brakemode:" ) {
|
||||||
// Ra 15-01: gałka nastawy hamulca
|
// Ra 15-01: gałka nastawy hamulca
|
||||||
parser.getTokens();
|
parser.getTokens();
|
||||||
@@ -5647,8 +5663,17 @@ TDynamicObject::LoadMMediaFile_mdload( std::string const &Name ) const {
|
|||||||
|
|
||||||
if( Name.empty() ) { return nullptr; }
|
if( Name.empty() ) { return nullptr; }
|
||||||
|
|
||||||
// try first specialized version of the load model, vehiclename_loadname
|
|
||||||
TModel3d *loadmodel { nullptr };
|
TModel3d *loadmodel { nullptr };
|
||||||
|
|
||||||
|
// check if we don't have model override for this load type
|
||||||
|
auto const lookup { LoadModelOverrides.find( Name ) };
|
||||||
|
if( lookup != LoadModelOverrides.end() ) {
|
||||||
|
loadmodel = TModelsManager::GetModel( asBaseDir + lookup->second, true );
|
||||||
|
// if the override was succesfully loaded call it a day
|
||||||
|
if( loadmodel != nullptr ) { return loadmodel; }
|
||||||
|
}
|
||||||
|
// regular routine if there's no override or it couldn't be loaded
|
||||||
|
// try first specialized version of the load model, vehiclename_loadname
|
||||||
auto const specializedloadfilename { asBaseDir + MoverParameters->TypeName + "_" + Name };
|
auto const specializedloadfilename { asBaseDir + MoverParameters->TypeName + "_" + Name };
|
||||||
if( ( true == FileExists( specializedloadfilename + ".e3d" ) )
|
if( ( true == FileExists( specializedloadfilename + ".e3d" ) )
|
||||||
|| ( true == FileExists( specializedloadfilename + ".t3d" ) ) ) {
|
|| ( true == FileExists( specializedloadfilename + ".t3d" ) ) ) {
|
||||||
|
|||||||
1
DynObj.h
1
DynObj.h
@@ -206,6 +206,7 @@ public:
|
|||||||
bool JointCabs{ false }; // flag for vehicles with multiple virtual 'cabs' sharing location and 3d model(s)
|
bool JointCabs{ false }; // flag for vehicles with multiple virtual 'cabs' sharing location and 3d model(s)
|
||||||
float fShade; // zacienienie: 0:normalnie, -1:w ciemności, +1:dodatkowe światło (brak koloru?)
|
float fShade; // zacienienie: 0:normalnie, -1:w ciemności, +1:dodatkowe światło (brak koloru?)
|
||||||
float LoadOffset { 0.f };
|
float LoadOffset { 0.f };
|
||||||
|
std::unordered_map<std::string, std::string> LoadModelOverrides; // potential overrides of default load visualization models
|
||||||
glm::vec3 InteriorLight { 0.9f * 255.f / 255.f, 0.9f * 216.f / 255.f, 0.9f * 176.f / 255.f }; // tungsten light. TODO: allow definition of light type?
|
glm::vec3 InteriorLight { 0.9f * 255.f / 255.f, 0.9f * 216.f / 255.f, 0.9f * 176.f / 255.f }; // tungsten light. TODO: allow definition of light type?
|
||||||
float InteriorLightLevel { 0.0f }; // current level of interior lighting
|
float InteriorLightLevel { 0.0f }; // current level of interior lighting
|
||||||
struct vehicle_section {
|
struct vehicle_section {
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ static int const maxcc = 4; /*max. ilosc odbierakow pradu*/
|
|||||||
//static int const MainBrakeMaxPos = 10; /*max. ilosc nastaw hamulca zasadniczego*/
|
//static int const MainBrakeMaxPos = 10; /*max. ilosc nastaw hamulca zasadniczego*/
|
||||||
static int const ManualBrakePosNo = 20; /*ilosc nastaw hamulca recznego*/
|
static int const ManualBrakePosNo = 20; /*ilosc nastaw hamulca recznego*/
|
||||||
static int const LightsSwitchPosNo = 16;
|
static int const LightsSwitchPosNo = 16;
|
||||||
|
static int const UniversalCtrlArraySize = 32; /*max liczba pozycji uniwersalnego nastawnika*/
|
||||||
|
|
||||||
/*uszkodzenia toru*/
|
/*uszkodzenia toru*/
|
||||||
static int const dtrack_railwear = 2;
|
static int const dtrack_railwear = 2;
|
||||||
@@ -572,6 +573,20 @@ struct TMotorParameters
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct TUniversalCtrl
|
||||||
|
{
|
||||||
|
int mode = 0; /*tryb pracy zadajnika - pomocnicze*/
|
||||||
|
double MinCtrlVal = 0.0; /*minimalna wartosc nastawy*/
|
||||||
|
double MaxCtrlVal = 0.0; /*maksymalna wartosc nastawy*/
|
||||||
|
double SetCtrlVal = 0.0; /*docelowa wartosc nastawy*/
|
||||||
|
double SpeedUp = 0.0; /*szybkosc zwiekszania nastawy*/
|
||||||
|
double SpeedDown = 0.0; /*szybkosc zmniejszania nastawy*/
|
||||||
|
int ReturnPosition = 0; /*pozycja na ktora odskakuje zadajnik*/
|
||||||
|
int NextPosFastInc = 0; /*nastepna duza pozycja przy przechodzeniu szybkim*/
|
||||||
|
int PrevPosFastDec = 0; /*poprzednia duza pozycja przy przechodzeniu szybkim*/
|
||||||
|
};
|
||||||
|
typedef TUniversalCtrl TUniversalCtrlTable[UniversalCtrlArraySize + 1]; /*tablica sterowania uniwersalnego nastawnika*/
|
||||||
|
|
||||||
struct TSecuritySystem
|
struct TSecuritySystem
|
||||||
{
|
{
|
||||||
int SystemType { 0 }; /*0: brak, 1: czuwak aktywny, 2: SHP/sygnalizacja kabinowa*/
|
int SystemType { 0 }; /*0: brak, 1: czuwak aktywny, 2: SHP/sygnalizacja kabinowa*/
|
||||||
@@ -941,6 +956,8 @@ public:
|
|||||||
bool MBrake = false; /*Czy jest hamulec reczny*/
|
bool MBrake = false; /*Czy jest hamulec reczny*/
|
||||||
double StopBrakeDecc = 0.0;
|
double StopBrakeDecc = 0.0;
|
||||||
TSecuritySystem SecuritySystem;
|
TSecuritySystem SecuritySystem;
|
||||||
|
TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/
|
||||||
|
int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/
|
||||||
|
|
||||||
/*-sekcja parametrow dla lokomotywy elektrycznej*/
|
/*-sekcja parametrow dla lokomotywy elektrycznej*/
|
||||||
TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/
|
TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/
|
||||||
@@ -1209,6 +1226,7 @@ public:
|
|||||||
int LightsPos = 0;
|
int LightsPos = 0;
|
||||||
int ActiveDir = 0; //czy lok. jest wlaczona i w ktorym kierunku:
|
int ActiveDir = 0; //czy lok. jest wlaczona i w ktorym kierunku:
|
||||||
//względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona
|
//względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona
|
||||||
|
int MaxMainCtrlPosNoDirChange { 0 }; // can't change reverser state with master controller set above this position
|
||||||
int CabNo = 0; //numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad
|
int CabNo = 0; //numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad
|
||||||
int DirAbsolute = 0; //zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1)
|
int DirAbsolute = 0; //zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1)
|
||||||
int ActiveCab = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład)
|
int ActiveCab = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład)
|
||||||
@@ -1357,6 +1375,7 @@ public:
|
|||||||
int DettachStatus(int ConnectNo);
|
int DettachStatus(int ConnectNo);
|
||||||
bool Dettach(int ConnectNo);
|
bool Dettach(int ConnectNo);
|
||||||
bool DirectionForward();
|
bool DirectionForward();
|
||||||
|
bool DirectionBackward( void );/*! kierunek ruchu*/
|
||||||
void BrakeLevelSet(double b);
|
void BrakeLevelSet(double b);
|
||||||
bool BrakeLevelAdd(double b);
|
bool BrakeLevelAdd(double b);
|
||||||
bool IncBrakeLevel(); // wersja na użytek AI
|
bool IncBrakeLevel(); // wersja na użytek AI
|
||||||
@@ -1393,6 +1412,9 @@ public:
|
|||||||
/*! glowny nastawnik:*/
|
/*! glowny nastawnik:*/
|
||||||
bool IncMainCtrl(int CtrlSpeed);
|
bool IncMainCtrl(int CtrlSpeed);
|
||||||
bool DecMainCtrl(int CtrlSpeed);
|
bool DecMainCtrl(int CtrlSpeed);
|
||||||
|
bool IsMainCtrlNoPowerPos() const; // whether the master controller is set to position which won't generate any extra power
|
||||||
|
int MainCtrlNoPowerPos() const; // highest setting of master controller which won't cause engine to generate extra power
|
||||||
|
int MainCtrlPowerPos() const; // current setting of master controller, relative to the highest setting not generating extra power
|
||||||
/*! pomocniczy nastawnik:*/
|
/*! pomocniczy nastawnik:*/
|
||||||
bool IncScndCtrl(int CtrlSpeed);
|
bool IncScndCtrl(int CtrlSpeed);
|
||||||
bool DecScndCtrl(int CtrlSpeed);
|
bool DecScndCtrl(int CtrlSpeed);
|
||||||
@@ -1456,7 +1478,6 @@ public:
|
|||||||
double ComputeRotatingWheel(double WForce, double dt, double n) const;
|
double ComputeRotatingWheel(double WForce, double dt, double n) const;
|
||||||
|
|
||||||
/*--funkcje dla lokomotyw*/
|
/*--funkcje dla lokomotyw*/
|
||||||
bool DirectionBackward(void);/*! kierunek ruchu*/
|
|
||||||
bool WaterPumpBreakerSwitch( bool State, range_t const Notify = range_t::consist ); // water pump breaker state toggle
|
bool WaterPumpBreakerSwitch( bool State, range_t const Notify = range_t::consist ); // water pump breaker state toggle
|
||||||
bool WaterPumpSwitch( bool State, range_t const Notify = range_t::consist ); // water pump state toggle
|
bool WaterPumpSwitch( bool State, range_t const Notify = range_t::consist ); // water pump state toggle
|
||||||
bool WaterPumpSwitchOff( bool State, range_t const Notify = range_t::consist ); // water pump state toggle
|
bool WaterPumpSwitchOff( bool State, range_t const Notify = range_t::consist ); // water pump state toggle
|
||||||
@@ -1560,6 +1581,7 @@ private:
|
|||||||
void LoadFIZ_MotorParamTable( std::string const &Input );
|
void LoadFIZ_MotorParamTable( std::string const &Input );
|
||||||
void LoadFIZ_Circuit( std::string const &Input );
|
void LoadFIZ_Circuit( std::string const &Input );
|
||||||
void LoadFIZ_RList( std::string const &Input );
|
void LoadFIZ_RList( std::string const &Input );
|
||||||
|
void LoadFIZ_UCList(std::string const &Input);
|
||||||
void LoadFIZ_DList( std::string const &Input );
|
void LoadFIZ_DList( std::string const &Input );
|
||||||
void LoadFIZ_FFList( std::string const &Input );
|
void LoadFIZ_FFList( std::string const &Input );
|
||||||
void LoadFIZ_LightsList( std::string const &Input );
|
void LoadFIZ_LightsList( std::string const &Input );
|
||||||
@@ -1574,12 +1596,14 @@ private:
|
|||||||
bool readMPTDieselEngine( std::string const &line );
|
bool readMPTDieselEngine( std::string const &line );
|
||||||
bool readBPT(/*int const ln,*/ std::string const &line); //Q 20160721
|
bool readBPT(/*int const ln,*/ std::string const &line); //Q 20160721
|
||||||
bool readRList( std::string const &Input );
|
bool readRList( std::string const &Input );
|
||||||
|
bool readUCList(std::string const &Input);
|
||||||
bool readDList( std::string const &line );
|
bool readDList( std::string const &line );
|
||||||
bool readFFList( std::string const &line );
|
bool readFFList( std::string const &line );
|
||||||
bool readWWList( std::string const &line );
|
bool readWWList( std::string const &line );
|
||||||
bool readLightsList( std::string const &Input );
|
bool readLightsList( std::string const &Input );
|
||||||
void BrakeValveDecode( std::string const &s ); //Q 20160719
|
void BrakeValveDecode( std::string const &s ); //Q 20160719
|
||||||
void BrakeSubsystemDecode(); //Q 20160719
|
void BrakeSubsystemDecode(); //Q 20160719
|
||||||
|
bool EIMDirectionChangeAllow( void );
|
||||||
};
|
};
|
||||||
|
|
||||||
//double Distance(TLocation Loc1, TLocation Loc2, TDimension Dim1, TDimension Dim2);
|
//double Distance(TLocation Loc1, TLocation Loc2, TDimension Dim1, TDimension Dim2);
|
||||||
|
|||||||
@@ -502,7 +502,7 @@ bool TMoverParameters::Dettach(int ConnectNo)
|
|||||||
|
|
||||||
bool TMoverParameters::DirectionForward()
|
bool TMoverParameters::DirectionForward()
|
||||||
{
|
{
|
||||||
if ((MainCtrlPosNo > 0) && (ActiveDir < 1) && (MainCtrlPos == 0))
|
if ((MainCtrlPosNo > 0) && (ActiveDir < 1) && (MainCtrlPos <= MaxMainCtrlPosNoDirChange) && (EIMDirectionChangeAllow()))
|
||||||
{
|
{
|
||||||
++ActiveDir;
|
++ActiveDir;
|
||||||
DirAbsolute = ActiveDir * CabNo;
|
DirAbsolute = ActiveDir * CabNo;
|
||||||
@@ -512,7 +512,7 @@ bool TMoverParameters::DirectionForward()
|
|||||||
SendCtrlToNext("Direction", ActiveDir, CabNo);
|
SendCtrlToNext("Direction", ActiveDir, CabNo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((ActiveDir == 1) && (MainCtrlPos == 0) && (TrainType == dt_EZT) && (EngineType != TEngineType::ElectricInductionMotor))
|
else if ((ActiveDir == 1) && (IsMainCtrlNoPowerPos()) && (TrainType == dt_EZT) && (EngineType != TEngineType::ElectricInductionMotor))
|
||||||
return MinCurrentSwitch(true); //"wysoki rozruch" EN57
|
return MinCurrentSwitch(true); //"wysoki rozruch" EN57
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
@@ -641,7 +641,7 @@ TMoverParameters::CurrentSwitch(bool const State) {
|
|||||||
// for SM42/SP42
|
// for SM42/SP42
|
||||||
if( ( EngineType == TEngineType::DieselElectric )
|
if( ( EngineType == TEngineType::DieselElectric )
|
||||||
&& ( true == ShuntModeAllow )
|
&& ( true == ShuntModeAllow )
|
||||||
&& ( MainCtrlPos == 0 ) ) {
|
&& ( IsMainCtrlNoPowerPos() ) ) {
|
||||||
ShuntMode = State;
|
ShuntMode = State;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1732,17 +1732,17 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed)
|
|||||||
|
|
||||||
case TEngineType::DieselEngine:
|
case TEngineType::DieselEngine:
|
||||||
{
|
{
|
||||||
if( CtrlSpeed > 1 ) {
|
if( CtrlSpeed > 1 ) {
|
||||||
while( MainCtrlPos < MainCtrlPosNo ) {
|
while( ( MainCtrlPos < MainCtrlPosNo )
|
||||||
IncMainCtrl( 1 );
|
&& ( IncMainCtrl( 1 ) ) ) {
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
++MainCtrlPos;
|
||||||
}
|
}
|
||||||
else {
|
CompressorAllow = ( MainCtrlPowerPos() > 0 );
|
||||||
++MainCtrlPos;
|
OK = true;
|
||||||
if( MainCtrlPos > 0 ) { CompressorAllow = true; }
|
|
||||||
else { CompressorAllow = false; }
|
|
||||||
}
|
|
||||||
OK = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1805,6 +1805,7 @@ bool TMoverParameters::DecMainCtrl(int CtrlSpeed)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// TBD, TODO: replace with mainctrlpowerpos() check?
|
||||||
if (MainCtrlPos > 0)
|
if (MainCtrlPos > 0)
|
||||||
{
|
{
|
||||||
if ((TrainType != dt_ET22) ||
|
if ((TrainType != dt_ET22) ||
|
||||||
@@ -1903,6 +1904,25 @@ bool TMoverParameters::DecMainCtrl(int CtrlSpeed)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMoverParameters::IsMainCtrlNoPowerPos() const {
|
||||||
|
// TODO: wrap controller pieces into a class for potential specializations, similar to brake subsystems
|
||||||
|
return MainCtrlPos <= MainCtrlNoPowerPos();
|
||||||
|
}
|
||||||
|
|
||||||
|
int TMoverParameters::MainCtrlNoPowerPos() const {
|
||||||
|
|
||||||
|
switch( EIMCtrlType ) {
|
||||||
|
case 1: { return 3; }
|
||||||
|
case 2: { return 3; }
|
||||||
|
default: { return 0; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int TMoverParameters::MainCtrlPowerPos() const {
|
||||||
|
|
||||||
|
return MainCtrlPos - MainCtrlNoPowerPos();
|
||||||
|
}
|
||||||
|
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
// Q: 20160710
|
// Q: 20160710
|
||||||
// zwiększenie bocznika
|
// zwiększenie bocznika
|
||||||
@@ -1911,14 +1931,13 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed)
|
|||||||
{
|
{
|
||||||
bool OK = false;
|
bool OK = false;
|
||||||
|
|
||||||
if ((MainCtrlPos == 0) && (CabNo != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) &&
|
if ((IsMainCtrlNoPowerPos()) && (CabNo != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) && (DynamicBrakeFlag))
|
||||||
(DynamicBrakeFlag))
|
|
||||||
{
|
{
|
||||||
OK = DynamicBrakeSwitch(false);
|
OK = DynamicBrakeSwitch(false);
|
||||||
}
|
}
|
||||||
else if ((ScndCtrlPosNo > 0) && (CabNo != 0) &&
|
else if ((ScndCtrlPosNo > 0) && (CabNo != 0) &&
|
||||||
!((TrainType == dt_ET42) &&
|
!((TrainType == dt_ET42) &&
|
||||||
((Imax == ImaxHi) || ((DynamicBrakeFlag) && (MainCtrlPos > 0)))))
|
((Imax == ImaxHi) || ((DynamicBrakeFlag) && (MainCtrlPowerPos() > 0)))))
|
||||||
{
|
{
|
||||||
// if (RList[MainCtrlPos].R=0) and (MainCtrlPos>0) and (ScndCtrlPos<ScndCtrlPosNo) and
|
// if (RList[MainCtrlPos].R=0) and (MainCtrlPos>0) and (ScndCtrlPos<ScndCtrlPosNo) and
|
||||||
// (not CoupledCtrl) then
|
// (not CoupledCtrl) then
|
||||||
@@ -1973,7 +1992,7 @@ bool TMoverParameters::DecScndCtrl(int CtrlSpeed)
|
|||||||
{
|
{
|
||||||
bool OK = false;
|
bool OK = false;
|
||||||
|
|
||||||
if ((MainCtrlPos == 0) && (CabNo != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) &&
|
if ((IsMainCtrlNoPowerPos()) && (CabNo != 0) && (TrainType == dt_ET42) && (ScndCtrlPos == 0) &&
|
||||||
!(DynamicBrakeFlag) && (CtrlSpeed == 1))
|
!(DynamicBrakeFlag) && (CtrlSpeed == 1))
|
||||||
{
|
{
|
||||||
// Ra: AI wywołuje z CtrlSpeed=2 albo gdy ScndCtrlPos>0
|
// Ra: AI wywołuje z CtrlSpeed=2 albo gdy ScndCtrlPos>0
|
||||||
@@ -2336,7 +2355,7 @@ bool TMoverParameters::DirectionBackward(void)
|
|||||||
DB = true; //
|
DB = true; //
|
||||||
return DB; // exit; TODO: czy dobrze przetlumaczone?
|
return DB; // exit; TODO: czy dobrze przetlumaczone?
|
||||||
}
|
}
|
||||||
if ((MainCtrlPosNo > 0) && (ActiveDir > -1) && (MainCtrlPos == 0))
|
if ((MainCtrlPosNo > 0) && (ActiveDir > -1) && (MainCtrlPos <= MaxMainCtrlPosNoDirChange) && (EIMDirectionChangeAllow()))
|
||||||
{
|
{
|
||||||
if (EngineType == TEngineType::WheelsDriven)
|
if (EngineType == TEngineType::WheelsDriven)
|
||||||
CabNo--;
|
CabNo--;
|
||||||
@@ -2354,6 +2373,13 @@ bool TMoverParameters::DirectionBackward(void)
|
|||||||
return DB;
|
return DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMoverParameters::EIMDirectionChangeAllow(void)
|
||||||
|
{
|
||||||
|
bool OK = false;
|
||||||
|
OK = (EngineType != TEngineType::ElectricInductionMotor || ((eimic <= 0) && (eimic_real <= 0) && (Vel < 0.1)));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
// Q: 20160710
|
// Q: 20160710
|
||||||
// załączenie przycisku przeciwpoślizgowego
|
// załączenie przycisku przeciwpoślizgowego
|
||||||
@@ -2956,7 +2982,7 @@ bool TMoverParameters::DynamicBrakeSwitch(bool Switch)
|
|||||||
{
|
{
|
||||||
bool DBS;
|
bool DBS;
|
||||||
|
|
||||||
if ((DynamicBrakeType == dbrake_switch) && (MainCtrlPos == 0))
|
if ((DynamicBrakeType == dbrake_switch) && (IsMainCtrlNoPowerPos()))
|
||||||
{
|
{
|
||||||
DynamicBrakeFlag = Switch;
|
DynamicBrakeFlag = Switch;
|
||||||
DBS = true;
|
DBS = true;
|
||||||
@@ -3250,7 +3276,7 @@ void TMoverParameters::CompressorCheck(double dt)
|
|||||||
if( ( true == CompressorAllow )
|
if( ( true == CompressorAllow )
|
||||||
&& ( true == CompressorAllowLocal )
|
&& ( true == CompressorAllowLocal )
|
||||||
&& ( true == Mains )
|
&& ( true == Mains )
|
||||||
&& ( MainCtrlPos > 0 ) ) {
|
&& ( MainCtrlPowerPos() > 0 ) ) {
|
||||||
if( Compressor < MaxCompressor ) {
|
if( Compressor < MaxCompressor ) {
|
||||||
if( ( EngineType == TEngineType::DieselElectric )
|
if( ( EngineType == TEngineType::DieselElectric )
|
||||||
&& ( CompressorPower > 0 ) ) {
|
&& ( CompressorPower > 0 ) ) {
|
||||||
@@ -3985,12 +4011,18 @@ void TMoverParameters::ComputeTotalForce(double dt) {
|
|||||||
&& ( std::abs(Fwheels) > TotalMassxg * Adhesive( RunningTrack.friction ) ) ) {
|
&& ( std::abs(Fwheels) > TotalMassxg * Adhesive( RunningTrack.friction ) ) ) {
|
||||||
SlippingWheels = true;
|
SlippingWheels = true;
|
||||||
}
|
}
|
||||||
if( true == SlippingWheels ) {
|
double temp_nrot = nrot;
|
||||||
|
if (true == SlippingWheels) {
|
||||||
|
|
||||||
double temp_nrot = ComputeRotatingWheel(Fwheels -
|
temp_nrot = ComputeRotatingWheel(Fwheels - Sign(nrot * M_PI * WheelDiameter - V) *
|
||||||
Sign(nrot * M_PI * WheelDiameter - V) *
|
Adhesive(RunningTrack.friction) * TotalMassxg, dt, nrot);
|
||||||
Adhesive(RunningTrack.friction) * TotalMassxg,
|
if (Sign(nrot * M_PI * WheelDiameter - V)*Sign(temp_nrot * M_PI * WheelDiameter - V) < 0)
|
||||||
dt, nrot);
|
{
|
||||||
|
SlippingWheels = false;
|
||||||
|
temp_nrot = V / M_PI / WheelDiameter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (true == SlippingWheels) {
|
||||||
Fwheels = Sign(temp_nrot * M_PI * WheelDiameter - V) * TotalMassxg * Adhesive(RunningTrack.friction);
|
Fwheels = Sign(temp_nrot * M_PI * WheelDiameter - V) * TotalMassxg * Adhesive(RunningTrack.friction);
|
||||||
if (Fwheels*Sign(V)>0)
|
if (Fwheels*Sign(V)>0)
|
||||||
{
|
{
|
||||||
@@ -4009,12 +4041,6 @@ void TMoverParameters::ComputeTotalForce(double dt) {
|
|||||||
{
|
{
|
||||||
WheelFlat = sqrt(square(WheelFlat) + abs(Fwheels) / NAxles*Vel*0.000002);
|
WheelFlat = sqrt(square(WheelFlat) + abs(Fwheels) / NAxles*Vel*0.000002);
|
||||||
}
|
}
|
||||||
if (Sign(nrot * M_PI * WheelDiameter - V)*Sign(temp_nrot * M_PI * WheelDiameter - V) < 0)
|
|
||||||
{
|
|
||||||
SlippingWheels = false;
|
|
||||||
temp_nrot = V / M_PI / WheelDiameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
nrot = temp_nrot;
|
nrot = temp_nrot;
|
||||||
}
|
}
|
||||||
@@ -4499,7 +4525,7 @@ double TMoverParameters::TractionForce( double dt ) {
|
|||||||
}
|
}
|
||||||
case TEngineType::DieselEngine: {
|
case TEngineType::DieselEngine: {
|
||||||
EnginePower = ( 2 * dizel_Mstand + dmoment ) * enrot * ( 2.0 * M_PI / 1000.0 );
|
EnginePower = ( 2 * dizel_Mstand + dmoment ) * enrot * ( 2.0 * M_PI / 1000.0 );
|
||||||
if( MainCtrlPos > 1 ) {
|
if( MainCtrlPowerPos() > 1 ) {
|
||||||
// dodatkowe opory z powodu sprezarki}
|
// dodatkowe opory z powodu sprezarki}
|
||||||
dmoment -= dizel_Mstand * ( 0.2 * enrot / dizel_nmax );
|
dmoment -= dizel_Mstand * ( 0.2 * enrot / dizel_nmax );
|
||||||
}
|
}
|
||||||
@@ -4696,7 +4722,7 @@ double TMoverParameters::TractionForce( double dt ) {
|
|||||||
auto const tmpV { nrot * Pirazy2 * 0.5 * WheelDiameter * DirAbsolute }; //*CabNo*ActiveDir;
|
auto const tmpV { nrot * Pirazy2 * 0.5 * WheelDiameter * DirAbsolute }; //*CabNo*ActiveDir;
|
||||||
// jazda manewrowa
|
// jazda manewrowa
|
||||||
if( true == ShuntMode ) {
|
if( true == ShuntMode ) {
|
||||||
if( ( true == Mains ) && ( MainCtrlPos > 0 ) ) {
|
if( ( true == Mains ) && ( MainCtrlPowerPos() > 0 ) ) {
|
||||||
Voltage = ( SST[ MainCtrlPos ].Umax * AnPos ) + ( SST[ MainCtrlPos ].Umin * ( 1.0 - AnPos ) );
|
Voltage = ( SST[ MainCtrlPos ].Umax * AnPos ) + ( SST[ MainCtrlPos ].Umin * ( 1.0 - AnPos ) );
|
||||||
// NOTE: very crude way to approximate power generated at current rpm instead of instant top output
|
// NOTE: very crude way to approximate power generated at current rpm instead of instant top output
|
||||||
// NOTE, TODO: doesn't take into account potentially increased revolutions if heating is on, fix it
|
// NOTE, TODO: doesn't take into account potentially increased revolutions if heating is on, fix it
|
||||||
@@ -4727,7 +4753,7 @@ double TMoverParameters::TractionForce( double dt ) {
|
|||||||
PosRatio = currentgenpower / DElist[MainCtrlPosNo].GenPower;
|
PosRatio = currentgenpower / DElist[MainCtrlPosNo].GenPower;
|
||||||
// stosunek mocy teraz do mocy max
|
// stosunek mocy teraz do mocy max
|
||||||
// NOTE: Mains in this context is working diesel engine
|
// NOTE: Mains in this context is working diesel engine
|
||||||
if( ( true == Mains ) && ( MainCtrlPos > 0 ) ) {
|
if( ( true == Mains ) && ( MainCtrlPowerPos() > 0 ) ) {
|
||||||
|
|
||||||
if( tmpV < ( Vhyp * power / DElist[ MainCtrlPosNo ].GenPower ) ) {
|
if( tmpV < ( Vhyp * power / DElist[ MainCtrlPosNo ].GenPower ) ) {
|
||||||
// czy na czesci prostej, czy na hiperboli
|
// czy na czesci prostej, czy na hiperboli
|
||||||
@@ -4829,7 +4855,7 @@ double TMoverParameters::TractionForce( double dt ) {
|
|||||||
Voltage = 0;
|
Voltage = 0;
|
||||||
|
|
||||||
// przekazniki bocznikowania, kazdy inny dla kazdej pozycji
|
// przekazniki bocznikowania, kazdy inny dla kazdej pozycji
|
||||||
if ((MainCtrlPos == 0) || (ShuntMode) || (false==Mains))
|
if ((IsMainCtrlNoPowerPos()) || (ShuntMode) || (false==Mains))
|
||||||
ScndCtrlPos = 0;
|
ScndCtrlPos = 0;
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@@ -5312,7 +5338,7 @@ bool TMoverParameters::FuseFlagCheck(void) const
|
|||||||
bool TMoverParameters::FuseOn(void)
|
bool TMoverParameters::FuseOn(void)
|
||||||
{
|
{
|
||||||
bool FO = false;
|
bool FO = false;
|
||||||
if ((MainCtrlPos == 0) && (ScndCtrlPos == 0) && (TrainType != dt_ET40) &&
|
if ((IsMainCtrlNoPowerPos()) && (ScndCtrlPos == 0) && (TrainType != dt_ET40) &&
|
||||||
((Mains) || (TrainType != dt_EZT)) && (!TestFlag(EngDmgFlag, 1)))
|
((Mains) || (TrainType != dt_EZT)) && (!TestFlag(EngDmgFlag, 1)))
|
||||||
{ // w ET40 jest blokada nastawnika, ale czy działa dobrze?
|
{ // w ET40 jest blokada nastawnika, ale czy działa dobrze?
|
||||||
SendCtrlToNext("FuseSwitch", 1, CabNo);
|
SendCtrlToNext("FuseSwitch", 1, CabNo);
|
||||||
@@ -5352,9 +5378,9 @@ double TMoverParameters::v2n(void)
|
|||||||
|
|
||||||
n = V / (M_PI * WheelDiameter); // predkosc obrotowa wynikajaca z liniowej [obr/s]
|
n = V / (M_PI * WheelDiameter); // predkosc obrotowa wynikajaca z liniowej [obr/s]
|
||||||
deltan = n - nrot; //"pochodna" prędkości obrotowej
|
deltan = n - nrot; //"pochodna" prędkości obrotowej
|
||||||
if (SlippingWheels)
|
/* if (SlippingWheels)
|
||||||
if (std::abs(deltan) < 0.001)
|
if (std::abs(deltan) < 0.001)
|
||||||
SlippingWheels = false; // wygaszenie poslizgu
|
SlippingWheels = false; // wygaszenie poslizgu */ //poslizg jest w innym miejscu wygaszany też
|
||||||
if (SlippingWheels) // nie ma zwiazku z predkoscia liniowa V
|
if (SlippingWheels) // nie ma zwiazku z predkoscia liniowa V
|
||||||
{ // McZapkie-221103: uszkodzenia kol podczas poslizgu
|
{ // McZapkie-221103: uszkodzenia kol podczas poslizgu
|
||||||
if (deltan > dmgn)
|
if (deltan > dmgn)
|
||||||
@@ -5800,7 +5826,7 @@ bool TMoverParameters::MotorConnectorsCheck() {
|
|||||||
( false == Mains )
|
( false == Mains )
|
||||||
|| ( true == FuseFlag )
|
|| ( true == FuseFlag )
|
||||||
|| ( true == StLinSwitchOff )
|
|| ( true == StLinSwitchOff )
|
||||||
|| ( MainCtrlPos == 0 )
|
|| ( IsMainCtrlNoPowerPos() )
|
||||||
|| ( ActiveDir == 0 ) };
|
|| ( ActiveDir == 0 ) };
|
||||||
|
|
||||||
if( connectorsoff ) { return false; }
|
if( connectorsoff ) { return false; }
|
||||||
@@ -5808,8 +5834,9 @@ bool TMoverParameters::MotorConnectorsCheck() {
|
|||||||
auto const connectorson {
|
auto const connectorson {
|
||||||
( true == StLinFlag )
|
( true == StLinFlag )
|
||||||
|| ( ( MainCtrlActualPos == 0 )
|
|| ( ( MainCtrlActualPos == 0 )
|
||||||
&& ( ( MainCtrlPos == 1 )
|
&& ( ( TrainType != dt_EZT ?
|
||||||
|| ( ( TrainType == dt_EZT ) && ( MainCtrlPos > 0 ) ) ) ) };
|
MainCtrlPowerPos() == 1 :
|
||||||
|
MainCtrlPowerPos() > 0 ) ) ) };
|
||||||
|
|
||||||
return connectorson;
|
return connectorson;
|
||||||
}
|
}
|
||||||
@@ -5977,6 +6004,10 @@ void TMoverParameters::CheckEIMIC(double dt)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
eimic -= clamp(-UniCtrlList[MainCtrlPos].SetCtrlVal + eimic, 0.0, dt * UniCtrlList[MainCtrlPos].SpeedDown); //odejmuj do X
|
||||||
|
eimic += clamp(UniCtrlList[MainCtrlPos].SetCtrlVal - eimic, 0.0, dt * UniCtrlList[MainCtrlPos].SpeedUp); //dodawaj do X
|
||||||
|
eimic = clamp(eimic, UniCtrlList[MainCtrlPos].MinCtrlVal, UniCtrlList[MainCtrlPos].MaxCtrlVal);
|
||||||
}
|
}
|
||||||
eimic = clamp(eimic, -1.0, 1.0);
|
eimic = clamp(eimic, -1.0, 1.0);
|
||||||
}
|
}
|
||||||
@@ -6057,7 +6088,7 @@ bool TMoverParameters::dizel_AutoGearCheck(void)
|
|||||||
{
|
{
|
||||||
if (dizel_engagestate > 0)
|
if (dizel_engagestate > 0)
|
||||||
dizel_EngageSwitch(0);
|
dizel_EngageSwitch(0);
|
||||||
if ((MainCtrlPos == 0) && (ScndCtrlActualPos > 0))
|
if ((IsMainCtrlNoPowerPos()) && (ScndCtrlActualPos > 0))
|
||||||
dizel_automaticgearstatus = -1;
|
dizel_automaticgearstatus = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -6145,12 +6176,13 @@ bool TMoverParameters::dizel_StartupCheck() {
|
|||||||
|
|
||||||
// test the fuel pump
|
// test the fuel pump
|
||||||
// TODO: add fuel pressure check
|
// TODO: add fuel pressure check
|
||||||
if( false == FuelPump.is_active ) {
|
if( ( false == FuelPump.is_active )
|
||||||
|
|| ( ( EngineType == TEngineType::DieselEngine ) && ( RList[ MainCtrlPos ].R == 0.0 ) ) ) {
|
||||||
engineisready = false;
|
engineisready = false;
|
||||||
if( FuelPump.start_type == start_t::manual ) {
|
// if( FuelPump.start_type == start_t::manual ) {
|
||||||
// with manual pump control startup procedure is done only once per starter switch press
|
// with manual pump control startup procedure is done only once per starter switch press
|
||||||
dizel_startup = false;
|
dizel_startup = false;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
// test the oil pump
|
// test the oil pump
|
||||||
if( ( false == OilPump.is_active )
|
if( ( false == OilPump.is_active )
|
||||||
@@ -6340,10 +6372,10 @@ double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt)
|
|||||||
if (hydro_TC) //jesli przetwornik momentu
|
if (hydro_TC) //jesli przetwornik momentu
|
||||||
{
|
{
|
||||||
//napelnianie przetwornika
|
//napelnianie przetwornika
|
||||||
if ((MainCtrlPos > 0) && (Mains) && (enrot>dizel_nmin*0.9))
|
if ((MainCtrlPowerPos() > 0) && (Mains) && (enrot>dizel_nmin*0.9))
|
||||||
hydro_TC_Fill += hydro_TC_FillRateInc * dt;
|
hydro_TC_Fill += hydro_TC_FillRateInc * dt;
|
||||||
//oproznianie przetwornika
|
//oproznianie przetwornika
|
||||||
if (((MainCtrlPos == 0) && (Vel<3))
|
if (((IsMainCtrlNoPowerPos()) && (Vel<3))
|
||||||
|| (!Mains)
|
|| (!Mains)
|
||||||
|| (enrot<dizel_nmin*0.8))
|
|| (enrot<dizel_nmin*0.8))
|
||||||
hydro_TC_Fill -= hydro_TC_FillRateDec * dt;
|
hydro_TC_Fill -= hydro_TC_FillRateDec * dt;
|
||||||
@@ -6351,10 +6383,10 @@ double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt)
|
|||||||
hydro_TC_Fill = clamp(hydro_TC_Fill, 0.0, 1.0);
|
hydro_TC_Fill = clamp(hydro_TC_Fill, 0.0, 1.0);
|
||||||
|
|
||||||
//blokowanie sprzegla blokującego
|
//blokowanie sprzegla blokującego
|
||||||
if ((Vel > hydro_TC_LockupSpeed) && (Mains) && (enrot > 0.9 * dizel_nmin) && (MainCtrlPos>0))
|
if ((Vel > hydro_TC_LockupSpeed) && (Mains) && (enrot > 0.9 * dizel_nmin) && (MainCtrlPowerPos() > 0))
|
||||||
hydro_TC_LockupRate += hydro_TC_FillRateInc*dt;
|
hydro_TC_LockupRate += hydro_TC_FillRateInc*dt;
|
||||||
//luzowanie sprzegla blokujacego
|
//luzowanie sprzegla blokujacego
|
||||||
if ((Vel < (MainCtrlPos>0 ? hydro_TC_LockupSpeed : hydro_TC_UnlockSpeed)) || (!Mains) || (enrot < 0.8 * dizel_nmin))
|
if ((Vel < (MainCtrlPowerPos() > 0 ? hydro_TC_LockupSpeed : hydro_TC_UnlockSpeed)) || (!Mains) || (enrot < 0.8 * dizel_nmin))
|
||||||
hydro_TC_LockupRate -= hydro_TC_FillRateDec*dt;
|
hydro_TC_LockupRate -= hydro_TC_FillRateDec*dt;
|
||||||
//obcinanie zakresu
|
//obcinanie zakresu
|
||||||
hydro_TC_LockupRate = clamp(hydro_TC_LockupRate, 0.0, 1.0);
|
hydro_TC_LockupRate = clamp(hydro_TC_LockupRate, 0.0, 1.0);
|
||||||
@@ -7224,7 +7256,7 @@ bool TMoverParameters::switch_physics(bool const State) // DO PRZETLUMACZENIA NA
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool startBPT;
|
bool startBPT;
|
||||||
bool startMPT, startMPT0;
|
bool startMPT, startMPT0;
|
||||||
bool startRLIST;
|
bool startRLIST, startUCLIST;
|
||||||
bool startDLIST, startFFLIST, startWWLIST;
|
bool startDLIST, startFFLIST, startWWLIST;
|
||||||
bool startLIGHTSLIST;
|
bool startLIGHTSLIST;
|
||||||
int LISTLINE;
|
int LISTLINE;
|
||||||
@@ -7419,6 +7451,31 @@ bool TMoverParameters::readRList( std::string const &Input ) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMoverParameters::readUCList(std::string const &line) {
|
||||||
|
|
||||||
|
cParser parser(line);
|
||||||
|
parser.getTokens(10, false);
|
||||||
|
auto idx = LISTLINE++;
|
||||||
|
if (idx >= sizeof(UniCtrlList) / sizeof(TUniversalCtrl)) {
|
||||||
|
WriteLog("Read UCList: number of entries exceeded capacity of the data table");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int i = 0;
|
||||||
|
parser
|
||||||
|
>> i
|
||||||
|
>> UniCtrlList[idx].mode
|
||||||
|
>> UniCtrlList[idx].MinCtrlVal
|
||||||
|
>> UniCtrlList[idx].MaxCtrlVal
|
||||||
|
>> UniCtrlList[idx].SetCtrlVal
|
||||||
|
>> UniCtrlList[idx].SpeedUp
|
||||||
|
>> UniCtrlList[idx].SpeedDown
|
||||||
|
>> UniCtrlList[idx].ReturnPosition
|
||||||
|
>> UniCtrlList[idx].NextPosFastInc
|
||||||
|
>> UniCtrlList[idx].PrevPosFastDec;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool TMoverParameters::readDList( std::string const &line ) {
|
bool TMoverParameters::readDList( std::string const &line ) {
|
||||||
|
|
||||||
cParser parser( line );
|
cParser parser( line );
|
||||||
@@ -7608,6 +7665,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
startMPT = false;
|
startMPT = false;
|
||||||
startMPT0 = false;
|
startMPT0 = false;
|
||||||
startRLIST = false;
|
startRLIST = false;
|
||||||
|
startUCLIST = false;
|
||||||
startDLIST = false;
|
startDLIST = false;
|
||||||
startFFLIST = false;
|
startFFLIST = false;
|
||||||
startWWLIST = false;
|
startWWLIST = false;
|
||||||
@@ -7664,6 +7722,11 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
startRLIST = false;
|
startRLIST = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (issection("END-RL", inputline)) {
|
||||||
|
startBPT = false;
|
||||||
|
startUCLIST = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if( issection( "END-DL", inputline ) ) {
|
if( issection( "END-DL", inputline ) ) {
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
startDLIST = false;
|
startDLIST = false;
|
||||||
@@ -7867,6 +7930,15 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (issection("UCList:", inputline))
|
||||||
|
{
|
||||||
|
startBPT = false;
|
||||||
|
fizlines.emplace("UCList", inputline);
|
||||||
|
startUCLIST = true; LISTLINE = 0;
|
||||||
|
LoadFIZ_RList(inputline);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( issection( "DList:", inputline ) )
|
if( issection( "DList:", inputline ) )
|
||||||
{
|
{
|
||||||
startBPT = false;
|
startBPT = false;
|
||||||
@@ -7916,6 +7988,10 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
readRList( inputline );
|
readRList( inputline );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (true == startUCLIST) {
|
||||||
|
readRList(inputline);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if( true == startDLIST ) {
|
if( true == startDLIST ) {
|
||||||
readDList( inputline );
|
readDList( inputline );
|
||||||
continue;
|
continue;
|
||||||
@@ -8514,6 +8590,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
extract_value( MainCtrlPosNo, "MCPN", line, "" );
|
extract_value( MainCtrlPosNo, "MCPN", line, "" );
|
||||||
extract_value( ScndCtrlPosNo, "SCPN", line, "" );
|
extract_value( ScndCtrlPosNo, "SCPN", line, "" );
|
||||||
extract_value( ScndInMain, "SCIM", line, "" );
|
extract_value( ScndInMain, "SCIM", line, "" );
|
||||||
|
extract_value( MaxMainCtrlPosNoDirChange, "DirChangeMaxPos", line, "" );
|
||||||
|
|
||||||
std::string autorelay;
|
std::string autorelay;
|
||||||
extract_value( autorelay, "AutoRelay", line, "" );
|
extract_value( autorelay, "AutoRelay", line, "" );
|
||||||
@@ -8523,7 +8600,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
|
|
||||||
extract_value( CoupledCtrl, "CoupledCtrl", line, "" );
|
extract_value( CoupledCtrl, "CoupledCtrl", line, "" );
|
||||||
extract_value( EIMCtrlType, "EIMCtrlType", line, "" );
|
extract_value( EIMCtrlType, "EIMCtrlType", line, "" );
|
||||||
clamp( EIMCtrlType, 0, 2 );
|
clamp( EIMCtrlType, 0, 3 );
|
||||||
|
|
||||||
extract_value( ScndS, "ScndS", line, "" ); // brak pozycji rownoleglej przy niskiej nastawie PSR
|
extract_value( ScndS, "ScndS", line, "" ); // brak pozycji rownoleglej przy niskiej nastawie PSR
|
||||||
|
|
||||||
@@ -8952,6 +9029,12 @@ void TMoverParameters::LoadFIZ_RList( std::string const &Input ) {
|
|||||||
extract_value( DynamicBrakeRes2, "DynBrakeRes2", Input, "");
|
extract_value( DynamicBrakeRes2, "DynBrakeRes2", Input, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TMoverParameters::LoadFIZ_UCList(std::string const &Input) {
|
||||||
|
|
||||||
|
extract_value(UniCtrlListSize, "Size", Input, "");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void TMoverParameters::LoadFIZ_DList( std::string const &Input ) {
|
void TMoverParameters::LoadFIZ_DList( std::string const &Input ) {
|
||||||
|
|
||||||
extract_value( dizel_Mmax, "Mmax", Input, "" );
|
extract_value( dizel_Mmax, "Mmax", Input, "" );
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ double TBrake::GetVRP()
|
|||||||
// cisnienie zbiornika sterujacego
|
// cisnienie zbiornika sterujacego
|
||||||
double TBrake::GetCRP()
|
double TBrake::GetCRP()
|
||||||
{
|
{
|
||||||
return 0;
|
return GetBRP();
|
||||||
}
|
}
|
||||||
|
|
||||||
// przeplyw z przewodu glowneg
|
// przeplyw z przewodu glowneg
|
||||||
@@ -2788,7 +2788,7 @@ double TMHZ_K5P::GetPos(int i)
|
|||||||
|
|
||||||
double TMHZ_K5P::GetCP()
|
double TMHZ_K5P::GetCP()
|
||||||
{
|
{
|
||||||
return RP;
|
return CP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMHZ_K5P::SetParams(bool AO, bool MO, double, double)
|
void TMHZ_K5P::SetParams(bool AO, bool MO, double, double)
|
||||||
@@ -2890,6 +2890,8 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
void TMHZ_6P::Init(double Press)
|
void TMHZ_6P::Init(double Press)
|
||||||
{
|
{
|
||||||
CP = Press;
|
CP = Press;
|
||||||
|
Time = true;
|
||||||
|
TimeEP = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMHZ_6P::SetReductor(double nAdj)
|
void TMHZ_6P::SetReductor(double nAdj)
|
||||||
@@ -2912,7 +2914,7 @@ double TMHZ_6P::GetPos(int i)
|
|||||||
|
|
||||||
double TMHZ_6P::GetCP()
|
double TMHZ_6P::GetCP()
|
||||||
{
|
{
|
||||||
return RP;
|
return CP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMHZ_6P::SetParams(bool AO, bool MO, double OverP, double)
|
void TMHZ_6P::SetParams(bool AO, bool MO, double OverP, double)
|
||||||
|
|||||||
19
Train.cpp
19
Train.cpp
@@ -789,8 +789,8 @@ void TTrain::OnCommand_jointcontrollerset( TTrain *Train, command_data const &Co
|
|||||||
clamp(
|
clamp(
|
||||||
1.0 - ( Command.param1 * 2 ),
|
1.0 - ( Command.param1 * 2 ),
|
||||||
0.0, 1.0 ) );
|
0.0, 1.0 ) );
|
||||||
if( Train->mvControlled->MainCtrlPos > 0 ) {
|
if( Train->mvControlled->MainCtrlPowerPos() > 0 ) {
|
||||||
Train->set_master_controller( 0 );
|
Train->set_master_controller( Train->mvControlled->MainCtrlNoPowerPos() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -846,7 +846,7 @@ void TTrain::OnCommand_mastercontrollerdecrease( TTrain *Train, command_data con
|
|||||||
if( Command.action != GLFW_RELEASE ) {
|
if( Command.action != GLFW_RELEASE ) {
|
||||||
// on press or hold
|
// on press or hold
|
||||||
if( ( Train->ggJointCtrl.SubModel != nullptr )
|
if( ( Train->ggJointCtrl.SubModel != nullptr )
|
||||||
&& ( Train->mvControlled->MainCtrlPos == 0 ) ) {
|
&& ( Train->mvControlled->IsMainCtrlNoPowerPos() ) ) {
|
||||||
OnCommand_independentbrakeincrease( Train, Command );
|
OnCommand_independentbrakeincrease( Train, Command );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -866,7 +866,7 @@ void TTrain::OnCommand_mastercontrollerdecreasefast( TTrain *Train, command_data
|
|||||||
if( Command.action != GLFW_RELEASE ) {
|
if( Command.action != GLFW_RELEASE ) {
|
||||||
// on press or hold
|
// on press or hold
|
||||||
if( ( Train->ggJointCtrl.SubModel != nullptr )
|
if( ( Train->ggJointCtrl.SubModel != nullptr )
|
||||||
&& ( Train->mvControlled->MainCtrlPos == 0 ) ) {
|
&& ( Train->mvControlled->IsMainCtrlNoPowerPos() ) ) {
|
||||||
OnCommand_independentbrakeincreasefast( Train, Command );
|
OnCommand_independentbrakeincreasefast( Train, Command );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -5543,7 +5543,12 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
if (ggIgnitionKey.SubModel)
|
if (ggIgnitionKey.SubModel)
|
||||||
{
|
{
|
||||||
ggIgnitionKey.UpdateValue(mvControlled->dizel_startup);
|
ggIgnitionKey.UpdateValue(
|
||||||
|
( mvControlled->Mains )
|
||||||
|
|| ( mvControlled->dizel_startup )
|
||||||
|
|| ( fMainRelayTimer > 0.f )
|
||||||
|
|| ( ggMainButton.GetDesiredValue() > 0.95 )
|
||||||
|
|| ( ggMainOnButton.GetDesiredValue() > 0.95 ) );
|
||||||
ggIgnitionKey.Update();
|
ggIgnitionKey.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5754,6 +5759,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
// others
|
// others
|
||||||
btLampkaMalfunction.Turn( mvControlled->dizel_heat.PA );
|
btLampkaMalfunction.Turn( mvControlled->dizel_heat.PA );
|
||||||
btLampkaMotorBlowers.Turn( ( mvControlled->MotorBlowers[ end::front ].is_active ) && ( mvControlled->MotorBlowers[ end::rear ].is_active ) );
|
btLampkaMotorBlowers.Turn( ( mvControlled->MotorBlowers[ end::front ].is_active ) && ( mvControlled->MotorBlowers[ end::rear ].is_active ) );
|
||||||
|
btLampkaCoolingFans.Turn( mvControlled->RventRot > 1.0 );
|
||||||
// universal devices state indicators
|
// universal devices state indicators
|
||||||
for( auto idx = 0; idx < btUniversals.size(); ++idx ) {
|
for( auto idx = 0; idx < btUniversals.size(); ++idx ) {
|
||||||
btUniversals[ idx ].Turn( ggUniversals[ idx ].GetValue() > 0.5 );
|
btUniversals[ idx ].Turn( ggUniversals[ idx ].GetValue() > 0.5 );
|
||||||
@@ -5814,6 +5820,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
// others
|
// others
|
||||||
btLampkaMalfunction.Turn( false );
|
btLampkaMalfunction.Turn( false );
|
||||||
btLampkaMotorBlowers.Turn( false );
|
btLampkaMotorBlowers.Turn( false );
|
||||||
|
btLampkaCoolingFans.Turn( false );
|
||||||
// universal devices state indicators
|
// universal devices state indicators
|
||||||
for( auto &universal : btUniversals ) {
|
for( auto &universal : btUniversals ) {
|
||||||
universal.Turn( false );
|
universal.Turn( false );
|
||||||
@@ -7570,6 +7577,7 @@ void TTrain::clear_cab_controls()
|
|||||||
btLampkaMalfunction.Clear();
|
btLampkaMalfunction.Clear();
|
||||||
btLampkaMalfunctionB.Clear();
|
btLampkaMalfunctionB.Clear();
|
||||||
btLampkaMotorBlowers.Clear();
|
btLampkaMotorBlowers.Clear();
|
||||||
|
btLampkaCoolingFans.Clear();
|
||||||
|
|
||||||
ggLeftLightButton.Clear();
|
ggLeftLightButton.Clear();
|
||||||
ggRightLightButton.Clear();
|
ggRightLightButton.Clear();
|
||||||
@@ -7914,6 +7922,7 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
|||||||
{ "i-highcurrent:", btLampkaWysRozr },
|
{ "i-highcurrent:", btLampkaWysRozr },
|
||||||
{ "i-vent_trim:", btLampkaWentZaluzje },
|
{ "i-vent_trim:", btLampkaWentZaluzje },
|
||||||
{ "i-motorblowers:", btLampkaMotorBlowers },
|
{ "i-motorblowers:", btLampkaMotorBlowers },
|
||||||
|
{ "i-coolingfans:", btLampkaCoolingFans },
|
||||||
{ "i-trainheating:", btLampkaOgrzewanieSkladu },
|
{ "i-trainheating:", btLampkaOgrzewanieSkladu },
|
||||||
{ "i-security_aware:", btLampkaCzuwaka },
|
{ "i-security_aware:", btLampkaCzuwaka },
|
||||||
{ "i-security_cabsignal:", btLampkaSHP },
|
{ "i-security_cabsignal:", btLampkaSHP },
|
||||||
|
|||||||
1
Train.h
1
Train.h
@@ -588,6 +588,7 @@ public: // reszta może by?publiczna
|
|||||||
TButton btLampkaMalfunction;
|
TButton btLampkaMalfunction;
|
||||||
TButton btLampkaMalfunctionB;
|
TButton btLampkaMalfunctionB;
|
||||||
TButton btLampkaMotorBlowers;
|
TButton btLampkaMotorBlowers;
|
||||||
|
TButton btLampkaCoolingFans;
|
||||||
|
|
||||||
TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
|
TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
|
||||||
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
|
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
|
||||||
|
|||||||
@@ -175,9 +175,7 @@ openal_source::bind( sound_source *Controller, uint32_sequence Sounds, Iterator_
|
|||||||
First, Last,
|
First, Last,
|
||||||
[&]( audio::buffer_handle const &bufferhandle ) {
|
[&]( audio::buffer_handle const &bufferhandle ) {
|
||||||
auto const &buffer { audio::renderer.buffer( bufferhandle ) };
|
auto const &buffer { audio::renderer.buffer( bufferhandle ) };
|
||||||
buffers.emplace_back( buffer.id );
|
buffers.emplace_back( buffer.id ); } );
|
||||||
if( false == buffer.caption.empty() ) {
|
|
||||||
ui::Transcripts.Add( buffer.caption ); } } );
|
|
||||||
|
|
||||||
if( id != audio::null_resource ) {
|
if( id != audio::null_resource ) {
|
||||||
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );
|
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ scenario_panel::render() {
|
|||||||
auto const assignmentheader { locale::strings[ locale::string::driver_scenario_assignment ] };
|
auto const assignmentheader { locale::strings[ locale::string::driver_scenario_assignment ] };
|
||||||
if( ( false == owner->assignment().empty() )
|
if( ( false == owner->assignment().empty() )
|
||||||
&& ( true == ImGui::CollapsingHeader( assignmentheader.c_str() ) ) ) {
|
&& ( true == ImGui::CollapsingHeader( assignmentheader.c_str() ) ) ) {
|
||||||
ImGui::TextWrapped( owner->assignment().c_str() );
|
ImGui::TextWrapped( "%s", owner->assignment().c_str() );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -825,7 +825,8 @@ debug_panel::update_section_ai( std::vector<text_line> &Output ) {
|
|||||||
+ ", slope: " + to_string( mechanik.fAccGravity + 0.001f, 2 ) + " (" + ( mechanik.fAccGravity > 0.01 ? "\\" : ( mechanik.fAccGravity < -0.01 ? "/" : "-" ) ) + ")"
|
+ ", slope: " + to_string( mechanik.fAccGravity + 0.001f, 2 ) + " (" + ( mechanik.fAccGravity > 0.01 ? "\\" : ( mechanik.fAccGravity < -0.01 ? "/" : "-" ) ) + ")"
|
||||||
+ "\n brake threshold: " + to_string( mechanik.fAccThreshold, 2 )
|
+ "\n brake threshold: " + to_string( mechanik.fAccThreshold, 2 )
|
||||||
+ ", delays: " + to_string( mechanik.fBrake_a0[ 0 ], 2 )
|
+ ", delays: " + to_string( mechanik.fBrake_a0[ 0 ], 2 )
|
||||||
+ "+" + to_string( mechanik.fBrake_a1[ 0 ], 2 );
|
+ "+" + to_string( mechanik.fBrake_a1[ 0 ], 2 )
|
||||||
|
+ "\n virtual brake position: " + to_string(mechanik.BrakeCtrlPosition, 2);
|
||||||
|
|
||||||
Output.emplace_back( textline, Global.UITextColor );
|
Output.emplace_back( textline, Global.UITextColor );
|
||||||
|
|
||||||
@@ -1002,10 +1003,8 @@ transcripts_panel::update() {
|
|||||||
text_lines.clear();
|
text_lines.clear();
|
||||||
|
|
||||||
for( auto const &transcript : ui::Transcripts.aLines ) {
|
for( auto const &transcript : ui::Transcripts.aLines ) {
|
||||||
if( Global.fTimeAngleDeg >= transcript.fShow ) {
|
if( Global.fTimeAngleDeg + ( transcript.fShow - Global.fTimeAngleDeg > 180 ? 360 : 0 ) < transcript.fShow ) { continue; }
|
||||||
// NOTE: legacy transcript lines use | as new line mark
|
text_lines.emplace_back( ExchangeCharInString( transcript.asText, '|', ' ' ), colors::white );
|
||||||
text_lines.emplace_back( ExchangeCharInString( transcript.asText, '|', ' ' ), colors::white );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1034,7 +1033,7 @@ transcripts_panel::render() {
|
|||||||
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
|
if( true == ImGui::Begin( panelname.c_str(), &is_open, flags ) ) {
|
||||||
// header section
|
// header section
|
||||||
for( auto const &line : text_lines ) {
|
for( auto const &line : text_lines ) {
|
||||||
ImGui::TextWrapped( line.data.c_str() );
|
ImGui::TextWrapped( "%s", line.data.c_str() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|||||||
@@ -94,6 +94,17 @@ world_environment::update() {
|
|||||||
// NOTE: sun light receives extra padding to prevent moon from kicking in too soon
|
// NOTE: sun light receives extra padding to prevent moon from kicking in too soon
|
||||||
auto const sunlightlevel = m_sun.getIntensity() + 0.05f * ( 1.f - twilightfactor );
|
auto const sunlightlevel = m_sun.getIntensity() + 0.05f * ( 1.f - twilightfactor );
|
||||||
auto const moonlightlevel = m_moon.getIntensity() * 0.65f; // scaled down by arbitrary factor, it's pretty bright otherwise
|
auto const moonlightlevel = m_moon.getIntensity() * 0.65f; // scaled down by arbitrary factor, it's pretty bright otherwise
|
||||||
|
|
||||||
|
// ...update skydome to match the current sun position as well...
|
||||||
|
// twilight factor can be reset later down, so we do it here while it's still reflecting state of the sun
|
||||||
|
// turbidity varies from 2-3 during the day based on overcast, 3-4 after sunset to deal with sunlight bleeding too much into the sky from below horizon
|
||||||
|
m_skydome.SetTurbidity(
|
||||||
|
2.f
|
||||||
|
+ clamp( Global.Overcast, 0.f, 1.f )
|
||||||
|
+ interpolate( 0.f, 1.f, clamp( twilightfactor * 1.5f, 0.f, 1.f ) ) );
|
||||||
|
m_skydome.SetOvercastFactor( Global.Overcast );
|
||||||
|
m_skydome.Update( m_sun.getDirection() );
|
||||||
|
|
||||||
float keylightintensity;
|
float keylightintensity;
|
||||||
glm::vec3 keylightcolor;
|
glm::vec3 keylightcolor;
|
||||||
if( moonlightlevel > sunlightlevel ) {
|
if( moonlightlevel > sunlightlevel ) {
|
||||||
@@ -119,9 +130,6 @@ world_environment::update() {
|
|||||||
glm::vec3( 235.0f / 255.0f, 140.0f / 255.0f, 36.0f / 255.0f ),
|
glm::vec3( 235.0f / 255.0f, 140.0f / 255.0f, 36.0f / 255.0f ),
|
||||||
duskfactor );
|
duskfactor );
|
||||||
}
|
}
|
||||||
// ...update skydome to match the current sun position as well...
|
|
||||||
m_skydome.SetOvercastFactor( Global.Overcast );
|
|
||||||
m_skydome.Update( m_sun.getDirection() );
|
|
||||||
// ...retrieve current sky colour and brightness...
|
// ...retrieve current sky colour and brightness...
|
||||||
auto const skydomecolour = m_skydome.GetAverageColor();
|
auto const skydomecolour = m_skydome.GetAverageColor();
|
||||||
auto const skydomehsv = colors::RGBtoHSV( skydomecolour );
|
auto const skydomehsv = colors::RGBtoHSV( skydomecolour );
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ bool CSkyDome::SetSunPosition( glm::vec3 const &Direction ) {
|
|||||||
|
|
||||||
void CSkyDome::SetTurbidity( float const Turbidity ) {
|
void CSkyDome::SetTurbidity( float const Turbidity ) {
|
||||||
|
|
||||||
m_turbidity = clamp( Turbidity, 1.0f, 512.0f );
|
m_turbidity = clamp( Turbidity, 1.f, 4.f );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSkyDome::SetExposure( bool const Linearexposure, float const Expfactor ) {
|
void CSkyDome::SetExposure( bool const Linearexposure, float const Expfactor ) {
|
||||||
|
|||||||
@@ -861,6 +861,13 @@ sound_source::update_counter( sound_handle const Sound, int const Value ) {
|
|||||||
|
|
||||||
// sound( Sound ).playing = std::max( 0, sound( Sound ).playing + Value );
|
// sound( Sound ).playing = std::max( 0, sound( Sound ).playing + Value );
|
||||||
sound( Sound ).playing += Value;
|
sound( Sound ).playing += Value;
|
||||||
|
if( ( m_properties.gain > 0.f )
|
||||||
|
&& ( sound( Sound ).playing == 1 ) ) {
|
||||||
|
auto const &buffer { audio::renderer.buffer( sound( Sound ).buffer ) };
|
||||||
|
if( false == buffer.caption.empty() ) {
|
||||||
|
ui::Transcripts.Add( buffer.caption );
|
||||||
|
}
|
||||||
|
}
|
||||||
assert( sound( Sound ).playing >= 0 );
|
assert( sound( Sound ).playing >= 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,12 @@ TTranscripts::AddLine( std::string const &txt, float show, float hide, bool it )
|
|||||||
|
|
||||||
if( show == hide ) { return; } // komentarz jest ignorowany
|
if( show == hide ) { return; } // komentarz jest ignorowany
|
||||||
|
|
||||||
|
// TODO: replace the timeangledeg mess with regular time points math
|
||||||
show = Global.fTimeAngleDeg + show / 240.0; // jeśli doba to 360, to 1s będzie równe 1/240
|
show = Global.fTimeAngleDeg + show / 240.0; // jeśli doba to 360, to 1s będzie równe 1/240
|
||||||
hide = Global.fTimeAngleDeg + hide / 240.0;
|
hide = Global.fTimeAngleDeg + hide / 240.0;
|
||||||
|
|
||||||
TTranscript transcript;
|
TTranscript transcript;
|
||||||
transcript.asText = txt;
|
transcript.asText = ExchangeCharInString( txt, '|', ' ' ); // NOTE: legacy transcript lines use | as new line mark
|
||||||
transcript.fShow = show;
|
transcript.fShow = show;
|
||||||
transcript.fHide = hide;
|
transcript.fHide = hide;
|
||||||
transcript.bItalic = it;
|
transcript.bItalic = it;
|
||||||
@@ -62,12 +63,25 @@ TTranscripts::Add( std::string const &txt, bool backgorund ) {
|
|||||||
void
|
void
|
||||||
TTranscripts::Update() {
|
TTranscripts::Update() {
|
||||||
|
|
||||||
|
// HACK: detect day change
|
||||||
|
if( fRefreshTime - Global.fTimeAngleDeg > 180 ) {
|
||||||
|
fRefreshTime -= 360;
|
||||||
|
}
|
||||||
|
|
||||||
if( Global.fTimeAngleDeg < fRefreshTime ) { return; } // nie czas jeszcze na zmiany
|
if( Global.fTimeAngleDeg < fRefreshTime ) { return; } // nie czas jeszcze na zmiany
|
||||||
|
|
||||||
while( ( false == aLines.empty() )
|
// remove expired lines
|
||||||
&& ( Global.fTimeAngleDeg >= aLines.front().fHide ) ) {
|
while( false == aLines.empty() ) {
|
||||||
// remove expired lines
|
// HACK: detect day change
|
||||||
aLines.pop_front();
|
if( aLines.front().fHide - Global.fTimeAngleDeg > 180 ) {
|
||||||
|
aLines.front().fShow -= 360;
|
||||||
|
aLines.front().fHide -= 360;
|
||||||
|
}
|
||||||
|
if( Global.fTimeAngleDeg <= aLines.front().fHide ) {
|
||||||
|
// no expired lines yet
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
aLines.pop_front(); // this line expired, discard it and start anew with the next one
|
||||||
}
|
}
|
||||||
// update next refresh time
|
// update next refresh time
|
||||||
if( false == aLines.empty() ) { fRefreshTime = aLines.front().fHide; }
|
if( false == aLines.empty() ) { fRefreshTime = aLines.front().fHide; }
|
||||||
|
|||||||
Reference in New Issue
Block a user