rec.autos.simulators

Sim Experiment-- Engines in real time

J. Todd Wass

Sim Experiment-- Engines in real time

by J. Todd Wass » Mon, 14 Apr 2003 09:41:11

I've often wondered if it would be possible to model an engine at a simple
level in real time.  What if you modelled eight (or whatever) pistons actually
moving up and down in the cylinders, forcing air through the exhaust system to
produce sound dynamically in real time?  

I decided to go ahead and give it a shot and see what it would sound like.
What you're listening to in the samples below are various 5.7 liter V-8 engines
with no exhaust headers (basically eight very short straight pipes):

http://www.racesimcentral.net/

Physically based sound has been done before, of course.  There was the Stacatto
engine demo, which took an approach like this, but it's interesting how
different this sounds.  There is a lot of room for other stuff to be put in
(I've got plenty of ideas).  Keep in mind this is a relatively simple model :-D

This might not run right on super fast computers.  A friend of mine had
problems on his 2.5Ghz system, but it ran fine on a couple of 1.1Ghz system at
work as well as my 333Mhz laptop.

Anyway, let me know what you think!  

Todd Wasson
Racing Software
http://www.racesimcentral.net/
My car sim
http://www.racesimcentral.net/

Nigel Nichol

Sim Experiment-- Engines in real time

by Nigel Nichol » Mon, 14 Apr 2003 14:19:45

Well that was a an interest play.  Sounds pretty damn good to me.  Doing
sound this way would eliminate the looping wav files heard in other games.
With thius you could easily develop a single cyclinder miss or like wise.
Cya
Nigel



RLevy106

Sim Experiment-- Engines in real time

by RLevy106 » Mon, 14 Apr 2003 12:09:54

excellent work, some of the sounds were pretty darn convincing... I am very
partial to the low rumble one I think it was file 12 or 13. Very big blockish.

Don't try to run 2 of them at the same time though... mega crash.... ;-)

Rich

J. Todd Wass

Sim Experiment-- Engines in real time

by J. Todd Wass » Tue, 15 Apr 2003 00:48:44

Thanks, Nigel.  Actually I do have misses already in there, but it's not in any
of the examples you heard.  Next will be to model the rest of the exhaust
system so you have resonances based on pipe lengths that will effect each
cylinder as rarefraction and compression waves travel between the cylinders,
helping or hindering cylinder filling depending on the exhaust configuration.
I think you should be able to actually hear when the engine reaches peak torque
this way.  Right now there is no sound at all for 25% of each piston's travel.
I.e., when the exhaust valve shuts, the sound stops.  With the pipes in there
the waves will continue bouncing around, producing some interesting changes
throughout the speed range.  

Also, the cylinder filling is a bit random now, but should really change with
engine speed of course as it follows the torque curve.  That should really
transform the sound as you rev up through the rpm's :-)

This will probably be in my demo, scheduled to be released in 2413 ;-)

Todd Wasson
Racing Software
http://PerformanceSimulations.com
My car sim
http://performancesimulations.com/scnshot4.htm

J. Todd Wass

Sim Experiment-- Engines in real time

by J. Todd Wass » Tue, 15 Apr 2003 00:50:14

Thanks :-)  I like the sound of big, crackly racing engines the most too.  

Hehe :-)  Yes, that doesn't work very well!

Todd Wasson
Racing Software
http://PerformanceSimulations.com
My car sim
http://performancesimulations.com/scnshot4.htm

n0sp4/\\/

Sim Experiment-- Engines in real time

by n0sp4/\\/ » Tue, 15 Apr 2003 02:39:00

The guys working on Live for Speed have nothing on you man.  This sounds
so much better than their "staccato" type sound engine.  Maybe you
should give them a call?

Steve
Mach42


>>Well that was a an interest play.  Sounds pretty damn good to me.  Doing
>>sound this way would eliminate the looping wav files heard in other games.
>>With thius you could easily develop a single cyclinder miss or like wise.
>>Cya
>>Nigel

> Thanks, Nigel.  Actually I do have misses already in there, but it's not in any
> of the examples you heard.  Next will be to model the rest of the exhaust
> system so you have resonances based on pipe lengths that will effect each
> cylinder as rarefraction and compression waves travel between the cylinders,
> helping or hindering cylinder filling depending on the exhaust configuration.
> I think you should be able to actually hear when the engine reaches peak torque
> this way.  Right now there is no sound at all for 25% of each piston's travel.
> I.e., when the exhaust valve shuts, the sound stops.  With the pipes in there
> the waves will continue bouncing around, producing some interesting changes
> throughout the speed range.  

> Also, the cylinder filling is a bit random now, but should really change with
> engine speed of course as it follows the torque curve.  That should really
> transform the sound as you rev up through the rpm's :-)

> This will probably be in my demo, scheduled to be released in 2413 ;-)

> Todd Wasson
> Racing Software
> http://PerformanceSimulations.com
> My car sim
> http://performancesimulations.com/scnshot4.htm

J. Todd Wass

Sim Experiment-- Engines in real time

by J. Todd Wass » Tue, 15 Apr 2003 03:11:51

Wow.  Thanks, Steve :-)  Think I'll go post this in their forum and see what
happens.

Todd Wasson
Racing Software
http://PerformanceSimulations.com
My car sim
http://performancesimulations.com/scnshot4.htm

Haqsa

Sim Experiment-- Engines in real time

by Haqsa » Tue, 15 Apr 2003 07:54:50

Are you going to model engine vibration too?  To me this is the
characterstic that really sets the sound of a V8 apart from a V12, for
example.  The vibration orders are the thing that is really different,
otherwise it's all just rpm x no. of cylinders.  Plus I have noticed that on
race broadcasts you can really hear some harsh engine vibration on decels,
which is something that I feel is missing from all the sims I have ever
played.  Seems like most sims use the same noise for accel and decel, but
maybe filter it a bit and add backfire to the decels.  It should be more
different than that.



J. Todd Wass

Sim Experiment-- Engines in real time

by J. Todd Wass » Tue, 15 Apr 2003 09:03:27

Hmm..  Hadn't thought of engine vibration.  Not really sure how to do it off
the top of my head.  This is pretty CPU hungry as it is and will get a lot
worse with the whole exhaust system in there, but I'll think about it.  

What I think is definately missing is the little jumping around in rpm's you
get when getting on or off the throttle like you mentioned.  It think this is
probably mostly due to gears engaging then bouncing off each other; almost like
a flexing in the drivetrain.  That's definately something I want to put in if
it's not too CPU intensive.  That adds so much to the sound.  Plus, this would
probably alter the sound quite a bit since it's accelerating and then
decelerating with different amounts of cylinder filling in between the little
"jumps."  

This sound actually changes based on how quickly the engine is
accelerating/decelerating along with cylinder filling which can be controlled
any way one's imagination allows, I suppose, so the off throttle sound can be
very different.  What you don't get here in the demos are part throttle
effects.  There's actually a smooth transition between full throttle and closed
throttle, so you'd get a really different sound as you're coaxing the car
through a corner while feathering the throttle.  

But yeah, I agree, there's something missing sound-wise from sims.  Hopefully
this is a step in the right direction though (I think it will be).

Todd Wasson
Racing Software
http://PerformanceSimulations.com
My car sim
http://performancesimulations.com/scnshot4.htm

Stefan Larsso

Sim Experiment-- Engines in real time

by Stefan Larsso » Tue, 15 Apr 2003 16:24:27


> http://performancesimulations.com/files/EngineSoundModel.zip

> Physically based sound has been done before, of course.  There was the Stacatto
> engine demo, which took an approach like this, but it's interesting how
> different this sounds.  There is a lot of room for other stuff to be put in
> (I've got plenty of ideas).  Keep in mind this is a relatively simple model :-D

Nice!  From my first impression the sound would need some low-pass
filtering...
You know, I've been using commercial software that produces worse sound
than that of your prototype, GT-Power...

http://www.gtisoft.com/

They give you the opportunity to even model the sound based on the
layout of the muffler. But it sound verrrry synthetic.

What is your model based on?  A first order simple thermodynamic ODE
coupled to a stiff crankshaft which is represented
by a second degree ODE which basically is Newton's equations, but for
rotation?  Or is it even simpler?

 From my own experience in modelling performed in scope of my own
research in engine control I could advise you to use a parametric
pressure model which probably will speed up your simulations a bit... It
is described in SAE Technical Paper 2002-01-0371, written by Lars
Eriksson and Ingemar Andersson. You could then try to model the rest of
the dynamics in pipes and such by formulating differential equations and
then discretizing these ending up with a computationally efficient
recursion algorithm... It might work very nice indeed!

/Stefan Larsson
http://www.s2.chalmers.se/~last
(remove nospam in e-mail to reply)

den

Sim Experiment-- Engines in real time

by den » Tue, 15 Apr 2003 19:30:58

Absolutly Awesome,wow the hairs on the back of my head stood up,fantastic
can't wait to hear this sound in a sim.regards
skell


Stefan Larsso

Sim Experiment-- Engines in real time

by Stefan Larsso » Tue, 15 Apr 2003 21:41:23


> Hmm..  Hadn't thought of engine vibration.  Not really sure how to do it off
> the top of my head.  This is pretty CPU hungry as it is and will get a lot
> worse with the whole exhaust system in there, but I'll think about it.  

You could maybe get some modelling inspiration from SAE Technical Paper
2000-01-0560: "Torque Estimation and Misfire Detection using Block
Angular Acceleration", by Jeffrey K. Ball et al.

/Stefan Larsson
http://www.s2.chalmers.se/~last
(remove nospam in e-mail to reply)

J. Todd Wass

Sim Experiment-- Engines in real time

by J. Todd Wass » Fri, 18 Apr 2003 08:58:27

Interesting.  I think it would be pretty simple to include a basic muffler
model (at least a vibrating muffler anyway).  I wonder how that would sound.
This isn't a 3D system though like the gti software most likely is, so it's
interesting that you find it sounding better even though it's far simpler,
probably.

Simpler.  Volume changes in the cylinder are controlled directly by engine
speed, which itself is artificially changed in the demos.  The acceleration you
hear is constant through each gear and really just a special effect more than
anything else in those demos.  For driving sims, however, you should be able to
simply feed the engine RPM directly into the sound function and let it do its
thing.  That's of course a function of all the car's setup parameters and so
forth.  The engine inertia, gearing, rotational acceleration is all part of the
vehicle model, not the engine sound system.  Basically, you say "for the next
period of time where the sound buffer is being filled, spin the engine at xxx
rpm and let it accelerate at xxx rpm/sec^2."

The actual acceleration would be handled in the vehicle model.

Thanks for the tip.  I'll look into that.  I have to keep in mind here though
that those demos are running at over 88,000 hz and are done for eight
cylinders.  That's going to be at least 176,000 * number_of_operations per
second per cylinder and per tube section, so the feasibility of having it run
in real time with graphics and so on for a driving sim is yet to be seen.  The
current version would run just fine, I think.  The full blown version of what
I've got in mind would probably be great for a Playstation 3 or other rumored
multi-processor systems possibly in planning, but it might need to be
simplified a bit for PC games (which would still be beefed up from what you
heard.)

You could then try to model the rest of

I have no idea how to formulate a differential equation, let alone discretize
it.  I'd have to look that up in a dictionary to even know what you meant ;-)
At least, if I've done it before, I didn't know that's what I was doing :-)
Sort of like numerical integration, I guess...

I'm not sure if this is the place for a recursive algorithm though because the
number of nodes in the mesh might have to remain small.  As it is, the demos
only have 8 control volumes and 8 boundaries to an infinite volume constant
pressure zone (one for each cylinder).  What you're effectively hearing is the
sound at the exhaust valve rather than at the end of any of the
not-yet-implemented pipes.  I've got a plan though for that already as far as
linking pipes and so forth is concerned.  

If I'm missing your point though, please expand on it.   Your thoughts on this
are interesting, and I appreciate your compliments!

Todd Wasson
Racing Software
http://PerformanceSimulations.com
My car sim
http://performancesimulations.com/scnshot4.htm

J. Todd Wass

Sim Experiment-- Engines in real time

by J. Todd Wass » Fri, 18 Apr 2003 08:58:45

Thanks! :-)

Todd Wasson
Racing Software
http://PerformanceSimulations.com
My car sim
http://performancesimulations.com/scnshot4.htm

Stefan Larsso

Sim Experiment-- Engines in real time

by Stefan Larsso » Fri, 18 Apr 2003 16:02:32


>>They give you the opportunity to even model the sound based on the
>>layout of the muffler. But it sound verrrry synthetic.

> Interesting.  I think it would be pretty simple to include a basic muffler
> model (at least a vibrating muffler anyway).  I wonder how that would sound.
> This isn't a 3D system though like the gti software most likely is, so it's
> interesting that you find it sounding better even though it's far simpler,
> probably.

But it might be more accurate for engineering... I haven't got the
opportunity to compare with an engine that corresponds to the model.
I've noticed a difference in approach between "*** industry" and
engineering.

Ok, I'm thinking in a very different way... Since I am working with
dynamic systems every day it is natural for me to formulate everything
as large models an then trying to simplify them using different
model reduction methods. My idea was to simulate the engine as a
simple system and just coupling the sound directly to the engine RPM.
The engine dynamics would then be incorporated in the simulation of the
engine as a whole.

88 kHz might be a bit high for physical simulations... But it might be
possible to approximate the pressure variation in the cylinder using a
cosine function, or even a quadratic function like x^2. I've already
tried to play a sequence of synthesized pressures two years ago, but it
didn't sound very good. Sounded much like playing abs(cos(x)).
I think you should go for the full model and then simplify it by trying
to get a grip of which components that matter.

Yep... It's like numerical integration, but more general. If you
formulate a linear continous differential system you can discretize it
by e.g. first Laplace transform it and the apply a discretization
transform into the Z-transform. Yes, I know it sounds horrible, but it
is actually quite simple once you understand the what's behind the
nomenclature.

By "recursive" I don't mean recursive in code, but in the algorithm...
Like:  y(k+1) = a0 * y(k) + a1 * y(k-1) + a2 * y(k-2) + ...,
which will be calculated once for every iteration.
It will depend on old values which already has been calculated which
makes it efficent. The coefficients a0, a1, ...  can be dependent of
different states in the engine, like RPM, pressure an so forth...

My point is that if you first formulate the physical system as a large
system of differential equations (which is the hardest part) it is then
quite simple to reduce it all into a couple of cryptic recursive
equations as the one above that has to be calculated often enough. :)
There are many known powerful methods for doing this.

Hmm... I made a quick search in the SAE Digital Library and found:

SAE 2000-25-0255, Interactive vehicle interior sound simulation.
SAE 1999-01-1809, A sound simulation technique used for the predicition

                   of passenger compartment noise.
SAE 968054      , Simulation and sound quality evaluation of car
                   interior noise for JARI driving simulator.
SAE 951755      , Numerical simulation of exhaust flows and tailpipe
                   noise of a small single-cylinder diesel engine.

etc. etc...

There seems to be a lot of literature on this subject. It appears
that most of the simulation techniques are based on simulation of
the flow of gas in the pipes. 1-D models seems to be sufficient.
Some even includes Helmholtz resonance simulation (resonances in
the intake pipes due to valve opening and closing if I remember
right).

Well, this do seem as a really interesting subject indeed! But I have
to get back to work now. :(

--
/S

/* http://www.racesimcentral.net/~last */
(remove "nospam" from email to reply)


rec.autos.simulators is a usenet newsgroup formed in December, 1993. As this group was always unmoderated there may be some spam or off topic articles included. Some links do point back to racesimcentral.net as we could not validate the original address. Please report any pages that you believe warrant deletion from this archive (include the link in your email). RaceSimCentral.net is in no way responsible and does not endorse any of the content herein.