# digital PID controller

#### suzuki

Joined Aug 10, 2011
119
deleted...

Last edited:

#### mik3

Joined Feb 4, 2008
4,843
I don't remember exactly but you might need to adjust the gain or wrap the frequency when using transformations like the bilinear. I have to revise my course!

#### suzuki

Joined Aug 10, 2011
119
hi,

thank you for the reply. i guess i'm unsure as to how i want to change my gain factors since it is already working in the s domain form, and i don't think i can do too much of a trial and error here since the simulation takes some time to run.

What did you mean by wrapping the frequency? As far as i know, the bilinear transform lets you choose whatever sampling frequency you desire. In my case, I just chose the highest operating frequency in my circuit.

thanks

#### suzuki

Joined Aug 10, 2011
119
Still having some trouble figuring this out. I can get some results if i change the sampling frequency very low (1kHz) instead of using something high (150kHz), but this seems counter-intuitive since i would be sampling more at the higher rate.

#### t_n_k

Joined Mar 6, 2009
5,455
It's hard to comment in an informed manner as you provide an incomplete picture of the problem. It might help if you provide a full description of the problem including the Plant (with some numbers) you are attempting to optimize with the PID block. Again, some numbers for your optimized 's' domain PID would probably be of help.

#### steveb

Joined Jul 3, 2008
2,436
... However, if I use this transfer function in my control loop, it fails to perform as well as my s-domain transfer function. I chose a sampling frequency that is the same as my system’s highest operating frequency.
Oh boy - That's very likely a big part of the problem. There are two issues with this approach.

First of all, the Nyquist sampling rate constraint is to sample at at least twice the maximum bandwidth you want. This is the a theoretical constraint, based on mathematics, that determines whether it is even possible to reconstruct a continuous time signal from the sampled system.

Second, you typically need to sample at about 20 times the controller bandwidth in order for your discretized system to reasonably match the continuous time equivalent system.

Also note that the use of a bilinear transform will "warp" the frequency domain characteristics. Adequate sampling rate will minimize the error in warping, but your pole and zero frequencies will not exactly match.

There is the well known MPZ (matched pole zero) method of discretizing that gives exact match of zero and pole frequencies, but this is still not an exact representation, since exact matching is impossible.

• suzuki