Basics of a car simulator



I've been searching Google Groups, and it seems that questions
concerning attempts to create home made car simulators are welcome here.
I am just starting out on such a project, and I want to make sure I have
the basics clear in my head. I hope that if you have any time then any
experts reading this might be able to scan my post and correct the
mistakes I am likely to be making at this stage. I have been reading
about this purely from the point of view of someone trying to write a
simulation and previously knew very little about the internals of a car.

I'm a C++ programmer, so please forgive me if my description of the
simulator components sounds a little unnaturally partitioned compared to
the way things sit in a car or if I lump together important components -
I'm probably just allowing the way I would implement things in classes
to pervade my thought.

Of course, I am happy with and fully understand the problems that are
not specific to a car, e.g. of contact patches in a 3d world and how
computer programs approximate them, of how torque and linear forces are
related, etc. If I wasn't, I don't think this would be the place to ask.

I am only a single person and am doing this to try and create games. I
am not imagining for a second that I could ever create something as
realistic as Gran Turismo or Grand Prix Legends, but I certainly don't
want to settle for Ridge Racer type dynamics.

As I understand it, the bedrock of simulating a car engine is the
flywheel. At any given time it has a particular RPM and a particular
torque. Torque may be derived from RPM and for simple simulation
purposes this can be done using a simple graph lookup. The graph will
appear to be an upward curve, peaking towards its end although maximum
torque is not output at maximum RPM. RPM is evolved over time as a
function of flywheel torque (hence this is a differential equation),
throttle and any external torques being applied. Engine whine is
principally a function of flywheel RPM.

Output torque from the flywheel is scaled according to throttle. It then
goes through the transmission before reaching the wheels. Some energy is
lost there, decreasing total power output.

Gears are applied and are usually described by their gear ratio - in
real life a measure of relative cog sizes which for the purposes of
simulation means a number with which to multiply torque and divide RPM.
Hence power output is not affected by gear ratio. Low gears tend to have
low values greater than 1 (as RPM is sacrificed for torque to get the
thing going) and high gears tend to have values between 0 and 1 (as the
car has built up momentum and the aim is to maximise RPM).

That information is passed on to the tyres. I shall ignore the
possibility of sideways forces for the time being.

At any instant they have a linear velocity obviously derived from the
motion of the main vehicle. Based on the RPM they are being driven at,
their radius and the RPM output to them a slip ratio can be computed.
The slip ratio and the output torque together combine, in practical
implementation terms via a graph lookup that relates slip ratio to a
torque scaler, to create a linear force on the tyre and, as a result,
the car body. Every action has an equal and opposite reaction, so
whatever force is applied acts back up through the transmission to the
flywheel as an external torque affecting the current engine RPM.

The "slip ratio" formulation of tyre/surface interaction is an emulation
of the real world that seems to be credited to Pacejka. Since
calculation requires a divide by linear velocity, it is hard to deal
with at low speeds - at speed 0 it is undefined and near 0 it can play
havoc with numerical accuracy due to the very large numbers involved. So
it is common to approximate tyre reactions at low speeds using a spring
model.

A spring model can be implemented by obtaining the difference between
real linear velocity and "intended" linear velocity (i.e. that implied
as a result of output RPM and tyre radius) and applying a force
calculated as though a spring with natural length 0 were stretched to a
size proportional to the difference in velocities. The spring
coefficient is derived in some way from torque. Presumably because this
is a quick fix to make things work in an unimportant area of most car
games - namely low speed driving - then whatever processing of the
numbers that appears to work is acceptable.

Sideways forces act similarly to the forward relative ones described
above, except that RPM isn't a factor - they can be derived purely from
the wheel's linear velocity as any sideways motion is pure slip.

The traction circle limits total traction. Thinking about it
pictographically, if the forwards and sideways forces are combined to
make a 2d vector from the origin then that vector is clipped if its
endpoint is outside of the traction circle. I have to admit that I'm
sufficiently new to this that I am not sure if the circle is always a
genuine circle or if it may be an ellipse with a minor and major radius.
It is the effects of the traction circle that tends to cause sliding
towards the outside of corners approached at speed.

-Thomas
.



Relevant Pages

  • Re: OT; 59 Chevy vs 2009 in head-on crash video
    ... Nothin' says lovin' like a mesa-flat torque curve from 1200 RPM straight on past redline. ... Put the same motor in a light car like a Wabbit or 'roccet and see what happens. ... anything with only four cylinders pales, torque-wise, next to a good old fashioned pushrod American V-8, ...
    (rec.bicycles.tech)
  • Re: OT; 59 Chevy vs 2009 in head-on crash video
    ... I do note that you qualified it with "normally aspirated" and I will assume that that signifies that you are aware that the 1.8T is a flat out beast, and a torque monster besides. ... Nothin' says lovin' like a mesa-flat torque curve from 1200 RPM straight on past redline. ... I think that the girlie would even give me a pass for "just one more project" if I could make that happen, seeing as I taught her to drive a stick on my '84 'roccet and it's the car that to this day I regret selling the most, of all the cars I've owned, and she also drove my GTI 1.8T and knows what that tater can do. ... anything with only four cylinders pales, torque-wise, next to a good old fashioned pushrod American V-8, tuned strictly for off-idle to 5-6K RPM operation. ...
    (rec.bicycles.tech)
  • Re: Okay gearheads, need some advice. (again) lol
    ... I have a Kenne Bell Blowzilla/Flowzilla setup on my '89 LX and last time I had it on a dyno it made 460 ft-lbs of torque at the rear wheels at 2,300 rpm. ... Today, it got pretty warm here, the car was a real dog. ... That's what I want, the Ford model, and there are no emissions testing where I live. ...
    (rec.autos.makers.ford.mustang)
  • Re: Friction (clutch) lining
    ... 540 rpm application. ... From a reading of specs, diesel engined cars tend to have higher torque than petrol engined ones. ... Just looking at the spec for my car compared with its diesel equivalent shows torque of 350 and 650 respectively - they don't quote units but I assume it's Nm. ...
    (uk.rec.models.engineering)
  • Re: Basics of a car simulator
    ... At any given time it has a particular RPM and a particular ... Torque may be derived from RPM and for simple simulation ... > At any instant they have a linear velocity obviously derived from the ... > their radius and the RPM output to them a slip ratio can be computed. ...
    (rec.autos.simulators)

Loading