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

AI does not fear SlippingWheels when driving ElectricInductionMotor vehicle + fix for adhesion calculation when slipping

This commit is contained in:
Królik Uszasty
2019-03-22 20:26:59 +01:00
committed by tmj-fstate
parent 73af767312
commit a767e36be8
3 changed files with 16 additions and 15 deletions

View File

@@ -5544,7 +5544,7 @@ TController::UpdateSituation(double dt) {
// część wykonawcza tylko dla AI, dla człowieka jedynie napisy // część wykonawcza tylko dla AI, dla człowieka jedynie napisy
// zapobieganie poslizgowi u nas // zapobieganie poslizgowi u nas
if (mvControlling->SlippingWheels) { if (mvControlling->SlippingWheels && mvControlling->EngineType != TEngineType::ElectricInductionMotor) {
if( false == mvControlling->DecScndCtrl( 2 ) ) { if( false == mvControlling->DecScndCtrl( 2 ) ) {
// bocznik na zero // bocznik na zero

View File

@@ -4001,12 +4001,18 @@ void TMoverParameters::ComputeTotalForce(double dt) {
&& ( std::abs(Fwheels) > TotalMassxg * Adhesive( RunningTrack.friction ) ) ) { && ( std::abs(Fwheels) > TotalMassxg * Adhesive( RunningTrack.friction ) ) ) {
SlippingWheels = true; SlippingWheels = true;
} }
if( true == SlippingWheels ) { double temp_nrot = nrot;
if (true == SlippingWheels) {
double temp_nrot = ComputeRotatingWheel(Fwheels - temp_nrot = ComputeRotatingWheel(Fwheels - Sign(nrot * M_PI * WheelDiameter - V) *
Sign(nrot * M_PI * WheelDiameter - V) * Adhesive(RunningTrack.friction) * TotalMassxg, dt, nrot);
Adhesive(RunningTrack.friction) * TotalMassxg, if (Sign(nrot * M_PI * WheelDiameter - V)*Sign(temp_nrot * M_PI * WheelDiameter - V) < 0)
dt, nrot); {
SlippingWheels = false;
temp_nrot = V / M_PI / WheelDiameter;
}
}
if (true == SlippingWheels) {
Fwheels = Sign(temp_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) if (Fwheels*Sign(V)>0)
{ {
@@ -4025,12 +4031,6 @@ void TMoverParameters::ComputeTotalForce(double dt) {
{ {
WheelFlat = sqrt(square(WheelFlat) + abs(Fwheels) / NAxles*Vel*0.000002); WheelFlat = sqrt(square(WheelFlat) + abs(Fwheels) / NAxles*Vel*0.000002);
} }
if (Sign(nrot * M_PI * WheelDiameter - V)*Sign(temp_nrot * M_PI * WheelDiameter - V) < 0)
{
SlippingWheels = false;
temp_nrot = V / M_PI / WheelDiameter;
}
nrot = temp_nrot; nrot = temp_nrot;
} }
@@ -5368,9 +5368,9 @@ double TMoverParameters::v2n(void)
n = V / (M_PI * WheelDiameter); // predkosc obrotowa wynikajaca z liniowej [obr/s] n = V / (M_PI * WheelDiameter); // predkosc obrotowa wynikajaca z liniowej [obr/s]
deltan = n - nrot; //"pochodna" prędkości obrotowej deltan = n - nrot; //"pochodna" prędkości obrotowej
if (SlippingWheels) /* if (SlippingWheels)
if (std::abs(deltan) < 0.001) if (std::abs(deltan) < 0.001)
SlippingWheels = false; // wygaszenie poslizgu SlippingWheels = false; // wygaszenie poslizgu */ //poslizg jest w innym miejscu wygaszany też
if (SlippingWheels) // nie ma zwiazku z predkoscia liniowa V if (SlippingWheels) // nie ma zwiazku z predkoscia liniowa V
{ // McZapkie-221103: uszkodzenia kol podczas poslizgu { // McZapkie-221103: uszkodzenia kol podczas poslizgu
if (deltan > dmgn) if (deltan > dmgn)

View File

@@ -820,7 +820,8 @@ debug_panel::update_section_ai( std::vector<text_line> &Output ) {
+ ", slope: " + to_string( mechanik.fAccGravity + 0.001f, 2 ) + " (" + ( mechanik.fAccGravity > 0.01 ? "\\" : ( mechanik.fAccGravity < -0.01 ? "/" : "-" ) ) + ")" + ", slope: " + to_string( mechanik.fAccGravity + 0.001f, 2 ) + " (" + ( mechanik.fAccGravity > 0.01 ? "\\" : ( mechanik.fAccGravity < -0.01 ? "/" : "-" ) ) + ")"
+ "\n brake threshold: " + to_string( mechanik.fAccThreshold, 2 ) + "\n brake threshold: " + to_string( mechanik.fAccThreshold, 2 )
+ ", delays: " + to_string( mechanik.fBrake_a0[ 0 ], 2 ) + ", delays: " + to_string( mechanik.fBrake_a0[ 0 ], 2 )
+ "+" + to_string( mechanik.fBrake_a1[ 0 ], 2 ); + "+" + to_string( mechanik.fBrake_a1[ 0 ], 2 )
+ "\n virtual brake position: " + to_string(mechanik.BrakeCtrlPosition, 2);
Output.emplace_back( textline, Global.UITextColor ); Output.emplace_back( textline, Global.UITextColor );