0% found this document useful (0 votes)
79 views

Control Systems Background - The Regulation Problem

This document discusses control systems and PID controllers. It provides background on closed loop control systems and describes the three main strategies for PID controllers: proportional (P), integral (I), and derivative (D). It then discusses implementing a PID controller using a data acquisition system and tuning the PID parameters. Several test cases are presented to illustrate PID control for different systems, including a sluggish first-order system. Figures are included to show system responses both with and without PID control.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

Control Systems Background - The Regulation Problem

This document discusses control systems and PID controllers. It provides background on closed loop control systems and describes the three main strategies for PID controllers: proportional (P), integral (I), and derivative (D). It then discusses implementing a PID controller using a data acquisition system and tuning the PID parameters. Several test cases are presented to illustrate PID control for different systems, including a sluggish first-order system. Figures are included to show system responses both with and without PID control.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 19

Introduction

Control Systems Background -- The Regulation Problem

In a regulated system, an input signal called the setpoint specifies the desired response level at the system output. The output could be a
of a cutting tool, to name just a few possibilities. In a perfect world, you would provide the setpoint signal to the system input, and it w
This configuration, sometimes called open loop control, is illustrated in Figure 1.

Figure 1. Ideal system and open loop control.

Very often, real processes cannot be operated in this way. The output may drift away from the setpoint for a variety of reasons, or may
much in response to transient changes. In these situations, the output of the system can be measured and processed by a separate contro
compares the system output to the setpoint level to determine a new control input for the system. This configuration, called closed loop

Figure 2. Typical system under closed loop control.

Various strategies have been used to implement the controller. Three of the most common are:

 (P) Proportional error correction. The difference between the setpoint and actual system output is amplified and fed back to pr
from the setpoint, the larger the correction signal.
 (I) Integral error correction. Persistent differences between the setpoint and actual system output accumulate over time, until t
back toward the setpoint.
 (D) Derivative error correction. The correction signal opposes rapid deviations in system output, reducing the response to dist

There is nothing that requires these strategies to be utilized in isolation. Usually, some combination provides better performance. The m
each of the correction terms affects the controller's output. Figure 3 shows a simplified block diagram of a PID controller.
Figure 3. Simplified block diagram of the DAPL PID1 controller.

Another common nomenclature for PID control parameters is given below. The configuration is the same as Figure 3, with parameter c

 P = Kc I = Kc / Ti D = Kc Td
 Kc = P Ti = P / I Td = D / P

Applying the PID1 Processing Command

The DAPL implementation of PID in the PID1 command is slightly different from a conventional PID controller. The Data Acquisition
operating directly on voltage signals, it actually operates on digitized samples using fixed-point arithmetic. A detailed block diagram of

Figure 4. Detailed block diagram of DAPL PID1 controller.

A DAP requires an external sensor to measure the system output and signal conditioning electronics to convert the measurement to an a
signal conditioning are represented in Figure 4 by the Si scaling factor. The voltage is typically a single-ended voltage in the range -5 to
control of a DAPL input procedure.

The numerical output of the PID1 task is converted to an output voltage by a D/A converter. The output voltage range is typically -5 to
as an explicit limiter block. External electronics may be required to convert the output voltage into a signal suitable for driving the syst
external electronics is represented by the multiplier So in Figure 4. If possible, the output scaling should take advantage of the output r
excessive control signal drive. For good transient response, the scaling also should allow some room for short-term control signal level

The PID controller calculations proceed at the rate that data samples are placed into the PID input pipe. The sampling rate should allow
samples, but should be sufficiently fast for observing system changes as they are happening. In the examples at the end of this note, the
respond to input changes, so the PID samples are captured at tenth of a second intervals. The T notation in Figure 4 represents sampling

The Integral and Derivative control calculations do not include the element of time, which must be introduced by scaling the PID coeff
how the scaled coefficients Ps and Ds shown in Figure 4 are related to the P and D parameters in Figure 3.

The integral operation is approximated by summing the values of the error input, and then applying the Is multiplier. The relationship b
sampled coefficient Is is

Is = I * T

To understand what this represents, suppose that the sample time T is reduced by half, causing the sample rate to double. The summati
twice as often, causing it to grow twice as fast. Without any correction, this increased growth would lead to a doubling of the integral c
for the faster growth.

The derivative is approximated by differences of consecutive inputs. The relationship between the real time Derivative coefficient and

Ds = D / T

Again suppose that the sample rate is doubled. The Derivative term observes the input twice as often, so it sees changes of roughly half
compensation it will produce about half the effective control response. The 1/T term in Ds above compensates for the smaller change o

The proportional gain parameter is not affected by sample time.

Ps = P

Tuning PID Parameters

Selecting optimal values for the P and D parameters of a closed loop control system is usually an iterative process. This process is calle

Before tuning begins, verify that all components of the control loop operate correctly. Test input processing tasks to verify that the mea
Test output procedures to verify that the control output is correctly scaled. Verify that the PID controller processes the sampled input an
with the input. If possible, verify that the system responds correctly to its control input.

Knowing that the components work individually still does not guarantee that they will work together. How do you establish initial para
without driving the actual system? You can use the multi-tasking capabilities of DAPL to simulate the essential characteristics of your
parameters that you specify. Then, when you are satisfied that the settings are reasonable, you can disconnect the simulated system and

The DAPL commands provided in Listing 1 at the end of this note simulate the response of an inertial third-order linear system under c
samples its control input from analog input channel 0 and sends its output level to analog output channel 0. The PID controller samples
a control output on analog output channel 1. A sample time of 1/10 second is used both for the PID controller and for the simulated sys

Some simple hardware connections are required to run the simulation. Connect an MSTB 003-01 termination board to a Data Acquisiti
S0, to route the output of the simulated system to the input of the PID control. Connect input pin S1 to output pin DAC0, to connect th
PID. After your tuning is completed, remove the connections to S1 and DAC1. Replace them with connections from your system outpu
control input.

You will want to edit some of the coefficients in Listing 1 to configure the operation of your PID controller and simulated system. The
system, in the form of a Laplace transform
(A2 s2 + A1 s + A0) / (B3 s3 + B2 s2 + B1 s + B0)

(Don't worry if you are unfamiliar with Laplace transforms and the s variable; you can use and modify the coefficient values from the t
variable specifies the setpoint. The variables PV, IV and DV specify the PID response characteristics, and the variable RAMP sets the

That's all you need. Download the edited DAPL program, run it under DAPview, and display PSET, PIDIN, and PIDOUT. The setpo
will plot as a red line, and the PID control output will plot as a green line on your DAPview display.

Test Cases

The following test cases illustrate PID control for three typical systems. These cases show the capabilities and the side effects of each o
the vertical scale of the output plots shown in Figures 5 through 15 represent the digital values provided to the D/A output stage. In the
line, and the PID control output is plotted as a thin line. The controller is limited to the range -20,000 to 20,000 in the test cases. You ca
variables as you wish, but the rest of the listing should require no changes.

One of the figures for each test case shows the response of the system without PID control. To replicate these graphs, you must overrid
command VIN=PIDOUT with the command VIN = SETPT.

Test Case #1 -- Sluggish first-order system, about 10 second time constant.

A2=10 A1=0 A0=0


B3=100 B2=10 B1=0 B0=0

PV=100 IV=0 DV=0


RAMP=10000

10
-----------
100s + 10

Without a controller, the system responds very slowly, as shown in Figure 5.


Figure 5. Slow step response without PID control.

Applying PID control with the settings given at the beginning of this test case, we get the response shown in Figure 6. The Proportiona
response is still sluggish. Each unit that the system approaches the setpoint produces a unit drop in control effort. The system and contr
not a very acceptable result! Note that a sustained control effort is required to maintain systems such as this one at any nonzero operati
require a sustained flow of power to a heating element.

Figure 6. Sluggish system response with low proportional correction

To reduce the difference between the setpoint and output, we first try increasing the Proportional control gain to 8, by setting PV=800.
control effort moves the system output much more quickly. Notice that the PID control effort jumps immediately to maximum and stay
higher gain would therefore have little effect: maximum effort is maximum effort at any gain setting. If we wished, we could raise the e
input, output, and setpoint to avoid saturation. On the negative side, higher gains can be seen to cause increased noise in the control sig

Figure 7. Better system response with higher proportional correction

If you examine Figure 7, you will notice that the system still does not reach the setpoint level of 10,000. As the system approaches the
correct this problem by introducing some Integral correction. Setting IV=300, we obtain the response curve shown in Figure 8. As long
Integral correction increases until the system reaches the setpoint.

Figure 8. Adding integral control corrects the offset.

Test Case #2 -- Lightly damped, integrating, second order system.

A2=0 A1=0 A0=6


B3=2 B2=5 B1=5 B0=0

PV=100 IV=0 DV=0


RAMP=10000

6
-----------------------
2 s**3 + 5 s**2 + 5 s

This system will stay at the setpoint without any control effort. But getting it there can be interesting, because once this system starts to
unstable response without PID control.
Figure 9. Integrating system goes unstable without controller

To get the system to the setpoint quickly, the usual strategy is to apply Proportional control. Using the coefficients given at the beginnin
causes the system to overshoot the setpoint of 10,000. The system oscillates for a significant time, as shown in Figure 10.

Figure 10. Oscillations in integrating system with proportional control.

Increasing the gain to PV=150 only makes the oscillations worse, as shown in Figure 11.
Figure 11. Increasing proportional gain worsens oscillations.

For this kind of system, a large control effort is not necessary to reach the setpoint. The best strategy is to reduce the proportional gain,
oscillations. Setting the proportional gain to PV=65 and the derivative gain to DV=425, we see the response shown in Figure 12. Deriv
oscillations, but too much makes the system sensitive to noise, and slows the approach to setpoint.

Figure 12. Control results with proportional and derivative gains.

Note that the Integral correction term was not used. For natural integrating systems such as this one, Proportional correction is all that i
tendency to oscillate, as this one does, the Integral correction will tend to increase the oscillation. As an experiment, you might want to
in response.

Test Case #3 -- Slightly underdamped oscillation riding on a gradual exponential rise.

A2=1 A1=11 A0=3


B3=15 B2=18 B1=25 B0=3

PV=100 IV=0 DV=0


RAMP=10000

s**2 + 11 s + 3
------------------------------
15 s**3 + 18 s**2 + 25 s + 3

The open loop response of this difficult system is shown in Figure 13. The system is very slow to approach the setpoint, yet at the same
almost impossible to operate without using feedback control.

Figure 13. Step response of third-order system without controller.

Using the PID parameter values given at the beginning of this test case, the low value of Proportional correction allows the system outp
system of Test Case #1. Applying more Proportional error correction, and setting PV=600, we get closer to the setpoint, but also excite

Figure 14. Response of third-order system to increased proportional gain.

Adding a large Derivative correction, we can both reduce the oscillations and allow a higher value of Proportional gain, at the expense
Also notice that like Test Case #1, this system also tends to settle to an output level different from the setpoint. Integral gain can correc
and derivative settings. Adjusting the gain settings to the values PV=500 , IV=6000 , and DV=2000 , we get the output response shown

Figure 15. Response of third-order system with tuned PID control.

Conclusion

With the unsurpassed flexibility provided by a Data Acquisition Processor-based system, and with the control capabilities provided by
reason to settle for control systems with lesser capability. Under DAPL, one Data Acquisition Processor can control one PID process lo
rack full of specialized controller modules. Adding a new control loop is simple by using DAPL to specify the input channel, the outpu
The Data Acquisition Processor can perform exceptionally high-speed or exceptionally low-speed PID control tasks beyond the capabi
Data Acquisition Processor can take care of the monitoring and data functions that must normally be provided by separate data logging

With conventional PID controllers, it can be difficult to know what control system performance to expect without actually building and
Data Acquisition Processor, however, DAPL can simulate closed-loop system response, using the PID control strategy that you specify
note to simulate some of the essential features of your system's response -- sustained control effort, response time, and tendency to osci
evaluate the effects of control limits, get some valuable practice at fine-tuning control parameters, and obtain a high degree of assuranc
behaved.

Listing 1 -- DAPL Code for Closed Loop PID Control Simulation

; **********************************************
; DAPL Closed loop simulation of 3rd order
; inertial system and feedback control using
; the PID1 command.
; **********************************************

RESET
OPTION SCHEDULING=FIXED

; The object of this simulation is to adjust


; the following three gain coefficients and the
; constant ramping limit to bring the system
; response line even with the desired system
; setpoint line as smoothly and quickly as
; possible.
VARIABLE PV=500, IV=2000, DV=600
CONSTANT RAMP=400

; Coefficients for system transfer function simulation.


; Edit these to describe your simulated system response.
;
VARIABLE A2=1, A1=11, A0=3
VARIABLE B3=14, B2=12, B1=24, B0=2
;
; A2**2 + A1 s + A0
; -----------------------------------
; B3 s**3 + B2 s**2 + B1 s + B0

; **********************************************

; Other PID control variables


VARIABLE LOCK=1
VARIABLE SETPT=0

; Pipes for system simulation.


PIPES VIN, VOUT, VFB
PIPES LS1 LONG, LS2 LONG, LS3 LONG
PIPES AUX1, AUX2, AUX3

; Pipes for PID feedback control


PIPES PIDIN, PIDOUT, PSET

; Dummy data for real-time synchronization


PIPES SYNC, PIDX

; Establish initial conditions


; for system simulation integrators.
FILL AUX1 0
FILL AUX2 0
FILL AUX3 0
FILL VFB 0
FILL VIN 0
FILL VOUT 0

; **********************************************

; Simulate data capture by synchronizing to the following


; sampling procedure. The sample values are not used.
; The COUNT command terminates the simulation.
IDEFINE SAMP 2
SET IPIPE0 S0
TIME 500
COUNT 8000
SYNC = (IP0 & 0) + 1
END

; **********************************************
; PID control.
PDEFINE CONTRL
SKIP(SYNC,0,1,19,PIDX)
PIDIN = PIDX * VOUT ; Feedback from system
PID1( PIDIN, SETPT, PV, IV, DV, \
LOCK, PIDOUT, -5000, 20000, RAMP)
VIN = PIDOUT
PSET= PIDX * SETPT
MERGE(PSET,PIDIN,PIDOUT,$binout)
END

; **********************************************

; System simulation by integration of state equations.


PDEFINE SYSTM
AUX1 = (VIN*A0 - VFB*B0)/B3/10
INTEGRATE(AUX1,LS1)
AUX2 = ((VIN*A1 - VFB*B1)/B3 + LS1)/100
INTEGRATE(AUX2,LS2)
AUX3 = ((VIN*A2 - VFB*B2)/B3)/10 + LS2
INTEGRATE(AUX3,LS3)
VOUT = LS3
VFB = LS3
END

; Start system and controller


START SAMP, SYSTM, CONTRL
PAUSE 300 ; system starts with control locked
LET SETPT=10000 ; change setpoint
LET LOCK=0 ; unlock PID control

; End of simulation

The DAPL system has supported PID controls since its very earliest versions. The reason for doing this was to enable developers to us
command used, for building customized controller commands. The reason that this maybe wasn't such a good idea, it limited develope

Actually, a system interface with multiple service functions is not necessary to support PID. As you will see, practical PID controls onl
put in the same 20 or so lines into your processing command and you will have all of the same capabilities, plus easy access for modif

PID state
Your PID controller needs two kinds of data: configuration and state. The configuration contains the adjustable settings that persist ove

class PID_params
{
// Gain parameters
public:
float Kgain; // Loop gain parameter
float Ti; // Integrator time constant
float Td; // Differentiator time constant
float delT; // Update time interval

// Setpoint parameters
float setpt; // Regulated level to maintain
};

The internal state variables change from sample to sample depending on what happens in the feedback.

class PID_state
{
// Controller state
public:
float integral; // Summation of setpoint errors
float deriv; // Previous setpoint error
};

The main reason for organizing the data in this manner is convenient addressing. State and gain settings are used together all the time a
encapsulation principles to merge the structures into one common PID_data object.

PID Initializations

Before the PID computations begin, set up the PID parameter and state objects, and initialize all of the terms.

PID_params Params;
PID_state State;
// Initialize these...

PID computations will implement the following control law.

u = -Kp * ( err + integral(err)/Ti + deriv(err)*Td )

When approximating the integral using rectangular rule integration, the integral adjustment at each time step becomes the integrand (se
approximating the derivative using a first difference, the deriviative estimate is the difference in successive setpoint error values divide

PID Computations

The PID computations compare the actual system output to the setpoint to determine the setpoint tracking error. This difference drives

seterr = curr_feedback - PID_params.setpt;


// Proportional response
pidout = seterr;
The setpoint error drives the integrator, which then drives the PID response indirectly. After the integral value is used, its state is updat

pidout += PID_state.integral * PID_params.delT / PID_params.Ti;


PID_state.integral += seterr;

The derivative of the setpoint error is needed next. The actual derivative is seldom available, so the PID controller estimates the deriva
calculation requires keeping one previous value in state memory.

change = seterr - PID_state.deriv;


pidout += change * PID_params.Td / PID_params.delT;
PID_state.deriv = seterr;

Finally, the control output is generated by applying the control gain.

pidout *= -PID_state.Kgain;
// drive controller output

When somebody says they are using PID control, this is the complete story. So far, only 8 lines of run-time code are used to implemen
few common modifications, and these are covered next.

Coping with Limits

Most software-driven PID controllers will need to convert the computed gains into a fixed-point value and use this to drive a digital to
on the value that the PID control could compute, but there is a definite limit on the fixed point number range to which output converter
to limit the output to that range.

There can be good reasons for more restrictive limits: amplifiers that are unipolar and can't respond to negative values, systems that res
can add two additional configuration parameters and force outputs to be limited to the specified range.

// New variables for PID_params


float lowlim;
float highlim;
...

// Enforce output limits


if (pidout > PID_params.highlim)
pidout = PID_params.highlim;
if (pidout < PID_params.lowlim)
pidout = PID_params.lowlim;
// drive controller output

Avoiding Windup

After limits are applied, linear PID controls become nonlinear, and this has some side effects. Consider what happens when a controlle
regulating at a high level. While the controller is driving hard toward the new level, the system is still far away from the target setpoint
even though the desired output level is reached, and passed, the integral effects by themselves are enough to continue driving ahead at
the extended transient time required to correct the integrator imbalance is known as unwinding. Various strategies to counter windup ef

1. Integrator Latching. Since accumulation problems occur predominantly while the control output is at a limit, do not allow in
updating the integrator state until after limits are checked.

// Enforce output limits and anti-windup latch


if (pidout >= PID_params.highlim)
pidout = PID_params.highlim;
else if (pidout <= PID_params.lowlim)
pidout = PID_params.lowlim;
else
PID_state.integral += seterr;
// drive controller output
2. Soft Integrator Anti-Windup. As it cures the windup problem, the integral clamping strategy sometimes delays desirable int
reduces integrator changes rather than completely eliminating them. Select a reduction factor in the range 0.05 to 0.25.

// New variable for PID_params


float anti_windup;
...

// Enforce output limits and soft anti-windup


if (pidout >= PID_params.highlim)
{
pidout = PID_params.highlim;
PID_state.integral += anti_windup * seterr;
}
else if (pidout <= PID_params.lowlim)
{
pidout = PID_params.lowlim;
PID_state.integral += anti_windup * seterr;
}
else
PID_state.integral += seterr;
// drive controller output ...

A reduction factor of 0 is the same as the clamping anti-windup strategy. A reduction factor of 1 is the same as no anti-wind

3. Integrator Rate Limiting. Presuming that the error integral is intended for final settling, not for rapid response to large trans
integral can change. An additional configuration parameter is required for the independent integrator rate limiter.

// New variables for PID_params


float rate_limit;
...

ichange = seterr;
if (ichange > PID_params.rate_limit)
ichange = PID_params.rate_limit;
else if (ichange < -PID_params.rate_limit)
ichange = -PID_params.rate_limit;
pidout += PID_state.integral * PID_params.delT / PID_params.Ti;
PID_state.integral += ichange;

Removing Command Glitches from Derivative Response

For computing the derivative estimate, the current and previous setpoint errors are subtracted. When regulating a constant setpoint, this
current and previous feedback values. When the setpoint is changed, however, the change in the setpoint looks like an instantaneous, "

For applications where the command level changes continuously and smoothly, the basic derivative scheme works fine. For regulation
level spikes and use the differences between current and previous feedback explicitly, all of the time.

change = curr_feedback - PID_state.deriv;


pidout += change * PID_params.Td / PID_params.delT;
PID_state.deriv = curr_feedback;

Improving Derivative Response

Derivative control action should oppose rapid changes and should therefore be beneficial — but it has a bad reputation for being "desta

 It introduces a closed loop zero. Closed loop poles, not zeroes, cause instability. Still, the "peaking" gains produced at high fre
with gain margins.
 The higher the frequency, the less likely the relevance to the control problem, but the more the derivative term amplifies it. Th
 The derivative term is an estimate, and errors in the estimate can in themselves be a source of noise.
 The derivative feedback does not play well with time delays. A derivative gain that is fine in a continuous variable controller
delay of a discrete-time control loop.

The problems are worst at the Nyquist frequency, with a tendency to produce a high-to-low rattling that damps slowly.

A derivative frequency response increases monotonically at high frequencies. A lowpass filter can offset this gain and neutralize phase
needs to have minimal effect at the important lower frequencies, while providing attentuation of high frequencies.

Two filtering strategies can help with this.

1. Averaging filter. This introduces a transmission zero at the Nyquist frequency. One additional state variable is needed.

// New variable for PID_state


float oldderiv;
...

change = (seterr - PID_state.oldderiv)/2;


pidout += change * PID_params.Td / PID_params.delT;
PID_state.oldderiv = PID_state.deriv;
PID_state.deriv = seterr;
2. Single pole filter. This requires an additional lag variable for filter state, plus an additional parameter between 0.0 and 1.0 to c
This scheme corresponds to the lag filtering usually assumed in analog simulations.

// New variable for PID_params


float lagcut;
...

// New variable for PID_state


float lagstate;
...

change = seterr - PID_state.deriv;


PID_state.lagstate = (1.0-PID_params.lagcut)*PID_state.lagstate
+ (PID_params.lagcut)*change;
pidout += PID_state.lagstate * PID_params.Td / PID_params.delT;

A lag parameter value of 0.15 to 0.35 usually works well. The lower this cutoff level, the better the high frequency noise rejection but
term is reduced.

Gain Adjustments

Gain changes that are applied automatically and continuously, as in the case of an adaptive tuning scheme, are small and introduced so
changes that are larger can produce an artificial transient. This is an avoidable problem.

No special adjustments are required for the derivative or proportional feedback effects. In steady operation the derivative term does no
the setpoint error is very small and so is the effect of proportional response. During transients the effects of a gain adjustment would no

That leaves the integral term. The loop gain and integral time constant terms act together upon the current integral value to hold the loo
of these two gain terms, there will be an instantaneous level change in the control output. Ordinarily, what you will want instead is that
gain adjustments.

The effect of the integral term before gain adjustments is

integralold * Kpold/Tiold

To avoid an artificial transient, you must artificially adjust the integral value at the same time as the gains, so that the net effect of the i

integralnew = integralold * (Kpold/Kpnew) / (Tiold/Tinew)

After this adjustment, the new values of loop gain Kgain and integral time constant Ti can replace the previous values in the PID_para

Unbalanced Output Drive

It is not uncommon to find that the control loop works against a biased loading. For example, an actuator applies lift, and must work ag
work with gravity to move the load downward. Ordinarily, PID action is the same in both directions, and this leads to pulling downwar

The proportional term is intended for responding quickly to deviations from the setpoint. The amount of adjustment to apply is indicat
setpoint tracking error can be tested to determine whether to increase or decrease proportional response according to the new paramete

// New variable for PID_params


float delKp;
...

seterr = curr_feedback - PID_params.setpt;


if (seterr >= 0.0)
seterr *= delKp;
else
seterr /= delKp;

// Proportional response
pidout = seterr;

Feedforward Compensation

Sometimes it is necessary to control a system that has a tendency to "ring." The oscillations damp out slowly, and there is not much tha
causing them. Abrupt level changes can contribute energy at the frequency of ringing and excite the oscillations unnecessarily.

There are two techniques that you can apply.

1. Adjustable command path gain. The proportional action is split between the feedback response and the setpoint command r
paths. The effect is to shift the transfer function zero that the PID controller introduces, moving it away from the frequency w
might encourage the oscillation. This option requires an additional gain scaling parameter that must be tuned along with the u
0.0 to 1.0. At 1.0, the loop action is the same as classic PID.

// New variable for PID_params


float Kz;
...

// No change for integral and derivative terms


seterr = curr_feedback - PID_params.setpt;
// Proportional response differs for command and feedback
pidout = curr_feedback - Kz * PID_params.setpt;
2. Pre-filtering. Smoothing out sharp edges in the command signal avoids frequencies that might excite an oscillation. The filte
command signal before driving the loop, not in the feedback path, this delay has no impact on stability.

The design of the filter is beyond the scope of this paper. The smoothed setpoint signal with gradual level changes is then app
setpoint changes directly. This could be a separate filtering task, but the filter and the PID gains often are closely related and s

If the filter reduces to a simple gain less than 1, this becomes the same as the adjustable command gain strategy.

Conclusions

This note has described how PID software controls work, and how to implement them in custom processing commands. If there is any
speaking, PID controls are linear controls with three gain parameters, but most implementations will apply one or more of the extensio
certain point, it is questionable whether the exotic variants deserve being called PID control.
The variants are shown here in an informal style that should be comfortable both to C and C++ programmers.

While we have covered the 20 or so lines of programming code needed for the PID computations, the real challenges will lie in getting
of the computations, in a manner that will meet real-time requirements. Additional support in the form of fully functional command ex
DAPL.

You might also like