mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 23:19:19 +02:00
1. Poprawione asynchrony.
2. Możliwość zdefiniowania koloru tła ekranu ładowania w eu07.ini. 3. Dodanie logowania ruchu ramek WM_COPYDATA do oddzielnego pliku. 4. Dodana ramka skrócona aktywnych AI. 5. Dodana ramka sterowania uszkodzeniami pojazdów. 6. Dodanie kręciołka od świateł (w tym trakcja wielokrotna). 7. Rozbudowa asynchronów, m.in. tempomat, zadawanie siły (w kN), przeciwpoślizg, czyste ED itd. 8. Dodanie animacji drtzwi odskokowo-przesuwnych. 9. Dodanie możliwości uszkadzania pojazdów (EN57). 10. Uruchomienie sprzęgu WN, zwłaszcza w asynchronach - do przejrzenia logowanie braków napięcia. 11. Wyłączanie radiostopu przez wyłączanie radia, a nie przez ruch zaworem maszynisty. 12. Usunięcie wyłącznika ciśnieniowego w EN57 (proteza, trzeba zrobić wpis na to). 13. Wstępna wersja hamowania rekuperacyjnego wraz z przechodzeniem na hamowanie oporowe. 14. Cała masa nowych zmiennych stanu dostępna dla ekranu (Pythona). 15. Nowa stara smuga z dawnego SPKSu. 16. Inne, które mogłem zapomnieć lub nie uszczegółowić. 17. Poprawione wyświetlanie haslera
This commit is contained in:
28
Driver.cpp
28
Driver.cpp
@@ -2386,7 +2386,11 @@ bool TController::IncBrake()
|
||||
mvOccupied->BrakeReleaser(0);
|
||||
break;
|
||||
case ElectroPneumatic:
|
||||
if (mvOccupied->fBrakeCtrlPos != mvOccupied->Handle->GetPos(bh_EPB))
|
||||
if (mvOccupied->EngineType == ElectricInductionMotor)
|
||||
{
|
||||
OK = mvOccupied->IncLocalBrakeLevel(1);
|
||||
}
|
||||
else if (mvOccupied->fBrakeCtrlPos != mvOccupied->Handle->GetPos(bh_EPB))
|
||||
{
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_EPB));
|
||||
if (mvOccupied->Handle->GetPos(bh_EPR) - mvOccupied->Handle->GetPos(bh_EPN) < 0.1)
|
||||
@@ -2423,7 +2427,11 @@ bool TController::DecBrake()
|
||||
Need_BrakeRelease = true;
|
||||
break;
|
||||
case ElectroPneumatic:
|
||||
if (mvOccupied->fBrakeCtrlPos != mvOccupied->Handle->GetPos(bh_EPR))
|
||||
if (mvOccupied->EngineType == ElectricInductionMotor)
|
||||
{
|
||||
OK = mvOccupied->DecLocalBrakeLevel(1);
|
||||
}
|
||||
else if (mvOccupied->fBrakeCtrlPos != mvOccupied->Handle->GetPos(bh_EPR))
|
||||
{
|
||||
mvOccupied->BrakeLevelSet(mvOccupied->Handle->GetPos(bh_EPR));
|
||||
if (mvOccupied->Handle->GetPos(bh_EPR) - mvOccupied->Handle->GetPos(bh_EPN) < 0.1)
|
||||
@@ -2527,7 +2535,15 @@ bool TController::IncSpeed()
|
||||
OK = mvControlling->IncScndCtrl(1);
|
||||
}
|
||||
break;
|
||||
case WheelsDriven:
|
||||
case ElectricInductionMotor:
|
||||
if (!mvControlling->FuseFlag)
|
||||
if (Ready || (iDrivigFlags & movePress) || (mvOccupied->ShuntMode)) //{(BrakePress<=0.01*MaxBrakePress)}
|
||||
{
|
||||
OK = mvControlling->IncMainCtrl(1);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case WheelsDriven:
|
||||
if (!mvControlling->CabNo)
|
||||
mvControlling->CabActivisation();
|
||||
if (sin(mvControlling->eAngle) > 0)
|
||||
@@ -2577,7 +2593,8 @@ bool TController::DecSpeed(bool force)
|
||||
break;
|
||||
case Dumb:
|
||||
case DieselElectric:
|
||||
OK = mvControlling->DecScndCtrl(2);
|
||||
case ElectricInductionMotor:
|
||||
OK = mvControlling->DecScndCtrl(2);
|
||||
if (!OK)
|
||||
OK = mvControlling->DecMainCtrl(2 + (mvControlling->MainCtrlPos / 2));
|
||||
break;
|
||||
@@ -2740,7 +2757,8 @@ void TController::SpeedSet()
|
||||
break;
|
||||
case Dumb:
|
||||
case DieselElectric:
|
||||
break;
|
||||
case ElectricInductionMotor:
|
||||
break;
|
||||
// WheelsDriven :
|
||||
// begin
|
||||
// OK:=False;
|
||||
|
||||
4
Driver.h
4
Driver.h
@@ -207,6 +207,10 @@ class TController
|
||||
TAction eAction; // aktualny stan
|
||||
bool HelpMeFlag; // wystawiane True jesli cos niedobrego sie dzieje
|
||||
public:
|
||||
inline TAction GetAction()
|
||||
{
|
||||
return eAction;
|
||||
}
|
||||
bool AIControllFlag; // rzeczywisty/wirtualny maszynista
|
||||
int iRouteWanted; // oczekiwany kierunek jazdy (0-stop,1-lewo,2-prawo,3-prosto) np. odpala
|
||||
// migacz lub czeka na stan zwrotnicy
|
||||
|
||||
344
DynObj.cpp
344
DynObj.cpp
@@ -139,7 +139,7 @@ void TAnim::Parovoz(){
|
||||
// animowanie tłoka i rozrządu parowozu
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
TDynamicObject *__fastcall TDynamicObject::FirstFind(int &coupler_nr)
|
||||
TDynamicObject * TDynamicObject::FirstFind(int &coupler_nr)
|
||||
{ // szukanie skrajnego połączonego pojazdu w pociagu
|
||||
// od strony sprzegu (coupler_nr) obiektu (start)
|
||||
TDynamicObject *temp = this;
|
||||
@@ -255,7 +255,7 @@ float TDynamicObject::GetEPP()
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
TDynamicObject *__fastcall TDynamicObject::GetFirstDynamic(int cpl_type)
|
||||
TDynamicObject * TDynamicObject::GetFirstDynamic(int cpl_type)
|
||||
{ // Szukanie skrajnego połączonego pojazdu w pociagu
|
||||
// od strony sprzegu (cpl_type) obiektu szukajacego
|
||||
// Ra: wystarczy jedna funkcja do szukania w obu kierunkach
|
||||
@@ -413,10 +413,10 @@ void TDynamicObject::UpdateDoorTranslate(TAnim *pAnim)
|
||||
{
|
||||
if (pAnim->iNumber & 1)
|
||||
pAnim->smAnimated->SetTranslate(
|
||||
vector3(0, 0, Max0R(dDoorMoveR * pAnim->fSpeed, dDoorMoveR)));
|
||||
vector3(0, 0, Min0R(dDoorMoveR * pAnim->fSpeed, dDoorMoveR)));
|
||||
else
|
||||
pAnim->smAnimated->SetTranslate(
|
||||
vector3(0, 0, Max0R(dDoorMoveL * pAnim->fSpeed, dDoorMoveL)));
|
||||
vector3(0, 0, Min0R(dDoorMoveL * pAnim->fSpeed, dDoorMoveL)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -485,6 +485,23 @@ void TDynamicObject::UpdatePant(TAnim *pAnim)
|
||||
pAnim->smElement[4]->SetRotate(float3(-1, 0, 0), b); //ślizg
|
||||
};
|
||||
|
||||
void TDynamicObject::UpdateDoorPlug(TAnim *pAnim)
|
||||
{ // animacja drzwi - odskokprzesuw
|
||||
if (pAnim->smAnimated)
|
||||
{
|
||||
if (pAnim->iNumber & 1)
|
||||
pAnim->smAnimated->SetTranslate(
|
||||
vector3(Min0R(dDoorMoveR * 2, MoverParameters->DoorMaxPlugShift), 0,
|
||||
Max0R(0, Min0R(dDoorMoveR * pAnim->fSpeed, dDoorMoveR) -
|
||||
MoverParameters->DoorMaxPlugShift * 0.5f)));
|
||||
else
|
||||
pAnim->smAnimated->SetTranslate(
|
||||
vector3(Min0R(dDoorMoveL * 2, MoverParameters->DoorMaxPlugShift), 0,
|
||||
Max0R(0, Min0R(dDoorMoveL * pAnim->fSpeed, dDoorMoveL) -
|
||||
MoverParameters->DoorMaxPlugShift * 0.5f)));
|
||||
}
|
||||
};
|
||||
|
||||
void TDynamicObject::UpdateLeverDouble(TAnim *pAnim)
|
||||
{ // animacja gałki zależna od double
|
||||
pAnim->smAnimated->SetRotate(float3(1, 0, 0), pAnim->fSpeed * *pAnim->fDoubleBase);
|
||||
@@ -919,7 +936,7 @@ double ABuAcos(const vector3 &calc_temp)
|
||||
return atan2(-calc_temp.x, calc_temp.z); // Ra: tak prościej
|
||||
}
|
||||
|
||||
TDynamicObject *__fastcall TDynamicObject::ABuFindNearestObject(TTrack *Track,
|
||||
TDynamicObject * TDynamicObject::ABuFindNearestObject(TTrack *Track,
|
||||
TDynamicObject *MyPointer,
|
||||
int &CouplNr)
|
||||
{ // zwraca wskaznik do obiektu znajdujacego sie na torze
|
||||
@@ -983,7 +1000,7 @@ TDynamicObject *__fastcall TDynamicObject::ABuFindNearestObject(TTrack *Track,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TDynamicObject *__fastcall TDynamicObject::ABuScanNearestObject(TTrack *Track, double ScanDir,
|
||||
TDynamicObject * TDynamicObject::ABuScanNearestObject(TTrack *Track, double ScanDir,
|
||||
double ScanDist, int &CouplNr)
|
||||
{ // skanowanie toru w poszukiwaniu obiektu najblizszego
|
||||
// kamerze
|
||||
@@ -1086,7 +1103,7 @@ void TDynamicObject::ABuCheckMyTrack()
|
||||
}
|
||||
|
||||
// Ra: w poniższej funkcji jest problem ze sprzęgami
|
||||
TDynamicObject *__fastcall TDynamicObject::ABuFindObject(TTrack *Track, int ScanDir,
|
||||
TDynamicObject * TDynamicObject::ABuFindObject(TTrack *Track, int ScanDir,
|
||||
Byte &CouplFound, double &dist)
|
||||
{ // Zwraca wskaźnik najbliższego obiektu znajdującego się
|
||||
// na torze w określonym kierunku, ale tylko wtedy, kiedy
|
||||
@@ -2625,18 +2642,22 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
// asynchronami, to
|
||||
// niech steruje
|
||||
{ // hamulcem lacznie dla calego pociagu/ezt
|
||||
float FED = 0;
|
||||
bool kier = (DirectionGet() * MoverParameters->ActiveCab > 0);
|
||||
float FED = 0;
|
||||
float np = 0;
|
||||
float masa = 0;
|
||||
float FrED = 0;
|
||||
float masamax = 0;
|
||||
float FmaxPN = 0;
|
||||
float FmaxED = 0;
|
||||
float FfulED = 0;
|
||||
float FmaxED = 0;
|
||||
float Fzad = 0;
|
||||
float FzadED = 0;
|
||||
float FzadPN = 0;
|
||||
float amax = 0;
|
||||
// 1. ustal wymagana sile hamowania calego pociagu
|
||||
float Frj = 0;
|
||||
float amax = 0;
|
||||
float osie = 0;
|
||||
// 1. ustal wymagana sile hamowania calego pociagu
|
||||
// - opoznienie moze byc ustalane na podstawie charakterystyki
|
||||
// - opoznienie moze byc ustalane na podstawie mas i cisnien granicznych
|
||||
//
|
||||
@@ -2644,7 +2665,7 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
// 2. ustal mozliwa do realizacji sile hamowania ED
|
||||
// - w szczegolnosci powinien brac pod uwage rozne sily hamowania
|
||||
for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0); p;
|
||||
p = p->NextC(4))
|
||||
(kier ? p = p->NextC(4) : p = p->PrevC(4)))
|
||||
{
|
||||
np++;
|
||||
masamax += p->MoverParameters->MBPM +
|
||||
@@ -2655,28 +2676,64 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
p->MoverParameters->BrakeCylMult[0] -
|
||||
p->MoverParameters->BrakeSlckAdj) *
|
||||
p->MoverParameters->BrakeCylNo * p->MoverParameters->BrakeRigEff;
|
||||
FmaxPN += Nmax *
|
||||
p->MoverParameters->Hamulec->GetFC(
|
||||
FmaxPN += Nmax * p->MoverParameters->Hamulec->GetFC(
|
||||
Nmax / (p->MoverParameters->NAxles * p->MoverParameters->NBpA),
|
||||
p->MoverParameters->Vmax) *
|
||||
1000; // sila hamowania pn
|
||||
FmaxED += ((p->MoverParameters->Mains) && (p->MoverParameters->eimc[eimc_p_Fh] *
|
||||
p->MoverParameters->NPoweredAxles >
|
||||
FmaxED += ((p->MoverParameters->Mains) && (p->MoverParameters->ActiveDir != 0) &&
|
||||
(p->MoverParameters->eimc[eimc_p_Fh] * p->MoverParameters->NPoweredAxles >
|
||||
0) ?
|
||||
p->MoverParameters->eimc[eimc_p_Fh] * 1000 :
|
||||
0); // chwilowy max ED -> do rozdzialu sil
|
||||
FED -= Min0R(p->MoverParameters->eimv[eimv_Fmax], 0) *
|
||||
1000; // chwilowy max ED -> do rozdzialu sil
|
||||
FrED -= Min0R(p->MoverParameters->eimv[eimv_Fr], 0) *
|
||||
FfulED = Min0R(p->MoverParameters->eimv[eimv_Fful], 0) *
|
||||
1000; // chwilowy max ED -> do rozdzialu sil
|
||||
FrED -= Min0R(p->MoverParameters->eimv[eimv_Fr], 0) *
|
||||
1000; // chwilowo realizowane ED -> do pneumatyki
|
||||
masa += p->MoverParameters->TotalMass;
|
||||
}
|
||||
Frj += Max0R(p->MoverParameters->eimv[eimv_Fr], 0) *
|
||||
1000;// chwilowo realizowany napęd -> do utrzymującego
|
||||
masa += p->MoverParameters->TotalMass;
|
||||
osie += p->MoverParameters->NAxles;
|
||||
}
|
||||
amax = FmaxPN / masamax;
|
||||
if ((MoverParameters->Vel < 0.5) && (MoverParameters->BrakePress > 0.2) ||
|
||||
(dDoorMoveL > 0.001) || (dDoorMoveR > 0.001))
|
||||
{
|
||||
MoverParameters->ShuntMode = true;
|
||||
}
|
||||
if (MoverParameters->ShuntMode)
|
||||
{
|
||||
MoverParameters->ShuntModeAllow = (dDoorMoveL < 0.001) && (dDoorMoveR < 0.001) &&
|
||||
(MoverParameters->LocalBrakeRatio() < 0.01);
|
||||
}
|
||||
if ((MoverParameters->Vel > 1) && (dDoorMoveL < 0.001) && (dDoorMoveR < 0.001))
|
||||
{
|
||||
MoverParameters->ShuntMode = false;
|
||||
MoverParameters->ShuntModeAllow = (MoverParameters->BrakePress > 0.2) &&
|
||||
(MoverParameters->LocalBrakeRatio() < 0.01);
|
||||
}
|
||||
Fzad = amax * MoverParameters->LocalBrakeRatio() * masa;
|
||||
if ((MoverParameters->ScndS) &&
|
||||
(MoverParameters->Vel > MoverParameters->eimc[eimc_p_Vh1]) && (FmaxED > 0))
|
||||
{
|
||||
Fzad = Min0R(MoverParameters->LocalBrakeRatio() * FmaxED, FfulED);
|
||||
}
|
||||
if (((MoverParameters->ShuntMode) && (Frj < 0.0015 * masa)) ||
|
||||
(MoverParameters->V * MoverParameters->DirAbsolute < -0.2))
|
||||
{
|
||||
Fzad = Max0R(0.5 * masa, Fzad);
|
||||
}
|
||||
FzadED = Min0R(Fzad, FmaxED);
|
||||
FzadPN = Fzad - FrED;
|
||||
np = 0;
|
||||
// 3. ustaw pojazdom sile hamowania ED
|
||||
bool* PrzekrF = new bool[np];
|
||||
float nPrzekrF = 0;
|
||||
bool test = true;
|
||||
float* FzED = new float[np];
|
||||
float* FzEP = new float[np];
|
||||
float* FmaxEP = new float[np];
|
||||
// 3. ustaw pojazdom sile hamowania ED
|
||||
// - proporcjonalnie do mozliwosci
|
||||
|
||||
// 4. ustal potrzebne dohamowanie pneumatyczne
|
||||
@@ -2685,30 +2742,142 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
// - gdy zahamowany ma ponizej 2 km/h
|
||||
// 6. ustaw pojazdom sile hamowania ep
|
||||
// - proporcjonalnie do masy, do liczby osi, rowne cisnienia - jak
|
||||
// bedzie, tak bedzie
|
||||
// dobrze
|
||||
float Fpoj = 0;
|
||||
for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0); p;
|
||||
p = p->NextC(4))
|
||||
{
|
||||
// bedzie, tak bedzie dobrze
|
||||
float Fpoj = 0; // MoverParameters->ActiveCab < 0
|
||||
////ALGORYTM 2 - KAZDEMU PO ROWNO, ale nie wiecej niz eped * masa
|
||||
// 1. najpierw daj kazdemu tyle samo
|
||||
int i = 0;
|
||||
for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0); p;
|
||||
(kier > 0 ? p = p->NextC(4) : p = p->PrevC(4)))
|
||||
{
|
||||
np++;
|
||||
float Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] -
|
||||
p->MoverParameters->BrakeCylSpring) *
|
||||
p->MoverParameters->BrakeCylMult[0] -
|
||||
p->MoverParameters->BrakeSlckAdj) *
|
||||
p->MoverParameters->BrakeCylNo * p->MoverParameters->BrakeRigEff;
|
||||
float FmaxPoj = Nmax *
|
||||
p->MoverParameters->Hamulec->GetFC(
|
||||
Nmax / (p->MoverParameters->NAxles * p->MoverParameters->NBpA),
|
||||
p->MoverParameters->Vel) *
|
||||
1000; // sila hamowania pn
|
||||
// Fpoj=(FED>0?-FzadED*p->MoverParameters->eimv[eimv_Fmax]*1000/FED:0);
|
||||
// p->MoverParameters->AnPos=(p->MoverParameters->eimc[eimc_p_Fh]>1?0.001f*Fpoj/(p->MoverParameters->eimc[eimc_p_Fh]):0);
|
||||
p->MoverParameters->AnPos = (FmaxED > 0 ? FzadED / FmaxED : 0);
|
||||
Fpoj = FzadPN * Min0R(p->MoverParameters->TotalMass / masa, 1);
|
||||
p->MoverParameters->LocalBrakePosA =
|
||||
(p->MoverParameters->SlippingWheels ? 0 : Min0R(Max0R(Fpoj / FmaxPoj, 0), 1));
|
||||
FmaxEP[i] = Nmax *
|
||||
p->MoverParameters->Hamulec->GetFC(
|
||||
Nmax / (p->MoverParameters->NAxles * p->MoverParameters->NBpA),
|
||||
p->MoverParameters->Vmax) *
|
||||
1000; // sila hamowania pn
|
||||
|
||||
PrzekrF[i] = false;
|
||||
FzED[i] = (FmaxED > 0 ? FzadED / FmaxED : 0);
|
||||
p->MoverParameters->AnPos =
|
||||
(MoverParameters->ScndS ? MoverParameters->LocalBrakeRatio() : FzED[i]);
|
||||
FzEP[i] = FzadPN * p->MoverParameters->NAxles / osie;
|
||||
i++;
|
||||
p->MoverParameters->ShuntMode = MoverParameters->ShuntMode;
|
||||
p->MoverParameters->ShuntModeAllow = MoverParameters->ShuntModeAllow;
|
||||
}
|
||||
while (test)
|
||||
{
|
||||
test = false;
|
||||
i = 0;
|
||||
float przek = 0;
|
||||
for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0); p;
|
||||
(kier > 0 ? p = p->NextC(4) : p = p->PrevC(4)))
|
||||
{
|
||||
if ((FzEP[i] > 0.01) &&
|
||||
(FzEP[i] >
|
||||
p->MoverParameters->TotalMass * p->MoverParameters->eimc[eimc_p_eped] +
|
||||
Min0R(p->MoverParameters->eimv[eimv_Fr], 0) * 1000) &&
|
||||
(!PrzekrF[i]))
|
||||
{
|
||||
float przek1 = -Min0R(p->MoverParameters->eimv[eimv_Fr], 0) * 1000 +
|
||||
FzEP[i] -
|
||||
p->MoverParameters->TotalMass *
|
||||
p->MoverParameters->eimc[eimc_p_eped] * 0.999;
|
||||
PrzekrF[i] = true;
|
||||
test = true;
|
||||
nPrzekrF++;
|
||||
przek1 = Min0R(przek1, FzEP[i]);
|
||||
FzEP[i] -= przek1;
|
||||
if (FzEP[i] < 0)
|
||||
FzEP[i] = 0;
|
||||
przek += przek1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
przek = przek / (np - nPrzekrF);
|
||||
for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0); p;
|
||||
(kier > 0 ? p = p->NextC(4) : p = p->PrevC(4)))
|
||||
{
|
||||
if (!PrzekrF[i])
|
||||
{
|
||||
FzEP[i] += przek;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0); p;
|
||||
(kier > 0 ? p = p->NextC(4) : p = p->PrevC(4)))
|
||||
{
|
||||
float Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] -
|
||||
p->MoverParameters->BrakeCylSpring) *
|
||||
p->MoverParameters->BrakeCylMult[0] -
|
||||
p->MoverParameters->BrakeSlckAdj) *
|
||||
p->MoverParameters->BrakeCylNo * p->MoverParameters->BrakeRigEff;
|
||||
float FmaxPoj = Nmax *
|
||||
p->MoverParameters->Hamulec->GetFC(
|
||||
Nmax / (p->MoverParameters->NAxles * p->MoverParameters->NBpA),
|
||||
p->MoverParameters->Vel) *
|
||||
1000; // sila hamowania pn
|
||||
p->MoverParameters->LocalBrakePosA = (p->MoverParameters->SlippingWheels ? 0 : FzEP[i] / FmaxPoj);
|
||||
if (p->MoverParameters->LocalBrakePosA>0.009)
|
||||
if (p->MoverParameters->P2FTrans * p->MoverParameters->BrakeCylMult[0] *
|
||||
p->MoverParameters->MaxBrakePress[0] != 0)
|
||||
{
|
||||
float x = (p->MoverParameters->BrakeSlckAdj / p->MoverParameters->BrakeCylMult[0] +
|
||||
p->MoverParameters->BrakeCylSpring) / (p->MoverParameters->P2FTrans *
|
||||
p->MoverParameters->MaxBrakePress[0]);
|
||||
p->MoverParameters->LocalBrakePosA = x + (1 - x) * p->MoverParameters->LocalBrakePosA;
|
||||
}
|
||||
else
|
||||
p->MoverParameters->LocalBrakePosA = p->MoverParameters->LocalBrakePosA;
|
||||
else
|
||||
p->MoverParameters->LocalBrakePosA = 0;
|
||||
i++;
|
||||
}
|
||||
/* ////ALGORYTM 1 - KAZDEMU PO ROWNO
|
||||
for (TDynamicObject *p = GetFirstDynamic(MoverParameters->ActiveCab < 0 ? 1 : 0); p;
|
||||
(iDirection > 0 ? p = p->NextC(4) : p = p->PrevC(4)))
|
||||
{
|
||||
|
||||
float Nmax = ((p->MoverParameters->P2FTrans * p->MoverParameters->MaxBrakePress[0] -
|
||||
p->MoverParameters->BrakeCylSpring) *
|
||||
p->MoverParameters->BrakeCylMult[0] -
|
||||
p->MoverParameters->BrakeSlckAdj) *
|
||||
p->MoverParameters->BrakeCylNo * p->MoverParameters->BrakeRigEff;
|
||||
float FmaxPoj = Nmax *
|
||||
p->MoverParameters->Hamulec->GetFC(
|
||||
Nmax / (p->MoverParameters->NAxles * p->MoverParameters->NBpA),
|
||||
p->MoverParameters->Vel) *
|
||||
1000; // sila hamowania pn
|
||||
// Fpoj=(FED>0?-FzadED*p->MoverParameters->eimv[eimv_Fmax]*1000/FED:0);
|
||||
// p->MoverParameters->AnPos=(p->MoverParameters->eimc[eimc_p_Fh]>1?0.001f*Fpoj/(p->MoverParameters->eimc[eimc_p_Fh]):0);
|
||||
p->MoverParameters->AnPos = (FmaxED > 0 ? FzadED / FmaxED : 0);
|
||||
// Fpoj = FzadPN * Min0R(p->MoverParameters->TotalMass / masa, 1);
|
||||
// p->MoverParameters->LocalBrakePosA =
|
||||
// (p->MoverParameters->SlippingWheels ? 0 : Min0R(Max0R(Fpoj / FmaxPoj, 0), 1));
|
||||
p->MoverParameters->LocalBrakePosA = (p->MoverParameters->SlippingWheels ? 0 : FzadPN / FmaxPN);
|
||||
} */
|
||||
|
||||
MED[0][0] = masa*0.001;
|
||||
MED[0][1] = amax;
|
||||
MED[0][2] = Fzad*0.001;
|
||||
MED[0][3] = FmaxPN*0.001;
|
||||
MED[0][4] = FmaxED*0.001;
|
||||
MED[0][5] = FrED*0.001;
|
||||
MED[0][6] = FzadPN*0.001;
|
||||
MED[0][7] = nPrzekrF;
|
||||
|
||||
delete[] PrzekrF;
|
||||
delete[] FzED;
|
||||
delete[] FzEP;
|
||||
}
|
||||
|
||||
// yB: cos (AI) tu jest nie kompatybilne z czyms (hamulce)
|
||||
@@ -2923,7 +3092,7 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
TAnimPant *p; // wskaźnik do obiektu danych pantografu
|
||||
double fCurrent = (MoverParameters->DynamicBrakeFlag && MoverParameters->ResistorsFlag ?
|
||||
0 :
|
||||
fabs(MoverParameters->Itot)) +
|
||||
MoverParameters->Itot) +
|
||||
MoverParameters->TotalCurrent; // prąd pobierany przez pojazd - bez
|
||||
// sensu z tym (TotalCurrent)
|
||||
// TotalCurrent to bedzie prad nietrakcyjny (niezwiazany z napedem)
|
||||
@@ -4788,7 +4957,10 @@ void TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
case 3:
|
||||
pAnimations[i + j].yUpdate = UpdateDoorFold;
|
||||
break; // obrót 3 kolejnych submodeli
|
||||
}
|
||||
case 4:
|
||||
pAnimations[i + j].yUpdate = UpdateDoorPlug;
|
||||
break;
|
||||
}
|
||||
pAnimations[i + j].iNumber =
|
||||
i; // parzyste działają inaczej niż nieparzyste
|
||||
pAnimations[i + j].fMaxDist = 300 * 300; // drzwi to z daleka widać
|
||||
@@ -5064,11 +5236,83 @@ void TDynamicObject::LoadMMediaFile(AnsiString BaseDir, AnsiString TypeName,
|
||||
void TDynamicObject::RadioStop()
|
||||
{ // zatrzymanie pojazdu
|
||||
if (Mechanik) // o ile ktoś go prowadzi
|
||||
if (MoverParameters->SecuritySystem.RadioStop) // jeśli pojazd ma RadioStop i jest on
|
||||
// aktywny
|
||||
if (MoverParameters->SecuritySystem.RadioStop &&
|
||||
MoverParameters->Radio) // jeśli pojazd ma RadioStop i jest on aktywny
|
||||
Mechanik->PutCommand("Emergency_brake", 1.0, 1.0, &vPosition, stopRadio);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
void TDynamicObject::Damage(char flag)
|
||||
{
|
||||
if (flag & 1) //różnicówka nie robi nic
|
||||
{
|
||||
MoverParameters->MainSwitch(false);
|
||||
MoverParameters->FuseOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
if (flag & 2) //usterka sterowania
|
||||
{
|
||||
MoverParameters->StLinFlag = false;
|
||||
if (MoverParameters->InitialCtrlDelay<100000000)
|
||||
MoverParameters->InitialCtrlDelay += 100000001;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MoverParameters->InitialCtrlDelay>100000000)
|
||||
MoverParameters->InitialCtrlDelay -= 100000001;
|
||||
}
|
||||
|
||||
if (flag & 4) //blokada przetwornicy
|
||||
{
|
||||
MoverParameters->ConvOvldFlag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
if (flag & 8) //blokada sprezarki
|
||||
{
|
||||
if (MoverParameters->MinCompressor>0)
|
||||
MoverParameters->MinCompressor -= 100000001;
|
||||
if (MoverParameters->MaxCompressor>0)
|
||||
MoverParameters->MaxCompressor -= 100000001;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MoverParameters->MinCompressor<0)
|
||||
MoverParameters->MinCompressor += 100000001;
|
||||
if (MoverParameters->MaxCompressor<0)
|
||||
MoverParameters->MaxCompressor += 100000001;
|
||||
}
|
||||
|
||||
if (flag & 16) //blokada wału
|
||||
{
|
||||
if (MoverParameters->CtrlDelay<100000000)
|
||||
MoverParameters->CtrlDelay += 100000001;
|
||||
if (MoverParameters->CtrlDownDelay<100000000)
|
||||
MoverParameters->CtrlDownDelay += 100000001;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MoverParameters->CtrlDelay>100000000)
|
||||
MoverParameters->CtrlDelay -= 100000001;
|
||||
if (MoverParameters->CtrlDownDelay>100000000)
|
||||
MoverParameters->CtrlDownDelay -= 100000001;
|
||||
}
|
||||
|
||||
if (flag & 32) //hamowanie nagŁe
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
MoverParameters->EngDmgFlag = flag;
|
||||
};
|
||||
|
||||
void TDynamicObject::RaLightsSet(int head, int rear)
|
||||
{ // zapalenie świateł z przodu i z
|
||||
// tyłu, zależne od kierunku
|
||||
@@ -5132,24 +5376,30 @@ int TDynamicObject::DirectionSet(int d)
|
||||
// następnego
|
||||
};
|
||||
|
||||
TDynamicObject *__fastcall TDynamicObject::PrevAny()
|
||||
TDynamicObject * TDynamicObject::PrevAny()
|
||||
{ // wskaźnik na poprzedni,
|
||||
// nawet wirtualny
|
||||
return iDirection ? PrevConnected : NextConnected;
|
||||
};
|
||||
TDynamicObject *__fastcall TDynamicObject::Prev()
|
||||
TDynamicObject * TDynamicObject::Prev()
|
||||
{
|
||||
if (MoverParameters->Couplers[iDirection ^ 1].CouplingFlag)
|
||||
return iDirection ? PrevConnected : NextConnected;
|
||||
return NULL; // gdy sprzęg wirtualny, to jakby nic nie było
|
||||
};
|
||||
TDynamicObject *__fastcall TDynamicObject::Next()
|
||||
TDynamicObject * TDynamicObject::Next()
|
||||
{
|
||||
if (MoverParameters->Couplers[iDirection].CouplingFlag)
|
||||
return iDirection ? NextConnected : PrevConnected;
|
||||
return NULL; // gdy sprzęg wirtualny, to jakby nic nie było
|
||||
};
|
||||
TDynamicObject *__fastcall TDynamicObject::NextC(int C)
|
||||
TDynamicObject * TDynamicObject::PrevC(int C)
|
||||
{
|
||||
if (MoverParameters->Couplers[iDirection ^ 1].CouplingFlag & C)
|
||||
return iDirection ? PrevConnected : NextConnected;
|
||||
return NULL; // gdy sprzęg wirtualny, to jakby nic nie było
|
||||
};
|
||||
TDynamicObject * TDynamicObject::NextC(int C)
|
||||
{
|
||||
if (MoverParameters->Couplers[iDirection].CouplingFlag & C)
|
||||
return iDirection ? NextConnected : PrevConnected;
|
||||
@@ -5167,7 +5417,7 @@ double TDynamicObject::NextDistance(double d)
|
||||
return d;
|
||||
};
|
||||
|
||||
TDynamicObject *__fastcall TDynamicObject::Neightbour(int &dir)
|
||||
TDynamicObject * TDynamicObject::Neightbour(int &dir)
|
||||
{ // ustalenie następnego (1) albo poprzedniego (0) w składzie bez
|
||||
// względu na prawidłowość
|
||||
// iDirection
|
||||
@@ -5242,7 +5492,7 @@ void TDynamicObject::CoupleDist()
|
||||
}
|
||||
};
|
||||
|
||||
TDynamicObject *__fastcall TDynamicObject::ControlledFind()
|
||||
TDynamicObject * TDynamicObject::ControlledFind()
|
||||
{ // taka proteza:
|
||||
// chcę podłączyć
|
||||
// kabinę EN57
|
||||
|
||||
36
DynObj.h
36
DynObj.h
@@ -157,7 +157,7 @@ class TDynamicObject
|
||||
float fAxleDist; // rozstaw wózków albo osi do liczenia proporcji zacienienia
|
||||
vector3 modelRot; // obrot pudła względem świata - do przeanalizowania, czy potrzebne!!!
|
||||
// bool bCameraNear; //blisko kamer są potrzebne dodatkowe obliczenia szczegółów
|
||||
TDynamicObject *__fastcall ABuFindNearestObject(TTrack *Track, TDynamicObject *MyPointer,
|
||||
TDynamicObject * ABuFindNearestObject(TTrack *Track, TDynamicObject *MyPointer,
|
||||
int &CouplNr);
|
||||
|
||||
public: // parametry położenia pojazdu dostępne publicznie
|
||||
@@ -197,7 +197,8 @@ class TDynamicObject
|
||||
void UpdateDoorTranslate(TAnim *pAnim); // animacja drzwi - przesuw
|
||||
void UpdateDoorRotate(TAnim *pAnim); // animacja drzwi - obrót
|
||||
void UpdateDoorFold(TAnim *pAnim); // animacja drzwi - składanie
|
||||
void UpdatePant(TAnim *pAnim); // animacja pantografu
|
||||
void UpdateDoorPlug(TAnim *pAnim); // animacja drzwi - odskokowo-przesuwne
|
||||
void UpdatePant(TAnim *pAnim); // animacja pantografu
|
||||
void UpdateLeverDouble(TAnim *pAnim); // animacja gałki zależna od double
|
||||
void UpdateLeverFloat(TAnim *pAnim); // animacja gałki zależna od float
|
||||
void UpdateLeverInt(TAnim *pAnim); // animacja gałki zależna od int (wartość)
|
||||
@@ -325,7 +326,7 @@ class TDynamicObject
|
||||
void ABuScanObjects(int ScanDir, double ScanDist);
|
||||
|
||||
protected:
|
||||
TDynamicObject *__fastcall ABuFindObject(TTrack *Track, int ScanDir, Byte &CouplFound,
|
||||
TDynamicObject * ABuFindObject(TTrack *Track, int ScanDir, Byte &CouplFound,
|
||||
double &dist);
|
||||
void ABuCheckMyTrack();
|
||||
|
||||
@@ -333,10 +334,11 @@ class TDynamicObject
|
||||
int *iLights; // wskaźnik na bity zapalonych świateł (własne albo innego członu)
|
||||
double fTrackBlock; // odległość do przeszkody do dalszego ruchu (wykrywanie kolizji z innym
|
||||
// pojazdem)
|
||||
TDynamicObject *__fastcall PrevAny();
|
||||
TDynamicObject *__fastcall Prev();
|
||||
TDynamicObject *__fastcall Next();
|
||||
TDynamicObject *__fastcall NextC(int C);
|
||||
TDynamicObject * PrevAny();
|
||||
TDynamicObject * Prev();
|
||||
TDynamicObject * Next();
|
||||
TDynamicObject * PrevC(int C);
|
||||
TDynamicObject * NextC(int C);
|
||||
double NextDistance(double d = -1.0);
|
||||
void SetdMoveLen(double dMoveLen)
|
||||
{
|
||||
@@ -367,9 +369,9 @@ class TDynamicObject
|
||||
// float EmR;
|
||||
// vector3 smokeoffset;
|
||||
|
||||
TDynamicObject *__fastcall ABuScanNearestObject(TTrack *Track, double ScanDir, double ScanDist,
|
||||
TDynamicObject * ABuScanNearestObject(TTrack *Track, double ScanDir, double ScanDist,
|
||||
int &CouplNr);
|
||||
TDynamicObject *__fastcall GetFirstDynamic(int cpl_type);
|
||||
TDynamicObject * GetFirstDynamic(int cpl_type);
|
||||
// TDynamicObject* GetFirstCabDynamic(int cpl_type);
|
||||
void ABuSetModelShake(vector3 mShake);
|
||||
|
||||
@@ -435,7 +437,7 @@ class TDynamicObject
|
||||
{
|
||||
return vLeft;
|
||||
};
|
||||
inline double *__fastcall Matrix()
|
||||
inline double * Matrix()
|
||||
{
|
||||
return mMatrix.getArray();
|
||||
};
|
||||
@@ -451,7 +453,7 @@ class TDynamicObject
|
||||
{
|
||||
return MoverParameters->Dim.W;
|
||||
};
|
||||
inline TTrack *__fastcall GetTrack()
|
||||
inline TTrack * GetTrack()
|
||||
{
|
||||
return (iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack());
|
||||
};
|
||||
@@ -476,15 +478,16 @@ class TDynamicObject
|
||||
{ // zwraca przesunięcie wózka względem Point1 toru z aktywną osią
|
||||
return iAxleFirst ? Axle1.GetTranslation() : Axle0.GetTranslation();
|
||||
};
|
||||
inline TTrack *__fastcall RaTrackGet()
|
||||
inline TTrack * RaTrackGet()
|
||||
{ // zwraca tor z aktywną osią
|
||||
return iAxleFirst ? Axle1.GetTrack() : Axle0.GetTrack();
|
||||
};
|
||||
void CouplersDettach(double MinDist, int MyScanDir);
|
||||
void RadioStop();
|
||||
void RaLightsSet(int head, int rear);
|
||||
void Damage(char flag);
|
||||
void RaLightsSet(int head, int rear);
|
||||
// void RaAxleEvent(TEvent *e);
|
||||
TDynamicObject *__fastcall FirstFind(int &coupler_nr);
|
||||
TDynamicObject * FirstFind(int &coupler_nr);
|
||||
float GetEPP(); // wyliczanie sredniego cisnienia w PG
|
||||
int DirectionSet(int d); // ustawienie kierunku w składzie
|
||||
int DirectionGet()
|
||||
@@ -493,15 +496,16 @@ class TDynamicObject
|
||||
}; // odczyt kierunku w składzie
|
||||
int DettachStatus(int dir);
|
||||
int Dettach(int dir);
|
||||
TDynamicObject *__fastcall Neightbour(int &dir);
|
||||
TDynamicObject * Neightbour(int &dir);
|
||||
void CoupleDist();
|
||||
TDynamicObject *__fastcall ControlledFind();
|
||||
TDynamicObject * ControlledFind();
|
||||
void ParamSet(int what, int into);
|
||||
int RouteWish(TTrack *tr); // zapytanie do AI, po którym segmencie skrzyżowania
|
||||
// jechać
|
||||
void DestinationSet(AnsiString to);
|
||||
AnsiString TextureTest(AnsiString &name);
|
||||
void OverheadTrack(float o);
|
||||
double MED[9][8]; // lista zmiennych do debugowania hamulca ED
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
48
EU07.bpr
48
EU07.bpr
@@ -5,15 +5,16 @@
|
||||
<VERSION value="BCB.05.03"/>
|
||||
<PROJECT value="E:\Gry\MaSzyna_15_04\EU07.exe"/>
|
||||
<OBJFILES value="QueryParserComp.obj McZapkie\mtable.obj McZapkie\_mover.obj
|
||||
McZapkie\hamulce.obj EU07.obj dumb3d.obj Camera.obj Texture.obj World.obj
|
||||
Model3d.obj MdlMngr.obj Train.obj wavread.obj Timer.obj Event.obj
|
||||
MemCell.obj Logs.obj Spring.obj Button.obj Globals.obj Gauge.obj
|
||||
AnimModel.obj Ground.obj TrkFoll.obj Segment.obj Sound.obj AdvSound.obj
|
||||
Track.obj DynObj.obj RealSound.obj EvLaunch.obj FadeSound.obj Traction.obj
|
||||
TractionPower.obj parser.obj sky.obj AirCoupler.obj opengl\glew.obj
|
||||
ResourceManager.obj VBO.obj TextureDDS.obj opengl\ARB_Multisample.obj
|
||||
Float3d.obj Classes.obj Driver.obj Names.obj Console.obj Mover.obj
|
||||
Console\PoKeys55.obj Forth.obj Console\LPT.obj PyInt.obj"/>
|
||||
McZapkie\hamulce.obj McZapkie\Oerlikon_ESt.obj EU07.obj dumb3d.obj
|
||||
Camera.obj Texture.obj World.obj Model3d.obj MdlMngr.obj Train.obj
|
||||
wavread.obj Timer.obj Event.obj MemCell.obj Logs.obj Spring.obj Button.obj
|
||||
Globals.obj Gauge.obj AnimModel.obj Ground.obj TrkFoll.obj Segment.obj
|
||||
Sound.obj AdvSound.obj Track.obj DynObj.obj RealSound.obj EvLaunch.obj
|
||||
FadeSound.obj Traction.obj TractionPower.obj parser.obj sky.obj
|
||||
AirCoupler.obj opengl\glew.obj ResourceManager.obj VBO.obj TextureDDS.obj
|
||||
opengl\ARB_Multisample.obj Float3d.obj Classes.obj Driver.obj Names.obj
|
||||
Console.obj Mover.obj Console\PoKeys55.obj Forth.obj Console\LPT.obj
|
||||
PyInt.obj"/>
|
||||
<RESFILES value="EU07.res"/>
|
||||
<IDLFILES value=""/>
|
||||
<IDLGENFILES value=""/>
|
||||
@@ -38,10 +39,10 @@
|
||||
<WARNINGS value="-w-par"/>
|
||||
</MACROS>
|
||||
<OPTIONS>
|
||||
<IDLCFLAGS value="-IConsole -Iopengl -IMcZapkie -I$(BCB)\include -I$(BCB)\include\vcl
|
||||
-src_suffix cpp -DGLEW_STATIC -D_DEBUG -boa"/>
|
||||
<CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a1 -6 -b- -k -y -v -vi-
|
||||
-c -tW -tWM"/>
|
||||
<IDLCFLAGS value="-src_suffix cpp -DGLEW_STATIC -D_DEBUG -IConsole -Iopengl -IMcZapkie
|
||||
-I$(BCB)\include -I$(BCB)\include\vcl -Ipython\include -boa"/>
|
||||
<CFLAG1 value="-Od -H=$(BCB)\lib\vcl50.csm -Hc -w- -Vx -Ve -X- -r- -a1 -6 -b- -k -y -v
|
||||
-vi- -c -tW -tWM"/>
|
||||
<PFLAGS value="-$Y+ -$W -$O- -v -JPHNE -M"/>
|
||||
<RFLAGS value=""/>
|
||||
<AFLAGS value="/mx /w2 /zi"/>
|
||||
@@ -59,7 +60,7 @@ AutoIncBuild=0
|
||||
MajorVer=15
|
||||
MinorVer=4
|
||||
Release=1171
|
||||
Build=474
|
||||
Build=475
|
||||
Debug=1
|
||||
PreRelease=0
|
||||
Special=0
|
||||
@@ -71,7 +72,7 @@ CodePage=1250
|
||||
[Version Info Keys]
|
||||
CompanyName=EU07 Team
|
||||
FileDescription=MaSzyna EU07-424
|
||||
FileVersion=15.4.1171.474
|
||||
FileVersion=15.4.1171.475
|
||||
InternalName=9th by firleju + Ra + SPKS + MP
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
@@ -98,25 +99,26 @@ Item1=$(BCB)\source\vcl
|
||||
[HistoryLists\hlConditionals]
|
||||
Count=8
|
||||
Item0=GLEW_STATIC;_DEBUG
|
||||
Item1=GLEW_STATIC;_DEBUG;USE_VBO
|
||||
Item2=GLEW_STATIC;_DEBUG;_USE_OLD_RW_STL
|
||||
Item3=GLEW_STATIC
|
||||
Item1=GLEW_STATIC
|
||||
Item2=GLEW_STATIC;_DEBUG;USE_VBO
|
||||
Item3=GLEW_STATIC;_DEBUG;_USE_OLD_RW_STL
|
||||
Item4=GLEW_STATIC;USE_VERTEX_ARRAYS;_DEBUG
|
||||
Item5=GLEW_STATIC;USE_VERTEX_ARRAYS
|
||||
Item6=GLEW_STATIC;_DEBUG;USE_VERTEX_ARRAYS
|
||||
Item7=_DEBUG
|
||||
|
||||
[HistoryLists\hlFinalOutputDir]
|
||||
Count=3
|
||||
Item0=E:\Gry\MaSzyna_15_04
|
||||
Item1=D:\EU07\
|
||||
Item2=E:\EU07\
|
||||
Count=4
|
||||
Item0=E:\Gry\MaSzyna_15_04\
|
||||
Item1=E:\Gry\MaSzyna_15_04
|
||||
Item2=D:\EU07\
|
||||
Item3=E:\EU07\
|
||||
|
||||
[Debugging]
|
||||
DebugSourceDirs=McZapkie\
|
||||
|
||||
[Parameters]
|
||||
RunParams=
|
||||
RunParams=-s $.scn -v EN57AKL-1ra
|
||||
HostApplication=
|
||||
RemoteHost=
|
||||
RemotePath=
|
||||
|
||||
1
EU07.cpp
1
EU07.cpp
@@ -78,6 +78,7 @@ USEUNIT("Console.cpp");
|
||||
USEUNIT("Mover.cpp");
|
||||
USEUNIT("McZapkie\_mover.pas");
|
||||
USEUNIT("McZapkie\hamulce.pas");
|
||||
USEUNIT("McZapkie\Oerlikon_ESt.pas");
|
||||
USEUNIT("Console\PoKeys55.cpp");
|
||||
USEUNIT("Forth.cpp");
|
||||
USEUNIT("Console\LPT.cpp");
|
||||
|
||||
@@ -85,6 +85,7 @@ vector3 Global::pFreeCameraInit[10];
|
||||
vector3 Global::pFreeCameraInitAngle[10];
|
||||
double Global::fFogStart = 1700;
|
||||
double Global::fFogEnd = 2000;
|
||||
float Global::Background[3] = { 0.2, 0.4, 0.33 };
|
||||
GLfloat Global::AtmoColor[] = {0.423f, 0.702f, 1.0f};
|
||||
GLfloat Global::FogColor[] = {0.6f, 0.7f, 0.8f};
|
||||
GLfloat Global::ambientDayLight[] = {0.40f, 0.40f, 0.45f, 1.0f}; // robocze
|
||||
@@ -469,7 +470,13 @@ void Global::ConfigParse(TQueryParserComp *qp, cParser *cp)
|
||||
// renderer
|
||||
TPythonInterpreter::getInstance()->setScreenRendererPriority(
|
||||
GetNextSymbol().LowerCase().c_str());
|
||||
} while (str != "endconfig"); //(!Parser->EndOfFile)
|
||||
else if (str == AnsiString("background"))
|
||||
{
|
||||
Background[0] = GetNextSymbol().ToDouble(); // r
|
||||
Background[1] = GetNextSymbol().ToDouble(); // g
|
||||
Background[2] = GetNextSymbol().ToDouble(); // b
|
||||
}
|
||||
} while (str != "endconfig"); //(!Parser->EndOfFile)
|
||||
// na koniec trochê zale¿noœci
|
||||
if (!bLoadTraction) // wczytywanie drutów i s³upów
|
||||
{ // tutaj wy³¹czenie, bo mog¹ nie byæ zdefiniowane w INI
|
||||
|
||||
@@ -215,7 +215,8 @@ class Global
|
||||
static void SetCameraRotation(double Yaw);
|
||||
static int iWriteLogEnabled; // maska bitowa: 1-zapis do pliku, 2-okienko
|
||||
// McZapkie-221002: definicja swiatla dziennego
|
||||
static GLfloat AtmoColor[];
|
||||
static float Background[3];
|
||||
static GLfloat AtmoColor[];
|
||||
static GLfloat FogColor[];
|
||||
// static bool bTimeChange;
|
||||
static GLfloat ambientDayLight[];
|
||||
|
||||
63
Ground.cpp
63
Ground.cpp
@@ -4774,6 +4774,24 @@ void TGround::WyslijEvent(const AnsiString &e, const AnsiString &d)
|
||||
cData.cbData = 12 + i + j; // 8+dwa liczniki i dwa zera koñcz¹ce
|
||||
cData.lpData = &r;
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(r.iComm) + " " + e + " sent");
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void TGround::WyslijUszkodzenia(const AnsiString &t, char fl)
|
||||
{ // wys³anie informacji w postaci pojedynczego tekstu
|
||||
DaneRozkaz r;
|
||||
r.iSygn = 'EU07';
|
||||
r.iComm = 13; // numer komunikatu
|
||||
int i = t.Length();
|
||||
r.cString[0] = char(fl);
|
||||
r.cString[1] = char(i);
|
||||
strcpy(r.cString + 2, t.c_str()); // z zerem koñcz¹cym
|
||||
COPYDATASTRUCT cData;
|
||||
cData.dwData = 'EU07'; // sygnatura
|
||||
cData.cbData = 11 + i; // 8+licznik i zero koñcz¹ce
|
||||
cData.lpData = &r;
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(r.iComm) + " " + t + " sent");
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void TGround::WyslijString(const AnsiString &t, int n)
|
||||
@@ -4789,6 +4807,7 @@ void TGround::WyslijString(const AnsiString &t, int n)
|
||||
cData.cbData = 10 + i; // 8+licznik i zero koñcz¹ce
|
||||
cData.lpData = &r;
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(r.iComm) + " " + t + " sent");
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
void TGround::WyslijWolny(const AnsiString &t)
|
||||
@@ -4868,7 +4887,51 @@ void TGround::WyslijNamiary(TGroundNode *t)
|
||||
// WriteLog("Ramka gotowa");
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
// WriteLog("Ramka poszla!");
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(r.iComm) + " " + t->asName + " sent");
|
||||
};
|
||||
//
|
||||
void TGround::WyslijObsadzone()
|
||||
{ // wys³anie informacji o pojeŸdzie
|
||||
DaneRozkaz2 r;
|
||||
r.iSygn = 'EU07';
|
||||
r.iComm = 12; // kod 12
|
||||
for (int i; i<1984; i++) r.cString[i] = 0;
|
||||
|
||||
int i = 0;
|
||||
for (TGroundNode *Current = nRootDynamic; Current; Current = Current->nNext)
|
||||
if (Current->DynamicObject->Mechanik)
|
||||
{
|
||||
strcpy(r.cString + 64 * i, Current->DynamicObject->asName.c_str());
|
||||
r.fPar[16 * i + 4] = Current->DynamicObject->GetPosition().x;
|
||||
r.fPar[16 * i + 5] = Current->DynamicObject->GetPosition().y;
|
||||
r.fPar[16 * i + 6] = Current->DynamicObject->GetPosition().z;
|
||||
r.iPar[16 * i + 7] = Current->DynamicObject->Mechanik->GetAction();
|
||||
strcpy(r.cString + 64 * i + 32, Current->DynamicObject->GetTrack()->IsolatedName().c_str());
|
||||
strcpy(r.cString + 64 * i + 48, Current->DynamicObject->Mechanik->Timetable()->TrainName.c_str());
|
||||
i++;
|
||||
if (i>30) break;
|
||||
}
|
||||
while (i <= 30)
|
||||
{
|
||||
strcpy(r.cString + 64 * i, AnsiString("none").c_str());
|
||||
r.fPar[16 * i + 4] = 1;
|
||||
r.fPar[16 * i + 5] = 2;
|
||||
r.fPar[16 * i + 6] = 3;
|
||||
r.iPar[16 * i + 7] = 0;
|
||||
strcpy(r.cString + 64 * i + 32, AnsiString("none").c_str());
|
||||
strcpy(r.cString + 64 * i + 48, AnsiString("none").c_str());
|
||||
i++;
|
||||
}
|
||||
|
||||
COPYDATASTRUCT cData;
|
||||
cData.dwData = 'EU07'; // sygnatura
|
||||
cData.cbData = 8 + 1984; // 8+licznik i zero koñcz¹ce
|
||||
cData.lpData = &r;
|
||||
// WriteLog("Ramka gotowa");
|
||||
Navigate("TEU07SRK", WM_COPYDATA, (WPARAM)Global::hWnd, (LPARAM)&cData);
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(r.iComm) + " obsadzone" + " sent");
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
void TGround::WyslijParam(int nr, int fl)
|
||||
{ // wys³anie parametrów symulacji w ramce (nr) z flagami (fl)
|
||||
|
||||
17
Ground.h
17
Ground.h
@@ -46,6 +46,18 @@ struct DaneRozkaz
|
||||
};
|
||||
};
|
||||
|
||||
struct DaneRozkaz2
|
||||
{ // struktura komunikacji z EU07.EXE
|
||||
int iSygn; // sygnatura 'EU07'
|
||||
int iComm; // rozkaz/status (kod ramki)
|
||||
union
|
||||
{
|
||||
float fPar[496];
|
||||
int iPar[496];
|
||||
char cString[1984]; // upakowane stringi
|
||||
};
|
||||
};
|
||||
|
||||
typedef int TGroundNodeType;
|
||||
|
||||
struct TGroundVertex
|
||||
@@ -386,7 +398,10 @@ class TGround
|
||||
void WyslijWolny(const AnsiString &t);
|
||||
void WyslijNamiary(TGroundNode *t);
|
||||
void WyslijParam(int nr, int fl);
|
||||
void RadioStop(vector3 pPosition);
|
||||
void WyslijUszkodzenia(const AnsiString &t, char fl);
|
||||
void WyslijPojazdy(int nr); // -> skladanie wielu pojazdow
|
||||
void WyslijObsadzone(); // -> skladanie wielu pojazdow
|
||||
void RadioStop(vector3 pPosition);
|
||||
TDynamicObject *__fastcall DynamicNearest(vector3 pPosition, double distance = 20.0,
|
||||
bool mech = false);
|
||||
TDynamicObject *__fastcall CouplerNearest(vector3 pPosition, double distance = 20.0,
|
||||
|
||||
24
Logs.cpp
24
Logs.cpp
@@ -20,6 +20,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
std::ofstream output; // standardowy "log.txt", mo¿na go wy³¹czyæ
|
||||
std::ofstream errors; // lista b³êdów "errors.txt", zawsze dzia³a
|
||||
std::ofstream comms; // lista komunikatow "comms.txt", mo¿na go wy³¹czyæ
|
||||
|
||||
char endstring[10] = "\n";
|
||||
|
||||
@@ -103,6 +104,29 @@ void WriteLog(const AnsiString &str, bool newline)
|
||||
{ // Ra: wersja z AnsiString jest zamienna z Error()
|
||||
WriteLog(str.c_str(), newline);
|
||||
};
|
||||
|
||||
void CommLog(const char *str)
|
||||
{ // Ra: warunkowa rejestracja komunikatów
|
||||
WriteLog(str);
|
||||
/* if (Global::iWriteLogEnabled & 4)
|
||||
{
|
||||
if (!comms.is_open())
|
||||
{
|
||||
comms.open("comms.txt", std::ios::trunc);
|
||||
comms << AnsiString("EU07.EXE " + Global::asRelease).c_str() << "\n";
|
||||
}
|
||||
if (str)
|
||||
comms << str;
|
||||
comms << "\n";
|
||||
comms.flush();
|
||||
}*/
|
||||
};
|
||||
|
||||
void CommLog(const AnsiString &str)
|
||||
{ // Ra: wersja z AnsiString jest zamienna z Error()
|
||||
CommLog(str.c_str());
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#pragma package(smart_init)
|
||||
|
||||
2
Logs.h
2
Logs.h
@@ -18,5 +18,7 @@ void WriteLog(const char *str, bool newline = true);
|
||||
void Error(const AnsiString &asMessage, bool box = true);
|
||||
void ErrorLog(const AnsiString &asMessage);
|
||||
void WriteLog(const AnsiString &str, bool newline = true);
|
||||
void CommLog(const char *str);
|
||||
void CommLog(const AnsiString &str);
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
@@ -93,8 +93,9 @@ enum TBrakeValve { NoValve, W, W_Lu_VI, W_Lu_L, W_Lu_XR, K, Kg, Kp, Kss, Kkg, Kk
|
||||
#pragma option pop
|
||||
|
||||
#pragma option push -b-
|
||||
enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113
|
||||
};
|
||||
enum TBrakeHandle {
|
||||
NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113,
|
||||
MHZ_P, MHZ_T, MHZ_EN57 };
|
||||
#pragma option pop
|
||||
|
||||
#pragma option push -b-
|
||||
@@ -425,6 +426,10 @@ public:
|
||||
Byte BrakeCtrlPosNo;
|
||||
Byte MainCtrlPosNo;
|
||||
Byte ScndCtrlPosNo;
|
||||
Byte LightsPosNo;
|
||||
Byte LightsDefPos;
|
||||
bool LightsWrap;
|
||||
Byte Lights[2][16];
|
||||
bool ScndInMain;
|
||||
bool MBrake;
|
||||
TSecuritySystem SecuritySystem;
|
||||
@@ -454,6 +459,7 @@ public:
|
||||
double RVentCutOff;
|
||||
int CompressorPower;
|
||||
int SmallCompressorPower;
|
||||
bool Trafo;
|
||||
double dizel_Mmax;
|
||||
double dizel_nMmax;
|
||||
double dizel_Mnmax;
|
||||
@@ -481,7 +487,7 @@ public:
|
||||
TShuntScheme SST[33];
|
||||
double PowerCorRatio;
|
||||
double Ftmax;
|
||||
double eimc[21];
|
||||
double eimc[26];
|
||||
int MaxLoad;
|
||||
AnsiString LoadAccepted;
|
||||
AnsiString LoadQuantity;
|
||||
@@ -496,7 +502,11 @@ public:
|
||||
double DoorCloseSpeed;
|
||||
double DoorMaxShiftL;
|
||||
double DoorMaxShiftR;
|
||||
double DoorMaxPlugShift;
|
||||
Byte DoorOpenMethod;
|
||||
double PlatformSpeed;
|
||||
double PlatformMaxShift;
|
||||
Byte PlatformOpenMethod;
|
||||
bool ScndS;
|
||||
TLocation Loc;
|
||||
TRotation Rot;
|
||||
@@ -559,6 +569,7 @@ public:
|
||||
double LimPipePress;
|
||||
double ActFlowSpeed;
|
||||
Byte DamageFlag;
|
||||
Byte EngDmgFlag;
|
||||
Byte DerailReason;
|
||||
TCommand CommandIn;
|
||||
AnsiString CommandOut;
|
||||
@@ -571,6 +582,7 @@ public:
|
||||
bool Mains;
|
||||
Byte MainCtrlPos;
|
||||
Byte ScndCtrlPos;
|
||||
Byte LightsPos;
|
||||
int ActiveDir;
|
||||
int CabNo;
|
||||
int DirAbsolute;
|
||||
@@ -763,6 +775,7 @@ static const Shortint maxcc = 0x4;
|
||||
static const Shortint LocalBrakePosNo = 0xa;
|
||||
static const Shortint MainBrakeMaxPos = 0xa;
|
||||
static const Shortint ManualBrakePosNo = 0x14;
|
||||
static const Shortint LightsSwitchPosNo = 0x10;
|
||||
static const Shortint dtrack_railwear = 0x2;
|
||||
static const Shortint dtrack_freerail = 0x4;
|
||||
static const Shortint dtrack_thinrail = 0x8;
|
||||
@@ -847,6 +860,8 @@ static const Shortint eimc_p_Ph = 0x11;
|
||||
static const Shortint eimc_p_Vh0 = 0x12;
|
||||
static const Shortint eimc_p_Vh1 = 0x13;
|
||||
static const Shortint eimc_p_Imax = 0x14;
|
||||
static const Shortint eimc_p_abed = 0x15;
|
||||
static const Shortint eimc_p_eped = 0x16;
|
||||
static const Shortint eimv_FMAXMAX = 0x0;
|
||||
static const Shortint eimv_Fmax = 0x1;
|
||||
static const Shortint eimv_ks = 0x2;
|
||||
|
||||
@@ -92,8 +92,8 @@ enum TBrakeValve { NoValve, W, W_Lu_VI, W_Lu_L, W_Lu_XR, K, Kg, Kp, Kss, Kkg, Kk
|
||||
#pragma option pop
|
||||
|
||||
#pragma option push -b-
|
||||
enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113
|
||||
};
|
||||
enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113,
|
||||
MHZ_P, MHZ_T, MHZ_EN57 };
|
||||
#pragma option pop
|
||||
|
||||
#pragma option push -b-
|
||||
@@ -404,6 +404,10 @@ public:
|
||||
Byte BrakeCtrlPosNo;
|
||||
Byte MainCtrlPosNo;
|
||||
Byte ScndCtrlPosNo;
|
||||
Byte LightsPosNo;
|
||||
Byte LightsDefPos;
|
||||
bool LightsWrap;
|
||||
Byte Lights[2][16];
|
||||
bool ScndInMain;
|
||||
bool MBrake;
|
||||
TSecuritySystem SecuritySystem;
|
||||
@@ -433,6 +437,7 @@ public:
|
||||
double RVentCutOff;
|
||||
int CompressorPower;
|
||||
int SmallCompressorPower;
|
||||
bool Trafo;
|
||||
double dizel_Mmax;
|
||||
double dizel_nMmax;
|
||||
double dizel_Mnmax;
|
||||
@@ -460,7 +465,7 @@ public:
|
||||
TShuntScheme SST[33];
|
||||
double PowerCorRatio;
|
||||
double Ftmax;
|
||||
double eimc[21];
|
||||
double eimc[26];
|
||||
int MaxLoad;
|
||||
AnsiString LoadAccepted;
|
||||
AnsiString LoadQuantity;
|
||||
@@ -475,7 +480,11 @@ public:
|
||||
double DoorCloseSpeed;
|
||||
double DoorMaxShiftL;
|
||||
double DoorMaxShiftR;
|
||||
double DoorMaxPlugShift;
|
||||
Byte DoorOpenMethod;
|
||||
double PlatformSpeed;
|
||||
double PlatformMaxShift;
|
||||
Byte PlatformOpenMethod;
|
||||
bool ScndS;
|
||||
TLocation Loc;
|
||||
TRotation Rot;
|
||||
@@ -538,6 +547,7 @@ public:
|
||||
double LimPipePress;
|
||||
double ActFlowSpeed;
|
||||
Byte DamageFlag;
|
||||
Byte EngDmgFlag;
|
||||
Byte DerailReason;
|
||||
TCommand CommandIn;
|
||||
AnsiString CommandOut;
|
||||
@@ -550,6 +560,7 @@ public:
|
||||
bool Mains;
|
||||
Byte MainCtrlPos;
|
||||
Byte ScndCtrlPos;
|
||||
Byte LightsPos;
|
||||
int ActiveDir;
|
||||
int CabNo;
|
||||
int DirAbsolute;
|
||||
@@ -761,6 +772,7 @@ static const Shortint maxcc = 0x4;
|
||||
static const Shortint LocalBrakePosNo = 0xa;
|
||||
static const Shortint MainBrakeMaxPos = 0xa;
|
||||
static const Shortint ManualBrakePosNo = 0x14;
|
||||
static const Shortint LightsSwitchPosNo = 0x10;
|
||||
static const Shortint dtrack_railwear = 0x2;
|
||||
static const Shortint dtrack_freerail = 0x4;
|
||||
static const Shortint dtrack_thinrail = 0x8;
|
||||
@@ -845,6 +857,8 @@ static const Shortint eimc_p_Ph = 0x11;
|
||||
static const Shortint eimc_p_Vh0 = 0x12;
|
||||
static const Shortint eimc_p_Vh1 = 0x13;
|
||||
static const Shortint eimc_p_Imax = 0x14;
|
||||
static const Shortint eimc_p_abed = 0x15;
|
||||
static const Shortint eimc_p_eped = 0x16;
|
||||
static const Shortint eimv_FMAXMAX = 0x0;
|
||||
static const Shortint eimv_Fmax = 0x1;
|
||||
static const Shortint eimv_ks = 0x2;
|
||||
|
||||
@@ -77,6 +77,7 @@ CONST
|
||||
LocalBrakePosNo=10; {ilosc nastaw hamulca pomocniczego}
|
||||
MainBrakeMaxPos=10; {max. ilosc nastaw hamulca zasadniczego}
|
||||
ManualBrakePosNo=20; {ilosc nastaw hamulca recznego}
|
||||
LightsSwitchPosNo=16;
|
||||
|
||||
{uszkodzenia toru}
|
||||
dtrack_railwear=2;
|
||||
@@ -182,6 +183,8 @@ CONST
|
||||
eimc_p_Vh0=18;
|
||||
eimc_p_Vh1=19;
|
||||
eimc_p_Imax=20;
|
||||
eimc_p_abed=21;
|
||||
eimc_p_eped=22;
|
||||
|
||||
//zmienne dla asynchronów
|
||||
eimv_FMAXMAX=0;
|
||||
@@ -248,7 +251,7 @@ TYPE
|
||||
{podtypy hamulcow zespolonych}
|
||||
TBrakeSubSystem = (ss_None, ss_W, ss_K, ss_KK, ss_Hik, ss_ESt, ss_KE, ss_LSt, ss_MT, ss_Dako);
|
||||
TBrakeValve = (NoValve, W, W_Lu_VI, W_Lu_L, W_Lu_XR, K, Kg, Kp, Kss, Kkg, Kkp, Kks, Hikg1, Hikss, Hikp1, KE, SW, EStED, NESt3, ESt3, LSt, ESt4, ESt3AL2, EP1, EP2, M483, CV1_L_TR, CV1, CV1_R, Other);
|
||||
TBrakeHandle = (NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113);
|
||||
TBrakeHandle = (NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113, MHZ_P, MHZ_T, MHZ_EN57);
|
||||
{typy hamulcow indywidualnych}
|
||||
TLocalBrake = (NoBrake, ManualBrake, PneumaticBrake, HydraulicBrake);
|
||||
|
||||
@@ -472,7 +475,7 @@ TYPE
|
||||
{promien cylindra, skok cylindra, przekladnia hamulcowa}
|
||||
BrakeCylSpring: real; {suma nacisku sprezyn powrotnych, kN}
|
||||
BrakeSlckAdj: real; {opor nastawiacza skoku tloka, kN}
|
||||
BrakeRigEff: real; {sprawnosc przekladni dzwigniowej}
|
||||
BrakeRigEff: real; {sprawnosc przekladni dzwigniowej}
|
||||
RapidMult: real; {przelozenie rapidu}
|
||||
BrakeValveSize: integer;
|
||||
BrakeValveParams: string;
|
||||
@@ -484,6 +487,9 @@ TYPE
|
||||
{nastawniki:}
|
||||
MainCtrlPosNo: byte; {ilosc pozycji nastawnika}
|
||||
ScndCtrlPosNo: byte;
|
||||
LightsPosNo, LightsDefPos: byte;
|
||||
LightsWrap: boolean;
|
||||
Lights: array [0..1] of array [1..16] of byte;
|
||||
ScndInMain: boolean; {zaleznosc bocznika od nastawnika}
|
||||
MBrake: boolean; {Czy jest hamulec reczny}
|
||||
SecuritySystem: TSecuritySystem;
|
||||
@@ -520,6 +526,7 @@ TYPE
|
||||
RVentCutOff: real; {rezystancja wylaczania wentylatorow dla RVentType=2}
|
||||
CompressorPower: integer; {0: bezp. z obwodow silnika, 1: z przetwornicy, reczne, 2: w przetwornicy, stale, 5: z silnikowego}
|
||||
SmallCompressorPower: integer; {Winger ZROBIC}
|
||||
Trafo: boolean; {pojazd wyposażony w transformator}
|
||||
|
||||
{-sekcja parametrow dla lokomotywy spalinowej z przekladnia mechaniczna}
|
||||
dizel_Mmax, dizel_nMmax, dizel_Mnmax, dizel_nmax, dizel_nominalfill: real;
|
||||
@@ -553,7 +560,7 @@ TYPE
|
||||
Ftmax:real;
|
||||
|
||||
{- dla lokomotyw z silnikami indukcyjnymi -}
|
||||
eimc: array [0..20] of real;
|
||||
eimc: array [0..25] of real;
|
||||
|
||||
{-dla wagonow}
|
||||
MaxLoad: longint; {masa w T lub ilosc w sztukach - ladownosc}
|
||||
@@ -564,8 +571,11 @@ TYPE
|
||||
DoorStayOpen: real; {jak dlugo otwarte w przypadku DoorCloseCtrl=2}
|
||||
DoorClosureWarning: boolean; {czy jest ostrzeganie przed zamknieciem}
|
||||
DoorOpenSpeed, DoorCloseSpeed: real; {predkosc otwierania i zamykania w j.u. }
|
||||
DoorMaxShiftL,DoorMaxShiftR: real;{szerokosc otwarcia lub kat}
|
||||
DoorMaxShiftL,DoorMaxShiftR,DoorMaxPlugShift: real;{szerokosc otwarcia lub kat}
|
||||
DoorOpenMethod: byte; {sposob otwarcia - 1: przesuwne, 2: obrotowe, 3: trójelementowe}
|
||||
PlatformSpeed: real; {szybkosc stopnia}
|
||||
PlatformMaxShift: real; {wysuniecie stopnia}
|
||||
PlatformOpenMethod: byte; {sposob animacji stopnia}
|
||||
ScndS: boolean; {Czy jest bocznikowanie na szeregowej}
|
||||
|
||||
{--sekcja zmiennych}
|
||||
@@ -629,6 +639,7 @@ TYPE
|
||||
|
||||
|
||||
DamageFlag: byte; //kombinacja bitowa stalych dtrain_* }
|
||||
EngDmgFlag: byte; //kombinacja bitowa stalych usterek}
|
||||
DerailReason: byte; //przyczyna wykolejenia
|
||||
|
||||
//EndSignalsFlag: byte; {ABu 060205: zmiany - koncowki: 1/16 - swiatla prz/tyl, 2/31 - blachy prz/tyl}
|
||||
@@ -648,6 +659,7 @@ TYPE
|
||||
Mains: boolean; {polozenie glownego wylacznika}
|
||||
MainCtrlPos: byte; {polozenie glownego nastawnika}
|
||||
ScndCtrlPos: byte; {polozenie dodatkowego nastawnika}
|
||||
LightsPos: byte;
|
||||
ActiveDir: integer; //czy lok. jest wlaczona i w ktorym kierunku:
|
||||
//względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona
|
||||
CabNo: integer; //numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad
|
||||
@@ -1048,6 +1060,7 @@ end;
|
||||
|
||||
{---------rozwiniecie deklaracji metod obiektu T_MoverParameters--------}
|
||||
|
||||
(*
|
||||
function T_MoverParameters.GetTrainsetVoltage: real;
|
||||
//ABu: funkcja zwracajaca napiecie dla calego skladu, przydatna dla EZT
|
||||
var volt: real;
|
||||
@@ -1074,6 +1087,14 @@ begin
|
||||
end;
|
||||
GetTrainsetVoltage:=volt;
|
||||
end;
|
||||
*)
|
||||
|
||||
function T_MoverParameters.GetTrainsetVoltage: real;
|
||||
//ABu: funkcja zwracajaca napiecie dla calego skladu, przydatna dla EZT
|
||||
//var volt: real;
|
||||
begin
|
||||
GetTrainsetVoltage:=Max0R(HVCouplers[1][1],HVCouplers[0][1]);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@@ -1554,6 +1575,12 @@ begin
|
||||
if (LastRelayTime>CtrlDelay) then
|
||||
LastRelayTime:=0;
|
||||
|
||||
if (OK) and (EngineType=ElectricInductionMotor) then
|
||||
if (Vmax<250) then
|
||||
ScndCtrlActualPos:=Round(Vel+0.5)
|
||||
else
|
||||
ScndCtrlActualPos:=Round(Vel/2+0.5);
|
||||
|
||||
IncScndCtrl:=OK;
|
||||
end;
|
||||
|
||||
@@ -1597,6 +1624,10 @@ begin
|
||||
if OK then
|
||||
if (LastRelayTime>CtrlDownDelay) then
|
||||
LastRelayTime:=0;
|
||||
|
||||
if (OK) and (EngineType=ElectricInductionMotor) then
|
||||
ScndCtrlActualPos:=0;
|
||||
|
||||
DecScndCtrl:=OK;
|
||||
end;
|
||||
|
||||
@@ -1631,7 +1662,7 @@ begin
|
||||
MainSwitch:=false; //Ra: przeniesione z końca
|
||||
if ((Mains<>State) and (MainCtrlPosNo>0)) then
|
||||
begin
|
||||
if (State=false) or ({(MainCtrlPos=0) and} (ScndCtrlPos=0) and (ConvOvldFlag=false) and (LastSwitchingTime>CtrlDelay) and not TestFlag(DamageFlag,dtrain_out)) then
|
||||
if (State=false) or ({(MainCtrlPos=0) and} (ScndCtrlPos=0) and ((ConvOvldFlag=false)or(TrainType=dt_EZT)) and (LastSwitchingTime>CtrlDelay) and not TestFlag(DamageFlag,dtrain_out) and not TestFlag(EngDmgFlag,1)) then
|
||||
begin
|
||||
if Mains then //jeśli był załączony
|
||||
SendCtrlToNext('MainSwitch',ord(State),CabNo); //wysłanie wyłączenia do pozostałych?
|
||||
@@ -1644,6 +1675,8 @@ begin
|
||||
begin
|
||||
dizel_enginestart:=State;
|
||||
end;
|
||||
if ((TrainType=dt_EZT)and(not State)) then
|
||||
ConvOvldFlag:=true;
|
||||
//if (State=false) then //jeśli wyłączony
|
||||
// begin
|
||||
//SetFlag(SoundFlag,sound_relay); //hunter-091012: przeniesione do Train.cpp, zeby sie nie zapetlal
|
||||
@@ -1939,6 +1972,8 @@ begin
|
||||
//poza tym jest zdefiniowany we wszystkich 3 członach EN57
|
||||
with SecuritySystem do
|
||||
begin
|
||||
if (not Radio) then
|
||||
EmergencyBrakeSwitch(false);
|
||||
if (SystemType>0) and (Status>0) and (Battery) then //Ra: EZT ma teraz czuwak w rozrządczym
|
||||
begin
|
||||
//CA
|
||||
@@ -1988,6 +2023,7 @@ begin
|
||||
end
|
||||
else if not (Battery) then
|
||||
begin //wyłączenie baterii deaktywuje sprzęt
|
||||
EmergencyBrakeSwitch(false);
|
||||
//SecuritySystem.Status:=0; //deaktywacja czuwaka
|
||||
end;
|
||||
end;
|
||||
@@ -2061,11 +2097,11 @@ begin
|
||||
begin
|
||||
dec(BrakeCtrlPos);
|
||||
// BrakeCtrlPosR:=BrakeCtrlPos;
|
||||
if EmergencyBrakeFlag then
|
||||
begin
|
||||
EmergencyBrakeFlag:=false; {!!!}
|
||||
SendCtrlToNext('Emergency_brake',0,CabNo);
|
||||
end;
|
||||
//// if EmergencyBrakeFlag then //yB: czy to jest potrzebne?
|
||||
//// begin
|
||||
//// EmergencyBrakeFlag:=false; {!!!}
|
||||
//// SendCtrlToNext('Emergency_brake',0,CabNo);
|
||||
//// end;
|
||||
|
||||
//youBy: wywalilem to, jak jest EP, to sa przenoszone sygnaly nt. co ma robic, a nie poszczegolne pozycje;
|
||||
// wystarczy spojrzec na Knorra i Oerlikona EP w EN57; mogly ze soba wspolapracowac
|
||||
@@ -2443,7 +2479,7 @@ with BrakePressureTable[BrakeCtrlPos] do
|
||||
end;
|
||||
|
||||
// if(EmergencyBrakeFlag)and(BrakeCtrlPosNo=0)then {ulepszony hamulec bezp.}
|
||||
if(EmergencyBrakeFlag)or TestFlag(SecuritySystem.Status,s_SHPebrake) or TestFlag(SecuritySystem.Status,s_CAebrake) or (s_CAtestebrake=true)then {ulepszony hamulec bezp.}
|
||||
if(EmergencyBrakeFlag)or TestFlag(SecuritySystem.Status,s_SHPebrake) or TestFlag(SecuritySystem.Status,s_CAebrake) or (s_CAtestebrake=true) or (TestFlag(EngDmgFlag,32)){ or (not Battery)}then {ulepszony hamulec bezp.}
|
||||
dpMainValve:=dpMainValve/1+PF(0,PipePress,0.15)*dt;
|
||||
//0.2*Spg
|
||||
Pipe.Flow(-dpMainValve);
|
||||
@@ -2479,12 +2515,18 @@ end;
|
||||
|
||||
if(DynamicBrakeFlag)and(EngineType=ElectricInductionMotor)then
|
||||
begin
|
||||
(Hamulec as TLSt).SetLBP(LocBrakePress);
|
||||
(Hamulec as TLSt).SetLBP(LocBrakePress);
|
||||
// if(Vel>10)then LocBrakePress:=0 else
|
||||
// if(Vel>5)then LocBrakePress:=(10-Vel)/5*LocBrakePress
|
||||
end
|
||||
else
|
||||
(Hamulec as TLSt).SetLBP(LocBrakePress);
|
||||
if (BrakeValve = EStED) then
|
||||
if MBPM<2 then
|
||||
(Hamulec as TEStED).PLC(MaxBrakePress[LoadFlag])
|
||||
else
|
||||
(Hamulec as TEStED).PLC(TotalMass);
|
||||
|
||||
end;
|
||||
CV1_L_TR:
|
||||
begin
|
||||
@@ -2496,7 +2538,7 @@ end;
|
||||
begin
|
||||
if MBPM<2 then
|
||||
(Hamulec as TNESt3).PLC(MaxBrakePress[LoadFlag])
|
||||
else
|
||||
else
|
||||
(Hamulec as TNESt3).PLC(TotalMass);
|
||||
LocBrakePress:=LocHandle.GetCP;
|
||||
(Hamulec as TNESt3).SetLBP(LocBrakePress);
|
||||
@@ -2570,7 +2612,7 @@ begin
|
||||
else
|
||||
begin
|
||||
CompressedVolume:=CompressedVolume+dt*CompressorSpeed*(2*MaxCompressor-Compressor)/MaxCompressor;
|
||||
TotalCurrent:=0.0015*Voltage; //tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę
|
||||
TotalCurrent:=TotalCurrent+0.0015*Voltage; //tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę
|
||||
end
|
||||
else
|
||||
begin
|
||||
@@ -2636,11 +2678,11 @@ begin
|
||||
begin
|
||||
CompressedVolume:=CompressedVolume+dt*CompressorSpeed*(2*MaxCompressor-Compressor)/MaxCompressor;
|
||||
if (CompressorPower=5)and(Couplers[1].Connected<>NIL) then
|
||||
Couplers[1].Connected.TotalCurrent:=0.0015*Couplers[1].Connected.Voltage //tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę
|
||||
Couplers[1].Connected.TotalCurrent:=Couplers[1].Connected.TotalCurrent+0.0015*Couplers[1].Connected.Voltage //tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę
|
||||
else if (CompressorPower=4)and(Couplers[0].Connected<>NIL) then
|
||||
Couplers[0].Connected.TotalCurrent:=0.0015*Couplers[0].Connected.Voltage //tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę
|
||||
Couplers[0].Connected.TotalCurrent:=Couplers[0].Connected.TotalCurrent+0.0015*Couplers[0].Connected.Voltage //tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę
|
||||
else
|
||||
TotalCurrent:=0.0015*Voltage; //tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę
|
||||
TotalCurrent:=TotalCurrent+0.0015*Voltage; //tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę
|
||||
end
|
||||
end;
|
||||
end;
|
||||
@@ -2748,7 +2790,7 @@ end;
|
||||
function T_MoverParameters.FuseOn: boolean;
|
||||
begin
|
||||
FuseOn:=false;
|
||||
if (MainCtrlPos=0) and (ScndCtrlPos=0) and (TrainType<>dt_ET40) and Mains then
|
||||
if (MainCtrlPos=0) and (ScndCtrlPos=0) and (TrainType<>dt_ET40) and ((Mains) or (TrainType<>dt_EZT)) and (not TestFlag(EngDmgFlag,1)) then
|
||||
begin //w ET40 jest blokada nastawnika, ale czy działa dobrze?
|
||||
SendCtrlToNext('FuseSwitch',1,CabNo);
|
||||
if ((EngineType=ElectricSeriesMotor)or((EngineType=DieselElectric))) and FuseFlag then
|
||||
@@ -3517,7 +3559,7 @@ var OK:boolean; //b:byte;
|
||||
begin
|
||||
//Ra 2014-06: dla SN61 nie działa prawidłowo
|
||||
//rozlaczanie stycznikow liniowych
|
||||
if (not Mains) or (FuseFlag) or (MainCtrlPos=0) or (BrakePress>2.1) or (ActiveDir=0) then //hunter-111211: wylacznik cisnieniowy
|
||||
if (not Mains) or (FuseFlag) or (MainCtrlPos=0) or ((BrakePress>2.1)and(TrainType<>dt_EZT)) or (ActiveDir=0) then //hunter-111211: wylacznik cisnieniowy
|
||||
begin
|
||||
StLinFlag:=false; //yBARC - rozlaczenie stycznikow liniowych
|
||||
AutoRelayCheck:=false;
|
||||
@@ -3534,6 +3576,9 @@ begin
|
||||
//brak PSR na tej pozycji działa PSR i prąd poniżej progu na tej pozycji nie działa PSR i pozycja walu ponizej
|
||||
// chodzi w tym wszystkim o to, żeby można było zatrzymać rozruch na jakiejś pozycji wpisując Autoswitch=0 i wymuszać
|
||||
// przejście dalej przez danie nastawnika na dalszą pozycję - tak to do tej pory działało i na tym się opiera fizyka ET22-2k
|
||||
|
||||
////// LocalBrakePos:=byte(ARFASI)+2*byte(ARFASI2);
|
||||
|
||||
begin
|
||||
if (StLinFlag) then
|
||||
begin
|
||||
@@ -3652,7 +3697,7 @@ begin
|
||||
begin
|
||||
OK:=false;
|
||||
//ybARC - tutaj sa wszystkie warunki, jakie musza byc spelnione, zeby mozna byla zalaczyc styczniki liniowe
|
||||
if ((MainCtrlPos=1)or((TrainType=dt_EZT)and(MainCtrlPos>0)))and(not FuseFlag)and(Mains)and(BrakePress<1.0)and(MainCtrlActualPos=0)and(ActiveDir<>0) then
|
||||
if ((MainCtrlPos=1)or((TrainType=dt_EZT)and(MainCtrlPos>0)))and(not FuseFlag)and(Mains)and((BrakePress<1.0)or(TrainType=dt_EZT))and(MainCtrlActualPos=0)and(ActiveDir<>0) then
|
||||
begin
|
||||
DelayCtrlFlag:=true;
|
||||
if (LastRelayTime>=InitialCtrlDelay) then
|
||||
@@ -3675,7 +3720,7 @@ begin
|
||||
MainCtrlActualPos:=0;
|
||||
OK:=true;
|
||||
end
|
||||
else
|
||||
else
|
||||
if(LastRelayTime>CtrlDownDelay)then
|
||||
begin
|
||||
if(MainCtrlActualPos<RListSize)then
|
||||
@@ -3962,6 +4007,7 @@ end;
|
||||
{SILY}
|
||||
|
||||
function T_MoverParameters.TractionForce(dt:real):real;
|
||||
const kv=0.2; ksum=0.05;
|
||||
var PosRatio,dmoment,dtrans,tmp,tmpV: real;
|
||||
i: byte;
|
||||
{oblicza sile trakcyjna lokomotywy (dla elektrowozu tez calkowity prad)}
|
||||
@@ -4291,41 +4337,63 @@ begin
|
||||
ElectricInductionMotor:
|
||||
begin
|
||||
if (Mains) then //nie wchodzić w funkcję bez potrzeby
|
||||
if (Abs(Voltage)<EnginePowerSource.CollectorParameters.MinV) or (Abs(Voltage)>EnginePowerSource.CollectorParameters.MaxV) then
|
||||
if (Abs(Voltage)<EnginePowerSource.CollectorParameters.MinV) or (Abs(Voltage)>EnginePowerSource.CollectorParameters.MaxV+100) then
|
||||
begin
|
||||
MainSwitch(false);
|
||||
// tmpV:=V/(Pi*WheelDiameter)*Transmision.Ratio;//*DirAbsolute*eimc[eimc_s_p]; - do przemyslenia dzialanie pp
|
||||
end;
|
||||
tmpV:=abs(nrot)*(Pi*WheelDiameter)*3.6;//*DirAbsolute*eimc[eimc_s_p]; - do przemyslenia dzialanie pp
|
||||
if (MainS) then
|
||||
begin
|
||||
|
||||
if ((Hamulec as TLSt).GetEDBCP<0.25) and (LocHandle.GetCP<0.25) and (AnPos<0.01) then
|
||||
dtrans:=(Hamulec as TLSt).GetEDBCP;
|
||||
if ((dtrans<0.25) and (LocHandle.GetCP<0.25) and (AnPos<0.01)) or ((ShuntModeAllow) and (LocalBrakePos=0)) then
|
||||
DynamicBrakeFlag:=false
|
||||
else if (((BrakePress>0.25) and ((Hamulec as TLSt).GetEDBCP>0.25) or (LocHandle.GetCP>0.25))) or (AnPos>0.02) then
|
||||
else if (((BrakePress>0.25) and (dtrans>0.25) or (LocHandle.GetCP>0.25))) or (AnPos>0.02) then
|
||||
DynamicBrakeFlag:=true;
|
||||
|
||||
dtrans:=(Hamulec as TLSt).GetEDBCP*eimc[eimc_p_abed]; //stala napedu
|
||||
if(DynamicBrakeFlag)then
|
||||
begin
|
||||
if eimv[eimv_Fmax]*sign(V)*DirAbsolute<-1 then
|
||||
PosRatio:=-sign(V)*DirAbsolute*eimv[eimv_Fr]/(eimc[eimc_p_Fh]*Max0R((Hamulec as TLSt).GetEDBCP/MaxBrakePress[0],AnPos){dizel_fill})
|
||||
begin
|
||||
PosRatio:=-sign(V)*DirAbsolute*eimv[eimv_Fr]/(eimc[eimc_p_Fh]*Max0R(dtrans/MaxBrakePress[0],AnPos){dizel_fill});
|
||||
end
|
||||
else
|
||||
PosRatio:=0;
|
||||
PosRatio:=round(20*Posratio)/20;
|
||||
if PosRatio<19.5/20 then PosRatio:=PosRatio*0.9;
|
||||
(Hamulec as TLSt).SetED(PosRatio);
|
||||
// if PosRatio<0 then
|
||||
// PosRatio:=2+PosRatio-2;
|
||||
(Hamulec as TLSt).SetED(Max0R(0.0,Min0R(PosRatio,1)));
|
||||
// (Hamulec as TLSt).SetLBP(LocBrakePress*(1-PosRatio));
|
||||
PosRatio:=-Max0R(Min0R((Hamulec as TLSt).GetEDBCP/MaxBrakePress[0],1),AnPos)*Max0R(0,Min0R(1,(Vel-eimc[eimc_p_Vh0])/(eimc[eimc_p_Vh1]-eimc[eimc_p_Vh0])));
|
||||
eimv[eimv_Fzad]:=-Max0R(LocalBrakeRatio,(Hamulec as TLSt).GetEDBCP/MaxBrakePress[0]);
|
||||
PosRatio:=-Max0R(Min0R(dtrans/MaxBrakePress[0],1),AnPos)*Max0R(0,Min0R(1,(Vel-eimc[eimc_p_Vh0])/(eimc[eimc_p_Vh1]-eimc[eimc_p_Vh0])));
|
||||
eimv[eimv_Fzad]:=-Max0R(LocalBrakeRatio,dtrans/MaxBrakePress[0]);
|
||||
tmp:=5;
|
||||
end
|
||||
else
|
||||
begin
|
||||
PosRatio:=(MainCtrlPos/MainCtrlPosNo);
|
||||
eimv[eimv_Fzad]:=PosRatio;
|
||||
if(Flat)and(eimc[eimc_p_F0]*eimv[eimv_Fful]>0)then
|
||||
PosRatio:=Min0R(PosRatio*eimc[eimc_p_F0]/eimv[eimv_Fful],1);
|
||||
if ScndCtrlActualPos>0 then
|
||||
if (Vmax<250) then
|
||||
PosRatio:=Min0R(PosRatio,Max0R(-1,0.5*(ScndCtrlActualPos-Vel)))
|
||||
else
|
||||
PosRatio:=Min0R(PosRatio,Max0R(-1,0.5*(ScndCtrlActualPos*2-Vel)));
|
||||
PosRatio:=1.0*(PosRatio*0+1)*PosRatio;
|
||||
(Hamulec as TLSt).SetED(0);
|
||||
// (Hamulec as TLSt).SetLBP(LocBrakePress);
|
||||
if (PosRatio>dizel_fill) then tmp:=1 else tmp:=4; //szybkie malenie, powolne wzrastanie
|
||||
end;
|
||||
if SlippingWheels then begin PosRatio:=0; tmp:=10; SandDoseOn; end;//przeciwposlizg
|
||||
// if SlippingWheels then begin PosRatio:=0; tmp:=10; SandDoseOn; end;//przeciwposlizg
|
||||
|
||||
// if(Flat)then //PRZECIWPOŚLIZG
|
||||
dmoment:=eimv[eimv_Fful];
|
||||
// else
|
||||
// dmoment:=eimc[eimc_p_F0]*0.99;
|
||||
if (abs((PosRatio+9.66*dizel_fill)*dmoment*100)>Adhesive(RunningTrack.friction)*TotalMassxg) then begin PosRatio:=0; tmp:=4; SandDoseOn; end;//przeciwposlizg
|
||||
if (abs((PosRatio+9.80*dizel_fill)*dmoment*100)>Adhesive(RunningTrack.friction)*TotalMassxg) then begin PosRatio:=0; tmp:=9; SandDoseOn; end;//przeciwposlizg
|
||||
if (SlippingWheels) then begin PosRatio:=-PosRatio*0; tmp:=9; SandDoseOn; end;//przeciwposlizg
|
||||
|
||||
dizel_fill:=dizel_fill+Max0R(Min0R(PosRatio-dizel_fill,0.1),-0.1)*2*(tmp{2{+4*byte(PosRatio<dizel_fill)})*dt; //wartość zadana/procent czegoś
|
||||
|
||||
@@ -4333,12 +4401,12 @@ begin
|
||||
|
||||
eimv[eimv_Uzsmax]:=Min0R(Voltage-eimc[eimc_f_DU],tmp);
|
||||
eimv[eimv_fkr]:=eimv[eimv_Uzsmax]/eimc[eimc_f_cfu];
|
||||
if(DynamicBrakeFlag)then
|
||||
if(dizel_fill<0)then
|
||||
eimv[eimv_Pmax]:=eimc[eimc_p_Ph]
|
||||
else
|
||||
eimv[eimv_Pmax]:=Min0R(eimc[eimc_p_Pmax],0.001*Voltage*(eimc[eimc_p_Imax]-eimc[eimc_f_I0])*Pirazy2*eimc[eimc_s_cim]/eimc[eimc_s_p]/eimc[eimc_s_cfu]);
|
||||
eimv[eimv_FMAXMAX]:=0.001*SQR(Min0R(eimv[eimv_fkr]/Max0R(abs(enrot)*eimc[eimc_s_p]+eimc[eimc_s_dfmax]*eimv[eimv_ks],eimc[eimc_s_dfmax]),1)*eimc[eimc_f_cfu]/eimc[eimc_s_cfu])*(eimc[eimc_s_dfmax]*eimc[eimc_s_dfic]*eimc[eimc_s_cim])*Transmision.Ratio*NPoweredAxles*2/WheelDiameter;
|
||||
if(DynamicBrakeFlag)then
|
||||
if(dizel_fill<0)then
|
||||
begin
|
||||
eimv[eimv_Fful]:=Min0R(eimc[eimc_p_Ph]*3.6/Vel,Min0R(eimc[eimc_p_Fh],eimv[eimv_FMAXMAX]));
|
||||
eimv[eimv_Fmax]:=-sign(V)*(DirAbsolute)*Min0R(eimc[eimc_p_Ph]*3.6/Vel,Min0R(-eimc[eimc_p_Fh]*dizel_fill,eimv[eimv_FMAXMAX]));//*Min0R(1,(Vel-eimc[eimc_p_Vh0])/(eimc[eimc_p_Vh1]-eimc[eimc_p_Vh0]))
|
||||
@@ -4346,7 +4414,10 @@ begin
|
||||
else
|
||||
begin
|
||||
eimv[eimv_Fful]:=Min0R(Min0R(3.6*eimv[eimv_Pmax]/Max0R(Vel,1),eimc[eimc_p_F0]-Vel*eimc[eimc_p_a1]),eimv[eimv_FMAXMAX]);
|
||||
eimv[eimv_Fmax]:=eimv[eimv_Fful]*dizel_fill;
|
||||
// if(not Flat)then
|
||||
eimv[eimv_Fmax]:=eimv[eimv_Fful]*dizel_fill
|
||||
// else
|
||||
// eimv[eimv_Fmax]:=Min0R(eimc[eimc_p_F0]*dizel_fill,eimv[eimv_Fful]);
|
||||
end;
|
||||
|
||||
|
||||
@@ -4369,7 +4440,13 @@ begin
|
||||
eimv[eimv_eta]:=eimv[eimv_Pm]/eimv[eimv_Pe];
|
||||
|
||||
Im:=eimv[eimv_If];
|
||||
Itot:=eimv[eimv_Ipoj];
|
||||
if (eimv[eimv_Ipoj]>=0) then
|
||||
Vadd:=Vadd*(1-2*dt)
|
||||
else if (Voltage<EnginePowerSource.CollectorParameters.MaxV) then
|
||||
Vadd:=Vadd*(1-dt)
|
||||
else
|
||||
Vadd:=Max0R(Vadd*(1-0.2*dt),0.02*(Voltage-EnginePowerSource.CollectorParameters.MaxV));
|
||||
Itot:=eimv[eimv_Ipoj]*(0.01+Min0R(0.99,0.99-Vadd));
|
||||
|
||||
|
||||
EnginePower:=Abs(eimv[eimv_Ic]*eimv[eimv_U]*NPoweredAxles)/1000;
|
||||
@@ -4392,11 +4469,20 @@ begin
|
||||
else
|
||||
begin
|
||||
Im:=0;Mm:=0;Mw:=0;Fw:=0;Ft:=0;Itot:=0;dizel_fill:=0;EnginePower:=0;
|
||||
for i:=1 to 20 do
|
||||
eimv[i]:=0;
|
||||
(Hamulec as TLSt).SetED(0);RventRot:=0.0;//(Hamulec as TLSt).SetLBP(LocBrakePress);
|
||||
end;
|
||||
end;
|
||||
None: begin end;
|
||||
end; {case EngineType}
|
||||
end {case EngineType}
|
||||
else if EngineType=ElectricInductionMotor then
|
||||
begin
|
||||
Im:=0;Mm:=0;Mw:=0;Fw:=0;Ft:=0;Itot:=0;dizel_fill:=0;EnginePower:=0;
|
||||
for i:=1 to 20 do
|
||||
eimv[i]:=0;
|
||||
(Hamulec as TLSt).SetED(0);RventRot:=0.0;//(Hamulec as TLSt).SetLBP(LocBrakePress);
|
||||
end;
|
||||
TractionForce:=Ft
|
||||
end;
|
||||
|
||||
@@ -4792,11 +4878,11 @@ begin
|
||||
else
|
||||
Voltage:=RunningTraction.TractionVoltage*DirAbsolute; //ActiveDir*CabNo;
|
||||
end {bo nie dzialalo}
|
||||
else if (EngineType=ElectricInductionMotor) or (((Couplers[0].CouplingFlag and ctrain_power)=ctrain_power) or ((Couplers[1].CouplingFlag and ctrain_power)=ctrain_power)) then //potem ulepszyc! pantogtrafy!
|
||||
Voltage:=Max0R(Max0R(RunningTraction.TractionVoltage,HVCouplers[0][1]),HVCouplers[1][1])
|
||||
else
|
||||
Voltage:=0;
|
||||
if Mains and {(Abs(CabNo)<2) and} (EngineType=ElectricInductionMotor) then //potem ulepszyc! pantogtrafy!
|
||||
Voltage:=Max0R(Max0R(RunningTraction.TractionVoltage,HVCouplers[0][1]),HVCouplers[1][1]);
|
||||
//end;
|
||||
//end;
|
||||
|
||||
if Power>0 then
|
||||
FTrain:=TractionForce(dt)
|
||||
@@ -4864,17 +4950,19 @@ var b:byte;
|
||||
const Vepsilon=1e-5; Aepsilon=1e-3; //ASBSpeed=0.8;
|
||||
begin
|
||||
TotalCurrent:=0;
|
||||
hvc:=Max0R(PantFrontVolt,PantRearVolt);
|
||||
for b:=0 to 1 do //przekazywanie napiec
|
||||
if ((Couplers[b].CouplingFlag and ctrain_power) = ctrain_power)or(((Couplers[b].CouplingFlag and ctrain_heating) = ctrain_heating)and(Heating)) then
|
||||
begin
|
||||
HVCouplers[1-b][1]:=Max0R(Abs(ElectricTraction.TractionVoltage),Couplers[b].Connected.HVCouplers[Couplers[b].ConnectedNr][1]*0.99);
|
||||
HVCouplers[1-b][1]:=Max0R(Abs(hvc),Couplers[b].Connected.HVCouplers[Couplers[b].ConnectedNr][1]-HVCouplers[b][0]*0.02);
|
||||
end
|
||||
else
|
||||
HVCouplers[1-b][1]:=Abs(ElectricTraction.TractionVoltage);//Max0R(Abs(Voltage),0);
|
||||
HVCouplers[1-b][1]:=Abs(hvc)-HVCouplers[b][0]*0.02;//Max0R(Abs(Voltage),0);
|
||||
// end;
|
||||
|
||||
hvc:=HVCouplers[0][1]+HVCouplers[1][1];
|
||||
if (Abs(ElectricTraction.TractionVoltage)<1) and (hvc>1)then //bez napiecia, ale jest cos na sprzegach:
|
||||
|
||||
if (Abs(PantFrontVolt)+Abs(PantRearVolt)<1) and (hvc>1)then //bez napiecia, ale jest cos na sprzegach:
|
||||
begin
|
||||
for b:=0 to 1 do //przekazywanie pradow
|
||||
if ((Couplers[b].CouplingFlag and ctrain_power) = ctrain_power)or(((Couplers[b].CouplingFlag and ctrain_heating) = ctrain_heating)and(Heating)) then //jesli spiety
|
||||
@@ -4888,11 +4976,13 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
TotalCurrent:=HVCouplers[0][0]+HVCouplers[1][0];
|
||||
if ((Couplers[0].CouplingFlag and ctrain_power) = ctrain_power)or(((Couplers[0].CouplingFlag and ctrain_heating) = ctrain_heating)and(Heating)) then
|
||||
TotalCurrent:=TotalCurrent+Couplers[0].Connected.HVCouplers[1-Couplers[0].ConnectedNr][0];
|
||||
if ((Couplers[1].CouplingFlag and ctrain_power) = ctrain_power)or(((Couplers[1].CouplingFlag and ctrain_heating) = ctrain_heating)and(Heating)) then
|
||||
TotalCurrent:=TotalCurrent+Couplers[1].Connected.HVCouplers[1-Couplers[1].ConnectedNr][0];
|
||||
HVCouplers[0][0]:=0;
|
||||
HVCouplers[1][0]:=0;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
ClearPendingExceptions;
|
||||
if not TestFlag(DamageFlag,dtrain_out) then
|
||||
@@ -5188,6 +5278,14 @@ Begin
|
||||
end
|
||||
else if command='ScndCtrl' then
|
||||
begin
|
||||
if (EngineType=ElectricInductionMotor) then
|
||||
if (ScndCtrlPos=0) and (Trunc(CValue1)>0) then
|
||||
if (Vmax<250) then
|
||||
ScndCtrlActualPos:=Round(Vel+0.5)
|
||||
else
|
||||
ScndCtrlActualPos:=Round(Vel/2+0.5)
|
||||
else if (Trunc(CValue1)=0) then
|
||||
ScndCtrlActualPos:=0;
|
||||
if ScndCtrlPosNo>=Trunc(CValue1) then
|
||||
ScndCtrlPos:=Trunc(CValue1);
|
||||
OK:=SendCtrlToNext(command,CValue1,CValue2);
|
||||
@@ -5431,7 +5529,7 @@ Begin
|
||||
end
|
||||
else if command='Emergency_brake' then
|
||||
begin
|
||||
if EmergencyBrakeSwitch(Trunc(CValue1)=1) then
|
||||
if EmergencyBrakeSwitch(Trunc(CValue1)=1) then //YB: czy to jest potrzebne?
|
||||
OK:=true
|
||||
else OK:=false;
|
||||
end
|
||||
@@ -5558,6 +5656,8 @@ begin
|
||||
end;
|
||||
WheelDiameter:=1.0;
|
||||
BrakeCtrlPosNo:=0;
|
||||
LightsPosNo:=0;
|
||||
LightsDefPos:=1;
|
||||
for k:=-1 to MainBrakeMaxPos do
|
||||
with BrakePressureTable[k] do
|
||||
begin
|
||||
@@ -5637,6 +5737,9 @@ begin
|
||||
InsideConsist:=false;
|
||||
CompressorPower:=1;
|
||||
SmallCompressorPower:=0;
|
||||
for b:=0 to 25 do
|
||||
eimc[b]:=0;
|
||||
eimc[eimc_p_eped]:=1.5;
|
||||
|
||||
ScndInMain:=false;
|
||||
|
||||
@@ -5668,6 +5771,7 @@ begin
|
||||
ScndCtrlPos:=0;
|
||||
MainCtrlActualPos:=0;
|
||||
ScndCtrlActualPos:=0;
|
||||
LightsPos:=0;
|
||||
Heating:=false;
|
||||
Mains:=false;
|
||||
ActiveDir:=0; //kierunek nie ustawiony
|
||||
@@ -5731,6 +5835,8 @@ begin
|
||||
dizel_enginestart:=false;
|
||||
dizel_engagedeltaomega:=0;
|
||||
PhysicActivation:=true;
|
||||
for b:=1 to 20 do
|
||||
eimv[b]:=0;
|
||||
|
||||
with RunningShape do
|
||||
begin
|
||||
@@ -5911,6 +6017,10 @@ case BrakeValve of
|
||||
EStED :begin
|
||||
Hamulec := TEStED.Create(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
(Hamulec as TEStED).SetRM(RapidMult);
|
||||
if(MBPM<2)then //jesli przystawka wazaca
|
||||
(Hamulec as TEStED).SetLP(0,MaxBrakePress[3],0)
|
||||
else
|
||||
(Hamulec as TEStED).SetLP(Mass, MBPM, MaxBrakePress[1]);
|
||||
end;
|
||||
EP2:begin
|
||||
Hamulec :=TEStEP2.Create(MaxBrakePress[3], BrakeCylRadius, BrakeCylDist, BrakeVVolume, BrakeCylNo, BrakeDelays, BrakeMethod, NAxles, NBpA);
|
||||
@@ -5943,6 +6053,8 @@ case BrakeLocHandle of
|
||||
begin
|
||||
LocHandle := TFD1.Create;
|
||||
LocHandle.Init(MaxBrakePress[0]);
|
||||
if(TrainType=dt_EZT)then
|
||||
(LocHandle as TFD1).SetSpeed(3.5);
|
||||
end;
|
||||
Knorr:
|
||||
begin
|
||||
@@ -5964,7 +6076,9 @@ end;
|
||||
Pipe.CreateCap((Max0R(Dim.L,14)+0.5)*Spg*1); //dlugosc x przekroj x odejscia i takie tam
|
||||
Pipe2.CreateCap((Max0R(Dim.L,14)+0.5)*Spg*1);
|
||||
|
||||
{to dac potem do init}
|
||||
if LightsPosNo>0 then LightsPos:=LightsDefPos;
|
||||
|
||||
{to dac potem do init}
|
||||
if ReadyFlag then {gotowy do drogi}
|
||||
begin
|
||||
CompressedVolume:=VeselVolume*MinCompressor*(9.8+Random)/10;
|
||||
@@ -5992,8 +6106,8 @@ end;
|
||||
CompressedVolume:=VeselVolume*MinCompressor*0.55;
|
||||
ScndPipePress:=5.1;
|
||||
PipePress:=LowPipePress;
|
||||
PipeBrakePress:=MaxBrakePress[3];
|
||||
BrakePress:=MaxBrakePress[3];
|
||||
PipeBrakePress:=MaxBrakePress[3]*0.5;
|
||||
BrakePress:=MaxBrakePress[3]*0.5;
|
||||
LocalBrakePos:=0;
|
||||
// if (BrakeSystem=Pneumatic) and (BrakeCtrlPosNo>0) then
|
||||
// BrakeCtrlPos:=-2; //Ra: hamulec jest poprawiany w DynObj.cpp
|
||||
@@ -6578,6 +6692,7 @@ begin
|
||||
if s='P10-Bg' then BrakeMethod:=bp_P10Bg else
|
||||
if s='P10-Bgu' then BrakeMethod:=bp_P10Bgu else
|
||||
if s='FR513' then BrakeMethod:=bp_FR513 else
|
||||
if s='FR510' then BrakeMethod:=bp_FR510 else
|
||||
if s='Cosid' then BrakeMethod:=bp_Cosid else
|
||||
if s='P10yBg' then BrakeMethod:=bp_P10yBg else
|
||||
if s='P10yBgu' then BrakeMethod:=bp_P10yBgu else
|
||||
@@ -6656,6 +6771,7 @@ begin
|
||||
s:=DUE(ExtractKeyWord(lines,'DoorOpenMethod='));
|
||||
if s='Shift' then DoorOpenMethod:=1 //przesuw
|
||||
else if s='Fold' then DoorOpenMethod:=3 //3 submodele się obracają
|
||||
else if s='Plug' then DoorOpenMethod:=4 //odskokowo-przesuwne
|
||||
else
|
||||
DoorOpenMethod:=2; //obrót
|
||||
s:=DUE(ExtractKeyWord(lines,'DoorClosureWarning='));
|
||||
@@ -6667,6 +6783,16 @@ begin
|
||||
if s='Yes' then DoorBlocked:=true
|
||||
else
|
||||
DoorBlocked:=false;
|
||||
s:=ExtractKeyWord(lines,'DoorMaxShiftPlug=');
|
||||
DoorMaxPlugShift:=s2r(DUE(s));
|
||||
s:=ExtractKeyWord(lines,'PlatformSpeed=');
|
||||
PlatformSpeed:=s2r(DUE(s));
|
||||
s:=ExtractKeyWord(lines,'PlatformMaxSpeed=');
|
||||
PlatformMaxShift:=s2r(DUE(s));
|
||||
s:=DUE(ExtractKeyWord(lines,'PlatformOpenMethod='));
|
||||
if s='Shift' then PlatformOpenMethod:=1 //przesuw
|
||||
else
|
||||
PlatformOpenMethod:=2; //obrót
|
||||
end
|
||||
else if (Pos('BuffCoupl.',lines)>0) or (Pos('BuffCoupl1.',lines)>0) then {zderzaki i sprzegi}
|
||||
begin
|
||||
@@ -7183,7 +7309,9 @@ begin
|
||||
s:=ExtractKeyWord(lines,'Vh0='); eimc[eimc_p_Vh0]:=s2r(DUE(s));
|
||||
s:=ExtractKeyWord(lines,'Vh1='); eimc[eimc_p_Vh1]:=s2r(DUE(s));
|
||||
s:=ExtractKeyWord(lines,'Imax='); eimc[eimc_p_Imax]:=s2r(DUE(s));
|
||||
|
||||
s:=ExtractKeyWord(lines,'abed='); if DUE(s)<>'' then eimc[eimc_p_abed]:=s2r(DUE(s));
|
||||
s:=ExtractKeyWord(lines,'edep='); if DUE(s)<>'' then eimc[eimc_p_eped]:=s2r(DUE(s));
|
||||
s:=ExtractKeyWord(lines,'Flat='); if DUE(s)='Yes' then Flat:=true else Flat:=false;
|
||||
end;
|
||||
|
||||
else ConversionError:=-13; {not implemented yet!}
|
||||
@@ -7377,6 +7505,14 @@ begin
|
||||
RListSize:=s2b(DUE(ExtractKeyWord(lines,'Size=')));
|
||||
for k:=0 to RListSize do
|
||||
readln(fin, DEList[k].rpm, DEList[k].genpower)
|
||||
end
|
||||
else if (Pos('LightsList:',lines)>0) then {dla asynchronow}
|
||||
begin
|
||||
LightsPosNo:=s2b(DUE(ExtractKeyWord(lines,'Size=')));
|
||||
LightsWrap:=('Yes')=(DUE(ExtractKeyWord(lines,'Wrap=')));
|
||||
LightsDefPos:=s2b(DUE(ExtractKeyWord(lines,'Default=')));
|
||||
for k:=1 to LightsPosNo do
|
||||
readln(fin, Lights[0][k], Lights[1][k])
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
@@ -322,11 +322,17 @@ private:
|
||||
bool Zamykajacy;
|
||||
bool Przys_blok;
|
||||
TReservoir* Miedzypoj;
|
||||
double TareM;
|
||||
double LoadM;
|
||||
double TareBP;
|
||||
double LoadC;
|
||||
|
||||
public:
|
||||
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
|
||||
virtual double __fastcall GetPF(double PP, double dt, double Vel);
|
||||
virtual double __fastcall GetEDBCP(void);
|
||||
void __fastcall PLC(double mass);
|
||||
void __fastcall SetLP(double TM, double LM, double TBP);
|
||||
public:
|
||||
#pragma option push -w-inl
|
||||
/* TBrake.Create */ inline __fastcall TEStED(double i_mbp, double i_bcr, double i_bcd, double i_brc
|
||||
@@ -692,9 +698,11 @@ private:
|
||||
double BP;
|
||||
|
||||
public:
|
||||
double Speed;
|
||||
virtual double __fastcall GetPF(double i_bcp, double pp, double hp, double dt, double ep);
|
||||
virtual void __fastcall Init(double press);
|
||||
virtual double __fastcall GetCP(void);
|
||||
void __fastcall SetSpeed(double nSpeed);
|
||||
public:
|
||||
#pragma option push -w-inl
|
||||
/* TObject.Create */ inline __fastcall TFD1(void) : THandle() { }
|
||||
@@ -802,6 +810,7 @@ static const Shortint bp_PKPBgu = 0xe;
|
||||
static const Byte bp_MHS = 0x80;
|
||||
static const Shortint bp_P10yBg = 0xf;
|
||||
static const Shortint bp_P10yBgu = 0x10;
|
||||
static const Shortint bp_FR510 = 0x11;
|
||||
static const Shortint sf_Acc = 0x1;
|
||||
static const Shortint sf_BR = 0x2;
|
||||
static const Shortint sf_CylB = 0x4;
|
||||
|
||||
@@ -95,6 +95,7 @@ CONST
|
||||
bp_MHS = 128; //magnetyczny hamulec szynowy
|
||||
bp_P10yBg = 15; //żeliwo fosforowe P10
|
||||
bp_P10yBgu= 16;
|
||||
bp_FR510 = 17; //Frenoplast FR510
|
||||
|
||||
sf_Acc = 1; //przyspieszacz
|
||||
sf_BR = 2; //przekladnia
|
||||
@@ -289,10 +290,15 @@ TYPE
|
||||
Zamykajacy: boolean; //pamiec zaworka zamykajacego
|
||||
Przys_blok: boolean; //blokada przyspieszacza
|
||||
Miedzypoj: TReservoir; //pojemnosc posrednia (urojona) do napelniania ZP i ZS
|
||||
TareM, LoadM: real; //masa proznego i pelnego
|
||||
TareBP: real; //cisnienie dla proznego
|
||||
LoadC: real;
|
||||
public
|
||||
procedure Init(PP, HPP, LPP, BP: real; BDF: byte); override;
|
||||
function GetPF(PP, dt, Vel: real): real; override; //przeplyw miedzy komora wstepna i PG
|
||||
function GetEDBCP: real; override; //cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
|
||||
procedure PLC(mass: real); //wspolczynnik cisnienia przystawki wazacej
|
||||
procedure SetLP(TM, LM, TBP: real); //parametry przystawki wazacej
|
||||
end;
|
||||
|
||||
TEStEP2= class(TLSt)
|
||||
@@ -489,9 +495,11 @@ TYPE
|
||||
MaxBP: real; //najwyzsze cisnienie
|
||||
BP: real; //aktualne cisnienie
|
||||
public
|
||||
Speed: real; //szybkosc dzialania
|
||||
function GetPF(i_bcp:real; pp, hp, dt, ep: real): real; override;
|
||||
procedure Init(press: real); override;
|
||||
function GetCP(): real; override;
|
||||
procedure SetSpeed(nSpeed: real);
|
||||
// procedure Init(press: real; MaxBP: real); overload;
|
||||
end;
|
||||
|
||||
@@ -771,6 +779,7 @@ begin
|
||||
bp_P10Bg: FM:=TP10Bg.Create;
|
||||
bp_P10Bgu: FM:=TP10Bgu.Create;
|
||||
bp_FR513: FM:=TFR513.Create;
|
||||
bp_FR510: FM:=TFR510.Create;
|
||||
bp_Cosid: FM:=TCosid.Create;
|
||||
bp_P10yBg: FM:=TP10yBg.Create;
|
||||
bp_P10yBgu: FM:=TP10yBgu.Create;
|
||||
@@ -1815,18 +1824,18 @@ begin
|
||||
|
||||
|
||||
RapidTemp:=RapidTemp+(RM*Byte((Vel>55)and(BrakeDelayFlag=bdelay_R))-RapidTemp)*dt/2;
|
||||
temp:=1-RapidTemp;
|
||||
temp:=Max0R(1-RapidTemp,0.001);
|
||||
// if EDFlag then temp:=1000;
|
||||
// temp:=temp/(1-);
|
||||
|
||||
//powtarzacz <20> podwojny zawor zwrotny
|
||||
temp:=Max0R(BCP/temp*Min0R(Max0R(1-EDFlag,0),1),LBP);
|
||||
temp:=Max0R(LoadC*BCP/temp*Min0R(Max0R(1-EDFlag,0),1),LBP);
|
||||
|
||||
if(BrakeCyl.P>temp)then
|
||||
dV:=-PFVd(BrakeCyl.P,0,0.02,temp)*dt
|
||||
dV:=-PFVd(BrakeCyl.P,0,0.02*sizeBC,temp)*dt
|
||||
else
|
||||
if(BrakeCyl.P<temp)then
|
||||
dV:=PFVa(BVP,BrakeCyl.P,0.02,temp)*dt
|
||||
dV:=PFVa(BVP,BrakeCyl.P,0.02*sizeBC,temp)*dt
|
||||
else dV:=0;
|
||||
|
||||
BrakeCyl.Flow(dV);
|
||||
@@ -1915,9 +1924,20 @@ end;
|
||||
|
||||
function TEStED.GetEDBCP: real;
|
||||
begin
|
||||
GetEDBCP:=ImplsRes.P;
|
||||
GetEDBCP:=ImplsRes.P*LoadC;
|
||||
end;
|
||||
|
||||
procedure TEStED.PLC(mass: real);
|
||||
begin
|
||||
LoadC:=1+Byte(Mass<LoadM)*((TareBP+(MaxBP-TareBP)*(mass-TareM)/(LoadM-TareM))/MaxBP-1);
|
||||
end;
|
||||
|
||||
procedure TEStED.SetLP(TM, LM, TBP: real);
|
||||
begin
|
||||
TareM:=TM;
|
||||
LoadM:=LM;
|
||||
TareBP:=TBP;
|
||||
end;
|
||||
|
||||
|
||||
//---DAKO CV1---
|
||||
@@ -2898,7 +2918,7 @@ begin
|
||||
// MaxBP:=4;
|
||||
// temp:=Min0R(i_bcp*MaxBP,Min0R(5.0,HP));
|
||||
temp:=Min0R(i_bcp*MaxBP,HP); //0011
|
||||
dp:=10*Min0R(abs(temp-BP),0.1)*PF(temp,BP,0.0006*(2+Byte(temp>BP)))*dt;
|
||||
dp:=10*Min0R(abs(temp-BP),0.1)*PF(temp,BP,0.0006*(2+Byte(temp>BP)))*dt*Speed;
|
||||
BP:=BP-dp;
|
||||
GetPF:=-dp;
|
||||
end;
|
||||
@@ -2909,6 +2929,7 @@ begin
|
||||
MaxBP:=press;
|
||||
Time:=false;
|
||||
TimeEP:=false;
|
||||
Speed:=1;
|
||||
end;
|
||||
|
||||
function TFD1.GetCP: real;
|
||||
@@ -2916,6 +2937,11 @@ begin
|
||||
GetCP:=BP;
|
||||
end;
|
||||
|
||||
procedure TFD1.SetSpeed(nSpeed: real);
|
||||
begin
|
||||
Speed:=nSpeed;
|
||||
end;
|
||||
|
||||
|
||||
//---KNORR---
|
||||
|
||||
|
||||
@@ -625,8 +625,8 @@ double TMoverParameters::ShowEngineRotation(int VehN)
|
||||
|
||||
void TMoverParameters::ConverterCheck()
|
||||
{ // sprawdzanie przetwornicy
|
||||
if (ConverterAllow && Mains)
|
||||
ConverterFlag = true;
|
||||
if (ConverterAllow && Mains && !ConvOvldFlag)
|
||||
ConverterFlag = true;
|
||||
else
|
||||
ConverterFlag = false;
|
||||
};
|
||||
|
||||
2
PyInt.h
2
PyInt.h
@@ -10,9 +10,11 @@
|
||||
#include <set>
|
||||
|
||||
#define PyGetFloat(param) PyFloat_FromDouble(param >= 0 ? param : -param)
|
||||
#define PyGetFloatS(param) PyFloat_FromDouble(param)
|
||||
#define PyGetInt(param) PyInt_FromLong(param)
|
||||
#define PyGetFloatS(param) PyFloat_FromDouble(param)
|
||||
#define PyGetBool(param) param ? Py_True : Py_False
|
||||
#define PyGetString(param) PyString_FromString(param)
|
||||
|
||||
struct ltstr
|
||||
{
|
||||
|
||||
@@ -680,7 +680,7 @@ double TTraction::VoltageGet(double u, double i)
|
||||
// 1. zasilacz psPower[0] z rezystancją fResistance[0] oraz jego wewnętrzną
|
||||
// 2. zasilacz psPower[1] z rezystancją fResistance[1] oraz jego wewnętrzną
|
||||
// 3. zasilacz psPowered z jego wewnętrzną rezystancją dla przęseł zasilanych bezpośrednio
|
||||
double res = (i != 0.0) ? fabs(u / i) : 10000.0;
|
||||
double res = (i != 0.0) ? (u / i) : 10000.0;
|
||||
if (psPowered)
|
||||
return psPowered->CurrentGet(res) *
|
||||
res; // yB: dla zasilanego nie baw się w gwiazdy, tylko bierz bezpośrednio
|
||||
|
||||
@@ -98,7 +98,10 @@ bool TTractionPowerSource::Render()
|
||||
|
||||
bool TTractionPowerSource::Update(double dt)
|
||||
{ // powinno byæ wykonane raz na krok fizyki
|
||||
if (NominalVoltage * TotalPreviousAdmitance >
|
||||
// if (NominalVoltage * TotalPreviousAdmitance >
|
||||
// MaxOutputCurrent * 0.00000005) // iloczyn napiêcia i admitancji daje pr¹d
|
||||
// ErrorLog("Power overload: \"" + gMyNode->asName + "\" with current " + AnsiString(NominalVoltage * TotalPreviousAdmitance) + "A");
|
||||
if (NominalVoltage * TotalPreviousAdmitance >
|
||||
MaxOutputCurrent) // iloczyn napiêcia i admitancji daje pr¹d
|
||||
{
|
||||
FastFuse = true;
|
||||
@@ -145,14 +148,15 @@ double TTractionPowerSource::CurrentGet(double res)
|
||||
FuseTimer = 0;
|
||||
return 0;
|
||||
}
|
||||
if ((res > 0) || ((res < 0) && (Recuperation)))
|
||||
TotalAdmitance +=
|
||||
if ((res > 0) || ((res < 0) && (Recuperation || true)))
|
||||
TotalAdmitance +=
|
||||
1.0 / res; // po³¹czenie równoleg³e rezystancji jest równowa¿ne sumie admitancji
|
||||
TotalCurrent = (TotalPreviousAdmitance != 0.0) ?
|
||||
NominalVoltage / (InternalRes + 1.0 / TotalPreviousAdmitance) :
|
||||
0.0; // napiêcie dzielone przez sumê rezystancji wewnêtrznej i obci¹¿enia
|
||||
OutputVoltage = NominalVoltage - InternalRes * TotalCurrent; // napiêcie na obci¹¿eniu
|
||||
return TotalCurrent / (res * TotalPreviousAdmitance); // pr¹d proporcjonalny do udzia³u (1/res)
|
||||
float NomVolt = (TotalPreviousAdmitance < 0 ? NominalVoltage * 1.083 : NominalVoltage);
|
||||
TotalCurrent = (TotalPreviousAdmitance != 0.0) ?
|
||||
NomVolt / (InternalRes + 1.0 / TotalPreviousAdmitance) :
|
||||
0.0; // napiêcie dzielone przez sumê rezystancji wewnêtrznej i obci¹¿enia
|
||||
OutputVoltage = NomVolt - InternalRes * TotalCurrent; // napiêcie na obci¹¿eniu
|
||||
return TotalCurrent / (res * TotalPreviousAdmitance); // pr¹d proporcjonalny do udzia³u (1/res)
|
||||
// w ca³kowitej admitancji
|
||||
};
|
||||
|
||||
|
||||
248
Train.cpp
248
Train.cpp
@@ -270,7 +270,8 @@ PyObject *TTrain::GetTrainState()
|
||||
}
|
||||
|
||||
PyDict_SetItemString(dict, "direction", PyGetInt(DynamicObject->MoverParameters->ActiveDir));
|
||||
PyDict_SetItemString(dict, "slipping_wheels",
|
||||
PyDict_SetItemString(dict, "cab", PyGetInt(DynamicObject->MoverParameters->ActiveCab));
|
||||
PyDict_SetItemString(dict, "slipping_wheels",
|
||||
PyGetBool(DynamicObject->MoverParameters->SlippingWheels));
|
||||
PyDict_SetItemString(dict, "converter",
|
||||
PyGetBool(DynamicObject->MoverParameters->ConverterFlag));
|
||||
@@ -290,16 +291,59 @@ PyObject *TTrain::GetTrainState()
|
||||
PyDict_SetItemString(dict, "minutes", PyGetInt(GlobalTime->mm));
|
||||
PyDict_SetItemString(dict, "seconds", PyGetInt(GlobalTime->mr));
|
||||
PyDict_SetItemString(dict, "velocity_desired", PyGetFloat(DynamicObject->Mechanik->VelDesired));
|
||||
Char* TXTT[10] = { "fd", "fdt", "fdb", "pd", "pdt", "pdb", "itothv", "1", "2", "3" };
|
||||
Char* TXTC[10] = { "fr", "frt", "frb", "pr", "prt", "prb", "im", "vm", "ihv", "uhv" };
|
||||
Char* TXTT[10] = { "fd","fdt","fdb","pd","pdt","pdb","itothv","1","2","3" };
|
||||
Char* TXTC[10] = { "fr","frt","frb","pr","prt","prb","im","vm","ihv","uhv" };
|
||||
Char* TXTP[3] = { "bc","bp","sp" };
|
||||
for (int j = 0; j<10; j++)
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_t_") + AnsiString(TXTT[j])).c_str(), PyGetFloatS(fEIMParams[0][j]));
|
||||
for (int i = 0; i<8; i++)
|
||||
{
|
||||
for (int j = 0; j<10; j++)
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_c") + IntToStr(i + 1) + AnsiString("_") + AnsiString(TXTC[j])).c_str(), PyGetFloatS(fEIMParams[i + 1][j]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_c") + IntToStr(i + 1) + AnsiString("_ms")).c_str(), PyGetBool(bMains[i]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_c") + IntToStr(i + 1) + AnsiString("_cv")).c_str(), PyGetFloatS(fCntVol[i]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_u") + IntToStr(i + 1) + AnsiString("_pf")).c_str(), PyGetBool(bPants[i][0]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_u") + IntToStr(i + 1) + AnsiString("_pr")).c_str(), PyGetBool(bPants[i][1]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_c") + IntToStr(i + 1) + AnsiString("_fuse")).c_str(), PyGetBool(bFuse[i]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_c") + IntToStr(i + 1) + AnsiString("_batt")).c_str(), PyGetBool(bBatt[i]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_c") + IntToStr(i + 1) + AnsiString("_conv")).c_str(), PyGetBool(bConv[i]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_u") + IntToStr(i + 1) + AnsiString("_comp_a")).c_str(), PyGetBool(bComp[i][0]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_u") + IntToStr(i + 1) + AnsiString("_comp_w")).c_str(), PyGetBool(bComp[i][1]));
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_c") + IntToStr(i + 1) + AnsiString("_heat")).c_str(), PyGetBool(bHeat[i]));
|
||||
|
||||
}
|
||||
for (int i = 0; i<20; i++)
|
||||
{
|
||||
for (int j = 0; j<3; j++)
|
||||
PyDict_SetItemString(dict, (AnsiString("eimp_pn") + IntToStr(i + 1) + AnsiString("_") + AnsiString(TXTP[j])).c_str(),
|
||||
PyGetFloatS(fPress[i][j]));
|
||||
}
|
||||
bool bEP, bPN;
|
||||
bEP = (mvControlled->LocHandle->GetCP()>0.2) || (fEIMParams[0][2]>0.01);
|
||||
PyDict_SetItemString(dict, "dir_brake", PyGetBool(bEP));
|
||||
if (mvControlled->Hamulec->ClassNameIs("TLSt") || mvControlled->Hamulec->ClassNameIs("TEStED"))
|
||||
{
|
||||
TBrake* temp_ham = mvControlled->Hamulec;
|
||||
// TLSt* temp_ham2 = temp_ham;
|
||||
bPN = (static_cast<TLSt*>(temp_ham)->GetEDBCP()>0.2);
|
||||
}
|
||||
else
|
||||
bPN = false;
|
||||
PyDict_SetItemString(dict, "indir_brake", PyGetBool(bPN));
|
||||
for (int i = 0; i<20; i++)
|
||||
{
|
||||
PyDict_SetItemString(dict, (AnsiString("doors_") + IntToStr(i + 1)).c_str(), PyGetFloatS(bDoors[i][0]));
|
||||
PyDict_SetItemString(dict, (AnsiString("doors_r_") + IntToStr(i + 1)).c_str(), PyGetFloatS(bDoors[i][1]));
|
||||
PyDict_SetItemString(dict, (AnsiString("doors_l_") + IntToStr(i + 1)).c_str(), PyGetFloatS(bDoors[i][2]));
|
||||
PyDict_SetItemString(dict, (AnsiString("doors_no_") + IntToStr(i + 1)).c_str(), PyGetInt(iDoorNo[i]));
|
||||
PyDict_SetItemString(dict, (AnsiString("code_") + IntToStr(i + 1)).c_str(), PyGetString(AnsiString(IntToStr(iUnits[i]) +
|
||||
cCode[i]).c_str()));
|
||||
PyDict_SetItemString(dict, (AnsiString("car_name") + IntToStr(i + 1)).c_str(), PyGetString(asCarName[i].c_str()));
|
||||
}
|
||||
PyDict_SetItemString(dict, "car_no", PyGetInt(iCarNo));
|
||||
PyDict_SetItemString(dict, "power_no", PyGetInt(iPowerNo));
|
||||
return dict;
|
||||
PyDict_SetItemString(dict, "unit_no", PyGetInt(iUnitNo));
|
||||
return dict;
|
||||
}
|
||||
|
||||
void TTrain::OnKeyDown(int cKey)
|
||||
@@ -325,12 +369,12 @@ void TTrain::OnKeyDown(int cKey)
|
||||
}
|
||||
else if (cKey == Global::Keys[k_DirectionBackward])
|
||||
{
|
||||
if (mvControlled->Radio == false)
|
||||
if (mvOccupied->Radio == false)
|
||||
if (GetAsyncKeyState(VK_CONTROL) >= 0)
|
||||
{
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
mvControlled->Radio = true;
|
||||
mvOccupied->Radio = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -898,8 +942,21 @@ void TTrain::OnKeyDown(int cKey)
|
||||
else if (cKey == Global::Keys[k_UpperSign]) // ABu 060205: œwiat³o górne -
|
||||
// w³¹czenie
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
(ggRearUpperLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu
|
||||
if (mvOccupied->LightsPosNo > 0) //krêciolek od swiatel
|
||||
{
|
||||
if ((mvOccupied->LightsPos < mvOccupied->LightsPosNo) || (mvOccupied->LightsWrap))
|
||||
{
|
||||
mvOccupied->LightsPos++;
|
||||
if (mvOccupied->LightsPos > mvOccupied->LightsPosNo)
|
||||
{
|
||||
mvOccupied->LightsPos = 1;
|
||||
}
|
||||
SetLights();
|
||||
}
|
||||
|
||||
}
|
||||
else if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
(ggRearUpperLightButton.SubModel)) // hunter-230112 - z controlem zapala z tylu
|
||||
{
|
||||
//------------------------------
|
||||
if ((mvOccupied->ActiveCab) == 1)
|
||||
@@ -1329,7 +1386,8 @@ void TTrain::OnKeyDown(int cKey)
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0) // z controlem
|
||||
{
|
||||
ggConverterFuseButton.PutValue(1); // hunter-261211
|
||||
if ((mvControlled->Mains == false) && (ggConverterButton.GetValue() == 0))
|
||||
if ((mvControlled->Mains == false) && (ggConverterButton.GetValue() == 0) &&
|
||||
(mvControlled->TrainType != dt_EZT))
|
||||
mvControlled->ConvOvldFlag = false;
|
||||
}
|
||||
else
|
||||
@@ -1369,11 +1427,11 @@ void TTrain::OnKeyDown(int cKey)
|
||||
{
|
||||
if (GetAsyncKeyState(VK_CONTROL) < 0)
|
||||
{ // wciœniêty [Ctrl]
|
||||
if (mvControlled->Radio == true)
|
||||
if (mvOccupied->Radio == true)
|
||||
{
|
||||
dsbSwitch->SetVolume(DSBVOLUME_MAX);
|
||||
dsbSwitch->Play(0, 0, 0);
|
||||
mvControlled->Radio = false;
|
||||
mvOccupied->Radio = false;
|
||||
}
|
||||
}
|
||||
else if (mvOccupied->DirectionBackward())
|
||||
@@ -2085,8 +2143,20 @@ if
|
||||
else if (cKey == Global::Keys[k_UpperSign]) // ABu 060205: œwiat³o górne -
|
||||
// wy³¹czenie
|
||||
{
|
||||
if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
(ggRearUpperLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||
if (mvOccupied->LightsPosNo > 0) //krêciolek od swiatel
|
||||
{
|
||||
if ((mvOccupied->LightsPos > 1) || (mvOccupied->LightsWrap))
|
||||
{
|
||||
mvOccupied->LightsPos--;
|
||||
if (mvOccupied->LightsPos < 1)
|
||||
{
|
||||
mvOccupied->LightsPos = mvOccupied->LightsPosNo;
|
||||
}
|
||||
SetLights();
|
||||
}
|
||||
}
|
||||
else if ((GetAsyncKeyState(VK_CONTROL) < 0) &&
|
||||
(ggRearUpperLightButton.SubModel)) // hunter-230112 - z controlem gasi z tylu
|
||||
{
|
||||
//------------------------------
|
||||
if (mvOccupied->ActiveCab == 1)
|
||||
@@ -2578,20 +2648,49 @@ bool TTrain::Update()
|
||||
fHCurrent[3] = mvControlled->ShowCurrent(3);
|
||||
}
|
||||
|
||||
TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->ActiveCab < 0 ? 1 : 0);
|
||||
bool kier = (DynamicObject->DirectionGet()*mvOccupied->ActiveCab > 0);
|
||||
TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->ActiveCab < 0 ? 1 : 0);
|
||||
int in = 0;
|
||||
fEIMParams[0][6] = 0;
|
||||
iCarNo = 0;
|
||||
iPowerNo = 0;
|
||||
for (int i = 0; i < 20; i++)
|
||||
iUnitNo = 1;
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
bMains[i] = false;
|
||||
fCntVol[i] = 0.0f;
|
||||
bPants[i][0] = false;
|
||||
bPants[i][1] = false;
|
||||
bFuse[i] = false;
|
||||
bBatt[i] = false;
|
||||
bConv[i] = false;
|
||||
bComp[i][0] = false;
|
||||
bComp[i][1] = false;
|
||||
bHeat[i] = false;
|
||||
}
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
fPress[i][0] = p->MoverParameters->BrakePress;
|
||||
fPress[i][1] = p->MoverParameters->PipePress;
|
||||
fPress[i][2] = p->MoverParameters->ScndPipePress;
|
||||
bDoors[i] = (p->dDoorMoveL > 0.001) || (p->dDoorMoveR > 0.001);
|
||||
if ((in < 8) && (p->MoverParameters->eimc[eimc_p_Pmax] > 1))
|
||||
bDoors[i][0] = (p->dDoorMoveL > 0.001) || (p->dDoorMoveR > 0.001);
|
||||
bDoors[i][1] = (p->dDoorMoveR > 0.001);
|
||||
bDoors[i][2] = (p->dDoorMoveL > 0.001);
|
||||
iDoorNo[i] = p->iAnimType[ANIM_DOORS];
|
||||
iUnits[i] = iUnitNo;
|
||||
cCode[i] = p->MoverParameters->TypeName[p->MoverParameters->TypeName.Length()];
|
||||
asCarName[i] = p->GetName();
|
||||
bPants[iUnitNo - 1][0] = (bPants[iUnitNo - 1][0] || p->MoverParameters->PantFrontUp);
|
||||
bPants[iUnitNo - 1][1] = (bPants[iUnitNo - 1][1] || p->MoverParameters->PantRearUp);
|
||||
bComp[iUnitNo - 1][0] = (bComp[iUnitNo - 1][0] || p->MoverParameters->CompressorAllow);
|
||||
if (p->MoverParameters->CompressorSpeed>0.00001)
|
||||
{
|
||||
bComp[iUnitNo - 1][1] = (bComp[iUnitNo - 1][1] || p->MoverParameters->CompressorFlag);
|
||||
}
|
||||
if ((in < 8) && (p->MoverParameters->eimc[eimc_p_Pmax] > 1))
|
||||
{
|
||||
fEIMParams[1 + in][0] = p->MoverParameters->eimv[eimv_Fr];
|
||||
fEIMParams[1 + in][1] = Max0R(fEIMParams[1 + in][0], 0);
|
||||
@@ -2602,22 +2701,36 @@ bool TTrain::Update()
|
||||
fEIMParams[1 + in][5] = -Min0R(fEIMParams[1 + in][3], 0);
|
||||
fEIMParams[1 + in][6] = p->MoverParameters->eimv[eimv_If];
|
||||
fEIMParams[1 + in][7] = p->MoverParameters->eimv[eimv_U];
|
||||
fEIMParams[1 + in][8] = p->MoverParameters->eimv[eimv_Ipoj];
|
||||
fEIMParams[1 + in][9] = p->MoverParameters->Voltage;
|
||||
fEIMParams[1 + in][8] = p->MoverParameters->Itot;//p->MoverParameters->eimv[eimv_Ipoj];
|
||||
fEIMParams[1 + in][9] = p->MoverParameters->Voltage;
|
||||
fEIMParams[0][6] += fEIMParams[1 + in][8];
|
||||
in++;
|
||||
bMains[in] = p->MoverParameters->Mains;
|
||||
fCntVol[in] = p->MoverParameters->BatteryVoltage;
|
||||
bFuse[in] = p->MoverParameters->FuseFlag;
|
||||
bBatt[in] = p->MoverParameters->Battery;
|
||||
bConv[in] = p->MoverParameters->ConverterFlag;
|
||||
bHeat[in] = p->MoverParameters->Heating;
|
||||
in++;
|
||||
iPowerNo = in;
|
||||
}
|
||||
p = p->NextC(4);
|
||||
iCarNo = i;
|
||||
}
|
||||
// p = p->NextC(4); //prev
|
||||
if ((kier ? p->NextC(16) : p->PrevC(16)) != (kier ? p->NextC(4) : p->PrevC(4)))
|
||||
iUnitNo++;
|
||||
p = (kier ? p->NextC(4) : p->PrevC(4));
|
||||
iCarNo = i + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fPress[i][0] = 0;
|
||||
fPress[i][1] = 0;
|
||||
fPress[i][2] = 0;
|
||||
bDoors[i] = false;
|
||||
}
|
||||
bDoors[i][0] = false;
|
||||
bDoors[i][1] = false;
|
||||
bDoors[i][2] = false;
|
||||
iUnits[i] = 0;
|
||||
cCode[i] = 0;//'0';
|
||||
asCarName[i] = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (mvControlled == mvOccupied)
|
||||
@@ -2705,8 +2818,9 @@ bool TTrain::Update()
|
||||
if (fConverterTimer < fConverterPrzekaznik)
|
||||
{
|
||||
mvControlled->ConvOvldFlag = true;
|
||||
mvControlled->MainSwitch(false);
|
||||
}
|
||||
if (mvControlled->TrainType != dt_EZT)
|
||||
mvControlled->MainSwitch(false);
|
||||
}
|
||||
else if (fConverterTimer >= fConverterPrzekaznik)
|
||||
mvControlled->CompressorSwitch(true);
|
||||
}
|
||||
@@ -3282,6 +3396,15 @@ bool TTrain::Update()
|
||||
dsbSlipAlarm->Stop();
|
||||
}
|
||||
|
||||
if ((mvControlled->Mains) || (mvControlled->TrainType == dt_EZT))
|
||||
{
|
||||
btLampkaNadmSil.Turn(mvControlled->FuseFlagCheck());
|
||||
}
|
||||
else
|
||||
{
|
||||
btLampkaNadmSil.TurnOff();
|
||||
}
|
||||
|
||||
if (mvControlled->Mains)
|
||||
{
|
||||
btLampkaWylSzybki.TurnOn();
|
||||
@@ -3324,7 +3447,6 @@ bool TTrain::Update()
|
||||
mvControlled->ResistorsFlagCheck());
|
||||
//-------
|
||||
|
||||
btLampkaNadmSil.Turn(mvControlled->FuseFlagCheck());
|
||||
btLampkaWysRozr.Turn(mvControlled->Imax == mvControlled->ImaxHi);
|
||||
if (((mvControlled->ScndCtrlActualPos > 0) ||
|
||||
((mvControlled->RList[mvControlled->MainCtrlActualPos].ScndAct != 0) &&
|
||||
@@ -3376,7 +3498,6 @@ bool TTrain::Update()
|
||||
btLampkaWylSzybki.TurnOff();
|
||||
btLampkaOpory.TurnOff();
|
||||
btLampkaStyczn.TurnOff();
|
||||
btLampkaNadmSil.TurnOff();
|
||||
btLampkaUkrotnienie.TurnOff();
|
||||
btLampkaHamPosp.TurnOff();
|
||||
btLampkaBoczniki.TurnOff();
|
||||
@@ -3511,7 +3632,7 @@ bool TTrain::Update()
|
||||
// KURS90
|
||||
btLampkaMaxSila.Turn(abs(mvControlled->Im) >= 350);
|
||||
btLampkaPrzekrMaxSila.Turn(abs(mvControlled->Im) >= 450);
|
||||
btLampkaRadio.Turn(mvControlled->Radio);
|
||||
btLampkaRadio.Turn(mvOccupied->Radio);
|
||||
btLampkaHamulecReczny.Turn(mvOccupied->ManualBrakePos > 0);
|
||||
// NBMX wrzesien 2003 - drzwi oraz sygna³ odjazdu
|
||||
btLampkaDoorLeft.Turn(mvOccupied->DoorLeftOpened);
|
||||
@@ -3680,7 +3801,7 @@ bool TTrain::Update()
|
||||
ggMainButton.Update();
|
||||
if (ggRadioButton.SubModel)
|
||||
{
|
||||
ggRadioButton.PutValue(mvControlled->Radio ? 1 : 0);
|
||||
ggRadioButton.PutValue(mvOccupied->Radio ? 1 : 0);
|
||||
ggRadioButton.Update();
|
||||
}
|
||||
if (ggConverterButton.SubModel)
|
||||
@@ -3864,6 +3985,11 @@ bool TTrain::Update()
|
||||
else
|
||||
ggRearRightLightButton.PutValue(-1);
|
||||
}
|
||||
if (ggLightsButton.SubModel)
|
||||
{
|
||||
ggLightsButton.PutValue(mvOccupied->LightsPos - 1);
|
||||
ggLightsButton.Update();
|
||||
}
|
||||
|
||||
//---------
|
||||
// Winger 010304 - pantografy
|
||||
@@ -4228,7 +4354,9 @@ bool TTrain::Update()
|
||||
ggConverterButton.PutValue(0);
|
||||
ggConverterOffButton.PutValue(1);
|
||||
mvControlled->ConverterSwitch(false);
|
||||
}
|
||||
if ((mvControlled->TrainType == dt_EZT) && (!TestFlag(mvControlled->EngDmgFlag, 4)))
|
||||
mvControlled->ConvOvldFlag = false;
|
||||
}
|
||||
|
||||
// if (
|
||||
// !Console::Pressed(VK_SHIFT)&&Console::Pressed(Global::Keys[k_Compressor])&&((mvControlled->EngineType==ElectricSeriesMotor)||(mvControlled->TrainType==dt_EZT))
|
||||
@@ -4263,8 +4391,8 @@ bool TTrain::Update()
|
||||
*/
|
||||
//-----------------
|
||||
|
||||
if (!FreeFlyModeFlag)
|
||||
{
|
||||
if ((!FreeFlyModeFlag) && (!DynamicObject->Mechanik->AIControllFlag))
|
||||
{
|
||||
if (Console::Pressed(Global::Keys[k_Releaser])) // yB: odluzniacz caly
|
||||
// czas trzymany, warunki
|
||||
// powinny byc takie same,
|
||||
@@ -5348,7 +5476,8 @@ bool TTrain::InitializeCab(int NewCabNo, AnsiString asFileName)
|
||||
ggUpperLightButton.Clear();
|
||||
ggLeftEndLightButton.Clear();
|
||||
ggRightEndLightButton.Clear();
|
||||
// hunter-230112
|
||||
ggLightsButton.Clear();
|
||||
// hunter-230112
|
||||
ggRearLeftLightButton.Clear();
|
||||
ggRearRightLightButton.Clear();
|
||||
ggRearUpperLightButton.Clear();
|
||||
@@ -5432,7 +5561,9 @@ bool TTrain::InitializeCab(int NewCabNo, AnsiString asFileName)
|
||||
ggLeftEndLightButton.Load(Parser, DynamicObject->mdKabina);
|
||||
else if (str == AnsiString("rightend_sw:")) // swiatlo
|
||||
ggRightEndLightButton.Load(Parser, DynamicObject->mdKabina);
|
||||
//---------------------
|
||||
else if (str == AnsiString("lights_sw:")) // swiatla wszystkie
|
||||
ggLightsButton.Load(Parser, DynamicObject->mdKabina);
|
||||
//---------------------
|
||||
// hunter-230112: przelaczniki swiatel tylnich
|
||||
else if (str == AnsiString("rearupperlight_sw:")) // swiatlo
|
||||
ggRearUpperLightButton.Load(Parser, DynamicObject->mdKabina);
|
||||
@@ -5541,7 +5672,15 @@ bool TTrain::InitializeCab(int NewCabNo, AnsiString asFileName)
|
||||
gg->Load(Parser, DynamicObject->mdKabina);
|
||||
gg->AssignFloat(&fEIMParams[i][j]);
|
||||
}
|
||||
else if ((str == AnsiString("brakepress:")) || (str == AnsiString("brakepressb:")))
|
||||
else if (str == AnsiString("brakes:"))
|
||||
{ // amperomierz calkowitego pradu
|
||||
int i = Parser->GetNextSymbol().ToInt();
|
||||
int j = Parser->GetNextSymbol().ToInt();
|
||||
gg = Cabine[cabindex].Gauge(-1); // pierwsza wolna ga³ka
|
||||
gg->Load(Parser, DynamicObject->mdKabina);
|
||||
gg->AssignFloat(&fPress[i - 1][j]);
|
||||
}
|
||||
else if ((str == AnsiString("brakepress:")) || (str == AnsiString("brakepressb:")))
|
||||
{ // manometr cylindrow
|
||||
// hamulcowych //Ra
|
||||
// 2014-08: przeniesione
|
||||
@@ -5759,8 +5898,8 @@ bool TTrain::InitializeCab(int NewCabNo, AnsiString asFileName)
|
||||
int i = Parser->GetNextSymbol().ToInt() - 1;
|
||||
bt = Cabine[cabindex].Button(-1); // pierwsza wolna lampka
|
||||
bt->Load(Parser, DynamicObject->mdKabina);
|
||||
bt->AssignBool(bDoors + i);
|
||||
}
|
||||
bt->AssignBool(bDoors[0] + 3 * i);
|
||||
}
|
||||
else if (str == AnsiString("pyscreen:"))
|
||||
pyScreens.init(Parser, DynamicObject->mdKabina, DynamicObject->GetName(), NewCabNo);
|
||||
// btLampkaUnknown.Init("unknown",mdKabina,false);
|
||||
@@ -5929,3 +6068,34 @@ void TTrain::Silence()
|
||||
if (dsbBufferClamp)
|
||||
dsbBufferClamp->Stop();
|
||||
};
|
||||
|
||||
void TTrain::SetLights()
|
||||
{
|
||||
TDynamicObject *p = DynamicObject->GetFirstDynamic(mvOccupied->ActiveCab < 0 ? 1 : 0);
|
||||
bool kier = (DynamicObject->DirectionGet() * mvOccupied->ActiveCab > 0);
|
||||
int xs = (kier ? 0 : 1);
|
||||
if (kier ? p->NextC(4) : p->PrevC(4)) // jesli jest nastepny, to tylko przod
|
||||
{
|
||||
p->RaLightsSet(mvOccupied->Lights[xs][mvOccupied->LightsPos - 1] * (1 - xs),
|
||||
mvOccupied->Lights[1 - xs][mvOccupied->LightsPos - 1] * xs);
|
||||
p = (kier ? p->NextC(4) : p->PrevC(4));
|
||||
while (p)
|
||||
{
|
||||
if (kier ? p->NextC(4) : p->PrevC(4))
|
||||
{
|
||||
p->RaLightsSet(0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->RaLightsSet(mvOccupied->Lights[xs][mvOccupied->LightsPos - 1] * xs,
|
||||
mvOccupied->Lights[1 - xs][mvOccupied->LightsPos - 1] * (1 - xs));
|
||||
}
|
||||
p = (kier ? p->NextC(4) : p->PrevC(4));
|
||||
}
|
||||
}
|
||||
else // calosc
|
||||
{
|
||||
p->RaLightsSet(mvOccupied->Lights[xs][mvOccupied->LightsPos - 1],
|
||||
mvOccupied->Lights[1 - xs][mvOccupied->LightsPos - 1]);
|
||||
}
|
||||
};
|
||||
|
||||
27
Train.h
27
Train.h
@@ -95,7 +95,8 @@ class TTrain
|
||||
void UpdateMechPosition(double dt);
|
||||
bool Update();
|
||||
void MechStop();
|
||||
// virtual bool RenderAlpha();
|
||||
void SetLights();
|
||||
// virtual bool RenderAlpha();
|
||||
// McZapkie-310302: ladowanie parametrow z pliku
|
||||
bool LoadMMediaFile(AnsiString asFileName);
|
||||
PyObject *GetTrainState();
|
||||
@@ -161,6 +162,7 @@ class TTrain
|
||||
TGauge ggRightLightButton;
|
||||
TGauge ggLeftEndLightButton;
|
||||
TGauge ggRightEndLightButton;
|
||||
TGauge ggLightsButton; //przelacznik reflektorow (wszystkich)
|
||||
|
||||
// hunter-230112: przelacznik swiatel tylnich
|
||||
TGauge ggRearUpperLightButton;
|
||||
@@ -359,6 +361,7 @@ class TTrain
|
||||
float fConverterTimer; // hunter-261211: dla przekaznika
|
||||
float fMainRelayTimer; // hunter-141211: zalaczanie WSa z opoznieniem
|
||||
float fCzuwakTestTimer; // hunter-091012: do testu czuwaka
|
||||
float fLightsTimer; // yB 150617: timer do swiatel
|
||||
|
||||
int CAflag; // hunter-131211: dla osobnego zbijania CA i SHP
|
||||
|
||||
@@ -378,10 +381,21 @@ class TTrain
|
||||
float fHVoltage; // napi?cie dla dynamicznych ga?ek
|
||||
float fHCurrent[4]; // pr?dy: suma i amperomierze 1,2,3
|
||||
float fEngine[4]; // obroty te? trzeba pobra?
|
||||
float fPress[20][3]; // cisnienia dla wszystkich czlonow
|
||||
int iCarNo, iPowerNo; //liczba pojazdow i czlonow napednych
|
||||
bool bDoors[20]; // drzwi dla wszystkich czlonow
|
||||
// McZapkie: do syczenia
|
||||
int iCarNo, iPowerNo, iUnitNo; //liczba pojazdow, czlonow napednych i jednostek spi皻ych ze sob<6F>
|
||||
bool bDoors[20][3]; // drzwi dla wszystkich czlonow
|
||||
int iUnits[20]; // numer jednostki
|
||||
int iDoorNo[20]; // liczba drzwi
|
||||
char cCode[20]; //kod pojazdu
|
||||
AnsiString asCarName[20]; //nazwa czlonu
|
||||
bool bMains[8]; //WSy
|
||||
float fCntVol[8]; //napiecie NN
|
||||
bool bPants[8][2]; //podniesienie pantografow
|
||||
bool bFuse[8]; //nadmiarowe
|
||||
bool bBatt[8]; //baterie
|
||||
bool bConv[8]; //przetwornice
|
||||
bool bComp[8][2]; //sprezarki
|
||||
bool bHeat[8]; //grzanie
|
||||
// McZapkie: do syczenia
|
||||
float fPPress, fNPress;
|
||||
float fSPPress, fSNPress;
|
||||
int iSekunda; // Ra: sekunda aktualizacji pr?dko?ci
|
||||
@@ -389,7 +403,8 @@ class TTrain
|
||||
TPythonScreens pyScreens;
|
||||
|
||||
public:
|
||||
float fEIMParams[9][10]; // parametry dla silnikow asynchronicznych
|
||||
float fPress[20][3]; // cisnienia dla wszystkich czlonow
|
||||
float fEIMParams[9][10]; // parametry dla silnikow asynchronicznych
|
||||
int RadioChannel()
|
||||
{
|
||||
return iRadioChannel;
|
||||
|
||||
278
World.cpp
278
World.cpp
@@ -274,9 +274,9 @@ bool TWorld::Init(HWND NhWnd, HDC hDC)
|
||||
glLoadIdentity();
|
||||
// WriteLog("glClearColor (FogColor[0], FogColor[1], FogColor[2], 0.0); ");
|
||||
// glClearColor (1.0, 0.0, 0.0, 0.0); // Background Color
|
||||
// glClearColor (FogColor[0], FogColor[1], FogColor[2], 0.0); // Background
|
||||
// Color
|
||||
glClearColor(0.2, 0.4, 0.33, 1.0); // Background Color
|
||||
// glClearColor (FogColor[0], FogColor[1], FogColor[2], 0.0);
|
||||
// Background // Color
|
||||
glClearColor(Global::Background[0], Global::Background[1], Global::Background[2], 1.0); // Background Color
|
||||
|
||||
WriteLog("glFogfv(GL_FOG_COLOR, FogColor);");
|
||||
glFogfv(GL_FOG_COLOR, FogColor); // Set Fog Color
|
||||
@@ -846,8 +846,9 @@ void TWorld::OnKeyDown(int cKey)
|
||||
}
|
||||
else if (cKey == 3) //[Ctrl]+[Break]
|
||||
{ // hamowanie wszystkich pojazdów w okolicy
|
||||
Ground.RadioStop(Camera.Pos);
|
||||
}
|
||||
if (Controlled->MoverParameters->Radio)
|
||||
Ground.RadioStop(Camera.Pos);
|
||||
}
|
||||
else if (!Global::iPause) //||(cKey==VK_F4)) //podczas pauzy sterownaie nie dzia³a, F4 tak
|
||||
if (Train)
|
||||
if (Controlled)
|
||||
@@ -1496,44 +1497,52 @@ bool TWorld::Update()
|
||||
// 3. jeœli smuga w³aczona, wyrenderowaæ pojazd u¿ytkownia po dodaniu smugi do sceny
|
||||
if (Train->Controlled()->Battery)
|
||||
{ // trochê na skróty z t¹ bateri¹
|
||||
glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_ONE);
|
||||
// glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_DST_COLOR);
|
||||
glBlendFunc(GL_DST_COLOR, GL_ONE);
|
||||
// glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
|
||||
// glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_ONE);
|
||||
// glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_DST_COLOR);
|
||||
// glBlendFunc(GL_SRC_ALPHA_SATURATE,GL_ONE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDepthFunc(GL_GEQUAL);
|
||||
glAlphaFunc(GL_GREATER, 0.004);
|
||||
// glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glBindTexture(GL_TEXTURE_2D, light); // Select our texture
|
||||
glColor4f(0.15f, 0.15f, 0.15f, 0.25f);
|
||||
glBindTexture(GL_TEXTURE_2D, light); // Select our texture
|
||||
glBegin(GL_QUADS);
|
||||
float fSmudge =
|
||||
Train->Dynamic()->MoverParameters->DimHalf.y + 7; // gdzie zaczynaæ smugê
|
||||
if (Train->Controlled()->iLights[0] & 21)
|
||||
{ // wystarczy jeden zapalony z przodu
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex3f(15.0, 0.0, +fSmudge); // rysowanie wzglêdem po³o¿enia modelu
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex3f(-15.0, 0.0, +fSmudge);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex3f(-15.0, 2.5, 250.0);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex3f(15.0, 2.5, 250.0);
|
||||
}
|
||||
for (int i = 15; i <= 35; i++)
|
||||
{
|
||||
float z = i * i * i * 0.01f;//25/4;
|
||||
float C = (36 - i*0.5)*0.05*0.1;
|
||||
glColor4f(C, C, C, 0.25f);
|
||||
glTexCoord2f(0, 0); glVertex3f(-10 / 2 - 2 * i / 4, 6.0 + 0.3*z, 13 + 1.7*z / 3);
|
||||
glTexCoord2f(1, 0); glVertex3f(10 / 2 + 2 * i / 4, 6.0 + 0.3*z, 13 + 1.7*z / 3);
|
||||
glTexCoord2f(1, 1); glVertex3f(10 / 2 + 2 * i / 4, -5.0 - 0.5*z, 13 + 1.7*z / 3);
|
||||
glTexCoord2f(0, 1); glVertex3f(-10 / 2 - 2 * i / 4, -5.0 - 0.5*z, 13 + 1.7*z / 3);
|
||||
}
|
||||
}
|
||||
if (Train->Controlled()->iLights[1] & 21)
|
||||
{ // wystarczy jeden zapalony z ty³u
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex3f(-15.0, 0.0, -fSmudge);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex3f(15.0, 0.0, -fSmudge);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex3f(15.0, 2.5, -250.0);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex3f(-15.0, 2.5, -250.0);
|
||||
}
|
||||
for (int i = 15; i <= 35; i++)
|
||||
{
|
||||
float z = i * i * i * 0.01f;//25/4;
|
||||
glTexCoord2f(0, 0); glVertex3f(10 / 2 + 3 * i / 4, 6.0 + 0.3*z, -13 - 1.7*z / 3);
|
||||
glTexCoord2f(1, 0); glVertex3f(-10 / 2 - 3 * i / 4, 6.0 + 0.3*z, -13 - 1.7*z / 3);
|
||||
glTexCoord2f(1, 1); glVertex3f(-10 / 2 - 3 * i / 4, -5.0 - 0.5*z, -13 - 1.7*z / 3);
|
||||
glTexCoord2f(0, 1); glVertex3f(10 / 2 + 3 * i / 4, -5.0 - 0.5*z, -13 - 1.7*z / 3);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
// glEnable(GL_LIGHTING); //i tak siê w³¹czy potem
|
||||
// glEnable(GL_DEPTH_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.04);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glEnable(GL_LIGHTING); //i tak siê w³¹czy potem
|
||||
glEnable(GL_FOG);
|
||||
}
|
||||
glEnable(GL_LIGHTING); // po renderowaniu smugi jest to wy³¹czone
|
||||
@@ -1900,9 +1909,23 @@ bool TWorld::Update()
|
||||
// u:")+FloatToStrF(tmp->MoverParameters->u,ffFixed,3,3);
|
||||
// OutText2+=AnsiString(",
|
||||
// N:")+FloatToStrF(tmp->MoverParameters->Ntotal,ffFixed,4,0);
|
||||
OutText2 +=
|
||||
AnsiString(", Ft:") + FloatToStrF(tmp->MoverParameters->Ft, ffFixed, 4, 0);
|
||||
// OutText3= AnsiString("BP:
|
||||
OutText2 += AnsiString(", MED:") +
|
||||
FloatToStrF(tmp->MoverParameters->LocalBrakePosA, ffFixed, 6, 2);
|
||||
OutText2 += AnsiString("+") +
|
||||
FloatToStrF(tmp->MoverParameters->AnPos, ffFixed, 6, 2);
|
||||
OutText2 += AnsiString(", Ft:") +
|
||||
FloatToStrF(tmp->MoverParameters->Ft * 0.001f, ffFixed, 4, 0);
|
||||
OutText2 += AnsiString(", HV0:") +
|
||||
FloatToStrF(tmp->MoverParameters->HVCouplers[0][1], ffFixed, 4, 0);
|
||||
OutText2 += AnsiString("@") +
|
||||
FloatToStrF(tmp->MoverParameters->HVCouplers[0][0], ffFixed, 4, 0);
|
||||
OutText2 += AnsiString("+HV1:") +
|
||||
FloatToStrF(tmp->MoverParameters->HVCouplers[1][1], ffFixed, 4, 0);
|
||||
OutText2 += AnsiString("@") +
|
||||
FloatToStrF(tmp->MoverParameters->HVCouplers[1][0], ffFixed, 4, 0);
|
||||
OutText2 += AnsiString(" TC:") +
|
||||
FloatToStrF(tmp->MoverParameters->TotalCurrent, ffFixed, 4, 0);
|
||||
// OutText3= AnsiString("BP:
|
||||
// ")+FloatToStrF(tmp->MoverParameters->BrakePress,ffFixed,5,2)+AnsiString(",
|
||||
// ");
|
||||
// OutText3+= AnsiString("PP:
|
||||
@@ -2203,8 +2226,10 @@ bool TWorld::Update()
|
||||
FloatToStrF(Controlled->MoverParameters->dizel_engagedeltaomega, ffFixed, 6, 3);
|
||||
OutText2 = AnsiString("HamZ=") +
|
||||
FloatToStrF(Controlled->MoverParameters->fBrakeCtrlPos, ffFixed, 6, 1);
|
||||
OutText2 += AnsiString("; HamP=") + AnsiString(Controlled->MoverParameters->LocalBrakePos);
|
||||
// mvControlled->MainCtrlPos;
|
||||
OutText2 += AnsiString("; HamP=") + AnsiString(mvControlled->LocalBrakePos);
|
||||
OutText2 += AnsiString("/") +
|
||||
FloatToStrF(Controlled->MoverParameters->LocalBrakePosA, ffFixed, 6, 2);
|
||||
// mvControlled->MainCtrlPos;
|
||||
// if (mvControlled->MainCtrlPos<0)
|
||||
// OutText2+= AnsiString("; nastawnik 0");
|
||||
// if (mvControlled->MainCtrlPos>iPozSzereg)
|
||||
@@ -2228,8 +2253,14 @@ bool TWorld::Update()
|
||||
FloatToStrF(Controlled->MoverParameters->RunningShape.R, ffFixed, 4, 1);
|
||||
OutText2 += AnsiString(" An=") + FloatToStrF(Controlled->MoverParameters->AccN, ffFixed, 4,
|
||||
2); // przyspieszenie poprzeczne
|
||||
OutText2 += AnsiString("; As=") + FloatToStrF(Controlled->MoverParameters->AccS, ffFixed, 4,
|
||||
2); // przyspieszenie wzd³u¿ne
|
||||
if (tprev != int(GlobalTime->mr))
|
||||
{
|
||||
tprev = GlobalTime->mr;
|
||||
Acc = (Controlled->MoverParameters->Vel - VelPrev) / 3.6;
|
||||
VelPrev = Controlled->MoverParameters->Vel;
|
||||
}
|
||||
OutText2 += AnsiString("; As=") + FloatToStrF(Acc/*Controlled->MoverParameters->AccS*/, ffFixed, 4,
|
||||
2); // przyspieszenie wzd³u¿ne
|
||||
// OutText2+=AnsiString("; P=")+FloatToStrF(mvControlled->EnginePower,ffFixed,6,1);
|
||||
OutText3 += AnsiString("cyl.ham. ") +
|
||||
FloatToStrF(Controlled->MoverParameters->BrakePress, ffFixed, 5, 2);
|
||||
@@ -2241,32 +2272,53 @@ bool TWorld::Update()
|
||||
OutText3 += AnsiString("; p.zas. ") +
|
||||
FloatToStrF(Controlled->MoverParameters->ScndPipePress, ffFixed, 6, 2);
|
||||
|
||||
if (Controlled->MoverParameters->EngineType == ElectricInductionMotor)
|
||||
{
|
||||
// glTranslatef(0.0f,0.0f,-0.50f);
|
||||
glColor3f(1.0f, 1.0f, 1.0f); // a, damy bia³ym
|
||||
for (int i = 0; i <= 20; i++)
|
||||
{
|
||||
glRasterPos2f(-0.25f, 0.16f - 0.01f * i);
|
||||
if (Controlled->MoverParameters->eimc[i] < 10)
|
||||
OutText4 = FloatToStrF(Controlled->MoverParameters->eimc[i], ffFixed, 6, 3);
|
||||
else
|
||||
OutText4 = FloatToStrF(Controlled->MoverParameters->eimc[i], ffGeneral, 5, 3);
|
||||
glPrint(OutText4.c_str());
|
||||
}
|
||||
for (int i = 0; i <= 20; i++)
|
||||
{
|
||||
glRasterPos2f(-0.2f, 0.16f - 0.01f * i);
|
||||
if (Controlled->MoverParameters->eimv[i] < 10)
|
||||
OutText4 = FloatToStrF(Controlled->MoverParameters->eimv[i], ffFixed, 6, 3);
|
||||
else
|
||||
OutText4 = FloatToStrF(Controlled->MoverParameters->eimv[i], ffGeneral, 5, 3);
|
||||
glPrint(OutText4.c_str());
|
||||
}
|
||||
OutText4 = "";
|
||||
// glTranslatef(0.0f,0.0f,+0.50f);
|
||||
glColor3f(1.0f, 0.0f, 0.0f); // a, damy czerwonym
|
||||
}
|
||||
if (Controlled->MoverParameters->EngineType == ElectricInductionMotor)
|
||||
{
|
||||
// glTranslatef(0.0f,0.0f,-0.50f);
|
||||
glColor3f(1.0f, 1.0f, 1.0f); // a, damy bia³ym
|
||||
for (int i = 0; i <= 20; i++)
|
||||
{
|
||||
glRasterPos2f(-0.25f, 0.16f - 0.01f * i);
|
||||
if (Controlled->MoverParameters->eimc[i] < 10)
|
||||
OutText4 = FloatToStrF(Controlled->MoverParameters->eimc[i], ffFixed, 6, 3);
|
||||
else
|
||||
OutText4 = FloatToStrF(Controlled->MoverParameters->eimc[i], ffGeneral, 5, 3);
|
||||
glPrint(OutText4.c_str());
|
||||
}
|
||||
for (int i = 0; i <= 20; i++)
|
||||
{
|
||||
glRasterPos2f(-0.2f, 0.16f - 0.01f * i);
|
||||
if (Controlled->MoverParameters->eimv[i] < 10)
|
||||
OutText4 = FloatToStrF(Controlled->MoverParameters->eimv[i], ffFixed, 6, 3);
|
||||
else
|
||||
OutText4 = FloatToStrF(Controlled->MoverParameters->eimv[i], ffGeneral, 5, 3);
|
||||
glPrint(OutText4.c_str());
|
||||
}
|
||||
for (int i = 0; i <= 10; i++)
|
||||
{
|
||||
glRasterPos2f(-0.15f, 0.16f - 0.01f * i);
|
||||
OutText4 = FloatToStrF(Train->fPress[i][0], ffFixed, 6, 3);
|
||||
glPrint(OutText4.c_str());
|
||||
}
|
||||
for (int i = 0; i <= 8; i++)
|
||||
{
|
||||
glRasterPos2f(-0.15f, 0.04f - 0.01f * i);
|
||||
OutText4 = FloatToStrF(Controlled->MED[0][i], ffFixed, 6, 3);
|
||||
glPrint(OutText4.c_str());
|
||||
}
|
||||
for (int i = 0; i <= 8; i++)
|
||||
{
|
||||
for (int j = 0; j <= 9; j++)
|
||||
{
|
||||
glRasterPos2f(0.05f + 0.03f * i, 0.16f - 0.01f * j);
|
||||
OutText4 = FloatToStrF(Train->fEIMParams[i][j], ffGeneral, 4, 2);
|
||||
glPrint(OutText4.c_str());
|
||||
}
|
||||
}
|
||||
OutText4 = "";
|
||||
// glTranslatef(0.0f,0.0f,+0.50f);
|
||||
glColor3f(1.0f, 0.0f, 0.0f); // a, damy czerwonym
|
||||
}
|
||||
|
||||
// ABu: testy sprzegow-> (potem przeniesc te zmienne z public do protected!)
|
||||
// OutText3+=AnsiString("; EnginePwr=")+FloatToStrF(mvControlled->EnginePower,ffFixed,1,5);
|
||||
@@ -2692,12 +2744,16 @@ void TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
|
||||
switch (pRozkaz->iComm)
|
||||
{
|
||||
case 0: // odes³anie identyfikatora wersji
|
||||
Ground.WyslijString(Global::asVersion, 0); // przedsatwienie siê
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " version" + " rcvd");
|
||||
Ground.WyslijString(Global::asVersion, 0); // przedsatwienie siê
|
||||
break;
|
||||
case 1: // odes³anie identyfikatora wersji
|
||||
Ground.WyslijString(Global::szSceneryFile, 1); // nazwa scenerii
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " scenery" + " rcvd");
|
||||
Ground.WyslijString(Global::szSceneryFile, 1); // nazwa scenerii
|
||||
break;
|
||||
case 2: // event
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " " +
|
||||
AnsiString(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) + " rcvd");
|
||||
if (Global::iMultiplayer)
|
||||
{ // WriteLog("Komunikat: "+AnsiString(pRozkaz->Name1));
|
||||
TEvent *e = Ground.FindEvent(
|
||||
@@ -2714,6 +2770,10 @@ void TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
|
||||
{
|
||||
int i =
|
||||
int(pRozkaz->cString[8]); // d³ugoœæ pierwszego ³añcucha (z przodu dwa floaty)
|
||||
CommLog(
|
||||
AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " " +
|
||||
AnsiString(pRozkaz->cString + 11 + i, (unsigned)(pRozkaz->cString[10 + i])) +
|
||||
" rcvd");
|
||||
TGroundNode *t = Ground.DynamicFind(
|
||||
AnsiString(pRozkaz->cString + 11 + i,
|
||||
(unsigned)pRozkaz->cString[10 + i])); // nazwa pojazdu jest druga
|
||||
@@ -2729,6 +2789,8 @@ void TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
|
||||
break;
|
||||
case 4: // badanie zajêtoœci toru
|
||||
{
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " " +
|
||||
AnsiString(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) + " rcvd");
|
||||
TGroundNode *t = Ground.FindGroundNode(
|
||||
AnsiString(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])), TP_TRACK);
|
||||
if (t)
|
||||
@@ -2738,19 +2800,22 @@ void TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
|
||||
break;
|
||||
case 5: // ustawienie parametrów
|
||||
{
|
||||
if (*pRozkaz->iPar & 1) // ustawienie czasu
|
||||
{
|
||||
double t = pRozkaz->fPar[1];
|
||||
GlobalTime->dd = floor(t); // niby nie powinno byæ dnia, ale...
|
||||
if (Global::fMoveLight >= 0)
|
||||
Global::fMoveLight = t; // trzeba by deklinacjê S³oñca przeliczyæ
|
||||
GlobalTime->hh = floor(24 * t) - 24.0 * GlobalTime->dd;
|
||||
GlobalTime->mm =
|
||||
floor(60 * 24 * t) - 60.0 * (24.0 * GlobalTime->dd + GlobalTime->hh);
|
||||
GlobalTime->mr =
|
||||
floor(60 * 60 * 24 * t) -
|
||||
60.0 * (60.0 * (24.0 * GlobalTime->dd + GlobalTime->hh) + GlobalTime->mm);
|
||||
}
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " params " +
|
||||
IntToStr(*pRozkaz->iPar) + " rcvd");
|
||||
if (*pRozkaz->iPar == 0) // sprawdzenie czasu
|
||||
if (*pRozkaz->iPar & 1) // ustawienie czasu
|
||||
{
|
||||
double t = pRozkaz->fPar[1];
|
||||
GlobalTime->dd = floor(t); // niby nie powinno byæ dnia, ale...
|
||||
if (Global::fMoveLight >= 0)
|
||||
Global::fMoveLight = t; // trzeba by deklinacjê S³oñca przeliczyæ
|
||||
GlobalTime->hh = floor(24 * t) - 24.0 * GlobalTime->dd;
|
||||
GlobalTime->mm =
|
||||
floor(60 * 24 * t) - 60.0 * (24.0 * GlobalTime->dd + GlobalTime->hh);
|
||||
GlobalTime->mr =
|
||||
floor(60 * 60 * 24 * t) -
|
||||
60.0 * (60.0 * (24.0 * GlobalTime->dd + GlobalTime->hh) + GlobalTime->mm);
|
||||
}
|
||||
if (*pRozkaz->iPar & 2)
|
||||
{ // ustawienie flag zapauzowania
|
||||
Global::iPause = pRozkaz->fPar[2]; // zak³adamy, ¿e wysy³aj¹cy wie, co robi
|
||||
@@ -2760,6 +2825,9 @@ void TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
|
||||
case 6: // pobranie parametrów ruchu pojazdu
|
||||
if (Global::iMultiplayer)
|
||||
{ // Ra 2014-12: to ma dzia³aæ równie¿ dla pojazdów bez obsady
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " " +
|
||||
AnsiString(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) +
|
||||
" rcvd");
|
||||
if (pRozkaz->cString[0]) // jeœli d³ugoœæ nazwy jest niezerowa
|
||||
{ // szukamy pierwszego pojazdu o takiej nazwie i odsy³amy parametry ramk¹ #7
|
||||
TGroundNode *t;
|
||||
@@ -2780,18 +2848,62 @@ void TWorld::OnCommandGet(DaneRozkaz *pRozkaz)
|
||||
}
|
||||
break;
|
||||
case 8: // ponowne wys³anie informacji o zajêtych odcinkach toru
|
||||
Ground.TrackBusyList();
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " all busy track" + " rcvd");
|
||||
Ground.TrackBusyList();
|
||||
break;
|
||||
case 9: // ponowne wys³anie informacji o zajêtych odcinkach izolowanych
|
||||
Ground.IsolatedBusyList();
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " all busy isolated" + " rcvd");
|
||||
Ground.IsolatedBusyList();
|
||||
break;
|
||||
case 10: // badanie zajêtoœci jednego odcinka izolowanego
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " " +
|
||||
AnsiString(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) + " rcvd");
|
||||
Ground.IsolatedBusy(AnsiString(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])));
|
||||
break;
|
||||
case 11: // ustawienie paerametrów ruchu pojazdu
|
||||
case 11: // ustawienie parametrów ruchu pojazdu
|
||||
// Ground.IsolatedBusy(AnsiString(pRozkaz->cString+1,(unsigned)(pRozkaz->cString[0])));
|
||||
break;
|
||||
}
|
||||
case 12: // skrocona ramka parametrow pojazdow AI (wszystkich!!)
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " obsadzone" + " rcvd");
|
||||
Ground.WyslijObsadzone();
|
||||
// Ground.IsolatedBusy(AnsiString(pRozkaz->cString+1,(unsigned)(pRozkaz->cString[0])));
|
||||
break;
|
||||
case 13: // ramka uszkodzenia i innych stanow pojazdu, np. wylaczenie CA, wlaczenie recznego itd.
|
||||
// WriteLog("Przyszlo 13!");
|
||||
// WriteLog(pRozkaz->cString);
|
||||
CommLog(AnsiString(Now()) + " " + IntToStr(pRozkaz->iComm) + " " +
|
||||
AnsiString(pRozkaz->cString + 1, (unsigned)(pRozkaz->cString[0])) +
|
||||
" rcvd");
|
||||
if (pRozkaz->cString[1]) // jeœli d³ugoœæ nazwy jest niezerowa
|
||||
{ // szukamy pierwszego pojazdu o takiej nazwie i odsy³amy parametry ramk¹ #13
|
||||
TGroundNode *t;
|
||||
if (pRozkaz->cString[2] == '*')
|
||||
t = Ground.DynamicFind(
|
||||
Global::asHumanCtrlVehicle); // nazwa pojazdu u¿ytkownika
|
||||
else
|
||||
t = Ground.DynamicFindAny(
|
||||
AnsiString(pRozkaz->cString + 2,
|
||||
(unsigned)pRozkaz->cString[1])); // nazwa pojazdu
|
||||
if (t)
|
||||
{
|
||||
TDynamicObject *d = t->DynamicObject;
|
||||
while (d)
|
||||
{
|
||||
d->Damage(pRozkaz->cString[0]);
|
||||
d = d->Next(); // pozosta³e te¿
|
||||
}
|
||||
d = t->DynamicObject->Prev();
|
||||
while (d)
|
||||
{
|
||||
d->Damage(pRozkaz->cString[0]);
|
||||
d = d->Prev(); // w drug¹ stronê te¿
|
||||
}
|
||||
Ground.WyslijUszkodzenia(t->asName, t->DynamicObject->MoverParameters->EngDmgFlag); // zwrot informacji o pojeŸdzie
|
||||
}
|
||||
}
|
||||
// Ground.IsolatedBusy(AnsiString(pRozkaz->cString+1,(unsigned)(pRozkaz->cString[0])));
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
3
World.h
3
World.h
@@ -62,6 +62,9 @@ class TWorld
|
||||
double fTimeBuffer; // bufor czasu aktualizacji dla sta³ego kroku fizyki
|
||||
double fMaxDt; //[s] krok czasowy fizyki (0.01 dla normalnych warunków)
|
||||
int iPause; // wykrywanie zmian w zapauzowaniu
|
||||
double VelPrev; // poprzednia prêdkoœæ
|
||||
int tprev; // poprzedni czas
|
||||
double Acc; // przyspieszenie styczne
|
||||
public:
|
||||
void ModifyTGA(const AnsiString &dir = "");
|
||||
void CreateE3D(const AnsiString &dir = "", bool dyn = false);
|
||||
|
||||
Reference in New Issue
Block a user