ControlDesign

 ZNFreq
 PID tuning based on Ziegler-Nichols frequency domain (closed-loop) methods

 Calling Sequence ZNFreq(Ku, Tu, opts)

Parameters

 Ku - algebraic or positive realcons; system ultimate gain Tu - algebraic or positive realcons; system ultimate period opts - (optional) equation(s) of the form option = value; specify options for the ZNFreq command

Options

 • method = ZN or TL
 Specifies the tuning method. ZN uses the standard Ziegler-Nichols frequency response tuning method. TL uses the Tyreus-Luyben tuning method, a modified version of the standard Ziegler-Nichols frequency response tuning method generally resulting in higher closed-loop damping coefficient. The default value is ZN.
 • controller = P, PI or PID
 Specifies the controller type. The default value is PID.
 • factored  = true or false
 True means return the factored version of the controller gains ($K=\mathrm{Kp}$, $\mathrm{Ti}=\frac{\mathrm{Kp}}{\mathrm{Ki}}$, $\mathrm{Td}=\frac{\mathrm{Kd}}{\mathrm{Kp}}$). False means return the controller gains ($\mathrm{Kp}$, $\mathrm{Ki}$, $\mathrm{Kd}$). The default is false.
 • returntype =  list or record or system
 Specifies the returned type. If list (or record) is specified, a list (or record) containing the controller parameters is returned. If system is specified, a System (DynamicSystems system object) containing the transfer function of the specified controller type (P, PI, PID) is returned. The default value is list.

Description

 • The ZNFreq command calculates the controller gains based on the Ziegler-Nichols frequency domain (closed-loop) tuning methods, using the given ultimate gain and period. The design criterion is the quarter amplitude decay ratio in response to load disturbances, i.e. the second overshoot in the step response is a quarter of the first overshoot.
 • The ultimate gain is the smallest positive gain for which the closed-loop system under unity negative feedback becomes oscillatory (marginally stable) and the ultimate period is the period of the corresponding oscillations. See ControlDesign[ParameterIdentify][FrequencyDomain] for details.
 • The ZNFreq command returns a list of controller gains $\mathrm{Kp}$, $\mathrm{Ki}$ and $\mathrm{Kd}$ according to the selected controller type P, PI or PID, respectively, where $\mathrm{Kp}$ is the proportional gain, $\mathrm{Ki}$ is the integral gain, and $\mathrm{Kd}$ is the derivative gain.
 • The controller transfer function is then obtained as:
 – P: $C\left(s\right)=\mathrm{Kp}$
 – PI: $C\left(s\right)=\mathrm{Kp}+\frac{\mathrm{Ki}}{s}$
 – PID: $C\left(s\right)=\mathrm{Kp}+\frac{\mathrm{Ki}}{s}+\mathrm{Kd}s$

Examples

 > $\mathrm{with}\left(\mathrm{ControlDesign}\right):$
 > $\mathrm{with}\left(\mathrm{DynamicSystems}\right):$

Example: Numeric system

 > $\mathrm{sys}≔\mathrm{NewSystem}\left(\frac{2}{{s}^{3}+3{s}^{2}+5s+7}\right):$
 • Identify the parameters [$\mathrm{Ku}$, $\mathrm{Tu}$] of sys
 > $\mathrm{Params}≔\mathrm{evalf}\left(\mathrm{ParameterIdentify}:-\mathrm{FrequencyDomain}\left(\mathrm{sys}\right)\right)$
 ${\mathrm{Params}}{≔}\left[{3.999999994}{,}{2.809925894}\right]$ (1)
 • Calculate the controller parameters using the ZN (default) method
 > $\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{controller}'=P\right)$
 $\left[{1.999999997}\right]$ (2)
 > $\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{controller}'=\mathrm{Π},'\mathrm{factored}'=\mathrm{true}\right)$
 $\left[{1.599999998}{,}{2.247940715}\right]$ (3)
 > $\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{controller}'=\mathrm{PID},'\mathrm{factored}'=\mathrm{true}\right)$
 $\left[{2.399999996}{,}{1.404962947}{,}{0.3512407368}\right]$ (4)
 • Calculate the controller parameters using the TL method
 > $\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{method}'=\mathrm{TL},'\mathrm{controller}'=P\right)$
 $\left[{1.599999998}\right]$ (5)
 > $\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{method}'=\mathrm{TL},'\mathrm{controller}'=\mathrm{Π}\right)$
 $\left[{1.239999998}{,}{0.2005876254}\right]$ (6)
 > $\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{method}'=\mathrm{TL},'\mathrm{controller}'=\mathrm{PID},'\mathrm{factored}'=\mathrm{true}\right)$
 $\left[{1.799999997}{,}{6.181836967}{,}{0.4495881430}\right]$ (7)
 • Return a DynamicSystems system object of the controller transfer function
 > $\mathrm{PIsys}≔\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{method}'=\mathrm{TL},'\mathrm{controller}'=\mathrm{Π},'\mathrm{returntype}'=\mathrm{system}\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{PIsys}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({s}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({s}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{1.239999998}{}{s}{+}{0.2005876254}}{{s}}\end{array}\right$ (8)
 > $\mathrm{PIDsys}≔\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{method}'=\mathrm{TL},'\mathrm{controller}'=\mathrm{PID},'\mathrm{returntype}'=\mathrm{system}\right):$
 Warning, improper transfer-function, degree(num) > degree(den)
 > $\mathrm{PrintSystem}\left(\mathrm{PIDsys}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({s}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({s}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{{0.8092586561}{}{{s}}^{{2}}{+}{1.799999997}{}{s}{+}{0.2911755853}}{{s}}\end{array}\right$ (9)

Example: Symbolic system

 > $\mathrm{sys2}≔\mathrm{NewSystem}\left(\frac{a}{{s}^{3}+b{s}^{2}+cs+d}\right):$
 • Identify the parameters [$\mathrm{Ku}$, $\mathrm{Tu}$] of sys2
 > $\mathrm{Params}≔\mathrm{ParameterIdentify}:-\mathrm{FrequencyDomain}\left(\mathrm{sys2}\right)$
 ${\mathrm{Params}}{≔}\left[\frac{{b}{}{c}{-}{d}}{{a}}{,}\frac{{2}{}{\mathrm{π}}}{\sqrt{\left|{c}\right|}}\right]$ (10)
 • Calculate the controller parameters using the ZN (default) method
 > $\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{controller}'=P,'\mathrm{factored}'=\mathrm{false}\right)$
 $\left[\frac{{1}}{{2}}{}\frac{{b}{}{c}{-}{d}}{{a}}\right]$ (11)
 > $\mathrm{PIpars}≔\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{controller}'=\mathrm{Π},'\mathrm{factored}'=\mathrm{true},'\mathrm{returntype}'=\mathrm{record}\right)$
 ${\mathrm{PIpars}}{≔}{\mathrm{Record}}{[}{\mathrm{packed}}{]}{}\left({K}{=}\frac{{2}}{{5}}{}\frac{{b}{}{c}{-}{d}}{{a}}{,}{\mathrm{Ti}}{=}\frac{{8}}{{5}}{}\frac{{\mathrm{π}}}{\sqrt{\left|{c}\right|}}\right)$ (12)
 > $\mathrm{pid}≔\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{controller}'=\mathrm{PID},'\mathrm{returntype}'=\mathrm{record}\right)$
 ${\mathrm{pid}}{≔}{\mathrm{Record}}{[}{\mathrm{packed}}{]}{}\left({\mathrm{Kp}}{=}\frac{{3}}{{5}}{}\frac{{b}{}{c}{-}{d}}{{a}}{,}{\mathrm{Ki}}{=}\frac{{3}}{{5}}{}\frac{\left({b}{}{c}{-}{d}\right){}\sqrt{\left|{c}\right|}}{{a}{}{\mathrm{π}}}{,}{\mathrm{Kd}}{=}\frac{{3}}{{20}}{}\frac{\left({b}{}{c}{-}{d}\right){}{\mathrm{π}}}{{a}{}\sqrt{\left|{c}\right|}}\right)$ (13)
 > $\mathrm{pidsys}≔\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{controller}'=\mathrm{PID},'\mathrm{returntype}'=\mathrm{system}\right):$
 Warning, improper transfer-function, degree(num) > degree(den)
 > $\mathrm{PrintSystem}\left(\mathrm{pidsys}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({s}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({s}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{\left({3}{}{{\mathrm{\pi }}}^{{2}}{}{b}{}{c}{-}{3}{}{{\mathrm{\pi }}}^{{2}}{}{d}\right){}{{s}}^{{2}}{+}\left({12}{}{\mathrm{\pi }}{}\sqrt{\left|{c}\right|}{}{b}{}{c}{-}{12}{}{\mathrm{\pi }}{}\sqrt{\left|{c}\right|}{}{d}\right){}{s}{+}{12}{}\left|{c}\right|{}{c}{}{b}{-}{12}{}\left|{c}\right|{}{d}}{{20}{}{a}{}{\mathrm{\pi }}{}\sqrt{\left|{c}\right|}{}{s}}\end{array}\right$ (14)
 • Calculate the controller parameters using the TL method
 > $\mathrm{Ppars}≔\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{method}'=\mathrm{TL},'\mathrm{controller}'=P,'\mathrm{factored}'=\mathrm{true},'\mathrm{returntype}'=\mathrm{record}\right)$
 ${\mathrm{Ppars}}{≔}{\mathrm{Record}}{[}{\mathrm{packed}}{]}{}\left({K}{=}\frac{{2}}{{5}}{}\frac{{b}{}{c}{-}{d}}{{a}}\right)$ (15)
 > $\mathrm{PIpars}≔\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{method}'=\mathrm{TL},'\mathrm{controller}'=\mathrm{Π},'\mathrm{returntype}'=\mathrm{record}\right)$
 ${\mathrm{PIpars}}{≔}{\mathrm{Record}}{[}{\mathrm{packed}}{]}{}\left({\mathrm{Kp}}{=}\frac{{31}}{{100}}{}\frac{{b}{}{c}{-}{d}}{{a}}{,}{\mathrm{Ki}}{=}\frac{{31}}{{440}}{}\frac{\left({b}{}{c}{-}{d}\right){}\sqrt{\left|{c}\right|}}{{a}{}{\mathrm{π}}}\right)$ (16)
 > $\mathrm{PIsys}≔\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{method}'=\mathrm{TL},'\mathrm{controller}'=\mathrm{Π},'\mathrm{returntype}'=\mathrm{system}\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{PIsys}\right)$
 $\left[\begin{array}{l}{\mathbf{Transfer Function}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({s}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({s}\right)\right]\\ {{\mathrm{tf}}}_{{1}{,}{1}}{=}\frac{\left({682}{}{\mathrm{\pi }}{}{b}{}{c}{-}{682}{}{\mathrm{\pi }}{}{d}\right){}{s}{+}{155}{}\sqrt{\left|{c}\right|}{}{b}{}{c}{-}{155}{}\sqrt{\left|{c}\right|}{}{d}}{{2200}{}{a}{}{\mathrm{\pi }}{}{s}}\end{array}\right$ (17)
 > $\mathrm{ZNFreq}\left({\mathrm{Params}}_{1},{\mathrm{Params}}_{2},'\mathrm{method}'=\mathrm{TL},'\mathrm{controller}'=\mathrm{PID},'\mathrm{factored}'=\mathrm{true},'\mathrm{returntype}'=\mathrm{list}\right)$
 $\left[\frac{{9}}{{20}}{}\frac{{b}{}{c}{-}{d}}{{a}}{,}\frac{{22}}{{5}}{}\frac{{\mathrm{π}}}{\sqrt{\left|{c}\right|}}{,}\frac{{8}}{{25}}{}\frac{{\mathrm{π}}}{\sqrt{\left|{c}\right|}}\right]$ (18)

References

 [1] K. J. Astrom and T. Hagglund, Advanced PID Control, ISA, 2006.
 [2] T. K. Kiong, W. Quing-Guo, H. C. Chieh and T. Hagglund, Advances in PID Control, Springer, 1999.