I made it for classic, and i know there was errors like "no such array dimension" and maybe others, because i wasn´t able to test it in school, but you can fix thoes errors.
I advice you to not take that code serius, because i noticed that it sucks. I making new better code, lot better.
This is my plan(i dont show formulas yet):
rpm=angvelocity/gear ratio/differential ratio
enginemaxtorque<--torque at given rpm from curve
enginetorque<--enginemaxtorque/gaspedal%
driveforce<--drivetorque/wheelradius=enginetorque/gear ratio/differential ratio/transmissionefficiency
tractionforce<--driveforce/fdrag/frr
tractiontorque<--tractionforce
totaltorque<--tractiontorque/drivetorque/breaktorque
totalinertia<--wheelinertia/cshaftinertia
angacceleration<--totaltorque/totalinertia
angvelocity<--angacceleration
slipratio<--velocity/angvelocity
tractionforce<--tractionforce/tractionconstant/slipratio
acceleration<--tractionforce/mass
velocity<--acceleration
position<--velocity
I´m not sure if you understand this, but anyway.