rec.autos.simulators

Sim Experiment- Real time engines part 2

Tom De Mue

Sim Experiment- Real time engines part 2

by Tom De Mue » Sun, 18 May 2003 04:15:54

Todd, Stefan,

Thx for the explanation, but I don't understand how you do it so fast: at
10000rpm for 12 cyl's that's 150 cycles of 12 cyl's : are you computing
pressures for them at every instance and then modelling the vibrations?
Or... am I confused ;-) ?

Is it the vibrations of the engine or of the air you are modelling?
Computing the vibration radiation of an engine block seems like complicated
to do in realtime or again... am I confused ? ;-)

Cheers,
Tom

J. Todd Wass

Sim Experiment- Real time engines part 2

by J. Todd Wass » Sun, 18 May 2003 07:04:42


>Date: 5/16/03 1:53 AM Central Daylight Time



For most of the loop the curve is much like a sine wave, but

I'm using a very rough approximation for now:

Cylinder(CylinderIndex).Pressure = Cylinder(CylinderIndex).Density /
StandardDensityCold * 14.696

When the exhaust valve opens, the pressure is effectively increased by a factor
of 5 to 7 artificially, so there's not really any work being done anywhere in
the system.  This keeps things very fast.  Unless the exhaust model works as I
hope there isn't much point in going with a more complete in-cylinder model
with proper thermodynamics, I figure.  It's got to stay simple enough to run in
real time on my 333Mhz laptop with 3D graphics and physics running on top of it
too.

I am modelling cycle to cycle variations in combustion

I hadn't heard of using charts, that's a neat idea and should be feasible
perhaps for a real time system.  I'll look into it once the exhaust system is
working.  I did use those functions in an in-cylinder combustion model
experiment several years ago (with the Wiebe function for mass fraction burned
you described) and it worked pretty well.  This was back in my QBasic days
though :-P  If I recall correctly, I spent quite a bit of time developing a
formula to approximate the variation of the ratio of specific heat capacities
throughout the temperature range.  Of course, I might have just extrapolated a
bunch of data points, I don't remember for sure.

- Show quoted text -

Interesting.  I'll archive this and have another look when I get back to
(attempting) a more complete engine model (non-real time).  For now all the
system is doing is randomly altering the cylinder mass from cycle to cycle.  It
gives a little bit of texture to the sound, but also static if you go too far
with it.

- Show quoted text -

I don't know, but phasing effects may give a more

I'm not sure I'm following you here.  Can you elaborate?

Try playing around with some discretised

I'll take a look, thanks.  Although this isn't really too difficult, I think.
What's killing me is the exhaust system right now.  I'll have to sit down and
look at it again when I get some time.

Thanks again for sharing!

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

J. Todd Wass

Sim Experiment- Real time engines part 2

by J. Todd Wass » Sun, 18 May 2003 07:10:29


>Date: 5/16/03 2:15 PM Central
>> Sorry for that... Engine combustion modelling tends to get complicated
>> quite fast. :P

>Todd, Stefan,

>Thx for the explanation, but I don't understand how you do it so fast: at
>10000rpm for 12 cyl's that's 150 cycles of 12 cyl's : are you computing
>pressures for them at every instance and then modelling the vibrations?
>Or... am I confused ;-) ?

The vibrations right now in my system are simply random numbers thrown into the
crank every loop.  The system is running at 44khz (CD quality sound), so that
means I pick a random number 44,000 times per second and add it to the
crankshaft rotation.  That's not proper really of course; it would be better to
calculate the torque as it varies every cycle, then use little springs for the
engine mounts and allow it to rock back and forth with the engine inertia.
That's a lot of calculations to do 44,000 times/sec though.  The exhaust system
is first on the to-do list now.  If there's enough CPU power left over I might
try something like that, but my hunch is that you couldn't hear a difference
anyway.  Either the engine is vibrating or it's not.  You can cheat this way in
games.  That's why they're fun to write ;-)

The engine block.  All it's doing is adding maybe -2 to 2 degrees every loop to
the regular crankshaft position.  This goofs up the exhaust profile enough to
hear a little wobbling in the tone.

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

Stefan Larsso

Sim Experiment- Real time engines part 2

by Stefan Larsso » Mon, 19 May 2003 00:05:22


> When the exhaust valve opens, the pressure is effectively increased by a factor
> of 5 to 7 artificially, so there's not really any work being done anywhere in
> the system.  This keeps things very fast.  Unless the exhaust model works as I
> hope there isn't much point in going with a more complete in-cylinder model
> with proper thermodynamics, I figure.  It's got to stay simple enough to run in
> real time on my 333Mhz laptop with 3D graphics and physics running on top of it
> too.

Wouldn't the pressure decrease when you open the exhaust valve, since
the gas expands? Or am I missing something?

You've been into this for a time i guess... I started working on these
things in 2000 when I started my PhD-studies in engine control...

Note that this is a very approximate formulation of the combustion. If
you want a better formulation, for off-line purposes, you should use a
dynamical combustion model.

You are not familiar with the concept of filtering? Imagine your
top-of-the-line stereo at home. I guess that you might have an
"equalizer" on the front panel somewhere. The setting of this sets the
frequency properties of an analogue filter which affects the sound in
different registers (like removing or enhancing the bass).
It is possible to filter signals by quite simple means by designing
digital filters. One way of obtaining a better sound could be to
first analyse the frequency contents of your synthesized engine sound
and also recording the sound of a real muffler at similar conditions
(desireable at a constant RPM). Compare the frequency spectra of
your synthesized sound and the real muffler sound. It is then possible
to try to design a filter that transforms the synthesized spectrum
into the spectrum of the muffler using algorithms like the
Remez-algorithm (I think it is implemented in Octave and SciLab).
I could help you with this if you like. Just hand me a clean recording
of a muffler (if it is possible for you to obtain) and a synthesized
sound (wav-files) for the same type of engine.
This would be known as "black-box modelling" of what happens between
the combustion and the muffler. Physical modelling is, most of the time,
better due to the deeper understanding of the system it results in.

Hmm... I don't know if phasing effects is interersting. They might be,
i.e. different frequencies of pressure waves travel at different speeds
through the exhaust system?  Synthesizers use filters and phasing to
achieve strange sound effects you know...

No prob... It's an interesting subject!

--
/S

/* http://www.s2.chalmers.se/~last */
(remove "nospam" from email to reply)

Stefan Larsso

Sim Experiment- Real time engines part 2

by Stefan Larsso » Mon, 19 May 2003 00:16:51


> The vibrations right now in my system are simply random numbers thrown into the
> crank every loop.  The system is running at 44khz (CD quality sound), so that
> means I pick a random number 44,000 times per second and add it to the
> crankshaft rotation.  That's not proper really of course; it would be better to
> calculate the torque as it varies every cycle, then use little springs for the
> engine mounts and allow it to rock back and forth with the engine inertia.
> That's a lot of calculations to do 44,000 times/sec though.  The exhaust system
> is first on the to-do list now.  If there's enough CPU power left over I might
> try something like that, but my hunch is that you couldn't hear a difference
> anyway.  Either the engine is vibrating or it's not.  You can cheat this way in
> games.  That's why they're fun to write ;-)

CD Quality = 44.1 kHz?  => 44 100 times/sec   ;)

--
/S

/* http://www.s2.chalmers.se/~last */
(remove "nospam" from email to reply)

J. Todd Wass

Sim Experiment- Real time engines part 2

by J. Todd Wass » Mon, 19 May 2003 06:34:07


>Date: 5/17/03 10:16 AM Central Daylight Time


>> The vibrations right now in my system are simply random numbers thrown into
>the
>> crank every loop.  The system is running at 44khz (CD quality sound), so
>that
>> means I pick a random number 44,000 times per second and add it to the
>> crankshaft rotation.  That's not proper really of course; it would be
>better to
>> calculate the torque as it varies every cycle, then use little springs for
>the
>> engine mounts and allow it to rock back and forth with the engine inertia.
>> That's a lot of calculations to do 44,000 times/sec though.  The exhaust
>system
>> is first on the to-do list now.  If there's enough CPU power left over I
>might
>> try something like that, but my hunch is that you couldn't hear a
>difference
>> anyway.  Either the engine is vibrating or it's not.  You can cheat this
>way in
>> games.  That's why they're fun to write ;-)

>CD Quality = 44.1 kHz?  => 44 100 times/sec   ;)

Floating point round off error ;-)

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

J. Todd Wass

Sim Experiment- Real time engines part 2

by J. Todd Wass » Mon, 19 May 2003 06:46:08

>From: Stefan Larsson

>> When the exhaust valve opens, the pressure is effectively increased by a
>factor
>> of 5 to 7 artificially, so there's not really any work being done anywhere
>in
>> the system.  This keeps things very fast.  Unless the exhaust model works
>as I
>> hope there isn't much point in going with a more complete in-cylinder model
>> with proper thermodynamics, I figure.  It's got to stay simple enough to
>run in
>> real time on my 333Mhz laptop with 3D graphics and physics running on top
>of it
>> too.

>Wouldn't the pressure decrease when you open the exhaust valve, since
>the gas expands? Or am I missing something?

I mean the pressure is effectively increased artificially as though combustion
had occured.  Of course when the exhaust valve opens the cylinder pressure
takes a nose dive.

- Show quoted text -

I don't have any formal education in this area, I just read a bit here and
there.  

- Show quoted text -

Oh, ok.  Heywood's "Internal Combustion Engine Fundamentals" covers a lot of
different methods.  I've only experimented with the Wiebe function at this
point.

- Show quoted text -

Hmmm...  Ok.  I don't think this is feasible in real time though (on a PC), is
it?

- Show quoted text -

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

Sim Experiment- Real time engines part 2

by Stefan Larsso » Mon, 19 May 2003 17:27:45


>>You are not familiar with the concept of filtering? Imagine your
>>top-of-the-line stereo at home. I guess that you might have an
>>"equalizer" on the front panel somewhere. The setting of this sets the
>>frequency properties of an analogue filter which affects the sound in
>>different registers (like removing or enhancing the bass).
>>It is possible to filter signals by quite simple means by designing
>>digital filters. One way of obtaining a better sound could be to
>>first analyse the frequency contents of your synthesized engine sound
>>and also recording the sound of a real muffler at similar conditions
>>(desireable at a constant RPM). Compare the frequency spectra of
>>your synthesized sound and the real muffler sound. It is then possible
>>to try to design a filter that transforms the synthesized spectrum
>>into the spectrum of the muffler using algorithms like the
>>Remez-algorithm (I think it is implemented in Octave and SciLab).
>>I could help you with this if you like. Just hand me a clean recording
>>of a muffler (if it is possible for you to obtain) and a synthesized
>>sound (wav-files) for the same type of engine.
>>This would be known as "black-box modelling" of what happens between
>>the combustion and the muffler. Physical modelling is, most of the time,
>>better due to the deeper understanding of the system it results in.
> Hmmm...  Ok.  I don't think this is feasible in real time though (on a PC), is
> it?

It is indeed... The design of the filter is done off-line, but its
implementation is definitely possible in real-time, depending on the
order of the filter. If you have a filter of order 10 you'll end up
with a maximum of approximately 20 multiplications and additions for
each iteration...

--
/S

/* http://www.s2.chalmers.se/~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.