This guide was contributed by Alex Hickson, an independent tuner. It details how to tune the advanced spring rate compensation parameters.

Tuning DBW throttles using spring and friction compensators

Introduction

A drive by wire throttle body mechanism consists of an electric motor, two position feedback sensors and a return spring. The return spring will cause the throttle to spring back to a “default” position (typically around 6-10% open). The motor has a gearing system and the throttle shaft, gears and motor all have frictions which act against movement. Any time that the net result of motor torque and return spring torque do not exceed the friction, the throttle will remain static. The aim of the friction and spring compensators now added to the ME442 firmware is to linearise the control system in order to improve throttle response time and stability.

  1. Calibrating HRTs

This procedure should be followed with the engine off. Start by setting the min and max TPPS 1,2 and PPS 1,2 HRT raw values as 0 and 100 in the relevant HRTs. 

To measure the max and min TPPS raw values, increase and decrease the manual PWM output until the raw values stop changing. Note that the duty will normally need to be negative to reach the minimum throttle position.

It is recommended to set HRT raw values slightly inside their upper and lower limits in order to ensure that the 0 and 100 positions can always be reached. This will prevent problems such as integral wind up. For example, if TPPS1 varies between 10,000 and 40,000 at its limits, it would be better to set the HRT values as 10,100 and 39,900 to ensure the whole range can always be reached, even if the sensors drift with temperature.


  1. Log based tuning of spring and friction Compensators

Note that any changes to TPPS or PPS calibration or solenoid frequency should be made before tuning spring and friction compensators.


Start by creating a log of throttle movement. This can be a driving log or a log of moving the throttle without the car running. Throttle movements should be kept slow and smooth so that the throttle position can track the pedal position accurately even with low gains. Note that the PID Batt. V ref in the PID settings should be set to the average battery voltage during the log.


Generate a plot of DBW A PWM Duty vs DBW A Target TPPS. Filter out any sudden changes in throttle and you should see a clear outline of the data points. An example of this outline of data points is shown by the orange outline below.


This outline of the points represents the PWM duty needed in order to cause the throttle to move from a static position. The central green line of this envelope represents the equivalent PWM duty required to match the force exerted by the spring . The height of the envelop above and below this green line (shown by the red arrows) is the equivalent PWM duty to the force required to overcome the friction sources in the throttle body.



The spring compensator should be set to match the centre of the envelope (green line in this diagram). The friction compensator should be set to match the difference between the green centre lines and the edge of the envelope (indicated by red arrows above) at each target TPPS. If there is some uncertainty, it is better to set the friction compensator too low than too high, but care should be taken to make both spring and friction compensators as accurate as possible.

  1. PID Tuning and other parameters

Tuning the PID control of the DBW system is the same as any other PID system. As a rough guide, a good initial guess for the I term is to set it to the time for the throttle to move from the minimum to maximum position plus time to move from maximum to minimum position when switching PWM duty between -100 and 100. The P term should then be gradually increased to the point of instability and then multiplied by 0.4. These should be considered as “initial guesses” and further fine tuning of the PID may be required.


The PID static reg width represents the Equivalent change in PID output to move from the spring compensator output to spring compensator +/- friction compensator. If the spring and friction compensators are set perfectly, this will be the dead zone of the PID output. If the spring compensator is inaccurate or friction compensator is too large, this will need to be increased to prevent instability.

PWM Min and Max duty are applied before the spring and friction compensators. This means that the maximum and minimum final outputs at any target TPPS are PWM Max Duty + Spring compensator + Friction Compensator and PWM Min Duty + Spring compensator - Friction Compensator. Setting PWM max and min too large can result in overshooting when large changes in throttle position are required. Setting these too small will slow the throttle response when large changes in position are required. If overshoot is observed on large throttle position changes but not on small changes, the solution is to reduce the amplitude of these limits.