mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge branch 'mover_in_c++'
This commit is contained in:
976
Driver.cpp
976
Driver.cpp
File diff suppressed because it is too large
Load Diff
33
Driver.h
33
Driver.h
@@ -102,6 +102,7 @@ enum TAction
|
||||
|
||||
enum TSpeedPosFlag
|
||||
{ // wartości dla iFlag w TSpeedPos
|
||||
spNone = 0x0,
|
||||
spEnabled = 0x1, // pozycja brana pod uwagę
|
||||
spTrack = 0x2, // to jest tor
|
||||
spReverse = 0x4, // odwrotnie
|
||||
@@ -126,11 +127,11 @@ enum TSpeedPosFlag
|
||||
class TSpeedPos
|
||||
{ // pozycja tabeli prędkości dla AI
|
||||
public:
|
||||
double fDist; // aktualna odległość (ujemna gdy minięte)
|
||||
double fVelNext; // prędkość obowiązująca od tego miejsca
|
||||
double fSectionVelocityDist; // długość ograniczenia prędkości
|
||||
double fDist{ 0.0 }; // aktualna odległość (ujemna gdy minięte)
|
||||
double fVelNext{ -1.0 }; // prędkość obowiązująca od tego miejsca
|
||||
double fSectionVelocityDist{ 0.0 }; // długość ograniczenia prędkości
|
||||
// double fAcc;
|
||||
int iFlags; // flagi typu wpisu do tabelki
|
||||
int iFlags{ spNone }; // flagi typu wpisu do tabelki
|
||||
// 1=istotny,2=tor,4=odwrotnie,8-zwrotnica (może się zmienić),16-stan
|
||||
// zwrotnicy,32-minięty,64=koniec,128=łuk
|
||||
// 0x100=event,0x200=manewrowa,0x400=przystanek,0x800=SBL,0x1000=wysłana komenda,0x2000=W5
|
||||
@@ -138,8 +139,8 @@ class TSpeedPos
|
||||
vector3 vPos; // współrzędne XYZ do liczenia odległości
|
||||
struct
|
||||
{
|
||||
TTrack *trTrack; // wskaźnik na tor o zmiennej prędkości (zwrotnica, obrotnica)
|
||||
TEvent *evEvent; // połączenie z eventem albo komórką pamięci
|
||||
TTrack *trTrack{ nullptr }; // wskaźnik na tor o zmiennej prędkości (zwrotnica, obrotnica)
|
||||
TEvent *evEvent{ nullptr }; // połączenie z eventem albo komórką pamięci
|
||||
};
|
||||
void CommandCheck();
|
||||
|
||||
@@ -166,16 +167,14 @@ extern bool WriteLogFlag; // logowanie parametrów fizycznych
|
||||
class TController
|
||||
{
|
||||
private: // obsługa tabelki prędkości (musi mieć możliwość odhaczania stacji w rozkładzie)
|
||||
TSpeedPos *sSpeedTable = nullptr; // najbliższe zmiany prędkości
|
||||
int iSpeedTableSize = 16; // wielkość tabelki
|
||||
int iFirst = 0; // aktualna pozycja w tabeli (modulo iSpeedTableSize)
|
||||
int iLast = 0; // ostatnia wypełniona pozycja w tabeli <iFirst (modulo iSpeedTableSize)
|
||||
int iTableDirection = 0; // kierunek zapełnienia tabelki względem pojazdu z AI
|
||||
int iLast{ 0 }; // ostatnia wypełniona pozycja w tabeli <iFirst (modulo iSpeedTableSize)
|
||||
int iTableDirection{ 0 }; // kierunek zapełnienia tabelki względem pojazdu z AI
|
||||
std::vector<TSpeedPos> sSpeedTable;
|
||||
double fLastVel = 0.0; // prędkość na poprzednio sprawdzonym torze
|
||||
TTrack *tLast = nullptr; // ostatni analizowany tor
|
||||
TEvent *eSignSkip = nullptr; // można pominąć ten SBL po zatrzymaniu
|
||||
TSpeedPos *sSemNext = nullptr; // następny semafor na drodze zależny od trybu jazdy
|
||||
TSpeedPos *sSemNextStop = nullptr; // następny semafor na drodze zależny od trybu jazdy i na stój
|
||||
std::size_t SemNextIndex{ -1 };
|
||||
std::size_t SemNextStopIndex{ -1 };
|
||||
private: // parametry aktualnego składu
|
||||
double fLength = 0.0; // długość składu (do wyciągania z ograniczeń)
|
||||
double fMass = 0.0; // całkowita masa do liczenia stycznej składowej grawitacji
|
||||
@@ -358,13 +357,15 @@ class TController
|
||||
TEvent *CheckTrackEvent(double fDirection, TTrack *Track);
|
||||
bool TableCheckEvent(TEvent *e);
|
||||
bool TableAddNew();
|
||||
bool TableNotFound(TEvent *e);
|
||||
bool TableNotFound(TEvent const *Event) const;
|
||||
void TableClear();
|
||||
TEvent *TableCheckTrackEvent(double fDirection, TTrack *Track);
|
||||
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = NULL);
|
||||
void TableCheck(double fDistance);
|
||||
TCommandType TableUpdate(double &fVelDes, double &fDist, double &fNext, double &fAcc);
|
||||
void TablePurger();
|
||||
public:
|
||||
std::size_t TableSize() const { return sSpeedTable.size(); }
|
||||
|
||||
private: // Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu
|
||||
bool BackwardTrackBusy(TTrack *Track);
|
||||
@@ -395,9 +396,9 @@ class TController
|
||||
};
|
||||
void MoveTo(TDynamicObject *to);
|
||||
void DirectionInitial();
|
||||
std::string TableText(int i);
|
||||
std::string TableText(std::size_t const Index);
|
||||
int CrossRoute(TTrack *tr);
|
||||
void RouteSwitch(int d);
|
||||
std::string OwnerName();
|
||||
std::string OwnerName() const;
|
||||
TMoverParameters const *Controlling() const { return mvControlling; }
|
||||
};
|
||||
|
||||
196
DynObj.cpp
196
DynObj.cpp
@@ -798,7 +798,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
btnOn = true;
|
||||
}
|
||||
// else btCPass2.TurnOff();
|
||||
if (MoverParameters->Battery)
|
||||
if (MoverParameters->Battery || MoverParameters->ConverterFlag)
|
||||
{ // sygnaly konca pociagu
|
||||
if (btEndSignals1.Active())
|
||||
{
|
||||
@@ -900,7 +900,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
||||
// Ra: przechyłkę załatwiamy na etapie przesuwania modelu
|
||||
// if (ObjSqrDist<80000) ABuModelRoll(); //przechyłki od 400m
|
||||
}
|
||||
if (MoverParameters->Battery)
|
||||
if( MoverParameters->Battery || MoverParameters->ConverterFlag )
|
||||
{ // sygnały czoła pociagu //Ra: wyświetlamy bez
|
||||
// ograniczeń odległości, by były widoczne z
|
||||
// daleka
|
||||
@@ -1753,52 +1753,45 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
||||
// wylaczanie hamulca
|
||||
if (ActPar.find("<>") != std::string::npos) // wylaczanie na probe hamowania naglego
|
||||
{
|
||||
MoverParameters->BrakeStatus |= 128; // wylacz
|
||||
MoverParameters->Hamulec->SetBrakeStatus( MoverParameters->Hamulec->GetBrakeStatus() | b_dmg ); // wylacz
|
||||
}
|
||||
if (ActPar.find('0') != std::string::npos) // wylaczanie na sztywno
|
||||
{
|
||||
MoverParameters->BrakeStatus |= 128; // wylacz
|
||||
MoverParameters->Hamulec->SetBrakeStatus( MoverParameters->Hamulec->GetBrakeStatus() | b_dmg ); // wylacz
|
||||
MoverParameters->Hamulec->ForceEmptiness();
|
||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
||||
}
|
||||
if (ActPar.find('E') != std::string::npos) // oprozniony
|
||||
{
|
||||
MoverParameters->Hamulec->ForceEmptiness();
|
||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
||||
MoverParameters->Pipe->CreatePress(0);
|
||||
MoverParameters->Pipe2->CreatePress(0);
|
||||
}
|
||||
if (ActPar.find('Q') != std::string::npos) // oprozniony
|
||||
{
|
||||
// MoverParameters->Hamulec->ForceEmptiness(); //TODO: sprawdzic,
|
||||
// dlaczego
|
||||
// pojawia sie blad przy uzyciu tej linijki w lokomotywie
|
||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
||||
MoverParameters->Hamulec->ForceEmptiness();
|
||||
MoverParameters->Pipe->CreatePress(0.0);
|
||||
MoverParameters->PipePress = 0.0;
|
||||
MoverParameters->Pipe2->CreatePress(0.0);
|
||||
MoverParameters->ScndPipePress = 0.0;
|
||||
MoverParameters->PantVolume = 1;
|
||||
MoverParameters->PantPress = 0;
|
||||
MoverParameters->CompressedVolume = 0;
|
||||
MoverParameters->PantVolume = 0.1;
|
||||
MoverParameters->PantPress = 0.0;
|
||||
MoverParameters->CompressedVolume = 0.0;
|
||||
}
|
||||
|
||||
if (ActPar.find('1') != std::string::npos) // wylaczanie 10%
|
||||
{
|
||||
if (Random(10) < 1) // losowanie 1/10
|
||||
{
|
||||
MoverParameters->BrakeStatus |= 128; // wylacz
|
||||
MoverParameters->Hamulec->SetBrakeStatus( MoverParameters->Hamulec->GetBrakeStatus() | b_dmg ); // wylacz
|
||||
MoverParameters->Hamulec->ForceEmptiness();
|
||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
||||
}
|
||||
}
|
||||
if (ActPar.find('X') != std::string::npos) // agonalny wylaczanie 20%, usrednienie przekladni
|
||||
{
|
||||
if (Random(100) < 20) // losowanie 20/100
|
||||
{
|
||||
MoverParameters->BrakeStatus |= 128; // wylacz
|
||||
MoverParameters->Hamulec->SetBrakeStatus( MoverParameters->Hamulec->GetBrakeStatus() | b_dmg ); // wylacz
|
||||
MoverParameters->Hamulec->ForceEmptiness();
|
||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
||||
}
|
||||
if (MoverParameters->BrakeCylMult[2] * MoverParameters->BrakeCylMult[1] >
|
||||
0.01) // jesli jest nastawiacz mechaniczny PL
|
||||
@@ -2443,43 +2436,61 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
if (!bEnabled)
|
||||
return false; // a normalnie powinny mieć bEnabled==false
|
||||
|
||||
// Ra: przeniosłem - no już lepiej tu, niż w wyświetlaniu!
|
||||
// if ((MoverParameters->ConverterFlag==false) &&
|
||||
// (MoverParameters->TrainType!=dt_ET22))
|
||||
// Ra: to nie może tu być, bo wyłącza sprężarkę w rozrządczym EZT!
|
||||
// if
|
||||
// ((MoverParameters->ConverterFlag==false)&&(MoverParameters->CompressorPower!=0))
|
||||
// MoverParameters->CompressorFlag=false;
|
||||
// if (MoverParameters->CompressorPower==2)
|
||||
// MoverParameters->CompressorAllow=MoverParameters->ConverterFlag;
|
||||
|
||||
// McZapkie-260202
|
||||
if ((MoverParameters->EnginePowerSource.SourceType == CurrentCollector) &&
|
||||
(MoverParameters->Power > 1.0)) // aby rozrządczy nie opuszczał silnikowemu
|
||||
/*
|
||||
if ((MechInside) || (MoverParameters->TrainType == dt_EZT))
|
||||
{
|
||||
*/
|
||||
// if
|
||||
// ((!MoverParameters->PantCompFlag)&&(MoverParameters->CompressedVolume>=2.8))
|
||||
// MoverParameters->PantVolume=MoverParameters->CompressedVolume;
|
||||
if (MoverParameters->PantPress < (MoverParameters->TrainType == dt_EZT ? 2.4 : 3.5))
|
||||
{ // 3.5 wg
|
||||
// http://www.transportszynowy.pl/eu06-07pneumat.php
|
||||
//"Wyłączniki ciśnieniowe odbieraków prądu wyłączają sterowanie
|
||||
// wyłącznika szybkiego
|
||||
// oraz uniemożliwiają podniesienie odbieraków prądu, gdy w instalacji
|
||||
// rozrządu
|
||||
// ciśnienie spadnie poniżej wartości 3,5 bara."
|
||||
// Ra 2013-12: Niebugocław mówi, że w EZT podnoszą się przy 2.5
|
||||
// if (!MoverParameters->PantCompFlag)
|
||||
// MoverParameters->PantVolume=MoverParameters->CompressedVolume;
|
||||
MoverParameters->PantFront(false); // opuszczenie pantografów przy niskim ciśnieniu
|
||||
MoverParameters->PantRear(false); // to idzie w ukrotnieniu, a nie powinno...
|
||||
|
||||
if( MoverParameters->PantPress < MoverParameters->EnginePowerSource.CollectorParameters.MinPress ) {
|
||||
// 3.5 wg http://www.transportszynowy.pl/eu06-07pneumat.php
|
||||
if( true == MoverParameters->PantPressSwitchActive ) {
|
||||
// opuszczenie pantografów przy niskim ciśnieniu
|
||||
/*
|
||||
// NOTE: disabled, the pantographs drop by themseleves when the pantograph tank pressure gets low enough
|
||||
MoverParameters->PantFront( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||
MoverParameters->PantRear( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||
*/
|
||||
if( MoverParameters->TrainType != dt_EZT ) {
|
||||
// pressure switch safety measure -- open the line breaker, unless there's alternate source of traction voltage
|
||||
if( MoverParameters->GetTrainsetVoltage() < 0.5 * MoverParameters->EnginePowerSource.MaxVoltage ) {
|
||||
// TODO: check whether line breaker should be open EMU-wide
|
||||
MoverParameters->MainSwitch( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
// specialized variant for EMU -- pwr system disables converter and heating,
|
||||
// and prevents their activation until pressure switch is set again
|
||||
MoverParameters->PantPressLockActive = true;
|
||||
// TODO: separate 'heating allowed' from actual heating flag, so we can disable it here without messing up heating toggle
|
||||
MoverParameters->ConverterSwitch( false, command_range::unit );
|
||||
}
|
||||
// mark the pressure switch as spent
|
||||
MoverParameters->PantPressSwitchActive = false;
|
||||
}
|
||||
}
|
||||
// Winger - automatyczne wylaczanie malej sprezarki
|
||||
else if (MoverParameters->PantPress >= 4.8)
|
||||
MoverParameters->PantCompFlag = false;
|
||||
} // Ra: do Mover to trzeba przenieść, żeby AI też mogło sobie podpompować
|
||||
else {
|
||||
if( MoverParameters->PantPress >= 4.6 ) {
|
||||
// prime the pressure switch
|
||||
MoverParameters->PantPressSwitchActive = true;
|
||||
// turn off the subsystems lock
|
||||
MoverParameters->PantPressLockActive = false;
|
||||
|
||||
if( MoverParameters->PantPress >= 4.8 ) {
|
||||
// Winger - automatyczne wylaczanie malej sprezarki
|
||||
// TODO: governor lock, disables usage until pressure drop below 3.8 (should really make compressor object we could reuse)
|
||||
MoverParameters->PantCompFlag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
} // Ra: do Mover to trzeba przenieść, żeby AI też mogło sobie podpompować
|
||||
*/
|
||||
double dDOMoveLen;
|
||||
|
||||
TLocation l;
|
||||
@@ -2911,37 +2922,26 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
|
||||
// fragment "z EXE Kursa"
|
||||
if (MoverParameters->Mains) // nie wchodzić w funkcję bez potrzeby
|
||||
if ( ( false == MoverParameters->Battery)
|
||||
if ( ( false == MoverParameters->Battery )
|
||||
&& ( false == MoverParameters->ConverterFlag ) // added alternative power source. TODO: more generic power check
|
||||
&& ( Controller == Humandriver)
|
||||
/*
|
||||
// NOTE: disabled on account of multi-unit setups, where the unmanned unit wouldn't be affected
|
||||
&& ( Controller == Humandriver )
|
||||
*/
|
||||
&& ( MoverParameters->EngineType != DieselEngine )
|
||||
&& ( MoverParameters->EngineType != WheelsDriven ) )
|
||||
{ // jeśli bateria wyłączona, a nie diesel ani drezyna reczna
|
||||
if (MoverParameters->MainSwitch(false)) // wyłączyć zasilanie
|
||||
if( MoverParameters->MainSwitch( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) ) ) {
|
||||
// wyłączyć zasilanie
|
||||
// NOTE: we turn off entire EMU, but only the affected unit for other multi-unit consists
|
||||
MoverParameters->EventFlag = true;
|
||||
// drop pantographs
|
||||
// NOTE: this isn't universal behaviour
|
||||
// TODO: have this dependant on .fiz-driven flag
|
||||
MoverParameters->PantFront( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||
MoverParameters->PantRear( false, ( MoverParameters->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||
}
|
||||
}
|
||||
if (MoverParameters->TrainType == dt_ET42)
|
||||
{ // powinny być wszystkie dwuczłony oraz EZT
|
||||
/*
|
||||
//Ra: to jest bez sensu, bo wyłącza WS przy przechodzeniu przez
|
||||
"wewnętrzne" kabiny (z
|
||||
powodu ActiveCab)
|
||||
//trzeba to zrobić inaczej, np. dla członu A sprawdzać, czy jest B
|
||||
//albo sprawdzać w momencie załączania WS i zmiany w sprzęgach
|
||||
if
|
||||
(((TestFlag(MoverParameters->Couplers[1].CouplingFlag,ctrain_controll))&&(MoverParameters->ActiveCab>0)&&(NextConnected->MoverParameters->TrainType!=dt_ET42))||((TestFlag(MoverParameters->Couplers[0].CouplingFlag,ctrain_controll))&&(MoverParameters->ActiveCab<0)&&(PrevConnected->MoverParameters->TrainType!=dt_ET42)))
|
||||
{//sprawdzenie, czy z tyłu kabiny mamy drugi człon
|
||||
if (MoverParameters->MainSwitch(false))
|
||||
MoverParameters->EventFlag=true;
|
||||
}
|
||||
if
|
||||
((!(TestFlag(MoverParameters->Couplers[1].CouplingFlag,ctrain_controll))&&(MoverParameters->ActiveCab>0))||(!(TestFlag(MoverParameters->Couplers[0].CouplingFlag,ctrain_controll))&&(MoverParameters->ActiveCab<0)))
|
||||
{
|
||||
if (MoverParameters->MainSwitch(false))
|
||||
MoverParameters->EventFlag=true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// McZapkie-260202 - dMoveLen przyda sie przy stukocie kol
|
||||
dDOMoveLen =
|
||||
@@ -3210,21 +3210,23 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
MoverParameters->PantRearVolt = 0.0;
|
||||
break;
|
||||
} // pozostałe na razie nie obsługiwane
|
||||
if (MoverParameters->PantPress >
|
||||
(MoverParameters->TrainType == dt_EZT ? 2.5 : 3.3)) // Ra 2013-12:
|
||||
// Niebugocław
|
||||
// mówi, że w EZT
|
||||
// podnoszą się
|
||||
// przy 2.5
|
||||
pantspeedfactor = 0.015 * (MoverParameters->PantPress) *
|
||||
dt1; // z EXE Kursa //Ra: wysokość zależy od ciśnienia !!!
|
||||
else
|
||||
if( MoverParameters->PantPress > (
|
||||
MoverParameters->TrainType == dt_EZT ?
|
||||
2.45 : // Ra 2013-12: Niebugocław mówi, że w EZT podnoszą się przy 2.5
|
||||
3.45 ) ) {
|
||||
// z EXE Kursa
|
||||
// Ra: wysokość zależy od ciśnienia !!!
|
||||
pantspeedfactor = 0.015 * ( MoverParameters->PantPress ) * dt1;
|
||||
}
|
||||
else {
|
||||
pantspeedfactor = 0.0;
|
||||
if (pantspeedfactor < 0)
|
||||
pantspeedfactor = 0;
|
||||
}
|
||||
pantspeedfactor = std::max( 0.0, pantspeedfactor );
|
||||
k = p->fAngleL;
|
||||
if (i ? MoverParameters->PantRearUp :
|
||||
MoverParameters->PantFrontUp) // jeśli ma być podniesiony
|
||||
if( ( pantspeedfactor > 0.0 )
|
||||
&& ( i ?
|
||||
MoverParameters->PantRearUp :
|
||||
MoverParameters->PantFrontUp ) )// jeśli ma być podniesiony
|
||||
{
|
||||
if (PantDiff > 0.001) // jeśli nie dolega do drutu
|
||||
{ // jeśli poprzednia wysokość jest mniejsza niż pożądana, zwiększyć kąt
|
||||
@@ -3283,6 +3285,9 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
sPantDown.Play(vol, 0, MechInside, vPosition);
|
||||
MoverParameters->PantRearSP = true;
|
||||
}
|
||||
/*
|
||||
// NOTE: disabled because it's both redundant and doesn't take into account alternative power sources
|
||||
// converter and compressor will (should) turn off during their individual checks, in the mover's (fast)computemovement() calls
|
||||
if (MoverParameters->EnginePowerSource.SourceType == CurrentCollector)
|
||||
{ // Winger 240404 - wylaczanie sprezarki i
|
||||
// przetwornicy przy braku napiecia
|
||||
@@ -3292,6 +3297,7 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
MoverParameters->CompressorFlag = false; // Ra: to jest wątpliwe - wyłączenie sprężarki powinno być w jednym miejscu!
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if (MoverParameters->EnginePowerSource.SourceType == InternalSource)
|
||||
if (MoverParameters->EnginePowerSource.PowerType == SteamPower)
|
||||
@@ -4124,22 +4130,20 @@ void TDynamicObject::RenderSounds()
|
||||
sConverter.TurnOff(MechInside, GetPosition());
|
||||
sConverter.Update(MechInside, GetPosition());
|
||||
}
|
||||
if (MoverParameters->WarningSignal > 0)
|
||||
{
|
||||
if (TestFlag(MoverParameters->WarningSignal, 1))
|
||||
sHorn1.TurnOn(MechInside, GetPosition());
|
||||
else
|
||||
sHorn1.TurnOff(MechInside, GetPosition());
|
||||
if (TestFlag(MoverParameters->WarningSignal, 2))
|
||||
sHorn2.TurnOn(MechInside, GetPosition());
|
||||
else
|
||||
sHorn2.TurnOff(MechInside, GetPosition());
|
||||
|
||||
if( TestFlag( MoverParameters->WarningSignal, 1 ) ) {
|
||||
sHorn1.TurnOn( MechInside, GetPosition() );
|
||||
}
|
||||
else
|
||||
{
|
||||
sHorn1.TurnOff(MechInside, GetPosition());
|
||||
sHorn2.TurnOff(MechInside, GetPosition());
|
||||
else {
|
||||
sHorn1.TurnOff( MechInside, GetPosition() );
|
||||
}
|
||||
if( TestFlag( MoverParameters->WarningSignal, 2 ) ) {
|
||||
sHorn2.TurnOn( MechInside, GetPosition() );
|
||||
}
|
||||
else {
|
||||
sHorn2.TurnOff( MechInside, GetPosition() );
|
||||
}
|
||||
|
||||
if (MoverParameters->DoorClosureWarning)
|
||||
{
|
||||
if (MoverParameters->DepartureSignal) // NBMX sygnal odjazdu, MC: pod warunkiem ze jest
|
||||
|
||||
@@ -130,7 +130,9 @@ class TTranscript
|
||||
float fHide; // czas ukrycia/usunięcia
|
||||
std::string asText; // tekst gotowy do wyświetlenia (usunięte znaczniki czasu)
|
||||
bool bItalic; // czy kursywa (dźwięk nieistotny dla prowadzącego)
|
||||
/*
|
||||
int iNext; // następna używana linijka, żeby nie przestawiać fizycznie tabeli
|
||||
*/
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
2
Ground.h
2
Ground.h
@@ -69,7 +69,7 @@ struct TGroundVertex
|
||||
{
|
||||
vector3 Point;
|
||||
vector3 Normal;
|
||||
float tu, tv;
|
||||
float tu{ 0.0f }, tv{ 0.0f };
|
||||
void HalfSet(const TGroundVertex &v1, const TGroundVertex &v2)
|
||||
{ // wyliczenie współrzędnych i mapowania punktu na środku odcinka v1<->v2
|
||||
Point = 0.5 * (v1.Point + v2.Point);
|
||||
|
||||
@@ -139,7 +139,23 @@ static int const ctrain_passenger = 16; //mostek przejściowy
|
||||
static int const ctrain_scndpneumatic = 32; //przewody 8 atm (żółte; zasilanie powietrzem)
|
||||
static int const ctrain_heating = 64; //przewody ogrzewania WN
|
||||
static int const ctrain_depot = 128; //nie rozłączalny podczas zwykłych manewrów (międzyczłonowy), we wpisie wartość ujemna
|
||||
|
||||
enum coupling {
|
||||
faux = 0x0,
|
||||
coupler = 0x1,
|
||||
brakehose = 0x2,
|
||||
control = 0x4,
|
||||
highvoltage = 0x8,
|
||||
gangway = 0x10,
|
||||
mainhose = 0x20,
|
||||
heating = 0x40,
|
||||
permanent = 0x80
|
||||
};
|
||||
/*! przesylanie komend sterujacych*/
|
||||
enum command_range {
|
||||
local,
|
||||
unit,
|
||||
consist
|
||||
};
|
||||
/*typ hamulca elektrodynamicznego*/
|
||||
static int const dbrake_none = 0;
|
||||
static int const dbrake_passive = 1;
|
||||
@@ -269,7 +285,8 @@ struct TCommand
|
||||
std::string Command; /*komenda*/
|
||||
double Value1 = 0.0; /*argumenty komendy*/
|
||||
double Value2 = 0.0;
|
||||
TLocation Location;
|
||||
int Coupling{ ctrain_controll }; // coupler flag used to determine command propagation
|
||||
TLocation Location;
|
||||
};
|
||||
|
||||
/*tory*/
|
||||
@@ -360,14 +377,14 @@ struct TBoilerType {
|
||||
};
|
||||
/*rodzaj odbieraka pradu*/
|
||||
struct TCurrentCollector {
|
||||
long CollectorsNo; //musi być tu, bo inaczej się kopie
|
||||
double MinH; double MaxH; //zakres ruchu pantografu, nigdzie nie używany
|
||||
double CSW; //szerokość części roboczej (styku) ślizgacza
|
||||
double MinV; double MaxV; //minimalne i maksymalne akceptowane napięcie
|
||||
double OVP; //czy jest przekaznik nadnapieciowy
|
||||
double InsetV; //minimalne napięcie wymagane do załączenia
|
||||
double MinPress; //minimalne ciśnienie do załączenia WS
|
||||
double MaxPress; //maksymalne ciśnienie za reduktorem
|
||||
long CollectorsNo{ 0 }; //musi być tu, bo inaczej się kopie
|
||||
double MinH{ 0.0 }; double MaxH{ 0.0 }; //zakres ruchu pantografu, nigdzie nie używany
|
||||
double CSW{ 0.0 }; //szerokość części roboczej (styku) ślizgacza
|
||||
double MinV{ 0.0 }; double MaxV{ 0.0 }; //minimalne i maksymalne akceptowane napięcie
|
||||
double OVP{ 0.0 }; //czy jest przekaznik nadnapieciowy
|
||||
double InsetV{ 0.0 }; //minimalne napięcie wymagane do załączenia
|
||||
double MinPress{ 0.0 }; //minimalne ciśnienie do załączenia WS
|
||||
double MaxPress{ 0.0 }; //maksymalne ciśnienie za reduktorem
|
||||
//inline TCurrentCollector() {
|
||||
// CollectorsNo = 0;
|
||||
// MinH, MaxH, CSW, MinV, MaxV = 0.0;
|
||||
@@ -536,6 +553,12 @@ struct TTransmision
|
||||
|
||||
enum TCouplerType { NoCoupler, Articulated, Bare, Chain, Screw, Automatic };
|
||||
|
||||
struct power_coupling {
|
||||
double current{ 0.0 };
|
||||
double voltage{ 0.0 };
|
||||
bool local{ false }; // whether the power comes from external or onboard source
|
||||
};
|
||||
|
||||
struct TCoupling {
|
||||
/*parametry*/
|
||||
double SpringKB = 1.0; /*stala sprezystosci zderzaka/sprzegu, %tlumiennosci */
|
||||
@@ -556,6 +579,9 @@ struct TCoupling {
|
||||
double CForce = 0.0; /*sila z jaka dzialal*/
|
||||
double Dist = 0.0; /*strzalka ugiecia zderzaków*/
|
||||
bool CheckCollision = false; /*czy sprawdzac sile czy pedy*/
|
||||
|
||||
power_coupling power_high;
|
||||
power_coupling power_low; // TODO: implement this
|
||||
};
|
||||
|
||||
class TMoverParameters
|
||||
@@ -768,7 +794,17 @@ public:
|
||||
TRotation Rot;
|
||||
std::string Name; /*nazwa wlasna*/
|
||||
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
|
||||
double HVCouplers[2][2]; //przewod WN
|
||||
enum side {
|
||||
front = 0,
|
||||
rear
|
||||
};
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
double HVCouplers[ 2 ][ 2 ]; //przewod WN
|
||||
enum hvcoupler {
|
||||
current = 0,
|
||||
voltage
|
||||
};
|
||||
#endif
|
||||
int ScanCounter = 0; /*pomocnicze do skanowania sprzegow*/
|
||||
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
|
||||
int SoundFlag = 0; /*!o patrz stale sound_ */
|
||||
@@ -804,6 +840,7 @@ public:
|
||||
bool CompressorFlag = false; /*!o czy wlaczona sprezarka*/
|
||||
bool PantCompFlag = false; /*!o czy wlaczona sprezarka pantografow*/
|
||||
bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/
|
||||
bool CompressorGovernorLock{ false }; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure
|
||||
bool ConverterFlag = false ; /*! czy wlaczona przetwornica NBMX*/
|
||||
bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/
|
||||
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
|
||||
@@ -812,7 +849,9 @@ public:
|
||||
int LocalBrakePos = 0; /*nastawa hamulca indywidualnego*/
|
||||
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
|
||||
double LocalBrakePosA = 0.0;
|
||||
int BrakeStatus = b_off; /*0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R*/
|
||||
/*
|
||||
int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R
|
||||
*/
|
||||
bool EmergencyBrakeFlag = false; /*hamowanie nagle*/
|
||||
int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/
|
||||
int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
|
||||
@@ -886,7 +925,9 @@ public:
|
||||
double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/
|
||||
bool UnBrake = false; /*w EZT - nacisniete odhamowywanie*/
|
||||
double PantPress = 0.0; /*Cisnienie w zbiornikach pantografow*/
|
||||
bool s_CAtestebrake = false; //hunter-091012: zmienna dla testu ca
|
||||
bool PantPressSwitchActive{ false }; // state of the pantograph pressure switch. gets primed at defined pressure level in pantograph air system
|
||||
bool PantPressLockActive{ false }; // pwr system state flag. fires when pressure switch activates by pantograph pressure dropping below defined level
|
||||
bool s_CAtestebrake = false; //hunter-091012: zmienna dla testu ca
|
||||
|
||||
/*-zmienne dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
||||
double dizel_fill = 0.0; /*napelnienie*/
|
||||
@@ -982,11 +1023,11 @@ public:
|
||||
|
||||
/*! przesylanie komend sterujacych*/
|
||||
bool SendCtrlBroadcast(std::string CtrlCommand, double ctrlvalue);
|
||||
bool SendCtrlToNext(std::string CtrlCommand, double ctrlvalue, double dir);
|
||||
bool SetInternalCommand(std::string NewCommand, double NewValue1, double NewValue2);
|
||||
bool SendCtrlToNext(std::string const CtrlCommand, double const ctrlvalue, double const dir, int const Couplertype = ctrain_controll);
|
||||
bool SetInternalCommand( std::string NewCommand, double NewValue1, double NewValue2, int const Couplertype = ctrain_controll );
|
||||
double GetExternalCommand(std::string &Command);
|
||||
bool RunCommand(std::string Command, double CValue1, double CValue2);
|
||||
bool RunInternalCommand(void);
|
||||
bool RunCommand( std::string Command, double CValue1, double CValue2, int const Couplertype = ctrain_controll );
|
||||
bool RunInternalCommand();
|
||||
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
|
||||
bool CabActivisation(void);
|
||||
bool CabDeactivisation(void);
|
||||
@@ -1002,7 +1043,7 @@ public:
|
||||
|
||||
bool AddPulseForce(int Multipler);/*dla drezyny*/
|
||||
|
||||
bool SandDoseOn(void);/*wlacza/wylacza sypanie piasku*/
|
||||
bool Sandbox( bool const State, int const Notify = command_range::consist );/*wlacza/wylacza sypanie piasku*/
|
||||
|
||||
/*! zbijanie czuwaka/SHP*/
|
||||
void SSReset(void);
|
||||
@@ -1058,9 +1099,9 @@ public:
|
||||
|
||||
/*--funkcje dla lokomotyw*/
|
||||
bool DirectionBackward(void);/*! kierunek ruchu*/
|
||||
bool MainSwitch(bool State);/*! wylacznik glowny*/
|
||||
bool ConverterSwitch(bool State);/*! wl/wyl przetwornicy*/
|
||||
bool CompressorSwitch(bool State);/*! wl/wyl sprezarki*/
|
||||
bool MainSwitch( bool const State, int const Notify = command_range::consist );/*! wylacznik glowny*/
|
||||
bool ConverterSwitch( bool State, int const Notify = command_range::consist );/*! wl/wyl przetwornicy*/
|
||||
bool CompressorSwitch( bool State, int const Notify = command_range::consist );/*! wl/wyl sprezarki*/
|
||||
|
||||
/*-funkcje typowe dla lokomotywy elektrycznej*/
|
||||
void ConverterCheck(); // przetwornica
|
||||
@@ -1074,7 +1115,7 @@ public:
|
||||
/*function ShowEngineRotation(VehN:int): integer; //Ra 2014-06: przeniesione do C++*/
|
||||
/*funkcje uzalezniajace sile pociagowa od predkosci: v2n, n2r, current, momentum*/
|
||||
double v2n(void);
|
||||
double current(double n, double U);
|
||||
double Current(double n, double U);
|
||||
double Momentum(double I);
|
||||
double MomentumF(double I, double Iw, int SCP);
|
||||
|
||||
@@ -1086,8 +1127,8 @@ public:
|
||||
bool AutoRelayCheck(void);//symulacja automatycznego rozruchu
|
||||
|
||||
bool ResistorsFlagCheck(void); //sprawdzenie kontrolki oporow rozruchowych NBMX
|
||||
bool PantFront(bool State); //obsluga pantografou przedniego
|
||||
bool PantRear(bool State); //obsluga pantografu tylnego
|
||||
bool PantFront( bool const State, int const Notify = command_range::consist ); //obsluga pantografou przedniego
|
||||
bool PantRear( bool const State, int const Notify = command_range::consist ); //obsluga pantografu tylnego
|
||||
|
||||
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
||||
bool dizel_EngageSwitch(double state);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,6 +16,7 @@ Copyright (C) 2007-2014 Maciej Cierniak
|
||||
#include "hamulce.h"
|
||||
#include <typeinfo>
|
||||
#include "Mover.h"
|
||||
#include "usefull.h"
|
||||
|
||||
//---FUNKCJE OGOLNE---
|
||||
|
||||
@@ -51,10 +52,10 @@ double PF_old(double P1, double P2, double S)
|
||||
|
||||
double PF( double const P1, double const P2, double const S, double const DP )
|
||||
{
|
||||
double PH = std::max(P1, P2) + 1; // wyzsze cisnienie absolutne
|
||||
double PL = P1 + P2 - PH + 2; // nizsze cisnienie absolutne
|
||||
double sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||
double FM = PH * 197 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
||||
double const PH = std::max(P1, P2) + 1.0; // wyzsze cisnienie absolutne
|
||||
double const PL = P1 + P2 - PH + 2.0; // nizsze cisnienie absolutne
|
||||
double const sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||
double const FM = PH * 197.0 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
||||
if (sg > 0.5) // jesli ponizej stosunku krytycznego
|
||||
if ((PH - PL) < DP) // niewielka roznica cisnien
|
||||
return (1.0 - sg) / DPL * FM * 2.0 * std::sqrt((DP) * (PH - DP));
|
||||
@@ -69,15 +70,15 @@ double PF1( double const P1, double const P2, double const S )
|
||||
{
|
||||
static double const DPS = 0.001;
|
||||
|
||||
double PH = std::max(P1, P2) + 1; // wyzsze cisnienie absolutne
|
||||
double PL = P1 + P2 - PH + 2; // nizsze cisnienie absolutne
|
||||
double sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||
double FM = PH * 197 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
||||
if ((sg > 0.5)) // jesli ponizej stosunku krytycznego
|
||||
if ((sg < DPS)) // niewielka roznica cisnien
|
||||
return (1 - sg) / DPS * FM * 2 * std::sqrt((DPS) * (1 - DPS));
|
||||
double const PH = std::max(P1, P2) + 1.0; // wyzsze cisnienie absolutne
|
||||
double const PL = P1 + P2 - PH + 2.0; // nizsze cisnienie absolutne
|
||||
double const sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||
double const FM = PH * 197.0 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
||||
if (sg > 0.5) // jesli ponizej stosunku krytycznego
|
||||
if (sg < DPS) // niewielka roznica cisnien
|
||||
return (1.0 - sg) / DPS * FM * 2.0 * std::sqrt((DPS) * (1.0 - DPS));
|
||||
else
|
||||
return FM * 2 * std::sqrt((sg) * (1 - sg));
|
||||
return FM * 2.0 * std::sqrt((sg) * (1.0 - sg));
|
||||
else // powyzej stosunku krytycznego
|
||||
return FM;
|
||||
}
|
||||
@@ -1184,50 +1185,50 @@ void TESt3AL2::Init( double const PP, double const HPP, double const LPP, double
|
||||
double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
||||
{
|
||||
double result;
|
||||
double dv;
|
||||
double dV1;
|
||||
double temp;
|
||||
double VVP;
|
||||
double BVP;
|
||||
double BCP;
|
||||
double CVP;
|
||||
|
||||
// ValveRes.CreatePress(LBP);
|
||||
// LBP:=0;
|
||||
|
||||
BVP = BrakeRes->P();
|
||||
VVP = ValveRes->P();
|
||||
BCP = ImplsRes->P();
|
||||
CVP = CntrlRes->P();
|
||||
double const BVP{ BrakeRes->P() };
|
||||
double const VVP{ ValveRes->P() };
|
||||
double const BCP{ ImplsRes->P() };
|
||||
double const CVP{ CntrlRes->P() };
|
||||
|
||||
dv = 0;
|
||||
dV1 = 0;
|
||||
double dV{ 0.0 };
|
||||
double dV1{ 0.0 };
|
||||
|
||||
// sprawdzanie stanu
|
||||
if ((BrakeStatus & b_rls) == b_rls)
|
||||
if ((CVP < 0))
|
||||
if( ( BrakeStatus & b_rls ) == b_rls ) {
|
||||
if( CVP < 0.0 ) {
|
||||
BrakeStatus &= ~b_rls;
|
||||
}
|
||||
else
|
||||
{ // 008
|
||||
dv = PF1(CVP, BCP, 0.024) * dt;
|
||||
CntrlRes->Flow(+dv);
|
||||
// dV1:=+dV; //minus potem jest
|
||||
// ImplsRes->Flow(-dV1);
|
||||
dV = PF1( CVP, BCP, 0.024 ) * dt;
|
||||
CntrlRes->Flow( dV );
|
||||
/*
|
||||
// NOTE: attempted fix, disabled because it breaks when releaser is used while releasing breakes
|
||||
dV = PF1(CVP, VVP, 0.024) * dt;
|
||||
CntrlRes->Flow( dV );
|
||||
dV1 = dV; //minus potem jest
|
||||
ImplsRes->Flow( -dV1 );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
VVP = ValveRes->P();
|
||||
double temp;
|
||||
// przeplyw ZS <-> PG
|
||||
if (((CVP - BCP) * BVM > 0.5))
|
||||
temp = 0;
|
||||
temp = 0.0;
|
||||
else if ((VVP > CVP + 0.4))
|
||||
temp = 0.5;
|
||||
else
|
||||
temp = 0.5;
|
||||
|
||||
dv = PF1(CVP, VVP, 0.0015 * temp / 1.8 / 2) * dt;
|
||||
CntrlRes->Flow(+dv);
|
||||
ValveRes->Flow(-0.04 * dv);
|
||||
dV1 = dV1 - 0.96 * dv;
|
||||
dV = PF1(CVP, VVP, 0.0015 * temp / 1.8 / 2) * dt;
|
||||
CntrlRes->Flow(+dV);
|
||||
ValveRes->Flow(-0.04 * dV);
|
||||
dV1 = dV1 - 0.96 * dV;
|
||||
|
||||
// luzowanie KI {G}
|
||||
// if VVP>BCP then
|
||||
@@ -1236,26 +1237,38 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
||||
// dV:=PF(VVP,BCP,0.00020*(1.33-int((CVP-BCP)*BVM>0.65)))*dt
|
||||
// else dV:=0; 0.00025 P
|
||||
/*P*/
|
||||
if (VVP > BCP)
|
||||
dv = PF(VVP, BCP,
|
||||
0.00043 * (1.5 - int(((CVP - BCP) * BVM > 1) && (BrakeDelayFlag == bdelay_G))),
|
||||
0.1) *
|
||||
dt;
|
||||
else if ((CVP - BCP) < 1.5)
|
||||
dv = PF(VVP, BCP,
|
||||
0.001472 * (1.36 - int(((CVP - BCP) * BVM > 1) && (BrakeDelayFlag == bdelay_G))),
|
||||
0.1) *
|
||||
dt;
|
||||
else
|
||||
dv = 0;
|
||||
if( VVP > BCP ) {
|
||||
dV =
|
||||
PF( VVP, BCP,
|
||||
0.00043 * ( 1.5 - (
|
||||
true == ( ( ( CVP - BCP ) * BVM > 1.0 )
|
||||
&& ( BrakeDelayFlag == bdelay_G ) ) ?
|
||||
1.0 :
|
||||
0.0 ) ),
|
||||
0.1 )
|
||||
* dt;
|
||||
}
|
||||
else if( ( CVP - BCP ) < 1.5 ) {
|
||||
dV = PF( VVP, BCP,
|
||||
0.001472 * ( 1.36 - (
|
||||
true == ( ( ( CVP - BCP ) * BVM > 1.0 )
|
||||
&& ( BrakeDelayFlag == bdelay_G ) ) ?
|
||||
1.0 :
|
||||
0.0 ) ),
|
||||
0.1 )
|
||||
* dt;
|
||||
}
|
||||
else {
|
||||
dV = 0;
|
||||
}
|
||||
|
||||
ImplsRes->Flow(-dv);
|
||||
ValveRes->Flow(+dv);
|
||||
ImplsRes->Flow(-dV);
|
||||
ValveRes->Flow(+dV);
|
||||
// przeplyw PG <-> rozdzielacz
|
||||
dv = PF(PP, VVP, 0.01, 0.1) * dt;
|
||||
ValveRes->Flow(-dv);
|
||||
dV = PF(PP, VVP, 0.01, 0.1) * dt;
|
||||
ValveRes->Flow(-dV);
|
||||
|
||||
result = dv - dV1;
|
||||
result = dV - dV1;
|
||||
|
||||
// if Vel>55 then temp:=0.72 else
|
||||
// temp:=1;{R}
|
||||
@@ -1272,18 +1285,18 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
||||
if ((BrakeCyl->P() > temp + 0.005) || (temp < 0.28))
|
||||
// dV:=PF(0,BrakeCyl->P(),0.0015*3*sizeBC)*dt
|
||||
// dV:=PF(0,BrakeCyl->P(),0.005*3*sizeBC)*dt
|
||||
dv = PFVd(BrakeCyl->P(), 0, 0.005 * 7 * SizeBC, temp) * dt;
|
||||
dV = PFVd(BrakeCyl->P(), 0, 0.005 * 7 * SizeBC, temp) * dt;
|
||||
else
|
||||
dv = 0;
|
||||
BrakeCyl->Flow(-dv);
|
||||
dV = 0;
|
||||
BrakeCyl->Flow(-dV);
|
||||
// przeplyw ZP <-> CH
|
||||
if ((BrakeCyl->P() < temp - 0.005) && (temp > 0.29))
|
||||
// dV:=PF(BVP,BrakeCyl->P(),0.002*3*sizeBC*2)*dt
|
||||
dv = -PFVa(BVP, BrakeCyl->P(), 0.002 * 7 * SizeBC * 2, temp) * dt;
|
||||
dV = -PFVa(BVP, BrakeCyl->P(), 0.002 * 7 * SizeBC * 2, temp) * dt;
|
||||
else
|
||||
dv = 0;
|
||||
BrakeRes->Flow(dv);
|
||||
BrakeCyl->Flow(-dv);
|
||||
dV = 0;
|
||||
BrakeRes->Flow(dV);
|
||||
BrakeCyl->Flow(-dV);
|
||||
|
||||
ImplsRes->Act();
|
||||
ValveRes->Act();
|
||||
@@ -2198,124 +2211,145 @@ double TFV4aM::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
static int const LBDelay = 100;
|
||||
static double const xpM = 0.3; // mnoznik membrany komory pod
|
||||
|
||||
double LimPP;
|
||||
double dpPipe;
|
||||
double dpMainValve;
|
||||
double ActFlowSpeed;
|
||||
double DP;
|
||||
double pom;
|
||||
int i;
|
||||
ep = (PP / 2.0) * 1.5 + (ep / 2.0) * 0.5; // SPKS!!
|
||||
|
||||
ep = PP / 2 * 1.5 + ep / 2 * 0.5; // SPKS!!
|
||||
// ep:=pp;
|
||||
// ep:=cp/3+pp/3+ep/3;
|
||||
// ep:=cp;
|
||||
for( int idx = 0; idx < 5; ++idx ) {
|
||||
Sounds[ idx ] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; ++i)
|
||||
Sounds[i] = 0;
|
||||
DP = 0;
|
||||
// na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||
i_bcp = clamp( i_bcp, -1.999, 5.999 );
|
||||
|
||||
i_bcp = Max0R(Min0R(i_bcp, 5.999), -1.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||
|
||||
if ((TP > 0))
|
||||
{ // jesli czasowy jest niepusty
|
||||
// dp:=0.07; //od cisnienia 5 do 0 w 60 sekund ((5-0)*dt/75)
|
||||
double DP{ 0.0 };
|
||||
if( TP > 0.0 ) {
|
||||
// jesli czasowy jest niepusty
|
||||
DP = 0.045; // 2.5 w 55 sekund (5,35->5,15 w PG)
|
||||
TP = TP - DP * dt;
|
||||
TP -= DP * dt;
|
||||
Sounds[s_fv4a_t] = DP;
|
||||
}
|
||||
else //.08
|
||||
{
|
||||
TP = 0;
|
||||
else {
|
||||
//.08
|
||||
TP = 0.0;
|
||||
}
|
||||
|
||||
if ((XP > 0)) // jesli komora pod niepusta jest niepusty
|
||||
{
|
||||
if (XP > 0) {
|
||||
// jesli komora pod niepusta jest niepusty
|
||||
DP = 2.5;
|
||||
Sounds[s_fv4a_x] = DP * XP;
|
||||
XP = XP - dt * DP * 2; // od cisnienia 5 do 0 w 10 sekund ((5-0)*dt/10)
|
||||
XP -= dt * DP * 2.0; // od cisnienia 5 do 0 w 10 sekund ((5-0)*dt/10)
|
||||
}
|
||||
else {
|
||||
// jak pusty, to pusty
|
||||
XP = 0.0;
|
||||
}
|
||||
else //.75
|
||||
XP = 0; // jak pusty, to pusty
|
||||
|
||||
LimPP = Min0R(LPP_RP(i_bcp) + TP * 0.08 + RedAdj, HP); // pozycja + czasowy lub zasilanie
|
||||
ActFlowSpeed = BPT[lround(i_bcp) + 2][0];
|
||||
double pom;
|
||||
if( EQ( i_bcp, -1.0 ) ) {
|
||||
pom = std::min( HP, 5.4 + RedAdj );
|
||||
}
|
||||
else {
|
||||
pom = std::min( CP, HP );
|
||||
}
|
||||
|
||||
if ((EQ(i_bcp, -1)))
|
||||
pom = Min0R(HP, 5.4 + RedAdj);
|
||||
else
|
||||
pom = Min0R(CP, HP);
|
||||
|
||||
if ((pom > RP + 0.25))
|
||||
if( pom > RP + 0.25 ) {
|
||||
Fala = true;
|
||||
if ((Fala))
|
||||
if ((pom > RP + 0.3))
|
||||
// if(ep>rp+0.11)then
|
||||
XP = XP - 20 * PR(pom, XP) * dt;
|
||||
// else
|
||||
// xp:=xp-16*(ep-(ep+0.01))/(0.1)*PR(ep,xp)*dt;
|
||||
else
|
||||
}
|
||||
if( Fala ) {
|
||||
if( pom > RP + 0.3 ) {
|
||||
XP = XP - 20.0 * PR( pom, XP ) * dt;
|
||||
}
|
||||
else {
|
||||
Fala = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((LimPP > CP)) // podwyzszanie szybkie
|
||||
CP = CP + 5 * 60 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy;
|
||||
else
|
||||
CP = CP + 13 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
|
||||
double LimPP = std::min(
|
||||
LPP_RP( i_bcp ) + TP * 0.08 + RedAdj,
|
||||
HP ); // pozycja + czasowy lub zasilanie
|
||||
|
||||
// zbiornik sterujacy
|
||||
if( LimPP > CP ) {
|
||||
// podwyzszanie szybkie
|
||||
CP +=
|
||||
5.0 * 60.0
|
||||
* std::min(
|
||||
std::abs( LimPP - CP ),
|
||||
0.05 )
|
||||
* PR( CP, LimPP )
|
||||
* dt;
|
||||
}
|
||||
else {
|
||||
CP +=
|
||||
13
|
||||
* std::min(
|
||||
std::abs( LimPP - CP ),
|
||||
0.05 )
|
||||
* PR( CP, LimPP )
|
||||
* dt;
|
||||
}
|
||||
|
||||
LimPP = pom; // cp
|
||||
dpPipe = Min0R(HP, LimPP + XP * xpM);
|
||||
double const dpPipe = std::min(HP, LimPP + XP * xpM);
|
||||
|
||||
if (dpPipe > PP)
|
||||
dpMainValve = -PFVa(HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||
else
|
||||
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||
double const ActFlowSpeed = BPT[ std::lround( i_bcp ) + 2 ][ 0 ];
|
||||
|
||||
if (EQ(i_bcp, -1))
|
||||
{
|
||||
if ((TP < 5))
|
||||
TP = TP + dt; // 5/10
|
||||
if ((TP < 1))
|
||||
TP = TP - 0.5 * dt; // 5/10
|
||||
// dpMainValve:=dpMainValve*2;
|
||||
//+1*PF(dpPipe,pp,ActFlowSpeed/LBDelay)//coby
|
||||
// nie przeszkadzal przy ladowaniu z zaworu obok
|
||||
double dpMainValve;
|
||||
if( dpPipe > PP ) {
|
||||
dpMainValve = -PFVa( HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4 );
|
||||
}
|
||||
else {
|
||||
dpMainValve = PFVd( PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4 );
|
||||
}
|
||||
|
||||
if (EQ(i_bcp, 0))
|
||||
{
|
||||
if ((TP > 2))
|
||||
dpMainValve = dpMainValve * 1.5; //+0.5*PF(dpPipe,pp,ActFlowSpeed/LBDelay)//coby nie
|
||||
// przeszkadzal przy ladowaniu z zaworu obok
|
||||
if (EQ(i_bcp, -1)) {
|
||||
|
||||
if( TP < 5 ) { TP += dt; }
|
||||
if( TP < 1 ) { TP -= 0.5 * dt; }
|
||||
}
|
||||
|
||||
if (EQ(i_bcp, 0)) {
|
||||
|
||||
if( TP > 2 ) {
|
||||
dpMainValve *= 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
ep = dpPipe;
|
||||
if ((EQ(i_bcp, 0) || (RP > ep)))
|
||||
RP = RP + PF(RP, ep, 0.0007) * dt; // powolne wzrastanie, ale szybsze na jezdzie;
|
||||
else
|
||||
RP = RP + PF(RP, ep, 0.000093 / 2 * 2) * dt; // powolne wzrastanie i to bardzo
|
||||
// jednak trzeba wydluzyc, bo
|
||||
// obecnie zle dziala
|
||||
if ((RP < ep) &&
|
||||
(RP <
|
||||
BPT[lround(i_bcpno) + 2][1])) // jesli jestesmy ponizej cisnienia w sterujacym (2.9 bar)
|
||||
RP = RP + PF(RP, CP, 0.005) * dt; // przypisz cisnienie w PG - wydluzanie napelniania o czas
|
||||
// potrzebny do napelnienia PG
|
||||
if( ( EQ( i_bcp, 0 )
|
||||
|| ( RP > ep ) ) ) {
|
||||
// powolne wzrastanie, ale szybsze na jezdzie;
|
||||
RP += PF( RP, ep, 0.0007 ) * dt;
|
||||
}
|
||||
else {
|
||||
// powolne wzrastanie i to bardzo
|
||||
RP += PF( RP, ep, 0.000093 / 2 * 2 ) * dt;
|
||||
}
|
||||
// jednak trzeba wydluzyc, bo obecnie zle dziala
|
||||
if( ( RP < ep )
|
||||
&& ( RP < BPT[ std::lround( i_bcpno ) + 2 ][ 1 ] ) ) {
|
||||
// jesli jestesmy ponizej cisnienia w sterujacym (2.9 bar)
|
||||
// przypisz cisnienie w PG - wydluzanie napelniania o czas potrzebny do napelnienia PG
|
||||
RP += PF( RP, CP, 0.005 ) * dt;
|
||||
}
|
||||
|
||||
if ((EQ(i_bcp, i_bcpno)) || (EQ(i_bcp, -2)))
|
||||
{
|
||||
DP = PF(0, PP, ActFlowSpeed / LBDelay);
|
||||
if( ( EQ( i_bcp, i_bcpno ) )
|
||||
|| ( EQ( i_bcp, -2 ) ) ) {
|
||||
|
||||
DP = PF( 0.0, PP, ActFlowSpeed / LBDelay );
|
||||
dpMainValve = DP;
|
||||
Sounds[s_fv4a_e] = DP;
|
||||
Sounds[s_fv4a_u] = 0;
|
||||
Sounds[s_fv4a_b] = 0;
|
||||
Sounds[s_fv4a_x] = 0;
|
||||
Sounds[s_fv4a_u] = 0.0;
|
||||
Sounds[s_fv4a_b] = 0.0;
|
||||
Sounds[s_fv4a_x] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dpMainValve > 0)
|
||||
Sounds[s_fv4a_b] = dpMainValve;
|
||||
else
|
||||
Sounds[s_fv4a_u] = -dpMainValve;
|
||||
else {
|
||||
|
||||
if( dpMainValve > 0.0 ) {
|
||||
Sounds[ s_fv4a_b ] = dpMainValve;
|
||||
}
|
||||
else {
|
||||
Sounds[ s_fv4a_u ] = -dpMainValve;
|
||||
}
|
||||
}
|
||||
|
||||
return dpMainValve * dt;
|
||||
@@ -2347,17 +2381,11 @@ double TFV4aM::GetPos(int i)
|
||||
|
||||
double TFV4aM::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
|
||||
{
|
||||
int i_pos;
|
||||
int const i_pos = 2 + std::floor( pos ); // zaokraglone w dol
|
||||
|
||||
i_pos = lround(pos - 0.5) + 2; // zaokraglone w dol
|
||||
double i, j, k, l;
|
||||
i = BPT[i_pos][1];
|
||||
j = BPT[i_pos + 1][1];
|
||||
k = pos + 2 - i_pos;
|
||||
l = i + (j - i) * k;
|
||||
double r = BPT[i_pos][1] +
|
||||
(BPT[i_pos + 1][1] - BPT[i_pos][1]) * (pos + 2 - i_pos); // interpolacja liniowa
|
||||
return r;
|
||||
return
|
||||
BPT[i_pos][1]
|
||||
+ (BPT[i_pos + 1][1] - BPT[i_pos][1]) * ((pos + 2) - i_pos); // interpolacja liniowa
|
||||
}
|
||||
bool TFV4aM::EQ(double pos, double i_pos)
|
||||
{
|
||||
@@ -2366,8 +2394,7 @@ bool TFV4aM::EQ(double pos, double i_pos)
|
||||
|
||||
//---FV4a/M--- nowonapisany kran bez poprawki IC
|
||||
|
||||
double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
{
|
||||
double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double ep ) {
|
||||
static int const LBDelay = 100;
|
||||
|
||||
double LimPP;
|
||||
@@ -2376,13 +2403,11 @@ double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep
|
||||
double ActFlowSpeed;
|
||||
double DP;
|
||||
double pom;
|
||||
int i;
|
||||
|
||||
{
|
||||
long i_end = 5;
|
||||
for (i = 0; i < i_end; ++i)
|
||||
Sounds[i] = 0;
|
||||
for( int idx = 0; idx < 5; ++idx ) {
|
||||
Sounds[ idx ] = 0;
|
||||
}
|
||||
|
||||
DP = 0;
|
||||
|
||||
i_bcp = Max0R(Min0R(i_bcp, 9.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||
|
||||
@@ -184,7 +184,7 @@ class TBrake {
|
||||
bool DCV = false; //podwojny zawor zwrotny
|
||||
double ASBP = 0.0; //cisnienie hamulca pp
|
||||
|
||||
int BrakeStatus = 0; //flaga stanu
|
||||
int BrakeStatus{ b_off }; //flaga stanu
|
||||
int SoundFlag = 0;
|
||||
|
||||
public:
|
||||
@@ -213,6 +213,8 @@ class TBrake {
|
||||
void SetASBP( double const Press ); //ustalenie cisnienia pp
|
||||
virtual void ForceEmptiness();
|
||||
int GetSoundFlag();
|
||||
int GetBrakeStatus() const { return BrakeStatus; }
|
||||
void SetBrakeStatus( int const Status ) { BrakeStatus = Status; }
|
||||
virtual void SetED( double const EDstate ) {}; //stan hamulca ED do luzowania
|
||||
};
|
||||
|
||||
|
||||
@@ -801,6 +801,7 @@ void TSegment::RaRenderLoft(CVertNormTex *&Vert, const vector6 *ShapePoints, int
|
||||
s = fStep * iSkip; // iSkip - ile odcinków z początku pominąć
|
||||
i = iSkip; // domyślnie 0
|
||||
t = fTsBuffer[i]; // tabela wattości t dla segmentów
|
||||
// BUG: length of spline can be 0, we should skip geometry generation for such cases
|
||||
fOffset = 0.1 / fLength; // pierwsze 10cm
|
||||
pos1 = FastGetPoint(t); // wektor początku segmentu
|
||||
dir = FastGetDirection(t, fOffset); // wektor kierunku
|
||||
|
||||
@@ -424,7 +424,6 @@ opengl_texture::load_TGA() {
|
||||
else if( tgaheader[ 2 ] == 10 ) {
|
||||
// compressed TGA
|
||||
int currentpixel = 0;
|
||||
int currentbyte = 0;
|
||||
|
||||
unsigned char buffer[ 4 ] = { 255, 255, 255, 255 };
|
||||
const int pixelcount = data_width * data_height;
|
||||
|
||||
557
Train.cpp
557
Train.cpp
@@ -925,19 +925,17 @@ void TTrain::OnCommand_sandboxactivate( TTrain *Train, command_data const &Comma
|
||||
return;
|
||||
}
|
||||
|
||||
if( Command.action != GLFW_RELEASE ) {
|
||||
// press or hold
|
||||
Train->mvControlled->SandDose = true;
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// press
|
||||
Train->mvControlled->Sandbox( true );
|
||||
// audio feedback
|
||||
if( Train->ggSandButton.GetValue() < 0.05 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
Train->ggSandButton.UpdateValue( 1.0 );
|
||||
}
|
||||
else {
|
||||
else if( Command.action == GLFW_RELEASE) {
|
||||
// release
|
||||
Train->mvControlled->SandDose = false;
|
||||
Train->mvControlled->Sandbox( false );
|
||||
/*
|
||||
// audio feedback
|
||||
if( Train->ggAntiSlipButton.GetValue() > 0.5 ) {
|
||||
@@ -1212,41 +1210,20 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( false == ( Train->mvOccupied->ActiveCab == 1 ? Train->mvControlled->PantFrontUp : Train->mvControlled->PantRearUp ) ) {
|
||||
if( false == Train->mvControlled->PantFrontUp ) {
|
||||
// turn on...
|
||||
if( Train->mvOccupied->ActiveCab == 1 ) {
|
||||
// przedni gdy w kabinie 1
|
||||
Train->mvControlled->PantFrontSP = false;
|
||||
if( Train->mvControlled->PantFront( true ) ) {
|
||||
if( Train->mvControlled->PantFrontStart != 1 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
if( Train->ggPantFrontButton.SubModel ) {
|
||||
Train->ggPantFrontButton.UpdateValue( 1.0 );
|
||||
}
|
||||
if( Train->ggPantFrontButtonOff.SubModel != nullptr ) {
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
Train->mvControlled->PantFrontSP = false;
|
||||
if( Train->mvControlled->PantFront( true ) ) {
|
||||
if( Train->mvControlled->PantFrontStart != 1 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
if( Train->ggPantFrontButton.SubModel ) {
|
||||
Train->ggPantFrontButton.UpdateValue( 1.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// rear otherwise
|
||||
Train->mvControlled->PantRearSP = false;
|
||||
if( Train->mvControlled->PantRear( true ) ) {
|
||||
if( Train->mvControlled->PantRearStart != 1 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
if( Train->ggPantFrontButton.SubModel ) {
|
||||
Train->ggPantFrontButton.UpdateValue( 1.0 );
|
||||
}
|
||||
if( Train->ggPantFrontButtonOff.SubModel != nullptr ) {
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
if( Train->ggPantFrontButtonOff.SubModel != nullptr ) {
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1261,32 +1238,15 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
||||
return;
|
||||
}
|
||||
|
||||
if( Train->mvOccupied->ActiveCab == 1 ) {
|
||||
// przedni gdy w kabinie 1
|
||||
Train->mvControlled->PantFrontSP = false;
|
||||
if( false == Train->mvControlled->PantFront( false ) ) {
|
||||
if( Train->mvControlled->PantFrontStart != 0 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
Train->ggPantFrontButton.UpdateValue( 0.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 1.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// rear otherwise
|
||||
Train->mvControlled->PantRearSP = false;
|
||||
if( false == Train->mvControlled->PantRear( false ) ) {
|
||||
if( Train->mvControlled->PantRearStart != 0 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
Train->ggPantFrontButton.UpdateValue( 0.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 1.0 );
|
||||
}
|
||||
Train->mvControlled->PantFrontSP = false;
|
||||
if( false == Train->mvControlled->PantFront( false ) ) {
|
||||
if( Train->mvControlled->PantFrontStart != 0 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
Train->ggPantFrontButton.UpdateValue( 0.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantFrontButtonOff.UpdateValue( 1.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1315,41 +1275,20 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
if( false == ( Train->mvOccupied->ActiveCab == 1 ? Train->mvControlled->PantRearUp : Train->mvControlled->PantFrontUp ) ) {
|
||||
if( false == Train->mvControlled->PantRearUp ) {
|
||||
// turn on...
|
||||
if( Train->mvOccupied->ActiveCab == 1 ) {
|
||||
// rear if in front cab
|
||||
Train->mvControlled->PantRearSP = false;
|
||||
if( Train->mvControlled->PantRear( true ) ) {
|
||||
if( Train->mvControlled->PantRearStart != 1 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
if( Train->ggPantRearButton.SubModel ) {
|
||||
Train->ggPantRearButton.UpdateValue( 1.0 );
|
||||
}
|
||||
if( Train->ggPantRearButtonOff.SubModel != nullptr ) {
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantRearButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
Train->mvControlled->PantRearSP = false;
|
||||
if( Train->mvControlled->PantRear( true ) ) {
|
||||
if( Train->mvControlled->PantRearStart != 1 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
if( Train->ggPantRearButton.SubModel ) {
|
||||
Train->ggPantRearButton.UpdateValue( 1.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// front otherwise
|
||||
Train->mvControlled->PantFrontSP = false;
|
||||
if( Train->mvControlled->PantFront( true ) ) {
|
||||
if( Train->mvControlled->PantFrontStart != 1 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
if( Train->ggPantRearButton.SubModel ) {
|
||||
Train->ggPantRearButton.UpdateValue( 1.0 );
|
||||
}
|
||||
if( Train->ggPantRearButtonOff.SubModel != nullptr ) {
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantRearButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
if( Train->ggPantRearButtonOff.SubModel != nullptr ) {
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantRearButtonOff.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1364,32 +1303,15 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
||||
return;
|
||||
}
|
||||
|
||||
if( Train->mvOccupied->ActiveCab == 1 ) {
|
||||
// rear if in front cab
|
||||
Train->mvControlled->PantRearSP = false;
|
||||
if( false == Train->mvControlled->PantRear( false ) ) {
|
||||
if( Train->mvControlled->PantRearStart != 0 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
Train->ggPantRearButton.UpdateValue( 0.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantRearButtonOff.UpdateValue( 1.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// front otherwise
|
||||
Train->mvControlled->PantFrontSP = false;
|
||||
if( false == Train->mvControlled->PantFront( false ) ) {
|
||||
if( Train->mvControlled->PantFrontStart != 0 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
Train->ggPantRearButton.UpdateValue( 0.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantRearButtonOff.UpdateValue( 1.0 );
|
||||
}
|
||||
Train->mvControlled->PantRearSP = false;
|
||||
if( false == Train->mvControlled->PantRear( false ) ) {
|
||||
if( Train->mvControlled->PantRearStart != 0 ) {
|
||||
// sound feedback
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
// visual feedback
|
||||
Train->ggPantRearButton.UpdateValue( 0.0 );
|
||||
// pantograph control can have two-button setup
|
||||
Train->ggPantRearButtonOff.UpdateValue( 1.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1533,6 +1455,10 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
|
||||
// press or hold...
|
||||
if( Train->m_linebreakerstate == 0 ) {
|
||||
// ...to close the circuit
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// fresh press, start fresh closing delay calculation
|
||||
Train->fMainRelayTimer = 0.0f;
|
||||
}
|
||||
if( Train->ggMainOnButton.SubModel != nullptr ) {
|
||||
// two separate switches to close and break the circuit
|
||||
// audio feedback
|
||||
@@ -1552,17 +1478,20 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
|
||||
Train->ggMainButton.UpdateValue( 1.0 );
|
||||
}
|
||||
// keep track of period the button is held down, to determine when/if circuit closes
|
||||
if( ( false == ( Train->mvControlled->EnginePowerSource.PowerType == ElectricSeriesMotor ) || ( Train->mvControlled->EngineType == ElectricInductionMotor ) )
|
||||
|| ( Train->fHVoltage > 0.0f ) ) {
|
||||
if( ( false == ( ( Train->mvControlled->EngineType == ElectricSeriesMotor )
|
||||
|| ( Train->mvControlled->EngineType == ElectricInductionMotor ) ) )
|
||||
|| ( Train->fHVoltage > 0.5 * Train->mvControlled->EnginePowerSource.MaxVoltage ) ) {
|
||||
// prevent the switch from working if there's no power
|
||||
// TODO: consider whether it makes sense for diesel engines and such
|
||||
Train->fMainRelayTimer += 0.33f; // Command.time_delta * 5.0;
|
||||
}
|
||||
/*
|
||||
if( Train->mvControlled->Mains != true ) {
|
||||
// hunter-080812: poprawka
|
||||
Train->mvControlled->ConverterSwitch( false );
|
||||
Train->mvControlled->CompressorSwitch( false );
|
||||
}
|
||||
*/
|
||||
if( Train->fMainRelayTimer > Train->mvControlled->InitialCtrlDelay ) {
|
||||
// wlaczanie WSa z opoznieniem
|
||||
Train->m_linebreakerstate = 2;
|
||||
@@ -1695,6 +1624,8 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
|
||||
// finalize the state of the line breaker
|
||||
Train->m_linebreakerstate = 1;
|
||||
}
|
||||
// on button release reset the closing timer, just in case something elsewhere tries to read it
|
||||
Train->fMainRelayTimer = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1705,15 +1636,17 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma
|
||||
if( ( false == Train->mvControlled->ConverterAllow )
|
||||
&& ( Train->ggConverterButton.GetValue() < 0.5 ) ) {
|
||||
// turn on
|
||||
// sound feedback
|
||||
if( Train->ggConverterButton.GetValue() < 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggConverterButton.UpdateValue( 1.0 );
|
||||
/*
|
||||
if( ( Train->mvControlled->EnginePowerSource.SourceType != CurrentCollector )
|
||||
|| ( Train->mvControlled->PantRearVolt != 0.0 )
|
||||
|| ( Train->mvControlled->PantFrontVolt != 0.0 ) ) {
|
||||
// visual feedback
|
||||
Train->ggConverterButton.UpdateValue( 1.0 );
|
||||
// sound feedback
|
||||
if( Train->ggConverterButton.GetValue() < 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
*/
|
||||
// impulse type switch has no effect if there's no power
|
||||
// NOTE: this is most likely setup wrong, but the whole thing is smoke and mirrors anyway
|
||||
if( ( Train->mvOccupied->ConvSwitchType != "impulse" )
|
||||
@@ -1728,7 +1661,9 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
}
|
||||
*/
|
||||
}
|
||||
else {
|
||||
//turn off
|
||||
@@ -2627,7 +2562,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
|
||||
if( Train->ggDoorLeftButton.GetValue() > 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
Train->play_sound( Train->dsbDoorOpen );
|
||||
Train->play_sound( Train->dsbDoorClose );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2638,7 +2573,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
|
||||
if( Train->ggDoorRightButton.GetValue() > 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
Train->play_sound( Train->dsbDoorOpen );
|
||||
Train->play_sound( Train->dsbDoorClose );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2688,7 +2623,7 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
|
||||
if( Train->ggDoorRightButton.GetValue() > 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
Train->play_sound( Train->dsbDoorOpen );
|
||||
Train->play_sound( Train->dsbDoorClose );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2699,7 +2634,7 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
|
||||
if( Train->ggDoorLeftButton.GetValue() > 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
Train->play_sound( Train->dsbDoorOpen );
|
||||
Train->play_sound( Train->dsbDoorClose );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2772,7 +2707,7 @@ void TTrain::OnCommand_hornlowactivate( TTrain *Train, command_data const &Comma
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
// turn off
|
||||
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
||||
Train->mvControlled->WarningSignal &= ~( 1 | 2 );
|
||||
Train->mvOccupied->WarningSignal &= ~( 1 | 2 );
|
||||
// audio feedback
|
||||
if( ( Train->ggHornButton.GetValue() < -0.5 )
|
||||
|| ( Train->ggHornLowButton.GetValue() > 0.5 ) ) {
|
||||
@@ -2815,14 +2750,14 @@ void TTrain::OnCommand_hornhighactivate( TTrain *Train, command_data const &Comm
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
// turn off
|
||||
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
||||
Train->mvControlled->WarningSignal &= ~( 1 | 2 );
|
||||
Train->mvOccupied->WarningSignal &= ~( 1 | 2 );
|
||||
// audio feedback
|
||||
if( Train->ggHornButton.GetValue() > 0.5 ) {
|
||||
Train->play_sound( Train->dsbSwitch );
|
||||
}
|
||||
// visual feedback
|
||||
Train->ggHornButton.UpdateValue( 0.0 );
|
||||
Train->ggHornButton.UpdateValue( 0.0 );
|
||||
Train->ggHornHighButton.UpdateValue( 0.0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3056,16 +2991,19 @@ void TTrain::OnKeyDown(int cKey)
|
||||
}
|
||||
else if (cKey == Global::Keys[k_CabForward])
|
||||
{
|
||||
if (!CabChange(1))
|
||||
if (TestFlag(DynamicObject->MoverParameters->Couplers[0].CouplingFlag,
|
||||
ctrain_passenger))
|
||||
{ // przejscie do nastepnego pojazdu
|
||||
if( !CabChange( 1 ) ) {
|
||||
if( TestFlag( DynamicObject->MoverParameters->Couplers[ 0 ].CouplingFlag,
|
||||
ctrain_passenger ) ) { // przejscie do nastepnego pojazdu
|
||||
Global::changeDynObj = DynamicObject->PrevConnected;
|
||||
Global::changeDynObj->MoverParameters->ActiveCab =
|
||||
DynamicObject->PrevConnectedNo ? -1 : 1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
NOTE: disabled to allow 'prototypical' 'tricking' pantograph compressor to run unattended
|
||||
if (DynamicObject->MoverParameters->ActiveCab)
|
||||
mvControlled->PantCompFlag = false; // wyjście z maszynowego wyłącza sprężarkę
|
||||
*/
|
||||
}
|
||||
else if (cKey == Global::Keys[k_CabBackward])
|
||||
{
|
||||
@@ -3077,9 +3015,12 @@ void TTrain::OnKeyDown(int cKey)
|
||||
Global::changeDynObj->MoverParameters->ActiveCab =
|
||||
DynamicObject->NextConnectedNo ? -1 : 1;
|
||||
}
|
||||
/*
|
||||
NOTE: disabled to allow 'prototypical' 'tricking' pantograph compressor to run unattended
|
||||
if (DynamicObject->MoverParameters->ActiveCab)
|
||||
mvControlled->PantCompFlag =
|
||||
false; // wyjście z maszynowego wyłącza sprężarkę pomocniczą
|
||||
*/
|
||||
}
|
||||
else if (cKey == Global::Keys[k_Couple])
|
||||
{ // ABu051104: male zmiany, zeby mozna bylo laczyc odlegle wagony
|
||||
@@ -3141,11 +3082,13 @@ if
|
||||
if (DynamicObject->Mechanik) // na wszelki wypadek
|
||||
DynamicObject->Mechanik->CheckVehicles(Connect); // aktualizacja flag kierunku w składzie
|
||||
play_sound( dsbCouplerAttach );
|
||||
// one coupling type per key press
|
||||
return;
|
||||
}
|
||||
else
|
||||
WriteLog("Mechanical coupling failed.");
|
||||
}
|
||||
else if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag, ctrain_pneumatic)) // pneumatyka
|
||||
if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag, ctrain_pneumatic)) // pneumatyka
|
||||
{
|
||||
if ((tmp->MoverParameters->Couplers[CouplNr].Connected->Couplers[CouplNr].AllowedFlag
|
||||
& tmp->MoverParameters->Couplers[CouplNr].AllowedFlag
|
||||
@@ -3155,12 +3098,16 @@ if
|
||||
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
||||
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_pneumatic)))
|
||||
{
|
||||
rsHiss.Play(1, DSBPLAY_LOOPING, true, tmp->GetPosition());
|
||||
// TODO: dedicated 'click' sound for connecting cable-type connections
|
||||
play_sound( dsbCouplerDetach );
|
||||
// rsHiss.Play( 1, DSBPLAY_LOOPING, true, tmp->GetPosition() );
|
||||
DynamicObject->SetPneumatic(CouplNr != 0, true); // Ra: to mi się nie podoba !!!!
|
||||
tmp->SetPneumatic(CouplNr != 0, true);
|
||||
// one coupling type per key press
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag, ctrain_scndpneumatic)) // zasilajacy
|
||||
if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag, ctrain_scndpneumatic)) // zasilajacy
|
||||
{
|
||||
if ((tmp->MoverParameters->Couplers[CouplNr].Connected->Couplers[CouplNr].AllowedFlag
|
||||
& tmp->MoverParameters->Couplers[CouplNr].AllowedFlag
|
||||
@@ -3170,17 +3117,18 @@ if
|
||||
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
||||
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_scndpneumatic)))
|
||||
{
|
||||
// rsHiss.Play(1,DSBPLAY_LOOPING,true,tmp->GetPosition());
|
||||
// TODO: dedicated 'click' sound for connecting cable-type connections
|
||||
play_sound( dsbCouplerDetach );
|
||||
DynamicObject->SetPneumatic(CouplNr != 0, false); // Ra: to mi się nie podoba !!!!
|
||||
// rsHiss.Play( 1, DSBPLAY_LOOPING, true, tmp->GetPosition() );
|
||||
DynamicObject->SetPneumatic( CouplNr != 0, false ); // Ra: to mi się nie podoba !!!!
|
||||
tmp->SetPneumatic(CouplNr != 0, false);
|
||||
// one coupling type per key press
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag, ctrain_controll)) // ukrotnionko
|
||||
if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag, ctrain_controll)) // ukrotnionko
|
||||
{
|
||||
if ((tmp->MoverParameters->Couplers[CouplNr]
|
||||
.Connected->Couplers[CouplNr]
|
||||
.AllowedFlag &
|
||||
if ((tmp->MoverParameters->Couplers[CouplNr].Connected->Couplers[CouplNr].AllowedFlag &
|
||||
tmp->MoverParameters->Couplers[CouplNr].AllowedFlag &
|
||||
ctrain_controll) == ctrain_controll)
|
||||
if (tmp->MoverParameters->Attach(
|
||||
@@ -3188,14 +3136,15 @@ if
|
||||
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
||||
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_controll)))
|
||||
{
|
||||
// TODO: dedicated 'click' sound for connecting cable-type connections
|
||||
play_sound( dsbCouplerAttach );
|
||||
// one coupling type per key press
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag, ctrain_passenger)) // mostek
|
||||
if (!TestFlag(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag, ctrain_passenger)) // mostek
|
||||
{
|
||||
if ((tmp->MoverParameters->Couplers[CouplNr]
|
||||
.Connected->Couplers[CouplNr]
|
||||
.AllowedFlag &
|
||||
if ((tmp->MoverParameters->Couplers[CouplNr].Connected->Couplers[CouplNr].AllowedFlag &
|
||||
tmp->MoverParameters->Couplers[CouplNr].AllowedFlag &
|
||||
ctrain_passenger) == ctrain_passenger)
|
||||
if (tmp->MoverParameters->Attach(
|
||||
@@ -3203,10 +3152,29 @@ if
|
||||
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
||||
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_passenger)))
|
||||
{
|
||||
// rsHiss.Play(1,DSBPLAY_LOOPING,true,tmp->GetPosition());
|
||||
play_sound( dsbCouplerDetach );
|
||||
play_sound( dsbCouplerAttach );
|
||||
/*
|
||||
DynamicObject->SetPneumatic(CouplNr != 0, false);
|
||||
tmp->SetPneumatic(CouplNr != 0, false);
|
||||
*/
|
||||
// one coupling type per key press
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( false == TestFlag( tmp->MoverParameters->Couplers[ CouplNr ].CouplingFlag, ctrain_heating ) ) {
|
||||
// heating
|
||||
if( ( tmp->MoverParameters->Couplers[ CouplNr ].Connected->Couplers[ CouplNr ].AllowedFlag
|
||||
& tmp->MoverParameters->Couplers[ CouplNr ].AllowedFlag
|
||||
& ctrain_heating ) == ctrain_heating )
|
||||
if( tmp->MoverParameters->Attach(
|
||||
CouplNr, 2,
|
||||
tmp->MoverParameters->Couplers[ CouplNr ].Connected,
|
||||
( tmp->MoverParameters->Couplers[ CouplNr ].CouplingFlag | ctrain_heating ) ) ) {
|
||||
|
||||
// TODO: dedicated 'click' sound for connecting cable-type connections
|
||||
play_sound( dsbCouplerAttach );
|
||||
// one coupling type per key press
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3469,32 +3437,6 @@ bool TTrain::Update( double const Deltatime )
|
||||
DWORD stat;
|
||||
double dt = Deltatime; // Timer::GetDeltaTime();
|
||||
|
||||
// catch cases where the power goes out, and the linebreaker state is left as closed
|
||||
if( ( m_linebreakerstate == 1 )
|
||||
&& ( false == mvControlled->Mains )
|
||||
&& ( ggMainButton.GetValue() < 0.05 ) ) {
|
||||
// crude way to catch cases where the main was knocked out and the user is trying to restart it
|
||||
// because the state of the line breaker isn't changed to match, we need to do it here manually
|
||||
m_linebreakerstate = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
// NOTE: disabled while switch state isn't preserved while moving between compartments
|
||||
// check whether we should raise the pantographs, based on volume in pantograph tank
|
||||
if( mvControlled->PantPress > (
|
||||
mvControlled->TrainType == dt_EZT ?
|
||||
2.4 :
|
||||
3.5 ) ) {
|
||||
if( ( false == mvControlled->PantFrontUp )
|
||||
&& ( ggPantFrontButton.GetValue() > 0.95 ) ) {
|
||||
mvControlled->PantFront( true );
|
||||
}
|
||||
if( ( false == mvControlled->PantRearUp )
|
||||
&& ( ggPantRearButton.GetValue() > 0.95 ) ) {
|
||||
mvControlled->PantRear( true );
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (DynamicObject->mdKabina)
|
||||
{ // Ra: TODO: odczyty klawiatury/pulpitu nie
|
||||
// powinny być uzależnione od istnienia modelu
|
||||
@@ -3502,15 +3444,14 @@ bool TTrain::Update( double const Deltatime )
|
||||
tor = DynamicObject->GetTrack(); // McZapkie-180203
|
||||
// McZapkie: predkosc wyswietlana na tachometrze brana jest z obrotow kol
|
||||
float maxtacho = 3;
|
||||
fTachoVelocity = Min0R(fabs(11.31 * mvControlled->WheelDiameter * mvControlled->nrot),
|
||||
mvControlled->Vmax * 1.05);
|
||||
fTachoVelocity = static_cast<float>( std::min( std::abs(11.31 * mvControlled->WheelDiameter * mvControlled->nrot), mvControlled->Vmax * 1.05) );
|
||||
{ // skacze osobna zmienna
|
||||
float ff = simulation::Time.data().wSecond; // skacze co sekunde - pol sekundy
|
||||
// pomiar, pol sekundy ustawienie
|
||||
if (ff != fTachoTimer) // jesli w tej sekundzie nie zmienial
|
||||
{
|
||||
if (fTachoVelocity > 1) // jedzie
|
||||
fTachoVelocityJump = fTachoVelocity + (2 - Random(3) + Random(3)) * 0.5;
|
||||
fTachoVelocityJump = fTachoVelocity + (2.0 - Random(3) + Random(3)) * 0.5;
|
||||
else
|
||||
fTachoVelocityJump = 0; // stoi
|
||||
fTachoTimer = ff; // juz zmienil
|
||||
@@ -3725,12 +3666,15 @@ bool TTrain::Update( double const Deltatime )
|
||||
// przy dowolnym ustawieniu kierunkowego
|
||||
// Ra: to już jest w T_MoverParameters::TractionForce(), ale zależy od
|
||||
// kierunku
|
||||
if (mvControlled->EngineType == ElectricSeriesMotor)
|
||||
if (fabs(mvControlled->RunningTraction.TractionVoltage) <
|
||||
0.5 *
|
||||
mvControlled->EnginePowerSource
|
||||
.MaxVoltage) // minimalne napięcie pobierać z FIZ?
|
||||
mvControlled->MainSwitch(false);
|
||||
if( ( mvControlled->Mains )
|
||||
&& ( mvControlled->EngineType == ElectricSeriesMotor ) ) {
|
||||
if( std::max( mvControlled->GetTrainsetVoltage(), std::fabs( mvControlled->RunningTraction.TractionVoltage ) ) < 0.5 * mvControlled->EnginePowerSource.MaxVoltage ) {
|
||||
// TODO: check whether it should affect entire consist for EMU
|
||||
// TODO: check whether it should happen if there's power supplied alternatively through hvcouplers
|
||||
// TODO: potentially move this to the mover module, as there isn't much reason to have this dependent on the operator presence
|
||||
mvControlled->MainSwitch( false, ( mvControlled->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||
}
|
||||
}
|
||||
|
||||
// hunter-091012: swiatlo
|
||||
if (bCabLight == true)
|
||||
@@ -3759,7 +3703,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
{
|
||||
mvControlled->ConvOvldFlag = true;
|
||||
if (mvControlled->TrainType != dt_EZT)
|
||||
mvControlled->MainSwitch(false);
|
||||
mvControlled->MainSwitch( false, ( mvControlled->TrainType == dt_EZT ? command_range::unit : command_range::local ) );
|
||||
}
|
||||
else if( fConverterTimer >= fConverterPrzekaznik ) {
|
||||
// changed switch from always true to take into account state of the compressor switch
|
||||
@@ -4352,7 +4296,11 @@ bool TTrain::Update( double const Deltatime )
|
||||
|
||||
if (mvControlled->Battery || mvControlled->ConverterFlag)
|
||||
{
|
||||
btLampkaWylSzybki.Turn( ( m_linebreakerstate > 0 ? true : false ) );
|
||||
btLampkaWylSzybki.Turn(
|
||||
( ( (m_linebreakerstate > 0)
|
||||
|| (true == mvControlled->Mains) ) ?
|
||||
true :
|
||||
false ) );
|
||||
|
||||
// hunter-261211: jakis stary kod (i niezgodny z prawda),
|
||||
// zahaszowalem i poprawilem
|
||||
@@ -4383,7 +4331,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
|
||||
// if
|
||||
// ((TestFlag(mvControlled->BrakeStatus,+b_Rused+b_Ractive)))//Lampka drugiego stopnia hamowania
|
||||
btLampkaHamPosp.Turn((TestFlag(mvOccupied->BrakeStatus, 1))); // lampka drugiego stopnia hamowania
|
||||
btLampkaHamPosp.Turn((TestFlag(mvOccupied->Hamulec->GetBrakeStatus(), 1))); // lampka drugiego stopnia hamowania
|
||||
//TODO: youBy wyciągnąć flagę wysokiego stopnia
|
||||
|
||||
// hunter-121211: lampka zanikowo-pradowego wentylatorow:
|
||||
@@ -4702,74 +4650,20 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggManualBrake.UpdateValue(double(mvOccupied->ManualBrakePos));
|
||||
ggManualBrake.Update();
|
||||
}
|
||||
if (ggBrakeProfileCtrl.SubModel)
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggBrakeProfileCtrl.UpdateValue(
|
||||
double(mvOccupied->BrakeDelayFlag == 4 ? 2 : mvOccupied->BrakeDelayFlag - 1));
|
||||
#endif
|
||||
ggBrakeProfileCtrl.Update();
|
||||
}
|
||||
if (ggBrakeProfileG.SubModel)
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggBrakeProfileG.UpdateValue( double( mvOccupied->BrakeDelayFlag == bdelay_G ? 1 : 0 ) );
|
||||
#endif
|
||||
ggBrakeProfileG.Update();
|
||||
}
|
||||
if (ggBrakeProfileR.SubModel)
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggBrakeProfileR.UpdateValue( double( mvOccupied->BrakeDelayFlag == bdelay_R ? 1 : 0 ) );
|
||||
#endif
|
||||
ggBrakeProfileR.Update();
|
||||
}
|
||||
|
||||
if (ggMaxCurrentCtrl.SubModel)
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggMaxCurrentCtrl.UpdateValue( double( mvControlled->Imax == mvControlled->ImaxHi ) );
|
||||
#endif
|
||||
ggMaxCurrentCtrl.Update();
|
||||
}
|
||||
|
||||
ggBrakeProfileCtrl.Update();
|
||||
ggBrakeProfileG.Update();
|
||||
ggBrakeProfileR.Update();
|
||||
ggMaxCurrentCtrl.Update();
|
||||
// NBMX wrzesien 2003 - drzwi
|
||||
if (ggDoorLeftButton.SubModel)
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggDoorLeftButton.PutValue( mvOccupied->DoorLeftOpened ? 1 : 0 );
|
||||
#endif
|
||||
ggDoorLeftButton.Update();
|
||||
}
|
||||
if (ggDoorRightButton.SubModel)
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggDoorRightButton.PutValue( mvOccupied->DoorRightOpened ? 1 : 0 );
|
||||
#endif
|
||||
ggDoorRightButton.Update();
|
||||
}
|
||||
if (ggDepartureSignalButton.SubModel)
|
||||
{
|
||||
// ggDepartureSignalButton.UpdateValue(double());
|
||||
ggDepartureSignalButton.Update();
|
||||
}
|
||||
|
||||
ggDoorLeftButton.Update();
|
||||
ggDoorRightButton.Update();
|
||||
ggDepartureSignalButton.Update();
|
||||
// NBMX dzwignia sprezarki
|
||||
if (ggCompressorButton.SubModel) // hunter-261211: poprawka
|
||||
ggCompressorButton.Update();
|
||||
if (ggMainButton.SubModel)
|
||||
ggMainButton.Update();
|
||||
if (ggRadioButton.SubModel)
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggRadioButton.PutValue( mvOccupied->Radio ? 1 : 0 );
|
||||
#endif
|
||||
ggRadioButton.Update();
|
||||
}
|
||||
if (ggConverterButton.SubModel)
|
||||
ggConverterButton.Update();
|
||||
if (ggConverterOffButton.SubModel)
|
||||
ggConverterOffButton.Update();
|
||||
ggCompressorButton.Update();
|
||||
ggMainButton.Update();
|
||||
ggRadioButton.Update();
|
||||
ggConverterButton.Update();
|
||||
ggConverterOffButton.Update();
|
||||
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
if( ( ( DynamicObject->iLights[ 0 ] ) == 0 ) && ( ( DynamicObject->iLights[ 1 ] ) == 0 ) )
|
||||
@@ -4918,64 +4812,18 @@ bool TTrain::Update( double const Deltatime )
|
||||
ggLightsButton.PutValue(mvOccupied->LightsPos - 1);
|
||||
ggLightsButton.Update();
|
||||
}
|
||||
if( ggDimHeadlightsButton.SubModel ) {
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggDimHeadlightsButton.PutValue( DynamicObject->DimHeadlights ? 1.0 : 0.0 );
|
||||
#endif
|
||||
ggDimHeadlightsButton.Update();
|
||||
}
|
||||
|
||||
ggDimHeadlightsButton.Update();
|
||||
//---------
|
||||
// Winger 010304 - pantografy
|
||||
// NOTE: shouldn't the pantograph updates check whether it's front or rear cabin?
|
||||
if (ggPantFrontButton.SubModel ) {
|
||||
ggPantFrontButton.Update();
|
||||
}
|
||||
if (ggPantRearButton.SubModel) {
|
||||
ggPantRearButton.Update();
|
||||
}
|
||||
if (ggPantFrontButtonOff.SubModel) {
|
||||
ggPantFrontButtonOff.Update();
|
||||
}
|
||||
ggPantFrontButton.Update();
|
||||
ggPantRearButton.Update();
|
||||
ggPantFrontButtonOff.Update();
|
||||
ggTrainHeatingButton.Update();
|
||||
ggSignallingButton.Update();
|
||||
ggDoorSignallingButton.Update();
|
||||
// Winger 020304 - ogrzewanie
|
||||
//----------
|
||||
// hunter-080812: poprawka na ogrzewanie w elektrykach - usuniete uzaleznienie od przetwornicy
|
||||
if( ggTrainHeatingButton.SubModel )
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
if( mvControlled->Heating )
|
||||
{
|
||||
ggTrainHeatingButton.PutValue(1);
|
||||
// if (mvControlled->ConverterFlag==true)
|
||||
// btLampkaOgrzewanieSkladu.TurnOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
ggTrainHeatingButton.PutValue(0);
|
||||
// btLampkaOgrzewanieSkladu.TurnOff();
|
||||
}
|
||||
#endif
|
||||
ggTrainHeatingButton.Update();
|
||||
}
|
||||
if (ggSignallingButton.SubModel != nullptr)
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggSignallingButton.PutValue( mvControlled->Signalling ? 1 : 0 );
|
||||
#endif
|
||||
ggSignallingButton.Update();
|
||||
}
|
||||
if (ggDoorSignallingButton.SubModel != nullptr)
|
||||
{
|
||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||
ggDoorSignallingButton.PutValue( mvControlled->DoorSignalling ? 1 : 0 );
|
||||
#endif
|
||||
ggDoorSignallingButton.Update();
|
||||
}
|
||||
// if (ggDistCounter.SubModel)
|
||||
//{//Ra 2014-07: licznik kilometrów
|
||||
// ggDistCounter.PutValue(mvControlled->DistCounter);
|
||||
// ggDistCounter.Update();
|
||||
//}
|
||||
if ((((mvControlled->EngineType == ElectricSeriesMotor) && (mvControlled->Mains == true) &&
|
||||
(mvControlled->ConvOvldFlag == false)) ||
|
||||
(mvControlled->ConverterFlag)) &&
|
||||
@@ -5373,6 +5221,8 @@ bool TTrain::Update( double const Deltatime )
|
||||
false) // nie wyłączać, gdy AI
|
||||
mvControlled->PantCompFlag = false; // wyłączona, gdy nie trzymamy klawisza
|
||||
#else
|
||||
/*
|
||||
// NOTE: disabled to allow 'prototypical' 'tricking' pantograph compressor into running unattended
|
||||
if( ( ( DynamicObject->Mechanik != nullptr )
|
||||
&& ( false == DynamicObject->Mechanik->AIControllFlag ) )
|
||||
&& ( mvControlled->TrainType == dt_EZT ?
|
||||
@@ -5382,6 +5232,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
// NOTE: this will break in multiplayer setups, do a proper tracking of pantograph user then
|
||||
mvControlled->PantCompFlag = false;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
if (Console::Pressed(Global::Keys[k_Univ2]))
|
||||
{
|
||||
@@ -5875,6 +5726,46 @@ bool TTrain::Update( double const Deltatime )
|
||||
}
|
||||
}
|
||||
|
||||
// catch cases where the power goes out, and the linebreaker state is left as closed
|
||||
if( ( m_linebreakerstate == 1 )
|
||||
&& ( false == mvControlled->Mains )
|
||||
&& ( ggMainButton.GetValue() < 0.05 ) ) {
|
||||
// crude way to catch cases where the main was knocked out and the user is trying to restart it
|
||||
// because the state of the line breaker isn't changed to match, we need to do it here manually
|
||||
m_linebreakerstate = 0;
|
||||
}
|
||||
|
||||
// NOTE: crude way to have the pantographs go back up if they're dropped due to insufficient pressure etc
|
||||
// TODO: rework it into something more elegant, when redoing the whole consist/unit/cab etc arrangement
|
||||
if( ( mvControlled->Battery )
|
||||
|| ( mvControlled->ConverterFlag ) ) {
|
||||
if( ( false == mvControlled->PantFrontUp )
|
||||
&& ( ggPantFrontButton.GetValue() >= 1.0 ) ) {
|
||||
mvControlled->PantFront( true );
|
||||
}
|
||||
if( ( false == mvControlled->PantRearUp )
|
||||
&& ( ggPantRearButton.GetValue() >= 1.0 ) ) {
|
||||
mvControlled->PantRear( true );
|
||||
}
|
||||
}
|
||||
/*
|
||||
// NOTE: disabled while switch state isn't preserved while moving between compartments
|
||||
// check whether we should raise the pantographs, based on volume in pantograph tank
|
||||
if( mvControlled->PantPress > (
|
||||
mvControlled->TrainType == dt_EZT ?
|
||||
2.4 :
|
||||
3.5 ) ) {
|
||||
if( ( false == mvControlled->PantFrontUp )
|
||||
&& ( ggPantFrontButton.GetValue() > 0.95 ) ) {
|
||||
mvControlled->PantFront( true );
|
||||
}
|
||||
if( ( false == mvControlled->PantRearUp )
|
||||
&& ( ggPantRearButton.GetValue() > 0.95 ) ) {
|
||||
mvControlled->PantRear( true );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
m_updated = true;
|
||||
return true; //(DynamicObject->Update(dt));
|
||||
} // koniec update
|
||||
@@ -6708,31 +6599,23 @@ void TTrain::set_cab_controls() {
|
||||
// pantographs
|
||||
if( mvOccupied->PantSwitchType != "impulse" ) {
|
||||
ggPantFrontButton.PutValue(
|
||||
( mvOccupied->ActiveCab == 1 ?
|
||||
mvControlled->PantFrontUp :
|
||||
mvControlled->PantRearUp ) ?
|
||||
1.0 :
|
||||
0.0 );
|
||||
( mvControlled->PantFrontUp ?
|
||||
1.0 :
|
||||
0.0 ) );
|
||||
ggPantFrontButtonOff.PutValue(
|
||||
( mvOccupied->ActiveCab == 1 ?
|
||||
mvControlled->PantFrontUp :
|
||||
mvControlled->PantRearUp ) ?
|
||||
0.0 :
|
||||
1.0 );
|
||||
( mvControlled->PantFrontUp ?
|
||||
0.0 :
|
||||
1.0 ) );
|
||||
}
|
||||
if( mvOccupied->PantSwitchType != "impulse" ) {
|
||||
ggPantRearButton.PutValue(
|
||||
( mvOccupied->ActiveCab == 1 ?
|
||||
mvControlled->PantRearUp :
|
||||
mvControlled->PantFrontUp ) ?
|
||||
1.0 :
|
||||
0.0 );
|
||||
( mvControlled->PantRearUp ?
|
||||
1.0 :
|
||||
0.0 ) );
|
||||
ggPantRearButtonOff.PutValue(
|
||||
( mvOccupied->ActiveCab == 1 ?
|
||||
mvControlled->PantRearUp :
|
||||
mvControlled->PantFrontUp ) ?
|
||||
0.0 :
|
||||
1.0 );
|
||||
( mvControlled->PantRearUp ?
|
||||
0.0 :
|
||||
1.0 ) );
|
||||
}
|
||||
// converter
|
||||
if( mvOccupied->ConvSwitchType != "impulse" ) {
|
||||
|
||||
94
World.cpp
94
World.cpp
@@ -714,6 +714,9 @@ void TWorld::OnKeyDown(int cKey)
|
||||
Train->OnKeyDown(cKey); // przekazanie klawisza do kabiny
|
||||
if (FreeFlyModeFlag) // aby nie odluźniało wagonu za lokomotywą
|
||||
{ // operacje wykonywane na dowolnym pojeździe, przeniesione tu z kabiny
|
||||
/*
|
||||
// NOTE: disabled so it doesn't interfere with new system controls in outside view
|
||||
// TODO: implement as part of the new system
|
||||
if (cKey == Global::Keys[k_Releaser]) // odluźniacz
|
||||
{ // działa globalnie, sprawdzić zasięg
|
||||
TDynamicObject *temp = Global::DynamicNearest();
|
||||
@@ -721,7 +724,7 @@ void TWorld::OnKeyDown(int cKey)
|
||||
{
|
||||
if (Global::ctrlState) // z ctrl odcinanie
|
||||
{
|
||||
temp->MoverParameters->BrakeStatus ^= 128;
|
||||
temp->MoverParameters->Hamulec->SetBrakeStatus( temp->MoverParameters->Hamulec->GetBrakeStatus() ^ 128 );
|
||||
}
|
||||
else if (temp->MoverParameters->BrakeReleaser(1))
|
||||
{
|
||||
@@ -731,7 +734,9 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cKey == Global::Keys[k_Heating]) // Ra: klawisz nie jest najszczęśliwszy
|
||||
else
|
||||
*/
|
||||
if (cKey == Global::Keys[k_Heating]) // Ra: klawisz nie jest najszczęśliwszy
|
||||
{ // zmiana próżny/ładowny; Ra: zabrane z kabiny
|
||||
TDynamicObject *temp = Global::DynamicNearest();
|
||||
if (temp)
|
||||
@@ -1799,12 +1804,12 @@ TWorld::Update_UI() {
|
||||
if( ( tmp->MoverParameters->BrakeDelayFlag & bdelay_M ) == bdelay_M )
|
||||
uitextline2 += "+Mg";
|
||||
|
||||
uitextline2 += ", BTP:" + to_string( tmp->MoverParameters->LoadFlag, 0 );
|
||||
uitextline2 += ", BTP: " + to_string( tmp->MoverParameters->LoadFlag, 0 );
|
||||
{
|
||||
uitextline2 +=
|
||||
"; pant. "
|
||||
"; pant: "
|
||||
+ to_string( tmp->MoverParameters->PantPress, 2 )
|
||||
+ ( tmp->MoverParameters->bPantKurek3 ? "<ZG" : "|ZG" );
|
||||
+ ( tmp->MoverParameters->bPantKurek3 ? "-ZG" : "|ZG" );
|
||||
}
|
||||
|
||||
uitextline2 +=
|
||||
@@ -1820,28 +1825,63 @@ TWorld::Update_UI() {
|
||||
uitextline2 +=
|
||||
"; TC:"
|
||||
+ to_string( tmp->MoverParameters->TotalCurrent, 0 );
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
uitextline2 +=
|
||||
", HV0:"
|
||||
+ to_string( tmp->MoverParameters->HVCouplers[ 0 ][ 1 ], 0 )
|
||||
", HV0: "
|
||||
+ to_string( tmp->MoverParameters->HVCouplers[ TMoverParameters::side::front ][ TMoverParameters::hvcoupler::voltage ], 0 )
|
||||
+ "@"
|
||||
+ to_string( tmp->MoverParameters->HVCouplers[ 0 ][ 0 ], 0 );
|
||||
+ to_string( tmp->MoverParameters->HVCouplers[ TMoverParameters::side::front ][ TMoverParameters::hvcoupler::current ], 0 );
|
||||
uitextline2 +=
|
||||
", HV1:"
|
||||
+ to_string( tmp->MoverParameters->HVCouplers[ 1 ][ 1 ], 0 )
|
||||
", HV1: "
|
||||
+ to_string( tmp->MoverParameters->HVCouplers[ TMoverParameters::side::rear ][ TMoverParameters::hvcoupler::voltage ], 0 )
|
||||
+ "@"
|
||||
+ to_string( tmp->MoverParameters->HVCouplers[ 1 ][ 0 ], 0 );
|
||||
+ to_string( tmp->MoverParameters->HVCouplers[ TMoverParameters::side::rear ][ TMoverParameters::hvcoupler::current ], 0 );
|
||||
#else
|
||||
auto const frontcouplerhighvoltage =
|
||||
to_string( tmp->MoverParameters->Couplers[ TMoverParameters::side::front ].power_high.voltage, 0 )
|
||||
+ "@"
|
||||
+ to_string( tmp->MoverParameters->Couplers[ TMoverParameters::side::front ].power_high.current, 0 );
|
||||
auto const rearcouplerhighvoltage =
|
||||
to_string( tmp->MoverParameters->Couplers[ TMoverParameters::side::rear ].power_high.voltage, 0 )
|
||||
+ "@"
|
||||
+ to_string( tmp->MoverParameters->Couplers[ TMoverParameters::side::rear ].power_high.current, 0 );
|
||||
uitextline2 += ", HV: ";
|
||||
if( tmp->MoverParameters->Couplers[ TMoverParameters::side::front ].power_high.local == false ) {
|
||||
uitextline2 +=
|
||||
"(" + frontcouplerhighvoltage + ")-"
|
||||
+ ":F" + ( tmp->DirectionGet() ? "<<" : ">>" ) + "R:"
|
||||
+ "-(" + rearcouplerhighvoltage + ")";
|
||||
}
|
||||
else {
|
||||
uitextline2 +=
|
||||
frontcouplerhighvoltage
|
||||
+ ":F" + ( tmp->DirectionGet() ? "<<" : ">>" ) + "R:"
|
||||
+ rearcouplerhighvoltage;
|
||||
}
|
||||
#endif
|
||||
// equipment flags
|
||||
uitextline3 = "";
|
||||
uitextline3 += ( tmp->MoverParameters->Battery ? "B" : "." );
|
||||
uitextline3 += ( tmp->MoverParameters->Mains ? "M" : "." );
|
||||
uitextline3 += ( tmp->MoverParameters->PantRearUp ? ( tmp->MoverParameters->PantRearVolt > 0.0 ? "O" : "o" ) : "." );;
|
||||
uitextline3 += ( tmp->MoverParameters->PantFrontUp ? ( tmp->MoverParameters->PantFrontVolt > 0.0 ? "P" : "p" ) : "." );;
|
||||
uitextline3 += ( tmp->MoverParameters->PantPressLockActive ? "!" : ( tmp->MoverParameters->PantPressSwitchActive ? "*" : "." ) );
|
||||
uitextline3 += ( tmp->MoverParameters->ConverterAllow ? ( tmp->MoverParameters->ConverterFlag ? "X" : "x" ) : "." );
|
||||
uitextline3 += ( tmp->MoverParameters->ConvOvldFlag ? "!" : "." );
|
||||
uitextline3 += ( tmp->MoverParameters->CompressorAllow ? ( tmp->MoverParameters->CompressorFlag ? "C" : "c" ) : "." );
|
||||
uitextline3 += ( tmp->MoverParameters->CompressorGovernorLock ? "!" : "." );
|
||||
|
||||
uitextline3 =
|
||||
"BP: " + to_string( tmp->MoverParameters->BrakePress, 2 )
|
||||
+ " (" + to_string( tmp->MoverParameters->BrakeStatus, 0 )
|
||||
+ "), LBP: " + to_string( tmp->MoverParameters->LocBrakePress, 2 )
|
||||
+ ", PP: " + to_string( tmp->MoverParameters->PipePress, 2 )
|
||||
uitextline3 +=
|
||||
" TrB: " + to_string( tmp->MoverParameters->BrakePress, 2 )
|
||||
+ ", " + to_hex_str( tmp->MoverParameters->Hamulec->GetBrakeStatus(), 2 )
|
||||
+ ", LcB: " + to_string( tmp->MoverParameters->LocBrakePress, 2 )
|
||||
+ ", pipes: " + to_string( tmp->MoverParameters->PipePress, 2 )
|
||||
+ "/" + to_string( tmp->MoverParameters->ScndPipePress, 2 )
|
||||
+ "/" + to_string( tmp->MoverParameters->EqvtPipePress, 2 )
|
||||
+ ", BVP: " + to_string( tmp->MoverParameters->Volume, 3 )
|
||||
+ ", " + to_string( tmp->MoverParameters->CntrlPipePress, 3 )
|
||||
+ ", " + to_string( tmp->MoverParameters->Hamulec->GetCRP(), 3 )
|
||||
+ ", " + to_string( tmp->MoverParameters->BrakeStatus, 0 );
|
||||
+ ", MT: " + to_string( tmp->MoverParameters->CompressedVolume, 3 )
|
||||
+ ", BT: " + to_string( tmp->MoverParameters->Volume, 3 )
|
||||
+ ", CtlP: " + to_string( tmp->MoverParameters->CntrlPipePress, 3 )
|
||||
+ ", CtlT: " + to_string( tmp->MoverParameters->Hamulec->GetCRP(), 3 );
|
||||
|
||||
if( tmp->MoverParameters->ManualBrakePos > 0 ) {
|
||||
|
||||
@@ -1876,7 +1916,7 @@ TWorld::Update_UI() {
|
||||
+ " VRd=" + to_string( tmp->Mechanik->VelRoad, 0 );
|
||||
|
||||
if( ( tmp->Mechanik->VelNext == 0.0 )
|
||||
&& ( tmp->Mechanik->eSignNext ) ) {
|
||||
&& ( tmp->Mechanik->eSignNext ) ) {
|
||||
// jeśli ma zapamiętany event semafora, nazwa eventu semafora
|
||||
uitextline4 +=
|
||||
" ("
|
||||
@@ -1895,13 +1935,13 @@ TWorld::Update_UI() {
|
||||
break;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
std::size_t i = 0; std::size_t const speedtablesize = clamp( static_cast<int>( tmp->Mechanik->TableSize() ) - 1, 0, 30 );
|
||||
do {
|
||||
std::string scanline = tmp->Mechanik->TableText( i );
|
||||
if( scanline.empty() ) { break; }
|
||||
UITable->text_lines.emplace_back( Global::Bezogonkow( scanline ), Global::UITextColor );
|
||||
++i;
|
||||
} while( i < 16 ); // TController:iSpeedTableSize TODO: change when the table gets recoded
|
||||
} while( i < speedtablesize ); // TController:iSpeedTableSize TODO: change when the table gets recoded
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1999,8 +2039,8 @@ TWorld::Update_UI() {
|
||||
}
|
||||
|
||||
uitextline1 =
|
||||
"vel: " + to_string(tmp->GetVelocity(), 2) + " km/h"
|
||||
+ "; dist: " + to_string(tmp->MoverParameters->DistCounter, 2) + " km"
|
||||
"vel: " + to_string( tmp->GetVelocity(), 2 ) + " km/h" + ( tmp->MoverParameters->SlippingWheels ? " (!)" : "" )
|
||||
+ "; dist: " + to_string( tmp->MoverParameters->DistCounter, 2 ) + " km"
|
||||
+ "; pos: ("
|
||||
+ to_string( tmp->GetPosition().x, 2 ) + ", "
|
||||
+ to_string( tmp->GetPosition().y, 2 ) + ", "
|
||||
@@ -2533,7 +2573,7 @@ world_environment::update() {
|
||||
m_moon.update();
|
||||
// ...determine source of key light and adjust global state accordingly...
|
||||
auto const sunlightlevel = m_sun.getIntensity();
|
||||
auto const moonlightlevel = m_moon.getIntensity();
|
||||
auto const moonlightlevel = m_moon.getIntensity() * 0.65f; // scaled down by arbitrary factor, it's pretty bright otherwise
|
||||
float keylightintensity;
|
||||
float twilightfactor;
|
||||
float3 keylightcolor;
|
||||
@@ -2555,8 +2595,6 @@ world_environment::update() {
|
||||
keylightintensity = sunlightlevel;
|
||||
// diffuse (sun) intensity goes down after twilight, and reaches minimum 18 degrees below horizon
|
||||
twilightfactor = clamp( -Global::SunAngle, 0.0f, 18.0f ) / 18.0f;
|
||||
// TODO: crank orange up at dawn/dusk
|
||||
keylightcolor = float3( 255.0f / 255.0f, 242.0f / 255.0f, 231.0f / 255.0f );
|
||||
float const duskfactor = 1.0f - clamp( Global::SunAngle, 0.0f, 18.0f ) / 18.0f;
|
||||
keylightcolor = interpolate(
|
||||
float3( 255.0f / 255.0f, 242.0f / 255.0f, 231.0f / 255.0f ),
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
glm::vec2 m_leftstick;
|
||||
glm::vec2 m_rightstick;
|
||||
glm::vec2 m_triggers;
|
||||
double m_modeaccumulator; // used to throttle command input rate for vehicle controls
|
||||
double m_modeaccumulator{ 0.0 }; // used to throttle command input rate for vehicle controls
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -871,9 +871,9 @@ opengl_renderer::Update ( double const Deltatime ) {
|
||||
int targetsegments;
|
||||
float targetfactor;
|
||||
|
||||
if( framerate > 65.0 ) { targetsegments = 400; targetfactor = 3.0f; }
|
||||
else if( framerate > 40.0 ) { targetsegments = 225; targetfactor = 1.5f; }
|
||||
else if( framerate > 15.0 ) { targetsegments = 90; targetfactor = Global::ScreenHeight / 768.0f; }
|
||||
if( framerate > 90.0 ) { targetsegments = 400; targetfactor = 3.0f; }
|
||||
else if( framerate > 60.0 ) { targetsegments = 225; targetfactor = 1.5f; }
|
||||
else if( framerate > 30.0 ) { targetsegments = 90; targetfactor = Global::ScreenHeight / 768.0f; }
|
||||
else { targetsegments = 9; targetfactor = Global::ScreenHeight / 768.0f * 0.75f; }
|
||||
|
||||
if( targetsegments > Global::iSegmentsRendered ) {
|
||||
|
||||
2
sun.cpp
2
sun.cpp
@@ -258,8 +258,6 @@ void cSun::irradiance() {
|
||||
static double degrad = 57.295779513; // converts from radians to degrees
|
||||
static double raddeg = 0.0174532925; // converts from degrees to radians
|
||||
|
||||
auto const &localtime = simulation::Time.data(); // time for the calculation
|
||||
|
||||
m_body.dayang = ( simulation::Time.year_day() - 1 ) * 360.0 / 365.0;
|
||||
double sd = sin( raddeg * m_body.dayang ); // sine of the day angle
|
||||
double cd = cos( raddeg * m_body.dayang ); // cosine of the day angle or delination
|
||||
|
||||
Reference in New Issue
Block a user