PIDopt.tex 18.4 KB
Newer Older
1
2
\documentclass[a4paper]{article}
\usepackage[left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}
3
4
\usepackage{amsmath}
\usepackage{filecontents}
5
\usepackage{xspace}
6
7
8
9
10
11
12
13
14

\usepackage{tikz}
\usetikzlibrary{shapes,positioning}
\usetikzlibrary{narrow}

\tikzset{block/.style={draw, rectangle, line width=2pt, minimum height=3em, minimum width=3em, outer sep=0pt}}
\tikzset{sumcircle/.style={draw, circle, outer sep=0pt,label=center:{{\Large$+$}}, minimum width=2em}}
\tikzset{every picture/.style={auto, line width=1pt, >=narrow,x=1mm, y=1mm, font=\small}}

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
\begin{filecontents}{\jobname.bib}
@article{pidfIAE,
author={Soltesz, Kristian and Grimholt, Chriss and Skogestad, Sigurd},
title={Simultaneous Design of {PID} Controller and Measurement Filter by Optimization},
journal={{IET Control Theory \& Applications}},
volume=11,
number=3,
year=2017,
pages={348--348},
doi={10.1049/iet-cta.2016.0297}
}

@inproceedings{pidIAE,
author={Grimholt, Chriss and Skogestad, Sigurd},
title={Improved Optimization-based Design of {PID} Controllers Using Exact Gradients},
booktitle={12th International Symposium on Process Systems Engineering and 25th European Symposium on Computer Aided Process Engineering},
address={Copenhagen, Denmark},
year=2015,
pages={1753--1756},
isbn={978-0-444-63445-0 (eBook)}
}

@inproceedings{pidIE,
Kristian Soltesz's avatar
Kristian Soltesz committed
38
author={Hast, Martin and {\AA}str{\"o}m, Karl Johan and Bernhardsson, Bo and Boyd, Stephen},
39
40
41
42
43
44
45
title={{PID} Design by Convex-Concave Optimization},
booktitle={{IEEE} European Control Conference ({ECC})},
address={Z\"{u}rish, Switzerland},
year=2013,
pages={4460--4465},
isbn={978-3-033-03962-9 (eBook)}
}
Kristian Soltesz's avatar
Kristian Soltesz committed
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

@book{astrom06,
author={{\AA}str{\"o}m, Karl Johan and H{\"a}gglund, Tore},
title={Advanced {PID} Control},
year=2006,
publisher={{ISA} - The Instrumentation, Systems and Automation Society},
isbn={978-1-55617-942-6}
}

@article{hast15,
author={Hast, Martin and H{\"a}gglund, Tore},
title={Optimal proportional-integral-derivative set-point weighting and tuning rules for proportional set-point weights},
journal={{IET Control Theory \& Applications}},
volume=9,
number=15,
year=2015,
pages={2266--2272},
doi={10.1049/iet-cta.2015.0171}
}

@phdthesis{garpinger15,
author={Garpinger, Olof},
title={Analysis and Design of Software-Based Optimal {PID} Controllers},
year=2015,
school={Department of Automatic Control, Lund University, Sweden},
number={{TFRT-1105}}
}
73
\end{filecontents}
74
75
76
77
78

\newcommand{\figref}[1]{Figure~\ref{fig:#1}}
\newcommand{\secref}[1]{Section~\ref{sec:#1}}
\newcommand{\tabref}[1]{Table~\ref{tab:#1}}

79
80
81
82
\newcommand{\pidIE}{\href{https://gitlab.control.lth.se/kristian/PIDopt/blob/master/pidIE.m}{\tt pidIE.m}\xspace}
\newcommand{\pidIAE}{\href{https://gitlab.control.lth.se/kristian/PIDopt/blob/master/pidIAE.m}{\tt pidIiAE.m}\xspace}
\newcommand{\pidfIAE}{\href{https://gitlab.control.lth.se/kristian/PIDopt/blob/master/pidfIAE.m}{\tt pidfIAE.m}\xspace}
\newcommand{\PIDopt}{\href{https://gitlab.control.lth.se/kristian/PIDopt}{\tt PIDopt} }
83

84
85
86
\bibliographystyle{plain}
\usepackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother
87
\usepackage{hyperref}
88
\makeatletter\let\@bibitem\saved@bibitem\makeatother
89

90
\begin{document}
91
92
\nobibliography*

93
\title{{PIDopt} -- Matlab software for robust optimization-based\\{PID} controller design}
94
95
96
\author{Kristian Soltesz}
\date{\today}
\maketitle
97
\section{Acknowledgement\label{sec:ack}}
98
The software consists of three scripts for {PID}. The underlying methods for these files are:
99
\begin{itemize}
100
\item\pidfIAE\\
101
102
\bibentry{pidfIAE}

103
\item\pidIAE\\
104
105
\bibentry{pidIAE}

106
\item\pidIE\\
107
108
109
\bibentry{pidIE}
\end{itemize}

110
\noindent The code present in the \PIDopt package is due to the authors of the above works. Please acknowledge these works through citation if you use the methods in your research.
111
112

\section{Getting started}
113
\subsection{Installation}
114
The software can be downloaded from the git repository \url{git@gitlab.control.lth.se:kristian/PIDopt.git}, accessible online at \url{https://gitlab.control.lth.se/kristian/PIDopt}. See\\\href{https://gitlab.control.lth.se/kristian/PIDopt/blob/master/example.m}{\tt example.m} at the base of the repository for an example illustrating how to run and evaluate the designs.
115

116
To run the software you will need Matlab. In addition, \pidIE relies on CVX for Matlab, which can be downloaded for free from \url{http://www.cvxr.com}.
117

118
\subsection{Bug reporting}
119
Feel free to report/correct bugs through the issue system available at \url{https://gitlab.control.lth.se/kristian/PIDopt/issues}. Make sure to read \secref{practical}, and check so that your issue has not already been reported, before opening a new issue.
120

121
The remainder of this document is dedicated to briefly describe the design method (\secref{design}), and to provide . If you remain with any questions, please send them to \href{mailto:kristian@control.lth.se}{\tt kristian@control.lth.se}.
122
\clearpage
123
\section{Design Methods\label{sec:design}}
124
\subsection{Design problem}
125
126
127
\begin{figure}[t]
\centering
\begin{tikzpicture}
128
129
130
131
\node[block](K){$K$};
\node[sumcircle,right=13mm of K](sum2){};
\node[block,right=10mm of sum2](P){$P$};
\node[sumcircle,right=10mm of P](sum3){};
132
\node[block,below=9mm of sum2](FB){$-1$};
133
\node[sumcircle,left=12mm of K](sum){};
134
\node[coordinate, left=10mm of sum](ref){};
135
\node[coordinate, right=12mm of sum3](output){};
136
\node[coordinate, above=10mm of sum2](dist){};
137
\node[coordinate, above=10mm of sum3](noise){};
138
\draw[->](ref)--node[xshift=-1mm](){$r$}(sum);
139
140
141
\draw[->](sum)--node[xshift=-1mm](){$e$}(K);
\draw[->](K)--node(){$u$}(sum2);
\draw[->](sum2)--(P);
142
\draw[->](dist)--node[yshift=2mm](){$l$}(sum2);
143
144
145
\draw[->](noise)--node[yshift=2mm](){$n$}(sum3);
\draw[->](P)--(sum3);
\draw[->](sum3)--node[xshift=0mm](Y){$y$}(output);
146
147
\draw[->](Y)|-(FB);
\draw[->](FB)-|(sum);
148
149
\end{tikzpicture}
\label{fig:cc}
150
\caption{The considered closed-loop control system with process $P$ and (filtered) PID controller $K$. The reference $r$ is not considered here ($r=0$ can be assumed). The remaining signals are the control error $e$, the control signal $u$, the measurement signal $y$, the load disturbance $l$, and measurement noise $n$.}
151
152
\end{figure}

153
All the design methods consider a closed-loop system as depicted in \figref{cc}. The process model $P$ is a SISO LTI system. The design objective is to minimize the influence of an additive (unit) load disturbance step $l$, entering at the process input at $t=0$, on the control error $e$, see \figref{cc}. In \pidIE (see \cite{pidIE} for details) the objective is to minimize the integral error,
154
155
156
\begin{equation}
\text{IE} = \int_0^\infty e(t) dt,
\end{equation}
157
whereas \pidIAE (see \cite{pidIAE} for details) and \pidfIAE (see \cite{pidfIAE} for details) aim to minimize the $\mathcal{L}_1$-norm of $e$, also known as the integrated absolute error,
158
159
160
\begin{equation}
\text{IAE} = \int_0^\infty |e(t)| dt.
\end{equation}
161
These objectives are standard within process control, and sound within a much broader application scope. A thorough introduction is provided in \cite{astrom06}.
162
163
164
165
166
167
168
169
170
171
172

Robustness of the control loop is enforced by constraining the sensitivity function
\begin{equation}
S = \dfrac{1}{1+L},
\nonumber
\end{equation}
the complementary sensitivity function
\begin{equation}
T = \dfrac{L}{1+L},
\nonumber
\end{equation}
173
as well as the noise sensitivity function $KS$. We use $L=KP$ to denote the loop transfer function. Interpretation of The sensitivity function $S$ and its complement $T=1-S$ are thoroughly covered in most introductory control textbooks, such as \cite{astrom06}. The noise sensitivity $KS$ is the transfer function from $y$ to $u$ in \figref{cc}, and determines how much measurement noise is attenuated (or amplified). Noise sensitivity is further discussed in \cite{pidfIAE}. The methods covered here impose robustness through $\mathcal{H}_\infty$-constraints:
174
175
176
177
178
179
180
\begin{align}
\|S\|_\infty &\leq M_s,\nonumber\\
\|T\|_\infty &\leq M_t,\nonumber\\
\|KS\|_\infty &\leq M_{ks}.\nonumber
\end{align}
Smaller values of $M_s$, $M_t$, and $M_{ks}$, correspond to better robustness, but typically correspond to an increase in objective. A reasonable default is $M_s=M_t=1.5$. It is not possible to give a default for $M_{ks}$ as it is unit dependent -- it is affected by the gain of $P$.

181
182
The reader is referred to the works listed in \secref{ack} for detailed information on the methods used to solve the constrained optimization problems described above. Related aspects of practical relevance are given in \secref{practical}.

183
\subsection{Controller and filter structure}
184
Process and controller representation herein is in continuous time. The controllers synthesized by \pidIE and \pidIAE are on the form
185
186
187
188
\begin{equation}
K(s) = k_p+\dfrac{ki}{s}+k_ds.
\label{eq:pid}
\end{equation}
189
Their (more common) parallel form representation,
190
\begin{equation}
191
K(s) = K\left(1+\dfrac{1}{T_i s} + T_ds \right),\nonumber
192
\end{equation}
193
can be obtained through $K=k_p$, $T_i=k_p/k_i$, $T_d=k_d/k_p$. See for example \cite{astrom06} if your controller needs to be on series form.
194

195
The controllers synthesized by \pidfIAE are a series connection of a controller on the form \eqref{eq:pid} and a second-order low-pass filter,
196
\begin{equation}
197
F(s) = \dfrac{1}{T^2s^2+2\zeta T s +1}.
198
\label{eq:filter}
199
\end{equation}
200
The filter is implemented with relative damping $\zeta=1/\sqrt{2}$. The role of the filter is to ensure high-frequency roll-off. In order to achieve this also with \pidIE and \pidIAE, simply design a low-pass filter and include it as a series connected component of $P$ prior to conducting the design.
201

202
\subsection{Which method to use?}
Kristian Soltesz's avatar
Kristian Soltesz committed
203
The robustness constraints are generally not convex in the controller parameters. The optimum (when either IE or IAE is minimized) is still unique for many processes \cite{garpinger15}, although it is possible to construct pathological examples, for which this is not true.
204
205
206
207
208
209
210

Minimizing IE \eqref{eq:ie}, as is done by \pidIE, has the advantage of being equivalent to maximizing $k_i$ of the controller \eqref{eq:pid}. This makes the objective convex (actually linear) in the controller parameters, while also being independent of the process dynamics. The resulting constrained optimization problem makes it possible to apply a very fast convex-concave method \cite{pidIE}. Furthermore, for closed-loop systems with a non-oscillating load step response it holds that IE and IAE are equal. Combinations of poor performance and low IE-values are, however, possible for oscillating responses, as illustrated in \figref{ievsiae}. In practice, this can be avoided by reasonable constraints on sensitivity and complementary sensitivity. For instance, the controllers optimized by \pidIE and \pidIAE, respectively, yield almost equivalent IAE-values for all processes of the extensive test batch reported in \cite{}, when $M_s=M_t=1.5$ is used.
\begin{figure}[b]
\centering
\caption{The figure shows the load step response of two closed-loop control systems. They both have equal IE values, while the IAE of the blue response is only half of that of the red response. IAE is consequently a more reliable performance measure for systems where oscillating load step responses cannot be ruled out.}
\label{fig:ievsiae}
\end{figure}
211

212
A disadvantage with \pidIE, is that it does not provide low-pass filtering of the control signal. Hence the high-frequency asymptote associated with the derivative part is infinite. This generally results in poor noise attenuation properties. It is possible to limit the noise sensitivity by constraining $M_{ks}$, but since the optimization is carried out over a frequency grid, there is no guaranteed for frequencies. Also, constraining $M_{ks}$ in \pidIE (as well as \pidIAE) typically results in severe performance degradation (in terms of the optimization objective).
213

214
The \pidIAE and \pidfIAE methods rely on gradient-based methods to find a (local optimum) to the constrained optimization design problem. Since most practical applications result in problems with unique optima, the methods are broadly applicable. They both rely on computing the sensitivities of objective and constraints with respect to the controller (and filter) parameters, in order to obtain the Jacobian matrix by the optimization tool. They execute slower than \pidIE, and since the two often result in similar performance, \pidIE is almost always preferred to \pidIAE for practical purposes.
215

216
In addition to the PID controller, \pidfIAE, synthesizes a low-pass filter \eqref{eq:filter}, which allows for a controller with high-frequency roll-off, and thus good noise attenuation properties. This makes constraining $K_{ks}$ practically feasible. An alternative is to manually iterate between filter and controller design, and incorporate the filter as a series connected component of $P$ when running either \pidIE or \pidIAE. In this context, it can can be mentioned that it is common in academic work on PID control to consider minimization of IAE or IE under constraints on sensitivity (and complementary sensitivity), while disregarding noise sensitivity. One reason for this might be that it is complicated to decide on a reasonable constraint level, as it depends both on the gain of the process and on the spectral density of the measurement noise. However, disregarding noise sensitivity can result in very aggressive controllers, not suitable for practical use.
217

218
219
220
\section{Practical aspects\label{sec:practical}}
Below is an unsorted list of practical aspects, which could be worth considering.
\begin{itemize}
221

222
\item\emph{Frequency grid} All three design scripts supplied in \PIDopt rely on frequency domain design over a finite set of points (referred to as the frequency grid). It is crucial that this grid is selected sufficiently dense over the frequency range withing which constraints can be expected to be active. In most PID control applications, the bandwidth of the closed-loop system lies reasonably close to that of the controlled process, making it possible to select this grid based on process dynamics alone. The provided scripts rely on process-dependent frequency grids, which work most of the time. For certain use cases, it might, however, be necessary or desirable to change the method of grid selection by modifying the scripts. Relatedly, there is no restriction on using identical grids for the individual constraints. It is advisable to evaluate constraint fulfilment on denser grids than the ones used in the optimization, as there is no guarantee on the behaviour between grid points.
223

224
\item\emph{Feasible initial controller} The \pidIE script relies on a feasible initial controller. For inherently stable processes, the zero controller $k_p=k_i=k_d$ constitutes a feasible choice. If the process is unstable, a stabilizing controller needs to be obtained -- methods for this are not provided within \PIDopt. The \pidIAE and \pidfIAE scripts do not explicitly rely on a stable initial controller. However, computation time is normally shortened if the initial controller has similar properties to the optimal one. In cases with local optima, a \emph{good} initial controller is also desirable
225

226
227
\item\emph{Hot-start}
A viable strategy to decrease computational speed when using \pidfIAE is to use the result of \pidIE (invokes with the same process and constraint levels) as initial controller (together with a small filter constant) to hot-start the optimization. See \url{https://gitlab.control.lth.se/kristian/PIDopt/blob/master/example.m} for an example of this.
228

229
230
\item\emph{Stability}
The time domain evaluation of IAE in \pidIAE and \pidfIAE ensures stability. The convex-concave method used in \pidIE does not involve the time domain, only the gridded frequency domain. While robustness is ensured, stability is not. It is therefore possible to end up with robustly \emph{unstable} controllers. This is why it is important that an initially stabilizing controller is supplied to \pidIE. Relatedly, there is a possibility that the optimizer jumps from a robustly stable controller to a robustly unstable one between two iterations. However, the practical risk for this is very with a reasonably dense and wide frequency grid.
231

232
\item\emph{Filter damping} The relative damping of the filter \eqref{eq:filter} optimized by \pidfIAE could of course be set to another value. It is also straightforward to modify the code, so that the filter damping is co-optimized with the controller parameters and filter time constants. This is not done in the supplied code, as the performance increase did not justify the encountered computational overhead, in for the few examples it has been evaluated in.
233

234
\item\emph{Discrete time} All process models and controllers in \PIDopt are continuous time LTI objects. Continuous time was chosen in favor of discrete time only because many control system designers have better intuition for it. It is straight forward to discretize the obtained controllers. Likewise, it should be straight forward to modify the scripts for discrete time designs -- the underlying methods are not particularity geared toward continuous time implementation. 
235

236
237
\item\emph{Alternative objectives and constraints}
It is straight forward to impose constraints on other closed-loop transfer functions. In \pidIAE and \pidfIAE it would also be possible to change the objective to minimization of for instance the integrated square error (ISE), being the $\mathcal{L}_2$-norm of the load response $e$ (of which IAE is the $\mathcal{L}_1$-norm). The choices in the provided code were motivated by what is most commonly used in industrial applications. It is also possible to impose frequency-dependent robustness constraints, in which each frequency grid point is independently constrained.
238

Kristian Soltesz's avatar
Kristian Soltesz committed
239
\item\emph{Reference handling} The transfer functions from reference $r$ to control signal $u$ and measurement $y$ has not been considered. The reason for this is that they can be shaped by adding a reference pre-filter in combination with a feed-forward path from $r$ to $u$, to shape these transfer functions once the feedback controller $K$ has been designed. See for instance \cite{hast15} for a discussion on the topic.
240

241
242
243
\item\emph{Active constraints} For most practical design scenarios, at least one of the robustness constraints will be active. There are many situations, where the degrees of freedom result in only one active constraints.
\item\emph{Hessian matrix} The current implementations of \pidIAE and \pidfIAE relies on a Jacobian obtained through exact gradient computations. It is likely that computational efficiency could be improved by also providing a Hessian computed by similar means (rather than by finite differences).
\end{itemize}
244

Kristian Soltesz's avatar
Kristian Soltesz committed
245
246
%\nobibliography{\jobname} % FIXME: add references here
\bibliography{\jobname}
247
\end{document}