- update simuV4
- update USR for tyre & degradation - update DanDroid for tyre & degradation - update shadow for tyre & degradation git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7516 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: d4cd162f051d38d34003a1d30798a2e2abac293f Former-commit-id: 6fd5ccf2aae610fb2bb0dfe976d761507041840e
This commit is contained in:
parent
2705a7a9eb
commit
98419bb92b
10 changed files with 2271 additions and 2167 deletions
File diff suppressed because it is too large
Load diff
|
@ -124,6 +124,12 @@ class TDriver {
|
||||||
double filterTCL_FWD();
|
double filterTCL_FWD();
|
||||||
double filterTCL_RWD();
|
double filterTCL_RWD();
|
||||||
double filterTCLSideSlip(double accel);
|
double filterTCLSideSlip(double accel);
|
||||||
|
double TyreConditionFront();
|
||||||
|
double TyreConditionRear();
|
||||||
|
double TyreCondition();
|
||||||
|
double TyreTreadDepthFront();
|
||||||
|
double TyreTreadDepthRear();
|
||||||
|
double TyreTreadDepth();
|
||||||
void readPrivateSection(PCarSettings *CarParmHandle);
|
void readPrivateSection(PCarSettings *CarParmHandle);
|
||||||
void readConstSpecs(PCarHandle CarHandle);
|
void readConstSpecs(PCarHandle CarHandle);
|
||||||
void readVarSpecs(PCarSettings CarParmHandle);
|
void readVarSpecs(PCarSettings CarParmHandle);
|
||||||
|
@ -142,6 +148,7 @@ class TDriver {
|
||||||
void driverMsg(std::string desc);
|
void driverMsg(std::string desc);
|
||||||
void driverMsgValue(int priority, std::string desc, double value);
|
void driverMsgValue(int priority, std::string desc, double value);
|
||||||
|
|
||||||
|
|
||||||
// Per robot global data
|
// Per robot global data
|
||||||
int mDrvPath;
|
int mDrvPath;
|
||||||
int mDrvPath_prev;
|
int mDrvPath_prev;
|
||||||
|
@ -336,6 +343,10 @@ class TDriver {
|
||||||
double mOVT_FRONTSPACE;
|
double mOVT_FRONTSPACE;
|
||||||
double mOVT_FRONTMARGIN;
|
double mOVT_FRONTMARGIN;
|
||||||
double mSTARTCLUTCHRATE;
|
double mSTARTCLUTCHRATE;
|
||||||
|
bool mHASTYC;
|
||||||
|
bool mHASABS;
|
||||||
|
bool mHASTCL;
|
||||||
|
bool mHASESP;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DRIVER_H_
|
#endif // _DRIVER_H_
|
||||||
|
|
|
@ -392,7 +392,7 @@ void CarModel::update( const tCarElt* car, const tSituation* sit )
|
||||||
WEARTREAD = MN(MN(car->priv.wheel[0].treadDepth, car->priv.wheel[1].treadDepth),
|
WEARTREAD = MN(MN(car->priv.wheel[0].treadDepth, car->priv.wheel[1].treadDepth),
|
||||||
MN(car->priv.wheel[2].treadDepth, car->priv.wheel[3].treadDepth));
|
MN(car->priv.wheel[2].treadDepth, car->priv.wheel[3].treadDepth));
|
||||||
|
|
||||||
LogSHADOW.debug("GRIP F = %.3f - GRIP R = %.3f - EFFECTIVEMU = %.3f - WEARTREAD = %.5f\n", GRIP_SCALE_F, GRIP_SCALE_R, EFFECTIVEMU, WEARTREAD);
|
LogSHADOW.debug("GRIP F = %.3f - GRIP R = %.3f - EFFECTIVEMU = %.3f - WEARTREAD = %.5f - Temperature = %.3f\n", GRIP_SCALE_F, GRIP_SCALE_R, EFFECTIVEMU, WEARTREAD, MN(car->priv.wheel[0].temp_mid, car->priv.wheel[1].temp_mid));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWheels( car, sit );
|
updateWheels( car, sit );
|
||||||
|
|
|
@ -115,15 +115,17 @@ double TFixCarParam::CalcAcceleration(
|
||||||
double TcF = oDriver->TyreConditionFront();
|
double TcF = oDriver->TyreConditionFront();
|
||||||
double TcR = oDriver->TyreConditionRear();
|
double TcR = oDriver->TyreConditionRear();
|
||||||
MU = MIN(TcF*MU,TcR*MU);
|
MU = MIN(TcF*MU,TcR*MU);
|
||||||
|
LogSimplix.info(" Friction F = %.3f - Friction R = %.3f - Tyre mu = %.3f - Tyre temperature = %.5f\n", TcF, TcR, oCar->priv.wheel[0].effectiveMu,
|
||||||
|
oCar->priv.wheel[0].temp_mid);
|
||||||
}
|
}
|
||||||
|
|
||||||
double CD = oCdBody *
|
double CD = oCdBody *
|
||||||
(1.0 + oTmpCarParam->oDamage / 10000.0) + oCdWing;
|
(1.0 + oTmpCarParam->oDamage / 10000.0) + oCdWing;
|
||||||
|
|
||||||
double Crv = (0.25*Crv0 + 0.75*Crv1);
|
double Crv = (0.25*Crv0 + 0.75*Crv1);
|
||||||
double Crvz = (0.25*Crvz0 + 0.75*Crvz1);
|
double Crvz = (0.25*Crvz0 + 0.75*Crvz1);
|
||||||
if (Crvz > 0)
|
if (Crvz > 0)
|
||||||
Crvz = 0;
|
Crvz = 0;
|
||||||
|
|
||||||
double Gdown = G * cos(TrackRollAngle);
|
double Gdown = G * cos(TrackRollAngle);
|
||||||
double Glat = G * sin(TrackRollAngle);
|
double Glat = G * sin(TrackRollAngle);
|
||||||
|
@ -139,28 +141,28 @@ double TFixCarParam::CalcAcceleration(
|
||||||
double AvgV = (U + V) * 0.5;
|
double AvgV = (U + V) * 0.5;
|
||||||
double AvgV2 = AvgV * AvgV;
|
double AvgV2 = AvgV * AvgV;
|
||||||
|
|
||||||
double Fdown = oTmpCarParam->oMass * Gdown
|
double Fdown = oTmpCarParam->oMass * Gdown
|
||||||
+ (oTmpCarParam->oMass * Crvz + oCa) * AvgV2;
|
+ (oTmpCarParam->oMass * Crvz + oCa) * AvgV2;
|
||||||
double Froad = Fdown * MU;
|
double Froad = Fdown * MU;
|
||||||
double Flat = oTmpCarParam->oMass * Glat;
|
double Flat = oTmpCarParam->oMass * Glat;
|
||||||
double Ftan = oTmpCarParam->oMass * Gtan - CD * AvgV2;
|
double Ftan = oTmpCarParam->oMass * Gtan - CD * AvgV2;
|
||||||
|
|
||||||
double Flatroad = fabs(oTmpCarParam->oMass * AvgV2 * Crv - Flat);
|
double Flatroad = fabs(oTmpCarParam->oMass * AvgV2 * Crv - Flat);
|
||||||
if (Flatroad > Froad)
|
if (Flatroad > Froad)
|
||||||
Flatroad = Froad;
|
Flatroad = Froad;
|
||||||
|
|
||||||
double Ftanroad = sqrt(Froad * Froad - Flatroad * Flatroad) + Ftan;
|
double Ftanroad = sqrt(Froad * Froad - Flatroad * Flatroad) + Ftan;
|
||||||
|
|
||||||
double Acc = Ftanroad / oTmpCarParam->oMass;
|
double Acc = Ftanroad / oTmpCarParam->oMass;
|
||||||
double MaxAcc = MIN(11.5,AccFromSpd.CalcY(AvgV));
|
double MaxAcc = MIN(11.5,AccFromSpd.CalcY(AvgV));
|
||||||
if (Acc > MaxAcc)
|
if (Acc > MaxAcc)
|
||||||
Acc = MaxAcc;
|
Acc = MaxAcc;
|
||||||
|
|
||||||
double Inner = MAX(0, U * U + 2 * Acc * Dist);
|
double Inner = MAX(0, U * U + 2 * Acc * Dist);
|
||||||
V = sqrt(Inner);
|
V = sqrt(Inner);
|
||||||
if (fabs(V - OldV) < 0.001)
|
if (fabs(V - OldV) < 0.001)
|
||||||
break;
|
break;
|
||||||
OldV = V;
|
OldV = V;
|
||||||
}
|
}
|
||||||
return V;
|
return V;
|
||||||
}
|
}
|
||||||
|
@ -206,13 +208,13 @@ double TFixCarParam::CalcBraking
|
||||||
Mu = MIN(MuF,MuR);
|
Mu = MIN(MuF,MuR);
|
||||||
|
|
||||||
// From SD:
|
// From SD:
|
||||||
double Cd = oCdBody *
|
double Cd = oCdBody *
|
||||||
(1.0 + oTmpCarParam->oDamage / 10000.0) + oCdWing;
|
(1.0 + oTmpCarParam->oDamage / 10000.0) + oCdWing;
|
||||||
|
|
||||||
Crv *= oDriver->CalcCrv(fabs(Crv));
|
Crv *= oDriver->CalcCrv(fabs(Crv));
|
||||||
|
|
||||||
if (Crvz > 0)
|
if (Crvz > 0)
|
||||||
Crvz = 0;
|
Crvz = 0;
|
||||||
|
|
||||||
double Gdown = G * cos(TrackRollAngle) * cos(TrackTiltAngle);
|
double Gdown = G * cos(TrackRollAngle) * cos(TrackTiltAngle);
|
||||||
double Glat = fabs(G * sin(TrackRollAngle));
|
double Glat = fabs(G * sin(TrackRollAngle));
|
||||||
|
@ -224,41 +226,41 @@ double TFixCarParam::CalcBraking
|
||||||
|
|
||||||
for (int I = 0; I < 10; I++)
|
for (int I = 0; I < 10; I++)
|
||||||
{
|
{
|
||||||
double AvgV = (U + V) * 0.5;
|
double AvgV = (U + V) * 0.5;
|
||||||
double AvgV2 = AvgV * AvgV;
|
double AvgV2 = AvgV * AvgV;
|
||||||
|
|
||||||
double Froad;
|
double Froad;
|
||||||
double Fdown = oTmpCarParam->oMass * Gdown
|
double Fdown = oTmpCarParam->oMass * Gdown
|
||||||
+ (oTmpCarParam->oMass * Crvz + (oCaFrontGroundEffect + oCaRearGroundEffect)) * AvgV2;
|
+ (oTmpCarParam->oMass * Crvz + (oCaFrontGroundEffect + oCaRearGroundEffect)) * AvgV2;
|
||||||
double Ffrnt = oCaFrontWing * AvgV2;
|
double Ffrnt = oCaFrontWing * AvgV2;
|
||||||
double Frear = oCaRearWing * AvgV2;
|
double Frear = oCaRearWing * AvgV2;
|
||||||
|
|
||||||
Froad = 0.95 * Fdown * Mu + Ffrnt * MuF + Frear * MuR;
|
Froad = 0.95 * Fdown * Mu + Ffrnt * MuF + Frear * MuR;
|
||||||
|
|
||||||
double Flat = oTmpCarParam->oMass * Glat;
|
double Flat = oTmpCarParam->oMass * Glat;
|
||||||
double Ftan = oTmpCarParam->oMass * Gtan - Cd * AvgV2;
|
double Ftan = oTmpCarParam->oMass * Gtan - Cd * AvgV2;
|
||||||
|
|
||||||
double Flatroad = MAX(0.0,oTmpCarParam->oMass * AvgV2 * fabs(Crv) - Flat);
|
double Flatroad = MAX(0.0,oTmpCarParam->oMass * AvgV2 * fabs(Crv) - Flat);
|
||||||
if (Flatroad > Froad)
|
if (Flatroad > Froad)
|
||||||
Flatroad = Froad;
|
Flatroad = Froad;
|
||||||
|
|
||||||
double Ftanroad = -sqrt(Froad * Froad - Flatroad * Flatroad) + Ftan;
|
double Ftanroad = -sqrt(Froad * Froad - Flatroad * Flatroad) + Ftan;
|
||||||
|
|
||||||
Acc = CarParam.oScaleBrake * Ftanroad
|
Acc = CarParam.oScaleBrake * Ftanroad
|
||||||
/ (oTmpCarParam->oMass * ( 3 + oTmpCarParam->oSkill) / 4);
|
/ (oTmpCarParam->oMass * ( 3 + oTmpCarParam->oSkill) / 4);
|
||||||
|
|
||||||
if (TDriver::UseBrakeLimit)
|
|
||||||
{
|
|
||||||
double Radius = 1.0 / fabs(Crv);
|
|
||||||
double factor = MIN(1.0,MAX(0.39, (Radius - 190.0) / 100.0));
|
|
||||||
Acc = MAX(Acc,TDriver::BrakeLimit * factor);
|
|
||||||
}
|
|
||||||
|
|
||||||
double Inner = MAX(0, V * V - 2 * Acc * Dist);
|
if (TDriver::UseBrakeLimit)
|
||||||
double OldU = U;
|
{
|
||||||
U = sqrt(Inner);
|
double Radius = 1.0 / fabs(Crv);
|
||||||
if (fabs(U - OldU) < 0.001)
|
double factor = MIN(1.0,MAX(0.39, (Radius - 190.0) / 100.0));
|
||||||
break;
|
Acc = MAX(Acc,TDriver::BrakeLimit * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
double Inner = MAX(0, V * V - 2 * Acc * Dist);
|
||||||
|
double OldU = U;
|
||||||
|
U = sqrt(Inner);
|
||||||
|
if (fabs(U - OldU) < 0.001)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
double MidSpeed = (U + Speed)/2;
|
double MidSpeed = (U + Speed)/2;
|
||||||
|
@ -273,7 +275,7 @@ double TFixCarParam::CalcBraking
|
||||||
else
|
else
|
||||||
LogSimplix.error("U: %g < B: %g\n",U*3.6,BrakeTargetSpeed*3.6);
|
LogSimplix.error("U: %g < B: %g\n",U*3.6,BrakeTargetSpeed*3.6);
|
||||||
*/
|
*/
|
||||||
// Sanity check
|
// Sanity check
|
||||||
return (float) MAX(ResultTargetSpeed,Speed);
|
return (float) MAX(ResultTargetSpeed,Speed);
|
||||||
}
|
}
|
||||||
//==========================================================================*
|
//==========================================================================*
|
||||||
|
@ -318,13 +320,13 @@ double TFixCarParam::CalcBrakingPit
|
||||||
Mu = MIN(MuF,MuR);
|
Mu = MIN(MuF,MuR);
|
||||||
|
|
||||||
// From TORCS:
|
// From TORCS:
|
||||||
double Cd = oCdBody *
|
double Cd = oCdBody *
|
||||||
(1.0 + oTmpCarParam->oDamage / 10000.0) + oCdWing;
|
(1.0 + oTmpCarParam->oDamage / 10000.0) + oCdWing;
|
||||||
|
|
||||||
Crv *= oDriver->CalcCrv(fabs(Crv));
|
Crv *= oDriver->CalcCrv(fabs(Crv));
|
||||||
|
|
||||||
if (Crvz > 0)
|
if (Crvz > 0)
|
||||||
Crvz = 0;
|
Crvz = 0;
|
||||||
|
|
||||||
double Gdown = G * cos(TrackRollAngle);
|
double Gdown = G * cos(TrackRollAngle);
|
||||||
double Glat = G * sin(TrackRollAngle);
|
double Glat = G * sin(TrackRollAngle);
|
||||||
|
@ -335,41 +337,41 @@ double TFixCarParam::CalcBrakingPit
|
||||||
|
|
||||||
for (int I = 0; I < 10; I++)
|
for (int I = 0; I < 10; I++)
|
||||||
{
|
{
|
||||||
double AvgV = (U + V) * 0.5;
|
double AvgV = (U + V) * 0.5;
|
||||||
double AvgV2 = AvgV * AvgV;
|
double AvgV2 = AvgV * AvgV;
|
||||||
|
|
||||||
double Froad;
|
double Froad;
|
||||||
double Fdown = oTmpCarParam->oMass * Gdown
|
double Fdown = oTmpCarParam->oMass * Gdown
|
||||||
+ (oTmpCarParam->oMass * Crvz + (oCaFrontGroundEffect + oCaRearGroundEffect)) * AvgV2;
|
+ (oTmpCarParam->oMass * Crvz + (oCaFrontGroundEffect + oCaRearGroundEffect)) * AvgV2;
|
||||||
double Ffrnt = oCaFrontWing * AvgV2;
|
double Ffrnt = oCaFrontWing * AvgV2;
|
||||||
double Frear = oCaRearWing * AvgV2;
|
double Frear = oCaRearWing * AvgV2;
|
||||||
|
|
||||||
Froad = Fdown * Mu + Ffrnt * MuF + Frear * MuR;
|
Froad = Fdown * Mu + Ffrnt * MuF + Frear * MuR;
|
||||||
|
|
||||||
double Flat = oTmpCarParam->oMass * Glat;
|
double Flat = oTmpCarParam->oMass * Glat;
|
||||||
double Ftan = oTmpCarParam->oMass * Gtan - Cd * AvgV2;
|
double Ftan = oTmpCarParam->oMass * Gtan - Cd * AvgV2;
|
||||||
|
|
||||||
double Flatroad = fabs(oTmpCarParam->oMass * AvgV2 * Crv - Flat);
|
double Flatroad = fabs(oTmpCarParam->oMass * AvgV2 * Crv - Flat);
|
||||||
if (Flatroad > Froad)
|
if (Flatroad > Froad)
|
||||||
Flatroad = Froad;
|
Flatroad = Froad;
|
||||||
|
|
||||||
double Ftanroad = -sqrt(Froad * Froad - Flatroad * Flatroad) + Ftan;
|
double Ftanroad = -sqrt(Froad * Froad - Flatroad * Flatroad) + Ftan;
|
||||||
|
|
||||||
double Acc = CarParam.oScaleBrakePit * Ftanroad
|
double Acc = CarParam.oScaleBrakePit * Ftanroad
|
||||||
/ oTmpCarParam->oMass;
|
/ oTmpCarParam->oMass;
|
||||||
|
|
||||||
//if (TDriver::UseBrakeLimit)
|
//if (TDriver::UseBrakeLimit)
|
||||||
{
|
{
|
||||||
double Radius = 1.0 / fabs(Crv);
|
double Radius = 1.0 / fabs(Crv);
|
||||||
double factor = MIN(1.0,MAX(0.39, (Radius - 190.0) / 100.0));
|
double factor = MIN(1.0,MAX(0.39, (Radius - 190.0) / 100.0));
|
||||||
Acc = MAX(Acc,TDriver::BrakeLimit * factor);
|
Acc = MAX(Acc,TDriver::BrakeLimit * factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
double Inner = MAX(0, V * V - 2 * Acc * Dist);
|
double Inner = MAX(0, V * V - 2 * Acc * Dist);
|
||||||
double OldU = U;
|
double OldU = U;
|
||||||
U = sqrt(Inner);
|
U = sqrt(Inner);
|
||||||
if (fabs(U - OldU) < 0.001)
|
if (fabs(U - OldU) < 0.001)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
double MidSpeed = (U + Speed)/2;
|
double MidSpeed = (U + Speed)/2;
|
||||||
|
@ -414,8 +416,8 @@ double TFixCarParam::CalcMaxSpeed
|
||||||
|
|
||||||
if (oDriver->oCarNeedsSinLong)
|
if (oDriver->oCarNeedsSinLong)
|
||||||
{
|
{
|
||||||
if (SinLat < SinLong)
|
if (SinLat < SinLong)
|
||||||
Sin = SinLong;
|
Sin = SinLong;
|
||||||
}
|
}
|
||||||
|
|
||||||
double AbsCrv0 = MAX(0.001, fabs(Crv0));
|
double AbsCrv0 = MAX(0.001, fabs(Crv0));
|
||||||
|
@ -424,17 +426,17 @@ double TFixCarParam::CalcMaxSpeed
|
||||||
double factor = 1.0;
|
double factor = 1.0;
|
||||||
|
|
||||||
if (AbsCrv < 1/200.0)
|
if (AbsCrv < 1/200.0)
|
||||||
CrvZ *= oDriver->oCrvZScale;
|
CrvZ *= oDriver->oCrvZScale;
|
||||||
|
|
||||||
if (AbsCrv > AbsCrv1)
|
if (AbsCrv > AbsCrv1)
|
||||||
{
|
{
|
||||||
if (oDriver->oUseAccelOut)
|
if (oDriver->oUseAccelOut)
|
||||||
factor = 1.015;
|
factor = 1.015;
|
||||||
AbsCrv *= oDriver->CalcCrv(AbsCrv);
|
AbsCrv *= oDriver->CalcCrv(AbsCrv);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
factor = 0.985;
|
factor = 0.985;
|
||||||
AbsCrv *= oDriver->CalcCrv(AbsCrv);
|
AbsCrv *= oDriver->CalcCrv(AbsCrv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,19 +462,19 @@ double TFixCarParam::CalcMaxSpeed
|
||||||
Mu = MIN(MuF,MuR) / oTmpCarParam->oSkill;
|
Mu = MIN(MuF,MuR) / oTmpCarParam->oSkill;
|
||||||
|
|
||||||
Den = (AbsCrv - ScaleBump * CrvZ)
|
Den = (AbsCrv - ScaleBump * CrvZ)
|
||||||
- (oCaFrontWing * MuF + oCaRearWing * MuR
|
- (oCaFrontWing * MuF + oCaRearWing * MuR
|
||||||
+ oCaFrontGroundEffect * MuF + oCaRearGroundEffect * MuR) / oTmpCarParam->oMass;
|
+ oCaFrontGroundEffect * MuF + oCaRearGroundEffect * MuR) / oTmpCarParam->oMass;
|
||||||
|
|
||||||
if (Den < 0.00001)
|
if (Den < 0.00001)
|
||||||
Den = 0.00001;
|
Den = 0.00001;
|
||||||
|
|
||||||
if (AbsCrv > 0.002)
|
if (AbsCrv > 0.002)
|
||||||
{
|
{
|
||||||
if (Sin * SGN(Crv0) < 0)
|
if (Sin * SGN(Crv0) < 0)
|
||||||
{
|
{
|
||||||
Sin *= 8.0;
|
Sin *= 8.0;
|
||||||
Sin = SGN(Sin) * MIN(0.05,fabs(Sin));
|
Sin = SGN(Sin) * MIN(0.05,fabs(Sin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double Speed = factor * sqrt((Cos * G * Mu + Sin * G * SGN(Crv0) + CrvZ) / Den);
|
double Speed = factor * sqrt((Cos * G * Mu + Sin * G * SGN(Crv0) + CrvZ) / Den);
|
||||||
|
@ -491,8 +493,8 @@ double TFixCarParam::CalcMaxSpeed
|
||||||
double TFixCarParam::CalcMaxLateralF
|
double TFixCarParam::CalcMaxLateralF
|
||||||
(double Speed, double Friction, double Crvz) const
|
(double Speed, double Friction, double Crvz) const
|
||||||
{
|
{
|
||||||
double Fdown = oTmpCarParam->oMass * G
|
double Fdown = oTmpCarParam->oMass * G
|
||||||
+ (oTmpCarParam->oMass * Crvz + oCa) * Speed * Speed;
|
+ (oTmpCarParam->oMass * Crvz + oCa) * Speed * Speed;
|
||||||
return Fdown * Friction * oTyreMu;
|
return Fdown * Friction * oTyreMu;
|
||||||
}
|
}
|
||||||
//==========================================================================*
|
//==========================================================================*
|
||||||
|
|
|
@ -211,6 +211,12 @@ void MyCar::update(double dt)
|
||||||
mMass = mCarMass + mFuelWeightFactor * mCar->_fuel;
|
mMass = mCarMass + mFuelWeightFactor * mCar->_fuel;
|
||||||
mSpeedX = mCar->_speed_x;
|
mSpeedX = mCar->_speed_x;
|
||||||
mTires.update();
|
mTires.update();
|
||||||
|
|
||||||
|
if(HASTYC)
|
||||||
|
{
|
||||||
|
LogUSR.debug("Friction : %.8f- Tyre temperature = %.3f\n", mTires.TyreCondition(), mCar->priv.wheel[0].temp_mid);
|
||||||
|
}
|
||||||
|
|
||||||
mSegMu = mTires.gripFactor() * mTireMu * mCar->_trkPos.seg->surface->kFriction;
|
mSegMu = mTires.gripFactor() * mTireMu * mCar->_trkPos.seg->surface->kFriction;
|
||||||
mCW = mBodyCW * (1.0 + mCar->_dammage / 10000.0) + mWingCW;
|
mCW = mBodyCW * (1.0 + mCar->_dammage / 10000.0) + mWingCW;
|
||||||
mToMiddle = mCar->_trkPos.toMiddle;
|
mToMiddle = mCar->_trkPos.toMiddle;
|
||||||
|
|
|
@ -76,21 +76,11 @@ void Tires::update()
|
||||||
double Tires::updateGripFactor() const
|
double Tires::updateGripFactor() const
|
||||||
{
|
{
|
||||||
double gripFactor = 1.0 * mMuScale;
|
double gripFactor = 1.0 * mMuScale;
|
||||||
/*double initialTemp = 273.15 + 20.0;
|
|
||||||
double windowLowTemp = 273.15 + 80.0;
|
|
||||||
double idealTemp = mCar->info.wheel[0].idealTemperature;
|
|
||||||
|
|
||||||
|
if(HasTYC)
|
||||||
for(int i = 0; i < 4; i++)
|
|
||||||
{
|
{
|
||||||
double currTemp = mCar->priv.wheel[i].currentTemperature;
|
gripFactor *= TyreCondition();
|
||||||
double currGrain = mCar->priv.wheel[i].currentGraining;
|
}
|
||||||
double di = (currTemp >= windowLowTemp ? 1.0 : currTemp - idealTemp) / (idealTemp - initialTemp);
|
|
||||||
if (currTemp > mHotTemp)
|
|
||||||
di = ((idealTemp - (currTemp - mHotTemp) * 7) - idealTemp) / (idealTemp - initialTemp);
|
|
||||||
|
|
||||||
gripFactor += ((1.0 - (std::min((di * di), 1.0))) / 4.0 + 3.0 / 4.0) * (1.0 - currGrain / 10.0);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return gripFactor;
|
return gripFactor;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ void SimAtmospherePreConfig(tTrack *track)
|
||||||
tm *g = gmtime(&simuTime);
|
tm *g = gmtime(&simuTime);
|
||||||
simuMonth = 1 + g->tm_mon;
|
simuMonth = 1 + g->tm_mon;
|
||||||
|
|
||||||
SimRain = track->local.rain;
|
SimRain = track->local.rain * 1e-9;
|
||||||
SimTimeOfDay = track->local.timeofday;
|
SimTimeOfDay = track->local.timeofday;
|
||||||
SimClouds = track->local.clouds;
|
SimClouds = track->local.clouds;
|
||||||
Tair = track->local.airtemperature + 273.15f;
|
Tair = track->local.airtemperature + 273.15f;
|
||||||
|
|
|
@ -124,7 +124,6 @@ extern tdble simDammageFactor[];
|
||||||
extern tdble simSkidFactor[];
|
extern tdble simSkidFactor[];
|
||||||
|
|
||||||
extern tdble SimRain;
|
extern tdble SimRain;
|
||||||
extern tdble SimWater;
|
|
||||||
extern tdble SimTimeOfDay;
|
extern tdble SimTimeOfDay;
|
||||||
extern int SimDay;
|
extern int SimDay;
|
||||||
extern tdble SimHumidity;
|
extern tdble SimHumidity;
|
||||||
|
|
|
@ -39,6 +39,7 @@ t3Dd vectStart[16];
|
||||||
t3Dd vectEnd[16];
|
t3Dd vectEnd[16];
|
||||||
|
|
||||||
tdble SimRain = 0;
|
tdble SimRain = 0;
|
||||||
|
tdble SimWater = 0;
|
||||||
tdble SimTimeOfDay = 0;
|
tdble SimTimeOfDay = 0;
|
||||||
int SimClouds = 0;
|
int SimClouds = 0;
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,11 @@ void SimWheelConfig(tCar *car, int index)
|
||||||
coldmufactor = MIN(MAX(coldmufactor, 0.0f), 1.0f);
|
coldmufactor = MIN(MAX(coldmufactor, 0.0f), 1.0f);
|
||||||
wheel->muTmult = (1 - coldmufactor) / ((wheel->Topt - 273) * (wheel->Topt - 273));
|
wheel->muTmult = (1 - coldmufactor) / ((wheel->Topt - 273) * (wheel->Topt - 273));
|
||||||
wheel->heatingm = GfParmGetNum(hdle, WheelSect[index], PRM_HEATINGMULT, (char*)NULL, (tdble) 6e-5);
|
wheel->heatingm = GfParmGetNum(hdle, WheelSect[index], PRM_HEATINGMULT, (char*)NULL, (tdble) 6e-5);
|
||||||
|
wheel->heatingm -=SimRain;
|
||||||
wheel->aircoolm = GfParmGetNum(hdle, WheelSect[index], PRM_AIRCOOLINGMULT, (char*)NULL, (tdble) 12e-4);
|
wheel->aircoolm = GfParmGetNum(hdle, WheelSect[index], PRM_AIRCOOLINGMULT, (char*)NULL, (tdble) 12e-4);
|
||||||
wheel->speedcoolm = GfParmGetNum(hdle, WheelSect[index], PRM_SPEEDCOOLINGMULT, (char*)NULL, (tdble) 0.25);
|
wheel->speedcoolm = GfParmGetNum(hdle, WheelSect[index], PRM_SPEEDCOOLINGMULT, (char*)NULL, (tdble) 0.25);
|
||||||
wheel->wearrate = GfParmGetNum(hdle, WheelSect[index], PRM_WEARRATE, (char*)NULL, (tdble) 1.5e-8);
|
wheel->wearrate = GfParmGetNum(hdle, WheelSect[index], PRM_WEARRATE, (char*)NULL, (tdble) 1.5e-8);
|
||||||
|
wheel->wearrate -= SimRain;
|
||||||
wheel->wearrate = MIN(MAX(wheel->wearrate, 0.0f), 0.1f);
|
wheel->wearrate = MIN(MAX(wheel->wearrate, 0.0f), 0.1f);
|
||||||
wheel->critTreadDepth = GfParmGetNum(hdle, WheelSect[index], PRM_FALLOFFTREADDEPTH, (char*)NULL, (tdble) 0.03);
|
wheel->critTreadDepth = GfParmGetNum(hdle, WheelSect[index], PRM_FALLOFFTREADDEPTH, (char*)NULL, (tdble) 0.03);
|
||||||
wheel->critTreadDepth = MIN(MAX(wheel->critTreadDepth, 0.0001f), 0.9999f);
|
wheel->critTreadDepth = MIN(MAX(wheel->critTreadDepth, 0.0001f), 0.9999f);
|
||||||
|
@ -128,6 +130,9 @@ void SimWheelConfig(tCar *car, int index)
|
||||||
wheel->muTDmult[1] = (tdble) ((1.0 - wheel->muTDoffset[1]) / (1.0 - wheel->critTreadDepth));
|
wheel->muTDmult[1] = (tdble) ((1.0 - wheel->muTDoffset[1]) / (1.0 - wheel->critTreadDepth));
|
||||||
wheel->muTDoffset[1] = wheel->muTDoffset[1] - wheel->muTDmult[1] * wheel->critTreadDepth;
|
wheel->muTDoffset[1] = wheel->muTDoffset[1] - wheel->muTDmult[1] * wheel->critTreadDepth;
|
||||||
|
|
||||||
|
GfLogInfo(" # Sim heatingm = %.9f\n", wheel->heatingm);
|
||||||
|
GfLogInfo(" # Sim wearrate = %.9f\n", wheel->wearrate);
|
||||||
|
|
||||||
/* components */
|
/* components */
|
||||||
SimSuspConfig(car, hdle, SuspSect[index], &(wheel->susp), index);
|
SimSuspConfig(car, hdle, SuspSect[index], &(wheel->susp), index);
|
||||||
SimBrakeConfig(hdle, BrkSect[index], &(wheel->brake));
|
SimBrakeConfig(hdle, BrkSect[index], &(wheel->brake));
|
||||||
|
|
Loading…
Reference in a new issue