General » rec.autos.simulators » Re: Basics of a car simulator
Re: Basics of a car simulator [message #495006] Mon, 31 October 2005 02:41
Jeff Reid  
> As I understand it, the bedrock of simulating a car engine is the
> flywheel.

I'm not sure why you have this impression. The flywheel only
adds rotational inertia to the engine. The only real effect this
has is when downshifting and the momentary braking effect it
causes while rpms are increased.

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

An equation or table look up for torque versus RPM is good enough.
You can make the simple assumption that response to throttle
inputs are linear (assume that the car has a real smart ECU).
Torque peak can range from about 25% to 80% of redline, I suggest
60% to 70%. For a racing engine, use a graph from a motorcyle
dyno chart (you can usually find these in bike magazines), as
the torque curves are close enough to racing engine (nomrally
aspirated ones). Scale the rpms for your intended redline.
If you can find the actual torque curve for the engine you're
trying to model, use it.

> RPM is evolved over time as a function of flywheel torque

This is only good for hitting the throttle with the clutch in, or
in neutral. Normally you can caclulate rear wheel force (assuming
rear wheel drive here), from rear wheel torque and diameter,
then calculate acceleration, and intergete over time to get
velocity and distance. Use velocity and gearing to determine new
engine rpm.

> 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" 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,

Slip ratio is relative to rear wheel torque and the downforce on the tire,
not velocity. I'm not sure why so many texts use velocity based equations
since this is an effect, not a cause. The contact patch moves slightly
slower than the rest of the tire as the tread surface stretches and relaxes
as it "flows" through the contact patch. The amount of slowing is relatively
small, and you might want to consider ignoring it. You can create a two
dimensional table, torque and downforce as indexes, containing values for
slip ratios, and use linear interpolation for values in between. You may
want to consider ignoring the downforce component.

Another factor is tread squirm, the sidewalls of a tire push inwards on
the contact patch. You can probably ignore this effect as 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.

Slip angles can occur without slippage. The contact patch is flexible, so
it's direction is not perpendicular to the tire's axis when there is
a side load. The smallest maximum slip angles occur on IRL type cars,
with a working slip angle of around 2%. Modern bias ply tires can go
over 5%, and the older tires were higher still.

> The traction circle limits total traction.

It's usually not a circle, for most tires, forwards/backwards grip
is a little higher than sideways grip.

What happens when you exceed the traction circle depends on the tire
type. For bias ply racing slicks, there is little if any, loss of grip
while cornering even if optimal slip angle is exceeded. A streat
oriented radial has significant loss of grip, and I would not recommend
using a street radial for actual racing.
Re: Basics of a car simulator [message #497167 ] Mon, 31 October 2005 18:00
Thomas Harte  
First of all, thanks to all for the help. I hope the questions I am
asking are not giving away too shocking a lack of knowledge in this area!

"Jeff Reid" <jeffareid [at] hotmail.com> wrote:
> I'm not sure why you have this impression. The flywheel only
> adds rotational inertia to the engine. The only real effect this
> has is when downshifting and the momentary braking effect it
> causes while rpms are increased.

I think this is probably a conceptual issue. I have no idea what the
inside of an engine looks like, but from reading the various guides to
simulating car behaviour I got the impression that the flywheel is the
thing driving the wheels (via the transmission which includes the
gearbox) and the combustion of petrol accelerates the flywheel. So I
guess I was using it as a catchall explanation in my mind for way the
various torques accumulate.

> You can make the simple assumption that response to throttle
> inputs are linear (assume that the car has a real smart ECU).

What would be a better assumption for response to throttle? I can easily
throw a graph lookup at the problem if data is available, but if not is
there some general shape that is more realistic?

"Todd Wasson" <todd_wasson [at] performancesimulations.com> wrote:
> Here's a quick vid of mine at the moment. Graphics stink, but hey :-)
>
> http://www.PerformanceSimulations.com/files/ToddSim10a.wmv

I can't try your programs first hand because I am using a Mac, but the
video looks great. If I could ever get anything going as well as that, I
would be very happy! I note you have implemented a more thorough
simulation than I intend to as you are keeping track of temperature and
incorporating considerations of camber.

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

Then I am, or hopefully have been, confused about this. I will try to
explain my revised understanding based on your answer.

I can calculate slip ratio from comparing the true linear velocity at
the contact patch to the velocity that the engine is trying to create.
Using that, I obtain a longitudinal force.

Presumably I multiply by load here, as F = (mu)*R (where '(mu)' is the
Greek letter you'd expect and not two separate variables)?

Finally, I apply that force both "positively" to push the car forwards
and "negatively" as a resistive torque along the driveline.

What this means is that whatever torque is being output by the engine is
irrelevant at this point in the calculations, albeit still highly
relevant to the total simulation because of the way it will attempt to
counteract the "negative" torque coming back from the wheels.

Now a quick question on data sets. I note that every document I've seen
recommends that the slip ratio -> force calculation is done as a data
set lookup. It strikes me that values of slip ratio are unbounded as
free rolling velocity may get arbitrarily close to zero. I therefore
guess that the sections of graph shown as suggested data sets are the
areas that it is recommended are kept in a table as they tend to be near
the origin and do something interesting then tail off in a predictable
fashion (see e.g.
http://www.btinternet.com/~ashley.mcconnell/physics/physicsi mages/longsli
p.gif - part of http://www.btinternet.com/~ashley.mcconnell/physics/).

Is that an accurate reading of the way this information is stored and
used? Presumably it is up to me and will depend on implementation
specific factors what I do to get a value outside of the stored area but
pictographically it looks like assuming a linear decay outside of the
stored area would be acceptable.

Incidentally, what level of realism am I likely to get with the
approximations I am adopting? I know that's hard to answer and that I'll
fall well below the higher tier, but how will I compare to classic
"realistic" games of the past such as the original Need for Speed or Car
& Driver immediately before it?

-Thomas
Re: Basics of a car simulator [message #497170 ] Mon, 31 October 2005 19:09
Jeff Reid  
> simulating car behaviour I got the impression that the flywheel is the
> thing driving the wheels

The flywheel is attached to the crankshaft, the main driven part of
the motor, so it can be considered as driving the wheels through
the drive train.

>> You can make the simple assumption that response to throttle
>> inputs are linear (assume that the car has a real smart ECU).
>
> What would be a better assumption for response to throttle? I can easily
> throw a graph lookup at the problem if data is available, but if not is
> there some general shape that is more realistic?

I'm not sure of the shape of the curve, but a classic throttle opens up
valve(s) controlling airflow into the engine. At small throttle openings,
rpms will be low, even in a no load situation. At slightly larger opening,
rpms will be high, but below the limit set by the rev-limiter, under a
no-load situation, and under load, the rpms will be less, depending on
the load versus the torque from the engine. At larger still openings,
but less than full throttle, the engine will run at max rpms set by the
rev-limiter in a no load situation, and lower rpms depending on the
load. As throttle is increased from this point, torque from the engine
increased until the airflow versus rpm is at or beyond the optimal
point. Assuming an ECU with fuel injection, the ECU controls the
amount of fuel going into the engine to correspond with air flow
and throttle position.

The curve shown for torque versus rpm is almost alway the curve that
occurs at full throttle. At lower throttle settings, the torque curve
is lowered, with more of this lowering occurring at higher rpms.
As far as actual data, hopefully Todd can help here.

In some cars, the throttle is not mechanically connected to anything
other than a sensor. Intake opening, fuel flow, ... are all computer
controlled in this case. Such a setup could produce a situation where
torque output was relative to throttle position, up to the maximum
torque for the rpm the engine is running at.

> I can calculate slip ratio from comparing the true linear velocity at
> the contact patch to the velocity that the engine is trying to create.
> Using that, I obtain a longitudinal force.

This is what I'm not getting. Where do you get the velocity that
the engine is trying to create? This engine velocity is related to
the load on the engine. The higher the load, the slower the engine
rotates (assuming a fixed throttle position). The load is related
to the slip ratio, so where is the starting point for this
process?

> What this means is that whatever torque is being output by the engine is
> irrelevant at this point

Engine torque will be directly proportional to rear wheel torque,
minus losses in the drive train, if the rear tire is not spinning.
If the rear tire is spinning, then engine torque is accelerating the
rate of rotation of the drive train and rear tire.

My thinking is that throttle position and engine rpm determines the
torque the engine outputs. This torque is applied to the rear wheels
causing deformation of the tread surface near the contact patch,
with the result that the tread just before and across the contact
patch is compressed (and stretched just after the contact patch,
and relaxed elsewhere, except for centritpital forces from high
rotation rate of the tires).

Ignoring "jerk" aspects, the flow of material (molecules per second)
past any cross section of the tread surface is constant. This
means compressed sections move slower than relaxed sections, and
stretched sections move faster.

I'm wondering if the force applied by the rear tires is relative
to the rear wheel torque divided by the "effective radius". By
"effective radius", I mean the actual radius times the density
of the relaxed tread surface divided by the density of the
compressed contact patch. The "effective" radius is smaller
than or equal to the tire's relaxed radius.

If this is true, then it would be an alternative to using slip
ratio to determine force generated by the rear tire, at least
when not moving or at very slow speeds.
Re: Basics of a car simulator [message #497171 ] Mon, 31 October 2005 19:20
Jeff Reid  
> I'm wondering if the force applied by the rear tires is relative
> to the rear wheel torque divided by the "effective radius".

Here's a link that explains it better:

http://www.mathworks.com/access/helpdesk/help/toolbox/physmo d/drive/tire.html
Re: Basics of a car simulator [message #497172 ] Mon, 31 October 2005 19:36
Jeff Reid  
>> I'm wondering if the force applied by the rear tires is relative
>> to the rear wheel torque divided by the "effective radius".

I forgot that the force is a combination of both adhesive and sliding
grip, so I don't think the deformation alone is enough.

Another link:

http://www.control.lth.se/documents/2003/gaf+03.pdf
Re: Basics of a car simulator [message #497175 ] Mon, 31 October 2005 20:56
Thomas Harte  
> > I can calculate slip ratio from comparing the true linear velocity at
> > the contact patch to the velocity that the engine is trying to create.
> > Using that, I obtain a longitudinal force.
>
> This is what I'm not getting. Where do you get the velocity that
> the engine is trying to create? This engine velocity is related to
> the load on the engine. The higher the load, the slower the engine
> rotates (assuming a fixed throttle position). The load is related
> to the slip ratio, so where is the starting point for this
> process?

I'm sorry, I've started writing as though the structure my code is
taking were more tightly related to reality than it is. The "velocity
the engine is trying to create" is the (angular) velocity the wheels
would be turning at were they not in contact with anything, i.e. if
there were nothing slowing them down.

Within my code - currently using a simple Euler integrator - the
internal forces are accumulated generating the "velocity the engine is
trying to create" and then the external forces (i.e. those resulting
from tyre/floor interactions) are applied. So the state of the vehicle
is evolved over time and the starting point is "vehicle is entirely
static".

I apologise for the confusion!

-Thomas
Re: Basics of a car simulator [message #497178 ] Mon, 31 October 2005 21:33
todd_wasson  
Jeff Reid wrote:
> > simulating car behaviour I got the impression that the flywheel is the
> > thing driving the wheels
>
> The flywheel is attached to the crankshaft, the main driven part of
> the motor, so it can be considered as driving the wheels through
> the drive train.
>
> >> You can make the simple assumption that response to throttle
> >> inputs are linear (assume that the car has a real smart ECU).
> >
> > What would be a better assumption for response to throttle? I can easily
> > throw a graph lookup at the problem if data is available, but if not is
> > there some general shape that is more realistic?
>
> I'm not sure of the shape of the curve, but a classic throttle opens up
> valve(s) controlling airflow into the engine. At small throttle openings,
> rpms will be low, even in a no load situation. At slightly larger opening,
> rpms will be high, but below the limit set by the rev-limiter, under a
> no-load situation, and under load, the rpms will be less, depending on
> the load versus the torque from the engine. At larger still openings,
> but less than full throttle, the engine will run at max rpms set by the
> rev-limiter in a no load situation, and lower rpms depending on the
> load. As throttle is increased from this point, torque from the engine
> increased until the airflow versus rpm is at or beyond the optimal
> point. Assuming an ECU with fuel injection, the ECU controls the
> amount of fuel going into the engine to correspond with air flow
> and throttle position.
>
> The curve shown for torque versus rpm is almost alway the curve that
> occurs at full throttle. At lower throttle settings, the torque curve
> is lowered, with more of this lowering occurring at higher rpms.
> As far as actual data, hopefully Todd can help here.
>
> In some cars, the throttle is not mechanically connected to anything
> other than a sensor. Intake opening, fuel flow, ... are all computer
> controlled in this case. Such a setup could produce a situation where
> torque output was relative to throttle position, up to the maximum
> torque for the rpm the engine is running at.
>


Adding to Jeff's comments, part throttle torque data is not very
commonly found online, I've found. In general there's a sort of
quadratic relationship there between throttle position and what the
torque curve looks like. The most common approach in sims is to have
two torque curves. One for full throttle and one for zero throttle.
The full throttle torque curve looks like the dyno graph I showed. The
zero throttle one should have 0 torque at whatever the idle rpm is,
positive torque at rpm's below that, and progressively more negative
torque (below 0) as rpm increases. This simulates the engine braking
effect. What folks generally do then is extrapolate between the two by
the throttle opening percentage.

As Jeff pointed out in the last paragraph, there are systems that
control the throttle position electronically depending on how far
you've pushed the gas pedal down, engine speed, and so forth. On such
systems you could pretty much make the part throttle curves look
however you want.

> I'm wondering if the force applied by the rear tires is relative
> to the rear wheel torque divided by the "effective radius".

Yes, the component of real wheel torque you're referring to here is
indeed force * effective radius.


By
> "effective radius", I mean the actual radius times the density
> of the relaxed tread surface divided by the density of the
> compressed contact patch. The "effective" radius is smaller
> than or equal to the tire's relaxed radius.
>

"Effective radius" generally means the distance from the center of the
wheel to the ground, including vertical tire deflection. And yes,
under any kind of load this will be smaller than the relaxed radius.
Re: Basics of a car simulator [message #497179 ] Mon, 31 October 2005 21:59
todd_wasson  
Thomas Harte wrote:
> First of all, thanks to all for the help. I hope the questions I am
> asking are not giving away too shocking a lack of knowledge in this area!
>

On the contrary, you're questions display a knack for simulation! :-)


> "Jeff Reid" <jeffareid [at] hotmail.com> wrote:
> > I'm not sure why you have this impression. The flywheel only
> > adds rotational inertia to the engine. The only real effect this
> > has is when downshifting and the momentary braking effect it
> > causes while rpms are increased.
>
> I think this is probably a conceptual issue. I have no idea what the
> inside of an engine looks like, but from reading the various guides to
> simulating car behaviour I got the impression that the flywheel is the
> thing driving the wheels (via the transmission which includes the
> gearbox) and the combustion of petrol accelerates the flywheel. So I
> guess I was using it as a catchall explanation in my mind for way the
> various torques accumulate.
>


Yes, that idea works just fine. It's connected directly to the engine
and rotates at the same speed as the internals of the engine do.


>
> "Todd Wasson" <todd_wasson [at] performancesimulations.com> wrote:
> > Here's a quick vid of mine at the moment. Graphics stink, but hey :-)
> >
> > http://www.PerformanceSimulations.com/files/ToddSim10a.wmv
>
> I can't try your programs first hand because I am using a Mac, but the
> video looks great. If I could ever get anything going as well as that, I
> would be very happy! I note you have implemented a more thorough
> simulation than I intend to as you are keeping track of temperature and
> incorporating considerations of camber.
>


Thanks! :)


> > > 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.
>
> Then I am, or hopefully have been, confused about this. I will try to
> explain my revised understanding based on your answer.
>
> I can calculate slip ratio from comparing the true linear velocity at
> the contact patch to the velocity that the engine is trying to create.
> Using that, I obtain a longitudinal force.
>
> Presumably I multiply by load here, as F = (mu)*R (where '(mu)' is the
> Greek letter you'd expect and not two separate variables)?
>

If your data tables contain effective friction coefficient versus slip
angle/ratio (i.e., numbers that go up to somewhere around 1 or 2), then
yes, you'd multiply that by the tire load. If you use a tire model
like Pacejka's commonly used Magic Tire Model, there's no need to
multiply by the tire load because that is already an input into the
equation. I.e., the formula outputs the forces directly.


> Finally, I apply that force both "positively" to push the car forwards
> and "negatively" as a resistive torque along the driveline.
>
> What this means is that whatever torque is being output by the engine is
> irrelevant at this point in the calculations, albeit still highly
> relevant to the total simulation because of the way it will attempt to
> counteract the "negative" torque coming back from the wheels.
>

Perfect :-)


> Now a quick question on data sets. I note that every document I've seen
> recommends that the slip ratio -> force calculation is done as a data
> set lookup. It strikes me that values of slip ratio are unbounded as
> free rolling velocity may get arbitrarily close to zero. I therefore
> guess that the sections of graph shown as suggested data sets are the
> areas that it is recommended are kept in a table as they tend to be near
> the origin and do something interesting then tail off in a predictable
> fashion (see e.g.
> http://www.btinternet.com/~ashley.mcconnell/physics/physicsi mages/longsli
> p.gif - part of http://www.btinternet.com/~ashley.mcconnell/physics/).
>

A locked wheel (braking) will have a slip ratio of -1 so slip ratio is
only bounded in that one case. There is no limit to slip ratio in the
accelerative direction, however.


> Is that an accurate reading of the way this information is stored and
> used? Presumably it is up to me and will depend on implementation
> specific factors what I do to get a value outside of the stored area but
> pictographically it looks like assuming a linear decay outside of the
> stored area would be acceptable.
>

Ashley is using one of Dr. Pacejka's Magic Tire Models. There is no
data lookup at all there, but rather the formula is used with the slip
ratio input directly into it with the force being output. In this
approach there is no need to worry about the slip ratio boundaries. I
model my tires with a very different approach, but it's also done
"live" without any lookup tables. You can of course use lookup tables
as you've proposed, and in that case you'd probably be just fine
artificially restricting the slip ratio inputs to keep within bounds.
I doubt anyone driving it could tell the difference :-)

> Incidentally, what level of realism am I likely to get with the
> approximations I am adopting? I know that's hard to answer and that I'll
> fall well below the higher tier, but how will I compare to classic
> "realistic" games of the past such as the original Need for Speed or Car
> & Driver immediately before it?
>

In terms of realism you'd blow both of them completely out of the water
with the approach you're taking, don't worry. Car & Driver appeared to
use a columb friction model for the tires without any sort of slip
angle/ratio modelling whatsoever. (Remember the "skid" indicator that
would pop up?) The original Need for Speed is big time arcade deal and
was probably not an attempt to realistically model a car by any stretch
of the imagination.

Sounds to me like you're right on track :-)
Re: Basics of a car simulator [message #497187 ] Tue, 01 November 2005 08:18
todd_wasson  
New video, ~20MB:

http://www.megaupload.com/?d=MS0X8NLO
Vorheriges Thema:Re: GPL Track question
Nächstes Thema:Re: Basics of a car simulator
Gehe zu:
  


aktuelle Zeit: Fri Jan 9 23:33:10 CET 2009

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

Powered