# No subject

Thu May 30 05:48:45 GMT 2013

```I have some basic code for developing the algorithm, now I need to make it
work with only 16 bit integer math.  Then I need to translate it to
assembly.  I could show you what I have so far if you wish.  Below is some
ramblings that was on the list earlier that you might find of interest:

=====================================================================

Lets start off by assuming a few things before we get started.  For this
example, let's assume we have a 4 cyl 4 liter engine and we want an air/fuel
ratio of 14.7/1.  This means 14.7 grams of air for each gram of fuel.
Also for
now, lets assume this engine is operating at an RPM that gives us 100%
volumetric effency.  Since our engine is 1 liter per cylinder, in order to
determine how much fuel to deliver to each cylinder, we need to know the mass
of the air in each cylinder.  Remember back in high school physics,
PV=nRT?
P is the pressure in atmosphers, V is the volume in Liters, n is the number
of mols of air, R is the universal gas constant (8.206x10E-2 Liters *
atmosphers/mols*K), and T is the temperature in degrees Kelvin.  A little bit
of manipulation will give us P/(R*T)=n/V, where n/V is the density of air in
mols per liter.  This isn't very useful, so to convert mols to grams, we
multiply bolth sides of the equation by the molecular weight of air.  I know
that somewhere there must be a 'standard' average value for air, but I
couldn't find it.  I calculated the molecular weight of dry air to be
28.96475143.  This should be close.  So anyway, the result is:
density of air in grams per liter = (mw * P)/(R*T) where mw is the Molecular
Weight of air, P is the pressure of air in Atmospheres, R is the gas constant
and T is the Temperature in degrees Kelvin.  For example, let's plug in 1
atmosphere and 300 degrees Kelvin (24 degrees C, about room
temperature).  At
this temperature and pressure, the density of air is 1.1765 grams per
liter.
Dividing by the desired air/fuel ratio (14.7) tells us that we want 0.08019
grams of fuel for each liter of engine per cycle.  Using a lookup table
(generated using a fuel injector flow bench like the one described in
Performance Engineering Magazine) we would determine the desired amount of
time to hold the fuel injector open.
So by measuring the intake manifold pressure and the intake air temperature
(hopefully at the same spot that the pressure was measured) we can calculate
the amount of fuel needed for a given a/f ratio.  But wait!  This assumes a
constant 100% volumetric effency.  We all know that most of the time it is
less than 100%, and some times greater.  A good estimate is to assume
volumetric effency changes with engine RPM and to correct the mass of air
calculation with an RPM factor.  This is usually done with a 3D Fuel
Map.  On
the X axis we would have the mass of air, the Y axis we would have the engine
RPM, and on the Z axis we output the amount of fuel needed.  This can be in
grams per cycle or if we include the fuel injector correction factor in the
fuel map, it can output pulse width.

(ranges of values for map/temp)
(corrections for cold start, acc, power mode, emmissions mode, fuel econ,
etc)
(what do you think?)

=====================================================================

What do you people think about look up tables?  I seem to remember
years back
in a DFI catalog that they used 16 x 16 look up tables with 4 point
linear
interpolation.  Without having any hands on experience with EFI
systems, this
is what I plan to use in my system.  For the fuel map, I will have
an 8 bit RPM
go in on one axis and an 8 bit "Density of Air" number (calculated
from Air
Intake Temp and MAP pressure) go in on the other axis.  The output
will be an 8
bit pulse width.  I will use the 4 most significant bits of each
byte (hence
the 16 x 16 table part) to get the 4 nearest points to linearly
interpolate
between.  I will then take the top two points and do a linear fit to
them
(y=mx+b) and plug in the lower 4 bit number into x.  Dito for the
bottom two
points.  Then I will take these two y values, do another linear fit
(y=mx+b)
and this result will be my pulse width.  Hmm, reading the above
isn't too clear
to me, so let me try to re-word it.  Assume these names for the 4
points:
A     B      X1 and X2 are the 4 bit lower nibbles to interpolate
with.
C     D
Y1=(B-A)*X1 + A
Y2=(D-C)*X1 + C
Result=(Y2-Y1)*X2 + Y2
A, B, C, and D are 8 bit unsigned numbers.
X1 and X2 are 4 bit unsigned numbers.
(B-A) and (D-C) are 8 bit signed tempoary results.
Y1 and Y2 are (8 bits good enough?) signed numbers.

Although the 68332 (sp?) looks like an ideal processor to use
because of the
timer unit, I have too much time, \$\$, and effort invested in the
6811.  I will
be implementing the above in assembly language.

Does anyone have any comments/suggestions to the above?  Am I on the
right
track?
In thinking about how a carb works, I would need a 'Modifier' for
the EFI
equivilent of a choke on a carb (works off coolent temp?) and a
modifier for
the accelerator pump (works off the rate at which the gas petal is
being
pressed down).  Besides for a ignition curve, what else would I need
a lookup
table for?
-Steven Ciciora
sciciora at aztec.al.bldrdoc.gov

=====================================================================
Ciciora Steve writes:
> Does anyone have any comments/suggestions to the above?  Am I on
the right
> track?

I'm not familiar with the details of interpolation, so I can't
comment
on that.  However I do believe that an 8x8 map is very inadequate.
16x16 plus interpolation is what my EFI Techinologies ECU used.

> In thinking about how a carb works, I would need a 'Modifier' for
the EFI
> equivilent of a choke on a carb (works off coolent temp?) and a
modifier for
> the accelerator pump (works off the rate at which the gas petal is
being
> pressed down).  Besides for a ignition curve, what else would I
need a lookup
> table for?

Okay, here are the curves that the EFI Technologies ECU I had used:

Fuel (16x16)
Spark (16x16)
Temperature Sensor Linearization
Injector Correction f(Throttle)
Battary Offset Correction f(Battery Voltage)
Transient Multiplier f(Watertemp)
Injection Correction f(Air Temp)
Injection Correction f(Water Temp)
Spark Correction f(Air Temp)
Spark Correction f(Water Temp)
Injector phasing f(RPM)

Except for the first three and the last one, all of those are
multiplier
tables.  By that I mean the pulse width from the first two tables is

multiplied by the value in the table for the given condition.  In our

setup, several of those curves were straight lines at 1 :).

Acceleration encrishment uses a constant multiplier and a constant
decay
rate.  There is also a minimum throttle position threshold for
acceleration enrichment and a throttle position point for
acceleration
enrichment saturation.  I believe accelration enrichment is scaled
linearly between those two points (as a function of throttle position

of course).

Does this help any?

--
Jonathan R. Lusky  --  lusky at knuth.mtsu.edu
"Turbos are nice but I'd rather be blown!"
68 Camaro Convertible - 350 / TH350
80 Toyota Celica - 20R / 5spd

=====================================================================
--------

Before the discussion on lookup tables really gets going, I would
like to
make sure that I fully understand the basic concepts and equations
needed to
control the injector portion of this project.  The following is a
start on
what I believe to be the relevant equations for a speed density
system. If
I'm not on track (check my math), please let me know and feel free
to
contribute.

**************************************

1 --- Injector duration

Description of the control algorithm for injector duration.

1.1 --- Calculation of air flow: lb/hr of air

The following describes the calculation of air flow (lbs/hr) as a
function of
the input parameters MAP, Ta, RPM

1.1.1 --- Constants and variables

A_lb/hr: air flow in lb/hr
MAP: Manifold Absolute Pressure (atm) (1 atm = 29.29 in (760 mm) of
Hg)
RPM: revolutions per minute (1/min)
Sa: specific gravity of air at 0 deg C and 1 atm
Sa = 0.0012929 gr/cc = 0.080713 lb/ft^3
Ta: air temperature (K) (T_in Kelvin = T_in Celsius + 273.15)
Vd: engine displacement (ft^3) (i.e., 0.2025 ft^3 for 350 cu. in.)
%VE: the volumetric efficiency

1.1.2 --- Equation

A_lb/hr = (Sa) X (temp & pressure correction factor, assuming ideal
gas) X
(engine displacement) X (RPM/2) X (%VE)

A_lb/hr (lb/hr) = Sa (lb/ft^3) * MAP/1 () * 273.15/Ta () * Vd/2
(ft^3) *
RPM (1/min) * 60 (min/hr) * %VE ()

A_lb/hr = (661.4 * Vd) * MAP / Ta * RPM * %VE