View unanswered posts | View active topics It is currently Thu Mar 30, 2017 11:53 am



Reply to topic  [ 14 posts ]  Go to page 1, 2  Next
Configuring Your Settings! 
Author Message
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
This thread is currently a draft, but will contain a reasonably up to date set of instructions on how to configure everything in a new FreeEMS install when complete. Completed or reasonably complete sections shall have a bold underlined heading and will extend to the end of a post or to the next bold or underlined heading, just like the rest of my documentation posts.

Draft index of posts:

  • Transfer Tables
  • Fixed Configuration
  • More Fixed Configuration
  • Output Scheduling
  • Live Tunable Items
  • More Live Tunable Items
  • Lambda Table
  • VE Table
  • Injection Timing
  • Ignition Timing

Random notes for the author:

hw = xor polarity, low z/high z, pullups/grounds/RPM connections
eng = injector, cylinder size, count, IDT, ETE, base timing, base VE
out = angles, limits, numbers - hand verified to not be out of range, no init checking yet

EDIT:

I wrote this out for a friend the other day:

(08:24:57) Fred: https://github.com/fredcooke/freeems-vanilla/
(08:27:11) Fred: git clone https://github.com/fredcooke/freeems-vanilla.git
(08:35:10) Fred: cd freeems-vanilla/src/main/initialisers/
(08:40:28) Fred: These are important: FixedConfig1.c, FixedConfig2.c, FuelTables.c, TimingTables.c, TunableConfig.c
(08:40:28) Fred: These need to be right, too: CHTTransferTable.c, IATTransferTable.c
(08:40:28) Fred: These are unused: MAFTransferTable.c, TestTransferTable.c, TimingTables2.c, TunableConfig2.c, FuelTables2.c
(08:41:56) Fred: src/main/data/
(08:42:11) Fred: src/main/data/thermistors/
(08:42:26) Fred: src/main/data/tables/
(08:46:45) Fred: src/main/inc/systemConfig.h < add yourself to this file
<and the two below, also>
(08:47:14) Fred: bin/testclibuilds.bash
(08:47:51) Fred: Makefile
<edit things making changes and get them into git in the following fashion>
(08:51:47) Fred: git add <files>
(08:52:09) Fred: git status
(08:52:38) Fred: git commit
(08:53:19) Fred: git log
(08:54:36) Fred: create and add ssh key
(08:54:41) Fred: to github
<fork the project on github, then>
(08:55:45) Fred: git remote set-url origin git@github.com:yourusername/freeems-vanilla.git
(08:55:55) Fred: git push

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Sat Mar 12, 2011 3:48 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
The Four Transfer Tables

Currently there are four transfer tables in FreeEMS, all are 1024 entries long and 16 bit unsigned per entry. They are named and used as follows below:

  • IAT - Essential
  • CHT - Essential
  • MAT - Unused at this time.
  • Test - Unused at this time.

The values within these lookup tables are obtained from mathematical processing of data points from measuring a real sensor (yourself or the manufacturer, via a data sheet). The firmware comes with a prebuilt library of common combinations which can be easily selected in the code base. The library contains all combinations of the three common sensor types and six common bias values, as listed below:

  • BoschM12H-2k0Bias.h
  • BoschM12H-2k2Bias.h
  • BoschM12H-2k49Bias.h
  • BoschM12H-2k4Bias.h
  • BoschM12H-2k6Bias.h
  • BoschM12H-2k7Bias.h
  • Denso-2k0Bias.h
  • Denso-2k2Bias.h
  • Denso-2k49Bias.h
  • Denso-2k4Bias.h
  • Denso-2k6Bias.h
  • Denso-2k7Bias.h
  • GM-2k0Bias.h
  • GM-2k2Bias.h
  • GM-2k49Bias.h
  • GM-2k4Bias.h
  • GM-2k6Bias.h
  • GM-2k7Bias.h

Additionally, if you require something not listed, these can be configured in a custom way with a number of tools. Notably, FreeTherm can generate output suitable for dropping directly into the code base when provided with just three temperature-resistance pairs and one bias resistor value.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Nov 04, 2011 6:48 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
Fixed Flash-Only Configuration Parameters

FixedConfig1.c:

Code:
        engineSettings:{
                perCylinderVolume:  cylinderSize500cc,
                injectorFlow:       injector550cc,
                stoichiometricAFR:  stoichiometricAFRGasoline,
                densityOfFuelAtSTP: densityOfPetrol

        serialSettings:{
                baudDivisor:        divisorFor115200bps

        tachoSettings:{
                tachoTickFactor:    tachoTickFactor4at50,
                tachoTotalFactor:   tachoTotalFactor4at50

        coreSettingsA:          0x07F0,
        userTextField:  "whatever"


FixedConfig2.c

Code:
        sensorPresets:{
                presetIAT:  roomTemperature,
                presetCHT:  runningTemperature,
                presetTPS:  halfThrottle,
                presetEGO:  stoichiometricLambda,
                presetBRV:  runningVoltage,
                presetMAP:  idleManifoldPressure,
                presetAAP:  seaLevelKPa,
                presetMAT:  roomTemperature,
                presetEGO2: stoichiometricLambda,
                presetIAP:  maxExpectedBoost,
                presetBPW:  idlePulseWidth,
                presetAF:   idleAirFlow
        },
        sensorRanges:{
                TPSClosedMAP:  offIdleMAP,
                TPSOpenMAP:    nearlyWOTMAP,// MAP Sensor Configuration
                MAPMinimum:    MPX4250AMin,
                MAPRange:      MPX4250ARange,#endif
                AAPMinimum:    HondaDenso183kPaMin,
                AAPRange:      HondaDenso183kPaRange,
                EGOMinimum:    AFR1020LambdaMin,
                EGORange:      AFR1020LambdaRange,
                BRVMinimum:    batteryVoltageMin,
                BRVRange:      batteryVoltageRange,
                TPSMinimumADC: TPSDefaultMin,
                TPSMaximumADC: TPSDefaultMax
        },
        sensorSettings:{ // Warning, until the following mods are made to ADC use, setting this lower than your cranking rpm will result in a pulsing fuel pump.
                readingTimeout: 250, /** Default to 0.25 of a second 120rpm for a 4 cylinder @todo TODO new method of ADC sampling, Always sample ADC async, If no sync, use async ADC readings, otherwise use synced. Do this with pointer to array set at beginning of math */
        },
        decoderSettings:{
                // Should macro these, 45.00,50.00 and 100.00 are percentages
                accelerationInputEventTimeTolerance: ((100/(100 + 50.00)) * 1000),
                decelerationInputEventTimeTolerance: (((100 + 50.00)/100) * 1000)
        userTextField2:  "whatever2"


Calibrating Your Battery Voltage Reading

Due the fact that even 1% tolerance resistors can cause a +/- 0.25V difference from correct (with 5% much worse at +/- 1.2V!!!) I recommend that you check your BRV figure and battery Voltage with a good meter and calibrate this input. Use the formula below to accomplish this:

Code:
VoltageForYourConfiguration = (VoltageDisplayedInMTX / VoltageMeasuredAtInputPin) * VoltageInConfiguration

Note, if you're using a TA card based setup, be sure to check the errata thread and make the necessary adjustments!

Worst case reading values for a 5% resistor setup with default config and default resistor nominal values and a true Voltage level of 14.4V is 15.9157895 on the high side and 13.0285714 on the low side. If you're seeing outside that, something is probably wrong with your circuit or you forgot to fix your TA card.

http://www.google.com/search?hl=en&safe ... 0.9.6l15l0
http://www.google.com/search?hl=en&safe ... 0l0l0ll0l0

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Nov 04, 2011 6:50 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
Output Scheduling Configuration

Code:
anglesOfTDC[0] =   0 * oneDegree; // Cylinder 1
outputEventPinNumbers[0] = 0;
#define cliConfigredNumberOfIgnitionEvents 4
#define numberOfInjectionEvents 2
#define firstInjectionEvent 4
#define cliConfiguredOffset (666.00 * oneDegree)
#define numberOfInjectionsPerEngineCycle 1
outputEventInputEventNumbers[4] = 1;
outputEventPinNumbers[4] = 4;

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Nov 04, 2011 6:51 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
Live Tunable Configuration Parameters

TunableConfig.c

Code:
                dwellDesiredVersusVoltageTable: {ARRAY_OF_16_VOLTAGES, LS1COILS_16_DWELLS},
                injectorDeadTimeTable: {ARRAY_OF_16_VOLTAGES, ARRAY_OF_16_DEADTIMES},
                engineTempEnrichmentTablePercent: {ARRAY_OF_16_TEMPS,    ARRAY_OF_16_PERCENTS},
                NOTE: Currently unused small tables cut out for clarity!

                loggingSettings: {
                        datalogStreamType:                    asyncDatalogBasic,
                        datalogPollingType:                   asyncDatalogBasic,
                        basicDatalogLength:                   maxBasicDatalogLength,
                        datalogByteStreamSourceAddress:       (void*)&PTIT,     // Port T state for default
                        datalogWordStreamSourceAddress:       (void*)&ATD0DR4,  // MAP sensor for default
                        datalogLongStreamSourceAddressFirst:  (void*)&PORTS_BA, // Port B and A combined with...
                        datalogLongStreamSourceAddressSecond: (void*)&ATD0DR4,  // ...MAP for default
                },
                perCylinderFuelTrims:          ARRAY_OF_6_FUEL_TRIMS,   /* perCylinderFuelTrims[] */

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Nov 04, 2011 6:52 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
Initial Lambda Table Choice

You should choose an initial lambda table roughly in line with your end expectations for the tune, with a few small exceptions. You should start at the rich end of the spectrum in the full load regions. You should start with nothing leaner than 1.0 lambda. Your idle region should be approximately 1.0, or a hair richer. Once you're up and running with VE well tuned and ignition timing under control, you can move the tune leaner under load and leaner in tune, simply by tweaking this map.

A rough guide to lambda values for petrol (gasoline) engines is as follows:

  • 1.3 approximate max for lean cruise, watch your EGT
  • 1.0 for idle and cruise regions with a cat
  • 0.95 lean end of the full load NA spectrum
  • 0.90 lead end of the full load boosted spectrum
  • 0.85 rich end of the well tuned NA spectrum
  • 0.75 rich end of the well tuned boosted spectrum
  • 0.68 some oems go this low, but you shouldn't

A small selection of suggested initial and typical final lambda maps will be provided at some point, but isn't yet. Please roll your own in line with the guidance provided above.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Nov 04, 2011 6:52 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
Initial Volumetric Efficiency Table

This is a tough one and depends entirely upon your engine and how well, or poorly, as the case may be, that it breaths. Even I don't have a good feel for this yet, however I believe lower numbers are better. Two engines are known to run well on numbers in the order of 30% to 60% at low loads and low RPMs and another in the 50% to 70% range. Thus, in that area, I would likely guess at 50% for a starting value and move away from that based on plug condition and engine behaviour, or if running, the wideband, of course.

For higher RPM and load regions it is recommended that you enter realistic values or overly optimistic values to start with. This effectively forces a rich condition in those areas until they have been tuned which is the safe option. For these areas, I'd suggest 80% to 110%, ramped up to fairly quickly from the lower load/RPM region and then flat to the extremes.

Eventually a map resembling this advice will be added to the code as the default, until then you need to roll your own in line with the above suggestions.

Once you are running your goal is to tune the VE table in order to make the EGO and Lambda figures match. If you don't like the direction that the tune is heading while doing this, and are happy with the way that the engine is running, adjust the lambda AND the VE in opposite directions equally and oppositely to maintain whatever EGO you're currently running with. This should be automate-able in future, though no service or application currently exists to perform this transformation for you. Such a tool would use only three parameters: Current lambda table, Current VE table, Realistic lambda table. This last term means what your lambda table should currently look like. With those three parameters new VE values can be easily generated to match your real working lambda curve.

Automated tuning tools will function in the same fashion with the addition of automatically collecting the EGO data and building your real lambda table for you such that you can then simply adjust the lambda to where you want it without touching the VE curves of the engine, which are fixed anyway (unless you modify it further).

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Nov 04, 2011 6:53 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
Initial Injection Timing Table

This will be provided for you, however it is definitely not critical in most applications and virtually any flat map will work well.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Nov 04, 2011 6:53 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
Initial Ignition Timing Table

This very much depends on the physical setup of the engine, choice of lambda curve and fuel used. Some good rules of thumb are listed here for those new to the game.

  • Idle region should be exactly flat and in the range of 10 to 20 degrees BTDC, with 15 being an excellent default choice and lower numbers more common.
  • 100kPa and near values should be between 28 and 35 degrees BTDC over the threshold RPM, for most engines.
  • Full vacuum values should be equal to or higher than 100kPa values, with maximums as high as 50 to 60 degrees BTDC in some cases.
  • Sub-idle values should be equal to or lower than idle values with exactly TDC being optimal in many cases.
  • Values for full boost should not ever go below 15 degrees BTDC, if you are forced to in order to avoid knock, your physical setup is sub-optimal.
  • Between the upper RPM bound of idle and the threshold RPM after which timing remains more or less flat the timing should ramp up fairly smoothly
  • Between full vacuum and full boost the values should ramp down fairly smoothly.
  • Between zero RPM and the lower RPM bound of idle the values should ramp up fairly smoothly.

Parameters that affect timing are partially listed here:

  • Fuel octane (< = <)
  • Lambda value (< = >)
  • Compression ratio (< = >)
  • Air temperature (< = >)
  • Quench tolerance (< = <)
  • Engine temperature (< = >)
  • Chamber design
  • Spark plug type/style
  • Port and manifold design
  • Injector style and size

(this = timing)
< = less
> = more

The above recommendations are for a final tune. It is recommended that you err on side of caution and run 3 - 10 degrees more retarded than expected in all medium to high load areas until the tune is more mature. A small library of common and conservative ignition timing maps will be provided at some point, but for the time being, please roll your own in line with the above guidelines.

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Nov 04, 2011 6:54 pm
Profile WWW
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14514
Location: Home sweet home!
Spare post with file listing and line numbers:

Conf1: ./initialisers/FixedConfig1.c:55:#ifdef TRUCK
Conf2: ./initialisers/FixedConfig2.c:70:#ifdef HOTEL
sched; ./fuelAndIgnitionCalcs.c:199:#ifdef TRUCK
Tune1: ./initialisers/TunableConfig.c:64:#elif JOSHBROWN
Lambda & VE: ./initialisers/FuelTables.c:56:#ifdef TRUCK
Adv: ./initialisers/TimingTables.c:58:#ifdef TRUCK

_________________
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!


Fri Nov 04, 2011 6:54 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF. ColorizeIt.