Projekt się buduje, ale ma 3k warningów.

This commit is contained in:
firleju
2016-10-31 07:38:45 +01:00
parent 1491681576
commit cd08fe0b5d
25 changed files with 620 additions and 694 deletions

View File

@@ -26,6 +26,7 @@ http://mozilla.org/MPL/2.0/.
#include "MemCell.h"
#include "World.h"
#include "dir.h"
#include "mctools.h"
#define LOGVELOCITY 0
#define LOGORDERS 0
@@ -87,7 +88,7 @@ const double HardAcceleration = 0.9;
const double PrepareTime = 2.0; //[s] przeb<65>yski <20>wiadomo<6D>ci przy odpalaniu
bool WriteLogFlag = false;
AnsiString StopReasonTable[] = {
string StopReasonTable[] = {
// przyczyny zatrzymania ruchu AI
"", // stopNone, //nie ma powodu - powinien jecha<68>
"Off", // stopSleep, //nie zosta<74> odpalony, to nie pojedzie
@@ -244,7 +245,8 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
if (trTrack->iNumDynamics > 0) // a skrzy<7A>owanie zawiera pojazd
{
if (Global::iWriteLogEnabled & 8)
WriteLog("Tor " + trTrack->NameGet() + " zajety przed pojazdem. Num=" + trTrack->iNumDynamics + "Dist= " + fDist);
WriteLog("Tor " + trTrack->NameGet() + " zajety przed pojazdem. Num=" +
to_string(trTrack->iNumDynamics) + "Dist= " + to_string(fDist));
fVelNext =
0.0; // to zabroni<6E> wjazdu (chyba <20>e ten z przodu te<74> jedzie prosto)
}
@@ -267,7 +269,8 @@ bool TSpeedPos::Update(vector3 *p, vector3 *dir, double &len)
0) // je<6A>li jeszcze nie wjechano na tor, a co<63> na nim jest
{
if (Global::iWriteLogEnabled & 8)
WriteLog("Rozjazd " + trTrack->NameGet() + " zajety przed pojazdem. Num=" + trTrack->iNumDynamics + "Dist= "+fDist);
WriteLog("Rozjazd " + trTrack->NameGet() + " zajety przed pojazdem. Num=" +
to_string(trTrack->iNumDynamics) + "Dist= "+ to_string(fDist));
//fDist -= 30.0;
fVelNext = 0.0; // to niech stanie w zwi<77>kszonej odleg<65>o<EFBFBD>ci
// else if (fVelNext==0.0) //je<6A>li zosta<74>a wyzerowana
@@ -810,7 +813,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
{ // o ile dana pozycja tabelki jest istotna
if (sSpeedTable[i].iFlags & spPassengerStopPoint)
{ // je<6A>li przystanek, trzeba obs<62>u<EFBFBD>y<EFBFBD> wg rozk<7A>adu
if (sSpeedTable[i].evEvent->CommandGet() != AnsiString(asNextStop.c_str()))
if (sSpeedTable[i].evEvent->CommandGet() != asNextStop)
{ // je<6A>li nazwa nie jest zgodna
if (sSpeedTable[i].fDist < -fLength) // je<6A>li zosta<74> przejechany
sSpeedTable[i].iFlags =
@@ -830,7 +833,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
#if LOGSTOPS
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName + ": at " +
to_string(GlobalTime->hh) + ":" + to_string(GlobalTime->mm) +
" skipped " + asNextStop.); // informacja
" skipped " + asNextStop); // informacja
#endif
fLastStopExpDist = mvOccupied->DistCounter + 0.250 +
0.001 * fLength; // przy jakim dystansie (stanie
@@ -1026,7 +1029,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
else
{ // je<6A>li dojechali<6C>my do ko<6B>ca rozk<7A>adu
#if LOGSTOPS
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName) +
WriteLog(pVehicle->asName + " as " + TrainParams->TrainName +
": at " + to_string(GlobalTime->hh) + ":" +
to_string(GlobalTime->mm) +
" end of route."); // informacja
@@ -1486,17 +1489,17 @@ TController::TController(bool AI, TDynamicObject *NewControll, bool InitPsyche,
if (WriteLogFlag)
{
mkdir("physicslog\\");
LogFile.open("physicslog\\" + VehicleName.c_str() + ".dat",
LogFile.open(string("physicslog\\" + VehicleName + ".dat").c_str(),
std::ios::in | std::ios::out | std::ios::trunc);
#if LOGPRESS == 0
LogFile << AnsiString(" Time [s] Velocity [m/s] Acceleration [m/ss] Coupler.Dist[m] "
LogFile << string(" Time [s] Velocity [m/s] Acceleration [m/ss] Coupler.Dist[m] "
"Coupler.Force[N] TractionForce [kN] FrictionForce [kN] "
"BrakeForce [kN] BrakePress [MPa] PipePress [MPa] "
"MotorCurrent [A] MCP SCP BCP LBP DmgFlag Command CVal1 CVal2")
.c_str() << "\r\n";
#endif
#if LOGPRESS == 1
LogFile << AnsiString("t\tVel\tAcc\tPP\tVVP\tBP\tBVP\tCVP").c_str() << "\n";
LogFile << string("t\tVel\tAcc\tPP\tVVP\tBP\tBVP\tCVP").c_str() << "\n";
#endif
LogFile.flush();
}
@@ -1874,8 +1877,8 @@ bool TController::CheckVehicles(TOrders user)
{
if (TrainParams)
if (p->asDestination == "none")
p->DestinationSet(AnsiString(TrainParams->Relation2.c_str()),
AnsiString(TrainParams->TrainName.c_str())); // relacja docelowa, je<6A>li nie by<62>o
p->DestinationSet(TrainParams->Relation2,
TrainParams->TrainName); // relacja docelowa, je<6A>li nie by<62>o
if (AIControllFlag) // je<6A>li prowadzi komputer
p->RaLightsSet(0, 0); // gasimy <20>wiat<61>a
if (p->MoverParameters->EnginePowerSource.SourceType == CurrentCollector)
@@ -2890,7 +2893,7 @@ void TController::RecognizeCommand()
}
void TController::PutCommand(std::string NewCommand, double NewValue1, double NewValue2,
const TLocation &NewLocation, TStopReason reason = stopComm)
const TLocation &NewLocation, TStopReason reason)
{ // wys<79>anie komendy przez event PutValues, jak pojazd ma obsad<61>, to wysy<73>a tutaj, a nie do pojazdu
// bezpo<70>rednio
vector3 sl;
@@ -2902,7 +2905,7 @@ void TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
}
bool TController::PutCommand(std::string NewCommand, double NewValue1, double NewValue2,
const vector3 *NewLocation, TStopReason reason = stopComm)
const vector3 *NewLocation, TStopReason reason)
{ // analiza komendy
if (NewCommand == "CabSignal")
{ // SHP wyzwalane jest przez cz<63>on z obsad<61>, ale obs<62>ugiwane przez silnikowy
@@ -2926,16 +2929,16 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
mvOccupied->PutCommand("Emergency_brake", 1.0, 1.0, mvOccupied->Loc);
return true; // za<7A>atwione
}
else if (NewCommand.Pos("Timetable:") == 1)
else if (NewCommand.find("Timetable:") == 0)
{ // przypisanie nowego rozk<7A>adu jazdy, r<>wnie<69> prowadzonemu przez u<>ytkownika
NewCommand.Delete(1, 10); // zostanie nazwa pliku z rozk<7A>adem
NewCommand = NewCommand.erase(0, 10); // zostanie nazwa pliku z rozk<7A>adem
#if LOGSTOPS
WriteLog("New timetable for " + pVehicle->asName + ": " + NewCommand); // informacja
#endif
if (!TrainParams)
TrainParams = new TTrainParameters(std::string(NewCommand.c_str())); // rozk<7A>ad jazdy
TrainParams = new TTrainParameters(NewCommand); // rozk<7A>ad jazdy
else
TrainParams->NewName(std::string(NewCommand.c_str())); // czy<7A>ci tabelk<6C> przystank<6E>w
TrainParams->NewName(NewCommand); // czy<7A>ci tabelk<6C> przystank<6E>w
delete tsGuardSignal;
tsGuardSignal = NULL; // wywalenie kierownika
if (NewCommand != "none")
@@ -2947,7 +2950,7 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
if (ConversionError == -8)
ErrorLog("Missed timetable: " + NewCommand);
WriteLog("Cannot load timetable file " + NewCommand + "\r\nError " +
ConversionError + " in position " + TrainParams->StationCount);
to_string(ConversionError) + " in position " + to_string(TrainParams->StationCount));
NewCommand = ""; // puste, dla wymiennej tekstury
}
else
@@ -2959,10 +2962,9 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
asNextStop = TrainParams->NextStop();
iDrivigFlags |= movePrimary; // skoro dosta<74> rozk<7A>ad, to jest teraz g<><67>wnym
NewCommand = Global::asCurrentSceneryPath + NewCommand + ".wav"; // na razie jeden
if (FileExists(NewCommand))
if (fileExists(NewCommand))
{ // wczytanie d<>wi<77>ku odjazdu podawanego bezpo<70>renido
tsGuardSignal = new TTextSound();
tsGuardSignal->Init(NewCommand.c_str(), 30, pVehicle->GetPosition().x,
tsGuardSignal = new TTextSound(NewCommand.c_str(), 30, pVehicle->GetPosition().x,
pVehicle->GetPosition().y, pVehicle->GetPosition().z,
false);
// rsGuardSignal->Stop();
@@ -2970,23 +2972,22 @@ bool TController::PutCommand(std::string NewCommand, double NewValue1, double Ne
}
else
{
NewCommand.Insert("radio", NewCommand.Length() - 3); // wstawienie przed kropk<70>
if (FileExists(NewCommand))
NewCommand = NewCommand.insert(NewCommand.find_last_of("."),"radio"); // wstawienie przed kropk<70>
if (fileExists(NewCommand))
{ // wczytanie d<>wi<77>ku odjazdu w wersji radiowej (s<>ycha<68> tylko w kabinie)
tsGuardSignal = new TTextSound();
tsGuardSignal->Init(NewCommand.c_str(), -1, pVehicle->GetPosition().x,
tsGuardSignal = new TTextSound(NewCommand.c_str(), -1, pVehicle->GetPosition().x,
pVehicle->GetPosition().y, pVehicle->GetPosition().z,
false);
iGuardRadio = iRadioChannel;
}
}
NewCommand = AnsiString(TrainParams->Relation2.c_str()); // relacja docelowa z rozk<7A>adu
NewCommand = TrainParams->Relation2; // relacja docelowa z rozk<7A>adu
}
// jeszcze poustawia<69> tekstury na wy<77>wietlaczach
TDynamicObject *p = pVehicles[0];
while (p)
{
p->DestinationSet(NewCommand, AnsiString(TrainParams->TrainName.c_str())); // relacja docelowa
p->DestinationSet(NewCommand, TrainParams->TrainName); // relacja docelowa
p = p->Next(); // pojazd pod<6F><64>czony od ty<74>u (licz<63>c od czo<7A>a)
}
}
@@ -4880,7 +4881,7 @@ void TController::OrdersDump()
WriteLog("Orders for " + pVehicle->asName + ":");
for (int b = 0; b < maxorders; ++b)
{
WriteLog(AnsiString(b) + ": " + Order2Str(OrderList[b]) + (OrderPos == b ? " <-" : ""));
WriteLog(to_string(b) + ": " + Order2Str(OrderList[b]) + (OrderPos == b ? " <-" : ""));
if (b) // z wyj<79>tkiem pierwszej pozycji
if (OrderList[b] == Wait_for_orders) // je<6A>li ko<6B>cowa komenda
break; // dalej nie trzeba
@@ -4988,7 +4989,7 @@ void TController::OrdersInit(double fVel)
// Ale mozna by je zapodac ze scenerii
};
AnsiString TController::StopReasonText()
string TController::StopReasonText()
{ // informacja tekstowa o przyczynie zatrzymania
if (eStopReason != 7) // zawalidroga b<>dzie inaczej
return StopReasonTable[eStopReason];
@@ -5300,11 +5301,11 @@ std::string TController::NextStop()
return ""; // tu nie powinno nigdy wej<65><6A>
TMTableLine *t = TrainParams->TimeTable + TrainParams->StationIndex;
if (t->Dh >= 0) // je<6A>li jest godzina odjazdu
return asNextStop.substr(19, 30) + " " + Global::to_string(t->Dh) + ":" +
Global::to_string(t->Dm); // odjazd
return asNextStop.substr(19, 30) + " " + to_string(t->Dh) + ":" +
to_string(t->Dm); // odjazd
else if (t->Ah >= 0) // przyjazd
return asNextStop.substr(19, 30) + " (" + Global::to_string(t->Ah) + ":" +
Global::to_string(t->Am) + ")"; // przyjazd
return asNextStop.substr(19, 30) + " (" + to_string(t->Ah) + ":" +
to_string(t->Am) + ")"; // przyjazd
return "";
};
@@ -5477,5 +5478,5 @@ void TController::RouteSwitch(int d)
};
std::string TController::OwnerName()
{
return pVehicle ? pVehicle->MoverParameters->Name : ("none");
return pVehicle ? pVehicle->MoverParameters->Name : string("none");
};

View File

@@ -13,8 +13,8 @@
ResourceManager.obj VBO.obj mtable.obj TextureDDS.obj
opengl\ARB_Multisample.obj Float3d.obj Classes.obj Driver.obj Names.obj
Console.obj McZapkie\Mover.obj McZapkie\hamulce.obj
McZapkie\Oerlikon_ESt.obj McZapkie\friction.obj Console\PoKeys55.obj
Forth.obj Console\LPT.obj PyInt.obj"/>
McZapkie\Oerlikon_ESt.obj McZapkie\friction.obj McZapkie\mctools.obj
Console\PoKeys55.obj Forth.obj Console\LPT.obj PyInt.obj"/>
<RESFILES value="EU07.res"/>
<IDLFILES value=""/>
<IDLGENFILES value=""/>

View File

@@ -83,6 +83,7 @@ USEUNIT("McZapkie\Mover.cpp");
USEUNIT("McZapkie\hamulce.cpp");
USEUNIT("McZapkie\Oerlikon_ESt.cpp");
USEUNIT("McZapkie\friction.cpp");
USEUNIT("McZapkie\mctools.cpp");
USEUNIT("Console\PoKeys55.cpp");
USEUNIT("Forth.cpp");
USEUNIT("Console\LPT.cpp");
@@ -761,3 +762,6 @@ int WINAPI WinMain(HINSTANCE hInstance, // instance
KillGLWindow(); // kill the window
return (msg.wParam); // exit the program
}

View File

@@ -24,6 +24,7 @@ http://mozilla.org/MPL/2.0/.
#include "MemCell.h"
#include "Globals.h"
#include "Ground.h"
#include "McZapkie\mctools.h"
#pragma package(smart_init)
TEvent::TEvent(string m)

View File

@@ -927,103 +927,5 @@ double Global::CutValueToRange(double min, double value, double max)
return value;
};
std::string to_string(int _Val)
{
std::ostringstream o;
o << _Val;
return o.str();
};
std::string to_string(unsigned int _Val)
{
std::ostringstream o;
o << _Val;
return o.str();
};
std::string to_string(double _Val)
{
std::ostringstream o;
o << _Val;
return o.str();
};
std::string to_string(int _Val, int precision)
{
std::ostringstream o;
o << std::fixed << std::setprecision(precision);
o << _Val;
return o.str();
};
std::string to_string(double _Val, int precision)
{
std::ostringstream o;
o << std::fixed << std::setprecision(precision);
o << _Val;
return o.str();
};
std::string to_string(int _Val, int precision, int width)
{
std::ostringstream o;
o.width(width);
o << std::fixed << std::setprecision(precision);
o << _Val;
return o.str();
};
std::string to_string(double _Val, int precision, int width)
{
std::ostringstream o;
o.width(width);
o << std::fixed << std::setprecision(precision);
o << _Val;
return o.str();
};
std::string to_hex_str(double _Val, int precision, int width)
{
std::ostringstream o;
if (width)
o.width(width);
o << std::fixed << std::hex;
if (precision)
o << std::setprecision(precision);
o << _Val;
return o.str();
};
int stol_def(const std::string &str, const int &DefaultValue)
{
// this function was developed iteratively on Codereview.stackexchange
// with the assistance of @Corbin
std::size_t len = str.size();
while (std::isspace(str[len - 1]))
len--;
if (len == 0)
return DefaultValue;
errno = 0;
char *s = new char[len + 1];
std::strncpy(s, str.c_str(), len);
char *p;
int result = strtol(s, &p, 0);
if ((*p != '\0') || (errno != 0))
{
return DefaultValue;
}
delete s;
return result;
}
std::string ToLower(std::string text)
{
std::transform(text.begin(), text.end(), text.begin(), ::tolower);
}
std::string ToUpper(std::string text)
{
std::transform(text.begin(), text.end(), text.begin(), ::toupper);
}
#pragma package(smart_init)

View File

@@ -326,19 +326,7 @@ class Global
static double CutValueToRange(double min, double value, double max);
};
std::string to_string(int _Val);
std::string to_string(unsigned int _Val);
std::string to_string(int _Val, int precision);
std::string to_string(int _Val, int precision, int width);
std::string to_string(double _Val);
std::string to_string(double _Val, int precision);
std::string to_string(double _Val, int precision, int width);
std::string to_hex_str(int _Val, int precision = 0, int width = 0);
int stol_def(const std::string & str, const int & DefaultValue);
std::string ToLower(std::string text);
std::string ToUpper(std::string text);
//---------------------------------------------------------------------------
#endif

View File

@@ -1760,7 +1760,6 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
3.0;
break;
case TP_SOUND:
tmp->tsStaticSound = new TTextSound;
parser->getTokens(3);
*parser >> tmp->pCenter.x >> tmp->pCenter.y >> tmp->pCenter.z;
tmp->pCenter.RotateY(aRotate.y / 180.0 * M_PI); // Ra 2014-11: uwzglêdnienie rotacji
@@ -1769,7 +1768,7 @@ TGroundNode * TGround::AddGroundNode(cParser *parser)
*parser >> token;
str = token;
//str = AnsiString(token.c_str());
tmp->tsStaticSound->Init(strdup(str.c_str()), sqrt(tmp->fSquareRadius), tmp->pCenter.x,
tmp->tsStaticSound = new TTextSound(strdup(str.c_str()), sqrt(tmp->fSquareRadius), tmp->pCenter.x,
tmp->pCenter.y, tmp->pCenter.z, false, rmin);
if (rmin < 0.0)
rmin =

2
Logs.h
View File

@@ -24,7 +24,7 @@ void ErrorLog(const std::string &str, bool newline = true);
void WriteLog(const AnsiString &str, bool newline = true);
void WriteLog(const std::string &str, bool newline = true);
void CommLog(const char *str);
void CommLog(const std::string);
void CommLog(const std::string &str);
void CommLog(const AnsiString &str);
//---------------------------------------------------------------------------
#endif

View File

@@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/.
#include "Oerlikon_ESt.h"
#include "hamulce.h"
#include <string>
#include <mctools.h>
/*

View File

@@ -23,7 +23,7 @@ http://mozilla.org/MPL/2.0/.
#include "Mover.h"
#include "../globals.h"
//#include "../qutils.h"
#include "mctools.h"
#include <mctools.h>
#include "../logs.h"
#include "hamulce.h"
#include "Oerlikon_ESt.h"
@@ -3574,17 +3574,17 @@ double TMoverParameters::Adhesive(double staticfriction)
{
if (SandDose)
adhesive = (Max0R(staticfriction * (100.0 + Vel) / ((50.0 + Vel) * 11.0), 0.048)) *
(11.0 - 2.0 * random(0.0, 1.0));
(11.0 - 2.0 * Random(0.0, 1.0));
else
adhesive = (staticfriction * (100.0 + Vel) / ((50.0 + Vel) * 10)) *
(11.0 - 2.0 * random(0.0, 1.0));
(11.0 - 2.0 * Random(0.0, 1.0));
}
else
{
if (SandDose)
adhesive = (0.048) * (11 - 2 * random(0.0, 1.0));
adhesive = (0.048) * (11 - 2 * Random(0.0, 1.0));
else
adhesive = (staticfriction * 0.02) * (11 - 2 * random(0.0, 1.0));
adhesive = (staticfriction * 0.02) * (11 - 2 * Random(0.0, 1.0));
}
// WriteLog(FloatToStr(adhesive)); // tutaj jest na poziomie 0.2 - 0.3
return adhesive;
@@ -5409,12 +5409,12 @@ int mSize;
double nMmax, nnMmax, nMnmax, nnmax, nnominalfill, nMstand;
int nSize;
int ti(std::string val)
/*inline int ti(std::string val)
{
return atoi(val.c_str());
}
double td(std::string val)
inline double td(std::string val)
{
return atof(val.c_str());
}
@@ -5430,14 +5430,15 @@ std::string ts(std::string val)
std::string tS(std::string val)
{
return ToUpper(val);
}
}*/
// *************************************************************************************************
// Q: 20160717
// *************************************************************************************************
int Pos(std::string find, std::string in)
int Pos(std::string str_find, std::string in)
{
return (in.Pos(find));
size_t pos = in.find(str_find);
return (pos ? pos : 0);
}
// *************************************************************************************************
@@ -5446,7 +5447,7 @@ int Pos(std::string find, std::string in)
bool issection(std::string name)
{
sectionname = name;
if (xline.Pos(name) > 0)
if (xline.find(name) != string::npos)
{
lastsectionname = name;
return true;
@@ -5470,19 +5471,19 @@ std::string getkeyval(int rettype, std::string key)
if (Pos(key, xline) > 0) // jezeli jest klucz w swkcji...
{
int klen = key.Length();
int klen = key.length();
int kpos = Pos(key, xline) - 1;
temp.Delete(1, kpos + klen);
if (temp.Pos(" ") > 0)
to = temp.Pos(" ");
temp.erase(0, kpos + klen);
if (temp.find(" ") != string::npos)
to = temp.find(" ");
else
to = 255;
kval = temp.SubString(1, to);
kval = temp.substr(0, to);
if (kval != "")
kval = kval.Trim(); // wyciagnieta wartosc
kval = TrimSpace(kval); // wyciagnieta wartosc
sectionname = StringReplace(sectionname, ":", "", TReplaceFlags() << rfReplaceAll);
sectionname = StringReplace(sectionname, ".", "", TReplaceFlags() << rfReplaceAll);
sectionname = ExchangeCharInString(sectionname, (char)":", (char)"");
sectionname = ExchangeCharInString(sectionname, (char)".", (char)"");
//--WriteLog(sectionname + "." + keyname + " val= [" + kval + "]");
// if (rettype == 1) vS = kval;
@@ -5490,8 +5491,9 @@ std::string getkeyval(int rettype, std::string key)
// if (kval != "" && rettype == 3) vD = StrToFloat(kval);
}
else
kval = "0"; // gdy nie bylo klucza TODO: dodac do funkcji parametr z wartoscia fabryczna
kval = ""; // gdy nie bylo klucza TODO: dodac do funkcji parametr z wartoscia fabryczna
// UWAGA! 0 moze powodowac bledy, przemyslec zwracanie wartosci gdy nie ma klucza!!!
// zwraca pusty klucz GF 2016-10-26
return kval;
}
@@ -5501,6 +5503,32 @@ int MARKERROR(int code, std::string type, std::string msg)
return code;
}
int s2NPW(string s)
{ // wylicza ilosc osi napednych z opisu ukladu osi
const char A = (char)"A" - (char)1;
int k;
int NPW = 0;
for (k = 0; k < s.length(); k++)
{
if (s[k] >= (char)"A" && s[k] <= (char)"Z")
NPW += s[k] - A;
}
return NPW;
}
int s2NNW(string s)
{ // wylicza ilosc osi nienapedzanych z opisu ukladu osi
const char Zero = (char)"0";
int k;
int NNW = 0;
for (k = 0; k < s.length(); k++)
{
if (s[k] >= (char)"1" && s[k] <= (char)"9")
NNW += s[k] - Zero;
}
return NNW;
}
// *************************************************************************************************
// Q: 20160717
// *************************************************************************************************
@@ -5515,27 +5543,27 @@ bool TMoverParameters::readMPT(int ln, std::string xline)
if (ln > 0) // 0 to nazwa sekcji - MotorParamTable0:
{
//--WriteLog("MPT: " + xline);
x = split(xline.c_str(), ' ');
x = Split(xline, ' ');
p0 = Trim(x[0].c_str());
p1 = Trim(x[1].c_str());
p2 = Trim(x[2].c_str());
p3 = Trim(x[3].c_str());
p4 = Trim(x[4].c_str());
p5 = Trim(x[5].c_str());
p6 = Trim(x[6].c_str());
p0 = TrimSpace(x[0]);
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)
as = false;
bl = StrToInt(p0); // numer pozycji
bl = atoi(p0.c_str()); // numer pozycji
MotorParam[StrToInt(p0)].mfi = StrToFloat(p1);
MotorParam[StrToInt(p0)].mIsat = StrToFloat(p2);
MotorParam[StrToInt(p0)].mfi0 = StrToFloat(p3);
MotorParam[StrToInt(p0)].fi = StrToFloat(p4);
MotorParam[StrToInt(p0)].Isat = StrToFloat(p5);
MotorParam[StrToInt(p0)].fi0 = StrToFloat(p6);
MotorParam[StrToInt(p0)].AutoSwitch = as;
MotorParam[bl].mfi = atof(p1.c_str());
MotorParam[bl].mIsat = atof(p2.c_str());
MotorParam[bl].mfi0 = atof(p3.c_str());
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 + "," +
//p6);
@@ -5558,29 +5586,29 @@ bool TMoverParameters::readRLIST(int ln, std::string xline)
// WriteLog("RLIST: " + xline);
xline = Tab2Sp(xline); // zamieniamy taby na spacje (ile tabow tyle spacji bedzie)
xxx = trim_and_reduce_spaces(stdstrtochar(xline.c_str())); // konwertujemy na *char i
xxx = TrimAndReduceSpaces(xline.c_str()); // konwertujemy na *char i
// ograniczamy spacje pomiedzy
// parametrami do jednej
x = split(xxx, ' '); // split je wskaznik na char jak i std::string
x = Split(xxx, ' '); // split je wskaznik na char jak i std::string
p0 = Trim(x[0].c_str());
p1 = Trim(x[1].c_str());
p2 = Trim(x[2].c_str());
p3 = Trim(x[3].c_str());
p4 = Trim(x[4].c_str());
p5 = Trim(x[5].c_str());
p0 = TrimSpace(x[0]);
p1 = TrimSpace(x[1]);
p2 = TrimSpace(x[2]);
p3 = TrimSpace(x[3]);
p4 = TrimSpace(x[4]);
p5 = TrimSpace(x[5]);
int k = ln - 1;
RlistSize = s2b(mSize);
RlistSize = (mSize);
if (RlistSize > ResArraySize)
ConversionError = -4;
RList[k].Relay = p0.ToInt(); // int
RList[k].R = p1.ToDouble(); // double
RList[k].Bn = p2.ToInt(); // int
RList[k].Mn = p3.ToInt(); // int
RList[k].Relay = atoi(p0.c_str()); // int
RList[k].R = atof(p1.c_str()); // double
RList[k].Bn = atoi(p2.c_str()); // int
RList[k].Mn = atoi(p3.c_str()); // int
RList[k].AutoSwitch = false; // p4.ToInt();
//--WriteLog("RLIST: " + p0 + "," + p1 + "," + p2 + "," + p3 + "," + p4);
@@ -5603,19 +5631,19 @@ bool TMoverParameters::readBPT(int ln, std::string xline)
{
// WriteLog("BPT: " + xline);
xline = Tab2Sp(xline);
xxx = trim_and_reduce_spaces(stdstrtochar(xline.c_str()));
x = split(xxx, ' ');
xxx = TrimAndReduceSpaces(xline.c_str());
x = Split(xxx, ' ');
p0 = Trim(x[0].c_str());
p1 = Trim(x[1].c_str());
p2 = Trim(x[2].c_str());
p3 = Trim(x[3].c_str());
p4 = Trim(x[4].c_str());
p0 = TrimSpace(x[0]);
p1 = TrimSpace(x[1]);
p2 = TrimSpace(x[2]);
p3 = TrimSpace(x[3]);
p4 = TrimSpace(x[4]);
k = s2iE(p0);
BrakePressureTable[k].PipePressureVal = p1.ToDouble();
BrakePressureTable[k].BrakePressureVal = p2.ToDouble();
BrakePressureTable[k].FlowSpeedVal = p3.ToDouble();
k = atoi(p0.c_str());
BrakePressureTable[k].PipePressureVal = atof(p1.c_str());
BrakePressureTable[k].BrakePressureVal = atof(p2.c_str());
BrakePressureTable[k].FlowSpeedVal = atof(p3.c_str());
if (p4 == "Pneumatic")
BrakePressureTable[k].BrakeType = Pneumatic;
else if (p4 == "ElectroPneumatic")
@@ -5685,19 +5713,28 @@ void TMoverParameters::BrakeSubsystemDecode()
BrakeSubsystem = ss_None;
switch (BrakeValve)
{
case W, W_Lu_L, W_Lu_VI, W_Lu_XR:
case W:
case W_Lu_L:
case W_Lu_VI:
case W_Lu_XR:
BrakeSubsystem = ss_W;
break;
case ESt3, ESt3AL2, ESt4, EP2, EP1:
case ESt3:
case ESt3AL2:
case ESt4:
case EP2:
case EP1:
BrakeSubsystem = ss_ESt;
break;
case KE:
BrakeSubsystem = ss_KE;
break;
case CV1, CV1_L_TR:
case CV1:
case CV1_L_TR:
BrakeSubsystem = ss_Dako;
break;
case LSt, EStED:
case LSt:
case EStED:
BrakeSubsystem = ss_LSt;
break;
}
@@ -5802,18 +5839,18 @@ void TMoverParameters::PowerParamDecode(std::string lines, std::string prefix,
case CurrentCollector:
{
PowerParamDecode.CollectorParameters.CollectorsNo = s2lE(jCollectorsNo);
PowerParamDecode.CollectorParameters.MinH = s2rE(jMinH);
PowerParamDecode.CollectorParameters.MaxH = s2rE(jMaxH);
PowerParamDecode.CollectorParameters.CSW = s2rE(jCSW); // szerokoœæ czêœci roboczej
PowerParamDecode.CollectorParameters.MaxV = s2rE(jMaxVoltage);
PowerParamDecode.CollectorParameters.CollectorsNo = (jCollectorsNo);
PowerParamDecode.CollectorParameters.MinH = (jMinH);
PowerParamDecode.CollectorParameters.MaxH = (jMaxH);
PowerParamDecode.CollectorParameters.CSW = (jCSW); // szerokoœæ czêœci roboczej
PowerParamDecode.CollectorParameters.MaxV = (jMaxVoltage);
// s:=jMinV; //napiêcie roz³¹czaj¹ce WS
if (jMinV == 0)
PowerParamDecode.CollectorParameters.MinV =
0.5 * PowerParamDecode.CollectorParameters.MaxV; // gdyby parametr nie podany
else
PowerParamDecode.CollectorParameters.MinV = s2rE(jMinV);
PowerParamDecode.CollectorParameters.MinV = (jMinV);
//-s:=ExtractKeyWord(lines,'InsetV='); //napiêcie wymagane do za³¹czenia WS
//-if s='' then
@@ -5825,12 +5862,12 @@ void TMoverParameters::PowerParamDecode(std::string lines, std::string prefix,
PowerParamDecode.CollectorParameters.MinPress = 2.0; // domyœlnie 2 bary do za³¹czenia
// WS
else
PowerParamDecode.CollectorParameters.MinPress = s2rE(jMinPress);
PowerParamDecode.CollectorParameters.MinPress = (jMinPress);
// s:=ExtractKeyWord(lines,'MaxPress='); //maksymalne ciœnienie za reduktorem
if (jMaxPress == 0)
PowerParamDecode.CollectorParameters.MaxPress = 5.0 + 0.001 * (random(50) - random(50));
PowerParamDecode.CollectorParameters.MaxPress = 5.0 + 0.001 * (Random(50) - Random(50));
else
PowerParamDecode.CollectorParameters.MaxPress = s2rE(jMaxPress);
PowerParamDecode.CollectorParameters.MaxPress = (jMaxPress);
}
// case PowerCable:
//{
@@ -5862,9 +5899,9 @@ void TMoverParameters::PowerParamDecode(std::string lines, std::string prefix,
// *************************************************************************************************
bool TMoverParameters::LoadFIZ(std::string chkpath)
{
const param_ok = 1;
const wheels_ok = 2;
const dimensions_ok = 4;
const int param_ok = 1;
const int wheels_ok = 2;
const int dimensions_ok = 4;
int ishash;
int bl, i, k;
@@ -5892,6 +5929,11 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
// appdir = ExtractFilePath(ParamStr(0));
ifstream in(file.c_str());
if (!in.is_open())
{
WriteLog("E8 - FIZ FILE NOT EXIST.");
return false;
}
bool secBPT, secMotorParamTable0, secPower, secEngine, secParam, secLoad, secDimensions,
secWheels, secBrake, secBuffCoupl, secCntrl, secSecurity, secLight, secCircuit, secRList,
@@ -5910,7 +5952,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
if ((ishash == 0))
{
if (xline.Length() == 0)
if (xline.length() == 0)
startBPT = false; // Tablica parametyrow hamulca nie ma znacznika konca :(
if (issection("END-MPT"))
startMPT = false;
@@ -5921,207 +5963,207 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
{
secParam = true;
SetFlag(OKFlag, param_ok);
aCategory = ts(getkeyval(1, "Category"));
aType = tS(getkeyval(1, "Type"));
aMass = td(getkeyval(3, "M"));
aMred = td(getkeyval(3, "Mred"));
aVmax = td(getkeyval(3, "Vmax"));
aPWR = td(getkeyval(3, "PWR"));
aSandCap = ti(getkeyval(2, "SandCap"));
aHeatingP = td(getkeyval(3, "HeatingP"));
aLightP = td(getkeyval(3, "LightP"));
aCategory = getkeyval(1, "Category");
aType = ToUpper(getkeyval(1, "Type"));
aMass = atof(getkeyval(3, "M").c_str());
aMred = atof(getkeyval(3, "Mred").c_str());
aVmax = atof(getkeyval(3, "Vmax").c_str());
aPWR = atof(getkeyval(3, "PWR").c_str());
aSandCap = atoi(getkeyval(2, "SandCap").c_str());
aHeatingP = atof(getkeyval(3, "HeatingP").c_str());
aLightP = atof(getkeyval(3, "LightP").c_str());
}
if (issection("Load:"))
{
secLoad = true;
bMaxLoad = ti(getkeyval(2, "MaxLoad"));
bLoadQ = ts(getkeyval(1, "LoadQ"));
bLoadAccepted = ts(getkeyval(1, "LoadAccepted"));
bLoadSpeed = td(getkeyval(3, "LoadSpeed"));
bUnLoadSpeed = td(getkeyval(3, "UnLoadSpeed"));
bOverLoadFactor = td(getkeyval(3, "OverLoadFactor"));
bMaxLoad = atoi(getkeyval(2, "MaxLoad").c_str());
bLoadQ = getkeyval(1, "LoadQ");
bLoadAccepted = getkeyval(1, "LoadAccepted");
bLoadSpeed = atof(getkeyval(3, "LoadSpeed").c_str());
bUnLoadSpeed = atof(getkeyval(3, "UnLoadSpeed").c_str());
bOverLoadFactor = atof(getkeyval(3, "OverLoadFactor").c_str());
}
if (issection("Dimensions:"))
{
secDimensions = true;
SetFlag(OKFlag, dimensions_ok);
cL = td(getkeyval(3, "L"));
cH = td(getkeyval(3, "H"));
cW = td(getkeyval(3, "W"));
cCx = td(getkeyval(3, "Cx"));
cFloor = td(getkeyval(3, "Floor"));
cL = atof(getkeyval(3, "L").c_str());
cH = atof(getkeyval(3, "H").c_str());
cW = atof(getkeyval(3, "W").c_str());
cCx = atof(getkeyval(3, "Cx").c_str());
cFloor = atof(getkeyval(3, "Floor").c_str());
}
if (issection("Wheels:"))
{
secWheels = true;
dD = td(getkeyval(3, "D"));
dDl = td(getkeyval(3, "Dl"));
dDt = td(getkeyval(3, "Dt"));
dAIM = td(getkeyval(3, "AIM"));
dTw = td(getkeyval(3, "Tw"));
dAxle = ts(getkeyval(1, "Axle"));
dAd = td(getkeyval(3, "Ad"));
dBd = td(getkeyval(3, "Bd"));
dRmin = td(getkeyval(3, "Rmin"));
dBearingType = ts(getkeyval(1, "BearingType"));
dD = atof(getkeyval(3, "D").c_str());
dDl = atof(getkeyval(3, "Dl").c_str());
dDt = atof(getkeyval(3, "Dt").c_str());
dAIM = atof(getkeyval(3, "AIM").c_str());
dTw = atof(getkeyval(3, "Tw").c_str());
dAxle = getkeyval(1, "Axle");
dAd = atof(getkeyval(3, "Ad").c_str());
dBd = atof(getkeyval(3, "Bd").c_str());
dRmin = atof(getkeyval(3, "Rmin").c_str());
dBearingType = getkeyval(1, "BearingType");
}
if (issection("Brake:"))
{
secBrake = true;
eBrakeValve = ts(getkeyval(1, "BrakeValve"));
eNBpA = ti(getkeyval(2, "NBpA"));
eMBF = td(getkeyval(3, "MBF"));
eTBF = td(getkeyval(3, "TBF"));
eSize = ti(getkeyval(3, "Size"));
eMaxBP = td(getkeyval(3, "MaxBP"));
eMedMaxBP = td(getkeyval(3, "MedMaxBP"));
eTareMaxBP = td(getkeyval(3, "TareMaxBP"));
eMaxLBP = td(getkeyval(3, "MaxLBP"));
eMaxASBP = td(getkeyval(3, "MaxASBP"));
eRM = td(getkeyval(3, "RM"));
eBCN = ti(getkeyval(2, "BCN"));
eBCR = td(getkeyval(3, "BCR"));
eBCD = td(getkeyval(3, "BCD"));
eBCM = td(getkeyval(3, "BCM"));
eBCMlo = td(getkeyval(3, "BCMlo"));
eBCMhi = td(getkeyval(3, "BCMhi"));
eVv = td(getkeyval(3, "Vv"));
eMinCP = td(getkeyval(3, "MinCP"));
eMaxCP = td(getkeyval(3, "MaxCP"));
eBCS = td(getkeyval(3, "BCS"));
eBSA = td(getkeyval(3, "BSA"));
eBM = ts(getkeyval(1, "BM"));
eBVV = ti(getkeyval(2, "BVV"));
eBRE = td(getkeyval(3, "BRE"));
eHiPP = td(getkeyval(3, "HiPP"));
eLoPP = td(getkeyval(3, "LoPP"));
eCompressorSpeed = td(getkeyval(3, "CompressorSpeed"));
eCompressorPower = ts(getkeyval(1, "CompressorPower"));
eBrakeValve = getkeyval(1, "BrakeValve");
eNBpA = atoi(getkeyval(2, "NBpA").c_str());
eMBF = atof(getkeyval(3, "MBF").c_str());
eTBF = atof(getkeyval(3, "TBF").c_str());
eSize = atoi(getkeyval(3, "Size").c_str());
eMaxBP = atof(getkeyval(3, "MaxBP").c_str());
eMedMaxBP = atof(getkeyval(3, "MedMaxBP").c_str());
eTareMaxBP = atof(getkeyval(3, "TareMaxBP").c_str());
eMaxLBP = atof(getkeyval(3, "MaxLBP").c_str());
eMaxASBP = atof(getkeyval(3, "MaxASBP").c_str());
eRM = atof(getkeyval(3, "RM").c_str());
eBCN = atoi(getkeyval(2, "BCN").c_str());
eBCR = atof(getkeyval(3, "BCR").c_str());
eBCD = atof(getkeyval(3, "BCD").c_str());
eBCM = atof(getkeyval(3, "BCM").c_str());
eBCMlo = atof(getkeyval(3, "BCMlo").c_str());
eBCMhi = atof(getkeyval(3, "BCMhi").c_str());
eVv = atof(getkeyval(3, "Vv").c_str());
eMinCP = atof(getkeyval(3, "MinCP").c_str());
eMaxCP = atof(getkeyval(3, "MaxCP").c_str());
eBCS = atof(getkeyval(3, "BCS").c_str());
eBSA = atof(getkeyval(3, "BSA").c_str());
eBM = atof(getkeyval(1, "BM").c_str());
eBVV = atoi(getkeyval(2, "BVV").c_str());
eBRE = atof(getkeyval(3, "BRE").c_str());
eHiPP = atof(getkeyval(3, "HiPP").c_str());
eLoPP = atof(getkeyval(3, "LoPP").c_str());
eCompressorSpeed = atof(getkeyval(3, "CompressorSpeed").c_str());
eCompressorPower = atof(getkeyval(1, "CompressorPower").c_str());
}
if (issection("BuffCoupl.") || issection("BuffCoupl1."))
{
secBuffCoupl = true;
fCType = ts(getkeyval(1, "CType"));
fkB = td(getkeyval(3, "kB"));
fDmaxB = td(getkeyval(3, "DmaxB"));
fFmaxB = td(getkeyval(3, "FmaxB"));
fkC = td(getkeyval(3, "kC"));
fDmaxC = td(getkeyval(3, "DmaxC"));
fFmaxC = td(getkeyval(3, "FmaxC"));
fbeta = td(getkeyval(3, "beta"));
fAllowedFlag = ti(getkeyval(2, "AllowedFlag"));
fCType = (getkeyval(1, "CType"));
fkB = atof(getkeyval(3, "kB").c_str());
fDmaxB = atof(getkeyval(3, "DmaxB").c_str());
fFmaxB = atof(getkeyval(3, "FmaxB").c_str());
fkC = atof(getkeyval(3, "kC").c_str());
fDmaxC = atof(getkeyval(3, "DmaxC").c_str());
fFmaxC = atof(getkeyval(3, "FmaxC").c_str());
fbeta = atof(getkeyval(3, "beta").c_str());
fAllowedFlag = atoi(getkeyval(2, "AllowedFlag").c_str());
}
if (issection("Cntrl."))
{
secCntrl = true;
gBrakeSystem = ts(getkeyval(1, "BrakeSystem"));
gBCPN = ti(getkeyval(2, "BCPN"));
gBDelay1 = ti(getkeyval(2, "BDelay1"));
gBDelay2 = ti(getkeyval(2, "BDelay2"));
gBDelay3 = ti(getkeyval(2, "BDelay3"));
gBDelay4 = ti(getkeyval(2, "BDelay4"));
gASB = ts(getkeyval(1, "ASB"));
gLocalBrake = ts(getkeyval(1, "LocalBrake"));
gDynamicBrake = ts(getkeyval(1, "DynamicBrake"));
// gManualBrake = ts(getkeyval(1, "ManualBrake"));
gFSCircuit = ts(getkeyval(1, "FSCircuit"));
gMCPN = ti(getkeyval(2, "MCPN"));
gSCPN = ti(getkeyval(2, "SCPN"));
gSCIM = ti(getkeyval(2, "SCIM"));
gScndS = ts(getkeyval(1, "ScndS"));
gCoupledCtrl = ts(getkeyval(1, "CoupledCtrl"));
gAutoRelay = ts(getkeyval(1, "AutoRelay"));
gIniCDelay = td(getkeyval(3, "IniCDelay"));
gSCDelay = td(getkeyval(3, "SCDelay"));
gSCDDelay = td(getkeyval(3, "SCDDelay"));
gBrakeDelays = ts(getkeyval(1, "BrakeDelays"));
gBrakeHandle = ts(getkeyval(1, "BrakeHandle"));
gLocBrakeHandle = ts(getkeyval(1, "LocBrakeHandle"));
gMaxBPMass = td(getkeyval(3, "MaxBPMass"));
gBrakeSystem = (getkeyval(1, "BrakeSystem"));
gBCPN = atoi(getkeyval(2, "BCPN").c_str());
gBDelay1 = atoi(getkeyval(2, "BDelay1").c_str());
gBDelay2 = atoi(getkeyval(2, "BDelay2").c_str());
gBDelay3 = atoi(getkeyval(2, "BDelay3").c_str());
gBDelay4 = atoi(getkeyval(2, "BDelay4").c_str());
gASB = (getkeyval(1, "ASB"));
gLocalBrake = (getkeyval(1, "LocalBrake"));
gDynamicBrake = (getkeyval(1, "DynamicBrake"));
// gManualBrake = (getkeyval(1, "ManualBrake"));
gFSCircuit = (getkeyval(1, "FSCircuit").c_str());
gMCPN = atoi(getkeyval(2, "MCPN").c_str());
gSCPN = atoi(getkeyval(2, "SCPN").c_str());
gSCIM = atoi(getkeyval(2, "SCIM").c_str());
gScndS = (getkeyval(1, "ScndS"));
gCoupledCtrl = (getkeyval(1, "CoupledCtrl"));
gAutoRelay = (getkeyval(1, "AutoRelay"));
gIniCDelay = atof(getkeyval(3, "IniCDelay").c_str());
gSCDelay = atof(getkeyval(3, "SCDelay").c_str());
gSCDDelay = atof(getkeyval(3, "SCDDelay").c_str());
gBrakeDelays = (getkeyval(1, "BrakeDelays"));
gBrakeHandle = (getkeyval(1, "BrakeHandle"));
gLocBrakeHandle = (getkeyval(1, "LocBrakeHandle"));
gMaxBPMass = atof(getkeyval(3, "MaxBPMass").c_str());
}
if (issection("Security:"))
{
secSecurity = true;
hAwareSystem = ts(getkeyval(1, "AwareSystem"));
hAwareMinSpeed = td(getkeyval(3, "AwareMinSpeed"));
hAwareDelay = td(getkeyval(3, "AwareDelay"));
hSoundSignalDelay = td(getkeyval(3, "SoundSignalDelay"));
hEmergencyBrakeDelay = td(getkeyval(3, "EmergencyBrakeDelay"));
hRadioStop = ts(getkeyval(1, "RadioStop"));
hAwareSystem = (getkeyval(1, "AwareSystem"));
hAwareMinSpeed = atof(getkeyval(3, "AwareMinSpeed").c_str());
hAwareDelay = atof(getkeyval(3, "AwareDelay").c_str());
hSoundSignalDelay = atof(getkeyval(3, "SoundSignalDelay").c_str());
hEmergencyBrakeDelay = atof(getkeyval(3, "EmergencyBrakeDelay").c_str());
hRadioStop = (getkeyval(1, "RadioStop"));
}
if (issection("Light:"))
{
secLight = true;
iLight = ts(getkeyval(1, "Light"));
iLGeneratorEngine = ts(getkeyval(1, "LGeneratorEngine"));
iLMaxVoltage = td(getkeyval(3, "LMaxVoltage"));
iLMaxCurrent = td(getkeyval(3, "LMaxCurrent"));
iLight = (getkeyval(1, "Light"));
iLGeneratorEngine = (getkeyval(1, "LGeneratorEngine"));
iLMaxVoltage = atof(getkeyval(3, "LMaxVoltage").c_str());
iLMaxCurrent = atof(getkeyval(3, "LMaxCurrent").c_str());
}
if (issection("Power:"))
{
secPower = true;
jEnginePower = ts(getkeyval(1, "EnginePower"));
jSystemPower = ts(getkeyval(1, "SystemPower"));
jCollectorsNo = ti(getkeyval(2, "CollectorsNo"));
jMaxVoltage = td(getkeyval(3, "MaxVoltage"));
jMaxCurrent = td(getkeyval(3, "MaxCurrent"));
jIntR = td(getkeyval(3, "IntR"));
jMinH = td(getkeyval(3, "MinH"));
jMaxH = td(getkeyval(3, "MaxH"));
jCSW = td(getkeyval(3, "CSW"));
jMinV = td(getkeyval(3, "MinV"));
jMinPress = td(getkeyval(3, "MinPress"));
jMaxPress = td(getkeyval(3, "MaxPress"));
jEnginePower = (getkeyval(1, "EnginePower"));
jSystemPower = (getkeyval(1, "SystemPower"));
jCollectorsNo = atoi(getkeyval(2, "CollectorsNo").c_str());
jMaxVoltage = atof(getkeyval(3, "MaxVoltage").c_str());
jMaxCurrent = atof(getkeyval(3, "MaxCurrent").c_str());
jIntR = atof(getkeyval(3, "IntR").c_str());
jMinH = atof(getkeyval(3, "MinH").c_str());
jMaxH = atof(getkeyval(3, "MaxH").c_str());
jCSW = atof(getkeyval(3, "CSW").c_str());
jMinV = atof(getkeyval(3, "MinV").c_str());
jMinPress = atof(getkeyval(3, "MinPress").c_str());
jMaxPress = atof(getkeyval(3, "MaxPress").c_str());
}
if (issection("Engine:"))
{
secEngine = true;
kEngineType = ts(getkeyval(1, "EngineType"));
kTrans = ts(getkeyval(1, "Trans"));
kVolt = td(getkeyval(3, "Volt"));
kWindingRes = td(getkeyval(3, "WindingRes"));
knmax = td(getkeyval(3, "nmax"));
kEngineType = (getkeyval(1, "EngineType"));
kTrans = (getkeyval(1, "Trans"));
kVolt = atof(getkeyval(3, "Volt").c_str());
kWindingRes = atof(getkeyval(3, "WindingRes").c_str());
knmax = atof(getkeyval(3, "nmax").c_str());
}
if (issection("Circuit:"))
{
secCircuit = true;
lCircuitRes = td(getkeyval(3, "CircuitRes"));
lImaxLo = ti(getkeyval(2, "ImaxLo"));
lImaxHi = ti(getkeyval(2, "ImaxHi"));
lIminLo = ti(getkeyval(2, "IminLo"));
lIminHi = ti(getkeyval(2, "IminHi"));
lCircuitRes = atof(getkeyval(3, "CircuitRes").c_str());
lImaxLo = atoi(getkeyval(2, "ImaxLo").c_str());
lImaxHi = atoi(getkeyval(2, "ImaxHi").c_str());
lIminLo = atoi(getkeyval(2, "IminLo").c_str());
lIminHi = atoi(getkeyval(2, "IminHi").c_str());
}
if (issection("RList:"))
{
secRList = true;
mSize = ti(getkeyval(2, "Size"));
mRVent = ts(getkeyval(1, "RVent"));
mRVentnmax = td(getkeyval(3, "RVentnmax"));
mRVentCutOff = td(getkeyval(3, "RVentCutOff"));
mSize = atoi(getkeyval(2, "Size").c_str());
mRVent = (getkeyval(1, "RVent"));
mRVentnmax = atof(getkeyval(3, "RVentnmax").c_str());
mRVentCutOff = atof(getkeyval(3, "RVentCutOff").c_str());
}
if (issection("DList:"))
{
secDList = true;
nMmax = td(getkeyval(3, "Mmax"));
nnMmax = td(getkeyval(3, "nMmax"));
nMnmax = td(getkeyval(3, "Mnmax"));
nnmax = td(getkeyval(3, "nmax"));
nnominalfill = td(getkeyval(3, "nominalfill"));
nMstand = td(getkeyval(3, "Mstand"));
nSize = ti(getkeyval(2, "Size"));
nMmax = atof(getkeyval(3, "Mmax").c_str());
nnMmax = atof(getkeyval(3, "nMmax").c_str());
nMnmax = atof(getkeyval(3, "Mnmax").c_str());
nnmax = atof(getkeyval(3, "nmax").c_str());
nnominalfill = atof(getkeyval(3, "nominalfill").c_str());
nMstand = atof(getkeyval(3, "Mstand").c_str());
nSize = atoi(getkeyval(2, "Size").c_str());
}
if (issection("WWList:"))
@@ -6185,7 +6227,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
else if (aCategory == "unimog")
CategoryFlag = 3;
else
ConversionError = MARKERROR(-7, 1, "Improper vechicle category");
ConversionError = MARKERROR(-7, "1", "Improper vechicle category");
Mass = aMass;
Mred = aMred;
@@ -6274,7 +6316,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
AxleInertialMoment = 1;
if (NAxles == 0)
ConversionError = MARKERROR(-1, 1, "0 axles, hover cat?");
ConversionError = MARKERROR(-1, "1", "0 axles, hover cat?");
if (dBearingType == "Roll")
BearingType = 1;
@@ -6368,7 +6410,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
RapidMult = 1;
}
else
ConversionError = MARKERROR(-5, 1, "0 brake cylinder units");
ConversionError = MARKERROR(-5, "1", "0 brake cylinder units");
}
else
P2FTrans = 0;
@@ -6379,7 +6421,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
CntrlPipePress = eHiPP;
else
CntrlPipePress =
5 + 0.001 * (random(10) - random(10)); // Ra 2014-07: trochê niedok³adnoœci
5 + 0.001 * (Random(10) - Random(10)); // Ra 2014-07: trochê niedok³adnoœci
HighPipePress = CntrlPipePress;
if (eHiPP != 0)
@@ -6705,13 +6747,13 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
{
NominalVoltage = kVolt;
x = split(kTrans.c_str(), ':'); // 18:79
x = Split(kTrans, ':'); // 18:79
p0 = Trim(x[0].c_str());
p1 = Trim(x[1].c_str());
p0 = TrimSpace(x[0]);
p1 = TrimSpace(x[1]);
Transmision.NToothW = s2b(p1);
Transmision.NToothM = s2b(p0);
Transmision.NToothW = atoi(p1.c_str());
Transmision.NToothM = atoi(p0.c_str());
// ToothW to drugi parametr czyli 79
// ToothM to pierwszy czyli 18
@@ -6745,19 +6787,19 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
if (secCircuit)
{
// s := DUE(ExtractKeyWord(lines, 'CircuitRes=')); writepaslog('CircuitRes', s);
CircuitRes = s2r(lCircuitRes);
CircuitRes = (lCircuitRes);
// s := DUE(ExtractKeyWord(lines, 'IminLo=')); writepaslog('IminLo', s);
IminLo = s2iE(lIminLo);
IminLo = (lIminLo);
// s := DUE(ExtractKeyWord(lines, 'IminHi=')); writepaslog('IminHi', s);
IminHi = s2i(lIminHi);
IminHi = (lIminHi);
// s := DUE(ExtractKeyWord(lines, 'ImaxLo=')); writepaslog('ImaxLo', s);
ImaxLo = s2iE(lImaxLo);
ImaxLo = (lImaxLo);
// s := DUE(ExtractKeyWord(lines, 'ImaxHi=')); writepaslog('ImaxHi', s);
ImaxHi = s2i(lImaxHi);
ImaxHi = (lImaxHi);
Imin = IminLo;
Imax = ImaxLo;
}
@@ -6767,7 +6809,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
if (secRList)
{
RlistSize = s2b(mSize);
RlistSize = (mSize);
if (mRVent == "Automatic")
RVentType = 2;
@@ -6778,9 +6820,9 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
if (RVentType > 0)
{
RVentnmax = s2rE(mRVentnmax) / 60.0;
RVentnmax = (mRVentnmax) / 60.0;
RVentCutOff = s2r(mRVentCutOff);
RVentCutOff = (mRVentCutOff);
}
}
@@ -6791,9 +6833,9 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
// WriteLog("");
// WriteLog("----------------------------------------------------------------------------------------");
WriteLog("CERROR: " + IntToStr(ConversionError) + ", SUCCES: " + AS(BoolToYN(OK)));
WriteLog("CERROR: " + to_string(ConversionError) + ", SUCCES: " + to_string(OK));
// WriteLogSS();
WriteLog("");
//WriteLog("");
return OK;
} // LoadFIZ()
@@ -6940,7 +6982,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
Handle = new TSt113();
break;
default:
Handle = new TBHandle();
Handle = new TDriverHandle();
}
switch (BrakeLocHandle)
@@ -6958,7 +7000,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
break;
}
default:
LocHandle = new TBHandle();
LocHandle = new TDriverHandle();
}
// ustalanie srednicy przewodu glownego (lokomotywa lub napêdowy
@@ -7070,7 +7112,7 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
// Hamulec->Init(PipePress, HighPipePress, LowPipePress, BrakePress, BrakeDelayFlag);
// ScndPipePress = Compressor;
WriteLogSS("OK=", BoolTo10(OK));
WriteLog("OK=" + to_string(OK));
return OK;
}
@@ -7228,7 +7270,7 @@ bool TMoverParameters::CreateBrakeSys()
Handle = new TSt113();
break;
default:
Handle = new TBHandle();
Handle = new TDriverHandle();
}
switch (BrakeLocHandle)
@@ -7246,7 +7288,7 @@ bool TMoverParameters::CreateBrakeSys()
break;
}
default:
LocHandle = new TBHandle();
LocHandle = new TDriverHandle();
}
Pipe = new TReservoir();
@@ -7336,7 +7378,7 @@ bool TMoverParameters::CreateBrakeSys()
ScndPipePress = Compressor;
// WriteLogSS("OK=", BoolTo10(OK));
WriteLog("");
//WriteLog("");
return OK;
}

View File

@@ -330,7 +330,7 @@ void TNESt3::Init(double PP, double HPP, double LPP, double BP, unsigned char BD
CntrlRes = new TReservoir();
CntrlRes->CreateCap(15);
CntrlRes->CreatePress(1 * HPP);
BrakeStatus = Byte(BP > 1) * 1;
BrakeStatus = int(BP > 1) * 1;
Miedzypoj = new TReservoir();
Miedzypoj->CreateCap(5);
Miedzypoj->CreatePress(PP);
@@ -457,7 +457,7 @@ void TNESt3::PLC(double mass)
{
LoadC =
1 +
Byte(mass < LoadM) *
double(mass < LoadM) *
((TareBP + (MaxBP - TareBP) * (mass - TareM) * 1.0 / (LoadM - TareM)) * 1.0 / MaxBP -
1);
}

View File

@@ -185,6 +185,9 @@ class TNESt3 : public TBrake
double LBP; // cisnienie hamulca pomocniczego
public:
inline TNESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc,
int i_bcn, int i_BD, int i_mat, int i_ba, int i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
virtual double GetPF(double PP, double dt,
double Vel) /*override*/; // przeplyw miedzy komora wstepna i PG
void EStParams(double i_crc); // parametry charakterystyczne dla ESt

View File

@@ -1,232 +0,0 @@
// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) 'friction.pas' rev: 5.00
#ifndef frictionHPP
#define frictionHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <SysUtils.hpp> // Pascal unit
#include <mctools.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Physics
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TFricMat;
class PASCALIMPLEMENTATION TFricMat : public System::TObject
{
typedef System::TObject inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFricMat(void) : System::TObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFricMat(void) { }
#pragma option pop
};
class DELPHICLASS TP10Bg;
class PASCALIMPLEMENTATION TP10Bg : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10Bg(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10Bg(void) { }
#pragma option pop
};
class DELPHICLASS TP10Bgu;
class PASCALIMPLEMENTATION TP10Bgu : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10Bgu(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10Bgu(void) { }
#pragma option pop
};
class DELPHICLASS TP10yBg;
class PASCALIMPLEMENTATION TP10yBg : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10yBg(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10yBg(void) { }
#pragma option pop
};
class DELPHICLASS TP10yBgu;
class PASCALIMPLEMENTATION TP10yBgu : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10yBgu(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10yBgu(void) { }
#pragma option pop
};
class DELPHICLASS TP10;
class PASCALIMPLEMENTATION TP10 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10(void) { }
#pragma option pop
};
class DELPHICLASS TFR513;
class PASCALIMPLEMENTATION TFR513 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFR513(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFR513(void) { }
#pragma option pop
};
class DELPHICLASS TFR510;
class PASCALIMPLEMENTATION TFR510 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFR510(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFR510(void) { }
#pragma option pop
};
class DELPHICLASS TCosid;
class PASCALIMPLEMENTATION TCosid : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TCosid(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TCosid(void) { }
#pragma option pop
};
class DELPHICLASS TDisk1;
class PASCALIMPLEMENTATION TDisk1 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TDisk1(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TDisk1(void) { }
#pragma option pop
};
class DELPHICLASS TDisk2;
class PASCALIMPLEMENTATION TDisk2 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TDisk2(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TDisk2(void) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
} /* namespace Friction */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Friction;
#endif
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // friction

View File

@@ -20,6 +20,18 @@ Copyright (C) 2007-2014 Maciej Cierniak
//---FUNKCJE OGOLNE---
static double const DPL = 0.25;
double TFV4aM::pos_table[11] = { 0, 8, 1, 2, 0, 3, 6, 8, 2, 2, 2 };
double TMHZ_EN57::pos_table[11] = { 0, 12, 1, 2, 2, 4, 11, 12, 2, 2, 2 };
double TM394::pos_table[11] = { 0, 6, 0, 1, 2, 3, 5, 6, 1, 1, 1 };
double TH14K1::BPT_K[6][2] =
{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) };
double TH14K1::pos_table[11] = { 0, 5, 0, 1, 2, 3, 4, 5, 1, 1, 1 };
double TSt113::BPT_K[6][2] =
{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) };
double TSt113::BEP_K[7] = { 0, -1, 1, 0, 0, 0, 0 };
double TSt113::pos_table[11] = { 0, 6, 0, 1, 3, 4, 5, 6, 1, 1, 2 };
double TFVel6::pos_table[11] = { -1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1 };
double PR(double P1, double P2)
{
@@ -40,7 +52,7 @@ double PF_old(double P1, double P2, double S)
return (PH + 1) * 222 * S * (P2 - P1) * 1.0 / (1.13 * PH - PL);
}
double PF(double P1, double P2, double S, double DP = 0.25)
double PF(double P1, double P2, double S, double DP)
{
double PH = Max0R(P1, P2) + 1; // wyzsze cisnienie absolutne
double PL = P1 + P2 - PH + 2; // nizsze cisnienie absolutne
@@ -79,7 +91,7 @@ long lround(double value)
}
double PFVa(double PH, double PL, double S, double LIM,
double DP = 0.1) // zawor napelniajacy z PH do PL, PL do LIM
double DP) // zawor napelniajacy z PH do PL, PL do LIM
{
if (LIM > PL)
{
@@ -104,7 +116,7 @@ double PFVa(double PH, double PL, double S, double LIM,
}
double PFVd(double PH, double PL, double S, double LIM,
double DP = 0.1) // zawor wypuszczajacy z PH do PL, PH do LIM
double DP) // zawor wypuszczajacy z PH do PL, PH do LIM
{
if (LIM < PH)
{
@@ -2347,9 +2359,7 @@ double TFV4aM::GetSound(int i)
double TFV4aM::GetPos(int i)
{
static double const table[11] = { -2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0 };
return table[i];
return pos_table[i];
}
double TFV4aM::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
@@ -2481,9 +2491,7 @@ double TMHZ_EN57::GetSound(int i)
double TMHZ_EN57::GetPos(int i)
{
static double const table[11] = { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
return table[i];
return pos_table[i];
}
double TMHZ_EN57::GetCP()
@@ -2585,9 +2593,7 @@ double TM394::GetCP()
double TM394::GetPos(int i)
{
static double const table[11] = { -1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0 };
return table[i];
return pos_table[i];
}
//---H14K1-- Knorr
@@ -2595,8 +2601,8 @@ double TM394::GetPos(int i)
double TH14K1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{
static int const LBDelay = 100; // szybkosc + zasilanie sterujacego
static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2] =
{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) };
// static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2] =
//{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) };
static double const NomPress = 5.0;
double LimPP;
@@ -2653,9 +2659,7 @@ double TH14K1::GetCP()
double TH14K1::GetPos(int i)
{
static double const table[11] = { -1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0 };
return table[i];
return pos_table[i];
}
//---St113-- Knorr EP
@@ -2663,9 +2667,6 @@ double TH14K1::GetPos(int i)
double TSt113::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{
static int const LBDelay = 100; // szybkosc + zasilanie sterujacego
static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2] =
{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) };
static double const BEP_K[/*?*/ /*-1..5*/ (5) - (-1) + 1] = { 0, -1, 1, 0, 0, 0, 0 };
static double const NomPress = 5.0;
double LimPP;
@@ -2715,9 +2716,7 @@ double TSt113::GetCP()
double TSt113::GetPos(int i)
{
static double const table[11] = { -1, 5, -1, 0, 2, 3, 4, 5, 0, 0, 1 };
return table[i];
return pos_table[i];
}
void TSt113::Init(double Press)
@@ -2890,9 +2889,7 @@ double TFVel6::GetCP()
double TFVel6::GetPos(int i)
{
static double const table[11] = { -1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1 };
return table[i];
return pos_table[i];
}
double TFVel6::GetSound(int i)

View File

@@ -129,10 +129,10 @@ Knorr/West EP -
//7//1.5
// BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (14, 5.4), (9, 5.0), (6, 4.6), (9, 4.5), (9, 4.0), (9, 3.5), (9, 2.8), (34, 2.8));
// BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (7, 5.0), (2.0, 5.0), (4.5, 4.6), (4.5, 4.2), (4.5, 3.8), (4.5, 3.4), (4.5, 2.8), (8, 2.8));
static double zero_based_BPT[ /*?*//*-2..6*/ (6) - (-2) + 1][2] = { (0 , 5.0) , (7 , 5.0) , (2.0 , 5.0) , (4.5 , 4.6) , (4.5 , 4.2) , (4.5 , 3.8) , (4.5 , 3.4) , (4.5 , 2.8) , (8 , 2.8) };
static double zero_based_BPT_394[ /*?*//*-1..5*/ (5) - (-1) + 1][2] = { (13 , 10.0) , (5 , 5.0) , (0 , -1) , (5 , -1) , (5 , 0.0) , (5 , 0.0) , (18 , 0.0) };
double *BPT = zero_based_BPT[2]; //tablica pozycji hamulca dla zakresu -2..6
double *BPT_394 = zero_based_BPT_394[1]; //tablica pozycji hamulca dla zakresu -1..5
static double BPT[ /*?*//*-2..6*/ (6) - (-2) + 1][2] = { (0 , 5.0) , (7 , 5.0) , (2.0 , 5.0) , (4.5 , 4.6) , (4.5 , 4.2) , (4.5 , 3.8) , (4.5 , 3.4) , (4.5 , 2.8) , (8 , 2.8) };
static double BPT_394[ /*?*//*-1..5*/ (5) - (-1) + 1][2] = { (13 , 10.0) , (5 , 5.0) , (0 , -1) , (5 , -1) , (5 , 0.0) , (5 , 0.0) , (18 , 0.0) };
//double *BPT = zero_based_BPT[2]; //tablica pozycji hamulca dla zakresu -2..6
//double *BPT_394 = zero_based_BPT_394[1]; //tablica pozycji hamulca dla zakresu -1..5
// BPT: array[-2..6] of array [0..1] of real= ((0, 5.0), (12, 5.4), (9, 5.0), (9, 4.6), (9, 4.2), (9, 3.8), (9, 3.4), (9, 2.8), (34, 2.8));
// BPT: array[-2..6] of array [0..1] of real= ((0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0),(0, 0));
static int const i_bcpno = 6;
@@ -559,6 +559,8 @@ Knorr/West EP -
double RedAdj; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
// Sounds: array[0..4] of real; //wielkosci przeplywow dla dzwiekow
bool Fala;
// const double pos_table[11] = { -2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0 };
static double pos_table[11];
double LPP_RP(double pos);
bool EQ(double pos, double i_pos);
public:
@@ -580,6 +582,8 @@ Knorr/West EP -
double CP; double TP; double RP; //zbiornik steruj¹cy, czasowy, redukcyjny
double RedAdj; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
bool Fala;
// const double pos_table[11] = { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
static double pos_table[11]; //= { 0, 12, 1, 2, 2, 4, 11, 12, 2, 2, 2 };
double LPP_RP(double pos);
bool EQ(double pos, double i_pos);
@@ -634,6 +638,8 @@ Knorr/West EP -
private:
double CP; //zbiornik steruj¹cy, czasowy, redukcyjny
double RedAdj; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
// double const pos_table[11] = { -1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0 };
static double pos_table[11]; // = { 0, 6, 0, 1, 2, 3, 5, 6, 1, 1, 1 };
public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
@@ -650,6 +656,10 @@ Knorr/West EP -
class TH14K1 : public TDriverHandle
{
private:
double static BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2];
// double const table[11] = { -1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0 };
double static pos_table[11]; // = { 0, 5, 0, 1, 2, 3, 4, 5, 1, 1, 1 };
protected:
double CP; //zbiornik steruj¹cy, czasowy, redukcyjny
double RedAdj; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
@@ -671,6 +681,10 @@ Knorr/West EP -
{
private:
double EPS;
double static BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2];
double static BEP_K[/*?*/ /*-1..5*/ (5) - (-1) + 1];
// double const pos_table[11] = { -1, 5, -1, 0, 2, 3, 4, 5, 0, 0, 1 };
double static pos_table[11]; // = { 0, 6, 0, 1, 3, 4, 5, 6, 1, 1, 2 };
public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
@@ -742,6 +756,8 @@ Knorr/West EP -
{
private:
double EPS;
// double const table[11] = { -1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1 };
double static pos_table[11]; // = { -1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1 };
public:
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;

View File

@@ -14,6 +14,10 @@ Copyright (C) 2007-2014 Maciej Cierniak
#include "mctools.h"
#include <cmath>
#include <fstream>
#include <cctype>
#include <ostream>
#include <iomanip>
#include <algorithm>
using namespace std;
/*================================================*/
@@ -139,7 +143,7 @@ std::string ReadWord(std::ifstream& infile)
return s;
}
std::string Cut_Space(std::string s, int Just)
std::string TrimSpace(std::string s, int Just)
{
int ii;
@@ -148,26 +152,45 @@ std::string Cut_Space(std::string s, int Just)
case CutLeft:
{
ii = 0;
while ((ii < s.length()) && (s[ii + 1] == _SPACE))
while ((ii < s.length()) && (s[ii + 1] == (char)" "))
++ii;
s = s.substr(ii + 1, s.length() - ii);
}
case CutRight:
{
ii = s.length();
while ((ii > 0) && (s[ii] == _SPACE))
while ((ii > 0) && (s[ii] == (char)" "))
--ii;
s = s.substr(0, ii);
}
case CutBoth:
{
s = Cut_Space(s, CutLeft);
s = Cut_Space(s, CutRight);
s = TrimSpace(s, CutLeft);
s = TrimSpace(s, CutRight);
}
}
return s;
}
/*Cut_Space*/
char* TrimAndReduceSpaces(const char* s)
{ // redukuje spacje pomiedzy znakami do jednej
char* tmp;
if (s)
{
strcpy(tmp, s);
char* from = tmp + strspn(tmp, " ");
char* to = tmp;
do if ((*to = *from++) == ' ')
from += strspn(from, " ");
while (*to++);
while (*--to == ' ')
*to = '\0';
}
return tmp;
}
std::string ExtractKeyWord(std::string InS, std::string KeyWord)
{
@@ -186,13 +209,13 @@ std::string ExtractKeyWord(std::string InS, std::string KeyWord)
return s;
}
std::string DUE(std::string s) /*Delete Until Equal sign*/
std::string DUE(std::string s) /*Delete Before Equal sign*/
{
//DUE = Copy(s, Pos("=", s) + 1, length(s));
return s.substr(s.find("=") + 1, s.length());
}
std::string DWE(std::string s) /*Delete While Equal sign*/
std::string DWE(std::string s) /*Delete After Equal sign*/
{
size_t ep = s.find("=");
if (ep != string::npos)
@@ -237,6 +260,141 @@ std::string Tab2Sp(std::string s) /*Tab to Space sign*/
//return s2;
}
std::string ExchangeCharInString(string s, const char &aim, const char &target)
{
char *tmp = new char[s.length()];
for (int b = 0; b < s.length(); ++b)
{
if (s[b] == aim)
if (target == (char)"")
b++;
else
tmp[b] = target;
else
tmp[b] = s[b];
}
return string(tmp);
}
std::vector<std::string> &Split(const std::string &s, char delim, std::vector<std::string> &elems)
{ // dzieli tekst na wektor tekstow
std::stringstream ss(s);
std::string item;
while (std::getline(ss, item, delim))
{
elems.push_back(item);
}
return elems;
}
std::vector<std::string> Split(const std::string &s, char delim)
{ // dzieli tekst na wektor tekstow
std::vector<std::string> elems;
Split(s, delim, elems);
return elems;
}
std::string to_string(int _Val)
{
std::ostringstream o;
o << _Val;
return o.str();
};
std::string to_string(unsigned int _Val)
{
std::ostringstream o;
o << _Val;
return o.str();
};
std::string to_string(double _Val)
{
std::ostringstream o;
o << _Val;
return o.str();
};
std::string to_string(int _Val, int precision)
{
std::ostringstream o;
o << std::fixed << std::setprecision(precision);
o << _Val;
return o.str();
};
std::string to_string(double _Val, int precision)
{
std::ostringstream o;
o << std::fixed << std::setprecision(precision);
o << _Val;
return o.str();
};
std::string to_string(int _Val, int precision, int width)
{
std::ostringstream o;
o.width(width);
o << std::fixed << std::setprecision(precision);
o << _Val;
return o.str();
};
std::string to_string(double _Val, int precision, int width)
{
std::ostringstream o;
o.width(width);
o << std::fixed << std::setprecision(precision);
o << _Val;
return o.str();
};
std::string to_hex_str(double _Val, int precision, int width)
{
std::ostringstream o;
if (width)
o.width(width);
o << std::fixed << std::hex;
if (precision)
o << std::setprecision(precision);
o << _Val;
return o.str();
};
int stol_def(const std::string &str, const int &DefaultValue)
{
// this function was developed iteratively on Codereview.stackexchange
// with the assistance of @Corbin
std::size_t len = str.size();
while (std::isspace(str[len - 1]))
len--;
if (len == 0)
return DefaultValue;
errno = 0;
char *s = new char[len + 1];
std::strncpy(s, str.c_str(), len);
char *p;
int result = strtol(s, &p, 0);
if ((*p != '\0') || (errno != 0))
{
return DefaultValue;
}
delete s;
return result;
}
std::string ToLower(std::string text)
{
std::transform(text.begin(), text.end(), text.begin(), ::tolower);
return text;
}
std::string ToUpper(std::string text)
{
std::transform(text.begin(), text.end(), text.begin(), ::toupper);
return text;
}
void ComputeArc(double X0, double Y0, double Xn, double Yn, double R, double L, double dL,
double &phi, double &Xout, double &Yout)
/*wylicza polozenie Xout Yout i orientacje phi punktu na elemencie dL luku*/

View File

@@ -19,6 +19,8 @@ http://mozilla.org/MPL/2.0/.
#include <fstream>
#include <time.h>
#include <sys/stat.h>
#include <vector>
#include <sstream>
using namespace std;
@@ -35,18 +37,18 @@ static char _EOL[2] = { (char)13, (char)10 };
//static char const _SPACE = " ";
static char _Spacesigns[4] = { (char)" ",(char)9, (char)13, (char)10};
static string _spacesigns = " " + (char)9 + (char)13 + (char)10;
static int const CutLeft = -1;
static int const CutRight = 1;
static int const CutBoth = 0; /*Cut_Space*/
static double const pi = 3.141592653589793;
static int const CutLeft = -1;
static int const CutRight = 1;
static int const CutBoth = 0; /*Cut_Space*/
static double const pi = 3.141592653589793;
int ConversionError = 0;
int LineCount = 0;
bool DebugModeFlag = false;
bool FreeFlyModeFlag = false;
int ConversionError = 0;
int LineCount = 0;
bool DebugModeFlag = false;
bool FreeFlyModeFlag = false;
typedef unsigned long/*?*//*set of: char */ TableChar; /*MCTUTIL*/
typedef unsigned long/*?*//*set of: char */ TableChar; /*MCTUTIL*/
/*konwersje*/
@@ -70,12 +72,17 @@ inline int Random()
return rand();
}
inline float random(float a, float b)
inline double Random(double a, double b)
{
srand(time(NULL));
return a + rand() / (float)RAND_MAX * (b - a);
}
inline double Random(double b)
{
return Random(0.0, b);
}
inline double BorlandTime()
{
std::tm epoch;
@@ -91,9 +98,9 @@ inline double BorlandTime()
}
/*funkcje logiczne*/
bool TestFlag(int Flag, int Value);
bool SetFlag( int & Flag, int Value);
bool iSetFlag( int & Flag, int Value);
extern bool TestFlag(int Flag, int Value);
extern bool SetFlag( int & Flag, int Value);
extern bool iSetFlag( int & Flag, int Value);
bool FuzzyLogic(double Test, double Threshold, double Probability);
/*jesli Test>Threshold to losowanie*/
@@ -103,19 +110,41 @@ bool FuzzyLogicAI(double Test, double Threshold, double Probability);
/*operacje na stringach*/
std::string ReadWord( std::ifstream& infile); /*czyta slowo z wiersza pliku tekstowego*/
//std::string Ups(std::string s);
std::string Cut_Space(std::string s, int Just);
std::string TrimSpace(std::string s, int Just = CutBoth);
char* TrimAndReduceSpaces(const char* s);
std::string ExtractKeyWord(std::string InS, std::string KeyWord); /*wyciaga slowo kluczowe i lancuch do pierwszej spacji*/
std::string DUE(std::string s); /*Delete Until Equal sign*/
std::string DWE(std::string s); /*Delete While Equal sign*/
std::string Ld2Sp(std::string s); /*Low dash to Space sign*/
std::string Tab2Sp(std::string s); /*Tab to Space sign*/
std::string ExchangeCharInString(string s, const char &aim, const char &target); // zamienia jeden znak na drugi
std::vector<std::string> &Split(const std::string &s, char delim, std::vector<std::string> &elems);
std::vector<std::string> Split(const std::string &s, char delim);
std::string to_string(int _Val);
std::string to_string(unsigned int _Val);
std::string to_string(int _Val, int precision);
std::string to_string(int _Val, int precision, int width);
std::string to_string(double _Val);
std::string to_string(double _Val, int precision);
std::string to_string(double _Val, int precision, int width);
std::string to_hex_str(double _Val, int precision = 0, int width = 0);
inline std::string to_string(bool _Val)
{
to_string((int)_Val);
}
int stol_def(const std::string & str, const int & DefaultValue);
std::string ToLower(std::string text);
std::string ToUpper(std::string text);
/*procedury, zmienne i funkcje graficzne*/
void ComputeArc(double X0, double Y0, double Xn, double Yn, double R, double L, double dL, double & phi, double & Xout, double & Yout);
/*wylicza polozenie Xout Yout i orientacje phi punktu na elemencie dL luku*/
void ComputeALine(double X0, double Y0, double Xn, double Yn, double L, double R, double & Xout, double & Yout);
inline bool fileExist(const std::string &name)
inline bool fileExists(const std::string &name)
{
struct stat buffer;
return (stat(name.c_str(), &buffer) == 0);

View File

@@ -40,6 +40,12 @@ TRealSound::TRealSound()
bLoopPlay = false; // dźwięk wyłączony
}
TRealSound::TRealSound(const char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
bool freqmod, double rmin)
{
Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin);
}
TRealSound::~TRealSound()
{
// if (this) if (pSound) pSound->Stop();
@@ -49,7 +55,7 @@ void TRealSound::Free()
{
}
void TRealSound::Init(char *SoundName, double DistanceAttenuation, double X, double Y, double Z,
void TRealSound::Init(const char *SoundName, double DistanceAttenuation, double X, double Y, double Z,
bool Dynamic, bool freqmod, double rmin)
{
// Nazwa=SoundName; //to tak raczej nie zadziała, (SoundName) jest tymczasowe
@@ -247,10 +253,17 @@ void TRealSound::ResetPosition()
pSound->SetCurrentPosition(0);
}
void TTextSound::Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z,
TTextSound::TTextSound(const char *SoundName, double SoundAttenuation, double X, double Y, double Z,
bool Dynamic, bool freqmod, double rmin)
: TRealSound(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin)
{
Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin);
}
void TTextSound::Init(const char *SoundName, double SoundAttenuation, double X, double Y, double Z,
bool Dynamic, bool freqmod, double rmin)
{ // dodatkowo doczytuje plik tekstowy
TRealSound::Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin);
//TRealSound::Init(SoundName, SoundAttenuation, X, Y, Z, Dynamic, freqmod, rmin);
fTime = GetWaveTime();
AnsiString txt = AnsiString(SoundName);
txt.Delete(txt.Length() - 3, 4); // obcięcie rozszerzenia

View File

@@ -33,10 +33,12 @@ class TRealSound
double FM; // mnoznik czestotliwosci
double FA; // offset czestotliwosci
bool bLoopPlay; // czy zapętlony dźwięk jest odtwarzany
TRealSound();
TRealSound();
TRealSound(const char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
bool freqmod = false, double rmin = 0.0);
~TRealSound();
void Free();
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
void Init(const char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
bool freqmod = false, double rmin = 0.0);
double ListenerDistance(vector3 ListenerPosition);
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
@@ -55,8 +57,10 @@ class TTextSound : public TRealSound
AnsiString asText;
float fTime; // czas trwania
public:
void Init(char *SoundName, double SoundAttenuation, double X, double Y, double Z, bool Dynamic,
bool freqmod = false, double rmin = 0.0);
TTextSound(const char *SoundName, double SoundAttenuation, double X, double Y, double Z,
bool Dynamic, bool freqmod = false, double rmin = 0.0);
void Init(const char *SoundName, double SoundAttenuation, double X, double Y, double Z,
bool Dynamic, bool freqmod = false, double rmin = 0.0);
void Play(double Volume, int Looping, bool ListenerInside, vector3 NewPosition);
};

View File

@@ -16,6 +16,7 @@ http://mozilla.org/MPL/2.0/.
#include "Usefull.h"
#include "Globals.h"
#include "Track.h"
#include <mctools.h>
//#define Precision 10000

View File

@@ -15,6 +15,7 @@ http://mozilla.org/MPL/2.0/.
#include "Sound.h"
#include "Usefull.h"
#include "Globals.h"
#include <mctools.h>
//#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
#define SAFE_RELEASE(p) \
{ \
@@ -33,7 +34,7 @@ LPDIRECTSOUNDNOTIFY TSoundsManager::pDSNotify;
int TSoundsManager::Count = 0;
TSoundContainer *TSoundsManager::First = NULL;
TSoundContainer::TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFileName,
TSoundContainer::TSoundContainer(LPDIRECTSOUND pDS, const char *Directory, const char *strFileName,
int NConcurrent)
{ // wczytanie pliku dŸwiêkowego
int hr = 111;
@@ -54,7 +55,7 @@ TSoundContainer::TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFi
// Load the wave file
if (FAILED(pWaveSoundRead->Open(Name)))
if (FAILED(pWaveSoundRead->Open(strFileName)))
if (FAILED(pWaveSoundRead->Open(strdup(strFileName))))
{
// SetFileUI( hDlg, TEXT("Bad wave file.") );
return;
@@ -182,7 +183,7 @@ void TSoundsManager::Free()
SAFE_RELEASE(pDS);
};
TSoundContainer * TSoundsManager::LoadFromFile(char *Dir, char *Name, int Concurrent)
TSoundContainer * TSoundsManager::LoadFromFile(const char *Dir, const char *Name, int Concurrent)
{
TSoundContainer *Tmp = First;
First = new TSoundContainer(pDS, Dir, Name, Concurrent);
@@ -203,7 +204,7 @@ void TSoundsManager::LoadSounds(char *Directory)
FindClose(handle);
};
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(char *Name, bool Dynamic, float *fSamplingRate)
LPDIRECTSOUNDBUFFER TSoundsManager::GetFromName(const char *Name, bool Dynamic, float *fSamplingRate)
{ // wyszukanie dŸwiêku w pamiêci albo wczytanie z pliku
AnsiString file;
if (Dynamic)

View File

@@ -39,7 +39,7 @@ class TSoundContainer
TSoundContainer *Next;
std::stack<LPDIRECTSOUNDBUFFER> DSBuffers;
LPDIRECTSOUNDBUFFER GetUnique(LPDIRECTSOUND pDS);
TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFileName, int NConcurrent);
TSoundContainer(LPDIRECTSOUND pDS, const char *Directory, const char *strFileName, int NConcurrent);
~TSoundContainer();
};
@@ -51,7 +51,7 @@ class TSoundsManager
// static char Directory[80];
static int Count;
static TSoundContainer *First;
static TSoundContainer * LoadFromFile(char *Dir, char *Name, int Concurrent);
static TSoundContainer * LoadFromFile(const char *Dir, const char *Name, int Concurrent);
public:
// TSoundsManager(HWND hWnd);
@@ -61,7 +61,7 @@ class TSoundsManager
static void Free();
static void Init(char *Name, int Concurrent);
static void LoadSounds(char *Directory);
static LPDIRECTSOUNDBUFFER GetFromName(char *Name, bool Dynamic, float *fSamplingRate = NULL);
static LPDIRECTSOUNDBUFFER GetFromName(const char *Name, bool Dynamic, float *fSamplingRate = NULL);
static void RestoreAll();
};

View File

@@ -111,11 +111,11 @@ bool TTractionPowerSource::Update(double dt)
{
SlowFuse = true;
ErrorLog("Power overload: \"" + gMyNode->asName + "\" disabled for " +
AnsiString(SlowFuseTimeOut) + "s");
to_string(SlowFuseTimeOut) + "s");
}
else
ErrorLog("Power overload: \"" + gMyNode->asName + "\" disabled for " +
AnsiString(FastFuseTimeOut) + "s");
to_string(FastFuseTimeOut) + "s");
FuseTimer = 0;
}
if (FastFuse || SlowFuse)

View File

@@ -167,7 +167,7 @@ std::string cParser::readToken(bool ToLower, const char *Break)
// if (trtest2.find("tr/")!=0)
mIncludeParser = new cParser(includefile, buffer_FILE, mPath, LoadTraction);
if (mIncludeParser->mSize <= 0)
ErrorLog("Missed include: " + AnsiString(includefile.c_str()));
ErrorLog("Missed include: " + includefile);
}
else
while (token.compare("end") != 0)

View File

@@ -25,11 +25,9 @@ void TSky::Init()
{
WriteLog(Global::asSky.c_str());
WriteLog("init");
AnsiString asModel;
asModel = Global::asSky;
if ((asModel != "1") && (asModel != "0"))
if ((Global::asSky != "1") && (Global::asSky != "0"))
// {
mdCloud = TModelsManager::GetModel(asModel.c_str());
mdCloud = TModelsManager::GetModel(Global::asSky.c_str());
// }
};