Boost Control: Difference between revisions

From B58 Wiki
 
(33 intermediate revisions by the same user not shown)
Line 4: Line 4:
# Figure out the boost target
# Figure out the boost target
# Convert the boost target and error into '''power at the turbine wheel''' (i.e. how hard and fast the turbo should be spinning).
# Convert the boost target and error into '''power at the turbine wheel''' (i.e. how hard and fast the turbo should be spinning).
# Work out the power inherent in the exhaust flow and, thus, how much of that should be ejected through the wastegate.
# Work out the power inherent in the exhaust flow, how much of that needs to go through the turbine and how much should be ejected through the wastegate.
# Work out the wastegate position to achieve that.
# Work out the wastegate position to achieve that.


We note that we are controlling a single variable, the boost, but we have two parameters: the turbine power and the wastegate position with which to affect it. In effect, the turbine power is arbitrary. This makes the problem underconstrained. We will gain an understanding of the turbo control then look at ways to pin this down.
We note that we are controlling a single variable, the boost, but we have two parameters: the turbine power and the wastegate position with which to affect it. In effect, the turbine power is arbitrary. The wastegate position is the value that really matters. This makes the problem underconstrained. We will gain an understanding of the turbo control then finish with the turbo diagnosis function that tries to ensure the two parts of the problem act in concert.


==== !!! WORK IN PROGRESS !!! ====
==== A note on naming and on units ====
 
MHD's XDF files use one set of map names and use g/s as the unit for MAF. BMW's A2L files uses a different set of names and kg/h for MAF. In the context of custom turbos, several important maps are missing from the MHD XDF files which exist to support development of their stock turbo maps. For that reason, this article generally uses the BMW names and units, but there is a bit switching between the two conventions. Finally, the word ''power'' get used a lot in this article. Power always refers to the power of the turbo's compressor and/or turbine wheels (how hard and fast they are spinning). It will '''never''' refer to the power of the engine.


==== Boost setpoint ====
==== Boost setpoint ====


Here, the DME runs through conversions of temperature and pressure quantities to arrive at the target MAF and target boost pressure for the turbo. It also figures out the deviation of the current boost pressure from the target and the target exhaust massflow by summing the air mass flow and the fuel mass flow.
Here, the DME runs through conversions of temperature and pressure quantities to arrive at the target MAF and target boost pressure for the turbo. It also figures out the deviation of the current boost pressure from the target and the target exhaust massflow by summing the air mass flow and the fuel mass flow. The only intervention from a calibration point of view is to increase some limits to allow the calculations to proceed naturally.
 
For the pressure calculation, there are two pressure ratio limiting tables. Both are functions of MAF, one of which also includes temperature. The DME takes the min value from each. There is then a third constant which applies to the boost pressure. Probably the best calibration approach is to lift these out of the way:
 
[[File:Tchsp_p_Req_uw.dot.svg]]
 


There are a number of limits applied...
'''Name: BMWtchsp_rat_p_CmprPmp_T'''


Target massflow and pressure are both lowpass filtered using tables BMWtchsp_fac_FilPRatCmpr_T and BMWtchsp_fac_mf_FilCmprNorm_T. These contain massflow-dependent constant and are configured for stock-like flows of upto 1100 kg/h (about 305 g/s). Consider adjusting for larger turbos. For example:
'''Description''': Upper limit for compressor pressure ratio setpoint.
 
'''Unit info''': kg/h --> -
 
'''Base''':
 
  500  535  600  650  725  800  850  1051
2.576 2.605 2.665 2.710 2.807 2.911 2.958 3.000
 
'''Modified''':
 
  500  535  600  650  725  800  850  1051
4.000 4.000 4.000 4.000 4.000 4.000 4.000 4.000
 
 
The same change can be applied across the temperature dependent limit table (BMWtchsp_rat_p_CmprMax_M).
 
The absolute boost limit, the stock value is 2500 hPa (36psi) which is fine for most situations.
 
'''Name''': BMWtchsp_p_ReqMax_C
 
'''Description''': Maximum target boost pressure
 
'''Units''': hPa
 
'''Base''':
 
2500.000
 
 
The target massflow and pressure are both lowpass filtered using filter constants in tables BMWtchsp_fac_FilPRatCmpr_T and BMWtchsp_fac_mf_FilCmprNorm_T. These are configured for stock-like flows of upto 1100 kg/h (about 305 g/s). Consider adjusting for larger turbos. For example:


'''Name''': BMWtchsp_fac_FilPRatCmpr_T
'''Name''': BMWtchsp_fac_FilPRatCmpr_T
Line 54: Line 91:
     0.120    0.100    0.100    0.020
     0.120    0.100    0.100    0.020


The following limit is applied to to the charge pipe pressure sensor:
'''Name''': BMWtchsp_p_ReqMax_C
'''Description''': Maximum target boost pressure due to diagnosis of the boost pressure sensor
'''Units''': hPa
'''Base''':
2500.000
'''Modified''':
3000.000


 
For an overview of maps and values feeding into the volume flow calculation see below:
Maps feeding into the volume flow calculation are shown in orange below:


[[File:BMW_MOD_TchSp_Volf_10ms.svg]]
[[File:BMW_MOD_TchSp_Volf_10ms.svg]]




Maps feeding into the pressure calculation are shown below:
For maps and values feeding into the pressure calculation see below:


[[File:BMW_MOD_TchSp_P_10ms.svg]]
[[File:BMW_MOD_TchSp_P_10ms.svg]]


==== Power calculation (TchCtr_Pwr) ====
==== Power calculation (TchCtr_Pwr) ====
With setpoints in hand, the DME passes control the ''boost controller''. This is a PID controller which acts to ensure the targets are met.


The first job of the boost controller is to work out how fast and hard is should be spinning the turbo to meet the required boost pressure. As such, (required) boost pressure quantities are converted into (required) power at the turbine wheel (in kW). Likewise boost errors are converted into power errors.
The first job of the boost controller is to work out how fast and hard is should be spinning the turbo to meet the required boost pressure. As such, (required) boost pressure quantities are converted into (required) power at the turbine wheel (in kW). Likewise boost errors are converted into power errors.


We can understand turbine power in terms of torque x rpm just as we can for engine power. As the boost pressure goes up, the air resistance on the compressor wheel also goes up so it needs more torque to keep turning at the same speed. As the engine speed rises and the airflow picks up, we can picture the compressor ''chasing'' the air and so it will have to rotate faster to create the same boost. For this reason, the compressor characteristic (BMWtchctr_pwr_Pctl_M) will tend to rise with pressure and with RPM:
We can understand turbine power in terms of torque x rpm just as we can for engine power. As the boost pressure goes up, the air resistance on the compressor wheel also goes up so it needs more torque to keep turning at the same speed. As the engine speed rises and the airflow picks up, we can picture the compressor ''chasing'' the air and so it will have to rotate faster to create the same boost.
 
===== Feed-forward compressor map =====
 
This intuition is quantified in the ''compressor characteristic map'' (BMWtchctr_pwr_Pctl_M). This provides the power output from the compressor as a function of pressure ratio and MAF:


[[File:Compressor-characteristic.png]]
[[File:Compressor-characteristic.png]]


Note that the boost axis does not have any units because the boost pressure in the chargepipe is divided by the pressure before the turbo. This value is often called boost ''presure ratio''.
''Pressure ratio'' refers to the boost pressure in the chargepipe divided by the pressure before the turbo.


The pressure before the turbo is ambient pressure minus any pressure drop across the air filter. The more air pulled through the filter, the more that filter gets in the way and hence this pressure drop becomes higher as airflow increases.
Initially, the DME uses this map to create a good guess at the required turbine power:
 
===== Feed-forward compressor map =====
Initially, the DME creates a good guess at the required turbine power through a feed-forward map, called the compressor characteristic (BMWtchctr_pwr_Pctl_M). This outputs a feed-forward compressor power.


[[File:Tch-pwr-ff.dot.svg]]
[[File:Tch-pwr-ff.dot.svg]]
Line 100: Line 124:


Note that with different and possibly bigger turbos than stock
Note that with different and possibly bigger turbos than stock
# They will flow more air so the MAF axis might require scaling up. A Pure800 would max out at about 500g/s for example.  
# They will flow more air so the MAF axis might require scaling up. A Pure800 would flow about 500g/s for example.  
# The power values might be '''lower''' not higher. In other words, if the turbo is operating more efficiently, it will generate the same MAF at lower power.  
# The power values might be '''lower''' not higher. In other words, if the turbo is operating more efficiently, it will generate the same MAF at lower power.  


Line 111: Line 135:


Firstly we have the ''P-Factor'' (MHD's name) which is based on airflow and pressure-ratio (same as the compressor characteristic). Note that this does '''not depend on the boost error'''. It is more a property of the turbo as a system in the sense of how aggressively it responds. Note in particular
Firstly we have the ''P-Factor'' (MHD's name) which is based on airflow and pressure-ratio (same as the compressor characteristic). Note that this does '''not depend on the boost error'''. It is more a property of the turbo as a system in the sense of how aggressively it responds. Note in particular
* When there is airflow through the turbo (i.e. it is spooled up), the turbo is responsive and P-Factor will be higher.
* When there is airflow through the turbo (i.e. it is spooled up), but relatively low boost, the turbo is responsive and P-Factor will be higher.
* When boost rises, the turbo has to work harder (to cut through the air, so to speak), it becomes less responsive and P-Factor will be lower.
* When boost rises, the turbo has to work harder (to cut through the air, so to speak), it becomes less responsive and P-Factor will be lower.
The degree to which these effects occur depend on the turbo.
The degree to which these effects occur depend on the turbo.


Then we have the P correction. Note that the inputs here are ''turbine massflow'' and ''boost error''.
Then we have the P correction. Note that the inputs here are ''turbine massflow'' and ''boost error''. Turbine massflow is not generally equal to compressor massflow because some exhaust goes through the wastegate and skips the turbine. (Turbine massflow is discussed later).


[[File:P-correction.png]]
[[File:P-correction.png]]
Line 137: Line 161:
Here, MHD's naming is to use ''D-Factor'' as the table which accounts for the error and ''D-Correction'' is now the power-based property-of-the-system factor.  
Here, MHD's naming is to use ''D-Factor'' as the table which accounts for the error and ''D-Correction'' is now the power-based property-of-the-system factor.  


Note that the ''gradient of the error'' is itself a pressure quantity (in hPa). As such, we think about it as the '''difference''' between successive boost error samples. (In other words, if gradient is rise/run then the rise the difference in the boost error samples but we do not bother with the run because it is always the same value.
Note that the ''gradient of the error'' is itself a pressure quantity (in hPa). As such, we think about it as the '''difference''' between successive boost error samples. (In other words, if gradient is rise/run then the rise the difference in the boost error samples but we do not bother with the run because it is always the same value).


[[File:Tch-pwr-d.dot.svg]]
[[File:Tch-pwr-d.dot.svg]]


Generally, the D-Factor values are small. This means we can worry less about them. For example, on the stock tune, with large underboost of 400 hPa (6psi) and maxed out gradient, the maximum possible D term would only adds 1.5kW to the compressor target.
Generally, the D-Factor values are small. This means we can worry less about them. For example, on the stock tune, with large underboost of 400 hPa (6psi) and maxed out gradient, the maximum possible D term would only add 1.5kW to the compressor target.


{| class="wikitable" style="margin:auto"
{| class="wikitable" style="margin:auto"
Line 171: Line 195:
==== Limiting PID control (TchCtr_PwrFade) ====
==== Limiting PID control (TchCtr_PwrFade) ====


The DME caps the level to which the PID controller can increase the power from the compressor map. This cap is itself controlled by a map called ''BMWtchctr_fac_pwr_CompLimPctl_T'' or (''Max factor for the increase of WGDC due to P and D'' in MHD's XDF files).
===== Disabling PID control =====
In some cases, the DME will discard the PID output in favour of the value from the compressor map. This happens when:
# the boost target drops below the actual boost by a value controlled by '''BMWtchco_p_HysAcv_C'''. Stock, this is 15MPa (0.2 psi). This can be interpreted as a hysteresis value. If the car is asking for more boost than it has currently, the PID will stay enabled to meet it. If the target drops, the PID will not be disabled unless the target drops sufficiently. This prevents jittery switching off of boost control.
# changing gear, when stationary, when heating the cat, in limp mode, in launch mode, in eco mode, when the car wants to open the wastegate for sounds like braps.
 
===== Capping PID control =====
Optionally, the DME can be setup to cap the level to which the PID controller can increase the power from the compressor map. This is primarily to protect the turbo from overspeed conditions due to (experimental) PID output.
 
The cap is itself controlled by a map called ''BMWtchctr_fac_pwr_CompLimPctl_T'' or (''Max factor for the increase of WGDC due to P and D'' in MHD's XDF files).  
 
The capping calculation applied is <math>P_{required} = \min(P_{pid}, P_{map}*factor)</math>. If, for example, the factor is 1.08 (i.e 8%), and the output of the PID is then 10% more than the compressor map output then the DME will take the value from the compressor map.
 


[[File:Max-factor-pd.png]]
[[File:Max-factor-pd.png]]
The calculation is <math>P_{required} = \min(P_{pid}, P_{map}*factor)</math>. If, for example, the factor is 1.08 (i.e 8%), and the output of the PID is then 10% more than the compressor map output then the DME will take the value from the compressor map.


Notice that the factor is MAF dependent and  
Notice that the factor is MAF dependent and  
# values at low to medium MAF allow the PID controller to raise the power target substantially (50-20%).
# values at low to medium MAF allow the PID controller to raise the power target substantially (50-20%).
# becomes restrictive at higher MAF (down to 6%).
# becomes restrictive at higher MAF (down to 6%).
# the breakpoints on this curve are scaled for the mass flow range of the stock turbo. Rescaling the breakpoints might be needed for different turbos.


The breakpoints on this curve are scaled, more or less, for the mass flow range of the stock turbo. '''Consider rescaling the breakpoints according to the massflow capabilities of a different turbo'''.
Finally, the capping only applies to target boost pressure below a certain maximum and target pressure ratios above a certain minimum:
 
# The boost '''maximum''' limit is ''BMWtchctr_p_ReqDynLimPctl_C''
The diagram below show the blackbox view. The crucial thing is that it is outputting the actual power target that gets handed over to the turbine side.
# And pressure ratio '''minimum''' limit is ''BMWtchctr_rat_p_ComprLimPctl_T'' (MAF dependent pressure ratios)
This provides a windowing mechanism for the PID cap.  


[[File:BMW_MOD_TchCtr_PwrFade_10ms.svg]]
On the stock tune, this capping path is disabled (because the upper limit, BMWtchctr_p_ReqDynLimPctl_C, is set to 0hPa and the pressure ratio minium to 6) so the capping condition is never true. Nonetheless, if you are changing the PID settings, this path is available for overspeed protection.


==== Wastegate Position calculation (TchCtr_Pwr2Pos) ====


Given the required turbine power from above, the DME now calculates:
The diagram below shows the blackbox view of the entire function. The crucial thing is the output: this is power target that gets handed over to the turbine side, which will then be met with wastegate position.  
# how much of the exhaust it wants to divert through the turbine to meet this target.
# the wastegate position needed such that the remainder of the exhaust goes through the wastegate.


This introduces some new quantities:
[[File:BMW_MOD_TchCtr_PwrFade_10ms.svg]]
# the ''turbine mass flow'' (a quantity in g/s or kg/h) and the ''turbine flow fraction'' which is the ratio of turbine mass flow to total exhaust mass flow.
# the ''wastegate mass flow'' and the ''combined (wastegate plus turbine) mass flow'' (which depend on the wastegate position).
# the ''exhaust temperature'' (which depends on the load)
# pressures before and after the turbine and the corresponding ''turbine pressure ratio'' (which depend on the turbo and the downpipe)
# the turbine efficiency (which depends on the turbo)


And it introduces some maps that need adjusting for non-stock turbos:
==== Exhaust-side tables ====
# KF_AUSY_TURB. This (and the KL_AUSY_TURB) curve below contain the results of mass flow calculations done by BMW. This is a 2D table which takes as input the turbine pressure ratio and the current wastegate position and outputs a value which, after multiplication by a couple of constants, gives the '''combined mass flow of the turbine and wastegate'''.
# KL_AUSY_TURB. This is a curve that takes as input the turbine pressure ratio and outputs the '''mass flow of the turbine''' (after multiplication by the same constants as above).
# KF_AUSY_TURB_DIFF. The formula used to calculate KF_AUSY_TURB is differentiated with respect to exhaust manifold pressure (i.e. <math>d(KF\_AUSY\_TURB)/d(Pak)</math> and stored in this table.


For tuning purposes, note these tables depend on ''turbine pressure ratio'' and the breakpoints on the stock map are calibrated to 2.8. For non-stock turbos with highflow downpipes, this will need increasing because higher loads increase the exhaust manifold pressure and high flow downpipes decrease the after-turbo pressure so the pressure ratio <math>P_1 / P_2</math> gets bigger.


Notice that we are here trying to calculate a wastegate position (to meet our required turbine power) but some of these quantities depend on wastegate position. The calculation is ''iterative''.
===== Turbine pressure ratio to mass flow =====


===== Turbine mass flow calculation =====
An important characteristic of any turbo is how freely it flows air through the exhaust side. The DME quantifies this by asking ''if I apply a certain pressure across the turbo, how much exhaust will it flow?''. It does this for the turbine alone and the turbine plus wastegate, where the wastegate position can change.


There are calculations to determine the turbine and wastegate mass flows. These massflows are then the quantities fed into the wastegate position table (see below).
Note, this is nothing to do with how the turbine turns the massflow into power. It is just about the properties of the two holes: the hole where the turbine sits and the hole covered by the wastegate.


This introduces some new tables:
This introduces some new tables:
# KF_AUSY_TURB -- this is the massflow table for the turbine + wastegate combined. This depends on both the pressure across the turbine ''and'' the wastegate position (because there will be a higher total massflow if the wastegate is open).  
# KF_AUSY_TURB -- this is the massflow table for the turbine + wastegate combined. This depends on both the pressure ratio across the turbine ''and'' the wastegate position (because there will be more flow if the wastegate is open).  
# KL_AUSY_TURB -- this is the massflow curve for the turbine. This only depends on the pressure ratio (because the hole has a fixed size).
# KL_AUSY_TURB -- this is the massflow curve for the turbine. This only depends on the pressure ratio (because the hole has a fixed size).
# KL_AUSY_TURB_DIFF -- this is a table of the slope of the KL_AUSY_TURB.  
# KL_AUSY_TURB_DIFF -- this is a table of the slope of KL_AUSY_TURB.  
# KL_TABG2TABG_WZINV -- this contains pre-calculated values for <math>1/\sqrt{exhaust temp}</math>. It is scaled out to temps of 1400K (1125 C). (We will consider exhaust temps and pressures separately).
# KL_TABG2TABG_WZINV -- this contains pre-calculated values for <math>1/\sqrt{exhaust temp}</math>. It is scaled out to temps of 1400K (1125 C). (We will consider exhaust temps and pressures separately).


Stock, the massflow tables are scaled out to a pressure ratio of 2.8 so you should consider extending this for custom turbos and downpipes. (There will be higher pressure in the manifold '''and''' lower pressure after the turbo because of higher flow downpipes).  
Stock, the massflow tables above are scaled out to a pressure ratio of 2.8, so you should consider extending the axes for custom turbos. In most tuning scenarios there will be higher maximum pressures in the exhaust manifold due to higher loads '''and''' lower pressure after the turbo because less restrictive downpipes.
 
The DME applies the following calculations:


<math>KF\_AUSY * p_{ak} * 360 / \sqrt{t_{ab}} = M_{turbo} (kg/h)</math>          ...1
<math>KF\_AUSY * p_{ak} * 360 / \sqrt{t_{ab}} = M_{turbo} (kg/h)</math>          ...1
Line 235: Line 261:
# p_{ak} is the exhaust manifold pressure (in hPa)
# p_{ak} is the exhaust manifold pressure (in hPa)
# t_{ab} is the exhaust gas temperature (in Kelvin)
# t_{ab} is the exhaust gas temperature (in Kelvin)
# <math>KF\_{AUSY_DIFF} is the the output of map KF_AUSY_TURB_DIFF (the slope of the exhaust flow map).
# <math>KF\_{AUSY\_DIFF}</math> is the the output of map KF_AUSY_TURB_DIFF (the slope of the exhaust flow map).


[[File:Ausy_turb.dot.svg]]
[[File:Ausy_turb.dot.svg]]


===== Wastegate position from turbine mass flow =====
===== Catalytic converter pressure ratio to mass flow =====
 
In order to get the turbine pressure ratio above, the DME needs to know the pressure across the catalytic converter. To do this is uses another massflow table called ''BMWausy_p_DifCat_T''. Stock, this is scaled to 1200kg/h and will require rescaling.
 
Other tables exist for DPF pressure loss and factors for accounting for the affect of exhaust flap being open or closed:
# ''BMWausy_gra_PEgFlpDwn_C'', ''BMWausy_gra_PEgFlpOp_C'' pressure factors for exhaust flap closed and open.
# ''BMWausy_p_DifCat_T'' catalytic converter mass flow table.
# ''BMWausy_p_DifPclFil_M'' DPF pressure loss table.
 
Older gen 1 DMEs use a slightly different exhaust strategy using tables
# ''KL_AUSYKAT_AKAUF'' cat pressure loss with exhaust flap open
# ''KL_AUSYKAT_AKZU'' cat pressure loss with exhaust flap closed.
 
 
===== Exhaust mass flow to turbine pressure ratio target =====
 
From the above massflow calculation, the DME knows '''massflow given pressure ratio'''. It now turns this question around to ask, ''given the exhaust massflow (which it gets from target MAF and fuel mass), what would the pressure ratio be''?
 
To do this, it inverts KF_AUSY_TURB. Because the exhaust massflow is our target massflow, the corresponding turbine pressure ratio is the target pressure ratio.
 
===== Turbine power to massflow =====
 
Now the DME software incorporates the required turbine power and pressure ratio to obtain a turbine massflow.
 
The flow is as follows:
 
[[File:Tch-pwr-pos_mf_trb.dot.svg]]
 
Note there are two tables that have axes which depend on pressure ratio:
# BMWtchctr_fac_TrbEffIvs_T. This is the so called turbine ''efficiency''. It reflects properties of the turbo (so consider scaling the axis and setting suitable values).
# BMWtchctr_fac_TrbExp_T. Specific temperature change curve. This is a pre-calculated table. A spreadsheet formula to recalculate it with different axis values is =1/(1-(1/X)^((1.395-1)/1.395)) (where X is a reference to the axis value).
 
==== Wastegate Position calculation (TchCtr_Pwr2Pos) ====
 
At last, the turbine and exhaust massflow requirements are fed into the feedforward wastegate position table:


[[File:Wg-basc.dot.svg]]
[[File:Wg-basc.dot.svg]]
   
   
Note:
# The X axis is the massflow fraction to send down the turbine. It is the turbine massflow divided by the total exhaust massflow. It is often called the ''wastegate distribution factor''.
# The stock exhaust flow axis is scaled to 300g/s (1080 kg/h) which is too low for even hybrid turbos.
# 100% wastegate position here corresponds to the wastegate being closed (i.e. all flow through the turbine and none through the wastegate, see below).


[[File:Wastegate-position.png]]
[[File:Wastegate-position.png]]


Notes:
==== Diagnosis functions ====
# The stock exhaust flow axis is too low for hybrid turbos and will need scaling out to about 550 g/s.
 
# 100% wastegate corresponds to the wastegate being closed (i.e. all flow through the turbo and none through the wastegate).
The DME runs checks to detect PID controller problems and boost leaks. The pressure diagnosis function often requires editing either to disable it or customise it.
 
===== Pressure diagnosis =====
 
If the boost is off target (there is some boost error), the PID controller will modify the compressor power target and, we hope, there '''will be a corresponding adjustment to the wastegate position'''. Specifically, if the turbo is underboosting, the controller will raise compressor power and there should be an increase in wastegate position and vice versa. But recall from the start of the article that the power and position parts of the problem are calibrated separately, so this correspondence is not guaranteed.
 
This expected correspondence between boost error, power adjustment and wastegate position adjustment is captured in two tables:
# BMWtchdiag_pct_WgPHi_M (PID correction floor in MHD's XDF)
# BMWtchdiag_pct_WgPLo_M (PID correction ceiling in the XDF)
 
We would have preferred the names ''Wastegate position correction floor/ceiling''. Whatever the names, these tables are tying together errors on the compressor side with errors on the wastegate side.
 
Stock, the tables look as follows:
 
[[File:Pid-correction-mppsk.png]]
 
Here
# The X-axis describes the boost pressure error (in hPa). It is defined as <math>P_{target} - P_{actual}</math> so overboost is negative and vice versa.
# The Y-axis is the ratio <math>Pwr_{pid} / Pwr_{compressor map}</math>. So if this is less than one, the controller is reducing compressor power.
 
The following diagram shows the logic for the ''hi'' case, where the car is overboosting and compressor power is being reduced by the controller. The question the DME is asking is ''what is an acceptable reduction is wastegate position?''.
 
[[File:Tchdiag_pressure.dot.svg]]


Note on MHD+ custom WGDC table based on boost and engine speed...
A common tuning approach for these tables is to set the floor table to -99% across the board and the ceiling table to +99%. This avoids any possibility of false positive diagnosis but allows certain pathalogical scenarios such as the wastegate position increasing when it should be decreasing (e.g. because the tuner put a minus sign in the wrong place somewhere).

Latest revision as of 04:07, 16 August 2024

Here we talk generally about how the B58 controls the turbo and more specifically about the maps you might need to recalibrate when changing from the stock turbo.

Boost control has several steps:

  1. Figure out the boost target
  2. Convert the boost target and error into power at the turbine wheel (i.e. how hard and fast the turbo should be spinning).
  3. Work out the power inherent in the exhaust flow, how much of that needs to go through the turbine and how much should be ejected through the wastegate.
  4. Work out the wastegate position to achieve that.

We note that we are controlling a single variable, the boost, but we have two parameters: the turbine power and the wastegate position with which to affect it. In effect, the turbine power is arbitrary. The wastegate position is the value that really matters. This makes the problem underconstrained. We will gain an understanding of the turbo control then finish with the turbo diagnosis function that tries to ensure the two parts of the problem act in concert.

A note on naming and on units[edit]

MHD's XDF files use one set of map names and use g/s as the unit for MAF. BMW's A2L files uses a different set of names and kg/h for MAF. In the context of custom turbos, several important maps are missing from the MHD XDF files which exist to support development of their stock turbo maps. For that reason, this article generally uses the BMW names and units, but there is a bit switching between the two conventions. Finally, the word power get used a lot in this article. Power always refers to the power of the turbo's compressor and/or turbine wheels (how hard and fast they are spinning). It will never refer to the power of the engine.

Boost setpoint[edit]

Here, the DME runs through conversions of temperature and pressure quantities to arrive at the target MAF and target boost pressure for the turbo. It also figures out the deviation of the current boost pressure from the target and the target exhaust massflow by summing the air mass flow and the fuel mass flow. The only intervention from a calibration point of view is to increase some limits to allow the calculations to proceed naturally.

For the pressure calculation, there are two pressure ratio limiting tables. Both are functions of MAF, one of which also includes temperature. The DME takes the min value from each. There is then a third constant which applies to the boost pressure. Probably the best calibration approach is to lift these out of the way:


Name: BMWtchsp_rat_p_CmprPmp_T

Description: Upper limit for compressor pressure ratio setpoint.

Unit info: kg/h --> -

Base:

  500   535   600   650   725   800   850  1051
2.576 2.605 2.665 2.710 2.807 2.911 2.958 3.000

Modified:

  500   535   600   650   725   800   850  1051
4.000 4.000 4.000 4.000 4.000 4.000 4.000 4.000


The same change can be applied across the temperature dependent limit table (BMWtchsp_rat_p_CmprMax_M).

The absolute boost limit, the stock value is 2500 hPa (36psi) which is fine for most situations.

Name: BMWtchsp_p_ReqMax_C

Description: Maximum target boost pressure

Units: hPa

Base:

2500.000


The target massflow and pressure are both lowpass filtered using filter constants in tables BMWtchsp_fac_FilPRatCmpr_T and BMWtchsp_fac_mf_FilCmprNorm_T. These are configured for stock-like flows of upto 1100 kg/h (about 305 g/s). Consider adjusting for larger turbos. For example:

Name: BMWtchsp_fac_FilPRatCmpr_T

Description: Filter constant for target pressure ratio

Unit info: kg/h --> -

Axis: BMWtchsp_fac_FilPRatCmpr_Ax

Base:

 200.000  300.000  900.000 1100.000
   0.120    0.120    0.070    0.030

Modified:

 200.000  300.000  900.000 1800.000
   0.120    0.120    0.070    0.030


Name: BMWtchsp_fac_mf_FilCmprNorm_T

Description: Filter constant for corr. Target mass flow

Unit info: kg/h --> -

Base:

 200.000  300.000 1100.000 1120.000
   0.120    0.100    0.100    0.020

Modified:

 200.000  300.000 1100.000 1800.000
   0.120    0.100    0.100    0.020


For an overview of maps and values feeding into the volume flow calculation see below:


For maps and values feeding into the pressure calculation see below:

Power calculation (TchCtr_Pwr)[edit]

With setpoints in hand, the DME passes control the boost controller. This is a PID controller which acts to ensure the targets are met.

The first job of the boost controller is to work out how fast and hard is should be spinning the turbo to meet the required boost pressure. As such, (required) boost pressure quantities are converted into (required) power at the turbine wheel (in kW). Likewise boost errors are converted into power errors.

We can understand turbine power in terms of torque x rpm just as we can for engine power. As the boost pressure goes up, the air resistance on the compressor wheel also goes up so it needs more torque to keep turning at the same speed. As the engine speed rises and the airflow picks up, we can picture the compressor chasing the air and so it will have to rotate faster to create the same boost.

Feed-forward compressor map[edit]

This intuition is quantified in the compressor characteristic map (BMWtchctr_pwr_Pctl_M). This provides the power output from the compressor as a function of pressure ratio and MAF:

Pressure ratio refers to the boost pressure in the chargepipe divided by the pressure before the turbo.

Initially, the DME uses this map to create a good guess at the required turbine power:

This is fairly straightforward to understand: the map represents the turbo's power at various airflow and pressure-ratio values. The DME reads these off, corrects for temperature and we're done.

Note that with different and possibly bigger turbos than stock

  1. They will flow more air so the MAF axis might require scaling up. A Pure800 would flow about 500g/s for example.
  2. The power values might be lower not higher. In other words, if the turbo is operating more efficiently, it will generate the same MAF at lower power.
P error term[edit]

The DME then calculates a proportional error term:

This is a more subtle scenario.

Firstly we have the P-Factor (MHD's name) which is based on airflow and pressure-ratio (same as the compressor characteristic). Note that this does not depend on the boost error. It is more a property of the turbo as a system in the sense of how aggressively it responds. Note in particular

  • When there is airflow through the turbo (i.e. it is spooled up), but relatively low boost, the turbo is responsive and P-Factor will be higher.
  • When boost rises, the turbo has to work harder (to cut through the air, so to speak), it becomes less responsive and P-Factor will be lower.

The degree to which these effects occur depend on the turbo.

Then we have the P correction. Note that the inputs here are turbine massflow and boost error. Turbine massflow is not generally equal to compressor massflow because some exhaust goes through the wastegate and skips the turbine. (Turbine massflow is discussed later).

We note the following:

  • This is where the error is factored in. When the error is zero, the value will be zero so as to cancel the P term in the PID control.
  • boost error = (target - actual) so underboost is a +ve error (which is confusing because we intuively think of under as meaning less, but it is the other way around here).
  • the correction provides a weighting to the boost error according to how far out of step it is with what's required in the exhaust.
  • If we need a lot of exhaust flow and we are underboosting, the correction table will increase the p factor to hurry the turbo into meeting the demand.
  • If we need not so much exhaust flow and are underboosting, the correction table will slow down the p factor.
  • There is an additional spool mode table, however, this is often unused. The DME has a notion of spooling and an associated spooling factor which it determines from the boost error in the sense that, if we require a lot of boost but the actual boost is low, then the turbo must be spooling and so the spool factor that will be close to 1. Then, the DME can interpolate between the normal p-correction table and the spool table according to a second blending factor which it gets from a table (BMWtchctr_fac_FadeDyn_M). In practice this blending factor is zero, meaning only the normal table is used. To our mind, this is too much complexity but we mention it for anyone wanting to introduce a few more variables.

We can see this process in action in the following log:

Note that the names in the log are confusing. The 'p-factor' here is the final p term (and not the turbo gain property from the P-factor table).

D error term[edit]

Here, MHD's naming is to use D-Factor as the table which accounts for the error and D-Correction is now the power-based property-of-the-system factor.

Note that the gradient of the error is itself a pressure quantity (in hPa). As such, we think about it as the difference between successive boost error samples. (In other words, if gradient is rise/run then the rise the difference in the boost error samples but we do not bother with the run because it is always the same value).

Generally, the D-Factor values are small. This means we can worry less about them. For example, on the stock tune, with large underboost of 400 hPa (6psi) and maxed out gradient, the maximum possible D term would only add 1.5kW to the compressor target.

Max possible D
Error (hPa) Error Gradient (hPa) Compr Power (kW) D term (kW)
400 30 21 1.62
400 30 31 1.62
400 30 41 1.62
400 30 51 1.62
360 30 21 1.566
... ... ... ...

Generally, on logs, we want to see the feed-forward compressor map get as close to target as possible (in other words, the feed-forward compressor power and the compressor power after PD correction are the same to within a few percent). The caveat, at this point, is that we do not yet know whether the boost errors being fed back are caused by errors in our compressor map or errors in our wastegate position calculation. Let's move on to look at that problem.

Required turbine power[edit]

Once the feed forward and error terms have been calculated, the DME adds them up to arrive at a final value for the turbine power. This will be fed into the wastegate position control (see next section).

Limiting PID control (TchCtr_PwrFade)[edit]

Disabling PID control[edit]

In some cases, the DME will discard the PID output in favour of the value from the compressor map. This happens when:

  1. the boost target drops below the actual boost by a value controlled by BMWtchco_p_HysAcv_C. Stock, this is 15MPa (0.2 psi). This can be interpreted as a hysteresis value. If the car is asking for more boost than it has currently, the PID will stay enabled to meet it. If the target drops, the PID will not be disabled unless the target drops sufficiently. This prevents jittery switching off of boost control.
  2. changing gear, when stationary, when heating the cat, in limp mode, in launch mode, in eco mode, when the car wants to open the wastegate for sounds like braps.
Capping PID control[edit]

Optionally, the DME can be setup to cap the level to which the PID controller can increase the power from the compressor map. This is primarily to protect the turbo from overspeed conditions due to (experimental) PID output.

The cap is itself controlled by a map called BMWtchctr_fac_pwr_CompLimPctl_T or (Max factor for the increase of WGDC due to P and D in MHD's XDF files).

The capping calculation applied is . If, for example, the factor is 1.08 (i.e 8%), and the output of the PID is then 10% more than the compressor map output then the DME will take the value from the compressor map.


Notice that the factor is MAF dependent and

  1. values at low to medium MAF allow the PID controller to raise the power target substantially (50-20%).
  2. becomes restrictive at higher MAF (down to 6%).
  3. the breakpoints on this curve are scaled for the mass flow range of the stock turbo. Rescaling the breakpoints might be needed for different turbos.

Finally, the capping only applies to target boost pressure below a certain maximum and target pressure ratios above a certain minimum:

  1. The boost maximum limit is BMWtchctr_p_ReqDynLimPctl_C
  2. And pressure ratio minimum limit is BMWtchctr_rat_p_ComprLimPctl_T (MAF dependent pressure ratios)

This provides a windowing mechanism for the PID cap.

On the stock tune, this capping path is disabled (because the upper limit, BMWtchctr_p_ReqDynLimPctl_C, is set to 0hPa and the pressure ratio minium to 6) so the capping condition is never true. Nonetheless, if you are changing the PID settings, this path is available for overspeed protection.


The diagram below shows the blackbox view of the entire function. The crucial thing is the output: this is power target that gets handed over to the turbine side, which will then be met with wastegate position.

Exhaust-side tables[edit]

Turbine pressure ratio to mass flow[edit]

An important characteristic of any turbo is how freely it flows air through the exhaust side. The DME quantifies this by asking if I apply a certain pressure across the turbo, how much exhaust will it flow?. It does this for the turbine alone and the turbine plus wastegate, where the wastegate position can change.

Note, this is nothing to do with how the turbine turns the massflow into power. It is just about the properties of the two holes: the hole where the turbine sits and the hole covered by the wastegate.

This introduces some new tables:

  1. KF_AUSY_TURB -- this is the massflow table for the turbine + wastegate combined. This depends on both the pressure ratio across the turbine and the wastegate position (because there will be more flow if the wastegate is open).
  2. KL_AUSY_TURB -- this is the massflow curve for the turbine. This only depends on the pressure ratio (because the hole has a fixed size).
  3. KL_AUSY_TURB_DIFF -- this is a table of the slope of KL_AUSY_TURB.
  4. KL_TABG2TABG_WZINV -- this contains pre-calculated values for . It is scaled out to temps of 1400K (1125 C). (We will consider exhaust temps and pressures separately).

Stock, the massflow tables above are scaled out to a pressure ratio of 2.8, so you should consider extending the axes for custom turbos. In most tuning scenarios there will be higher maximum pressures in the exhaust manifold due to higher loads and lower pressure after the turbo because less restrictive downpipes.

The DME applies the following calculations:

...1

...2

...3

...4

where

  1. is the output of map KF_AUSY_TURB (turbine plus wastegate flow map)
  2. is the output of curve KL_AUSY_TURB (the turbine flow curve)
  3. are the massflows of turbo, wastegate and turbine respectively (BMW names: Msturb, Mswg, Msturbine).
  4. p_{ak} is the exhaust manifold pressure (in hPa)
  5. t_{ab} is the exhaust gas temperature (in Kelvin)
  6. is the the output of map KF_AUSY_TURB_DIFF (the slope of the exhaust flow map).

Catalytic converter pressure ratio to mass flow[edit]

In order to get the turbine pressure ratio above, the DME needs to know the pressure across the catalytic converter. To do this is uses another massflow table called BMWausy_p_DifCat_T. Stock, this is scaled to 1200kg/h and will require rescaling.

Other tables exist for DPF pressure loss and factors for accounting for the affect of exhaust flap being open or closed:

  1. BMWausy_gra_PEgFlpDwn_C, BMWausy_gra_PEgFlpOp_C pressure factors for exhaust flap closed and open.
  2. BMWausy_p_DifCat_T catalytic converter mass flow table.
  3. BMWausy_p_DifPclFil_M DPF pressure loss table.

Older gen 1 DMEs use a slightly different exhaust strategy using tables

  1. KL_AUSYKAT_AKAUF cat pressure loss with exhaust flap open
  2. KL_AUSYKAT_AKZU cat pressure loss with exhaust flap closed.


Exhaust mass flow to turbine pressure ratio target[edit]

From the above massflow calculation, the DME knows massflow given pressure ratio. It now turns this question around to ask, given the exhaust massflow (which it gets from target MAF and fuel mass), what would the pressure ratio be?

To do this, it inverts KF_AUSY_TURB. Because the exhaust massflow is our target massflow, the corresponding turbine pressure ratio is the target pressure ratio.

Turbine power to massflow[edit]

Now the DME software incorporates the required turbine power and pressure ratio to obtain a turbine massflow.

The flow is as follows:

Note there are two tables that have axes which depend on pressure ratio:

  1. BMWtchctr_fac_TrbEffIvs_T. This is the so called turbine efficiency. It reflects properties of the turbo (so consider scaling the axis and setting suitable values).
  2. BMWtchctr_fac_TrbExp_T. Specific temperature change curve. This is a pre-calculated table. A spreadsheet formula to recalculate it with different axis values is =1/(1-(1/X)^((1.395-1)/1.395)) (where X is a reference to the axis value).

Wastegate Position calculation (TchCtr_Pwr2Pos)[edit]

At last, the turbine and exhaust massflow requirements are fed into the feedforward wastegate position table:

Note:

  1. The X axis is the massflow fraction to send down the turbine. It is the turbine massflow divided by the total exhaust massflow. It is often called the wastegate distribution factor.
  2. The stock exhaust flow axis is scaled to 300g/s (1080 kg/h) which is too low for even hybrid turbos.
  3. 100% wastegate position here corresponds to the wastegate being closed (i.e. all flow through the turbine and none through the wastegate, see below).

Diagnosis functions[edit]

The DME runs checks to detect PID controller problems and boost leaks. The pressure diagnosis function often requires editing either to disable it or customise it.

Pressure diagnosis[edit]

If the boost is off target (there is some boost error), the PID controller will modify the compressor power target and, we hope, there will be a corresponding adjustment to the wastegate position. Specifically, if the turbo is underboosting, the controller will raise compressor power and there should be an increase in wastegate position and vice versa. But recall from the start of the article that the power and position parts of the problem are calibrated separately, so this correspondence is not guaranteed.

This expected correspondence between boost error, power adjustment and wastegate position adjustment is captured in two tables:

  1. BMWtchdiag_pct_WgPHi_M (PID correction floor in MHD's XDF)
  2. BMWtchdiag_pct_WgPLo_M (PID correction ceiling in the XDF)

We would have preferred the names Wastegate position correction floor/ceiling. Whatever the names, these tables are tying together errors on the compressor side with errors on the wastegate side.

Stock, the tables look as follows:

Here

  1. The X-axis describes the boost pressure error (in hPa). It is defined as so overboost is negative and vice versa.
  2. The Y-axis is the ratio . So if this is less than one, the controller is reducing compressor power.

The following diagram shows the logic for the hi case, where the car is overboosting and compressor power is being reduced by the controller. The question the DME is asking is what is an acceptable reduction is wastegate position?.

A common tuning approach for these tables is to set the floor table to -99% across the board and the ceiling table to +99%. This avoids any possibility of false positive diagnosis but allows certain pathalogical scenarios such as the wastegate position increasing when it should be decreasing (e.g. because the tuner put a minus sign in the wrong place somewhere).