DIY_EFI Digest V4 #464
William T Wilson
fluffy at snurgle.org
Thu Aug 12 20:43:47 GMT 1999
I hate digest mode.
Somebody please fix it. :}
> The most common pitfalls are not coming to terms with writing "real
> time" applications and how very "real time" the engine management
> game is.
Something that is extremely lacking - not just in engine management but in
many technology applications - is people actually quantifying what they
want the stuff to do.
Let's say your engine turns 10,000 RPM (because it's a nice round number
and is pretty much an upper bound for anything amateurs are likely to do).
Let's say it's a 4 cylinder engine or a rotary; a V8 has twice as much to
do but turns about half as fast, so it all works out. Let's also assume
you're using TBI injection. Now, if my brain is working (which it often
is not):
10,000 RPM is equal to 166 RPS. Since you have one pulse for every other
revolution for each cylinder (assume 4) you'll have 4 * 166 / 2 = 332
pulses per second. Now, that doesn't seem all that bad, but consider all
the stuff that has to be done for that pulse and how precise it has to be.
It's easy enough for a computer to do 332 things per second but for it to
do one thing precisely every 3 msec is a little different.
First you must sense the current RPM. You can't do this in the same
thread that does anything else because by the time you get the RPM sensed
you'll have missed a pulse. If you have 6 teeth with one missing on your
sensor widget (that's a technical term) you'll be getting 50,000 pulses a
second, which means you need resolution of 100,000 pulses a second (so you
can find the missed one) which means you need additional hardware to help
with this, *already* your laptop is by itself inadequate.
Assuming you have a unit which sends you a 16-bit value (adequate for any
RPM) 10,000 times a second. You need to read your serial port at a bit
rate of 19,200 bps just to make 9600 RPM max. 38,400 if you want to be
safe. The good news is that if you miss one of these it's not the end of
the world.
Then you need to send the injection pulse. First you need 3msec timer
accuracy. The hardware clock can do that, but if your system is too
heavily loaded, you'll lose out. This is where Windows really falls over;
it's simply not that precise. Most of the time Windows can't even play
mp3's and run Netscape at the same time without cutting out even though
the total cpu load is less than 25%.
The trouble is, you can't block (i.e. run in a tight loop to ensure
precise timing) while you do this because about half the time, some other
cylinder will need a spark while you're timing the injection pulse. So
you have to pass it off to the OS and go tend to the other guy's spark.
If you have a V8 instead of a 4-cylinder you'll have twice as many sparks
and longer injection pulses so you'll have even more trouble with that.
Somewhere in there you have to find time to check the TPS, correlate it
with the RPM and boost level (if applicable) and find out how much fuel
you're going to squirt for the next pulse. If you are running closed loop
you'll have to check the value of the O2 sensor... oh, bad news. A/D
converters are slow - so you can't do that read instantaneously. But you
need to know this ahead of time because otherwise you don't want to go
lean accidentally.
Any of this stuff is easy enough to do, but getting all the scheduling
right is the hard part.
> On the Engine Management side things are a lot more difficult.
You can get a good handle on things just by connecting an A/F meter to see
how much fuel is being pushed in at various RPM's. You can then simply
capture this data for a good starting point.
> Let us know what you find out ? Can a 300mHz 32 bit wintel run an
> engine ?
No chance. Windows cannot do this. Linux probably can if you are
comfortable with programming for real time applications, but you would
probably be safest with a genuine real-time OS, which of course is a very
specialized skill and probably expensive for the software.
You kind of reach a point of diminishing returns with PC hardware. The
CPUs today are designed for computationally intensive applications which
engine management is certainly not. Your real bottleneck is the I/O,
most PC systems are very poor at this and it's the most important part of
engine management.
More information about the Diy_efi
mailing list