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

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 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   'HD file
FOR x = 1 TO 50
    y = 1        'x and y are integers
    y$ = STR$(y)  'convert to ASC strings
    x$ = STR$(x)  'required for spread sheets
    n1 = 30
    num$ = STR$(n1)
    PRINT #1, "A(";
    PRINT #1, x$;
    PRINT #1, ",";
    PRINT #1, y$;
    PRINT #1, ")";
    PRINT #1, num$   'print 30
NEXT x
FOR y = 1 TO 50
    x = 1
    y$ = STR$(y)
    x$ = STR$(x)
    n1 = 30       'initial value
    num$ = STR$(n1)
    PRINT #1, "A(";  'the semi colon tells print to print
    PRINT #1, x$;    'the next one right after the last
    PRINT #1, ",";   'one.
    PRINT #1, y$;
    PRINT #1, ")";
    PRINT #1, num$   'no semi colon so a carriage return
....................'will be "printed".
NEXT y
CLOSE 1  'close the file on the HD.
END

Small sample of the output. 100 of these total.
A( 1, 1) 30
A( 2, 1) 30
A( 3, 1) 30
A( 4, 1) 30
A( 5, 1) 30
A( 6, 1) 30
This gets loaded into the program in the init area.


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.