mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 04:19:19 +02:00
Fixed slip calculations, some new parameters for python scripts
This commit is contained in:
@@ -3720,14 +3720,19 @@ void TMoverParameters::ComputeTotalForce(double dt, double dt1, bool FullVer)
|
||||
Sign(nrot * M_PI * WheelDiameter - V) *
|
||||
Adhesive(RunningTrack.friction) * TotalMassxg,
|
||||
dt, nrot);
|
||||
Fwheels = Sign(nrot * M_PI * WheelDiameter - V) * TotalMassxg * Adhesive(RunningTrack.friction);
|
||||
Fwheels = Sign(temp_nrot * M_PI * WheelDiameter - V) * TotalMassxg * Adhesive(RunningTrack.friction);
|
||||
if (Fwheels*Sign(V)>0)
|
||||
{
|
||||
FTrain = Fwheels - Fb;
|
||||
FTrain = Fwheels + Fb*Sign(V);
|
||||
}
|
||||
else if (FTrain*Sign(V)>0)
|
||||
{
|
||||
Fb = FTrain*Sign(V) - Fwheels*Sign(V);
|
||||
}
|
||||
else
|
||||
{
|
||||
Fb = FTrain - Fwheels;
|
||||
Fb = -Fwheels*Sign(V);
|
||||
FTrain = 0;
|
||||
}
|
||||
if (Sign(nrot * M_PI * WheelDiameter - V)*Sign(temp_nrot * M_PI * WheelDiameter - V) < 0)
|
||||
{
|
||||
@@ -4630,7 +4635,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
{
|
||||
PosRatio = -Sign(V) * DirAbsolute * eimv[eimv_Fr] /
|
||||
(eimc[eimc_p_Fh] *
|
||||
Max0R(dtrans / MaxBrakePress[0], AnPos) /*dizel_fill*/);
|
||||
Max0R(Max0R(dtrans,0.01) / MaxBrakePress[0], AnPos) /*dizel_fill*/);
|
||||
}
|
||||
else
|
||||
PosRatio = 0;
|
||||
|
||||
47
Train.cpp
47
Train.cpp
@@ -478,11 +478,13 @@ PyObject *TTrain::GetTrainState() {
|
||||
PyDict_SetItemString( dict, "velocity", PyGetFloat( mover->Vel ) );
|
||||
PyDict_SetItemString( dict, "tractionforce", PyGetFloat( mover->Ft ) );
|
||||
PyDict_SetItemString( dict, "slipping_wheels", PyGetBool( mover->SlippingWheels ) );
|
||||
PyDict_SetItemString( dict, "sanding", PyGetBool( mover->SlippingWheels ));
|
||||
// electric current data
|
||||
PyDict_SetItemString( dict, "traction_voltage", PyGetFloat( mover->RunningTraction.TractionVoltage ) );
|
||||
PyDict_SetItemString( dict, "voltage", PyGetFloat( mover->Voltage ) );
|
||||
PyDict_SetItemString( dict, "im", PyGetFloat( mover->Im ) );
|
||||
PyDict_SetItemString( dict, "fuse", PyGetBool( mover->FuseFlag ) );
|
||||
PyDict_SetItemString( dict, "epfuse", PyGetBool( mover->EpFuse ));
|
||||
// induction motor state data
|
||||
char* TXTT[ 10 ] = { "fd", "fdt", "fdb", "pd", "pdt", "pdb", "itothv", "1", "2", "3" };
|
||||
char* TXTC[ 10 ] = { "fr", "frt", "frb", "pr", "prt", "prb", "im", "vm", "ihv", "uhv" };
|
||||
@@ -522,6 +524,7 @@ PyObject *TTrain::GetTrainState() {
|
||||
PyDict_SetItemString( dict, ( std::string( "code_" ) + std::to_string( i + 1 ) ).c_str(), PyGetString( std::string( std::to_string( iUnits[ i ] ) +
|
||||
cCode[ i ] ).c_str() ) );
|
||||
PyDict_SetItemString( dict, ( std::string( "car_name" ) + std::to_string( i + 1 ) ).c_str(), PyGetString( asCarName[ i ].c_str() ) );
|
||||
PyDict_SetItemString( dict, ( std::string( "slip_" ) + std::to_string( i + 1 )).c_str(), PyGetBool( bSlip[i]) );
|
||||
}
|
||||
// ai state data
|
||||
auto const &driver = DynamicObject->Mechanik;
|
||||
@@ -3879,19 +3882,33 @@ if
|
||||
d = d->Prev(); // w drugą stronę też
|
||||
}
|
||||
}
|
||||
else if (cKey == GLFW_KEY_RIGHT_BRACKET)
|
||||
{
|
||||
while (d)
|
||||
{
|
||||
d->Move(-100.0 * d->DirectionGet());
|
||||
d = d->Next(); // pozostałe też
|
||||
}
|
||||
d = DynamicObject->Prev();
|
||||
while (d)
|
||||
{
|
||||
d->Move(-100.0 * d->DirectionGet());
|
||||
d = d->Prev(); // w drugą stronę też
|
||||
}
|
||||
else if (cKey == GLFW_KEY_RIGHT_BRACKET)
|
||||
{
|
||||
while (d)
|
||||
{
|
||||
d->Move(-100.0 * d->DirectionGet());
|
||||
d = d->Next(); // pozostałe też
|
||||
}
|
||||
d = DynamicObject->Prev();
|
||||
while (d)
|
||||
{
|
||||
d->Move(-100.0 * d->DirectionGet());
|
||||
d = d->Prev(); // w drugą stronę też
|
||||
}
|
||||
}
|
||||
else if (cKey == GLFW_KEY_TAB)
|
||||
{
|
||||
while (d)
|
||||
{
|
||||
d->MoverParameters->V+= d->DirectionGet()*2.78;
|
||||
d = d->Next(); // pozostałe też
|
||||
}
|
||||
d = DynamicObject->Prev();
|
||||
while (d)
|
||||
{
|
||||
d->MoverParameters->V += d->DirectionGet()*2.78;
|
||||
d = d->Prev(); // w drugą stronę też
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cKey == GLFW_KEY_MINUS)
|
||||
@@ -4176,11 +4193,12 @@ bool TTrain::Update( double const Deltatime )
|
||||
bDoors[i][2] = (p->dDoorMoveL > 0.001);
|
||||
iDoorNo[i] = p->iAnimType[ANIM_DOORS];
|
||||
iUnits[i] = iUnitNo;
|
||||
cCode[i] = p->MoverParameters->TypeName[p->MoverParameters->TypeName.length()];
|
||||
cCode[i] = p->MoverParameters->TypeName[p->MoverParameters->TypeName.length()-1];
|
||||
asCarName[i] = p->GetName();
|
||||
bPants[iUnitNo - 1][0] = (bPants[iUnitNo - 1][0] || p->MoverParameters->PantFrontUp);
|
||||
bPants[iUnitNo - 1][1] = (bPants[iUnitNo - 1][1] || p->MoverParameters->PantRearUp);
|
||||
bComp[iUnitNo - 1][0] = (bComp[iUnitNo - 1][0] || p->MoverParameters->CompressorAllow);
|
||||
bSlip[i] = p->MoverParameters->SlippingWheels;
|
||||
if (p->MoverParameters->CompressorSpeed > 0.00001)
|
||||
{
|
||||
bComp[iUnitNo - 1][1] = (bComp[iUnitNo - 1][1] || p->MoverParameters->CompressorFlag);
|
||||
@@ -4222,6 +4240,7 @@ bool TTrain::Update( double const Deltatime )
|
||||
bDoors[i][0] = false;
|
||||
bDoors[i][1] = false;
|
||||
bDoors[i][2] = false;
|
||||
bSlip[i] = false;
|
||||
iUnits[i] = 0;
|
||||
cCode[i] = 0; //'0';
|
||||
asCarName[i] = "";
|
||||
|
||||
1
Train.h
1
Train.h
@@ -464,6 +464,7 @@ public: // reszta może by?publiczna
|
||||
int iUnits[20]; // numer jednostki
|
||||
int iDoorNo[20]; // liczba drzwi
|
||||
char cCode[20]; // kod pojazdu
|
||||
bool bSlip[20]; // poślizg kół pojazdu
|
||||
std::string asCarName[20]; // nazwa czlonu
|
||||
bool bMains[8]; // WSy
|
||||
float fCntVol[8]; // napiecie NN
|
||||
|
||||
Reference in New Issue
Block a user