General » rec.autos.simulators » Re: Basics of a car simulator
Re: Basics of a car simulator [message #494999] Mon, 31 October 2005 06:07
todd_wasson  
Thomas Harte wrote:
> 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.
>

Sounds just like a lot of us :)

Here's a quick vid of mine at the moment. Graphics stink, but hey :-)

http://www.PerformanceSimulations.com/files/ToddSim10a.wmv

Also did Virtual RC Racing. There are some vids around the net of
that.


<snip>

>
> 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.
>

Yes, you can look up torque as a function of RPM. Just google "dyno
chart," "dyno test," "dyno graph," "torque curve" or simlar to find a
plethora of data. You'll want something that looks like this:

http://www.airflowresearch.com/dyno/chevy_dyno.htm

> 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.
>

Yes, typically you'd just multiply the flywheel torque by a fixed
driveline efficiency to get the torque at the driven wheels. Note that
some dyno test data is actually measured at the wheels to start off
with, so in those cases the efficiency you'd use would be 100%.


> 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).
>


Yep. By the way, any "overdrive" gear means its value is < 1. Just a
tidbit there..


> 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.


Right. Slip ratio = 1 - (actual rotational velocity / free rolling
velocity)


> 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.


Sort of. Tire data is in the form of longitudinal force vs. slip
ratio. There's not a "torque scaler" there anywhere, although maybe
that's what you meant anyway.


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.
>

Right.


> The "slip ratio" formulation of tyre/surface interaction is an emulation
> of the real world that seems to be credited to Pacejka.

"Slip ratio" is a term that has been around since the dawn of vehicle
dynamics. Not credited to Dr. Pacejka. He has written numerous tire
models however. His famous Magic Tire Model is very popular with the
sim racing community, so you'll see "slip ratio" and Pacejka in the
same sentence quite a lot :-)


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.


Yes, you tend toward a singularity (dividing by numbers closer and
closer to 0) as the tire's contact patch velocity approaches 0.


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.
>

Actually, a simpler, slightly more clean way to do it is to change the
slip ratio calculation from a division to a subtraction at low speeds.
I.e., :

Slip ratio = 1 - (actual rotational velocity / free rolling velocity)

becomes something like:

Slip ratio = 1 - (actual rotational velocity - free rolling velocity)

If you went about it this way, you'd need a cutoff velocity to switch
between the two equations. Really, if you're under that cutoff
velocity a pretty good way to handle things is to calculate it both
ways (provided free rolling velocity <> 0), then use a weighted average
of the two depending on where you are in relation to the cutoff
velocity. This way they two methods will blend into each other nicely
and you won't get a sudden jolt/change in slip ratio at some point.

Granted, all this really does is increases stability at low speed. You
won't be able to stop on hills this way. There are a few ways to solve
that though, although frequently they don't really work out all that
well. I was modelling my tires as torsion springs at low speed for
awhile there. That actually worked quite well.


> 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.
>

Correct. Slip angle is simply the direction the tire is moving
relative to the direction it's facing. It indeed an "angle," however,
not a percentage as Jeff suggested.


> 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.

Yes, although clipping the vector is not really the most realistic way
to go about it (I've tried both and let engineers drive the model both
ways). It's generally more realistic to give the longitudinal force
precedence over the lateral one. I.e., you let the longitudinal force
go to whatever it wants, then find out how much room you have left for
sideforce. This means you are not just clipping the vector, but also
changing its direction. This still gives mediocre results at best, but
is what most sims appear to do so you may very well be on par with them
with that approach.



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.

A circle is a good enough approximation probably in most cases. You're
not going to get any useful, interesting tire data anyway so will need
to live with a good guess. In reality there is usually a slightly
elliptical shape. I wouldn't be too concerned with that at first,
however.

Todd Wasson
Racing and Engine Simulation Software
http://www.PerformanceSimulations.com
http://www.VirtualRC.com
Re: Basics of a car simulator [message #497211 ] Wed, 02 November 2005 18:48
Thomas Harte  
> Actually, a simpler, slightly more clean way to do it is to change the
> slip ratio calculation from a division to a subtraction at low speeds.
> I.e., :
>
> Slip ratio = 1 - (actual rotational velocity / free rolling velocity)
>
> becomes something like:
>
> Slip ratio = 1 - (actual rotational velocity - free rolling velocity)

Do you actually want "1 -" in the second equation? Surely if actual
rotational velocity = free rolling velocity then you want slip ratio = 0?

-Thomas
Re: Basics of a car simulator [message #497212 ] Wed, 02 November 2005 22:50
todd_wasson  
Thomas Harte wrote:
> > Actually, a simpler, slightly more clean way to do it is to change the
> > slip ratio calculation from a division to a subtraction at low speeds.
> > I.e., :
> >
> > Slip ratio = 1 - (actual rotational velocity / free rolling velocity)
> >
> > becomes something like:
> >
> > Slip ratio = 1 - (actual rotational velocity - free rolling velocity)
>
> Do you actually want "1 -" in the second equation? Surely if actual
> rotational velocity = free rolling velocity then you want slip ratio = 0?
>
> -Thomas

Oh yes, you're right :-) Actually what you'll probably need is simply
the subtraction (without the "1 -" of course) and then a multiplying
factor to fiddle with as well.
Re: Basics of a car simulator [message #592511 ] Wed, 11 January 2006 11:46
Ruud van Gaal  
Todd Wasson wrote:
> Thomas Harte wrote:
....
>>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.
>
> Actually, a simpler, slightly more clean way to do it is to change the
> slip ratio calculation from a division to a subtraction at low speeds.
> I.e., :
>
> Slip ratio = 1 - (actual rotational velocity / free rolling velocity)
>
> becomes something like:
>
> Slip ratio = 1 - (actual rotational velocity - free rolling velocity)
....
> Granted, all this really does is increases stability at low speed.

Gee, hope somebody is still reading this; I only visit RAS about once
every half year these days. ;-)

Anyway, another method to deal with low velocity is inside the SAE950311
document, also described in who-was-it-again's thesis. Eric McKenzie I
believe, just glancing over it.
That makes the SR/SA values slide along nicely as the wheel rotates,
giving no problems at 0 speed. Also, it deals with stopping on a hill,
and stopping diagonally on a hill for that matter. I use it in Racer.

The only thing with it is that I limit SR/SA values to not grow too
large since it then takes too much time to bring it down to normal
levels when sudden changes in wheel velocity take place.

That's all. :) Interesting read though.

Cheers,
Ruud
Vorheriges Thema:New Graphics Card
Nächstes Thema:DFP Driving Force Pro - what do you set the rotation to?
Gehe zu:
  


aktuelle Zeit: Sat Jan 10 00:13:30 CET 2009

Insgesamt benötigte Zeit, um die Seite zu erzeugen: 0.21161 Sekunden
.:: Startseite - Hinweise - Impressum ::.

Powered