I've written a few engine models that vary in complexity. The 2 stroke model is for Virtual RC Racing 4 (or VRC Pro or whatever we wind up calling it) and will probably be used in KartSim too. That's not audio stuff.
There are two components to the 2 stroke sim. First is a preprocessing step where the simulation is run at a bunch of rpm steps. That's pretty quick really since it's a single cylinder engine. It takes perhaps 2 seconds to come up with the torque curve. In that you can change fuel mixture strength, oil and nitro %, etc.. It's using unsteady gas dynamics so the pressure waves travelling through all the intake/exhaust/expansion chamber areas and so on influence things significantly. The area above the piston is three separate volumes which allows intake/exhaust gases to flow and mix across the piston between the transfer and exhaust ports. Some basic heat transfer and other stuff is saved during this step too which is then used in the second component, the real time part. In that, the engine temperature, oil film thickness on the cylinder wall, and so forth varies in real time which can change the torque the engine is making and allow runaway heating from a too-lean condition to seize the engine.
The more complex sim is indeed a 4 stroke model that works similar to WAVE, although probably isn't as accurate. That one takes a couple of minutes to run a full torque curve for a V8 so is definitely not real time. The output data from that can then be used for the real time audio stuff.
Some of you may remember these from a couple of years ago:
http://www.performancesimulati ... iles/EngineSoundModel.zip
http://www.performancesimulati ... les/EngineSoundModel2.zip
Those are indeed real time V8 engine simulations with all 8 cylinders having their own mass flow rates through the valves, cylinder pressure variation, and so on. You'll probably notice the CPU load is pretty high though. It's also not used to make torque curves as it's such a simplified model that it's not nearly accurate enough to do that. The valve model is very simple. They're either open or closed, and there is no intake model at all. Instead, there are preselected volumetric efficiency curves which could have been done in a way to allow throttling of the engine, although I didn't bother with that as I abandoned the approach. The exhaust runner length and dimensions are not accounted for either. So we're talking very, very basic here to run in real time. And this one uses too much CPU power to run a car sim on top of it unless it was running on a multi-core system. Those didn't exist when I wrote those though
The latest one I'm working on now has a lot more potential. This is another simplified engine model that currently is running in a preprocessing step, then the data is fed into the live audio simulation system which itself is very fast (1-2% cpu load usually). That preprocessing step engine model is considerably faster than real time. A V8 will run about 100 times faster than real time with plenty of room to double or triple that, so eventually I'll use it that way, although currently that's not the case. I can kill off cylinders and that sort of thing. Valve bounce/float and simulating stuck valves will also be able to be done with the approach as well.
This too, however, will probably not be very accurate in terms of torque output and so forth which is more what this thread seems to be about. There isn't a turbo simulation in there either. It's mainly intended for audio.
http://www.performancesimulati ... iles/ToddSim-GenIV-06.wmv
http://www.performancesimulati ... iles/ToddSim-GenIV-07.wmv
So yes, it's possible to do an engine simulation in real time. The above movie has audio running at 88Khz, so it's calculating the engine stuff 88,000 times per second on average, which is double what audio/music on a CD runs if I'm not mistaken. The question is really, "how much can you do and at what level of accuracy and complexity?" Currently, it's not too high if you're only using the CPU and not the graphics card (especially the 8800GTX).
While I'm posting videos I might as well add a fun, OT one:
http://www.performancesimulations.com/files/dominoes.wmv