# Integration methode

• posted

What is the consequence of using the often used integration method in control systems: Yn = Yn-1 + ki * Xn

compared to the more precise: Yn = (Xn + Xn-1) dT / 2 + Yn-1

Thanks Ole

• posted

I imagine you are referring to sampled data. If so, dT (I would write dt) becomes deltaT, with a value of one sample interval, and so disappears. Yn = Yn-1 + ki * Xn is essentially a running sum. The result /as it applies to the present instant/ would be degraded by applying the trapezoidal rule.

Jerry

• posted

data. If so, dT (I would write

=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF

The stability domains are different for the three methods: forward and reverse rectangular rule and Tustin/Bilinear rule. Forward rectangular rule can map outside the unit circle. Backward methods are preferred for simple approximations. Tustin/Bilinear always maps in the unit circle.

Hope that helps.

fred.

• posted

Yep sorry - I refer to sampled data. I use dT as 1/samplefreq. I forgot to mention that I'm new to control system so my questions will be basic to you guys I think.

So is the rectangular integration method only used because it is less cpu time demanding?

When using the rectangular method in a PID controller how is the samplefreqeunce (1/dT) included in ki e.g. when using the Ziegler Nichols tuning rules?

Thanks, Ole

• posted

Trapezoidal approximation assumes the existence of data between the sample points. It is counterintuitive, but with periodically sampled data, the values at the sample points is all the math makes available. In effect, there is nothing between. Averaging adjacent samples not only low-pass filters the data, discarding some high-frequency information (for an integral, that doesn't matter), it delays the "integral" (sum, really) by half a sample time. Delay is not good in a control loop.

Jerry

• posted

First, I assume that ki is the reset rate in the same units as the sample time--repeats per second if the sample time is one second.

I think the second equation would be written: Yn=Yn-1 + ki*(Xn-Xn-1)/2

The difference between the two is that the second uses the average error rather than the most recent error.

Because the sample time should be very small compared to the time constant of the process, it makes very little difference. Remember that you are tuning a controller, not determining the numerical value of an area (such as when buying land!). Any difference would be eliminated when you "tweak" the tuning constant.

I have code (pseudo code in English) on my web site for two different implementations of the PID algorithm:

(see link to bottom to an improved method).

John Shaw

• posted

If you are approximating continuous-time integrators then both of the above methods should include the sample time, not just the trapezoidal integration.

You include it by knowing it up front, and adjusting your actual integrator gain by the sample time.

• posted

Specifically, you divide the integral constant by the number of scans within the time unit used to express the integral term. For example, if the reset rate (Ki) is in repeats per minute and the scan rate is once per second, the two equations for integration are:

Yn = Yn-1 + (ki/60) * Xn

Yn=Yn-1 + (ki/60)*(Xn-Xn-1)/2

John Shaw