Subject: Put this in the EFI email folder Arrays Improved
From: rotaryeng
Date: 1/21/2013, 11:24 PM
To: AAAA-rotaryeng

Delete the last program and replace it with
this. Debugged and much improved. The old one won't work
anyway.

I am getting a little practice with 2D arrays in QB64

I have decided to use a 10 by 10 array which is
a little larger than usual for an EFI system.
As I recall Megasquirt uses an 8 by 8.

The array is a look up table. The x axis is the RPM
and the Y axis is the mass airflow.

Arrays have the form of A(xcoord,ycoord) in BASIC.

There will be a xcoord  entry about every 75 RPM
and about every  0.5 Volts ycoord from the mass air flow
sensor. About 100 entries total  It looks like this.

^  x x x x x x x x x x x x
M  x x x x x x x x x x x x
A  x x x x x x x x x x x x
F  x x x x x x x x x x x x
^  x x x x x x x x x x x x
V  x x x x x x x x x x x x
O  x x x x x x x x x x x x
L  x x x x x x x x x x x x
T  x x x x x x x x x x x x
S  x x x x x x x x x x x x
......   RPM >>>>>

x represents a mixture setting or pulse width for the injectors.
I wrote a program to initialize the array to 30
because it is rather tedious to type all that in by
hand. Simple QB64 program. The array will be adjusted
before I run the engine on it. The tuning procedure
is dump the array to a PC and load it into a spreadsheet
program. Edit as needed and ship it back through the
USB to the EFI computer. The next guy that builds
a EFI computer like this will have a head start.
Eventually we will accumulate a bunch of tables that people
can try when they are starting up for the first time.
CLS

OPEN "mix-tab.bas" FOR OUTPUT AS #1
FOR x = 1 TO 10
    FOR y = 1 TO 10
        y$ = STR$(y)
        x$ = STR$(x)
        n1 = 30
        num$ = STR$(n1)
        PRINT #1, "A(";
        PRINT #1, x$;
        PRINT #1, ",";
        PRINT #1, y$;
        PRINT #1, ") =";
        PRINT #1, num$
    NEXT y
NEXT x
CLOSE 1
END

Small sample of the output. 100 of these total.
A( 1, 1) = 30
A( 1, 2) = 30
A( 1, 3) = 30
A( 1, 4) = 30
A( 1, 5) = 30
A( 1, 6) = 30
A( 1, 7) = 30
A( 1, 8) = 30
A( 1, 9) = 30
A( 1, 10) = 30
A( 2, 1) = 30
A( 2, 2) = 30
A( 2, 3) = 30
A( 2, 4) = 30

This gets loaded into the program in the init area.


To read the array.

Inj-width = A(RPM,MAF)

Super simple. Temperature is compensated
automatically by hot wire mass airflow sensor.

Paul Lamar


-- 
The Rotary Engine News Letter. Powered by Linux.
ACRE NL web site. http://www.rotaryeng.net
You Tube http://tinyurl.com/beqqxas
Copyright 1998-2013 All world wide rights reserved.