# Calculating final drive force from engine torque and tyre spin ratio

Trying to build a simplified physics simulation for cars, along the lines of "Car Physics" by Marco Monster. I'm stuck at straight line acceleration. I don't know if I understand the processes correctly or not:

I'm using engine torque, gear ratio and throttle input to calculate the "potential drive torque" on the axle. From this, I directly calculate the angular acceleration of the drive wheels. Then I compare the actual speed of the vehicle with the angular velocity of the wheels to get the longitudinal slip ratio. If too much power is used, the result indicates that the tyre is spinning by a certain amount. And here's where my confusion starts. I then use the spin ratio and the load on the drive wheels to get the final drive force.

Am I correctly using the spin ratio curve by plugging in the spin ratio and using the resulting force directly as the final drive force?

This feels wrong, over time there's a discrepancy between the angular velocity of the wheel (calculated from engine torque) and the car's speed (calculated indirectly from load on the wheel, the only input that was carried over from the engine calculation before is the spin ratio). The difference between the two speed values gets larger as long as I accelerate.

Edit: Adding my current pseudo-code

var engineTorque = getEngineTorque(engineRpm, throttleInput)
var maxTireTraction = frictionCoefficient * loadOnRearWheels
var potDriveTorque = engineTorque * gearRatio
var potDriveForce = potDriveTorque / wheelRadius

var driveWheelAngularAcceleration = potDriveTorque / rearAxleInertia
driveWheelAngularVelocity += driveWheelAngularAcceleration * dt
driveWheelRpm = driveWheelAngularVelocity * 2 * PI
var slipRatio = getSlipRatio(driveWheelRpm, wheelRadius, speed)
var driveForce = getForceFromSlipRatio(slipRatio, loadOnRearWheels)

var totalForce = driveForce - resistanceForces - brakeForce
speed += dt * totalForce / mass