mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 18:39:18 +02:00
Obsługuje rózne warianty RList i MotorParamTable
This commit is contained in:
@@ -5959,32 +5959,26 @@ bool TMoverParameters::readMPT(int ln, std::string line)
|
|||||||
//--WriteLog("MPT: " + xline);
|
//--WriteLog("MPT: " + xline);
|
||||||
x = Split(line);
|
x = Split(line);
|
||||||
|
|
||||||
if (x.size() != 7)
|
int s = x.size();
|
||||||
|
if ( s < 7 && s > 8)
|
||||||
{
|
{
|
||||||
WriteLog("Read MPT: wrong argument number of arguments in line " + to_string(ln -1));
|
WriteLog("Read MPT: wrong argument number of arguments in line " + to_string(ln -1));
|
||||||
|
MPTLINE++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < s; i++)
|
||||||
|
x[i] = TrimSpace(x[i]);
|
||||||
|
|
||||||
p0 = TrimSpace(x[0]);
|
bl = atoi(x[0].c_str()); // numer pozycji
|
||||||
p1 = TrimSpace(x[1]);
|
|
||||||
p2 = TrimSpace(x[2]);
|
|
||||||
p3 = TrimSpace(x[3]);
|
|
||||||
p4 = TrimSpace(x[4]);
|
|
||||||
p5 = TrimSpace(x[5]);
|
|
||||||
p6 = TrimSpace(x[6]);
|
|
||||||
|
|
||||||
if (AutoRelayType == 0)
|
MotorParam[bl].mfi = atof(x[1].c_str());
|
||||||
as = false;
|
MotorParam[bl].mIsat = atof(x[2].c_str());
|
||||||
bl = atoi(p0.c_str()); // numer pozycji
|
MotorParam[bl].mfi0 = atof(x[3].c_str());
|
||||||
|
MotorParam[bl].fi = atof(x[4].c_str());
|
||||||
MotorParam[bl].mfi = atof(p1.c_str());
|
MotorParam[bl].Isat = atof(x[5].c_str());
|
||||||
MotorParam[bl].mIsat = atof(p2.c_str());
|
MotorParam[bl].fi0 = atof(x[6].c_str());
|
||||||
MotorParam[bl].mfi0 = atof(p3.c_str());
|
MotorParam[bl].AutoSwitch = s == 8 ? atoi(x[7].c_str()): false;
|
||||||
MotorParam[bl].fi = atof(p4.c_str());
|
|
||||||
MotorParam[bl].Isat = atof(p5.c_str());
|
|
||||||
MotorParam[bl].fi0 = atof(p6.c_str());
|
|
||||||
MotorParam[bl].AutoSwitch = as;
|
|
||||||
|
|
||||||
//--WriteLog(":::: " + p0 + "," + p1 + "," + p2 + "," + p3 + "," + p4 + "," + p5 + "," +
|
//--WriteLog(":::: " + p0 + "," + p1 + "," + p2 + "," + p3 + "," + p4 + "," + p5 + "," +
|
||||||
//p6);
|
//p6);
|
||||||
@@ -6013,18 +6007,17 @@ bool TMoverParameters::readRLIST(int ln, std::string line)
|
|||||||
|
|
||||||
x = Split(xxx); // split je wskaznik na char jak i std::string
|
x = Split(xxx); // split je wskaznik na char jak i std::string
|
||||||
|
|
||||||
if (x.size() != 5)
|
int s = x.size();
|
||||||
|
if ( s < 5 && s > 6)
|
||||||
{
|
{
|
||||||
WriteLog("Read RLIST: wrong argument number of arguments in line " + to_string(ln - 1));
|
WriteLog("Read RLIST: wrong argument number of arguments in line " + to_string(ln - 1));
|
||||||
delete[] xxx;
|
delete[] xxx;
|
||||||
|
RLISTLINE++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
p0 = TrimSpace(x[0]);
|
for (int i = 0; i < s; i++)
|
||||||
p1 = TrimSpace(x[1]);
|
x[i] = TrimSpace(x[i]);
|
||||||
p2 = TrimSpace(x[2]);
|
|
||||||
p3 = TrimSpace(x[3]);
|
|
||||||
p4 = TrimSpace(x[4]);
|
|
||||||
|
|
||||||
int k = ln - 1;
|
int k = ln - 1;
|
||||||
|
|
||||||
@@ -6032,12 +6025,12 @@ bool TMoverParameters::readRLIST(int ln, std::string line)
|
|||||||
if (RlistSize > ResArraySize)
|
if (RlistSize > ResArraySize)
|
||||||
ConversionError = -4;
|
ConversionError = -4;
|
||||||
|
|
||||||
RList[k].Relay = atoi(p0.c_str()); // int
|
RList[k].Relay = atoi(x[0].c_str()); // int
|
||||||
RList[k].R = atof(p1.c_str()); // double
|
RList[k].R = atof(x[1].c_str()); // double
|
||||||
RList[k].Bn = atoi(p2.c_str()); // int
|
RList[k].Bn = atoi(x[2].c_str()); // int
|
||||||
RList[k].Mn = atoi(p3.c_str()); // int
|
RList[k].Mn = atoi(x[3].c_str()); // int
|
||||||
RList[k].AutoSwitch = false; // p4.ToInt();
|
RList[k].AutoSwitch = (bool)atoi(x[4].c_str()); // p4.ToInt();
|
||||||
|
RList[k].ScndAct = s == 6 ? atoi(x[5].c_str()) : 0; //jeśli ma boczniki w nastawniku
|
||||||
//--WriteLog("RLIST: " + p0 + "," + p1 + "," + p2 + "," + p3 + "," + p4);
|
//--WriteLog("RLIST: " + p0 + "," + p1 + "," + p2 + "," + p3 + "," + p4);
|
||||||
}
|
}
|
||||||
delete[] xxx;
|
delete[] xxx;
|
||||||
@@ -6062,26 +6055,24 @@ bool TMoverParameters::readBPT(int ln, std::string line)
|
|||||||
xxx = TrimAndReduceSpaces(line.c_str());
|
xxx = TrimAndReduceSpaces(line.c_str());
|
||||||
x = Split(xxx);
|
x = Split(xxx);
|
||||||
|
|
||||||
if (x.size() != 5)
|
int s = x.size();
|
||||||
|
if (s != 5)
|
||||||
{
|
{
|
||||||
WriteLog("Read BPT: wrong argument number of arguments in line " + to_string(ln - 1));
|
WriteLog("Read BPT: wrong argument number of arguments in line " + to_string(ln - 1));
|
||||||
delete[] xxx;
|
delete[] xxx;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
p0 = TrimSpace(x[0]);
|
for (int i = 0; i < s; i++)
|
||||||
p1 = TrimSpace(x[1]);
|
x[i] = TrimSpace(x[i]);
|
||||||
p2 = TrimSpace(x[2]);
|
|
||||||
p3 = TrimSpace(x[3]);
|
|
||||||
p4 = TrimSpace(x[4]);
|
|
||||||
|
|
||||||
k = atoi(p0.c_str());
|
k = atoi(x[0].c_str());
|
||||||
BrakePressureTable[k].PipePressureVal = atof(p1.c_str());
|
BrakePressureTable[k].PipePressureVal = atof(x[1].c_str());
|
||||||
BrakePressureTable[k].BrakePressureVal = atof(p2.c_str());
|
BrakePressureTable[k].BrakePressureVal = atof(x[2].c_str());
|
||||||
BrakePressureTable[k].FlowSpeedVal = atof(p3.c_str());
|
BrakePressureTable[k].FlowSpeedVal = atof(x[3].c_str());
|
||||||
if (p4 == "Pneumatic")
|
if (x[4] == "Pneumatic")
|
||||||
BrakePressureTable[k].BrakeType = Pneumatic;
|
BrakePressureTable[k].BrakeType = Pneumatic;
|
||||||
else if (p4 == "ElectroPneumatic")
|
else if (x[4] == "ElectroPneumatic")
|
||||||
BrakePressureTable[k].BrakeType = ElectroPneumatic;
|
BrakePressureTable[k].BrakeType = ElectroPneumatic;
|
||||||
else
|
else
|
||||||
BrakePressureTable[k].BrakeType = Individual;
|
BrakePressureTable[k].BrakeType = Individual;
|
||||||
|
|||||||
@@ -89,18 +89,22 @@ bool SetFlag(int &Flag, int Value)
|
|||||||
bool iSetFlag(int &Flag, int Value)
|
bool iSetFlag(int &Flag, int Value)
|
||||||
{
|
{
|
||||||
if (Value > 0)
|
if (Value > 0)
|
||||||
|
{
|
||||||
if ((Flag & Value) == 0)
|
if ((Flag & Value) == 0)
|
||||||
{
|
{
|
||||||
Flag |= Value;
|
Flag |= Value;
|
||||||
return true; // true, gdy by³o wczeœniej 0 i zosta³o ustawione
|
return true; // true, gdy by³o wczeœniej 0 i zosta³o ustawione
|
||||||
}
|
}
|
||||||
if (Value < 0)
|
}
|
||||||
Value = abs(Value);
|
else if (Value < 0)
|
||||||
|
{
|
||||||
|
Value = abs(Value);
|
||||||
if ((Flag & Value) == Value)
|
if ((Flag & Value) == Value)
|
||||||
{
|
{
|
||||||
Flag &= ~Value; // Value jest ujemne, czyli zerowanie flagi
|
Flag &= ~Value; // Value jest ujemne, czyli zerowanie flagi
|
||||||
return true; // true, gdy by³o wczeœniej 1 i zosta³o wyzerowane
|
return true; // true, gdy by³o wczeœniej 1 i zosta³o wyzerowane
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user