# The algorithm for the following analog controller => digital controller?

I have found a continous control in the following form:

$$u(s) = \left( K_{p} + \frac{K_{i}}{s} + K_{d} \frac{N}{1 + \frac{N}{s}} \right)e(s)$$

but since I need it to "convert" in a digital control I need something like:

$$y_{k} = y_{k-1} + q_{0}e_{k-1} + q_{2}e_{k-2}$$

or everything that I can use in a digital way. Is there any algorithm to achieve such transformation? Actually the problem is the term $N$ in the equation. At first I thought that it was a simply PID controller but the N term is far from my understanding

Thank you very much and happy Christmas!!

• Where have you found it, and why do you think it is what you need? The derivative term looks unusual. What is N? – Eugene Sh. Dec 25 '14 at 3:53
• In this document link on page 43 – Dave Dec 25 '14 at 8:52
• Same question as Eugene Sh. This looks like a PID controller, with an unusual term for the derivative term. The link you gave is not working. – Alexandre Willame Dec 25 '14 at 18:35
• The parameter N regulates the filtering on the derivative term to cut off high-frequency noise and to make the derivative feasible, of course. Read the bible of PID (page 76) for reference. – Ugo Dec 25 '14 at 19:55

You should take a look at the Tustin transformation to get the bilinear mapping between s-domain and z-domain. You'll also find examples therein.

Once you're provided with the description of your transfer function in z-domain, it's straightforward to derive the formula in discrete time domain.

Given $$\frac{Y}{U}=\frac{b_0+\ldots+b_{m-1}z^{-(m-1)}+b_mz^{-m}}{a_0+\ldots+a_{n-1}z^{-(n-1)}+a_nz^{-n}},$$

you'll obtain $$y_k=\frac{b_0u_k+\ldots+b_mu_{k-m} - a_1y_{k-1}-\ldots-a_ny_{k-n}}{a_0}.$$

• How should I deal with the $N$ term in the first formel? – Dave Dec 25 '14 at 18:49
• Uhm, it seems you're not so familiar with PID control then... This is one of possible reference (page 76). Before rushing headlong into the problem, always recap some useful pieces of theory :) – Ugo Dec 25 '14 at 19:57