PID Controller block has a parameter called Filter Coefficient, N. By default this parameter is set to 100. Based on your results, looks like you left this value unchanged. The transfer function of PID Controller block is:
P+I/s+D*N/(1+N/s)
N is the bandwidth of lowpass filter on the derivative. Pure derivative is not a good idea - it amplifies measurement noise, so a practical implementation should avoid pure derivatives and use a low pass filter, which is what PID Controller block does.
If you look under the mask of native PID block, that's how it does it:
The main point is not to use the pure derivative in your simulation. If you want to approach the pure derivative as high as possible, set N high, say at 1,000 or 10,000.
The derivative term of the PID controller is never implemented as a pure derivative because that would be extremely sensitive to noise. Hence, a cutoff frequency is added.
So, the D term will act like almost a derivative up to a frequency via
Ns
s ---> --------
s + N
N being the filter coefficient. This also makes it possible to implement a D term using an integrator avoiding a noisy derivative operation.
For N=100, its frequency response is:
Ideally, N will be as low as possible. The drawback of derivative action is ideal derivative has very high gain for high frequency signals. It means the high frequency measurement noise will generate large variations of the control signal.
To prevent this situation, the value of filter coefficient ‘N' is taken to be low (2 < N < 20)
Create PID controller in parallel form, convert to parallel-form PID controller
C = pid(Kp,Ki,Kd,Tf)
creates a continuous-time PID controller with proportional, integral, and derivative gains Kp
, Ki
, and Kd
and first-order derivative filter time constant Tf
:
This representation is in parallel form. When Tf = 0
, the controller has no filter on the derivative action.
Create a PID controller in standard form, convert to standard-form PID controller
C = pidstd(Kp,Ti,Td,N)
creates a continuous-time PIDF (PID with first-order derivative filter) controller object in standard form. The controller has proportional gain Kp
, integral and derivative times Ti
and Td
, and first-order derivative filter divisor N
:
When Ti = Inf
, the controller has no derivative action. When Td = 0
, the controller has no derivative action. When N = Inf
, the controller has no filter on the derivative action. $\frac{T_d}{N}= T_f$
Tune PID controllers.
Command: pidTuner
Open PID Tuner for PID tuning.
The PID Tuner app automatically tunes the gains of a PID controller for a SISO plant to achieve a balance between performance and robustness.
Form—Controller form in PID Tuner: ‘Parallel' - ‘Standard'. See pid
and pidstd
.
PID tuning algorithm for linear plant model.
C=pidtune(sys,type)
designs a PID controller of type type
for the plant sys
. If type
specifies a one-degree-of-freedom (1-DOF) PID controller, then the controller is designed for the unit feedback loop as illustrated:
type
:
P
—Proportional onlyI
—Integral onlyPI
—Proportional and integralPD
—Proportional and derivativePDF
—Proportional and derivative with first-order filter on derivative termPID
—Proportional, integral, and derivativePIDF
—Proportional, integral, and derivative with first-order filter on derivative termContinuous-time or discrete-time PID controller in Simulink.
The PID Controller block implements a PID controller (PID, PI, PD, P only, or I only).
Form—Controller structure: Parallel (default) - Ideal
\(C_{par}(s)=P+I(\frac{1}{s})+D(\frac{Ns}{s+N})\) \(C_{par}(s)=P+I(\frac{1}{s})+D(\frac{s}{\frac{s}{N}+1})\)
Here N cannot = Inf
. The block does not support N = Inf
(ideal unfiltered derivative).
Compare it with pidstd
form: