Our VIP Package gets you every single course at 80% off the individual price. For a limited time, save an additional $100 with coupon code 100VIP. Learn more

Variable Cam Control Tuning: PID Control Basics

Watch This Course

$149 USD

Or 8 weekly payments of only $18.63 Instant access. Easy checkout. No fees. Learn more
Course Access for Life
60 day money back guarantee

PID Control Basics


00:00 - Since the PID control algorithm is at the heart of the cam control system, we're going to cover PID control in detail, explaining what it is, giving you a practical analogy so you can understand it and then giving you an approach to tuning and optimising it over the next few modules.
00:17 While every cam control system uses a PID control algorithm, the following sections are really most relevant if you're setting up or tuning an aftermarket standalone ECU.
00:27 While every ECU including those used by OE manufacturers uses PID control, it's unusual to have access to the specific PID gains in a factory ECU.
00:38 It's also reasonable to expect that the OEs have put in the hard work in the initial calibration process to get the best results out of the cam control so short of some dramatic mechanical changes, you shouldn't need to make many changes here anyway.
00:51 It's important to mention that PID control isn't limited to cam control and instead it's at the heart of many of the ECU's control strategies that rely on closed loop feedback.
01:02 In fact, it's a well accepted control strategy used across all types of industry too.
01:07 That term closed loop feedback simply means that the ECU is targeting a specific value and then monitoring the outcome of whatever it's controlling.
01:16 Any time there's an error between the target and measured value, the ECU can manipulate the output in order to drive the value towards the target.
01:24 Open loop on the other hand means that the ECU will blindly output the same thing irrespective of the measured value.
01:30 With any system that utilises closed loop control, the ECU needs a control strategy to tell it how to respond to an error between a target and the measured parameter.
01:40 This could be applied to idle speed, boost control, electronic throttle control or in our case cam control.
01:47 I'll explain the individual terms shortly but for now, just remember that PID stands for proportional integral and derivative.
01:55 These are just the parameters we adjust to affect the control of the system.
02:01 Tuning a PID control system can be challenging as you can't hope to apply the same PID gains to every situation.
02:08 The ability of the ECU to control a particular output will depend on what we're trying to control.
02:14 For example if we consider variable cam control, we have a system that can respond very rapidly to the ECU's commands.
02:21 We also want the cam position to track our target very accurately so our accepted tolerance will be very small.
02:28 Perhaps only 1° or thereabouts.
02:31 On the other hand, if we consider idle speed control, we have a system that will respond much slower to changes.
02:37 We also probably aren't so worried about pinpoint accuracy and an error of 20-50 RPM might be completely acceptable for our overall strategy.
02:47 For these reasons, we need to tune the PID control system to suit each specific application but to do that we need to understand how the control algorithm works and we need an approach to follow in order to tune the system and achieve fast, accurate and stable control.
03:04 One of the concepts I've just brought up does warrant a little more explanation before we move on.
03:10 A PID control system will usually include a headband which is a narrow range above and below the set point that the system will consider to be on target.
03:18 When the measured value is within this headband the ECU will stop trying to drive the system towards the target.
03:25 This deadband will depend on the particular system we're controlling.
03:28 For example a drive by wire throttle may require a deadband of 0.1% or less.
03:34 When it comes to idle speed control as I've mentioned already, a deadband of 20-50 RPM might be just fine.
03:41 Before we get too far ahead of ourselves though, let's move on and examine the individual components of the PID control system.
03:48 These components are the proportional gain or P, the integral gain or I and the derivative gain or D.
03:56 I'm going to explain how each of these components affect the control of the system but I also know that PID is a complex topic and many struggle to understand it.
04:05 Particularly since it involves maths.
04:08 To keep it simple and easy to understand, I'm also going to use an analogy in the next module but before we get into that, let's look at what each of those gains does.
04:17 Starting with the proportional gain, this provides a correction proportional to the size of the error.
04:23 This component provides an immediate response to an error and is responsible for the response of the system.
04:30 Proportional gain on its own will never be able to reduce the error in a system to 0 though since as the error reduces the proportional response is also reduced.
04:40 A small value for proportional gain will only result in a small reduction in the error and the system will never reach the target and will also respond slowly to changes.
04:50 If on the other hand the proportional gain is large, the system will respond quickly to an error but it'll tend to overshoot the target and become unstable resulting in the measured value oscillating wildly above and below the target.
05:03 This is a common issue I see with all types of PID control systems.
05:08 The integral gain or I component is a slower moving component that works to reduce the error to 0 over time.
05:15 The result of a control system using just proportional or proportional and derivative gains on their own can never achieve an error of zero because as mentioned when the error is reduced, the effect of the proportional and derivative components is also reduced.
05:31 The integral gain works to eliminate this remaining error and can move the system onto the target over time.
05:37 Basically any time the error is not 0, the integral component will continue to increase or decrease.
05:44 One problem that can arise with integral gain is an aspect known as integral windup which occurs when the system can't reach the target.
05:51 A common example of this would be trying to target a cam position that the system can't reach due to the mechanical limit of the cam's rotation.
06:00 Let's say that our engine provides a maximum cam advance on the intake of 40°.
06:04 If we instead targeted 45°, this system can't achieve this because the cam wheel is hard against the mechanical stop.
06:12 This leaves us with an error of 5° and if left unchecked the integral component will continue to increase the cam solenoid duty cycle to try and achieve this impossible target.
06:23 The problem with integral windup comes when the cam target changes to something that's achievable again, let's say 30°.
06:30 Before the system can track the new target, the large integral component needs to unwind which can take a second or more, resulting in a very slow response while the integral gain slowly reverses.
06:42 You'll see this situation demonstrated in our practical skills section.
06:46 The derivative gain or D component works in relation to the rate of change of the error.
06:50 This works as a damping or braking component and when combined with the proportional gain, can improve the response of the system while eliminating the overshoot and oscillation that we can see if we're just using proportional gain alone.
07:03 Since the derivative gain is dependent on the rate of change of error, it's effect is greatest when there are sudden changes.
07:11 That covers the 3 components of a PID control algorithm, however there is one more parameter that is important for good control.
07:18 Depending on the system you're tuning, this may be called base duty, base position average positon, feed forward or linearisation however for simplicity, we'll use the term base duty cycle from now on to cover these terms.
07:33 Basically this is a parameter or table of parameters that provides a starting point for the particular output to get it close to the target before any closed loop control is used.
07:44 If we're considering boost control, this would be the wastegate duty cycle that's required to get to our target boost.
07:51 In the case of cam control there isn't a direct correlation between actuated duty cycle and a specific cam angle.
07:58 Instead, the actuator will increase the duty to advance the cam and reduce the duty to retard the cam.
08:05 Once the target is reached, the duty will normally settle around a reasonably consistent value which is what is required to hold the cam position steady.
08:13 This is the value that we use for base duty cycle in a cam control system.
08:17 Usually this is likely to be close to 50% duty cycle but we'll still need to test in order to find what our system needs.
08:26 Properly tuning the base duty cycle table is critical in getting good stable control in any PID control system as we'll see.
08:34 It's also worth discussing what the ECU does with the individual components in order to control a system.
08:41 With a PID control algorithm, each component or gain is constantly being calculated inside the ECU based on the current error.
08:48 The result or duty cycle that will be applied to the output at any time is the sum of all of these components.
08:56 Some ECUs will give you the ability to actually log the individual components so that you can see how the system is responding at any time and this can be helpful in tuning the PID gains.
09:07 If this module has managed to confuse you, don't worry just yet.
09:11 We needed to discuss the components first and explain what they mean before we could move on.
09:17 In the next module I'll cover a practical analogy that will put the PID components into perspective and let you understand how they interact.