16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 19:49:19 +02:00

Zakończone sprawdzanie mover.

This commit is contained in:
firleju
2016-12-02 23:01:50 +01:00
parent 7d3d848eeb
commit 3ffb50ce12
2 changed files with 380 additions and 343 deletions

View File

@@ -887,7 +887,7 @@ public:
// obsługa sprzęgów // obsługa sprzęgów
double Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension &Dim1, const TDimension &Dim2); double Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension &Dim1, const TDimension &Dim2);
double Distance(const vector3 &Loc1, const vector3 &Loc2, const vector3 &Dim1, const vector3 &Dim2); double Distance(const vector3 &Loc1, const vector3 &Loc2, const vector3 &Dim1, const vector3 &Dim2);
bool AttachA(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced = false); //bool AttachA(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced = false);
bool Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced = false); bool Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, int CouplingType, bool Forced = false);
int DettachStatus(int ConnectNo); int DettachStatus(int ConnectNo);
bool Dettach(int ConnectNo); bool Dettach(int ConnectNo);
@@ -918,7 +918,7 @@ public:
bool SendCtrlToNext(std::string CtrlCommand, double ctrlvalue, double dir); bool SendCtrlToNext(std::string CtrlCommand, double ctrlvalue, double dir);
bool SetInternalCommand(std::string NewCommand, double NewValue1, double NewValue2); bool SetInternalCommand(std::string NewCommand, double NewValue1, double NewValue2);
double GetExternalCommand(std::string &Command); double GetExternalCommand(std::string &Command);
bool RunCommand(std::string command, double CValue1, double CValue2); bool RunCommand(std::string Command, double CValue1, double CValue2);
bool RunInternalCommand(void); bool RunInternalCommand(void);
void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation); void PutCommand(std::string NewCommand, double NewValue1, double NewValue2, const TLocation &NewLocation);
bool CabActivisation(void); bool CabActivisation(void);

View File

@@ -315,12 +315,12 @@ TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit,
BrakeCtrlPosNo = 0; BrakeCtrlPosNo = 0;
LightsPosNo = 0; LightsPosNo = 0;
LightsDefPos = 1; LightsDefPos = 1;
//for (k = -1; k < MainBrakeMaxPos; k++) for (k = -1; k <= MainBrakeMaxPos; k++)
//{ {
// BrakePressureTable[k].PipePressureVal = 0; BrakePressureTable[k].PipePressureVal = 0;
// BrakePressureTable[k].BrakePressureVal = 0; BrakePressureTable[k].BrakePressureVal = 0;
// BrakePressureTable[k].FlowSpeedVal = 0; BrakePressureTable[k].FlowSpeedVal = 0;
//} }
// with BrakePressureTable[-2] do {pozycja odciecia} // with BrakePressureTable[-2] do {pozycja odciecia}
{ {
@@ -333,7 +333,7 @@ TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit,
DynamicBrakeType = 0; DynamicBrakeType = 0;
ASBType = 0; ASBType = 0;
AutoRelayType = 0; AutoRelayType = 0;
for (b = 0; b < 1; b++) // Ra: kto tu zrobił "for b:=1 to 2 do" ??? for (b = 0; b < 2; b++) // Ra: kto tu zrobił "for b:=1 to 2 do" ???
{ {
Couplers[b].CouplerType = NoCoupler; Couplers[b].CouplerType = NoCoupler;
Couplers[b].SpringKB = 1; Couplers[b].SpringKB = 1;
@@ -418,6 +418,11 @@ TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit,
CompressorPower = 1; CompressorPower = 1;
SmallCompressorPower = 0; SmallCompressorPower = 0;
for (b = 0; b < 26; b++)
eimc[b] = 0;
eimc[eimc_p_eped] = 1.5;
StopBrakeDecc = 0;
ScndInMain = false; ScndInMain = false;
Vhyp = 1; Vhyp = 1;
@@ -428,7 +433,7 @@ TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit,
// Loc:=LocInitial; //Ra: to i tak trzeba potem przesunąć, po ustaleniu pozycji na torze // Loc:=LocInitial; //Ra: to i tak trzeba potem przesunąć, po ustaleniu pozycji na torze
// (potrzebna długość) // (potrzebna długość)
// Rot:=RotInitial; // Rot:=RotInitial;
for (b = 0; b < 1; b++) for (b = 0; b < 2; b++)
{ {
Couplers[b].AllowedFlag = 3; // domyślnie hak i hamulec, inne trzeba włączyć jawnie w FIZ Couplers[b].AllowedFlag = 3; // domyślnie hak i hamulec, inne trzeba włączyć jawnie w FIZ
Couplers[b].CouplingFlag = 0; Couplers[b].CouplingFlag = 0;
@@ -448,6 +453,7 @@ TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit,
ScndCtrlPos = 0; ScndCtrlPos = 0;
MainCtrlActualPos = 0; MainCtrlActualPos = 0;
ScndCtrlActualPos = 0; ScndCtrlActualPos = 0;
LightsPos = 0;
Heating = false; Heating = false;
Mains = false; Mains = false;
ActiveDir = 0; // kierunek nie ustawiony ActiveDir = 0; // kierunek nie ustawiony
@@ -524,6 +530,9 @@ TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit,
dizel_engagedeltaomega = 0; dizel_engagedeltaomega = 0;
PhysicActivation = true; PhysicActivation = true;
for (b = 0; b < 21; b++)
eimv[b] = 0;
RunningShape.R = 0; RunningShape.R = 0;
RunningShape.Len = 1; RunningShape.Len = 1;
RunningShape.dHtrack = 0; RunningShape.dHtrack = 0;
@@ -610,7 +619,7 @@ double TMoverParameters::CouplerDist(int Coupler)
Couplers[Coupler].Connected->Dim); // odległość pomiędzy sprzęgami (kula!) Couplers[Coupler].Connected->Dim); // odległość pomiędzy sprzęgami (kula!)
}; };
bool TMoverParameters::AttachA(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, bool TMoverParameters::Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo,
int CouplingType, bool Forced) int CouplingType, bool Forced)
{ //łączenie do swojego sprzęgu (ConnectNo) pojazdu (ConnectTo) stroną (ConnectToNr) { //łączenie do swojego sprzęgu (ConnectNo) pojazdu (ConnectTo) stroną (ConnectToNr)
// Ra: zwykle wykonywane dwukrotnie, dla każdego pojazdu oddzielnie // Ra: zwykle wykonywane dwukrotnie, dla każdego pojazdu oddzielnie
@@ -653,11 +662,12 @@ bool TMoverParameters::AttachA(int ConnectNo, int ConnectToNr, TMoverParameters
// sprzęgu, brak haka // sprzęgu, brak haka
}; };
bool TMoverParameters::Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo, // to jest już niepotrzebne bo nie ma Delphi
int CouplingType, bool Forced) //bool TMoverParameters::Attach(int ConnectNo, int ConnectToNr, TMoverParameters *ConnectTo,
{ //łączenie do (ConnectNo) pojazdu (ConnectTo) stroną (ConnectToNr) // int CouplingType, bool Forced)
return AttachA(ConnectNo, ConnectToNr, (TMoverParameters *)ConnectTo, CouplingType, Forced); //{ //łączenie do (ConnectNo) pojazdu (ConnectTo) stroną (ConnectToNr)
}; // return Attach(ConnectNo, ConnectToNr, (TMoverParameters *)ConnectTo, CouplingType, Forced);
//};
int TMoverParameters::DettachStatus(int ConnectNo) int TMoverParameters::DettachStatus(int ConnectNo)
{ // Ra: sprawdzenie, czy odległość jest dobra do rozłączania { // Ra: sprawdzenie, czy odległość jest dobra do rozłączania
@@ -1037,6 +1047,7 @@ ZN //masa
// ***************************************************************************** // *****************************************************************************
// Q: 20160714 // Q: 20160714
// Oblicza iloraz aktualnej pozycji do maksymalnej hamulca pomocnicznego
// ***************************************************************************** // *****************************************************************************
double TMoverParameters::LocalBrakeRatio(void) double TMoverParameters::LocalBrakeRatio(void)
{ {
@@ -1060,6 +1071,7 @@ double TMoverParameters::LocalBrakeRatio(void)
// ***************************************************************************** // *****************************************************************************
// Q: 20160714 // Q: 20160714
// Oblicza iloraz aktualnej pozycji do maksymalnej hamulca ręcznego
// ***************************************************************************** // *****************************************************************************
double TMoverParameters::ManualBrakeRatio(void) double TMoverParameters::ManualBrakeRatio(void)
{ {
@@ -1074,6 +1086,7 @@ double TMoverParameters::ManualBrakeRatio(void)
// ***************************************************************************** // *****************************************************************************
// Q: 20160713 // Q: 20160713
// Zwraca objętość
// ***************************************************************************** // *****************************************************************************
double TMoverParameters::BrakeVP(void) double TMoverParameters::BrakeVP(void)
{ {
@@ -1085,8 +1098,8 @@ double TMoverParameters::BrakeVP(void)
// ***************************************************************************** // *****************************************************************************
// Q: 20160713 // Q: 20160713
// Zwraca iloraz różnicy między przewodem kontrolnym i głównym oraz DeltaPipePress
// ***************************************************************************** // *****************************************************************************
double TMoverParameters::RealPipeRatio(void) double TMoverParameters::RealPipeRatio(void)
{ {
double rpp; double rpp;
@@ -1100,6 +1113,7 @@ double TMoverParameters::RealPipeRatio(void)
// ***************************************************************************** // *****************************************************************************
// Q: 20160713 // Q: 20160713
// Zwraca iloraz ciśnienia w przewodzie do DeltaPipePress
// ***************************************************************************** // *****************************************************************************
double TMoverParameters::PipeRatio(void) double TMoverParameters::PipeRatio(void)
{ {
@@ -5028,6 +5042,7 @@ bool TMoverParameters::AutoRelayCheck(void)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160713 // Q: 20160713
// Podnosi / opuszcza przedni pantograf
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::PantFront(bool State) bool TMoverParameters::PantFront(bool State)
{ {
@@ -5073,6 +5088,7 @@ bool TMoverParameters::PantFront(bool State)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160713 // Q: 20160713
// Podnoszenie / opuszczanie pantografu tylnego
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::PantRear(bool State) bool TMoverParameters::PantRear(bool State)
{ {
@@ -5424,6 +5440,7 @@ bool TMoverParameters::LoadingDone(double LSpeed, std::string LoadInit)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160713 // Q: 20160713
// Zwraca informacje o działającej blokadzie drzwi
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::DoorBlockedFlag(void) bool TMoverParameters::DoorBlockedFlag(void)
{ {
@@ -5437,6 +5454,7 @@ bool TMoverParameters::DoorBlockedFlag(void)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160713 // Q: 20160713
// Otwiera / zamyka lewe drzwi
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::DoorLeft(bool State) bool TMoverParameters::DoorLeft(bool State)
{ {
@@ -5451,7 +5469,7 @@ bool TMoverParameters::DoorLeft(bool State)
SendCtrlToNext("DoorOpen", 1, CabNo); // 1=lewe, 2=prawe SendCtrlToNext("DoorOpen", 1, CabNo); // 1=lewe, 2=prawe
else else
SendCtrlToNext("DoorOpen", 2, CabNo); // zamiana SendCtrlToNext("DoorOpen", 2, CabNo); // zamiana
CompressedVolume = CompressedVolume - 0.003; CompressedVolume -= 0.003;
} }
else else
{ {
@@ -5468,6 +5486,7 @@ bool TMoverParameters::DoorLeft(bool State)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160713 // Q: 20160713
// Otwiera / zamyka prawe drzwi
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::DoorRight(bool State) bool TMoverParameters::DoorRight(bool State)
{ {
@@ -5482,7 +5501,7 @@ bool TMoverParameters::DoorRight(bool State)
SendCtrlToNext("DoorOpen", 2, CabNo); // 1=lewe, 2=prawe SendCtrlToNext("DoorOpen", 2, CabNo); // 1=lewe, 2=prawe
else else
SendCtrlToNext("DoorOpen", 1, CabNo); // zamiana SendCtrlToNext("DoorOpen", 1, CabNo); // zamiana
CompressedVolume = CompressedVolume - 0.003; CompressedVolume -= 0.003;
} }
else else
{ {
@@ -5500,6 +5519,7 @@ bool TMoverParameters::DoorRight(bool State)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160713 // Q: 20160713
// Przesuwa pojazd o podaną wartość w bok względem toru (dla samochodów)
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::ChangeOffsetH(double DeltaOffset) bool TMoverParameters::ChangeOffsetH(double DeltaOffset)
{ {
@@ -5522,6 +5542,7 @@ bool TMoverParameters::ChangeOffsetH(double DeltaOffset)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160713 // Q: 20160713
// Testuje zmienną (narazie tylko 0) i na podstawie uszkodzenia zwraca informację tekstową
// ************************************************************************************************* // *************************************************************************************************
std::string TMoverParameters::EngineDescription(int what) std::string TMoverParameters::EngineDescription(int what)
{ {
@@ -5574,6 +5595,7 @@ std::string TMoverParameters::EngineDescription(int what)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160709 // Q: 20160709
// Funkcja zwracajaca napiecie dla calego skladu, przydatna dla EZT
// ************************************************************************************************* // *************************************************************************************************
double TMoverParameters::GetTrainsetVoltage(void) double TMoverParameters::GetTrainsetVoltage(void)
{//ABu: funkcja zwracajaca napiecie dla calego skladu, przydatna dla EZT {//ABu: funkcja zwracajaca napiecie dla calego skladu, przydatna dla EZT
@@ -5581,7 +5603,7 @@ double TMoverParameters::GetTrainsetVoltage(void)
} }
// ************************************************************************************************* // *************************************************************************************************
// // Kasowanie zmiennych pracy fizyki
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::Physic_ReActivation(void) // DO PRZETLUMACZENIA NA KONCU bool TMoverParameters::Physic_ReActivation(void) // DO PRZETLUMACZENIA NA KONCU
{ {
@@ -7711,6 +7733,7 @@ bool TMoverParameters::CreateBrakeSys(bool ReadyFlag)
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160714 // Q: 20160714
// Wstawia komendę z parametrem, od sprzęgu i w lokalizacji do pojazdu
// ************************************************************************************************* // *************************************************************************************************
void TMoverParameters::PutCommand(std::string NewCommand, double NewValue1, double NewValue2, void TMoverParameters::PutCommand(std::string NewCommand, double NewValue1, double NewValue2,
const TLocation &NewLocation) const TLocation &NewLocation)
@@ -7726,6 +7749,7 @@ void TMoverParameters::PutCommand(std::string NewCommand, double NewValue1, doub
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160714 // Q: 20160714
// Pobiera komendę z parametru funkcji oraz wartość zmiennej jako return
// ************************************************************************************************* // *************************************************************************************************
double TMoverParameters::GetExternalCommand(std::string &Command) double TMoverParameters::GetExternalCommand(std::string &Command)
{ {
@@ -7755,6 +7779,7 @@ bool TMoverParameters::SendCtrlBroadcast(std::string CtrlCommand, double ctrlval
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160714 // Q: 20160714
// Ustawienie komendy wraz z parametrami
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::SetInternalCommand(std::string NewCommand, double NewValue1, bool TMoverParameters::SetInternalCommand(std::string NewCommand, double NewValue1,
double NewValue2) double NewValue2)
@@ -7812,349 +7837,361 @@ bool TMoverParameters::SendCtrlToNext(std::string CtrlCommand, double ctrlvalue,
// Komenda musi być zdefiniowana tutaj, a jeśli się wywołuje funkcję, to ona nie może // Komenda musi być zdefiniowana tutaj, a jeśli się wywołuje funkcję, to ona nie może
// sama przesyłać do kolejnych pojazdów. Należy też się zastanowić, czy dla uzyskania // sama przesyłać do kolejnych pojazdów. Należy też się zastanowić, czy dla uzyskania
// jakiejś zmiany (np. IncMainCtrl) lepiej wywołać funkcję, czy od razu wysłać komendę. // jakiejś zmiany (np. IncMainCtrl) lepiej wywołać funkcję, czy od razu wysłać komendę.
bool TMoverParameters::RunCommand(std::string command, double CValue1, double CValue2) bool TMoverParameters::RunCommand(std::string Command, double CValue1, double CValue2)
{ {
bool OK; bool OK;
std::string testload; std::string testload;
OK = false; OK = false;
ClearPendingExceptions(); ClearPendingExceptions();
/*
{test komend sterowania ukrotnionego} if (Command == "MainCtrl")
if command='MainCtrl' then {
begin if (MainCtrlPosNo >= floor(CValue1))
if MainCtrlPosNo>=Trunc(CValue1) then MainCtrlPos = floor(CValue1);
MainCtrlPos:=Trunc(CValue1); OK = SendCtrlToNext(Command, CValue1, CValue2);
//--OK:=SendCtrlToNext(command,CValue1,CValue2); }
end else if (Command == "ScndCtrl")
else if command='ScndCtrl' then {
begin if ((EngineType == ElectricInductionMotor))
if ScndCtrlPosNo>=Trunc(CValue1) then if ((ScndCtrlPos == 0) && (floor(CValue1) > 0))
ScndCtrlPos:=Trunc(CValue1); if ((Vmax < 250))
//--OK:=SendCtrlToNext(command,CValue1,CValue2); ScndCtrlActualPos = Round(Vel + 0.5);
end else
(* else if command='BrakeCtrl' then ScndCtrlActualPos = Round(Vel * 1.0 / 2 + 0.5);
else if ((floor(CValue1) == 0))
ScndCtrlActualPos = 0;
if (ScndCtrlPosNo >= floor(CValue1))
ScndCtrlPos = floor(CValue1);
OK = SendCtrlToNext(Command, CValue1, CValue2);
}
/* else if command='BrakeCtrl' then
begin begin
if BrakeCtrlPosNo>=Trunc(CValue1) then if BrakeCtrlPosNo>=Trunc(CValue1) then
begin begin
BrakeCtrlPos:=Trunc(CValue1); BrakeCtrlPos:=Trunc(CValue1);
OK:=SendCtrlToNext(command,CValue1,CValue2); OK:=SendCtrlToNext(command,CValue1,CValue2);
end; end;
end *) end */
else if command='Brake' then //youBy - jak sie EP hamuje, to trza sygnal wyslac... else if (Command == "Brake") // youBy - jak sie EP hamuje, to trza sygnal wyslac...
begin {
Hamulec.SetEPS(CValue1); Hamulec->SetEPS(CValue1);
//fBrakeCtrlPos:=BrakeCtrlPos; //to powinnno być w jednym miejscu, aktualnie w C++!!! // fBrakeCtrlPos:=BrakeCtrlPos; //to powinnno być w jednym miejscu, aktualnie w C++!!!
BrakePressureActual:=BrakePressureTable[BrakeCtrlPos]; BrakePressureActual = BrakePressureTable[BrakeCtrlPos];
//--OK:=SendCtrlToNext(command,CValue1,CValue2); OK = SendCtrlToNext(Command, CValue1, CValue2);
end //youby - odluzniacz hamulcow, przyda sie } // youby - odluzniacz hamulcow, przyda sie
else if command='BrakeReleaser' then else if (Command == "BrakeReleaser")
begin {
//--OK:=BrakeReleaser(Round(CValue1)); //samo się przesyła dalej // TODO: funkcja OK = BrakeReleaser(Round(CValue1)); // samo się przesyła dalej
przeniesiona do mover.cpp // OK:=SendCtrlToNext(command,CValue1,CValue2); //to robiło kaskadę 2^n
//OK:=SendCtrlToNext(command,CValue1,CValue2); //to robiło kaskadę 2^n }
end else if (Command == "MainSwitch")
else if command='MainSwitch' then {
begin if (CValue1 == 1)
if CValue1=1 then {
begin Mains = true;
Mains:=true; if ((EngineType == DieselEngine) && Mains)
if (EngineType=DieselEngine) and Mains then dizel_enginestart = true;
dizel_enginestart:=true; }
end else
else Mains:=false; Mains = false;
//--OK:=SendCtrlToNext(command,CValue1,CValue2); OK = SendCtrlToNext(Command, CValue1, CValue2);
end }
else if command='Direction' then else if (Command == "Direction")
begin {
ActiveDir:=Trunc(CValue1); ActiveDir = floor(CValue1);
DirAbsolute:=ActiveDir*CabNo; DirAbsolute = ActiveDir * CabNo;
//--OK:=SendCtrlToNext(command,CValue1,CValue2); OK = SendCtrlToNext(Command, CValue1, CValue2);
end }
else if command='CabActivisation' then else if (Command == "CabActivisation")
begin {
// OK:=Power>0.01; // OK:=Power>0.01;
case Trunc(CValue1*CValue2) of //CValue2 ma zmieniany znak przy niezgodności sprzęgów switch (static_cast<int>(CValue1 * CValue2))
1 : CabNo:= 1; { // CValue2 ma zmieniany znak przy niezgodności sprzęgów
-1 : CabNo:=-1; case 1:
else CabNo:=0; //gdy CValue1==0 CabNo = 1;
end; case -1:
DirAbsolute:=ActiveDir*CabNo; CabNo = -1;
//--OK:=SendCtrlToNext(command,CValue1,CValue2); default:
end CabNo = 0; // gdy CValue1==0
else if command='AutoRelaySwitch' then }
begin DirAbsolute = ActiveDir * CabNo;
if (CValue1=1) and (AutoRelayType=2) then AutoRelayFlag:=true OK = SendCtrlToNext(Command, CValue1, CValue2);
else AutoRelayFlag:=false; }
//--OK:=SendCtrlToNext(command,CValue1,CValue2); else if (Command == "AutoRelaySwitch")
end {
else if command='FuseSwitch' then if ((CValue1 == 1) && (AutoRelayType == 2))
begin AutoRelayFlag = true;
if ((EngineType=ElectricSeriesMotor)or(EngineType=DieselElectric)) and FuseFlag and else
(CValue1=1) and AutoRelayFlag = false;
(MainCtrlActualPos=0) and (ScndCtrlActualPos=0) and Mains then OK = SendCtrlToNext(Command, CValue1, CValue2);
{ if (EngineType=ElectricSeriesMotor) and (CValue1=1) and }
(MainCtrlActualPos=0) and (ScndCtrlActualPos=0) and Mains then} else if (Command == "FuseSwitch")
FuseFlag:=false; {wlaczenie ponowne obwodu} {
if (((EngineType == ElectricSeriesMotor) || (EngineType == DieselElectric)) && FuseFlag &&
(CValue1 == 1) && (MainCtrlActualPos == 0) && (ScndCtrlActualPos == 0) && Mains)
/* if (EngineType=ElectricSeriesMotor) and (CValue1=1) and
(MainCtrlActualPos=0) and (ScndCtrlActualPos=0) and Mains then*/
FuseFlag = false; /*wlaczenie ponowne obwodu*/
// if ((EngineType=ElectricSeriesMotor)or(EngineType=DieselElectric)) and not FuseFlag and // if ((EngineType=ElectricSeriesMotor)or(EngineType=DieselElectric)) and not FuseFlag and
(CValue1=0) and Mains then // (CValue1=0) and Mains then
// FuseFlag:=true; // FuseFlag:=true;
//--OK:=SendCtrlToNext(command,CValue1,CValue2); OK = SendCtrlToNext(Command, CValue1, CValue2);
end }
else if command='ConverterSwitch' then {NBMX} else if (Command == "ConverterSwitch") /*NBMX*/
begin {
if (CValue1=1) then ConverterAllow:=true if ((CValue1 == 1))
else if (CValue1=0) then ConverterAllow:=false; ConverterAllow = true;
//--OK:=SendCtrlToNext(command,CValue1,CValue2); else if ((CValue1 == 0))
end ConverterAllow = false;
else if command='BatterySwitch' then {NBMX} OK = SendCtrlToNext(Command, CValue1, CValue2);
begin }
//--if (CValue1=1) then Battery:=true else if (Command == "BatterySwitch") /*NBMX*/
//--else if (CValue1=0) then Battery:=false; {
//--if (Battery) and (ActiveCab<>0) {or (TrainType=dt_EZT)} then if ((CValue1 == 1))
//-- SecuritySystem.Status:=SecuritySystem.Status or s_waiting //aktywacja czuwaka Battery = true;
//--else else if ((CValue1 == 0))
//-- SecuritySystem.Status:=0; //wyłączenie czuwaka Battery = false;
//--OK:=SendCtrlToNext(command,CValue1,CValue2); if ((Battery) && (ActiveCab != 0) /*or (TrainType=dt_EZT)*/)
end SecuritySystem.Status = SecuritySystem.Status || s_waiting; // aktywacja czuwaka
else
SecuritySystem.Status = 0; // wyłączenie czuwaka
OK = SendCtrlToNext(Command, CValue1, CValue2);
}
// else if command='EpFuseSwitch' then {NBMX} // else if command='EpFuseSwitch' then {NBMX}
// begin // begin
// if (CValue1=1) then EpFuse:=true // if (CValue1=1) then EpFuse:=true
// else if (CValue1=0) then EpFuse:=false; // else if (CValue1=0) then EpFuse:=false;
// OK:=SendCtrlToNext(command,CValue1,CValue2); // OK:=SendCtrlToNext(command,CValue1,CValue2);
// end // end
else if command='CompressorSwitch' then {NBMX} else if (Command == "CompressorSwitch") /*NBMX*/
begin {
if (CValue1=1) then CompressorAllow:=true if ((CValue1 == 1))
else if (CValue1=0) then CompressorAllow:=false; CompressorAllow = true;
//--OK:=SendCtrlToNext(command,CValue1,CValue2); else if ((CValue1 == 0))
end CompressorAllow = false;
else if command='DoorOpen' then {NBMX} OK = SendCtrlToNext(Command, CValue1, CValue2);
begin //Ra: uwzględnić trzeba jeszcze zgodność sprzęgów }
if (CValue2>0) then else if (Command == "DoorOpen") /*NBMX*/
begin //normalne ustawienie pojazdu { // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
if (CValue1=1) OR (CValue1=3) then if ((CValue2 > 0))
DoorLeftOpened:=true; { // normalne ustawienie pojazdu
if (CValue1=2) OR (CValue1=3) then if ((CValue1 == 1) || (CValue1 == 3))
DoorRightOpened:=true; DoorLeftOpened = true;
end if ((CValue1 == 2) || (CValue1 == 3))
DoorRightOpened = true;
}
else else
begin //odwrotne ustawienie pojazdu { // odwrotne ustawienie pojazdu
if (CValue1=2) OR (CValue1=3) then if ((CValue1 == 2) || (CValue1 == 3))
DoorLeftOpened:=true; DoorLeftOpened = true;
if (CValue1=1) OR (CValue1=3) then if ((CValue1 == 1) || (CValue1 == 3))
DoorRightOpened:=true; DoorRightOpened = true;
end; }
//--OK:=SendCtrlToNext(command,CValue1,CValue2); OK = SendCtrlToNext(Command, CValue1, CValue2);
end }
else if command='DoorClose' then {NBMX} else if (Command == "DoorClose") /*NBMX*/
begin //Ra: uwzględnić trzeba jeszcze zgodność sprzęgów { // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
if (CValue2>0) then if ((CValue2 > 0))
begin //normalne ustawienie pojazdu { // normalne ustawienie pojazdu
if (CValue1=1) OR (CValue1=3) then if ((CValue1 == 1) || (CValue1 == 3))
DoorLeftOpened:=false; DoorLeftOpened = false;
if (CValue1=2) OR (CValue1=3) then if ((CValue1 == 2) || (CValue1 == 3))
DoorRightOpened:=false; DoorRightOpened = false;
end }
else else
begin //odwrotne ustawienie pojazdu { // odwrotne ustawienie pojazdu
if (CValue1=2) OR (CValue1=3) then if ((CValue1 == 2) || (CValue1 == 3))
DoorLeftOpened:=false; DoorLeftOpened = false;
if (CValue1=1) OR (CValue1=3) then if ((CValue1 == 1) || (CValue1 == 3))
DoorRightOpened:=false; DoorRightOpened = false;
end; }
//--OK:=SendCtrlToNext(command,CValue1,CValue2); OK = SendCtrlToNext(Command, CValue1, CValue2);
end }
else if command='PantFront' then {Winger 160204} else if (Command == "PantFront") /*Winger 160204*/
begin //Ra: uwzględnić trzeba jeszcze zgodność sprzęgów { // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
//Czemu EZT ma być traktowane inaczej? Ukrotnienie ma, a człon może być odwrócony // Czemu EZT ma być traktowane inaczej? Ukrotnienie ma, a człon może być odwrócony
if (TrainType=dt_EZT) then if ((TrainType == dt_EZT))
begin //'ezt' { //'ezt'
if (CValue1=1) then if ((CValue1 == 1))
begin {
PantFrontUp:=true; PantFrontUp = true;
PantFrontStart:=0; PantFrontStart = 0;
end }
else if (CValue1=0) then else if ((CValue1 == 0))
begin {
PantFrontUp:=false; PantFrontUp = false;
PantFrontStart:=1; PantFrontStart = 1;
end; }
end }
else else
begin //nie 'ezt' - odwrotne ustawienie pantografów: ^-.-^ zamiast ^-.^- { // nie 'ezt' - odwrotne ustawienie pantografów: ^-.-^ zamiast ^-.^-
(* if ((CValue1 == 1))
if (CValue1=1) then if ((TestFlag(Couplers[1].CouplingFlag, ctrain_controll) && (CValue2 == 1)) ||
if (TestFlag(Couplers[1].CouplingFlag,ctrain_controll)and(CValue2= 1)) (TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
or(TestFlag(Couplers[0].CouplingFlag,ctrain_controll)and(CValue2=-1)) {
then PantFrontUp = true;
begin PantFrontStart = 0;
PantFrontUp:=true; }
PantFrontStart:=0;
end
else else
begin {
PantRearUp:=true; PantRearUp = true;
PantRearStart:=0; PantRearStart = 0;
end }
else if (CValue1=0) then else if ((CValue1 == 0))
if (TestFlag(Couplers[1].CouplingFlag,ctrain_controll)and(CValue2= 1)) if ((TestFlag(Couplers[1].CouplingFlag, ctrain_controll) && (CValue2 == 1)) ||
or(TestFlag(Couplers[0].CouplingFlag,ctrain_controll)and(CValue2=-1)) (TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
then {
begin PantFrontUp = false;
PantFrontUp:=false; PantFrontStart = 1;
PantFrontStart:=1; }
end
else else
begin {
PantRearUp:=false; PantRearUp = false;
PantRearStart:=1; PantRearStart = 1;
end; }
*) }
end; OK = SendCtrlToNext(Command, CValue1, CValue2);
//--OK:=SendCtrlToNext(command,CValue1,CValue2); }
end else if (Command == "PantRear") /*Winger 160204, ABu 310105 i 030305*/
else if command='PantRear' then {Winger 160204, ABu 310105 i 030305} { // Ra: uwzględnić trzeba jeszcze zgodność sprzęgów
begin //Ra: uwzględnić trzeba jeszcze zgodność sprzęgów if ((TrainType == dt_EZT))
if (TrainType=dt_EZT) then { /*'ezt'*/
begin {'ezt'} if ((CValue1 == 1))
if (CValue1=1) then {
begin PantRearUp = true;
PantRearUp:=true; PantRearStart = 0;
PantRearStart:=0; }
end else if ((CValue1 == 0))
else if (CValue1=0) then {
begin PantRearUp = false;
PantRearUp:=false; PantRearStart = 1;
PantRearStart:=1; }
end; }
end
else else
begin {nie 'ezt'} { /*nie 'ezt'*/
(* if ((CValue1 == 1))
if (CValue1=1) then /*if ostatni polaczony sprz. sterowania*/
{if ostatni polaczony sprz. sterowania} if ((TestFlag(Couplers[1].CouplingFlag, ctrain_controll) && (CValue2 == 1)) ||
if (TestFlag(Couplers[1].CouplingFlag,ctrain_controll)and(CValue2= 1)) (TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
or(TestFlag(Couplers[0].CouplingFlag,ctrain_controll)and(CValue2=-1)) {
then PantRearUp = true;
begin PantRearStart = 0;
PantRearUp:=true; }
PantRearStart:=0;
end
else else
begin {
PantFrontUp:=true; PantFrontUp = true;
PantFrontStart:=0; PantFrontStart = 0;
end }
else if (CValue1=0) then else if ((CValue1 == 0))
if (TestFlag(Couplers[1].CouplingFlag,ctrain_controll)and(CValue2= 1)) if ((TestFlag(Couplers[1].CouplingFlag, ctrain_controll) && (CValue2 == 1)) ||
or(TestFlag(Couplers[0].CouplingFlag,ctrain_controll)and(CValue2=-1)) (TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
then {
begin PantRearUp = false;
PantRearUp:=false; PantRearStart = 1;
PantRearStart:=1; }
end
else else
begin {
PantFrontUp:=false; PantFrontUp = false;
PantFrontStart:=1; PantFrontStart = 1;
end; }
*) }
end; OK = SendCtrlToNext(Command, CValue1, CValue2);
//--OK:=SendCtrlToNext(command,CValue1,CValue2); }
end else if (Command == "MaxCurrentSwitch")
else if command='MaxCurrentSwitch' then {
begin OK = MaxCurrentSwitch(CValue1 == 1);
//--OK:=MaxCurrentSwitch(CValue1=1); }
end else if (Command == "MinCurrentSwitch")
else if command='MinCurrentSwitch' then {
begin OK = MinCurrentSwitch(CValue1 == 1);
//--OK:=MinCurrentSwitch(CValue1=1); }
end /*test komend oddzialywujacych na tabor*/
{test komend oddzialywujacych na tabor} else if (Command == "SetDamage")
else if command='SetDamage' then {
begin if (CValue2 == 1)
if CValue2=1 then OK:=SetFlag(DamageFlag,Trunc(CValue1)); OK = SetFlag(DamageFlag, floor(CValue1));
if CValue2=-1 then OK:=SetFlag(DamageFlag,-Trunc(CValue1)); if (CValue2 == -1)
end OK = SetFlag(DamageFlag, -floor(CValue1));
else if command='Emergency_brake' then }
begin else if (Command == "Emergency_brake")
//-- if EmergencyBrakeSwitch(Trunc(CValue1)=1) then // moe ma w pas TODO: {
//-- OK:=true if (EmergencyBrakeSwitch(floor(CValue1) == 1)) // YB: czy to jest potrzebne?
//-- else OK:=false; OK = true;
end else
else if command='BrakeDelay' then OK = false;
begin }
BrakeDelayFlag:=Trunc(CValue1); else if (Command == "BrakeDelay")
OK:=true; {
end BrakeDelayFlag = floor(CValue1);
//--else if command='SandDoseOn' then OK = true;
//-- begin }
//-- if SandDoseOn then else if (Command == "SandDoseOn")
//-- OK:=true {
//-- else OK:=false; if (SandDoseOn)
//-- end OK = true;
else if command='CabSignal' then {SHP,Indusi} else
begin //Ra: to powinno działać tylko w członie obsadzonym OK = false;
//-- if {(TrainType=dt_EZT)or} (ActiveCab<>0) and (Battery) and }
TestFlag(SecuritySystem.SystemType,2) then //jeśli kabina jest obsadzona (silnikowy w EZT?) else if (Command == "CabSignal") /*SHP,Indusi*/
//-- with SecuritySystem do { // Ra: to powinno działać tylko w członie obsadzonym
//-- begin if (/*(TrainType=dt_EZT)or*/ (ActiveCab != 0) && (Battery) &&
//-- VelocityAllowed:=Trunc(CValue1); TestFlag(SecuritySystem.SystemType,
//-- NextVelocityAllowed:=Trunc(CValue2); 2)) // jeśli kabina jest obsadzona (silnikowy w EZT?)
//-- SystemSoundSHPTimer:=0; //hunter-091012 /*?*/ /* WITH SecuritySystem */
//-- SetFlag(Status,s_active); {
//-- end; SecuritySystem.VelocityAllowed = floor(CValue1);
//else OK:=false; SecuritySystem.NextVelocityAllowed = floor(CValue2);
OK:=true; //true, gdy można usunąć komendę SecuritySystem.SystemSoundSHPTimer = 0; // hunter-091012
end SetFlag(SecuritySystem.Status, s_active);
{naladunek/rozladunek} }
else if Pos('Load=',command)=1 then // else OK:=false;
begin OK = true; // true, gdy można usunąć komendę
OK:=false; //będzie powtarzane aż się załaduje }
//-if (Vel=0) and (MaxLoad>0) and (Load<MaxLoad*(1+OverLoadFactor)) then //czy można /*naladunek/rozladunek*/
ładowac? else if (Pos("Load=", Command) == 1)
//- if Distance(Loc,CommandIn.Location,Dim,Dim)<10 then //ten peron/rampa {
//- begin OK = false; // będzie powtarzane aż się załaduje
//- testload:=LowerCase(DUE(command)); if ((Vel == 0) && (MaxLoad > 0) &&
//-if Pos(testload,LoadAccepted)>0 then //nazwa jest obecna w CHK (Load < MaxLoad * (1 + OverLoadFactor))) // czy można ładowac?
//- OK:=LoadingDone(Min0R(CValue2,LoadSpeed),testload); //zmienia LoadStatus // if (Distance(Loc, CommandIn.Location, Dim, Dim) < 10) // ten peron/rampa
przeniesione do mover.cpp {
//- end; testload = ToLower(DUE(Command));
//if OK then LoadStatus:=0; //nie udalo sie w ogole albo juz skonczone if (Pos(testload, LoadAccepted) > 0) // nazwa jest obecna w CHK
end OK = LoadingDone(Min0R(CValue2, LoadSpeed), testload); // zmienia LoadStatus
else if Pos('UnLoad=',command)=1 then }
begin // if OK then LoadStatus:=0; //nie udalo sie w ogole albo juz skonczone
OK:=false; //będzie powtarzane aż się rozładuje }
//-if (Vel=0) and (Load>0) then //czy jest co rozladowac? else if (Pos("UnLoad=", Command) == 1)
//- if Distance(Loc,CommandIn.Location,Dim,Dim)<10 then //ten peron {
//- begin OK = false; // będzie powtarzane aż się rozładuje
//- testload:=DUE(command); //zgodność nazwy ładunku z CHK if ((Vel == 0) && (Load > 0)) // czy jest co rozladowac?
//-if LoadType=testload then {mozna to rozladowac} if (Distance(Loc, CommandIn.Location, Dim, Dim) < 10) // ten peron
//- OK:=LoadingDone(-Min0R(CValue2,LoadSpeed),testload); // {
przeniesione do mover.cpp testload = DUE(Command); // zgodność nazwy ładunku z CHK
//- end; if (LoadType == testload) /*mozna to rozladowac*/
//if OK then LoadStatus:=0; OK = LoadingDone(-Min0R(CValue2, LoadSpeed), testload);
end; }
RunCommand:=OK; //dla true komenda będzie usunięta, dla false wykonana ponownie // if OK then LoadStatus:=0;
}
*/ return OK; // dla true komenda będzie usunięta, dla false wykonana ponownie
return OK;
} }
// ************************************************************************************************* // *************************************************************************************************
// Q: 20160714 // Q: 20160714
// Uruchamia funkcję RunCommand aż do skutku. Jeśli będzie pozytywny to kasuje komendę.
// ************************************************************************************************* // *************************************************************************************************
bool TMoverParameters::RunInternalCommand(void) bool TMoverParameters::RunInternalCommand(void)
{ {
bool OK; bool OK;
if (CommandIn.Command != "") if (!CommandIn.Command.empty())
{ {
OK = RunCommand(CommandIn.Command, CommandIn.Value1, CommandIn.Value2); OK = RunCommand(CommandIn.Command, CommandIn.Value1, CommandIn.Value2);
if (OK) if (OK)
{ {
CommandIn.Command = ""; // kasowanie bo rozkaz wykonany CommandIn.Command.clear(); // kasowanie bo rozkaz wykonany
CommandIn.Value1 = 0; CommandIn.Value1 = 0;
CommandIn.Value2 = 0; CommandIn.Value2 = 0;
CommandIn.Location.X = 0; CommandIn.Location.X = 0;