PDA

View Full Version : AEM EMS Tutorial Notes



Intropy
07-23-2012, 09:50 AM
Who knows if I'll ever finish the tutorial... it's a lot of work. So I've decided to start dumping my notes. These are going to be dense and not organized for easy consumption, but you might find them useful. Let me know if you notice any errors or something isn't clear.

Timing Basics

We start with some basic facts about the 6G72:

4-stroke - 720° in a full engine cycle.
6 cylinder - 120° between cylinders (720° / 6 = 120°).
Waste spark ignition - paired cylinders are 360° out of phase (1&4, 2&5, 3&6).


The cam and crank sensors (either the 1st gen CAS or 2nd gen Hall effect sensors) are the most important inputs and the basis of all timing. As Jeff's notes (Stealth 316 - 3S Ignition System (http://www.stealth316.com/2-ignitionsystem.htm)) show, these provide two square wave signals to the EMS. The rising and falling edges are used as reference points for timing calculations.

Take a look at this chart. It shows how these signals correspond to the engine cycle and each cylinder's individual strokes:

http://i440.photobucket.com/albums/qq124/intropy/AEM/ignctrl_distr-1.jpg

Syncing Up

The first thing we're interested in is how the EMS synchronizes itself with these signals. Jeff says,


If the TDCS signal is high when the CAS goes from low to high, the ECU knows that cylinders 2 and 5 are in either the compression or exhaust stroke. When the CAS then goes from high to low, the ECU uses this as a reference to turn power transistor "B" off to produce sparks in cylinders 2 and 5. If the TDCS is still high at this time the ECU also knows that cylinder 1 was near TDC and is currently on the combustion stroke, and that it was cylinder 2 that was on the compression stroke.

If the TDCS signal is low when the CAS goes from low to high, the ECU waits until the CAS signal goes from high to low to determine which of the other two cylinder pairs should be fired. When the CAS signal goes from high to low and the TDCS is high, then cylinders 3 and 6 are in either the compression or exhaust stroke. If instead the TDCS is low, then cylinders 1 and 4 are in either the compression or exhaust stroke. In each case, the ECU uses this (the CAS signal going from high top low) as a reference to turn the appropriate power transistor off ("A" for cylinders 1 and 4 or "C" for cylinders 3 and 6) to produce sparks in the cylinder pair.

I don't know if this is actually how the stock ECU works (maybe the flashable ECU guys can tell us) but it is NOT how the EMS works.

Being a generalized ECU for multiple platforms, the EMS has multiple sync strategies. The one used on a 3S is called Sync Crank S Count. It is extremely simple - it watches for a particular number (Sync Teeth: 4) of crank "teeth" (both rising and falling edges, Crank Falling Edge: ON, Crank Rising Edge: ON) to pass between cam "teeth" (falling edges only, Cam(T2) Falling Edge: ON, Cam(T2) Rising Edge: OFF).

I want to take the previous diagram and make it a bit more intuitive. First, all the events are listed in degrees BTDC of the following cylinder. Instead, let's think about a full 720° engine cycle, starting at TDC of the #1 cylinder. Here are the cam and crank signals with each edge's degree in the cycle:

http://i440.photobucket.com/albums/qq124/intropy/AEM/camcrank-03.png

Let's drop the cam rising edges (Cam(T2) Rising Edge: OFF). This represents the significant events as seen by the EMS:

http://i440.photobucket.com/albums/qq124/intropy/AEM/ccnor-03.png

Notice that between the cam edges at 550° and 70°, there are 4 crank edges. This is the ONLY time this occurs in the 720° cycle, and is what the EMS uses as its sync signal. This is very important - the EMS considers the passage of 4 crank signals between cam signals to be the sync event, and synchronizes on the following crank edge at 115°. This won't make much sense yet, but 115° is the tooth reset point for the 3S.

How the EMS "Counts"

Remember that the rising crank edge at 115° (5° BTDC #2) is the reset point. The EMS keeps an internal counter called A Tooth that counts the number of crank teeth seen since the reset point. At that point, it is reset to 0.

http://i440.photobucket.com/albums/qq124/intropy/AEM/atooth-02.png

Just remember that for A Tooth, 1 crank signal edge = 1 tooth.

Now, the EMS must convert A Tooth into an even pattern of six (Spark Teeth: 6, Fuel Teeth: 6) for use as injection / ignition timing references. These are counted in Fuel Tooth and Ign Tooth, based on A Tooth and configured via the table Crank Tooth Control.

http://i440.photobucket.com/albums/qq124/intropy/AEM/cranktoothcontrol_table.png

It's not necessary to cover every function, but in short they are:

Value Function
0 Do nothing.
1 Process significant edge.
2 Process alternative edge, used for crank firing.
3 Force reset of A_Tooth, if loss of sync.
4 Test for synchronisation
5 Process significant edge and Test for synchronisation.
6 Process alternative edge and Test for synchronisation.
7 Reserved

All you really need to worry about is function 5, which increments Fuel/Ign Tooth, and function 3, which forces a reset (we should never get to A Tooth: 12). In layman's terms: when we hit a crank edge, if the current A Tooth value is 0, 2, 4, 6, 8, or 10, increment Fuel/Ign Tooth.

http://i440.photobucket.com/albums/qq124/intropy/AEM/teeth-04-1.png

:poke: TODO: Actually explain how the sync happens. Cam Tooth, S Tooth, S Sync Tooth. Sync Early. Stat Cranking, Stat Sync. Crank Alt Options.

Intropy
07-23-2012, 09:50 AM
So here's the complete picture:

http://i440.photobucket.com/albums/qq124/intropy/AEM/timing-01.png

Injector Phasing

Once you get this, some spooky options make sense. We like to think of "0" as TDC #1, but as far as the EMS is concerned, "0" is 115°, or 5° BTDC #2.

Injector firing order and timing is determined by the Injector Tooth X options. These correspond to the Fuel Tooth values depicted above. E.g., if Injector Tooth 1 = 0 as it does in the basemap, we are saying that we want to fire injector #1 when Fuel Tooth = 0 at 165°.

Obviously, this is wrong. Injector #1 needs to fire much later when Cylinder #1 is in its intake stroke, around 4XX°. The other injectors will be off as well. So we need to retard all the injectors using the Injector Phasing option. In the basemap, this is set to 5 teeth, or 5 * 120° = 600° (remember 1 tooth = 120°). But that would mean Inj #1 opens at 165° + 600° = 765° (45°), which is still wrong!

This is where AEM engineers made a decision that I don't really understand, but it is what it is and once you know about it, it's not a problem. There is also the Injector Advance map, which tells the EMS how much additional advance is required at higher RPMs. In the basemap, it is set to 0° at 0 RPM and increases from there. The maximum advance is 357°.

The weird thing is that this value does not behave exactly like you might expect. First, it is injector "advance" so it is the opposite of injector phasing - higher values are more advanced, lower values are more retarded (heh heh). Furthermore, to fire Inj #1 at 45° like we thought, Injector Advance would need to equal 357°. If it is 0°, you need to add (retard) 357° to the Injector Phasing. So in this case, Injector #1 opens at 165° + 600° + 357° = 402°, which is thankfully where we want it.

Why did they do it this way? I'm not really sure. Just remember it like this: If...
Injector Tooth 1 = 0, and
Injector Phasing = 0, and
Injector Advance = 357, then Injector #1 fires exactly at 165° when Fuel Tooth = 0.

Read more here: Injector Phasing Information (http://forum.aempower.com/forum/index.php/topic,10624.0.html)

Intropy
07-23-2012, 09:53 PM
A Quick Illustration

Here's a screen from AEMData showing this in action.

http://i440.photobucket.com/albums/qq124/intropy/AEM/teeth.png

You can see that A Tooth is counted and filtered to Fuel Tooth. Also displayed is Fuel Inj 1 Open, which is the location (in teeth) of the injector 1 event. It is about 1.84 or approximately 386° = 165° + (5 * 120°) + 340° (the 340° comes from the Injector Advance table which is not pictured but is 17° at this RPM, so add 357° - 17° = 340°).

Do I really need to know all this?

Nope. To actually tune injector phasing, it's really easiest to just log the Fuel Inj X Open channels and do it by feel. But you could do some really crazy things with this information, like changing your trigger wheels or syncing to valve events.

J. Fast
07-24-2012, 12:46 AM
Anyone seen my Etch-A-Sketch? I need to get this!

Intropy
07-24-2012, 03:22 PM
Thanks, I need a wiki so other people can edit it.

Intropy
07-25-2012, 03:50 AM
Ignition Timing

Spark timing works just like injector timing, with only a few minor differences.

First, notice that Ign Tooth and Fuel Tooth are not the same. Ign Tooth's "0" point is at 45°. Don't think too hard about this right now, just accept it as brute fact.

Just like injector order and timing is determined by the Inj Tooth X options, coil order and timing is set in the Ign Tooth X options. They are listed here under "Coil Phasing":

http://i440.photobucket.com/albums/qq124/intropy/AEM/coils.png

You'll notice a few things are different. First, they are not even values like the Inj Tooth options. That may seem a little weird, but remember that 1 tooth = 120°, so it's completely fine to have fractions of a tooth.

The next thing you'll notice is because this is a waste spark ignition, we have paired coils 1 & 1B, 2 & 2B, and 3 & 3B. These are the same, i.e. 1 & 1B are both "Coil 1" and drive the same output, just at different times. As you would expect, the firing order is 1 - 2 - 3 - 1 - 2 - 3, corresponding to cylinders 1-6.

Again, we have a global phasing option like Injector Phasing, which in this case is Ignition Sync. This is the option you adjust when you run the Ignition Timing Setup Wizard.

Finally, we have the oh-so-familiar Ignition Map, which adjusts the timing relative to engine speed and load. The same odd behavior that applies to the Injector Advance map applies here. The maximum value is 72.6° of advance, so if this table is 0°, you need to add (retard) the spark timing by 72.6° when doing your calculations.

Intropy
07-25-2012, 04:09 AM
An Example

So here's a real example from AEMData showing that this is all true:

http://i440.photobucket.com/albums/qq124/intropy/AEM/ign.png

You can see that the car is basically idling (1000 RPM) and so the "timing" that we're all familiar with (Ign Timing) is 14.641°. In this state, Ign 1 Firing Loc is 5.26953 teeth. That number is the sum of the Ignition Sync option (3.652 in the base map) and the Ign Tooth 1 option (1.141 as seen above), along with the weird calculation based on the timing (72.6° - 14.641° / 120°) = .48299 teeth:

3.652 + 1.141 + .48299 =~ 5.27

Intropy
07-25-2012, 04:13 AM
:poke: TODO: 72.6° is not a hard max, can be chaged. Maybe talk about this.

Intropy
07-25-2012, 08:31 AM
This was a good question so answering publicly:


If i'm reading the aem forum post correctly, does the injector phasing automatically start off retarded 357 degrees? And ign retarded 72.6 degrees?

I'm not sure I would say "automatically", but yes, if Injector Advance = 0 and your Ignition Timing is 0°, then you would need to add 357° and 72.6° respectively.

The formula in fuel teeth is:
Fuel Inj X Open = Inj Tooth X + Inj Phasing + ((357° - Inj Advance) / (720° / Fuel Teeth))

Or in degrees of the engine cycle:
165° + (Inj Phasing / 6 * 720°) + (357° - Inj Advance)


AEM Does it this way...?

Injector Tooth 1 = 0, and
Injector Phasing = 5, and
Injector Advance(idle) = 0, then Injector #1 fires exactly at 402° when Fuel Tooth = 0

Would the same function occur if it were like this?

Injector Tooth 1 = 0, and
Injector Phasing = 0, and
Injector Advance = 120, then Injector #1 fires exactly at 402° when Fuel Tooth = 0


Yes, you've got it. Except that fuel tooth does not equal 0 at that time, it equals 1.

Just to do the work explicitly for anyone following along...


Injector Tooth 1 = 0, and
Injector Phasing = 5, and
Injector Advance(idle) = 0, then Injector #1 fires at 402° (Fuel Tooth = 1 at this time)

Formulas:
Fuel Inj X Open = Inj Tooth X + Inj Phasing + ((357° - Inj Advance) / (720° / Fuel Teeth))
Degrees in cycle = 165° + (Inj Phasing / 6 * 720°) + (357° - Inj Advance)

Fuel Inj 1 Open = 0 + 5 + ((357° - 0) / (720° / 6))
= 0 + 5 + 2.975
= 7.975
-6 (minus 6 to get us back in range)
= 1.975

So Fuel Tooth is 1 at this time, about to change to 2.

In degrees...
165° + (5 / 6 * 720°) + (357° - 0) = 1122°
-720 (minus 720° to get back in range)
= 402°

Or...
165° + 1.975 * 120° = 402°


Injector Tooth 1 = 0, and
Injector Phasing = 0, and
Injector Advance = 120, then Injector #1 fires at 402° (Fuel Tooth = 1 at this time)

Fuel Inj 1 Open = 0 + 0 + ((357° - 120°) / (720° / 6))
= 0 + 0 + 1.975
= 1.975

In degrees...
165° + (0 / 6 * 720°) + (357° - 120°) = 402°

Or...
165° + 1.975 * 120° = 402°

These are all equivalent.

Intropy
07-26-2012, 06:01 PM
:poke: TODO: this doesn't belong here but posting it before I forget

AIT correction

To the extent that it's possible, you want to tune your fuel map at a known, constant intake air temp. Keep in mind that with speed density you are estimating air intake from pressure and temperature. From the ideal gas law, you are estimating n from a known V and R and measured P and T:

n = (PV)/(RT)

If you tune parts of your map at different temps, your map will be off. Let's say you tune at temp T0, and now the temp is T1. Think about the relationship of n0 and n1 where:

n0 = (PV) / (R T0)
n1 = (PV) / (R T1)

From this you can derive:

n1 = (T0 / T1) n0

So if T0 is your reference temperature and T1 is your measured temp, n0 must be multiplied by the ratio (T0/T1).

In terms of the EMS, the table for this correction is Air Temp Fuel Trim. Because the values in this table are percentages, our ratio (T0/T1) needs to be multiplied by 100. E.g.,

.5 * 100 = 50 (%)

But wait, we're talking about a correction. In other words, if T0=T1, then T0/T1 * 100 = 100 (%). But if T0=T1, our correction should be 0%. So we just subtract 100 to yield the formula:

Correction(T1) = ((T0/T1) * 100) - 100

So if you tuned your map at 60 degrees F (288.7 K) and now it is 50 degrees F (283.2 K), theoretically you need a correction of approximately:

((288.7/283.2) * 100) - 100 = 1.94 %

Intropy
07-27-2012, 03:50 AM
Another question:


I just bypassed my resistor pack and noticed in the wizard they have injectors listed with <P&H DRIVER> and then the rest just have their brand/model, high or low impedance. Is there a setting that tells the driver to operate as P&H or saturated? Or does it only operate as P&H? It lists the stock 3000gt injectors as 3ohm. I assume any low imp injector listed without the prefix <P&H DRIVER> was tested with a resistor pack inline to produce battery offset numbers that were meant for use in the series 1 box with its saturated driver...?

Injector Latency / Battery Offset Primary / Injector Drivers (Peak & Hold)

The driver on the EMS is always peak & hold. Deleting the resistor pack lets you take advantage of this. Yep, any injector listed in the setup wizard that is not prefixed with <P&H Driver> is intended for use with the resistor pack. If you delete it, you'll want to choose the closest P&H driver.

Now that being said... unless you are just lucky enough to be running one of the 10 or so injectors listed in the wizard, you're going to need to be critical of the values. Remember that with P&H, the resistors are gone and the EMS supplies full battery voltage to the injector until the desired current level is reached, at which point it backs down. This is obviously going to change the way the injector responds at different battery voltages and thus require a change to the Batt Offset Primary table. When you select a P&H injector in the wizard, that table is the ONLY thing you are changing (well, and Inj Size, which is only used by wizards). So the question is really how to make sure your offset values are right. You have 4 options:


Use a value published online, if available.
Get AEM's approval to mail your injectors to them for testing. They'll give you an offset table.
Pay someone to do it.
Do it experimentally.


I don't recommend option 4, but if you're just trying to get a car running and tuned, what you want to check is that changes to your fuel map behave as expected.

Batt Offset Primary adds a duration (observable in the channel Fuel Trim Bat-Pri, in mS) to your injector pulse for a given voltage. Let's say that the correct pulse for a given RPM, load, and desired AFR is 4ms (observable in Fuel Inj 1 Pulse). You're at 14v and the Batt Offset Primary table is 0.5ms at 14v. This means it is adding 0.5ms to your pulse. If it was 0, your pulse would be 3.5ms.

In order to know if that's right, you obviously need another data point. Say our AFR in the above example was 13.2. Let's try to make it 12. So we need to remove 9.1% in that cell (12 / 13.2 = .909). You can do this easily by choosing that cell in AEMTuner and pressing 'E', then '-9.1', 'Enter' (or AEMPro style, you enter 90.9).

If you don't get the desired AFR, you need to adjust Batt Offset Primary (and your fuel map) until you do. When you get predictable results from changing your fuel map at various locations, you know you're close. Obviously, this can only be done with any sort of precision on a dyno, and you can really only do it for the operating voltage ranges of your car.

Intropy
08-07-2012, 05:26 PM
A question.


I want to hook up a switch to activate logging. I'd like to use my cruise control switch. There is a wire that is 12v switched on. Can I attach that 12v to a lowside(ground switched) input? I assume I would need to put a small resistor on that line to act as load? Or am I doing it wrong? The other way I was thinking was using that 12v source to activate a relay that is just connected to ground on one end and switch input on the ems.

I can't remember how the cruise control switch is wired but you can certainly use it. One side must go to ground. The other side will be wired to one of the AEM's high side switch pins, such as switch 5 (pin 107/37) or switch 6 (pin 114/44). Then select that as your switch input in the ECU Internal Logging setup screen. No resistor necessary.

The way AEM lists switch input options is a little confusing - it will be either:

GND=ON - this is the "normal" option, which means that the software switch is on when the hardware switch is closed.
12V=ON - the opposite: the software switch is on when the hardware switch is open ("floating").

Memphetic
12-21-2012, 12:35 AM
Thanks, I need a wiki so other people can edit it.

You can put this on my wiki. FrozenApps Wiki (http://www.frozenapps.com/appwiki)

SpikeyGG
06-09-2014, 10:31 PM
Intropy, this is an awesome thread. Thanks for posting it so long ago. I made a post on 3SI about a month ago asking for these types of details, one guy responded. He basically said: "don't ask here because no one knows." Anyway, I wanted to thank you because it gives me some idea of which cylinder I see as knocking -- very useful thread.