Subaru Knock Control Strategy

Technical discussions
Post Reply
User avatar
duncan
Posts: 10897
Joined: Thu Jul 27, 2006 3:12 pm
Location: On the podium
Contact:

Subaru Knock Control Strategy

Post by duncan »

copied from Enginuity...

It may be of interest to someone but mainly copied here to bookmark it for me :)
This post will attempt to explain, in detail, how the knock control strategy works for the 16bit ecus. Current tables available in Enginuity will be identified and those that could be added in a future ecu definition release will be indicated by an asterisk (*). The example values given are based on a usdm 02 wrx.

TIMING BASICS

Timing is determined by the ecu as follows:

Total Timing = Base Timing + Knock Correction + Other timing compensations

Other timing compensation = 'Timing Compensation (Coolant Temp) and (Intake Temp)' among others.

Knock Correction = (Timing Advance Max * (IAM/16)) + feedback correction + fine correction learning

From the formula above, you can see that Knock Correction (KC) consists of three elements. How these values are determined and how they interact with one another will be discussed below.

Although exactly how the ecu decides what noise from the knock sensor is knock or not is not fully understood currently, the result is quite simple. The knock signal is either set or clear. That it, as far as the ecu is concerned, there either is knock or there isn't. There's no level of severity that is stored.

FEEDBACK CORRECTION

Feedback correction, as applied, is always either zero or negative. It is best to think of this as temporary correction when knock is present. It is active when engine speed and load are within the ranges specified by the 'Feedback Correction Range' tables. If in range, the ecu looks at the knock signal. If set (i.e. knock), the feedback correction value is decreased by about 2 degrees(*). Each time this portion of the code is executed, 2 degrees will be removed if the knock signal is still set, up to a limit of about -11 degrees(*). However, if feedback correction is negative and the knock signal is then clear (i.e. no knock), feedback correction does not immediately become zero. Instead, there is a delay(*) in which the current correction remains until the knock signal is clear and no negative feedback corrections are made over the delay period. If so, feedback correction is increased by ~1 degree(*) and the feedback delay counter is reset. This process continues and feedback correction will eventually become zero as long as the delay period is satisfied enough times to increment the correction back to zero. Of course, "delay" is in the terms of the ecu, so this all happens very rapidly.

ROUGH CORRECTION

Rough correction involves manipulating the IAM (ignition advance multiplier) due to knock. This has the result of correcting timing advance across the board (timing advance * IAM/16). The IAM can range between 0-16.

The ECU has two modes of operation - rough correction or fine correction learning (feedback correction is always active if its requirements are met). That is, the ECU is either poised to possibly make corrections to the IAM (rough correction) or to possibly make changes to the fine correction learning table (described later), but not both at the same time. But, just because the ECU is in either of these modes, does not mean changes to IAM or the fine correction table will be made. Therefore, there are two sets of thresholds for each mode. One set determines when to switch between modes (different depending on original mode) and another set to determine whether changes to IAM or the fine correction table will be made in their respective modes. NOTE: After an ecu reset, the ecu defaults to the rough correction mode.

To exit from fine correction mode to rough correction (IAM) mode, the following requirements must be met:
1. Engine speed and load must be within the ranges specified by the 'Rough Correction Range' tables.
2. Timing advance (max) map value is greater than 4.9(*) degrees.
3. Some fine correction value change (positive or negative) occured last execution.
4. The last fine correction value (|x|) is greater than 3.9(*) degrees (that is, the absolute correction -> ex. -4 = 4)
5. The last fine correction raw difference (|y| * 2.84) is greater than last timing advance (max) map value.
6. (IAM > 1) or (IAM <= 1 and last fine correction was positive).

Once in rough correction mode, the following requirements must be met each time in order to make any change to the IAM. That is, even though the ecu is in rough correction mode, it will not always be adjusting the IAM:
1. Current timing advance (max) > 3.9(*) degrees.
2. Limp-home mode not active (IAM would already be 0 in this case)
3. No feedback correction made this execution.
4. IAM step value > 1 (explained below)

If these are met, the following will occur, however, only after switching between the fine correction mode to the rough correction mode. That is, these will only be executed once each time the switch to the rough correction mode from fine correction mode occurs and right before a change to the IAM is going to occur:
1. IAM is set to the 'Advance Multiplier (Initial)' value
2. IAM step value is set to 4(* described below)
3. IAM learning delay counter set to 0 (explained below)
4. The entire fine correction learning table in ram is cleared.

The knock signal is checked. If clear (i.e. no knock):
1. The IAM learning delay counter is checked. If the current value is less than the delay target specified by the 'Advance Multiplier Learning Delay (Increasing)' table then the counter is incremented (similar to the delay for feedback correction). When the current value is greater than the delay target, then the IAM is increased. On the first run through, IAM is always advanced by 4 (initial IAM step value). It remains 4 as long as it is keeps increasing the IAM (up to 16). However, if during the last execution IAM was decreased, the IAM step value is reduced by 1/2. This occurs each time the IAM flip-flops. When the IAM step value drops down to 0 or 1, the rough correction mode ends and the ecu switches to fine correction mode. Basically, this is the way the ecu determines that the IAM has settled.

If the knock signal is set (i.e. knock):
1. There is no delay for decreasing the IAM. However the counter value is cleared because knock was detected.
2. Other than no delay, the rest of the logic is basically the same as when IAM is increasing except that IAM is decreased.

In addition, when IAM is 0 or 16, after a slight delay(*) of remaining at these extremes, the ecu will switch to fine correction mode regardless if the step value is 0 or 1. This would be necessary if there was not enough "settling" before reaching these extremes to exit the rough correction mode.

Note, that when the IAM has finally "settled", the ecu will switch from rough correction mode to fine correction mode. Fine correction mode will continue until the mode switch conditions listed at the beginning of this section are met again.

FINE CORRECTION LEARNING

Fine correction learning allows for positive or negative correction to KC based on knock. These values are stored in ram and are applied across specific load and rpm ranges. The ecu determines these ranges based on the 'Fine Correction Rows (RPM)' and 'Fine Correction Columns (Load)' tables. Although these tables consist of 7 values each, the ranges make up an 8x8 3d table. For example:

If your 'Fine Correction Rows (RPM)' table was:
1400,1800,2600,3400,4200,5000,6000 - the ranges would be as follows:
Range 1: less than 1400
Range 2: 1400 to less than 1800
Range 3: 1800 to less than 2600
Range 4: 2600 to less than 3400
Range 5: 3400 to less than 4200
Range 6: 4200 to less than 5000
Range 7: 5000 to less than 6000
Range 8: 6000 +

Fine correction is designed to make "finer" adjustments to timing after IAM has roughly corrected timing advance where there is no knock. Fine corrections are stored in ram and are applied to KC all the time (except for certain conditions like idle). Although the fine correction learning table values in ram are always being applied to KC, adjustments to the table itself can only occur when certain conditions are met:
1. Currently in fine correction mode. The switch from rough correction mode to fine correction mode occurs when the IAM step value <= 1 or IAM is 0 or 16 after a slight delay.
2. Feedback Correction was not made during this execution.
3. Engine speed and load are within the ranges specified by the 'Fine Correction Range' tables.
4. Limp-home mode is not active.

Then, if the knock signal is clear, other conditions must be met to add positive correction to the current fine correction cell in ram:
1. (Feedback correction and/or negative Fine Correction was NOT applied during the last execution)
2. if #1 is true, then the previous fine correction load/rpm range also has to be the same as the last range before this execution.
3. The current fine correction range is the same as the last range.
4. Like the other corrections, there is a delay before which a fine correction value can be increased ('Fine Correction Advance Delay'). This is based on a counter (similar to the feedback correction counter), which is incremented when there is no knock and is cleared when fine correction table adjustments are made or the knock signal is set.

If the above are met, then the fine correction value for the current load/rpm is increased. However, it cannot be increased if current timing advance + fine correction is greater than the current value in the timing advance (max) map. This also means that if IAM is 16, only negative fine corrections are allowed. Each increment of fine correction is .35 degrees ('Fine Correction Advance Step Value'). Maximum allowable correction is 8 degrees(*).

If the knock signal is set:
1. Fine correction in the current cell is decreased by about 1 degree (2d table referenced by rpm*) with a limit of about 12 degrees(*).

NOTE: After switching from fine correction mode to rough correction mode and right before the first change to IAM after switching to that mode, the entire fine correction table is cleared and no corrections to the table are made until the ecu switches to the fine correction mode (although the current fine correction table is applied regardless except at idle and certain sensor failures).
FAQ

Q: Do the 32bit ecus use the same logic?

I haven't analyzed the 32bit ecus in as much detail as I have done here. From what I have looked at, the generalities are the same. When I look more closely at the specifics, I'll be sure to update this thread.

Q: Whenever IAM is re-evaluated, you said that IAM is set to the value in the 'Advance Multiplier (Initial)' table, even without an ecu reset. I've never seen this in my logs. Can you explain why?

When the IAM re-evaluation starts, IAM is always set to this initial value, however this would be almost impossible to catch on a log because the next chunk of code is involved in decreasing/increasing the IAM (with an intial IAM step value of 4). This happens pretty much instantly as far as logging is concerned and it would be very unlikely that you would capture it.

Q: How can I log feedback knock correction, fine learning knock correction or rough correction?

All ecus can log Knock Correction with Enginuity's logger. All supported ecus can log feedback knock correction, fine learning knock correction, base timing and current timing advance by updating your logger definitions to the newest update 0.2b (see downloads).

Q: So, there is no fine or feedback correction to KC above their respective rpm/load ranges?

Not necessarily. Fine correction is applied in ranges. Looking at the rpm example above for 'Fine Correction Rows (RPM)', the stored fine correction value in ram is applied at any rpm 6000+ (and its corresponding load cell). However, a change to the fine correction learning table in ram can only occur within the ranges as specified by the 'Fine Correction Range' tables. If this table has a max value of say, 6200 rpm, then adjustments to the ram table will only be made between 6000-6200 (assuming the same corresponding load), however they will be applied from 6000+ rpm (also assuming the same load).

Also, for feedback correction, if it is negative at the same time you are leaving maximum load or rpm thresholds, the ecu will keep the current feedback correction in play.
Not that it suspends corrections (although it does suspend changes to the fine correction ram values for this brief time period), instead a correction resets the counter. The counter is incremented each execution where the knock signal is clear. There is a mistake in this paragraph (I went ahead and edited it), there are actually 3 separate counters (fine, feedback and rough correction). So, in this case, the "no-knock" counter is incremented each execution where there is no knock and it is reset if the knock signal is set or there was a negative feedback correction in the last execution (normally one in the same, however the counter sub is not executed in this block of code). It is the same for fine correction, except that its counter is cleared when there was a negative fine correction or the knock signal is set.

Here's an example for feedback correction:
1. knock signal is set. Feedback and Fine correction "no-knock" counters are cleared.
2. Negative feedback correction due to knock: -2
3. Next execution: knock signal is still set - more correction: -4, "no-knock" counters cleared.
4. Knock signal is now clear. "no-knock" counters are incremented by 1.
5. Feedback "no-knock" counter is compared against the feedback advance delay value. If it the counter is less than the delay, feedback correction remains at -4.
6. When the counter is incremented enough and exceeds the delay value (due to no knock), feedback correction is advanced by 1 degree (-3). "no-knock" feedback correction counter is reset.
7. The counter is incremented again as long as there is no knock or negative feedback correction. feedback correction is advanced by 1 degree (-2).
8. This continues until feedback correction is zero (assuming no knock and the delay periods are satisfied enough to bring it back to zero).

When feedback correction is not zero, fine correction is disabled to obviously avoid these corrections interferring with one another. IAM can still be re-evaluated even when there is negative feedback correction.

ESL
Posts: 934
Joined: Wed Mar 21, 2007 1:14 pm

Post by ESL »

I only skim read the above, but when the IAM drops to certain key values the ECU will richen areas of the map up and ultimately modulate the boost as well as the ignition retard strategy detailed above. It is a very comprehensive knock control system.

If Spence is around he may enlighten us further as he wrote the disassembler for it and decoded the V1/2 code.

User avatar
duncan
Posts: 10897
Joined: Thu Jul 27, 2006 3:12 pm
Location: On the podium
Contact:

Post by duncan »

It is indeed Andy.

Sprint Chief
Posts: 61
Joined: Fri Mar 23, 2007 2:27 pm
Contact:

Post by Sprint Chief »

Bit busy today (!) so can't read through in too much detail, but it looks virtually identical to the strategy in the 16-bit ECUs (92-98 ). There is a misconception promulgated by armchair pundits on forums like scoobynet that the early knock control is not as good, but this isn't really true; the method is pretty much identical, and the range of control is essentially the same, and programmable. I can see some differences (e.g. the IAM delta starts at 2 on the early cars rather than 4; fine control corrections are -1 and +0.25; although these are changeable parameters).

The feedback section sounds a little different though, that may be my short memory :)

As Andy notes, they have only covered the ignition stuff (which, to be fair, is the most difficult to follow) and not fuelling or boost control (which is simpler, based on IAM thresholds).

I think ECUTEK link to the original patent on their site, which describes the strategy, although this doesn't give specific parameter values etc. However, like most patents, the description isn't designed to be easy to follow like the one above.

Post Reply