Home | Pacejka's Magic Formula is used for expressing tire forces. |
|
Pacejka's Magic Formula is used to estimate tire forces due to slip angle and ratio. For more information on the basic formula(e), see the Pacejka Magic Formula page here. This page deals only with the implementation in Racer.
Racer uses only Fx, Fy and Mz curves (longitudinal, lateral and aligning moment; note that Racer uses a different coordinate system: the Fx notation uses the SAE coordinate system). Also, even though the model indicates Pacejka96, there seem to be a lot of Pacejka variations out there with varying properties & sign conventions. So, examining the source code is your best if you want to know what happens exactly.
Sign conventions
Racer's Pacejka implementation has the following properties:
The source code - longitudinal tire force
// Fx - longitudinal rfloat RPacejka::CalcFx96() // Pacejka96 model // Calculates longitudinal force (Fx) // From G. Genta's book, page 63 // Note that the units are inconsistent: // Fz is in kN // slipRatio is in percentage (=slipRatio*100=slipPercentage) // camber and slipAngle are in degrees // Resulting forces are better defined: // Fx, Fy are in N // Mz is in Nm { rfloat B,C,D,E; rfloat Fx; rfloat Sh,Sv; rfloat uP; rfloat FzSquared; // Calculate derived coefficients FzSquared=Fz*Fz; C=b0; uP=b1*Fz+b2; D=uP*Fz; // Avoid div by 0 if((C>-D3_EPSILON&&C<D3_EPSILON) || (D>-D3_EPSILON&&D<D3_EPSILON)) { B=99999.0f; } else { B=((b3*FzSquared+b4*Fz)*expf(-b5*Fz))/(C*D); } E=b6*FzSquared+b7*Fz+b8; Sh=b9*Fz+b10; Sv=b11*Fz+b12; // Notice that product BCD is the longitudinal tire stiffness longStiffness=B*C*D; // *RR_RAD2DEG; // RR_RAD2DEG == *360/2PI // Remember the max longitudinal force (where sin(...)==1) maxForce.x=D+Sv; // Calculate result force Fx=D*sinf(C*atanf(B*(1.0f-E)*(slipPercentage+Sh)+E*atanf(B*(slipPercentage+Sh))))+Sv; return Fx; }
Lateral force
// Fy - lateral rfloat RPacejka::CalcFy96() // Pacejka 96 // Calculates lateral force // Note that B*C*D is the cornering stiffness, and // Sh and Sv account for ply steer and conicity forces { rfloat B,C,D,E; rfloat Fy; rfloat Sh,Sv; rfloat uP; // Calculate derived coefficients C=a0; uP=a1*Fz+a2; D=uP*Fz; E=a6*Fz+a7; // Avoid div by 0 if((C>-D3_EPSILON&&C<D3_EPSILON) || (D>-D3_EPSILON&&D<D3_EPSILON)) { B=99999.0f; } else { if(a4>-D3_EPSILON&&a4<D3_EPSILON) { B=99999.0f; } else { // Notice that product BCD is the lateral stiffness (=cornering) latStiffness=a3*sinf(2*atanf(Fz/a4))*(1.0f-a5*fabs(camber)); B=latStiffness/(C*D); } } Sh=a8*camber+a9*Fz+a10; Sv=(a111*Fz+a112)*camber*Fz+a12*Fz+a13; // Remember maximum lateral force maxForce.y=D+Sv; // Calculate result force Fy=D*sinf(C*atanf(B*(1.0f-E)*(sideSlip+Sh)+ E*atanf(B*(sideSlip+Sh))))+Sv;
return Fy; }
(last updated January 14, 2013 )