mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
Merge remote-tracking branch 'tmj-fstate/mover_in_c++' into mover_in_c++
This commit is contained in:
814
Driver.cpp
814
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
|
enum TSpeedPosFlag
|
||||||
{ // wartości dla iFlag w TSpeedPos
|
{ // wartości dla iFlag w TSpeedPos
|
||||||
|
spNone = 0x0,
|
||||||
spEnabled = 0x1, // pozycja brana pod uwagę
|
spEnabled = 0x1, // pozycja brana pod uwagę
|
||||||
spTrack = 0x2, // to jest tor
|
spTrack = 0x2, // to jest tor
|
||||||
spReverse = 0x4, // odwrotnie
|
spReverse = 0x4, // odwrotnie
|
||||||
@@ -126,11 +127,11 @@ enum TSpeedPosFlag
|
|||||||
class TSpeedPos
|
class TSpeedPos
|
||||||
{ // pozycja tabeli prędkości dla AI
|
{ // pozycja tabeli prędkości dla AI
|
||||||
public:
|
public:
|
||||||
double fDist; // aktualna odległość (ujemna gdy minięte)
|
double fDist{ 0.0 }; // aktualna odległość (ujemna gdy minięte)
|
||||||
double fVelNext; // prędkość obowiązująca od tego miejsca
|
double fVelNext{ -1.0 }; // prędkość obowiązująca od tego miejsca
|
||||||
double fSectionVelocityDist; // długość ograniczenia prędkości
|
double fSectionVelocityDist{ 0.0 }; // długość ograniczenia prędkości
|
||||||
// double fAcc;
|
// 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
|
// 1=istotny,2=tor,4=odwrotnie,8-zwrotnica (może się zmienić),16-stan
|
||||||
// zwrotnicy,32-minięty,64=koniec,128=łuk
|
// zwrotnicy,32-minięty,64=koniec,128=łuk
|
||||||
// 0x100=event,0x200=manewrowa,0x400=przystanek,0x800=SBL,0x1000=wysłana komenda,0x2000=W5
|
// 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
|
vector3 vPos; // współrzędne XYZ do liczenia odległości
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
TTrack *trTrack; // wskaźnik na tor o zmiennej prędkości (zwrotnica, obrotnica)
|
TTrack *trTrack{ nullptr }; // wskaźnik na tor o zmiennej prędkości (zwrotnica, obrotnica)
|
||||||
TEvent *evEvent; // połączenie z eventem albo komórką pamięci
|
TEvent *evEvent{ nullptr }; // połączenie z eventem albo komórką pamięci
|
||||||
};
|
};
|
||||||
void CommandCheck();
|
void CommandCheck();
|
||||||
|
|
||||||
@@ -166,16 +167,14 @@ extern bool WriteLogFlag; // logowanie parametrów fizycznych
|
|||||||
class TController
|
class TController
|
||||||
{
|
{
|
||||||
private: // obsługa tabelki prędkości (musi mieć możliwość odhaczania stacji w rozkładzie)
|
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 iLast{ 0 }; // ostatnia wypełniona pozycja w tabeli <iFirst (modulo iSpeedTableSize)
|
||||||
int iSpeedTableSize = 16; // wielkość tabelki
|
int iTableDirection{ 0 }; // kierunek zapełnienia tabelki względem pojazdu z AI
|
||||||
int iFirst = 0; // aktualna pozycja w tabeli (modulo iSpeedTableSize)
|
std::vector<TSpeedPos> sSpeedTable;
|
||||||
int iLast = 0; // ostatnia wypełniona pozycja w tabeli <iFirst (modulo iSpeedTableSize)
|
|
||||||
int iTableDirection = 0; // kierunek zapełnienia tabelki względem pojazdu z AI
|
|
||||||
double fLastVel = 0.0; // prędkość na poprzednio sprawdzonym torze
|
double fLastVel = 0.0; // prędkość na poprzednio sprawdzonym torze
|
||||||
TTrack *tLast = nullptr; // ostatni analizowany tor
|
TTrack *tLast = nullptr; // ostatni analizowany tor
|
||||||
TEvent *eSignSkip = nullptr; // można pominąć ten SBL po zatrzymaniu
|
TEvent *eSignSkip = nullptr; // można pominąć ten SBL po zatrzymaniu
|
||||||
TSpeedPos *sSemNext = nullptr; // następny semafor na drodze zależny od trybu jazdy
|
std::size_t SemNextIndex{ -1 };
|
||||||
TSpeedPos *sSemNextStop = nullptr; // następny semafor na drodze zależny od trybu jazdy i na stój
|
std::size_t SemNextStopIndex{ -1 };
|
||||||
private: // parametry aktualnego składu
|
private: // parametry aktualnego składu
|
||||||
double fLength = 0.0; // długość składu (do wyciągania z ograniczeń)
|
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
|
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);
|
TEvent *CheckTrackEvent(double fDirection, TTrack *Track);
|
||||||
bool TableCheckEvent(TEvent *e);
|
bool TableCheckEvent(TEvent *e);
|
||||||
bool TableAddNew();
|
bool TableAddNew();
|
||||||
bool TableNotFound(TEvent *e);
|
bool TableNotFound(TEvent const *Event) const;
|
||||||
void TableClear();
|
void TableClear();
|
||||||
TEvent *TableCheckTrackEvent(double fDirection, TTrack *Track);
|
TEvent *TableCheckTrackEvent(double fDirection, TTrack *Track);
|
||||||
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = NULL);
|
void TableTraceRoute(double fDistance, TDynamicObject *pVehicle = NULL);
|
||||||
void TableCheck(double fDistance);
|
void TableCheck(double fDistance);
|
||||||
TCommandType TableUpdate(double &fVelDes, double &fDist, double &fNext, double &fAcc);
|
TCommandType TableUpdate(double &fVelDes, double &fDist, double &fNext, double &fAcc);
|
||||||
void TablePurger();
|
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
|
private: // Ra: stare funkcje skanujące, używane do szukania sygnalizatora z tyłu
|
||||||
bool BackwardTrackBusy(TTrack *Track);
|
bool BackwardTrackBusy(TTrack *Track);
|
||||||
@@ -395,9 +396,9 @@ class TController
|
|||||||
};
|
};
|
||||||
void MoveTo(TDynamicObject *to);
|
void MoveTo(TDynamicObject *to);
|
||||||
void DirectionInitial();
|
void DirectionInitial();
|
||||||
std::string TableText(int i);
|
std::string TableText(std::size_t const Index);
|
||||||
int CrossRoute(TTrack *tr);
|
int CrossRoute(TTrack *tr);
|
||||||
void RouteSwitch(int d);
|
void RouteSwitch(int d);
|
||||||
std::string OwnerName();
|
std::string OwnerName() const;
|
||||||
TMoverParameters const *Controlling() const { return mvControlling; }
|
TMoverParameters const *Controlling() const { return mvControlling; }
|
||||||
};
|
};
|
||||||
|
|||||||
186
DynObj.cpp
186
DynObj.cpp
@@ -798,7 +798,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
|||||||
btnOn = true;
|
btnOn = true;
|
||||||
}
|
}
|
||||||
// else btCPass2.TurnOff();
|
// else btCPass2.TurnOff();
|
||||||
if (MoverParameters->Battery)
|
if (MoverParameters->Battery || MoverParameters->ConverterFlag)
|
||||||
{ // sygnaly konca pociagu
|
{ // sygnaly konca pociagu
|
||||||
if (btEndSignals1.Active())
|
if (btEndSignals1.Active())
|
||||||
{
|
{
|
||||||
@@ -900,7 +900,7 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist)
|
|||||||
// Ra: przechyłkę załatwiamy na etapie przesuwania modelu
|
// Ra: przechyłkę załatwiamy na etapie przesuwania modelu
|
||||||
// if (ObjSqrDist<80000) ABuModelRoll(); //przechyłki od 400m
|
// 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
|
{ // sygnały czoła pociagu //Ra: wyświetlamy bez
|
||||||
// ograniczeń odległości, by były widoczne z
|
// ograniczeń odległości, by były widoczne z
|
||||||
// daleka
|
// daleka
|
||||||
@@ -1753,52 +1753,45 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
// wylaczanie hamulca
|
// wylaczanie hamulca
|
||||||
if (ActPar.find("<>") != std::string::npos) // wylaczanie na probe hamowania naglego
|
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
|
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->Hamulec->ForceEmptiness();
|
||||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
|
||||||
}
|
}
|
||||||
if (ActPar.find('E') != std::string::npos) // oprozniony
|
if (ActPar.find('E') != std::string::npos) // oprozniony
|
||||||
{
|
{
|
||||||
MoverParameters->Hamulec->ForceEmptiness();
|
MoverParameters->Hamulec->ForceEmptiness();
|
||||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
|
||||||
MoverParameters->Pipe->CreatePress(0);
|
MoverParameters->Pipe->CreatePress(0);
|
||||||
MoverParameters->Pipe2->CreatePress(0);
|
MoverParameters->Pipe2->CreatePress(0);
|
||||||
}
|
}
|
||||||
if (ActPar.find('Q') != std::string::npos) // oprozniony
|
if (ActPar.find('Q') != std::string::npos) // oprozniony
|
||||||
{
|
{
|
||||||
// MoverParameters->Hamulec->ForceEmptiness(); //TODO: sprawdzic,
|
MoverParameters->Hamulec->ForceEmptiness();
|
||||||
// dlaczego
|
|
||||||
// pojawia sie blad przy uzyciu tej linijki w lokomotywie
|
|
||||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
|
||||||
MoverParameters->Pipe->CreatePress(0.0);
|
MoverParameters->Pipe->CreatePress(0.0);
|
||||||
MoverParameters->PipePress = 0.0;
|
MoverParameters->PipePress = 0.0;
|
||||||
MoverParameters->Pipe2->CreatePress(0.0);
|
MoverParameters->Pipe2->CreatePress(0.0);
|
||||||
MoverParameters->ScndPipePress = 0.0;
|
MoverParameters->ScndPipePress = 0.0;
|
||||||
MoverParameters->PantVolume = 1;
|
MoverParameters->PantVolume = 0.1;
|
||||||
MoverParameters->PantPress = 0;
|
MoverParameters->PantPress = 0.0;
|
||||||
MoverParameters->CompressedVolume = 0;
|
MoverParameters->CompressedVolume = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ActPar.find('1') != std::string::npos) // wylaczanie 10%
|
if (ActPar.find('1') != std::string::npos) // wylaczanie 10%
|
||||||
{
|
{
|
||||||
if (Random(10) < 1) // losowanie 1/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->Hamulec->ForceEmptiness();
|
||||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ActPar.find('X') != std::string::npos) // agonalny wylaczanie 20%, usrednienie przekladni
|
if (ActPar.find('X') != std::string::npos) // agonalny wylaczanie 20%, usrednienie przekladni
|
||||||
{
|
{
|
||||||
if (Random(100) < 20) // losowanie 20/100
|
if (Random(100) < 20) // losowanie 20/100
|
||||||
{
|
{
|
||||||
MoverParameters->BrakeStatus |= 128; // wylacz
|
MoverParameters->Hamulec->SetBrakeStatus( MoverParameters->Hamulec->GetBrakeStatus() | b_dmg ); // wylacz
|
||||||
MoverParameters->Hamulec->ForceEmptiness();
|
MoverParameters->Hamulec->ForceEmptiness();
|
||||||
MoverParameters->BrakeReleaser(1); // odluznij automatycznie
|
|
||||||
}
|
}
|
||||||
if (MoverParameters->BrakeCylMult[2] * MoverParameters->BrakeCylMult[1] >
|
if (MoverParameters->BrakeCylMult[2] * MoverParameters->BrakeCylMult[1] >
|
||||||
0.01) // jesli jest nastawiacz mechaniczny PL
|
0.01) // jesli jest nastawiacz mechaniczny PL
|
||||||
@@ -2443,43 +2436,61 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
if (!bEnabled)
|
if (!bEnabled)
|
||||||
return false; // a normalnie powinny mieć bEnabled==false
|
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
|
// McZapkie-260202
|
||||||
if ((MoverParameters->EnginePowerSource.SourceType == CurrentCollector) &&
|
if ((MoverParameters->EnginePowerSource.SourceType == CurrentCollector) &&
|
||||||
(MoverParameters->Power > 1.0)) // aby rozrządczy nie opuszczał silnikowemu
|
(MoverParameters->Power > 1.0)) // aby rozrządczy nie opuszczał silnikowemu
|
||||||
|
/*
|
||||||
if ((MechInside) || (MoverParameters->TrainType == dt_EZT))
|
if ((MechInside) || (MoverParameters->TrainType == dt_EZT))
|
||||||
{
|
{
|
||||||
|
*/
|
||||||
// if
|
// if
|
||||||
// ((!MoverParameters->PantCompFlag)&&(MoverParameters->CompressedVolume>=2.8))
|
// ((!MoverParameters->PantCompFlag)&&(MoverParameters->CompressedVolume>=2.8))
|
||||||
// MoverParameters->PantVolume=MoverParameters->CompressedVolume;
|
// 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...
|
|
||||||
}
|
|
||||||
// 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ć
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
double dDOMoveLen;
|
||||||
|
|
||||||
TLocation l;
|
TLocation l;
|
||||||
@@ -2913,34 +2924,23 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
if (MoverParameters->Mains) // nie wchodzić w funkcję bez potrzeby
|
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
|
&& ( false == MoverParameters->ConverterFlag ) // added alternative power source. TODO: more generic power check
|
||||||
|
/*
|
||||||
|
// NOTE: disabled on account of multi-unit setups, where the unmanned unit wouldn't be affected
|
||||||
&& ( Controller == Humandriver )
|
&& ( Controller == Humandriver )
|
||||||
|
*/
|
||||||
&& ( MoverParameters->EngineType != DieselEngine )
|
&& ( MoverParameters->EngineType != DieselEngine )
|
||||||
&& ( MoverParameters->EngineType != WheelsDriven ) )
|
&& ( MoverParameters->EngineType != WheelsDriven ) )
|
||||||
{ // jeśli bateria wyłączona, a nie diesel ani drezyna reczna
|
{ // 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;
|
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
|
// McZapkie-260202 - dMoveLen przyda sie przy stukocie kol
|
||||||
@@ -3210,21 +3210,23 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
MoverParameters->PantRearVolt = 0.0;
|
MoverParameters->PantRearVolt = 0.0;
|
||||||
break;
|
break;
|
||||||
} // pozostałe na razie nie obsługiwane
|
} // pozostałe na razie nie obsługiwane
|
||||||
if (MoverParameters->PantPress >
|
if( MoverParameters->PantPress > (
|
||||||
(MoverParameters->TrainType == dt_EZT ? 2.5 : 3.3)) // Ra 2013-12:
|
MoverParameters->TrainType == dt_EZT ?
|
||||||
// Niebugocław
|
2.45 : // Ra 2013-12: Niebugocław mówi, że w EZT podnoszą się przy 2.5
|
||||||
// mówi, że w EZT
|
3.45 ) ) {
|
||||||
// podnoszą się
|
// z EXE Kursa
|
||||||
// przy 2.5
|
// Ra: wysokość zależy od ciśnienia !!!
|
||||||
pantspeedfactor = 0.015 * (MoverParameters->PantPress) *
|
pantspeedfactor = 0.015 * ( MoverParameters->PantPress ) * dt1;
|
||||||
dt1; // z EXE Kursa //Ra: wysokość zależy od ciśnienia !!!
|
}
|
||||||
else
|
else {
|
||||||
pantspeedfactor = 0.0;
|
pantspeedfactor = 0.0;
|
||||||
if (pantspeedfactor < 0)
|
}
|
||||||
pantspeedfactor = 0;
|
pantspeedfactor = std::max( 0.0, pantspeedfactor );
|
||||||
k = p->fAngleL;
|
k = p->fAngleL;
|
||||||
if (i ? MoverParameters->PantRearUp :
|
if( ( pantspeedfactor > 0.0 )
|
||||||
MoverParameters->PantFrontUp) // jeśli ma być podniesiony
|
&& ( i ?
|
||||||
|
MoverParameters->PantRearUp :
|
||||||
|
MoverParameters->PantFrontUp ) )// jeśli ma być podniesiony
|
||||||
{
|
{
|
||||||
if (PantDiff > 0.001) // jeśli nie dolega do drutu
|
if (PantDiff > 0.001) // jeśli nie dolega do drutu
|
||||||
{ // jeśli poprzednia wysokość jest mniejsza niż pożądana, zwiększyć kąt
|
{ // 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);
|
sPantDown.Play(vol, 0, MechInside, vPosition);
|
||||||
MoverParameters->PantRearSP = true;
|
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)
|
if (MoverParameters->EnginePowerSource.SourceType == CurrentCollector)
|
||||||
{ // Winger 240404 - wylaczanie sprezarki i
|
{ // Winger 240404 - wylaczanie sprezarki i
|
||||||
// przetwornicy przy braku napiecia
|
// 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!
|
MoverParameters->CompressorFlag = false; // Ra: to jest wątpliwe - wyłączenie sprężarki powinno być w jednym miejscu!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else if (MoverParameters->EnginePowerSource.SourceType == InternalSource)
|
else if (MoverParameters->EnginePowerSource.SourceType == InternalSource)
|
||||||
if (MoverParameters->EnginePowerSource.PowerType == SteamPower)
|
if (MoverParameters->EnginePowerSource.PowerType == SteamPower)
|
||||||
@@ -4124,22 +4130,20 @@ void TDynamicObject::RenderSounds()
|
|||||||
sConverter.TurnOff(MechInside, GetPosition());
|
sConverter.TurnOff(MechInside, GetPosition());
|
||||||
sConverter.Update(MechInside, GetPosition());
|
sConverter.Update(MechInside, GetPosition());
|
||||||
}
|
}
|
||||||
if (MoverParameters->WarningSignal > 0)
|
|
||||||
{
|
if( TestFlag( MoverParameters->WarningSignal, 1 ) ) {
|
||||||
if (TestFlag(MoverParameters->WarningSignal, 1))
|
|
||||||
sHorn1.TurnOn( MechInside, GetPosition() );
|
sHorn1.TurnOn( MechInside, GetPosition() );
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
sHorn1.TurnOff( MechInside, GetPosition() );
|
sHorn1.TurnOff( MechInside, GetPosition() );
|
||||||
if (TestFlag(MoverParameters->WarningSignal, 2))
|
}
|
||||||
|
if( TestFlag( MoverParameters->WarningSignal, 2 ) ) {
|
||||||
sHorn2.TurnOn( MechInside, GetPosition() );
|
sHorn2.TurnOn( MechInside, GetPosition() );
|
||||||
else
|
}
|
||||||
sHorn2.TurnOff(MechInside, GetPosition());
|
else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sHorn1.TurnOff(MechInside, GetPosition());
|
|
||||||
sHorn2.TurnOff( MechInside, GetPosition() );
|
sHorn2.TurnOff( MechInside, GetPosition() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MoverParameters->DoorClosureWarning)
|
if (MoverParameters->DoorClosureWarning)
|
||||||
{
|
{
|
||||||
if (MoverParameters->DepartureSignal) // NBMX sygnal odjazdu, MC: pod warunkiem ze jest
|
if (MoverParameters->DepartureSignal) // NBMX sygnal odjazdu, MC: pod warunkiem ze jest
|
||||||
|
|||||||
@@ -130,7 +130,9 @@ class TTranscript
|
|||||||
float fHide; // czas ukrycia/usunięcia
|
float fHide; // czas ukrycia/usunięcia
|
||||||
std::string asText; // tekst gotowy do wyświetlenia (usunięte znaczniki czasu)
|
std::string asText; // tekst gotowy do wyświetlenia (usunięte znaczniki czasu)
|
||||||
bool bItalic; // czy kursywa (dźwięk nieistotny dla prowadzącego)
|
bool bItalic; // czy kursywa (dźwięk nieistotny dla prowadzącego)
|
||||||
|
/*
|
||||||
int iNext; // następna używana linijka, żeby nie przestawiać fizycznie tabeli
|
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 Point;
|
||||||
vector3 Normal;
|
vector3 Normal;
|
||||||
float tu, tv;
|
float tu{ 0.0f }, tv{ 0.0f };
|
||||||
void HalfSet(const TGroundVertex &v1, const TGroundVertex &v2)
|
void HalfSet(const TGroundVertex &v1, const TGroundVertex &v2)
|
||||||
{ // wyliczenie współrzędnych i mapowania punktu na środku odcinka v1<->v2
|
{ // wyliczenie współrzędnych i mapowania punktu na środku odcinka v1<->v2
|
||||||
Point = 0.5 * (v1.Point + v2.Point);
|
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_scndpneumatic = 32; //przewody 8 atm (żółte; zasilanie powietrzem)
|
||||||
static int const ctrain_heating = 64; //przewody ogrzewania WN
|
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
|
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*/
|
/*typ hamulca elektrodynamicznego*/
|
||||||
static int const dbrake_none = 0;
|
static int const dbrake_none = 0;
|
||||||
static int const dbrake_passive = 1;
|
static int const dbrake_passive = 1;
|
||||||
@@ -269,6 +285,7 @@ struct TCommand
|
|||||||
std::string Command; /*komenda*/
|
std::string Command; /*komenda*/
|
||||||
double Value1 = 0.0; /*argumenty komendy*/
|
double Value1 = 0.0; /*argumenty komendy*/
|
||||||
double Value2 = 0.0;
|
double Value2 = 0.0;
|
||||||
|
int Coupling{ ctrain_controll }; // coupler flag used to determine command propagation
|
||||||
TLocation Location;
|
TLocation Location;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -360,14 +377,14 @@ struct TBoilerType {
|
|||||||
};
|
};
|
||||||
/*rodzaj odbieraka pradu*/
|
/*rodzaj odbieraka pradu*/
|
||||||
struct TCurrentCollector {
|
struct TCurrentCollector {
|
||||||
long CollectorsNo; //musi być tu, bo inaczej się kopie
|
long CollectorsNo{ 0 }; //musi być tu, bo inaczej się kopie
|
||||||
double MinH; double MaxH; //zakres ruchu pantografu, nigdzie nie używany
|
double MinH{ 0.0 }; double MaxH{ 0.0 }; //zakres ruchu pantografu, nigdzie nie używany
|
||||||
double CSW; //szerokość części roboczej (styku) ślizgacza
|
double CSW{ 0.0 }; //szerokość części roboczej (styku) ślizgacza
|
||||||
double MinV; double MaxV; //minimalne i maksymalne akceptowane napięcie
|
double MinV{ 0.0 }; double MaxV{ 0.0 }; //minimalne i maksymalne akceptowane napięcie
|
||||||
double OVP; //czy jest przekaznik nadnapieciowy
|
double OVP{ 0.0 }; //czy jest przekaznik nadnapieciowy
|
||||||
double InsetV; //minimalne napięcie wymagane do załączenia
|
double InsetV{ 0.0 }; //minimalne napięcie wymagane do załączenia
|
||||||
double MinPress; //minimalne ciśnienie do załączenia WS
|
double MinPress{ 0.0 }; //minimalne ciśnienie do załączenia WS
|
||||||
double MaxPress; //maksymalne ciśnienie za reduktorem
|
double MaxPress{ 0.0 }; //maksymalne ciśnienie za reduktorem
|
||||||
//inline TCurrentCollector() {
|
//inline TCurrentCollector() {
|
||||||
// CollectorsNo = 0;
|
// CollectorsNo = 0;
|
||||||
// MinH, MaxH, CSW, MinV, MaxV = 0.0;
|
// MinH, MaxH, CSW, MinV, MaxV = 0.0;
|
||||||
@@ -536,6 +553,12 @@ struct TTransmision
|
|||||||
|
|
||||||
enum TCouplerType { NoCoupler, Articulated, Bare, Chain, Screw, Automatic };
|
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 {
|
struct TCoupling {
|
||||||
/*parametry*/
|
/*parametry*/
|
||||||
double SpringKB = 1.0; /*stala sprezystosci zderzaka/sprzegu, %tlumiennosci */
|
double SpringKB = 1.0; /*stala sprezystosci zderzaka/sprzegu, %tlumiennosci */
|
||||||
@@ -556,6 +579,9 @@ struct TCoupling {
|
|||||||
double CForce = 0.0; /*sila z jaka dzialal*/
|
double CForce = 0.0; /*sila z jaka dzialal*/
|
||||||
double Dist = 0.0; /*strzalka ugiecia zderzaków*/
|
double Dist = 0.0; /*strzalka ugiecia zderzaków*/
|
||||||
bool CheckCollision = false; /*czy sprawdzac sile czy pedy*/
|
bool CheckCollision = false; /*czy sprawdzac sile czy pedy*/
|
||||||
|
|
||||||
|
power_coupling power_high;
|
||||||
|
power_coupling power_low; // TODO: implement this
|
||||||
};
|
};
|
||||||
|
|
||||||
class TMoverParameters
|
class TMoverParameters
|
||||||
@@ -768,7 +794,17 @@ public:
|
|||||||
TRotation Rot;
|
TRotation Rot;
|
||||||
std::string Name; /*nazwa wlasna*/
|
std::string Name; /*nazwa wlasna*/
|
||||||
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
|
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
|
||||||
|
enum side {
|
||||||
|
front = 0,
|
||||||
|
rear
|
||||||
|
};
|
||||||
|
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||||
double HVCouplers[ 2 ][ 2 ]; //przewod WN
|
double HVCouplers[ 2 ][ 2 ]; //przewod WN
|
||||||
|
enum hvcoupler {
|
||||||
|
current = 0,
|
||||||
|
voltage
|
||||||
|
};
|
||||||
|
#endif
|
||||||
int ScanCounter = 0; /*pomocnicze do skanowania sprzegow*/
|
int ScanCounter = 0; /*pomocnicze do skanowania sprzegow*/
|
||||||
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
|
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
|
||||||
int SoundFlag = 0; /*!o patrz stale sound_ */
|
int SoundFlag = 0; /*!o patrz stale sound_ */
|
||||||
@@ -804,6 +840,7 @@ public:
|
|||||||
bool CompressorFlag = false; /*!o czy wlaczona sprezarka*/
|
bool CompressorFlag = false; /*!o czy wlaczona sprezarka*/
|
||||||
bool PantCompFlag = false; /*!o czy wlaczona sprezarka pantografow*/
|
bool PantCompFlag = false; /*!o czy wlaczona sprezarka pantografow*/
|
||||||
bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/
|
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 ConverterFlag = false ; /*! czy wlaczona przetwornica NBMX*/
|
||||||
bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/
|
bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/
|
||||||
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
|
int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/
|
||||||
@@ -812,7 +849,9 @@ public:
|
|||||||
int LocalBrakePos = 0; /*nastawa hamulca indywidualnego*/
|
int LocalBrakePos = 0; /*nastawa hamulca indywidualnego*/
|
||||||
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
|
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
|
||||||
double LocalBrakePosA = 0.0;
|
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*/
|
bool EmergencyBrakeFlag = false; /*hamowanie nagle*/
|
||||||
int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/
|
int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/
|
||||||
int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
|
int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
|
||||||
@@ -886,6 +925,8 @@ public:
|
|||||||
double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/
|
double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/
|
||||||
bool UnBrake = false; /*w EZT - nacisniete odhamowywanie*/
|
bool UnBrake = false; /*w EZT - nacisniete odhamowywanie*/
|
||||||
double PantPress = 0.0; /*Cisnienie w zbiornikach pantografow*/
|
double PantPress = 0.0; /*Cisnienie w zbiornikach pantografow*/
|
||||||
|
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
|
bool s_CAtestebrake = false; //hunter-091012: zmienna dla testu ca
|
||||||
|
|
||||||
/*-zmienne dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
/*-zmienne dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
||||||
@@ -982,11 +1023,11 @@ public:
|
|||||||
|
|
||||||
/*! przesylanie komend sterujacych*/
|
/*! przesylanie komend sterujacych*/
|
||||||
bool SendCtrlBroadcast(std::string CtrlCommand, double ctrlvalue);
|
bool SendCtrlBroadcast(std::string CtrlCommand, double ctrlvalue);
|
||||||
bool SendCtrlToNext(std::string CtrlCommand, double ctrlvalue, double dir);
|
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);
|
bool SetInternalCommand( std::string NewCommand, double NewValue1, double NewValue2, int const Couplertype = ctrain_controll );
|
||||||
double GetExternalCommand(std::string &Command);
|
double GetExternalCommand(std::string &Command);
|
||||||
bool RunCommand(std::string Command, double CValue1, double CValue2);
|
bool RunCommand( std::string Command, double CValue1, double CValue2, int const Couplertype = ctrain_controll );
|
||||||
bool RunInternalCommand(void);
|
bool RunInternalCommand();
|
||||||
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
|
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
|
||||||
bool CabActivisation(void);
|
bool CabActivisation(void);
|
||||||
bool CabDeactivisation(void);
|
bool CabDeactivisation(void);
|
||||||
@@ -1002,7 +1043,7 @@ public:
|
|||||||
|
|
||||||
bool AddPulseForce(int Multipler);/*dla drezyny*/
|
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*/
|
/*! zbijanie czuwaka/SHP*/
|
||||||
void SSReset(void);
|
void SSReset(void);
|
||||||
@@ -1058,9 +1099,9 @@ public:
|
|||||||
|
|
||||||
/*--funkcje dla lokomotyw*/
|
/*--funkcje dla lokomotyw*/
|
||||||
bool DirectionBackward(void);/*! kierunek ruchu*/
|
bool DirectionBackward(void);/*! kierunek ruchu*/
|
||||||
bool MainSwitch(bool State);/*! wylacznik glowny*/
|
bool MainSwitch( bool const State, int const Notify = command_range::consist );/*! wylacznik glowny*/
|
||||||
bool ConverterSwitch(bool State);/*! wl/wyl przetwornicy*/
|
bool ConverterSwitch( bool State, int const Notify = command_range::consist );/*! wl/wyl przetwornicy*/
|
||||||
bool CompressorSwitch(bool State);/*! wl/wyl sprezarki*/
|
bool CompressorSwitch( bool State, int const Notify = command_range::consist );/*! wl/wyl sprezarki*/
|
||||||
|
|
||||||
/*-funkcje typowe dla lokomotywy elektrycznej*/
|
/*-funkcje typowe dla lokomotywy elektrycznej*/
|
||||||
void ConverterCheck(); // przetwornica
|
void ConverterCheck(); // przetwornica
|
||||||
@@ -1074,7 +1115,7 @@ public:
|
|||||||
/*function ShowEngineRotation(VehN:int): integer; //Ra 2014-06: przeniesione do C++*/
|
/*function ShowEngineRotation(VehN:int): integer; //Ra 2014-06: przeniesione do C++*/
|
||||||
/*funkcje uzalezniajace sile pociagowa od predkosci: v2n, n2r, current, momentum*/
|
/*funkcje uzalezniajace sile pociagowa od predkosci: v2n, n2r, current, momentum*/
|
||||||
double v2n(void);
|
double v2n(void);
|
||||||
double current(double n, double U);
|
double Current(double n, double U);
|
||||||
double Momentum(double I);
|
double Momentum(double I);
|
||||||
double MomentumF(double I, double Iw, int SCP);
|
double MomentumF(double I, double Iw, int SCP);
|
||||||
|
|
||||||
@@ -1086,8 +1127,8 @@ public:
|
|||||||
bool AutoRelayCheck(void);//symulacja automatycznego rozruchu
|
bool AutoRelayCheck(void);//symulacja automatycznego rozruchu
|
||||||
|
|
||||||
bool ResistorsFlagCheck(void); //sprawdzenie kontrolki oporow rozruchowych NBMX
|
bool ResistorsFlagCheck(void); //sprawdzenie kontrolki oporow rozruchowych NBMX
|
||||||
bool PantFront(bool State); //obsluga pantografou przedniego
|
bool PantFront( bool const State, int const Notify = command_range::consist ); //obsluga pantografou przedniego
|
||||||
bool PantRear(bool State); //obsluga pantografu tylnego
|
bool PantRear( bool const State, int const Notify = command_range::consist ); //obsluga pantografu tylnego
|
||||||
|
|
||||||
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
||||||
bool dizel_EngageSwitch(double state);
|
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 "hamulce.h"
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
#include "Mover.h"
|
#include "Mover.h"
|
||||||
|
#include "usefull.h"
|
||||||
|
|
||||||
//---FUNKCJE OGOLNE---
|
//---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 PF( double const P1, double const P2, double const S, double const DP )
|
||||||
{
|
{
|
||||||
double PH = std::max(P1, P2) + 1; // wyzsze cisnienie absolutne
|
double const PH = std::max(P1, P2) + 1.0; // wyzsze cisnienie absolutne
|
||||||
double PL = P1 + P2 - PH + 2; // nizsze cisnienie absolutne
|
double const PL = P1 + P2 - PH + 2.0; // nizsze cisnienie absolutne
|
||||||
double sg = PL / PH; // bezwymiarowy stosunek cisnien
|
double const sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||||
double FM = PH * 197 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
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 > 0.5) // jesli ponizej stosunku krytycznego
|
||||||
if ((PH - PL) < DP) // niewielka roznica cisnien
|
if ((PH - PL) < DP) // niewielka roznica cisnien
|
||||||
return (1.0 - sg) / DPL * FM * 2.0 * std::sqrt((DP) * (PH - DP));
|
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;
|
static double const DPS = 0.001;
|
||||||
|
|
||||||
double PH = std::max(P1, P2) + 1; // wyzsze cisnienie absolutne
|
double const PH = std::max(P1, P2) + 1.0; // wyzsze cisnienie absolutne
|
||||||
double PL = P1 + P2 - PH + 2; // nizsze cisnienie absolutne
|
double const PL = P1 + P2 - PH + 2.0; // nizsze cisnienie absolutne
|
||||||
double sg = PL / PH; // bezwymiarowy stosunek cisnien
|
double const sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||||
double FM = PH * 197 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
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 > 0.5) // jesli ponizej stosunku krytycznego
|
||||||
if ((sg < DPS)) // niewielka roznica cisnien
|
if (sg < DPS) // niewielka roznica cisnien
|
||||||
return (1 - sg) / DPS * FM * 2 * std::sqrt((DPS) * (1 - DPS));
|
return (1.0 - sg) / DPS * FM * 2.0 * std::sqrt((DPS) * (1.0 - DPS));
|
||||||
else
|
else
|
||||||
return FM * 2 * std::sqrt((sg) * (1 - sg));
|
return FM * 2.0 * std::sqrt((sg) * (1.0 - sg));
|
||||||
else // powyzej stosunku krytycznego
|
else // powyzej stosunku krytycznego
|
||||||
return FM;
|
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 TLSt::GetPF( double const PP, double const dt, double const Vel )
|
||||||
{
|
{
|
||||||
double result;
|
double result;
|
||||||
double dv;
|
|
||||||
double dV1;
|
|
||||||
double temp;
|
|
||||||
double VVP;
|
|
||||||
double BVP;
|
|
||||||
double BCP;
|
|
||||||
double CVP;
|
|
||||||
|
|
||||||
// ValveRes.CreatePress(LBP);
|
// ValveRes.CreatePress(LBP);
|
||||||
// LBP:=0;
|
// LBP:=0;
|
||||||
|
|
||||||
BVP = BrakeRes->P();
|
double const BVP{ BrakeRes->P() };
|
||||||
VVP = ValveRes->P();
|
double const VVP{ ValveRes->P() };
|
||||||
BCP = ImplsRes->P();
|
double const BCP{ ImplsRes->P() };
|
||||||
CVP = CntrlRes->P();
|
double const CVP{ CntrlRes->P() };
|
||||||
|
|
||||||
dv = 0;
|
double dV{ 0.0 };
|
||||||
dV1 = 0;
|
double dV1{ 0.0 };
|
||||||
|
|
||||||
// sprawdzanie stanu
|
// sprawdzanie stanu
|
||||||
if ((BrakeStatus & b_rls) == b_rls)
|
if( ( BrakeStatus & b_rls ) == b_rls ) {
|
||||||
if ((CVP < 0))
|
if( CVP < 0.0 ) {
|
||||||
BrakeStatus &= ~b_rls;
|
BrakeStatus &= ~b_rls;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ // 008
|
{ // 008
|
||||||
dv = PF1(CVP, BCP, 0.024) * dt;
|
dV = PF1( CVP, BCP, 0.024 ) * dt;
|
||||||
CntrlRes->Flow(+dv);
|
CntrlRes->Flow( dV );
|
||||||
// dV1:=+dV; //minus potem jest
|
/*
|
||||||
// ImplsRes->Flow(-dV1);
|
// 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
|
// przeplyw ZS <-> PG
|
||||||
if (((CVP - BCP) * BVM > 0.5))
|
if (((CVP - BCP) * BVM > 0.5))
|
||||||
temp = 0;
|
temp = 0.0;
|
||||||
else if ((VVP > CVP + 0.4))
|
else if ((VVP > CVP + 0.4))
|
||||||
temp = 0.5;
|
temp = 0.5;
|
||||||
else
|
else
|
||||||
temp = 0.5;
|
temp = 0.5;
|
||||||
|
|
||||||
dv = PF1(CVP, VVP, 0.0015 * temp / 1.8 / 2) * dt;
|
dV = PF1(CVP, VVP, 0.0015 * temp / 1.8 / 2) * dt;
|
||||||
CntrlRes->Flow(+dv);
|
CntrlRes->Flow(+dV);
|
||||||
ValveRes->Flow(-0.04 * dv);
|
ValveRes->Flow(-0.04 * dV);
|
||||||
dV1 = dV1 - 0.96 * dv;
|
dV1 = dV1 - 0.96 * dV;
|
||||||
|
|
||||||
// luzowanie KI {G}
|
// luzowanie KI {G}
|
||||||
// if VVP>BCP then
|
// 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
|
// dV:=PF(VVP,BCP,0.00020*(1.33-int((CVP-BCP)*BVM>0.65)))*dt
|
||||||
// else dV:=0; 0.00025 P
|
// else dV:=0; 0.00025 P
|
||||||
/*P*/
|
/*P*/
|
||||||
if (VVP > BCP)
|
if( VVP > BCP ) {
|
||||||
dv = PF(VVP, BCP,
|
dV =
|
||||||
0.00043 * (1.5 - int(((CVP - BCP) * BVM > 1) && (BrakeDelayFlag == bdelay_G))),
|
PF( VVP, BCP,
|
||||||
0.1) *
|
0.00043 * ( 1.5 - (
|
||||||
dt;
|
true == ( ( ( CVP - BCP ) * BVM > 1.0 )
|
||||||
else if ((CVP - BCP) < 1.5)
|
&& ( BrakeDelayFlag == bdelay_G ) ) ?
|
||||||
dv = PF(VVP, BCP,
|
1.0 :
|
||||||
0.001472 * (1.36 - int(((CVP - BCP) * BVM > 1) && (BrakeDelayFlag == bdelay_G))),
|
0.0 ) ),
|
||||||
0.1) *
|
0.1 )
|
||||||
dt;
|
* dt;
|
||||||
else
|
}
|
||||||
dv = 0;
|
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);
|
ImplsRes->Flow(-dV);
|
||||||
ValveRes->Flow(+dv);
|
ValveRes->Flow(+dV);
|
||||||
// przeplyw PG <-> rozdzielacz
|
// przeplyw PG <-> rozdzielacz
|
||||||
dv = PF(PP, VVP, 0.01, 0.1) * dt;
|
dV = PF(PP, VVP, 0.01, 0.1) * dt;
|
||||||
ValveRes->Flow(-dv);
|
ValveRes->Flow(-dV);
|
||||||
|
|
||||||
result = dv - dV1;
|
result = dV - dV1;
|
||||||
|
|
||||||
// if Vel>55 then temp:=0.72 else
|
// if Vel>55 then temp:=0.72 else
|
||||||
// temp:=1;{R}
|
// 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))
|
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.0015*3*sizeBC)*dt
|
||||||
// dV:=PF(0,BrakeCyl->P(),0.005*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
|
else
|
||||||
dv = 0;
|
dV = 0;
|
||||||
BrakeCyl->Flow(-dv);
|
BrakeCyl->Flow(-dV);
|
||||||
// przeplyw ZP <-> CH
|
// przeplyw ZP <-> CH
|
||||||
if ((BrakeCyl->P() < temp - 0.005) && (temp > 0.29))
|
if ((BrakeCyl->P() < temp - 0.005) && (temp > 0.29))
|
||||||
// dV:=PF(BVP,BrakeCyl->P(),0.002*3*sizeBC*2)*dt
|
// 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
|
else
|
||||||
dv = 0;
|
dV = 0;
|
||||||
BrakeRes->Flow(dv);
|
BrakeRes->Flow(dV);
|
||||||
BrakeCyl->Flow(-dv);
|
BrakeCyl->Flow(-dV);
|
||||||
|
|
||||||
ImplsRes->Act();
|
ImplsRes->Act();
|
||||||
ValveRes->Act();
|
ValveRes->Act();
|
||||||
@@ -2198,125 +2211,146 @@ double TFV4aM::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
static int const LBDelay = 100;
|
static int const LBDelay = 100;
|
||||||
static double const xpM = 0.3; // mnoznik membrany komory pod
|
static double const xpM = 0.3; // mnoznik membrany komory pod
|
||||||
|
|
||||||
double LimPP;
|
ep = (PP / 2.0) * 1.5 + (ep / 2.0) * 0.5; // SPKS!!
|
||||||
double dpPipe;
|
|
||||||
double dpMainValve;
|
|
||||||
double ActFlowSpeed;
|
|
||||||
double DP;
|
|
||||||
double pom;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
ep = PP / 2 * 1.5 + ep / 2 * 0.5; // SPKS!!
|
for( int idx = 0; idx < 5; ++idx ) {
|
||||||
// ep:=pp;
|
Sounds[ idx ] = 0;
|
||||||
// ep:=cp/3+pp/3+ep/3;
|
}
|
||||||
// ep:=cp;
|
|
||||||
|
|
||||||
for (i = 0; i < 5; ++i)
|
// na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||||
Sounds[i] = 0;
|
i_bcp = clamp( i_bcp, -1.999, 5.999 );
|
||||||
DP = 0;
|
|
||||||
|
|
||||||
i_bcp = Max0R(Min0R(i_bcp, 5.999), -1.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
double DP{ 0.0 };
|
||||||
|
if( TP > 0.0 ) {
|
||||||
if ((TP > 0))
|
// jesli czasowy jest niepusty
|
||||||
{ // jesli czasowy jest niepusty
|
|
||||||
// dp:=0.07; //od cisnienia 5 do 0 w 60 sekund ((5-0)*dt/75)
|
|
||||||
DP = 0.045; // 2.5 w 55 sekund (5,35->5,15 w PG)
|
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;
|
Sounds[s_fv4a_t] = DP;
|
||||||
}
|
}
|
||||||
else //.08
|
else {
|
||||||
{
|
//.08
|
||||||
TP = 0;
|
TP = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((XP > 0)) // jesli komora pod niepusta jest niepusty
|
if (XP > 0) {
|
||||||
{
|
// jesli komora pod niepusta jest niepusty
|
||||||
DP = 2.5;
|
DP = 2.5;
|
||||||
Sounds[s_fv4a_x] = DP * XP;
|
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
|
double pom;
|
||||||
ActFlowSpeed = BPT[lround(i_bcp) + 2][0];
|
if( EQ( i_bcp, -1.0 ) ) {
|
||||||
|
pom = std::min( HP, 5.4 + RedAdj );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pom = std::min( CP, HP );
|
||||||
|
}
|
||||||
|
|
||||||
if ((EQ(i_bcp, -1)))
|
if( pom > RP + 0.25 ) {
|
||||||
pom = Min0R(HP, 5.4 + RedAdj);
|
|
||||||
else
|
|
||||||
pom = Min0R(CP, HP);
|
|
||||||
|
|
||||||
if ((pom > RP + 0.25))
|
|
||||||
Fala = true;
|
Fala = true;
|
||||||
if ((Fala))
|
}
|
||||||
if ((pom > RP + 0.3))
|
if( Fala ) {
|
||||||
// if(ep>rp+0.11)then
|
if( pom > RP + 0.3 ) {
|
||||||
XP = XP - 20 * PR(pom, XP) * dt;
|
XP = XP - 20.0 * PR( pom, XP ) * dt;
|
||||||
// else
|
}
|
||||||
// xp:=xp-16*(ep-(ep+0.01))/(0.1)*PR(ep,xp)*dt;
|
else {
|
||||||
else
|
|
||||||
Fala = false;
|
Fala = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((LimPP > CP)) // podwyzszanie szybkie
|
double LimPP = std::min(
|
||||||
CP = CP + 5 * 60 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy;
|
LPP_RP( i_bcp ) + TP * 0.08 + RedAdj,
|
||||||
else
|
HP ); // pozycja + czasowy lub zasilanie
|
||||||
CP = CP + 13 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
|
|
||||||
|
// 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
|
LimPP = pom; // cp
|
||||||
dpPipe = Min0R(HP, LimPP + XP * xpM);
|
double const dpPipe = std::min(HP, LimPP + XP * xpM);
|
||||||
|
|
||||||
if (dpPipe > PP)
|
double const ActFlowSpeed = BPT[ std::lround( i_bcp ) + 2 ][ 0 ];
|
||||||
|
|
||||||
|
double dpMainValve;
|
||||||
|
if( dpPipe > PP ) {
|
||||||
dpMainValve = -PFVa( HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4 );
|
dpMainValve = -PFVa( HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4 );
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
dpMainValve = PFVd( PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4 );
|
dpMainValve = PFVd( PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4 );
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EQ(i_bcp, 0))
|
if (EQ(i_bcp, -1)) {
|
||||||
{
|
|
||||||
if ((TP > 2))
|
if( TP < 5 ) { TP += dt; }
|
||||||
dpMainValve = dpMainValve * 1.5; //+0.5*PF(dpPipe,pp,ActFlowSpeed/LBDelay)//coby nie
|
if( TP < 1 ) { TP -= 0.5 * dt; }
|
||||||
// przeszkadzal przy ladowaniu z zaworu obok
|
}
|
||||||
|
|
||||||
|
if (EQ(i_bcp, 0)) {
|
||||||
|
|
||||||
|
if( TP > 2 ) {
|
||||||
|
dpMainValve *= 1.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ep = dpPipe;
|
ep = dpPipe;
|
||||||
if ((EQ(i_bcp, 0) || (RP > ep)))
|
if( ( EQ( i_bcp, 0 )
|
||||||
RP = RP + PF(RP, ep, 0.0007) * dt; // powolne wzrastanie, ale szybsze na jezdzie;
|
|| ( RP > ep ) ) ) {
|
||||||
else
|
// powolne wzrastanie, ale szybsze na jezdzie;
|
||||||
RP = RP + PF(RP, ep, 0.000093 / 2 * 2) * dt; // powolne wzrastanie i to bardzo
|
RP += PF( RP, ep, 0.0007 ) * dt;
|
||||||
// jednak trzeba wydluzyc, bo
|
}
|
||||||
// obecnie zle dziala
|
else {
|
||||||
if ((RP < ep) &&
|
// powolne wzrastanie i to bardzo
|
||||||
(RP <
|
RP += PF( RP, ep, 0.000093 / 2 * 2 ) * dt;
|
||||||
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
|
// jednak trzeba wydluzyc, bo obecnie zle dziala
|
||||||
// potrzebny do napelnienia PG
|
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)))
|
if( ( EQ( i_bcp, i_bcpno ) )
|
||||||
{
|
|| ( EQ( i_bcp, -2 ) ) ) {
|
||||||
DP = PF(0, PP, ActFlowSpeed / LBDelay);
|
|
||||||
|
DP = PF( 0.0, PP, ActFlowSpeed / LBDelay );
|
||||||
dpMainValve = DP;
|
dpMainValve = DP;
|
||||||
Sounds[s_fv4a_e] = DP;
|
Sounds[s_fv4a_e] = DP;
|
||||||
Sounds[s_fv4a_u] = 0;
|
Sounds[s_fv4a_u] = 0.0;
|
||||||
Sounds[s_fv4a_b] = 0;
|
Sounds[s_fv4a_b] = 0.0;
|
||||||
Sounds[s_fv4a_x] = 0;
|
Sounds[s_fv4a_x] = 0.0;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (dpMainValve > 0)
|
if( dpMainValve > 0.0 ) {
|
||||||
Sounds[ s_fv4a_b ] = dpMainValve;
|
Sounds[ s_fv4a_b ] = dpMainValve;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
Sounds[ s_fv4a_u ] = -dpMainValve;
|
Sounds[ s_fv4a_u ] = -dpMainValve;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return dpMainValve * dt;
|
return dpMainValve * dt;
|
||||||
}
|
}
|
||||||
@@ -2347,17 +2381,11 @@ double TFV4aM::GetPos(int i)
|
|||||||
|
|
||||||
double TFV4aM::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
|
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
|
return
|
||||||
double i, j, k, l;
|
BPT[i_pos][1]
|
||||||
i = BPT[i_pos][1];
|
+ (BPT[i_pos + 1][1] - BPT[i_pos][1]) * ((pos + 2) - i_pos); // interpolacja liniowa
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
bool TFV4aM::EQ(double pos, double i_pos)
|
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
|
//---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;
|
static int const LBDelay = 100;
|
||||||
|
|
||||||
double LimPP;
|
double LimPP;
|
||||||
@@ -2376,13 +2403,11 @@ double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep
|
|||||||
double ActFlowSpeed;
|
double ActFlowSpeed;
|
||||||
double DP;
|
double DP;
|
||||||
double pom;
|
double pom;
|
||||||
int i;
|
|
||||||
|
|
||||||
{
|
for( int idx = 0; idx < 5; ++idx ) {
|
||||||
long i_end = 5;
|
Sounds[ idx ] = 0;
|
||||||
for (i = 0; i < i_end; ++i)
|
|
||||||
Sounds[i] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DP = 0;
|
DP = 0;
|
||||||
|
|
||||||
i_bcp = Max0R(Min0R(i_bcp, 9.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
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
|
bool DCV = false; //podwojny zawor zwrotny
|
||||||
double ASBP = 0.0; //cisnienie hamulca pp
|
double ASBP = 0.0; //cisnienie hamulca pp
|
||||||
|
|
||||||
int BrakeStatus = 0; //flaga stanu
|
int BrakeStatus{ b_off }; //flaga stanu
|
||||||
int SoundFlag = 0;
|
int SoundFlag = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -213,6 +213,8 @@ class TBrake {
|
|||||||
void SetASBP( double const Press ); //ustalenie cisnienia pp
|
void SetASBP( double const Press ); //ustalenie cisnienia pp
|
||||||
virtual void ForceEmptiness();
|
virtual void ForceEmptiness();
|
||||||
int GetSoundFlag();
|
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
|
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ąć
|
s = fStep * iSkip; // iSkip - ile odcinków z początku pominąć
|
||||||
i = iSkip; // domyślnie 0
|
i = iSkip; // domyślnie 0
|
||||||
t = fTsBuffer[i]; // tabela wattości t dla segmentów
|
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
|
fOffset = 0.1 / fLength; // pierwsze 10cm
|
||||||
pos1 = FastGetPoint(t); // wektor początku segmentu
|
pos1 = FastGetPoint(t); // wektor początku segmentu
|
||||||
dir = FastGetDirection(t, fOffset); // wektor kierunku
|
dir = FastGetDirection(t, fOffset); // wektor kierunku
|
||||||
|
|||||||
@@ -424,7 +424,6 @@ opengl_texture::load_TGA() {
|
|||||||
else if( tgaheader[ 2 ] == 10 ) {
|
else if( tgaheader[ 2 ] == 10 ) {
|
||||||
// compressed TGA
|
// compressed TGA
|
||||||
int currentpixel = 0;
|
int currentpixel = 0;
|
||||||
int currentbyte = 0;
|
|
||||||
|
|
||||||
unsigned char buffer[ 4 ] = { 255, 255, 255, 255 };
|
unsigned char buffer[ 4 ] = { 255, 255, 255, 255 };
|
||||||
const int pixelcount = data_width * data_height;
|
const int pixelcount = data_width * data_height;
|
||||||
|
|||||||
427
Train.cpp
427
Train.cpp
@@ -925,19 +925,17 @@ void TTrain::OnCommand_sandboxactivate( TTrain *Train, command_data const &Comma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Command.action != GLFW_RELEASE ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// press or hold
|
// press
|
||||||
Train->mvControlled->SandDose = true;
|
Train->mvControlled->Sandbox( true );
|
||||||
// audio feedback
|
// audio feedback
|
||||||
if( Train->ggSandButton.GetValue() < 0.05 ) {
|
|
||||||
Train->play_sound( Train->dsbSwitch );
|
Train->play_sound( Train->dsbSwitch );
|
||||||
}
|
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggSandButton.UpdateValue( 1.0 );
|
Train->ggSandButton.UpdateValue( 1.0 );
|
||||||
}
|
}
|
||||||
else {
|
else if( Command.action == GLFW_RELEASE) {
|
||||||
// release
|
// release
|
||||||
Train->mvControlled->SandDose = false;
|
Train->mvControlled->Sandbox( false );
|
||||||
/*
|
/*
|
||||||
// audio feedback
|
// audio feedback
|
||||||
if( Train->ggAntiSlipButton.GetValue() > 0.5 ) {
|
if( Train->ggAntiSlipButton.GetValue() > 0.5 ) {
|
||||||
@@ -1212,10 +1210,8 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
|||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// 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...
|
// turn on...
|
||||||
if( Train->mvOccupied->ActiveCab == 1 ) {
|
|
||||||
// przedni gdy w kabinie 1
|
|
||||||
Train->mvControlled->PantFrontSP = false;
|
Train->mvControlled->PantFrontSP = false;
|
||||||
if( Train->mvControlled->PantFront( true ) ) {
|
if( Train->mvControlled->PantFront( true ) ) {
|
||||||
if( Train->mvControlled->PantFrontStart != 1 ) {
|
if( Train->mvControlled->PantFrontStart != 1 ) {
|
||||||
@@ -1232,25 +1228,6 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// ...or turn off
|
// ...or turn off
|
||||||
if( ( Train->mvOccupied->PantSwitchType == "impulse" )
|
if( ( Train->mvOccupied->PantSwitchType == "impulse" )
|
||||||
@@ -1261,8 +1238,6 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Train->mvOccupied->ActiveCab == 1 ) {
|
|
||||||
// przedni gdy w kabinie 1
|
|
||||||
Train->mvControlled->PantFrontSP = false;
|
Train->mvControlled->PantFrontSP = false;
|
||||||
if( false == Train->mvControlled->PantFront( false ) ) {
|
if( false == Train->mvControlled->PantFront( false ) ) {
|
||||||
if( Train->mvControlled->PantFrontStart != 0 ) {
|
if( Train->mvControlled->PantFrontStart != 0 ) {
|
||||||
@@ -1275,21 +1250,6 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// impulse switches return automatically to neutral position
|
// impulse switches return automatically to neutral position
|
||||||
@@ -1315,10 +1275,8 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
|||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// 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...
|
// turn on...
|
||||||
if( Train->mvOccupied->ActiveCab == 1 ) {
|
|
||||||
// rear if in front cab
|
|
||||||
Train->mvControlled->PantRearSP = false;
|
Train->mvControlled->PantRearSP = false;
|
||||||
if( Train->mvControlled->PantRear( true ) ) {
|
if( Train->mvControlled->PantRear( true ) ) {
|
||||||
if( Train->mvControlled->PantRearStart != 1 ) {
|
if( Train->mvControlled->PantRearStart != 1 ) {
|
||||||
@@ -1335,25 +1293,6 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// ...or turn off
|
// ...or turn off
|
||||||
if( ( Train->mvOccupied->PantSwitchType == "impulse" )
|
if( ( Train->mvOccupied->PantSwitchType == "impulse" )
|
||||||
@@ -1364,8 +1303,6 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Train->mvOccupied->ActiveCab == 1 ) {
|
|
||||||
// rear if in front cab
|
|
||||||
Train->mvControlled->PantRearSP = false;
|
Train->mvControlled->PantRearSP = false;
|
||||||
if( false == Train->mvControlled->PantRear( false ) ) {
|
if( false == Train->mvControlled->PantRear( false ) ) {
|
||||||
if( Train->mvControlled->PantRearStart != 0 ) {
|
if( Train->mvControlled->PantRearStart != 0 ) {
|
||||||
@@ -1378,21 +1315,6 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// impulse switches return automatically to neutral position
|
// impulse switches return automatically to neutral position
|
||||||
@@ -1533,6 +1455,10 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
|
|||||||
// press or hold...
|
// press or hold...
|
||||||
if( Train->m_linebreakerstate == 0 ) {
|
if( Train->m_linebreakerstate == 0 ) {
|
||||||
// ...to close the circuit
|
// ...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 ) {
|
if( Train->ggMainOnButton.SubModel != nullptr ) {
|
||||||
// two separate switches to close and break the circuit
|
// two separate switches to close and break the circuit
|
||||||
// audio feedback
|
// audio feedback
|
||||||
@@ -1552,17 +1478,20 @@ void TTrain::OnCommand_linebreakertoggle( TTrain *Train, command_data const &Com
|
|||||||
Train->ggMainButton.UpdateValue( 1.0 );
|
Train->ggMainButton.UpdateValue( 1.0 );
|
||||||
}
|
}
|
||||||
// keep track of period the button is held down, to determine when/if circuit closes
|
// 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 ) )
|
if( ( false == ( ( Train->mvControlled->EngineType == ElectricSeriesMotor )
|
||||||
|| ( Train->fHVoltage > 0.0f ) ) {
|
|| ( Train->mvControlled->EngineType == ElectricInductionMotor ) ) )
|
||||||
|
|| ( Train->fHVoltage > 0.5 * Train->mvControlled->EnginePowerSource.MaxVoltage ) ) {
|
||||||
// prevent the switch from working if there's no power
|
// prevent the switch from working if there's no power
|
||||||
// TODO: consider whether it makes sense for diesel engines and such
|
// TODO: consider whether it makes sense for diesel engines and such
|
||||||
Train->fMainRelayTimer += 0.33f; // Command.time_delta * 5.0;
|
Train->fMainRelayTimer += 0.33f; // Command.time_delta * 5.0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if( Train->mvControlled->Mains != true ) {
|
if( Train->mvControlled->Mains != true ) {
|
||||||
// hunter-080812: poprawka
|
// hunter-080812: poprawka
|
||||||
Train->mvControlled->ConverterSwitch( false );
|
Train->mvControlled->ConverterSwitch( false );
|
||||||
Train->mvControlled->CompressorSwitch( false );
|
Train->mvControlled->CompressorSwitch( false );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if( Train->fMainRelayTimer > Train->mvControlled->InitialCtrlDelay ) {
|
if( Train->fMainRelayTimer > Train->mvControlled->InitialCtrlDelay ) {
|
||||||
// wlaczanie WSa z opoznieniem
|
// wlaczanie WSa z opoznieniem
|
||||||
Train->m_linebreakerstate = 2;
|
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
|
// finalize the state of the line breaker
|
||||||
Train->m_linebreakerstate = 1;
|
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 )
|
if( ( false == Train->mvControlled->ConverterAllow )
|
||||||
&& ( Train->ggConverterButton.GetValue() < 0.5 ) ) {
|
&& ( Train->ggConverterButton.GetValue() < 0.5 ) ) {
|
||||||
// turn on
|
// turn on
|
||||||
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
|
// sound feedback
|
||||||
if( Train->ggConverterButton.GetValue() < 0.5 ) {
|
if( Train->ggConverterButton.GetValue() < 0.5 ) {
|
||||||
Train->play_sound( Train->dsbSwitch );
|
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 ) ) {
|
||||||
|
*/
|
||||||
// impulse type switch has no effect if there's no power
|
// 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
|
// NOTE: this is most likely setup wrong, but the whole thing is smoke and mirrors anyway
|
||||||
if( ( Train->mvOccupied->ConvSwitchType != "impulse" )
|
if( ( Train->mvOccupied->ConvSwitchType != "impulse" )
|
||||||
@@ -1728,7 +1661,9 @@ void TTrain::OnCommand_convertertoggle( TTrain *Train, command_data const &Comma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//turn off
|
//turn off
|
||||||
@@ -2627,7 +2562,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
|
|||||||
if( Train->ggDoorLeftButton.GetValue() > 0.5 ) {
|
if( Train->ggDoorLeftButton.GetValue() > 0.5 ) {
|
||||||
Train->play_sound( Train->dsbSwitch );
|
Train->play_sound( Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
Train->play_sound( Train->dsbDoorOpen );
|
Train->play_sound( Train->dsbDoorClose );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2638,7 +2573,7 @@ void TTrain::OnCommand_doortoggleleft( TTrain *Train, command_data const &Comman
|
|||||||
if( Train->ggDoorRightButton.GetValue() > 0.5 ) {
|
if( Train->ggDoorRightButton.GetValue() > 0.5 ) {
|
||||||
Train->play_sound( Train->dsbSwitch );
|
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 ) {
|
if( Train->ggDoorRightButton.GetValue() > 0.5 ) {
|
||||||
Train->play_sound( Train->dsbSwitch );
|
Train->play_sound( Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
Train->play_sound( Train->dsbDoorOpen );
|
Train->play_sound( Train->dsbDoorClose );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2699,7 +2634,7 @@ void TTrain::OnCommand_doortoggleright( TTrain *Train, command_data const &Comma
|
|||||||
if( Train->ggDoorLeftButton.GetValue() > 0.5 ) {
|
if( Train->ggDoorLeftButton.GetValue() > 0.5 ) {
|
||||||
Train->play_sound( Train->dsbSwitch );
|
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 ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// turn off
|
// turn off
|
||||||
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
// 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
|
// audio feedback
|
||||||
if( ( Train->ggHornButton.GetValue() < -0.5 )
|
if( ( Train->ggHornButton.GetValue() < -0.5 )
|
||||||
|| ( Train->ggHornLowButton.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 ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// turn off
|
// turn off
|
||||||
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
// 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
|
// audio feedback
|
||||||
if( Train->ggHornButton.GetValue() > 0.5 ) {
|
if( Train->ggHornButton.GetValue() > 0.5 ) {
|
||||||
Train->play_sound( Train->dsbSwitch );
|
Train->play_sound( Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggHornButton.UpdateValue( 0.0 );
|
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])
|
else if (cKey == Global::Keys[k_CabForward])
|
||||||
{
|
{
|
||||||
if (!CabChange(1))
|
if( !CabChange( 1 ) ) {
|
||||||
if( TestFlag( DynamicObject->MoverParameters->Couplers[ 0 ].CouplingFlag,
|
if( TestFlag( DynamicObject->MoverParameters->Couplers[ 0 ].CouplingFlag,
|
||||||
ctrain_passenger))
|
ctrain_passenger ) ) { // przejscie do nastepnego pojazdu
|
||||||
{ // przejscie do nastepnego pojazdu
|
|
||||||
Global::changeDynObj = DynamicObject->PrevConnected;
|
Global::changeDynObj = DynamicObject->PrevConnected;
|
||||||
Global::changeDynObj->MoverParameters->ActiveCab =
|
Global::changeDynObj->MoverParameters->ActiveCab =
|
||||||
DynamicObject->PrevConnectedNo ? -1 : 1;
|
DynamicObject->PrevConnectedNo ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
NOTE: disabled to allow 'prototypical' 'tricking' pantograph compressor to run unattended
|
||||||
if (DynamicObject->MoverParameters->ActiveCab)
|
if (DynamicObject->MoverParameters->ActiveCab)
|
||||||
mvControlled->PantCompFlag = false; // wyjście z maszynowego wyłącza sprężarkę
|
mvControlled->PantCompFlag = false; // wyjście z maszynowego wyłącza sprężarkę
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else if (cKey == Global::Keys[k_CabBackward])
|
else if (cKey == Global::Keys[k_CabBackward])
|
||||||
{
|
{
|
||||||
@@ -3077,9 +3015,12 @@ void TTrain::OnKeyDown(int cKey)
|
|||||||
Global::changeDynObj->MoverParameters->ActiveCab =
|
Global::changeDynObj->MoverParameters->ActiveCab =
|
||||||
DynamicObject->NextConnectedNo ? -1 : 1;
|
DynamicObject->NextConnectedNo ? -1 : 1;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
NOTE: disabled to allow 'prototypical' 'tricking' pantograph compressor to run unattended
|
||||||
if (DynamicObject->MoverParameters->ActiveCab)
|
if (DynamicObject->MoverParameters->ActiveCab)
|
||||||
mvControlled->PantCompFlag =
|
mvControlled->PantCompFlag =
|
||||||
false; // wyjście z maszynowego wyłącza sprężarkę pomocniczą
|
false; // wyjście z maszynowego wyłącza sprężarkę pomocniczą
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else if (cKey == Global::Keys[k_Couple])
|
else if (cKey == Global::Keys[k_Couple])
|
||||||
{ // ABu051104: male zmiany, zeby mozna bylo laczyc odlegle wagony
|
{ // ABu051104: male zmiany, zeby mozna bylo laczyc odlegle wagony
|
||||||
@@ -3141,11 +3082,13 @@ if
|
|||||||
if (DynamicObject->Mechanik) // na wszelki wypadek
|
if (DynamicObject->Mechanik) // na wszelki wypadek
|
||||||
DynamicObject->Mechanik->CheckVehicles(Connect); // aktualizacja flag kierunku w składzie
|
DynamicObject->Mechanik->CheckVehicles(Connect); // aktualizacja flag kierunku w składzie
|
||||||
play_sound( dsbCouplerAttach );
|
play_sound( dsbCouplerAttach );
|
||||||
|
// one coupling type per key press
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WriteLog("Mechanical coupling failed.");
|
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
|
if ((tmp->MoverParameters->Couplers[CouplNr].Connected->Couplers[CouplNr].AllowedFlag
|
||||||
& tmp->MoverParameters->Couplers[CouplNr].AllowedFlag
|
& tmp->MoverParameters->Couplers[CouplNr].AllowedFlag
|
||||||
@@ -3155,12 +3098,16 @@ if
|
|||||||
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
||||||
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_pneumatic)))
|
(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 !!!!
|
DynamicObject->SetPneumatic(CouplNr != 0, true); // Ra: to mi się nie podoba !!!!
|
||||||
tmp->SetPneumatic(CouplNr != 0, true);
|
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
|
if ((tmp->MoverParameters->Couplers[CouplNr].Connected->Couplers[CouplNr].AllowedFlag
|
||||||
& tmp->MoverParameters->Couplers[CouplNr].AllowedFlag
|
& tmp->MoverParameters->Couplers[CouplNr].AllowedFlag
|
||||||
@@ -3170,17 +3117,18 @@ if
|
|||||||
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
||||||
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_scndpneumatic)))
|
(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 );
|
play_sound( dsbCouplerDetach );
|
||||||
|
// rsHiss.Play( 1, DSBPLAY_LOOPING, true, tmp->GetPosition() );
|
||||||
DynamicObject->SetPneumatic( CouplNr != 0, false ); // Ra: to mi się nie podoba !!!!
|
DynamicObject->SetPneumatic( CouplNr != 0, false ); // Ra: to mi się nie podoba !!!!
|
||||||
tmp->SetPneumatic(CouplNr != 0, false);
|
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]
|
if ((tmp->MoverParameters->Couplers[CouplNr].Connected->Couplers[CouplNr].AllowedFlag &
|
||||||
.Connected->Couplers[CouplNr]
|
|
||||||
.AllowedFlag &
|
|
||||||
tmp->MoverParameters->Couplers[CouplNr].AllowedFlag &
|
tmp->MoverParameters->Couplers[CouplNr].AllowedFlag &
|
||||||
ctrain_controll) == ctrain_controll)
|
ctrain_controll) == ctrain_controll)
|
||||||
if (tmp->MoverParameters->Attach(
|
if (tmp->MoverParameters->Attach(
|
||||||
@@ -3188,14 +3136,15 @@ if
|
|||||||
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
||||||
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_controll)))
|
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_controll)))
|
||||||
{
|
{
|
||||||
|
// TODO: dedicated 'click' sound for connecting cable-type connections
|
||||||
play_sound( dsbCouplerAttach );
|
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]
|
if ((tmp->MoverParameters->Couplers[CouplNr].Connected->Couplers[CouplNr].AllowedFlag &
|
||||||
.Connected->Couplers[CouplNr]
|
|
||||||
.AllowedFlag &
|
|
||||||
tmp->MoverParameters->Couplers[CouplNr].AllowedFlag &
|
tmp->MoverParameters->Couplers[CouplNr].AllowedFlag &
|
||||||
ctrain_passenger) == ctrain_passenger)
|
ctrain_passenger) == ctrain_passenger)
|
||||||
if (tmp->MoverParameters->Attach(
|
if (tmp->MoverParameters->Attach(
|
||||||
@@ -3203,10 +3152,29 @@ if
|
|||||||
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
tmp->MoverParameters->Couplers[CouplNr].Connected,
|
||||||
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_passenger)))
|
(tmp->MoverParameters->Couplers[CouplNr].CouplingFlag | ctrain_passenger)))
|
||||||
{
|
{
|
||||||
// rsHiss.Play(1,DSBPLAY_LOOPING,true,tmp->GetPosition());
|
play_sound( dsbCouplerAttach );
|
||||||
play_sound( dsbCouplerDetach );
|
/*
|
||||||
DynamicObject->SetPneumatic(CouplNr != 0, false);
|
DynamicObject->SetPneumatic(CouplNr != 0, false);
|
||||||
tmp->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;
|
DWORD stat;
|
||||||
double dt = Deltatime; // Timer::GetDeltaTime();
|
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)
|
if (DynamicObject->mdKabina)
|
||||||
{ // Ra: TODO: odczyty klawiatury/pulpitu nie
|
{ // Ra: TODO: odczyty klawiatury/pulpitu nie
|
||||||
// powinny być uzależnione od istnienia modelu
|
// powinny być uzależnione od istnienia modelu
|
||||||
@@ -3502,15 +3444,14 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
tor = DynamicObject->GetTrack(); // McZapkie-180203
|
tor = DynamicObject->GetTrack(); // McZapkie-180203
|
||||||
// McZapkie: predkosc wyswietlana na tachometrze brana jest z obrotow kol
|
// McZapkie: predkosc wyswietlana na tachometrze brana jest z obrotow kol
|
||||||
float maxtacho = 3;
|
float maxtacho = 3;
|
||||||
fTachoVelocity = Min0R(fabs(11.31 * mvControlled->WheelDiameter * mvControlled->nrot),
|
fTachoVelocity = static_cast<float>( std::min( std::abs(11.31 * mvControlled->WheelDiameter * mvControlled->nrot), mvControlled->Vmax * 1.05) );
|
||||||
mvControlled->Vmax * 1.05);
|
|
||||||
{ // skacze osobna zmienna
|
{ // skacze osobna zmienna
|
||||||
float ff = simulation::Time.data().wSecond; // skacze co sekunde - pol sekundy
|
float ff = simulation::Time.data().wSecond; // skacze co sekunde - pol sekundy
|
||||||
// pomiar, pol sekundy ustawienie
|
// pomiar, pol sekundy ustawienie
|
||||||
if (ff != fTachoTimer) // jesli w tej sekundzie nie zmienial
|
if (ff != fTachoTimer) // jesli w tej sekundzie nie zmienial
|
||||||
{
|
{
|
||||||
if (fTachoVelocity > 1) // jedzie
|
if (fTachoVelocity > 1) // jedzie
|
||||||
fTachoVelocityJump = fTachoVelocity + (2 - Random(3) + Random(3)) * 0.5;
|
fTachoVelocityJump = fTachoVelocity + (2.0 - Random(3) + Random(3)) * 0.5;
|
||||||
else
|
else
|
||||||
fTachoVelocityJump = 0; // stoi
|
fTachoVelocityJump = 0; // stoi
|
||||||
fTachoTimer = ff; // juz zmienil
|
fTachoTimer = ff; // juz zmienil
|
||||||
@@ -3725,12 +3666,15 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
// przy dowolnym ustawieniu kierunkowego
|
// przy dowolnym ustawieniu kierunkowego
|
||||||
// Ra: to już jest w T_MoverParameters::TractionForce(), ale zależy od
|
// Ra: to już jest w T_MoverParameters::TractionForce(), ale zależy od
|
||||||
// kierunku
|
// kierunku
|
||||||
if (mvControlled->EngineType == ElectricSeriesMotor)
|
if( ( mvControlled->Mains )
|
||||||
if (fabs(mvControlled->RunningTraction.TractionVoltage) <
|
&& ( mvControlled->EngineType == ElectricSeriesMotor ) ) {
|
||||||
0.5 *
|
if( std::max( mvControlled->GetTrainsetVoltage(), std::fabs( mvControlled->RunningTraction.TractionVoltage ) ) < 0.5 * mvControlled->EnginePowerSource.MaxVoltage ) {
|
||||||
mvControlled->EnginePowerSource
|
// TODO: check whether it should affect entire consist for EMU
|
||||||
.MaxVoltage) // minimalne napięcie pobierać z FIZ?
|
// TODO: check whether it should happen if there's power supplied alternatively through hvcouplers
|
||||||
mvControlled->MainSwitch(false);
|
// 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
|
// hunter-091012: swiatlo
|
||||||
if (bCabLight == true)
|
if (bCabLight == true)
|
||||||
@@ -3759,7 +3703,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
{
|
{
|
||||||
mvControlled->ConvOvldFlag = true;
|
mvControlled->ConvOvldFlag = true;
|
||||||
if (mvControlled->TrainType != dt_EZT)
|
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 ) {
|
else if( fConverterTimer >= fConverterPrzekaznik ) {
|
||||||
// changed switch from always true to take into account state of the compressor switch
|
// 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)
|
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),
|
// hunter-261211: jakis stary kod (i niezgodny z prawda),
|
||||||
// zahaszowalem i poprawilem
|
// zahaszowalem i poprawilem
|
||||||
@@ -4383,7 +4331,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
|
|
||||||
// if
|
// if
|
||||||
// ((TestFlag(mvControlled->BrakeStatus,+b_Rused+b_Ractive)))//Lampka drugiego stopnia hamowania
|
// ((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
|
//TODO: youBy wyciągnąć flagę wysokiego stopnia
|
||||||
|
|
||||||
// hunter-121211: lampka zanikowo-pradowego wentylatorow:
|
// hunter-121211: lampka zanikowo-pradowego wentylatorow:
|
||||||
@@ -4702,73 +4650,19 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggManualBrake.UpdateValue(double(mvOccupied->ManualBrakePos));
|
ggManualBrake.UpdateValue(double(mvOccupied->ManualBrakePos));
|
||||||
ggManualBrake.Update();
|
ggManualBrake.Update();
|
||||||
}
|
}
|
||||||
if (ggBrakeProfileCtrl.SubModel)
|
|
||||||
{
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
|
||||||
ggBrakeProfileCtrl.UpdateValue(
|
|
||||||
double(mvOccupied->BrakeDelayFlag == 4 ? 2 : mvOccupied->BrakeDelayFlag - 1));
|
|
||||||
#endif
|
|
||||||
ggBrakeProfileCtrl.Update();
|
ggBrakeProfileCtrl.Update();
|
||||||
}
|
|
||||||
if (ggBrakeProfileG.SubModel)
|
|
||||||
{
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
|
||||||
ggBrakeProfileG.UpdateValue( double( mvOccupied->BrakeDelayFlag == bdelay_G ? 1 : 0 ) );
|
|
||||||
#endif
|
|
||||||
ggBrakeProfileG.Update();
|
ggBrakeProfileG.Update();
|
||||||
}
|
|
||||||
if (ggBrakeProfileR.SubModel)
|
|
||||||
{
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
|
||||||
ggBrakeProfileR.UpdateValue( double( mvOccupied->BrakeDelayFlag == bdelay_R ? 1 : 0 ) );
|
|
||||||
#endif
|
|
||||||
ggBrakeProfileR.Update();
|
ggBrakeProfileR.Update();
|
||||||
}
|
|
||||||
|
|
||||||
if (ggMaxCurrentCtrl.SubModel)
|
|
||||||
{
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
|
||||||
ggMaxCurrentCtrl.UpdateValue( double( mvControlled->Imax == mvControlled->ImaxHi ) );
|
|
||||||
#endif
|
|
||||||
ggMaxCurrentCtrl.Update();
|
ggMaxCurrentCtrl.Update();
|
||||||
}
|
|
||||||
|
|
||||||
// NBMX wrzesien 2003 - drzwi
|
// NBMX wrzesien 2003 - drzwi
|
||||||
if (ggDoorLeftButton.SubModel)
|
|
||||||
{
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
|
||||||
ggDoorLeftButton.PutValue( mvOccupied->DoorLeftOpened ? 1 : 0 );
|
|
||||||
#endif
|
|
||||||
ggDoorLeftButton.Update();
|
ggDoorLeftButton.Update();
|
||||||
}
|
|
||||||
if (ggDoorRightButton.SubModel)
|
|
||||||
{
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
|
||||||
ggDoorRightButton.PutValue( mvOccupied->DoorRightOpened ? 1 : 0 );
|
|
||||||
#endif
|
|
||||||
ggDoorRightButton.Update();
|
ggDoorRightButton.Update();
|
||||||
}
|
|
||||||
if (ggDepartureSignalButton.SubModel)
|
|
||||||
{
|
|
||||||
// ggDepartureSignalButton.UpdateValue(double());
|
|
||||||
ggDepartureSignalButton.Update();
|
ggDepartureSignalButton.Update();
|
||||||
}
|
|
||||||
|
|
||||||
// NBMX dzwignia sprezarki
|
// NBMX dzwignia sprezarki
|
||||||
if (ggCompressorButton.SubModel) // hunter-261211: poprawka
|
|
||||||
ggCompressorButton.Update();
|
ggCompressorButton.Update();
|
||||||
if (ggMainButton.SubModel)
|
|
||||||
ggMainButton.Update();
|
ggMainButton.Update();
|
||||||
if (ggRadioButton.SubModel)
|
|
||||||
{
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
|
||||||
ggRadioButton.PutValue( mvOccupied->Radio ? 1 : 0 );
|
|
||||||
#endif
|
|
||||||
ggRadioButton.Update();
|
ggRadioButton.Update();
|
||||||
}
|
|
||||||
if (ggConverterButton.SubModel)
|
|
||||||
ggConverterButton.Update();
|
ggConverterButton.Update();
|
||||||
if (ggConverterOffButton.SubModel)
|
|
||||||
ggConverterOffButton.Update();
|
ggConverterOffButton.Update();
|
||||||
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
||||||
@@ -4918,64 +4812,18 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggLightsButton.PutValue(mvOccupied->LightsPos - 1);
|
ggLightsButton.PutValue(mvOccupied->LightsPos - 1);
|
||||||
ggLightsButton.Update();
|
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
|
// Winger 010304 - pantografy
|
||||||
// NOTE: shouldn't the pantograph updates check whether it's front or rear cabin?
|
// NOTE: shouldn't the pantograph updates check whether it's front or rear cabin?
|
||||||
if (ggPantFrontButton.SubModel ) {
|
|
||||||
ggPantFrontButton.Update();
|
ggPantFrontButton.Update();
|
||||||
}
|
|
||||||
if (ggPantRearButton.SubModel) {
|
|
||||||
ggPantRearButton.Update();
|
ggPantRearButton.Update();
|
||||||
}
|
|
||||||
if (ggPantFrontButtonOff.SubModel) {
|
|
||||||
ggPantFrontButtonOff.Update();
|
ggPantFrontButtonOff.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();
|
ggTrainHeatingButton.Update();
|
||||||
}
|
|
||||||
if (ggSignallingButton.SubModel != nullptr)
|
|
||||||
{
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
|
||||||
ggSignallingButton.PutValue( mvControlled->Signalling ? 1 : 0 );
|
|
||||||
#endif
|
|
||||||
ggSignallingButton.Update();
|
ggSignallingButton.Update();
|
||||||
}
|
|
||||||
if (ggDoorSignallingButton.SubModel != nullptr)
|
|
||||||
{
|
|
||||||
#ifdef EU07_USE_OLD_COMMAND_SYSTEM
|
|
||||||
ggDoorSignallingButton.PutValue( mvControlled->DoorSignalling ? 1 : 0 );
|
|
||||||
#endif
|
|
||||||
ggDoorSignallingButton.Update();
|
ggDoorSignallingButton.Update();
|
||||||
}
|
// Winger 020304 - ogrzewanie
|
||||||
// if (ggDistCounter.SubModel)
|
// hunter-080812: poprawka na ogrzewanie w elektrykach - usuniete uzaleznienie od przetwornicy
|
||||||
//{//Ra 2014-07: licznik kilometrów
|
|
||||||
// ggDistCounter.PutValue(mvControlled->DistCounter);
|
|
||||||
// ggDistCounter.Update();
|
|
||||||
//}
|
|
||||||
if ((((mvControlled->EngineType == ElectricSeriesMotor) && (mvControlled->Mains == true) &&
|
if ((((mvControlled->EngineType == ElectricSeriesMotor) && (mvControlled->Mains == true) &&
|
||||||
(mvControlled->ConvOvldFlag == false)) ||
|
(mvControlled->ConvOvldFlag == false)) ||
|
||||||
(mvControlled->ConverterFlag)) &&
|
(mvControlled->ConverterFlag)) &&
|
||||||
@@ -5373,6 +5221,8 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
false) // nie wyłączać, gdy AI
|
false) // nie wyłączać, gdy AI
|
||||||
mvControlled->PantCompFlag = false; // wyłączona, gdy nie trzymamy klawisza
|
mvControlled->PantCompFlag = false; // wyłączona, gdy nie trzymamy klawisza
|
||||||
#else
|
#else
|
||||||
|
/*
|
||||||
|
// NOTE: disabled to allow 'prototypical' 'tricking' pantograph compressor into running unattended
|
||||||
if( ( ( DynamicObject->Mechanik != nullptr )
|
if( ( ( DynamicObject->Mechanik != nullptr )
|
||||||
&& ( false == DynamicObject->Mechanik->AIControllFlag ) )
|
&& ( false == DynamicObject->Mechanik->AIControllFlag ) )
|
||||||
&& ( mvControlled->TrainType == dt_EZT ?
|
&& ( 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
|
// NOTE: this will break in multiplayer setups, do a proper tracking of pantograph user then
|
||||||
mvControlled->PantCompFlag = false;
|
mvControlled->PantCompFlag = false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
if (Console::Pressed(Global::Keys[k_Univ2]))
|
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;
|
m_updated = true;
|
||||||
return true; //(DynamicObject->Update(dt));
|
return true; //(DynamicObject->Update(dt));
|
||||||
} // koniec update
|
} // koniec update
|
||||||
@@ -6708,31 +6599,23 @@ void TTrain::set_cab_controls() {
|
|||||||
// pantographs
|
// pantographs
|
||||||
if( mvOccupied->PantSwitchType != "impulse" ) {
|
if( mvOccupied->PantSwitchType != "impulse" ) {
|
||||||
ggPantFrontButton.PutValue(
|
ggPantFrontButton.PutValue(
|
||||||
( mvOccupied->ActiveCab == 1 ?
|
( mvControlled->PantFrontUp ?
|
||||||
mvControlled->PantFrontUp :
|
|
||||||
mvControlled->PantRearUp ) ?
|
|
||||||
1.0 :
|
1.0 :
|
||||||
0.0 );
|
0.0 ) );
|
||||||
ggPantFrontButtonOff.PutValue(
|
ggPantFrontButtonOff.PutValue(
|
||||||
( mvOccupied->ActiveCab == 1 ?
|
( mvControlled->PantFrontUp ?
|
||||||
mvControlled->PantFrontUp :
|
|
||||||
mvControlled->PantRearUp ) ?
|
|
||||||
0.0 :
|
0.0 :
|
||||||
1.0 );
|
1.0 ) );
|
||||||
}
|
}
|
||||||
if( mvOccupied->PantSwitchType != "impulse" ) {
|
if( mvOccupied->PantSwitchType != "impulse" ) {
|
||||||
ggPantRearButton.PutValue(
|
ggPantRearButton.PutValue(
|
||||||
( mvOccupied->ActiveCab == 1 ?
|
( mvControlled->PantRearUp ?
|
||||||
mvControlled->PantRearUp :
|
|
||||||
mvControlled->PantFrontUp ) ?
|
|
||||||
1.0 :
|
1.0 :
|
||||||
0.0 );
|
0.0 ) );
|
||||||
ggPantRearButtonOff.PutValue(
|
ggPantRearButtonOff.PutValue(
|
||||||
( mvOccupied->ActiveCab == 1 ?
|
( mvControlled->PantRearUp ?
|
||||||
mvControlled->PantRearUp :
|
|
||||||
mvControlled->PantFrontUp ) ?
|
|
||||||
0.0 :
|
0.0 :
|
||||||
1.0 );
|
1.0 ) );
|
||||||
}
|
}
|
||||||
// converter
|
// converter
|
||||||
if( mvOccupied->ConvSwitchType != "impulse" ) {
|
if( mvOccupied->ConvSwitchType != "impulse" ) {
|
||||||
|
|||||||
84
World.cpp
84
World.cpp
@@ -714,6 +714,9 @@ void TWorld::OnKeyDown(int cKey)
|
|||||||
Train->OnKeyDown(cKey); // przekazanie klawisza do kabiny
|
Train->OnKeyDown(cKey); // przekazanie klawisza do kabiny
|
||||||
if (FreeFlyModeFlag) // aby nie odluźniało wagonu za lokomotywą
|
if (FreeFlyModeFlag) // aby nie odluźniało wagonu za lokomotywą
|
||||||
{ // operacje wykonywane na dowolnym pojeździe, przeniesione tu z kabiny
|
{ // 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
|
if (cKey == Global::Keys[k_Releaser]) // odluźniacz
|
||||||
{ // działa globalnie, sprawdzić zasięg
|
{ // działa globalnie, sprawdzić zasięg
|
||||||
TDynamicObject *temp = Global::DynamicNearest();
|
TDynamicObject *temp = Global::DynamicNearest();
|
||||||
@@ -721,7 +724,7 @@ void TWorld::OnKeyDown(int cKey)
|
|||||||
{
|
{
|
||||||
if (Global::ctrlState) // z ctrl odcinanie
|
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))
|
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
|
{ // zmiana próżny/ładowny; Ra: zabrane z kabiny
|
||||||
TDynamicObject *temp = Global::DynamicNearest();
|
TDynamicObject *temp = Global::DynamicNearest();
|
||||||
if (temp)
|
if (temp)
|
||||||
@@ -1802,9 +1807,9 @@ TWorld::Update_UI() {
|
|||||||
uitextline2 += ", BTP: " + to_string( tmp->MoverParameters->LoadFlag, 0 );
|
uitextline2 += ", BTP: " + to_string( tmp->MoverParameters->LoadFlag, 0 );
|
||||||
{
|
{
|
||||||
uitextline2 +=
|
uitextline2 +=
|
||||||
"; pant. "
|
"; pant: "
|
||||||
+ to_string( tmp->MoverParameters->PantPress, 2 )
|
+ to_string( tmp->MoverParameters->PantPress, 2 )
|
||||||
+ ( tmp->MoverParameters->bPantKurek3 ? "<ZG" : "|ZG" );
|
+ ( tmp->MoverParameters->bPantKurek3 ? "-ZG" : "|ZG" );
|
||||||
}
|
}
|
||||||
|
|
||||||
uitextline2 +=
|
uitextline2 +=
|
||||||
@@ -1820,28 +1825,63 @@ TWorld::Update_UI() {
|
|||||||
uitextline2 +=
|
uitextline2 +=
|
||||||
"; TC:"
|
"; TC:"
|
||||||
+ to_string( tmp->MoverParameters->TotalCurrent, 0 );
|
+ to_string( tmp->MoverParameters->TotalCurrent, 0 );
|
||||||
|
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||||
uitextline2 +=
|
uitextline2 +=
|
||||||
", HV0: "
|
", HV0: "
|
||||||
+ to_string( tmp->MoverParameters->HVCouplers[ 0 ][ 1 ], 0 )
|
+ 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 +=
|
uitextline2 +=
|
||||||
", HV1: "
|
", HV1: "
|
||||||
+ to_string( tmp->MoverParameters->HVCouplers[ 1 ][ 1 ], 0 )
|
+ 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 =
|
uitextline3 +=
|
||||||
"BP: " + to_string( tmp->MoverParameters->BrakePress, 2 )
|
" TrB: " + to_string( tmp->MoverParameters->BrakePress, 2 )
|
||||||
+ " (" + to_string( tmp->MoverParameters->BrakeStatus, 0 )
|
+ ", " + to_hex_str( tmp->MoverParameters->Hamulec->GetBrakeStatus(), 2 )
|
||||||
+ "), LBP: " + to_string( tmp->MoverParameters->LocBrakePress, 2 )
|
+ ", LcB: " + to_string( tmp->MoverParameters->LocBrakePress, 2 )
|
||||||
+ ", PP: " + to_string( tmp->MoverParameters->PipePress, 2 )
|
+ ", pipes: " + to_string( tmp->MoverParameters->PipePress, 2 )
|
||||||
+ "/" + to_string( tmp->MoverParameters->ScndPipePress, 2 )
|
+ "/" + to_string( tmp->MoverParameters->ScndPipePress, 2 )
|
||||||
+ "/" + to_string( tmp->MoverParameters->EqvtPipePress, 2 )
|
+ "/" + to_string( tmp->MoverParameters->EqvtPipePress, 2 )
|
||||||
+ ", BVP: " + to_string( tmp->MoverParameters->Volume, 3 )
|
+ ", MT: " + to_string( tmp->MoverParameters->CompressedVolume, 3 )
|
||||||
+ ", " + to_string( tmp->MoverParameters->CntrlPipePress, 3 )
|
+ ", BT: " + to_string( tmp->MoverParameters->Volume, 3 )
|
||||||
+ ", " + to_string( tmp->MoverParameters->Hamulec->GetCRP(), 3 )
|
+ ", CtlP: " + to_string( tmp->MoverParameters->CntrlPipePress, 3 )
|
||||||
+ ", " + to_string( tmp->MoverParameters->BrakeStatus, 0 );
|
+ ", CtlT: " + to_string( tmp->MoverParameters->Hamulec->GetCRP(), 3 );
|
||||||
|
|
||||||
if( tmp->MoverParameters->ManualBrakePos > 0 ) {
|
if( tmp->MoverParameters->ManualBrakePos > 0 ) {
|
||||||
|
|
||||||
@@ -1895,13 +1935,13 @@ TWorld::Update_UI() {
|
|||||||
break;
|
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 {
|
do {
|
||||||
std::string scanline = tmp->Mechanik->TableText( i );
|
std::string scanline = tmp->Mechanik->TableText( i );
|
||||||
if( scanline.empty() ) { break; }
|
if( scanline.empty() ) { break; }
|
||||||
UITable->text_lines.emplace_back( Global::Bezogonkow( scanline ), Global::UITextColor );
|
UITable->text_lines.emplace_back( Global::Bezogonkow( scanline ), Global::UITextColor );
|
||||||
++i;
|
++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 {
|
else {
|
||||||
@@ -1999,7 +2039,7 @@ TWorld::Update_UI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uitextline1 =
|
uitextline1 =
|
||||||
"vel: " + to_string(tmp->GetVelocity(), 2) + " km/h"
|
"vel: " + to_string( tmp->GetVelocity(), 2 ) + " km/h" + ( tmp->MoverParameters->SlippingWheels ? " (!)" : "" )
|
||||||
+ "; dist: " + to_string( tmp->MoverParameters->DistCounter, 2 ) + " km"
|
+ "; dist: " + to_string( tmp->MoverParameters->DistCounter, 2 ) + " km"
|
||||||
+ "; pos: ("
|
+ "; pos: ("
|
||||||
+ to_string( tmp->GetPosition().x, 2 ) + ", "
|
+ to_string( tmp->GetPosition().x, 2 ) + ", "
|
||||||
@@ -2533,7 +2573,7 @@ world_environment::update() {
|
|||||||
m_moon.update();
|
m_moon.update();
|
||||||
// ...determine source of key light and adjust global state accordingly...
|
// ...determine source of key light and adjust global state accordingly...
|
||||||
auto const sunlightlevel = m_sun.getIntensity();
|
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 keylightintensity;
|
||||||
float twilightfactor;
|
float twilightfactor;
|
||||||
float3 keylightcolor;
|
float3 keylightcolor;
|
||||||
@@ -2555,8 +2595,6 @@ world_environment::update() {
|
|||||||
keylightintensity = sunlightlevel;
|
keylightintensity = sunlightlevel;
|
||||||
// diffuse (sun) intensity goes down after twilight, and reaches minimum 18 degrees below horizon
|
// diffuse (sun) intensity goes down after twilight, and reaches minimum 18 degrees below horizon
|
||||||
twilightfactor = clamp( -Global::SunAngle, 0.0f, 18.0f ) / 18.0f;
|
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;
|
float const duskfactor = 1.0f - clamp( Global::SunAngle, 0.0f, 18.0f ) / 18.0f;
|
||||||
keylightcolor = interpolate(
|
keylightcolor = interpolate(
|
||||||
float3( 255.0f / 255.0f, 242.0f / 255.0f, 231.0f / 255.0f ),
|
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_leftstick;
|
||||||
glm::vec2 m_rightstick;
|
glm::vec2 m_rightstick;
|
||||||
glm::vec2 m_triggers;
|
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;
|
int targetsegments;
|
||||||
float targetfactor;
|
float targetfactor;
|
||||||
|
|
||||||
if( framerate > 65.0 ) { targetsegments = 400; targetfactor = 3.0f; }
|
if( framerate > 90.0 ) { targetsegments = 400; targetfactor = 3.0f; }
|
||||||
else if( framerate > 40.0 ) { targetsegments = 225; targetfactor = 1.5f; }
|
else if( framerate > 60.0 ) { targetsegments = 225; targetfactor = 1.5f; }
|
||||||
else if( framerate > 15.0 ) { targetsegments = 90; targetfactor = Global::ScreenHeight / 768.0f; }
|
else if( framerate > 30.0 ) { targetsegments = 90; targetfactor = Global::ScreenHeight / 768.0f; }
|
||||||
else { targetsegments = 9; targetfactor = Global::ScreenHeight / 768.0f * 0.75f; }
|
else { targetsegments = 9; targetfactor = Global::ScreenHeight / 768.0f * 0.75f; }
|
||||||
|
|
||||||
if( targetsegments > Global::iSegmentsRendered ) {
|
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 degrad = 57.295779513; // converts from radians to degrees
|
||||||
static double raddeg = 0.0174532925; // converts from degrees to radians
|
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;
|
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 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
|
double cd = cos( raddeg * m_body.dayang ); // cosine of the day angle or delination
|
||||||
|
|||||||
Reference in New Issue
Block a user