Integration methode

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

Reply to
Ole
Loading thread data ...

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

Reply to
Jerry Avins

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.

Reply to
fred.zakity

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

Reply to
Ole

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

Reply to
Jerry Avins

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:

formatting link
(see link to bottom to an improved method).

John Shaw

formatting link

Reply to
John Shaw

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.

Reply to
Tim Wescott

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

formatting link

Posted from Google Groups, the 21st century access to usenet.

Reply to
John Shaw

Dnia Tue, 12 Dec 2006 18:41:21 +0100, Jerry Avins napisa³:

All truth. To Ole I would suggest looking on bode characteristics. First int. method would be k1*z/(z-1) second k2*(z+1)/(z-1) if I'm right. Well, in this case there are no big diffrences but keep in mind that sometimes it does (there are many methods of discret integration, approximation, interpolation, some signal manipulation in frequency or time domain and so on).

Second method has better nois rejection at the end of band but needs one more variable to remember during computation and needs time for multiplying. Multiplying could be trouble on some microcontrollers. If you would use very cheap chip you should consider it. On the other hand if you have very noisy signals... Choice is all yours Ole.

Reply to
Mikolaj

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.