2020-11-30 17:44:13 +01:00
#+TITLE : A brief and practical introduction to $\mathcal{H}_\infty$ Control
2020-11-25 19:35:11 +01:00
:DRAWER:
#+STARTUP : overview
#+LANGUAGE : en
#+EMAIL : dehaeze.thomas@gmail.com
#+AUTHOR : Dehaeze Thomas
#+HTML_LINK_HOME : ../index.html
#+HTML_LINK_UP : ../index.html
2020-11-25 19:37:47 +01:00
#+HTML_HEAD : <link rel="stylesheet" type="text/css" href="https://research.tdehaeze.xyz/css/style.css"/>
#+HTML_HEAD : <script type="text/javascript" src="https://research.tdehaeze.xyz/js/script.js"></script>
2020-11-25 19:35:11 +01:00
#+HTML_MATHJAX : align: center tagside: right font: TeX
2020-12-04 23:38:01 +01:00
#+BIND : org-latex-image-default-option "scale=1"
#+BIND : org-latex-image-default-width ""
#+LaTeX_CLASS : scrreprt
2020-12-04 23:54:53 +01:00
#+LaTeX_CLASS_OPTIONS : [a4paper, 10pt, DIV=12, parskip=full]
2020-12-04 23:38:01 +01:00
#+LaTeX_HEADER_EXTRA : \input{preamble.tex}
2020-12-02 19:01:04 +01:00
#+CSL_STYLE : ieee.csl
2020-11-25 19:35:11 +01:00
#+PROPERTY : header-args:matlab :session *MATLAB*
#+PROPERTY : header-args:matlab+ :comments org
#+PROPERTY : header-args:matlab+ :results none
#+PROPERTY : header-args:matlab+ :exports both
#+PROPERTY : header-args:matlab+ :eval no-export
#+PROPERTY : header-args:matlab+ :output-dir figs
#+PROPERTY : header-args:matlab+ :tangle no
#+PROPERTY : header-args:matlab+ :mkdirp yes
#+PROPERTY : header-args:shell :eval no-export
#+PROPERTY : header-args:latex :headers '("\\usepackage{tikz}" "\\usepackage{import}" "\\import{$HOME/Cloud/tikz/org/}{config.tex}")
#+PROPERTY : header-args:latex+ :imagemagick t :fit yes
#+PROPERTY : header-args:latex+ :iminoptions -scale 100% -density 150
#+PROPERTY : header-args:latex+ :imoutoptions -quality 100
#+PROPERTY : header-args:latex+ :results file raw replace
#+PROPERTY : header-args:latex+ :buffer no
2020-11-30 17:44:13 +01:00
#+PROPERTY : header-args:latex+ :tangle no
2020-11-25 19:35:11 +01:00
#+PROPERTY : header-args:latex+ :eval no-export
#+PROPERTY : header-args:latex+ :exports results
#+PROPERTY : header-args:latex+ :mkdirp yes
#+PROPERTY : header-args:latex+ :output-dir figs
#+PROPERTY : header-args:latex+ :post pdf2svg(file=*this*, ext="png")
:END:
2020-12-05 00:08:03 +01:00
#+begin_export html
<hr >
<p >This document is also available as a <a href="./index.pdf" >pdf</a >.</p >
<hr >
#+end_export
2020-12-04 23:38:01 +01:00
* LaTeX Config :noexport:
#+begin_src emacs-lisp :tangle no
(setq org-latex-default-table-environment "tabular")
2020-12-04 23:54:53 +01:00
(setq org-latex-tables-booktabs t)
2020-12-04 23:38:01 +01:00
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{float}
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{caption,tabularx,booktabs}
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{biblatex}
\addbibresource{ref.bib}
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{fontawesome}
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{caption}
\usepackage{subcaption}
\captionsetup[figure]{labelfont=bf}
\captionsetup[subfigure]{labelfont=bf}
\captionsetup[listing]{labelfont=bf}
\captionsetup[table]{labelfont=bf}
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{xcolor}
\definecolor{my-blue}{HTML}{6b7adb}
\definecolor{my-pale-blue}{HTML}{e6e9f9}
\definecolor{my-red}{HTML}{db6b6b}
\definecolor{my-pale-red}{HTML}{f9e6e6}
\definecolor{my-green}{HTML}{6bdbb6}
\definecolor{my-pale-green}{HTML}{e6f9f3}
\definecolor{my-yellow}{HTML}{dbd26b}
\definecolor{my-pale-yellow}{HTML}{f9f7e6}
\definecolor{my-orange}{HTML}{dba76b}
\definecolor{my-pale-orange}{HTML}{f9f0e6}
\definecolor{my-grey}{HTML}{a3a3a3}
\definecolor{my-pale-grey}{HTML}{f0f0f0}
\definecolor{my-turq}{HTML}{6bc7db}
\definecolor{my-pale-turq}{HTML}{e6f6f9}
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{inconsolata}
\usepackage[newfloat=true, chapter]{minted}
\usemintedstyle{autumn}
\setminted{frame=lines,breaklines=true,tabsize=4,fontsize= \scriptsize,autogobble=true,labelposition=topline,bgcolor=my-pale-grey}
\setminted[matlab]{label=Matlab}
\setminted[latex]{label=LaTeX}
\setminted[bash]{label=Bash}
\setminted[python]{label=Python}
\setminted[text]{label=Results}
\setmintedinline{fontsize=\normalsize,bgcolor=my-pale-grey}
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage[most]{tcolorbox}
\tcbuselibrary{minted}
\newtcolorbox{seealso}[1][]{ enhanced,breakable,colback=my-pale-grey,colframe=my-grey,fonttitle= \bfseries,title=See Also,#1}
\newtcolorbox{hint}[1][]{ enhanced,breakable,colback=my-pale-grey,colframe=my-grey,fonttitle= \bfseries,title=Hint,#1}
\newtcolorbox{definition}[1][]{enhanced,breakable,colback=my-pale-red, colframe=my-red, fonttitle= \bfseries,title=Definition,#1}
\newtcolorbox{important}[1][]{ enhanced,breakable,colback=my-pale-red, colframe=my-red, fonttitle= \bfseries,title=Important,#1}
\newtcolorbox{exampl}[1][]{ enhanced,breakable,colback=my-pale-green,colframe=my-green,fonttitle= \bfseries,title=Example,#1}
\newtcolorbox{exercice}[1][]{ enhanced,breakable,colback=my-pale-yellow,colframe=my-yellow,fonttitle= \bfseries,title=Exercice,#1}
\newtcolorbox{question}[1][]{ enhanced,breakable,colback=my-pale-yellow,colframe=my-yellow,fonttitle= \bfseries,title=Question,#1}
\newtcolorbox{answer}[1][]{ enhanced,breakable,colback=my-pale-turq,colframe=my-turq,fonttitle= \bfseries,title=Answer,#1}
\newtcolorbox{summary}[1][]{ enhanced,breakable,colback=my-pale-blue,colframe=my-blue,fonttitle= \bfseries,title=Summary,#1}
\newtcolorbox{caution}[1][]{ enhanced,breakable,colback=my-pale-orange,colframe=my-orange,fonttitle= \bfseries,title=Caution,#1}
\newtcolorbox{warning}[1][]{ enhanced,breakable,colback=my-pale-orange,colframe=my-orange,fonttitle= \bfseries,title=Warning,#1}
#+end_src
#+begin_src latex :tangle preamble.tex
\newtcolorbox{my-quote}[1]{%
colback=my-pale-grey,
grow to right by=-10mm,
grow to left by=-10mm,
boxrule=0pt,
boxsep=0pt,
breakable,
enhanced jigsaw,
borderline west={4pt}{0pt}{my-grey}}
\renewenvironment{quote}{\begin{my-quote}}{\end{my-quote}}
#+end_src
#+begin_src latex :tangle preamble.tex
\newtcolorbox{my-verse}[1]{%
colback=my-pale-grey,
grow to right by=-10mm,
grow to left by=-10mm,
boxrule=0pt,
boxsep=0pt,
breakable,
enhanced jigsaw,
borderline west={4pt}{0pt}{my-grey}}
\renewenvironment{verse}{\begin{my-verse}}{\end{my-verse}}
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{environ}% http://ctan.org/pkg/environ
\NewEnviron{aside}{%
\marginpar{\BODY}
}
#+end_src
#+begin_src latex :tangle preamble.tex
\renewenvironment{verbatim}{\VerbatimEnvironment\begin{minted}[]{text}}{\end{minted}}
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{soul}
\sethlcolor{my-pale-grey}
\let\OldTexttt\texttt
\renewcommand{\texttt}[1]{{\ttfamily\hl{\mbox{\,#1\,}}}}
#+end_src
#+begin_src latex :tangle preamble.tex
\makeatletter
\preto\Gin@extensions{png,}
\DeclareGraphicsRule{.png}{pdf}{.pdf}{\noexpand\Gin@base.pdf}
\makeatother
#+end_src
#+begin_src latex :tangle preamble.tex
\usepackage{hyperref}
\hypersetup{
colorlinks = true,
allcolors = my-blue
}
\usepackage{hypcap}
#+end_src
* Introduction
:PROPERTIES:
:UNNUMBERED: t
:END:
2020-12-01 00:23:13 +01:00
2020-12-02 11:00:11 +01:00
The purpose of this document is to give a /practical introduction/ to the wonderful world of $\mathcal{H}_\infty$ Control.
No attend is made to provide an exhaustive treatment of the subject.
$\mathcal{H}_\infty$ Control is a very broad topic and entire books are written on it.
Therefore, for more advanced discussion, please have a look at the recommended references at the bottom of this document.
When possible, Matlab scripts used for the example/exercises are provided such that you can easily test them on your computer.
The general structure of this document is as follows:
- A short introduction to /model based control/ is given in Section [[sec:model_based_control ]]
2020-12-01 00:23:13 +01:00
- Classical /open/ loop shaping method is presented in Section [[sec:open_loop_shaping ]].
2020-12-02 11:00:11 +01:00
It is also shown that $\mathcal{H}_\infty$ synthesis can be used for /open/ loop shaping
- Important concepts indispensable for $\mathcal{H}_\infty$ control such as the $\mathcal{H}_ \infty$ norm and the generalized plant are introduced in Section [[sec:h_infinity_introduction ]]
- A very important step in $\mathcal{H}_\infty$ control is to express the control specifications (performances, robustness, etc.) as an $\mathcal{H}_ \infty$ optimization problem. Such procedure is described in Section [[sec:modern_interpretation_specification ]]
- One of the most useful use of the $\mathcal{H}_\infty$ control is the shaping of closed-loop transfer functions.
Such technique is presented in Section [[sec:closed-loop-shaping ]]
2020-12-03 12:13:53 +01:00
- Finally, complete examples of the use of $\mathcal{H}_\infty$ Control for practical problems are provided in Section [[sec:h_infinity_mixed_sensitivity ]]
2020-12-01 00:23:13 +01:00
2020-11-25 19:35:11 +01:00
* Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<<matlab-dir >>
#+end_src
#+begin_src matlab :exports none :results silent :noweb yes
<<matlab-init >>
#+end_src
2020-11-30 17:44:13 +01:00
#+begin_src matlab :tangle no
addpath('matlab')
#+end_src
2020-12-01 00:23:13 +01:00
* Introduction to Model Based Control
2020-11-30 17:44:13 +01:00
<<sec:model_based_control >>
** Model Based Control - Methodology
<<sec:model_based_control_methodology >>
2020-11-25 19:35:11 +01:00
2020-12-02 17:01:03 +01:00
The typical methodology for *Model Based Control* techniques is schematically shown in Figure [[fig:control-procedure ]].
2020-11-25 19:35:11 +01:00
It consists of three steps:
2020-12-02 17:01:03 +01:00
1. *Identification or modeling* : a mathematical model $G(s)$ representing the plant dynamics is obtained
2020-11-25 19:35:11 +01:00
2. *Translate the specifications into mathematical criteria* :
- _Specifications_ : Response Time, Noise Rejection, Maximum input amplitude, Robustness, ...
2020-12-02 17:01:03 +01:00
- _Mathematical Criteria_ : Cost Function, Shape of transfer function, Phase/Gain margin, Roll-Off, ...
3. *Synthesis* : research of a controller $K(s)$ that satisfies the specifications for the model of the system
2020-11-25 19:35:11 +01:00
#+begin_src latex :file control-procedure.pdf
\begin{tikzpicture}
\node[addb={+}{}{}{}{-}] (addsub) at (0, 0){};
\node[block, right=1.5 of addsub] (controller) {Controller};
\node[block, right=1.5 of controller] (plant) {Plant};
\node[block, above=1 of controller] (controller_design) {Synthesis};
\node[block, above=1 of plant] (model_plant) {Model};
\draw[<-] (addsub.west) -- ++(-1, 0) node[above right]{$r$};
\draw[->] (addsub) -- (controller.west) node[above left]{$\epsilon$};
\draw[->] (controller) -- (plant.west) node[above left]{$u$};
\draw[->] (plant.east) -- ++(1, 0) node[above left]{$y$};
\draw[] ($(plant.east) + (0.5, 0)$) -- + +(0, -1);
\draw[->] ($(plant.east) + (0.5, -1)$) -| (addsub.south);
\draw[->, dashed] (plant) -- node[midway, right, labelc, solid]{1} (model_plant);
\draw[->, dashed] (controller_design) --node[midway, right, labelc, solid]{3} (controller);
\draw[->, dashed] (model_plant) -- (controller_design);
\draw[<-, dashed] (controller_design.west) -- node[midway, above, labelc, solid]{2} ++(-1, 0) node[left, style={align=center}]{Specifications};
\end{tikzpicture}
#+end_src
#+name : fig:control-procedure
#+caption : Typical Methodoly for Model Based Control
#+RESULTS :
[[file:figs/control-procedure.png ]]
2020-12-02 17:01:03 +01:00
In this document, we will suppose a model of the plant is available (step 1 already performed), and we will focus on steps 2 and 3.
In Section [[sec:open_loop_shaping ]], steps 2 and 3 will be described for a control techniques called *classical (open-)loop shaping* .
2020-11-25 19:35:11 +01:00
2020-12-02 17:01:03 +01:00
Then, steps 2 and 3 for the *$\mathcal{H}_\infty$ Loop Shaping* of closed-loop transfer functions will be discussed in Sections [[sec:modern_interpretation_specification ]], [[sec:closed-loop-shaping ]] and [[sec:h_infinity_mixed_sensitivity ]].
2020-12-01 00:23:13 +01:00
** From Classical Control to Robust Control
2020-11-30 17:44:13 +01:00
<<sec:comp_classical_modern_robust_control >>
2020-11-25 19:35:11 +01:00
2020-12-02 17:01:03 +01:00
Many different model based control techniques have been developed since the birth of /classical control theory/ in the '30s.
*Classical control* methods were developed starting from 1930 based on tools such as the Laplace and Fourier transforms.
It was then natural to study systems in the frequency domain using tools such as the Bode and Nyquist plots.
Controllers were manually tuned to optimize criteria such as control bandwidth, gain and phase margins.
The '60s saw the development of control techniques based on a state-space.
Linear algebra and matrices were used instead of the frequency domain tool of the class control theory.
This allows multi-inputs multi-outputs systems to be easily treated.
Kalman introduced the well known /Kalman estimator/ as well the notion of optimality by minimizing quadratic cost functions.
This set of developments is loosely termed *Modern Control* theory.
By the 1980's, modern control theory was shown to have some robustness issues and to lack the intuitive tools that the classical control methods were offering.
This led to a new control theory called *Robust control* that blends the best features of classical and modern techniques.
This robust control theory is the subject of this document.
The three presented control methods are compared in Table [[tab:comparison_control_methods ]].
Note that in parallel, there have been numerous other developments, including non-linear control, adaptive control, machine-learning control just to name a few.
2020-12-04 23:38:01 +01:00
2020-11-27 23:13:29 +01:00
#+name : tab:comparison_control_methods
#+caption : Table summurazing the main differences between classical, modern and robust control
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width \linewidth :align lccc
2020-12-04 23:38:01 +01:00
| <l> | <c> | <c> | <c> |
| | *Classical Control* | *Modern Control* | *Robust Control* |
|---------------+---------------------+--------------------------+-------------------------------|
| *Date* | 1930- | 1960- | 1980- |
|---------------+---------------------+--------------------------+-------------------------------|
| *Tools* | Transfer Functions | State Space formulation | Systems/Signal Norms |
| | Nyquist, Bode Plots | Riccati Equations | Closed Loop TF |
| | Root Locus | Kalman Filters | Closed Loop Shaping |
| | Phase/Gain margins | | Weighting Functions |
| | Open Loop Shaping | | Disk margin |
|---------------+---------------------+--------------------------+-------------------------------|
| *Controllers* | P, PI, PID | Full State Feedback | General Control Conf. |
| | Leads, Lags | LQG, LQR | |
|---------------+---------------------+--------------------------+-------------------------------|
| *Advantages* | Study Stability | Automatic Synthesis | Automatic Synthesis |
| | Simple | MIMO | MIMO |
| | Natural | Optimization Problem | Optimization Problem |
| | | | Guaranteed Robustness |
|---------------+---------------------+--------------------------+-------------------------------|
| *Disadvant.* | Manual Method | No Guaranteed Robustness | Requires knowledge of tools |
| | Only SISO | Rejection of Pert. | Need good model of the system |
| | No input usage lim. | | |
2020-11-27 18:26:06 +01:00
2020-11-30 19:42:57 +01:00
#+begin_src latex :file robustness_performance.pdf
\begin{tikzpicture}
% Scale
\def\yscale{0.8}
\def\xscale{1.0}
% Colors
\def\colorstart{blue}
\def\colorend{red}
% Axis
\draw [->] (-0.5,0) -- (10*\xscale,0) node[below left]{Robustness};
\draw [->] (0,-0.5) -- (0,10*\yscale) node[below left, rotate=90, anchor=south east]{Performance};
% Color Bar
\shade[draw, bottom color=\colorstart, top color= \colorend, fill opacity=0.5] (10*\xscale, 1* \yscale) rectangle (11*\xscale, 9* \yscale);
\node[rotate=90, above] at (10*\xscale, 5* \yscale) {Required information on plant};
\node[above] at (10.5*\xscale, 1* \yscale) {little};
\node[below] at (10.5*\xscale, 9* \yscale) {large};
% ===================================
% Classical Control
% ===================================
% Control Types
\node[align=center] (pid) at (7.0*\xscale, 1.2* \yscale) {PID\\Lead-Lag};
\begin{scope}[on background layer]
% Control Families
\node[ellipse, draw, dashed, minimum width=3.0*\xscale cm, minimum height=2.0* \yscale cm,
fill=\colorstart!90!\colorend, fill opacity=0.5, text opacity=1]
(classicalcontrol) at (pid) {};
\end{scope}
\node[above, align=center] at (classicalcontrol.north) {\textbf{Classical control} (1930)\\{\small SISO, Manual Method}};
% ===================================
% ===================================
% Modern Control
% ===================================
% Control Types
\node[align=center] (lqg) at (2.0*\xscale, 7.5* \yscale) {LQR\\LQG};
\begin{scope}[on background layer]
\node[ellipse, draw, dashed, minimum width=2.0*\xscale cm, minimum height=2.0* \yscale cm,
fill=\colorstart!20!\colorend, fill opacity=0.5, text opacity=1]
(moderncontrol) at (lqg) {};
\end{scope}
\node[above, align=center] at (moderncontrol.north) {\textbf{Modern control} (1960)\\{\small MIMO, Optimal}};
% ===================================
% ===================================
% Robust Control
% ===================================
% Control Types
\node[align=center] (hinf) at (4.5*\xscale, 4.8* \yscale) {$H_\infty$\\$H_2$};
\node[] (mu) at (5.5*\xscale, 4.8* \yscale) {$\mu$};
\begin{scope}[on background layer]
\node[ellipse, draw, dashed, minimum width=3.0*\xscale cm, minimum height=2.5* \yscale cm,
shade, left color=\colorstart!50!\colorend, right color= \colorstart!10!\colorend, fill opacity=0.5, text opacity=1]
(robustcontrol) at ($0.5*(hinf)+0.5* (mu)$) {};
\end{scope}
\node[above, align=center] at (robustcontrol.north) {\textbf{Robust control} (1990)\\{\small MIMO, Robust}};
% ===================================
\end{tikzpicture}
#+end_src
2020-12-02 17:01:03 +01:00
# #+name: fig:robustness_performance
# #+caption: Comparison of the performance and robustness of classical control methods, modern control methods and robust control methods. The required information on the plant to succesfuly apply each of the control methods are indicated by the colors.
# #+RESULTS:
# [[file:figs/robustness_performance.png]]
2020-11-30 19:42:57 +01:00
2020-11-27 18:26:06 +01:00
** Example System
2020-11-30 17:44:13 +01:00
<<sec:example_system >>
2020-11-27 18:26:06 +01:00
2020-12-02 17:01:03 +01:00
Throughout this document, multiple examples and practical application of presented control strategies will be provided.
Most of them will be applied on a physical system presented in this section.
This system is shown in Figure [[fig:mech_sys_1dof_inertial_contr ]].
It could represent an active suspension stage supporting a payload.
The /inertial/ motion of the payload is measured using an inertial sensor and this is feedback to a force actuator.
Such system could be used to actively isolate the payload (disturbance rejection problem) or to make it follow a trajectory (tracking problem).
The notations used on Figure [[fig:mech_sys_1dof_inertial_contr ]] are listed and described in Table [[tab:example_notations ]].
2020-11-27 18:26:06 +01:00
#+begin_src latex :file mech_sys_1dof_inertial_contr.pdf
\begin{tikzpicture}
% Parameters
\def\massw{3}
\def\massh{1}
\def\spaceh{1.8}
% Ground
\draw[] (-0.5*\massw, 0) -- (0.5* \massw, 0);
% Mass
\draw[fill=white] (-0.5*\massw, \spaceh) rectangle (0.5* \massw, \spaceh+\massh) node[pos=0.5](m){$m$};
% Spring, Damper, and Actuator
\draw[spring] (-0.3*\massw, 0) -- (-0.3* \massw, \spaceh) node[midway, left=0.1]{$k$};
\draw[damper] ( 0, 0) -- ( 0, \spaceh) node[midway, left=0.3]{$c$};
\draw[actuator] ( 0.3*\massw, 0) -- (0.3* \massw, \spaceh) node[midway](F){};
% Displacements
\draw[dashed] (0.5*\massw, 0) -- ++(0.5, 0);
\draw[->] (0.6*\massw, 0) -- ++(0, 0.5) node[below right]{$d$};
% Inertial Sensor
\node[inertialsensor] (inertials) at (0.5*\massw, \spaceh+\massh){};
\node[addb={+}{-}{}{}{}, right=0.8 of inertials] (subf) {};
\node[block, below=0.4 of subf] (K){$K(s)$};
\draw[->] (inertials.east) node[above right]{$y$} -- (subf.west);
\draw[->] (subf.south) -- (K.north) node[above right]{$\epsilon$};
\draw[<-] (subf.north) -- ++(0, 0.6) node[below right]{$r$};
\draw[->] (K.south) |- (F.east) node[above right]{$u$};
\end{tikzpicture}
#+end_src
#+name : fig:mech_sys_1dof_inertial_contr
#+caption : Test System consisting of a payload with a mass $m$ on top of an active system with a stiffness $k$, damping $c$ and an actuator. A feedback controller $K(s)$ is added to position / isolate the payload.
#+RESULTS :
[[file:figs/mech_sys_1dof_inertial_contr.png ]]
#+name : tab:example_notations
#+caption : Example system variables
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width \linewidth :align cXcc
2020-11-27 18:26:06 +01:00
| *Notation* | *Description* | *Value* | *Unit* |
|--------------------+----------------------------------------------------------------+----------------+-----------|
2020-11-27 23:13:29 +01:00
| $m$ | Payload's mass to position / isolate | $10$ | [kg] |
| $k$ | Stiffness of the suspension system | $10^6$ | [N/m] |
| $c$ | Damping coefficient of the suspension system | $400$ | [N/(m/s)] |
2020-12-04 23:54:53 +01:00
|--------------------+----------------------------------------------------------------+----------------+-----------|
2020-11-27 18:26:06 +01:00
| $y$ | Payload absolute displacement (measured by an inertial sensor) | | [m] |
| $d$ | Ground displacement, it acts as a disturbance | | [m] |
| $u$ | Actuator force | | [N] |
| $r$ | Wanted position of the mass (the reference) | | [m] |
| $\epsilon = r - y$ | Position error | | [m] |
2020-12-04 23:54:53 +01:00
|--------------------+----------------------------------------------------------------+----------------+-----------|
2020-11-27 18:26:06 +01:00
| $K$ | Feedback controller | to be designed | [N/m] |
#+begin_exercice
Derive the following open-loop transfer functions:
\begin{align}
G(s) &= \frac{y}{u} \\
G_d(s) &= \frac{y}{d}
\end{align}
2020-11-27 23:13:29 +01:00
#+HTML : <details><summary>Hint</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Hint}
2020-11-27 23:13:29 +01:00
You can follow this generic procedure:
2020-11-27 18:26:06 +01:00
1. List all applied forces ot the mass: Actuator force, Stiffness force (Hooke's law), ...
2. Apply the Newton's Second Law on the payload
\[ m \ddot{y} = \Sigma F \]
3. Transform the differential equations into the Laplace domain:
\[ \frac{d\ \cdot}{dt} \Leftrightarrow \cdot \times s \]
4. Write $y(s)$ as a function of $u(s)$ and $w(s)$
2020-11-27 23:13:29 +01:00
#+HTML : </details>
#+HTML : <details><summary>Results</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Results}
2020-11-27 23:13:29 +01:00
\begin{align}
G(s) &= \frac{1}{m s^2 + cs + k} \\
G_d(s) &= \frac{cs + k}{m s^2 + cs + k}
\end{align}
#+HTML : </details>
2020-11-27 18:26:06 +01:00
#+end_exercice
2020-12-02 17:01:03 +01:00
Having obtained $G(s)$ and $G_d(s)$, we can transform the system shown in Figure [[fig:mech_sys_1dof_inertial_contr ]] into a classical feedback architecture as shown in Figure [[fig:open_loop_shaping ]].
2020-11-27 18:26:06 +01:00
#+begin_src latex :file classical_feedback_test_system.pdf
\begin{tikzpicture}
\node[addb={+}{}{}{}{-}] (addfb) at (0, 0){};
\node[block, right=0.8 of addfb] (K){$K(s)$};
\node[block, right=0.8 of K] (G){$G(s)$};
\node[addb={+}{}{}{}{}, right=0.8 of G] (addd){};
\node[block, above=0.5 of addd] (Gd){$G_d(s)$};
\draw[<-] (addfb.west) -- ++(-0.8, 0) node[above right]{$r$};
\draw[->] (addfb.east) -- (K.west) node[above left]{$\epsilon$};
\draw[->] (K.east) -- (G.west) node[above left]{$u$};
\draw[->] (G.east) -- (addd.west);
\draw[<-] (Gd.north) -- ++(0, 0.8) node[below right]{$d$};
\draw[->] (Gd.south) -- (addd.north);
\draw[->] (addd.east) -- ++(1.2, 0);
\draw[->] ($(addd.east) + (0.6, 0)$) node[branch]{} node[above]{$y$} -- + +(0, -1.0) -| (addfb.south);
\end{tikzpicture}
#+end_src
#+name : fig:classical_feedback_test_system
2020-12-02 17:01:03 +01:00
#+caption : Block diagram corresponding to the example system of Figure [[fig:mech_sys_1dof_inertial_contr]]
2020-11-27 18:26:06 +01:00
#+RESULTS :
[[file:figs/classical_feedback_test_system.png ]]
2020-11-27 23:13:29 +01:00
Let's define the system parameters on Matlab.
#+begin_src matlab +n
2020-11-27 18:26:06 +01:00
k = 1e6; % Stiffness [N/m]
c = 4e2; % Damping [N/(m/s)]
2020-11-27 23:13:29 +01:00
m = 10; % Mass [kg]
2020-11-27 18:26:06 +01:00
#+end_src
2020-12-02 17:01:03 +01:00
And now the system dynamics $G(s)$ and $G_d(s)$.
2020-11-27 23:13:29 +01:00
#+begin_src matlab +n -r
G = 1/(m*s^2 + c*s + k); % Plant
Gd = (c*s + k)/(m*s^2 + c*s + k); % Disturbance
2020-11-27 18:26:06 +01:00
#+end_src
2020-12-02 17:01:03 +01:00
The Bode plots of $G(s)$ and $G_d(s)$ are shown in Figures [[fig:bode_plot_example_afm ]] and [[fig:bode_plot_example_Gd ]].
2020-11-27 18:26:06 +01:00
#+begin_src matlab :exports none
2020-11-27 23:13:29 +01:00
freqs = logspace(0, 3, 1000);
2020-11-27 18:26:06 +01:00
figure;
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile([2,1]);
hold on;
plot(freqs, abs(squeeze(freqresp(G, freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Magnitude'); set(gca, 'XTickLabel',[]);
hold off;
2020-12-04 23:54:53 +01:00
ylim([1e-9, 1e-5]);
2020-11-27 18:26:06 +01:00
ax2 = nexttile;
hold on;
plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(G, freqs, 'Hz')))));
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
2020-12-04 23:54:53 +01:00
yticks(-360:90:360); ylim([-200, 20]);
2020-11-27 18:26:06 +01:00
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');
xlim([freqs(1), freqs(end)]);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
2020-12-04 23:54:53 +01:00
exportFig('figs/bode_plot_example_afm.pdf', 'width', 'wide', 'height', 'tall');
2020-11-27 18:26:06 +01:00
#+end_src
#+name : fig:bode_plot_example_afm
#+caption : Bode plot of the plant $G(s)$
#+RESULTS :
[[file:figs/bode_plot_example_afm.png ]]
2020-11-27 23:13:29 +01:00
#+begin_src matlab :exports none
freqs = logspace(0, 3, 1000);
figure;
2020-12-01 18:49:40 +01:00
tiledlayout(1, 1, 'TileSpacing', 'None', 'Padding', 'None');
nexttile;
2020-11-27 23:13:29 +01:00
hold on;
plot(freqs, abs(squeeze(freqresp(Gd, freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
hold off;
xlim([freqs(1), freqs(end)]);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/bode_plot_example_Gd.pdf', 'width', 'wide', 'height', 'small');
#+end_src
#+name : fig:bode_plot_example_Gd
#+caption : Magnitude of the disturbance transfer function $G_d(s)$
#+RESULTS :
[[file:figs/bode_plot_example_Gd.png ]]
* Classical Open Loop Shaping
2020-11-30 17:44:13 +01:00
<<sec:open_loop_shaping >>
2020-12-01 18:49:40 +01:00
** Introduction :ignore:
2020-12-02 19:01:04 +01:00
After an introduction to classical Loop Shaping in Section [[sec:open_loop_shaping_introduction ]], a practical example is given in Section [[sec:loop_shaping_example ]].
Such Loop Shaping is usually performed manually with tools coming from the classical control theory.
However, the $\mathcal{H}_\infty$ synthesis can be used to automate the Loop Shaping process.
This is presented in Section [[sec:h_infinity_open_loop_shaping ]] and applied on the same example in Section [[sec:h_infinity_open_loop_shaping_example ]].
2020-12-01 18:49:40 +01:00
2020-11-30 17:44:13 +01:00
** Introduction to Loop Shaping
<<sec:open_loop_shaping_introduction >>
2020-11-27 23:13:29 +01:00
#+begin_definition
2020-12-02 19:01:04 +01:00
*Loop Shaping* refers to a control design procedure that involves explicitly shaping the magnitude of the *Loop Transfer Function* $L(s)$.
2020-11-30 17:44:13 +01:00
#+end_definition
#+begin_definition
2020-12-02 19:01:04 +01:00
The *Loop Gain* (or Loop transfer function) $L(s)$ usually refers to as the product of the controller and the plant (see Figure [[fig:open_loop_shaping ]]):
2020-11-27 23:13:29 +01:00
\begin{equation}
L(s) = G(s) \cdot K(s) \label{eq:loop_gain}
\end{equation}
2020-12-02 19:01:04 +01:00
Its name comes from the fact that this is actually the "gain around the loop".
2020-11-27 23:13:29 +01:00
#+begin_src latex :file open_loop_shaping.pdf
\begin{tikzpicture}
\node[addb={+}{}{}{}{-}] (addsub) at (0, 0){};
\node[block, right=0.8 of addsub] (K) {$K(s)$};
\node[below] at (K.south) {Controller};
\node[block, right=0.8 of K] (G) {$G(s)$};
\node[below] at (G.south) {Plant};
\draw[<-] (addsub.west) -- ++(-0.8, 0) node[above right]{$r$};
\draw[->] (addsub) -- (K.west) node[above left]{$\epsilon$};
\draw[->] (K.east) -- (G.west) node[above left]{$u$};
\draw[->] (G.east) -- ++(0.8, 0) node[above left]{$y$};
\draw[] ($(G.east) + (0.5, 0)$) -- + +(0, -1.4);
\draw[->] ($(G.east) + (0.5, -1.4)$) -| (addsub.south);
\draw [decoration={brace, raise=5pt}, decorate] (K.north west) -- node[above=6pt]{$L(s)$} (G.north east);
\end{tikzpicture}
#+end_src
#+name : fig:open_loop_shaping
#+caption : Classical Feedback Architecture
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-11-27 23:13:29 +01:00
[[file:figs/open_loop_shaping.png ]]
#+end_definition
2020-12-02 19:01:04 +01:00
This synthesis method is one of main way controllers are design in the classical control theory.
It is widely used and generally successful as many characteristics of the closed-loop system depend on the shape of the open loop gain $L(s)$ such as:
- *Good Tracking* : $L$ large
2020-11-27 23:13:29 +01:00
- *Good disturbance rejection* : $L$ large
2020-12-02 19:01:04 +01:00
- *Attenuation of measurement noise on plant output* : $L$ small
- *Small magnitude of input signal* : $L$ small
2020-11-27 23:13:29 +01:00
- *Nominal stability* : $L$ small (RHP zeros and time delays)
- *Robust stability* : $L$ small (neglected dynamics)
2020-12-02 19:01:04 +01:00
The shaping of the Loop Gain is done manually by combining several leads, lags, notches...
This process is very much simplified by the fact that the loop gain $L(s)$ depends *linearly* on $K(s)$ eqref:eq:loop_gain.
A typical wanted Loop Shape is shown in Figure [[fig:open_loop_shaping_shape ]].
Another interesting Loop shape called "Bode Step" is described in cite:lurie02_system_archit_trades_using_bode.
2020-11-30 17:44:13 +01:00
#+begin_src latex :file open_loop_shaping_shape.pdf
\begin{tikzpicture}
% Phase Axis
\draw[->] (-0.3, -0.5) -- ++(8, 0) node[above]{$\omega$}; \draw[<-] (0, 0)
node[left]{$\angle L(j\omega)$} -- ++(0, -2.3);
% Gain Axis
\draw[->] (-0.3, 2) -- ++(8, 0) node[above]{$\omega$}; \draw[->] (0, 0.5) --
++(0, 3) node[left]{$\left|L(j\omega)\right|$};
% Gain Slopes
\draw[shift={(0,2)}] (0.5, 1.25) -- node[midway, above]{$-2$} (2, 0.5) --
node[midway, above]{$-1$} (6, -0.5) -- node[midway, below left]{$-2$} (7.5,
-1.25);
% Forbiden region
\path[shift={(0,1.8)}, fill=red!50!white] (0.5, 1.25) -- (2, 0.5) -| coordinate[near start](lfshaping) cycle;
\path[shift={(0,2.2)}, fill=red!50!white] (6, -0.5) -- (7.5, -1.25) |- coordinate[near end](hfshaping) cycle;
2020-12-02 19:01:04 +01:00
\draw[<-] (lfshaping) -- ++(0, -0.8) node[below, align=center]{{\scriptsize Ref. tracking}\\{\scriptsize Dist. rejection}};
\draw[<-] (hfshaping) -- ++(0, 0.8) node[above, align=center]{{\scriptsize Noise attenuation}};
2020-11-30 17:44:13 +01:00
% Crossover frequency
\node[below] (wc) at (4,2){$\omega_c$};
2020-12-02 19:01:04 +01:00
\draw[<-] (wc.south) -- ++(0, -0.4) node[below, align=center]{{\scriptsize Bandwidth}};
2020-11-30 17:44:13 +01:00
% Phase
\draw[] (0.5, -2) -- (2, -2)[out=0, in= -180] to (4, -1.25)[out=0, in= -180] to
(6, -2) -- (7.5, -2); \draw[] (0.5, -2) -- (2, -2)[out=0, in= -180] to (4,
-1.25)[out=0, in= -180] to (6, -2) -- (7.5, -2);
% Phase Margin
2020-12-02 19:01:04 +01:00
\draw[->, dashed] (4, -2) -- (4, -1.25) node[above]{{\scriptsize Phase Margin}};
2020-11-30 17:44:13 +01:00
\draw[dashed] (0, -2) node[left]{$-\pi$} -- (7.5, -2);
\end{tikzpicture}
#+end_src
#+name : fig:open_loop_shaping_shape
#+caption : Typical Wanted Shape for the Loop Gain $L(s)$
#+RESULTS :
[[file:figs/open_loop_shaping_shape.png ]]
2020-11-27 23:13:29 +01:00
2020-12-02 19:01:04 +01:00
The shaping of *closed-loop* transfer functions is obviously not as simple as they don't depend linearly on $K(s)$.
But this is were the $\mathcal{H}_\infty$ Synthesis will be useful!
More details on that in Sections [[sec:modern_interpretation_specification ]] and [[sec:closed-loop-shaping ]].
** Example of Manual Open Loop Shaping
2020-11-30 17:44:13 +01:00
<<sec:loop_shaping_example >>
2020-11-27 23:13:29 +01:00
#+begin_exampl
2020-12-02 19:01:04 +01:00
Let's take our example system described in Section [[sec:example_system ]] and design a controller using the Open-Loop shaping synthesis approach.
The specifications are:
1. *Disturbance rejection* : Highest possible rejection below 1Hz
2. *Positioning speed* : Bandwidth of approximately 10Hz
3. *Noise attenuation* : Roll-off of -40dB/decade past 30Hz
4. *Robustness* : Gain margin > 3dB and Phase margin > 30 deg
2020-11-27 23:13:29 +01:00
#+end_exampl
2020-11-27 18:26:06 +01:00
#+begin_exercice
2020-12-02 19:01:04 +01:00
Using =SISOTOOL= , design a controller that fulfills the specifications.
2020-11-27 18:26:06 +01:00
2020-12-01 00:23:13 +01:00
#+begin_src matlab :eval no :tangle no
2020-11-27 18:26:06 +01:00
sisotool(G)
#+end_src
2020-12-02 19:01:04 +01:00
#+HTML : <details><summary>Hint</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Hint}
2020-12-02 19:01:04 +01:00
You can follow this procedure:
1. In order to have good disturbance rejection at low frequency, add a simple or double *integrator*
2. In terms of the loop gain, the *bandwidth* can be defined at the frequency $\omega_c$ where $|l(j\omega_c)|$ first crosses 1 from above.
Therefore, adjust the *gain* such that $L(j\omega)$ crosses 1 at around 10Hz
3. The roll-off at high frequency for noise attenuation should already be good enough.
If not, add a *low pass filter*
4. Add a *Lead* centered around the crossover frequency (10 Hz) and tune it such that sufficient phase margin is added.
Verify that the gain margin is good enough.
#+HTML : </details>
#+end_exercice
2020-11-27 18:26:06 +01:00
2020-12-02 19:01:04 +01:00
Let's say we came up with the following controller.
2020-11-27 18:26:06 +01:00
#+begin_src matlab
2020-12-02 19:01:04 +01:00
K = 14e8 * ... % Gain
1/(s^2) * ... % Double Integrator
2020-11-27 23:13:29 +01:00
1/(1 + s/2/pi/40) * ... % Low Pass Filter
(1 + s/(2*pi*10/sqrt(8)))/(1 + s/(2*pi*10*sqrt(8))); % Lead
2020-11-27 18:26:06 +01:00
#+end_src
2020-12-02 19:01:04 +01:00
The bode plot of the Loop Gain is shown in Figure [[fig:loop_gain_manual_afm ]] and we can verify that we have the wanted stability margins using the =margin= command:
#+begin_src matlab
[Gm, Pm, ~, Wc] = margin(G*K)
#+end_src
#+begin_src matlab :exports results :results value table replace :tangle no :post addhdr(*this* )
data2orgtable([Gm; Pm; Wc/2/pi], {'Gain Margin $> 3$ [dB]', 'Phase Margin $> 30$ [deg]', 'Crossover $\approx 10$ [Hz]'}, {'Requirements', 'Manual Method'}, ' %.1f ');
#+end_src
#+RESULTS :
| Requirements | Manual Method |
|-----------------------------+---------------|
| Gain Margin $> 3$ [dB] | 3.1 |
| Phase Margin $> 30$ [deg] | 35.4 |
| Crossover $\approx 10$ [Hz] | 10.1 |
2020-11-27 18:26:06 +01:00
#+begin_src matlab :exports none
2020-11-27 23:13:29 +01:00
freqs = logspace(0, 3, 1000);
2020-11-27 18:26:06 +01:00
figure;
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile([2,1]);
hold on;
plot(freqs, abs(squeeze(freqresp(G*K, freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Magnitude'); set(gca, 'XTickLabel',[]);
hold off;
2020-11-27 23:13:29 +01:00
ylim([1e-4, 1e1])
2020-11-27 18:26:06 +01:00
ax2 = nexttile;
hold on;
plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(G*K, freqs, 'Hz')))));
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
yticks(-360:90:360); ylim([-360, 0]);
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');
xlim([freqs(1), freqs(end)]);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
2020-11-27 23:13:29 +01:00
exportFig('figs/loop_gain_manual_afm.pdf', 'width', 'wide', 'height', 'normal');
2020-11-27 18:26:06 +01:00
#+end_src
#+name : fig:loop_gain_manual_afm
#+caption : Bode Plot of the obtained Loop Gain $L(s) = G(s) K(s)$
#+RESULTS :
[[file:figs/loop_gain_manual_afm.png ]]
** $\mathcal{H}_\infty$ Loop Shaping Synthesis
2020-11-30 17:44:13 +01:00
<<sec:h_infinity_open_loop_shaping >>
2020-11-27 23:13:29 +01:00
2020-12-02 19:01:04 +01:00
The synthesis of controllers based on the Loop Shaping method can be automated using the $\mathcal{H}_\infty$ Synthesis.
2020-11-27 18:26:06 +01:00
2020-12-02 19:01:04 +01:00
Using Matlab, it can be easily performed using the =loopsyn= command:
2020-12-01 00:23:13 +01:00
#+begin_src matlab :eval no :tangle no
2020-12-02 19:01:04 +01:00
K = loopsyn(G, Lw);
2020-11-27 18:26:06 +01:00
#+end_src
where:
- =G= is the (LTI) plant
2020-12-02 19:01:04 +01:00
- =Lw= is the wanted loop shape
2020-11-27 18:26:06 +01:00
- =K= is the synthesize controller
#+begin_seealso
Matlab documentation of =loopsyn= ([[https://www.mathworks.com/help/robust/ref/loopsyn.html ][link ]]).
#+end_seealso
2020-12-02 19:01:04 +01:00
Therefore, by just providing the wanted loop shape and the plant model, the $\mathcal{H}_\infty$ Loop Shaping synthesis generates a /stabilizing/ controller such that the obtained loop gain $L(s)$ matches the specified one with an accuracy $\gamma$.
Even though we will not go into details and explain how such synthesis is working, an example is provided in the next section.
2020-11-27 18:26:06 +01:00
** Example of the $\mathcal{H}_\infty$ Loop Shaping Synthesis
2020-11-30 17:44:13 +01:00
<<sec:h_infinity_open_loop_shaping_example >>
2020-11-27 18:26:06 +01:00
2020-12-02 19:01:04 +01:00
To apply the $\mathcal{H}_\infty$ Loop Shaping Synthesis, the wanted shape of the loop gain should be determined from the specifications.
This is summarized in Table [[tab:open_loop_shaping_specifications ]].
Such shape corresponds to the typical wanted Loop gain Shape shown in Figure [[fig:open_loop_shaping_shape ]].
2020-11-27 18:26:06 +01:00
2020-12-02 19:01:04 +01:00
#+name : tab:open_loop_shaping_specifications
#+caption : Wanted Loop Shape corresponding to each specification
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width \linewidth :align lXX
2020-12-04 23:38:01 +01:00
| | *Specification* | *Corresponding Loop Shape* |
|--------------+----------------------------------------+------------------------------------------|
| *Dist. Rej.* | Highest possible rejection below 1Hz | Slope of -40dB/dec at low frequency |
| *Pos. Speed* | Bandwidth of approximately 10Hz | $L$ crosses 1 at 10Hz |
| *Noise Att.* | Roll-off of -40dB/decade past 30Hz | Roll-off of -40dB/decade past 30Hz |
| *Robustness* | $\Delta G > 3dB$, $\Delta \phi > 30^o$ | Slope of -20dB/decade near the crossover |
2020-11-27 18:26:06 +01:00
2020-12-02 19:01:04 +01:00
Then, a (stable, minimum phase) transfer function $L_w(s)$ should be created that has the same gain as the wanted shape of the Loop gain.
For this example, a double integrator and a lead centered on 10Hz are used.
Then the gain is adjusted such that the $|L_w(j2 \pi 10)| = 1$.
Using Matlab, we have:
2020-11-27 18:26:06 +01:00
#+begin_src matlab
2020-11-27 23:13:29 +01:00
Lw = 2.3e3 * ...
1/(s^2) * ... % Double Integrator
(1 + s/(2*pi*10/sqrt(3)))/(1 + s/(2*pi*10*sqrt(3))); % Lead
#+end_src
2020-11-27 18:26:06 +01:00
2020-12-02 19:01:04 +01:00
The $\mathcal{H}_\infty$ open loop shaping synthesis is then performed using the =loopsyn= command:
2020-11-27 23:13:29 +01:00
#+begin_src matlab
[K, ~, GAM] = loopsyn(G, Lw);
2020-11-27 18:26:06 +01:00
#+end_src
2020-12-02 19:01:04 +01:00
The obtained Loop Gain is shown in Figure [[fig:open_loop_shaping_hinf_L ]] and matches the specified one by a factor $\gamma \approx 2$.
2020-11-27 23:13:29 +01:00
2020-11-27 18:26:06 +01:00
#+begin_src matlab :exports none
2020-11-27 23:13:29 +01:00
freqs = logspace(0, 3, 1000);
2020-11-27 18:26:06 +01:00
2020-11-27 23:13:29 +01:00
figure;
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile([2,1]);
2020-12-02 19:01:04 +01:00
hold on;
plot(freqs, abs(squeeze(freqresp(G*K, freqs, 'Hz'))), 'DisplayName', '$L(s)$');
plot(freqs, abs(squeeze(freqresp(Lw, freqs, 'Hz'))), 'k--', 'DisplayName', '$L_w(s)$');
plot(freqs, abs(squeeze(freqresp(Lw, freqs, 'Hz')))*GAM, 'k-.', 'DisplayName', '$L_w(s) / \gamma$, $L_w(s) \cdot \gamma$');
plot(freqs, abs(squeeze(freqresp(Lw, freqs, 'Hz')))/GAM, 'k-.', 'HandleVisibility', 'off');
hold off;
2020-11-27 23:13:29 +01:00
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Magnitude'); set(gca, 'XTickLabel',[]);
hold off;
2020-12-02 19:01:04 +01:00
legend('location', 'northeast');
ylim([1e-4, 1e2]);
2020-11-27 23:13:29 +01:00
ax2 = nexttile;
2020-12-02 19:01:04 +01:00
hold on;
plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(G*K, freqs, 'Hz')))));
2020-11-27 23:13:29 +01:00
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
2020-12-02 19:01:04 +01:00
yticks(-360:90:360); ylim([-360, 0]);
2020-11-27 23:13:29 +01:00
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
2020-12-02 19:01:04 +01:00
hold off;
2020-11-27 23:13:29 +01:00
linkaxes([ax1,ax2],'x');
xlim([freqs(1), freqs(end)]);
2020-11-27 18:26:06 +01:00
#+end_src
2020-11-27 23:13:29 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
2020-12-02 19:01:04 +01:00
exportFig('figs/open_loop_shaping_hinf_L.pdf', 'width', 'wide', 'height', 'tall');
2020-11-27 18:26:06 +01:00
#+end_src
2020-12-02 19:01:04 +01:00
#+name : fig:open_loop_shaping_hinf_L
#+caption : Obtained Open Loop Gain $L(s) = G(s) K(s)$ and comparison with the wanted Loop gain $L_w$
2020-11-27 23:13:29 +01:00
#+RESULTS :
2020-12-02 19:01:04 +01:00
[[file:figs/open_loop_shaping_hinf_L.png ]]
2020-11-27 23:13:29 +01:00
2020-12-02 19:01:04 +01:00
#+begin_important
When using the $\mathcal{H}_\infty$ Synthesis, it is usually recommended to analyze the obtained controller.
This is usually done by breaking down the controller into simple elements such as low pass filters, high pass filters, notches, leads, etc.
#+end_important
Let's briefly analyze the obtained controller which bode plot is shown in Figure [[fig:open_loop_shaping_hinf_K ]]:
- two integrators are used at low frequency to have the wanted low frequency high gain
- a lead is added centered with the crossover frequency to increase the phase margin
- a notch is added at the resonance of the plant to increase the gain margin (this is very typical of $\mathcal{H}_\infty$ controllers, and can be an issue, more info on that latter)
2020-11-27 23:13:29 +01:00
2020-11-27 18:26:06 +01:00
#+begin_src matlab :exports none
2020-11-27 23:13:29 +01:00
freqs = logspace(0, 3, 1000);
2020-11-27 18:26:06 +01:00
figure;
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile([2,1]);
2020-12-02 19:01:04 +01:00
plot(freqs, abs(squeeze(freqresp(K, freqs, 'Hz'))));
2020-11-27 18:26:06 +01:00
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Magnitude'); set(gca, 'XTickLabel',[]);
hold off;
ax2 = nexttile;
2020-12-02 19:01:04 +01:00
plot(freqs, 180/pi*angle(squeeze(freqresp(K, freqs, 'Hz'))));
2020-11-27 18:26:06 +01:00
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
2020-12-02 19:01:04 +01:00
yticks(-360:90:360); ylim([-180, 90]);
2020-11-27 18:26:06 +01:00
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
linkaxes([ax1,ax2],'x');
xlim([freqs(1), freqs(end)]);
#+end_src
2020-11-27 23:13:29 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
2020-12-02 19:01:04 +01:00
exportFig('figs/open_loop_shaping_hinf_K.pdf', 'width', 'wide', 'height', 'normal');
2020-11-27 23:13:29 +01:00
#+end_src
2020-12-02 19:01:04 +01:00
#+name : fig:open_loop_shaping_hinf_K
#+caption : Obtained controller $K$ using the open-loop $\mathcal{H}_\infty$ shaping
2020-11-27 23:13:29 +01:00
#+RESULTS :
2020-12-02 19:01:04 +01:00
[[file:figs/open_loop_shaping_hinf_K.png ]]
2020-11-27 23:13:29 +01:00
2020-12-02 19:01:04 +01:00
Let's finally compare the obtained stability margins of the $\mathcal{H}_\infty$ controller and of the manually developed controller in Table [[tab:open_loop_shaping_compare ]].
2020-11-27 23:13:29 +01:00
#+begin_src matlab :exports none
[Gm_2, Pm_2, ~, Wc_2] = margin(G*K)
#+end_src
#+begin_src matlab :exports results :results value table replace :tangle no :post addhdr(*this* )
data2orgtable([Gm, Gm_2; Pm, Pm_2; Wc/2/pi, Wc_2/2/pi], {'Gain Margin $> 3$ [dB]', 'Phase Margin $> 30$ [deg]', 'Crossover $\approx 10$ [Hz]'}, {'Specifications', 'Manual Method', '$\mathcal{H}_ \infty$ Method'}, ' %.1f ');
#+end_src
#+name : tab:open_loop_shaping_compare
#+caption : Comparison of the characteristics obtained with the two methods
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width \linewidth :align Xcc
2020-11-27 23:13:29 +01:00
#+RESULTS :
2020-12-04 23:38:01 +01:00
| *Specifications* | *Manual Method* | *$\mathcal{H}_\infty$ Method* |
|-----------------------------+-----------------+-------------------------------|
| Gain Margin $> 3$ [dB] | 3.1 | 31.7 |
| Phase Margin $> 30$ [deg] | 35.4 | 54.7 |
| Crossover $\approx 10$ [Hz] | 10.1 | 9.9 |
2020-11-27 18:26:06 +01:00
2020-12-01 18:49:40 +01:00
* A first Step into the $\mathcal{H}_\infty$ world
2020-11-30 17:44:13 +01:00
<<sec:h_infinity_introduction >>
2020-12-01 18:49:40 +01:00
** Introduction :ignore:
2020-12-02 19:53:19 +01:00
In this section, the $\mathcal{H}_\infty$ Synthesis method, which is based on the optimization of the $\mathcal{H}_ \infty$ norm of transfer functions, is introduced.
2020-12-01 18:49:40 +01:00
2020-12-02 19:53:19 +01:00
After the $\mathcal{H}_\infty$ norm is defined in Section [[sec:h_infinity_norm ]], the $\mathcal{H}_\infty$ synthesis procedure is described in Section [[sec:h_infinity_synthesis ]] .
The generalized plant, a very useful tool to describe a control problem, is presented in Section [[sec:generalized_plant ]].
The $\mathcal{H}_\infty$ is then applied to this generalized plant in Section [[sec:h_infinity_general_synthesis ]].
Finally, an example showing how to convert a typical feedback control architecture into a generalized plant is given in Section [[sec:generalized_plant_derivation ]].
2020-12-01 18:49:40 +01:00
2020-11-27 23:13:29 +01:00
** The $\mathcal{H}_\infty$ Norm
2020-11-30 17:44:13 +01:00
<<sec:h_infinity_norm >>
2020-11-25 19:35:11 +01:00
#+begin_definition
2020-12-02 19:53:19 +01:00
The $\mathcal{H}_\infty$ norm of a multi-input multi-output system $G(s)$ is defined as the peak of the maximum singular value of its frequency response
2020-11-25 19:35:11 +01:00
\begin{equation}
\|G(s)\|_\infty = \max_ \omega \bar{\sigma}\big( G(j\omega) \big)
\end{equation}
2020-12-02 19:53:19 +01:00
For a single-input single-output system $G(s)$, it is simply the peak value of $|G(j\omega)|$ as a function of frequency:
2020-11-25 19:35:11 +01:00
\begin{equation}
\|G(s)\|_\infty = \max_ {\omega} |G(j\omega)| \label{eq:hinf_norm_siso}
\end{equation}
#+end_definition
#+begin_exampl
2020-11-30 17:44:13 +01:00
Let's compute the $\mathcal{H}_\infty$ norm of our test plant $G(s)$ using the =hinfnorm= function:
2020-11-25 19:35:11 +01:00
#+begin_src matlab :results value replace
hinfnorm(G)
#+end_src
#+RESULTS :
2020-11-27 23:13:29 +01:00
: 7.9216e-06
2020-11-25 19:35:11 +01:00
2020-12-02 19:53:19 +01:00
We can see in Figure [[fig:hinfinity_norm_siso_bode ]] that indeed, the $\mathcal{H}_\infty$ norm of $G(s)$ does corresponds to the peak value of $|G(j\omega)|$.
2020-11-25 19:35:11 +01:00
#+begin_src matlab :exports none
2020-11-27 23:13:29 +01:00
freqs = logspace(0, 3, 1000);
2020-11-25 19:35:11 +01:00
figure;
hold on;
plot(freqs, abs(squeeze(freqresp(G, freqs, 'Hz'))), 'k-');
2020-11-27 23:13:29 +01:00
plot([20, 100], [hinfnorm(G) hinfnorm(G)], 'k--');
text(100, hinfnorm(G), '$\quad \|G\|_\infty$')
2020-11-25 19:35:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude $|G(j\omega)|$');
ylim([1e-8, 2e-5]);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/hinfinity_norm_siso_bode.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name : fig:hinfinity_norm_siso_bode
#+caption : Example of the $\mathcal{H}_\infty$ norm of a SISO system
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-11-25 19:35:11 +01:00
#+RESULTS :
[[file:figs/hinfinity_norm_siso_bode.png ]]
#+end_exampl
2020-11-27 23:13:29 +01:00
** $\mathcal{H}_\infty$ Synthesis
2020-11-30 17:44:13 +01:00
<<sec:h_infinity_synthesis >>
#+begin_definition
2020-12-02 19:53:19 +01:00
The $\mathcal{H}_\infty$ synthesis is a method that uses an *algorithm* (LMI optimization, Riccati equation) to find a controller that stabilizes the system and that *minimizes* the $\mathcal{H}_ \infty$ norms of defined transfer functions.
2020-11-30 17:44:13 +01:00
#+end_definition
2020-12-02 19:53:19 +01:00
Why optimizing the $\mathcal{H}_\infty$ norm of transfer functions is a pertinent choice will become clear when we will translate the typical control specifications into the $\mathcal{H}_ \infty$ norm of transfer functions in Section [[sec:modern_interpretation_specification ]].
2020-11-25 19:35:11 +01:00
2020-12-02 19:53:19 +01:00
#+begin_important
Then applying the $\mathcal{H}_\infty$ synthesis to a plant, the engineer work usually consists of the following steps:
1. Write the problem as standard $\mathcal{H}_\infty$ problem using the generalized plant (described in the next section)
2. Translate the specifications as $\mathcal{H}_\infty$ norms of transfer functions (Section [[sec:modern_interpretation_specification ]])
3. Make the synthesis and analyze the obtained controller
2020-11-25 19:35:11 +01:00
2020-12-02 19:53:19 +01:00
As the $\mathcal{H}_\infty$ synthesis usually gives very high order controllers, an additional step that reduces the controller order is sometimes required for practical implementation.
#+end_important
2020-11-30 17:44:13 +01:00
Note that there are many ways to use the $\mathcal{H}_\infty$ Synthesis:
- Traditional $\mathcal{H}_\infty$ Synthesis (=hinfsyn= [[https://www.mathworks.com/help/robust/ref/hinfsyn.html ][doc ]])
- Open Loop Shaping $\mathcal{H}_\infty$ Synthesis (=loopsyn= [[https://www.mathworks.com/help/robust/ref/loopsyn.html ][doc ]])
- Mixed Sensitivity Loop Shaping (=mixsyn= [[https://www.mathworks.com/help/robust/ref/lti.mixsyn.html ][doc ]])
- Fixed-Structure $\mathcal{H}_\infty$ Synthesis (=hinfstruct= [[https://www.mathworks.com/help/robust/ref/lti.hinfstruct.html ][doc ]])
2020-12-01 18:49:40 +01:00
- Signal Based $\mathcal{H}_\infty$ Synthesis, and many more...
2020-11-25 19:35:11 +01:00
2020-11-27 23:13:29 +01:00
** The Generalized Plant
2020-11-30 17:44:13 +01:00
<<sec:generalized_plant >>
The first step when applying the $\mathcal{H}_\infty$ synthesis is usually to write the problem as a standard $\mathcal{H}_ \infty$ problem.
This consist of deriving the *Generalized Plant* for the current problem.
The generalized plant, usually noted $P(s)$, is shown in Figure [[fig:general_plant ]].
2020-12-02 19:53:19 +01:00
It has two /sets/ of inputs $[w,\,u]$ and two /sets/ of outputs $[z\,v]$ such that:
2020-11-30 17:44:13 +01:00
\begin{equation}
2020-12-02 19:53:19 +01:00
\begin{bmatrix} z \\ v \end{bmatrix} = P \begin{bmatrix} w \\ u \end{bmatrix}
2020-11-30 17:44:13 +01:00
\end{equation}
2020-12-02 19:53:19 +01:00
The meaning of these inputs and outputs are summarized in Table [[tab:notation_general ]].
A practical example about how to derive the generalized plant for a classical control problem is given in Section [[sec:generalized_plant_derivation ]].
2020-11-25 19:35:11 +01:00
#+begin_src latex :file general_plant.pdf
\begin{tikzpicture}
\node[block={2.0cm}{2.0cm}] (P) {$P$};
\node[above] at (P.north) {Generalized Plant};
% Input and outputs coordinates
\coordinate[] (inputw) at ($(P.south west)!0.75!(P.north west)$);
\coordinate[] (inputu) at ($(P.south west)!0.25!(P.north west)$);
\coordinate[] (outputz) at ($(P.south east)!0.75!(P.north east)$);
\coordinate[] (outputv) at ($(P.south east)!0.25!(P.north east)$);
% Connections and labels
\draw[<-] (inputw) -- ++(-0.8, 0) node[above right]{$w$};
\draw[<-] (inputu) -- ++(-0.8, 0) node[above right]{$u$};
\draw[->] (outputz) -- ++(0.8, 0) node[above left]{$z$};
\draw[->] (outputv) -- ++(0.8, 0) node[above left]{$v$};
\end{tikzpicture}
#+end_src
2020-12-02 19:53:19 +01:00
#+begin_important
2020-11-30 17:44:13 +01:00
#+name : fig:general_plant
#+caption : Inputs and Outputs of the generalized Plant
2020-12-04 23:38:01 +01:00
#+ATTR_LATEX : :float nil
2020-11-25 19:35:11 +01:00
#+RESULTS :
[[file:figs/general_plant.png ]]
#+name : tab:notation_general
#+caption : Notations for the general configuration
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width 0.8\linewidth :align cX :float nil
2020-12-04 23:38:01 +01:00
| *Notation* | *Meaning* |
|------------+----------------------------------------------------|
| $P$ | Generalized plant model |
| $w$ | Exogenous inputs: references, disturbances, noises |
| $z$ | Exogenous outputs: signals to be minimized |
| $v$ | Controller inputs: measurements |
| $u$ | Control signals |
2020-11-30 17:44:13 +01:00
#+end_important
2020-11-25 19:35:11 +01:00
2020-12-01 00:23:13 +01:00
** The $\mathcal{H}_\infty$ Synthesis applied on the Generalized plant
2020-11-30 17:44:13 +01:00
<<sec:h_infinity_general_synthesis >>
2020-11-25 19:35:11 +01:00
2020-11-30 17:44:13 +01:00
Once the generalized plant is obtained, the $\mathcal{H}_\infty$ synthesis problem can be stated as follows:
2020-11-25 19:35:11 +01:00
2020-11-30 17:44:13 +01:00
#+begin_important
- $\mathcal{H}_\infty$ Synthesis applied on the generalized plant ::
2020-12-02 19:53:19 +01:00
Find a stabilizing controller $K$ that, using the sensed outputs $v$, generates control signals $u$ such that the $\mathcal{H}_\infty$ norm of the closed-loop transfer function from $w$ to $z$ is minimized.
2020-11-30 17:44:13 +01:00
After $K$ is found, the system is /robustified/ by adjusting the response around the unity gain frequency to increase stability margins.
2020-12-02 19:53:19 +01:00
The obtained controller $K$ and the generalized plant are connected as shown in Figure [[fig:general_control_names ]].
2020-11-30 17:44:13 +01:00
#+begin_src latex :file general_control_names.pdf
2020-11-25 19:35:11 +01:00
\begin{tikzpicture}
2020-11-30 17:44:13 +01:00
% Blocs
\node[block={2.0cm}{2.0cm}] (P) {$P$};
\node[block={1.5cm}{1.5cm}, below=0.7 of P] (K) {$K$};
% Input and outputs coordinates
\coordinate[] (inputw) at ($(P.south west)!0.75!(P.north west)$);
\coordinate[] (inputu) at ($(P.south west)!0.25!(P.north west)$);
\coordinate[] (outputz) at ($(P.south east)!0.75!(P.north east)$);
\coordinate[] (outputv) at ($(P.south east)!0.25!(P.north east)$);
% Connections and labels
\draw[<-] (inputw) node[above left, align=right]{(weighted)\\exogenous inputs\\$w$} -- ++(-1.5, 0);
\draw[<-] (inputu) -- ++(-0.8, 0) |- node[left, near start, align=right]{control signals\\$u$} (K.west);
\draw[->] (outputz) node[above right, align=left]{(weighted)\\exogenous outputs\\$z$} -- ++(1.5, 0);
\draw[->] (outputv) -- ++(0.8, 0) |- node[right, near start, align=left]{sensed output\\$v$} (K.east);
2020-11-25 19:35:11 +01:00
\end{tikzpicture}
#+end_src
2020-11-30 17:44:13 +01:00
#+name : fig:general_control_names
#+caption : General Control Configuration
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-11-25 19:35:11 +01:00
#+RESULTS :
2020-11-30 17:44:13 +01:00
[[file:figs/general_control_names.png ]]
2020-12-02 19:53:19 +01:00
#+end_important
2020-11-30 17:44:13 +01:00
Using Matlab, the $\mathcal{H}_\infty$ Synthesis applied on a Generalized plant can be applied using the =hinfsyn= command ([[https://www.mathworks.com/help/robust/ref/hinfsyn.html ][documentation ]]):
2020-12-01 00:23:13 +01:00
#+begin_src matlab :eval no :tangoe no
2020-11-30 17:44:13 +01:00
K = hinfsyn(P, nmeas, ncont);
#+end_src
where:
- =P= is the generalized plant transfer function matrix
- =nmeas= is the number of sensed output (size of $v$)
- =ncont= is the number of control signals (size of $u$)
2020-12-02 19:53:19 +01:00
- =K= obtained controller (of size =ncont x nmeas= ) that minimizes the $\mathcal{H}_\infty$ norm from $w$ to $z$.
Note that the general control configure of Figure [[fig:general_control_names ]], as its name implies, is quite /general/ and can represent feedback control as well as feedforward control architectures.
2020-11-30 17:44:13 +01:00
** From a Classical Feedback Architecture to a Generalized Plant
<<sec:generalized_plant_derivation >>
The procedure to convert a typical control architecture as the one shown in Figure [[fig:classical_feedback_tracking ]] to a generalized Plant is as follows:
2020-12-02 19:53:19 +01:00
1. Define signals of the generalized plant: $w$, $z$, $u$ and $v$
2020-12-02 11:00:11 +01:00
2. Remove $K$ and rearrange the inputs and outputs to match the generalized configuration shown in Figure [[fig:general_plant ]]
2020-11-25 19:35:11 +01:00
#+begin_src latex :file classical_feedback_tracking.pdf
\begin{tikzpicture}
\node[addb={+}{}{}{}{-}] (addfb) at (0, 0){};
\node[block, right=0.8 of addfb] (K){$K(s)$};
\node[block, right=0.8 of K] (G){$G(s)$};
\draw[<-] (addfb.west) -- ++(-0.8, 0) node[above right]{$r$};
\draw[->] (addfb.east) -- (K.west) node[above left]{$\epsilon$};
\draw[->] (K.east) -- (G.west) node[above left]{$u$};
\draw[->] (G.east) -- ++(1.2, 0);
\draw[->] ($(G.east) + (0.6, 0)$) node[branch]{} node[above]{$y$} -- + +(0, -0.8) -| (addfb.south);
\end{tikzpicture}
#+end_src
#+begin_src latex :file mixed_sensitivity_ref_tracking.pdf
\begin{tikzpicture}
\node[block] (G) {$G(s)$};
\node[addb={+}{-}{}{}{}, right=0.6 of G] (addw) {};
\coordinate[above right=0.6 and 1.4 of addw] (u);
\coordinate[above=0.6 of u] (epsilon);
\coordinate[] (w) at ($(epsilon-|G.west)+(-1.4, 0)$);
\node[block, below left=0.8 and 0 of addw] (K) {$K(s)$};
% Connections
\draw[->] (G.east) -- (addw.west);
\draw[->] ($(addw.east)+(0.4, 0)$)node[branch]{} |- (epsilon) node[above left](z1){$\epsilon$};
\draw[->] ($(G.west)+(-0.4, 0)$)node[branch](start){} |- (u) node[above left](z2){$u$};
\draw[->] (addw.east) -- (addw-|z1) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} ($(G-|w)+(0.4, 0)$) -- (G.west);
\draw[->] (w) node[above]{$w = r$} -| (addw.north);
\draw [decoration={brace, raise=5pt}, decorate] (z1.north east) -- node[right=6pt]{$z$} (z2.south east);
\begin{scope}[on background layer]
\node[fit={(G.south-|start.west) ($(z1.north west)+(-0.4, 0)$)}, inner sep=6pt, draw, dashed, fill=black!20!white] (P) {};
2020-11-27 23:13:29 +01:00
\node[below] at (P.north) {Generalized Plant $P(s)$};
2020-11-25 19:35:11 +01:00
\end{scope}
\end{tikzpicture}
#+end_src
2020-11-27 23:13:29 +01:00
#+begin_exercice
2020-12-02 19:53:19 +01:00
Consider the feedback control architecture shown in Figure [[fig:classical_feedback_tracking ]].
Suppose we want to design $K$ using the general $\mathcal{H}_\infty$ synthesis, and suppose the signals to be minimized are the control input $u$ and the tracking error $\epsilon$.
1. Convert the control architecture to a generalized configuration
2. Compute the transfer function matrix of the generalized plant $P$ using Matlab as a function or $K$ and $G$
2020-11-25 19:35:11 +01:00
#+name: fig:classical_feedback_tracking
#+caption: Classical Feedback Control Architecture (Tracking)
2020-12-04 23:38:01 +01:00
#+attr_latex: :float nil
2020-11-25 19:35:11 +01:00
[[file:figs/classical_feedback_tracking.png ]]
2020-11-30 17:44:13 +01:00
#+HTML : <details><summary>Hint</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Hint}
2020-11-25 19:35:11 +01:00
First, define the signals of the generalized plant:
- Exogenous inputs: $w = r$
2020-12-02 11:00:11 +01:00
- Signals to be minimized:
Usually, we want to minimize the tracking errors $\epsilon$ and the control signal $u$: $z = [\epsilon,\ u]$
- Controller inputs: this is the signal at the input of the controller: $v = \epsilon$
2020-12-04 23:38:01 +01:00
- Controller outputs: signal generated by the controller: $u$
2020-11-25 19:35:11 +01:00
2020-12-02 11:00:11 +01:00
Then, Remove $K$ and rearrange the inputs and outputs as in Figure [[fig:general_plant ]].
2020-11-30 17:44:13 +01:00
#+HTML : </details>
#+HTML : <details><summary>Answer</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Anwser}
2020-11-30 17:44:13 +01:00
The obtained generalized plant shown in Figure [[fig:mixed_sensitivity_ref_tracking ]].
2020-11-25 19:35:11 +01:00
#+name: fig:mixed_sensitivity_ref_tracking
#+caption: Generalized plant of the Classical Feedback Control Architecture (Tracking)
2020-12-04 23:38:01 +01:00
#+attr_latex: :float nil
2020-11-25 19:35:11 +01:00
[[file:figs/mixed_sensitivity_ref_tracking.png ]]
2020-12-02 11:00:11 +01:00
Using Matlab, the generalized plant can be defined as follows:
#+begin_src matlab :tangle no :eval no
P = [1 -G;
0 1;
1 -G]
P.InputName = {'w', 'u'};
P.OutputName = {'e', 'u', 'v'};
#+end_src
2020-11-30 17:44:13 +01:00
#+HTML : </details>
#+end_exercice
2020-12-01 18:49:40 +01:00
* Modern Interpretation of Control Specifications
2020-11-30 17:44:13 +01:00
<<sec:modern_interpretation_specification >>
2020-12-01 18:49:40 +01:00
** Introduction :ignore:
2020-11-30 17:44:13 +01:00
2020-12-01 18:49:40 +01:00
As shown in Section [[sec:open_loop_shaping ]], the loop gain $L(s) = G(s) K(s)$ is a useful and easy tool when manually designing controllers.
This is mainly due to the fact that $L(s)$ is very easy to shape as it depends /linearly/ on $K(s)$.
2020-12-01 00:23:13 +01:00
Moreover, important quantities such as the stability margins and the control bandwidth can be estimated from the shape/phase of $L(s)$.
2020-11-30 19:42:57 +01:00
2020-12-03 01:07:02 +01:00
However, the loop gain $L(s)$ does *not* directly give the performances of the closed-loop system.
As a matter of fact, the behavior of the closed-loop system by the *closed-loop* transfer functions.
These are derived of a typical feedback architecture functions in Section [[sec:closed_loop_tf ]].
2020-12-01 00:23:13 +01:00
2020-12-03 01:07:02 +01:00
The modern interpretation of control specifications then consists of determining the *required shape of the closed-loop transfer functions* such that the system behavior corresponds to the requirements.
Once this is done, the $\mathcal{H}_\infty$ synthesis can be used to generate a controller that will *shape* the closed-loop transfer function as specified..
This method is presented in Section [[sec:closed-loop-shaping ]].
One of the most important closed-loop transfer function is called the *sensitivity function* .
Its link with the closed-loop behavior of the feedback system is studied in Section [[sec:sensitivity_transfer_functions ]].
The robustness (stability margins) of the system can also be linked to the shape of the sensitivity function with the use of the *module margin* (Section [[sec:module_margin ]]).
Links between typical control specifications and shapes of the closed-loop transfer functions are summarized in Section [[sec:other_requirements ]].
** Closed Loop Transfer Functions and the Gang of Four
<<sec:closed_loop_tf >>
Consider the typical feedback system shown in Figure [[fig:gang_of_four_feedback ]].
The behavior (performances) of this feedback system is determined by the closed-loop transfer functions from the inputs ($r$, $d$ and $n$) to the important signals such as $\epsilon$, $u$ and $y$.
Depending on the specification, different closed-loop transfer functions do matter.
These are summarized in Table [[tab:spec_closed_loop_tf ]].
2020-11-30 17:44:13 +01:00
#+begin_src latex :file gang_of_four_feedback.pdf
\begin{tikzpicture}
\node[addb={+}{}{}{}{-}] (addfb) at (0, 0){};
\node[block, right=0.8 of addfb] (K){$K(s)$};
\node[addb, right=0.8 of K] (addd){};
\node[block, right=0.8 of addd] (G){$G(s)$};
\node[addb, below right=0.4 and 0.2 of G] (addn){};
\draw[<-] (addfb.west) -- ++(-0.8, 0) node[above right]{$r$};
\draw[->] (addfb.east) -- (K.west) node[above left]{$\epsilon$};
\draw[->] (K.east) -- (addd.west);
\draw[<-] (addd.north) -- ++(0, 0.6) node[below right]{$d$};
\draw[->] (addd.east) -- (G.west) node[above left]{$u$};
\draw[->] (G.east) -- ++(1.6, 0) node[above left]{$y$};
\draw[->] (G-|addn) node[branch]{} -- (addn.north);
\draw[<-] (addn.east) -- ++(0.8, 0) node[above left]{$n$};
\draw[->] (addn.west) -| (addfb.south);
\end{tikzpicture}
#+end_src
#+name : fig:gang_of_four_feedback
2020-12-03 01:07:02 +01:00
#+caption : Simple Feedback Architecture with $r$ the reference signal, $\epsilon$ the tracking error, $d$ a disturbance acting at the plant input $u$, $y$ is the output signal and $n$ the measurement noise
2020-11-30 17:44:13 +01:00
#+RESULTS :
[[file:figs/gang_of_four_feedback.png ]]
2020-12-03 01:07:02 +01:00
#+name : tab:spec_closed_loop_tf
#+caption : Typical Specification and associated closed-loop transfer function
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width 0.8\linewidth :align Xl
2020-12-04 23:38:01 +01:00
| *Specification* | *CL Transfer Function* |
2020-12-03 01:07:02 +01:00
|--------------------------------+-----------------------------------------------|
| Reference Tracking | From $r$ to $\epsilon$ |
| Disturbance Rejection | From $d$ to $y$ |
| Measurement Noise Filtering | From $n$ to $y$ |
| Small Command Amplitude | From $n,r,d$ to $u$ |
| Stability | All |
| Robustness (stability margins) | Module margin (see Section [[sec:module_margin]]) |
2020-11-30 19:42:57 +01:00
2020-11-30 17:44:13 +01:00
#+begin_exercice
2020-12-03 01:07:02 +01:00
For the feedback system in Figure [[fig:gang_of_four_feedback ]], write the output signals $[\epsilon, u, y]$ as a function of the systems $K(s), G(s)$ and the input signals $[r, d, n]$.
2020-11-30 17:44:13 +01:00
#+HTML : <details><summary>Hint</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Hint}
2020-11-30 17:44:13 +01:00
Take one of the output (e.g. $y$), and write it as a function of the inputs $[d, r, n]$ going step by step around the loop:
2020-12-04 23:38:01 +01:00
\begin{align*}
2020-11-30 17:44:13 +01:00
y &= G u \\
&= G (d + K \epsilon) \\
&= G \big(d + K (r - n - y) \big) \\
&= G d + GK r - GK n - GK y
2020-12-04 23:38:01 +01:00
\end{align*}
2020-11-30 17:44:13 +01:00
Isolate $y$ at the right hand side, and finally obtain:
\[ y = \frac{GK}{1+ GK} r + \frac{G}{1 + GK} d - \frac{GK}{1 + GK} n \]
Do the same procedure for $u$ and $\epsilon$
#+HTML : </details>
2020-11-25 19:35:11 +01:00
2020-12-01 18:49:40 +01:00
#+HTML : <details><summary>Answer</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Answer}
2020-11-30 17:44:13 +01:00
The following equations should be obtained:
\begin{align}
y &= \frac{GK}{1 + GK} r + \frac{G}{1 + GK} d - \frac{GK}{1 + GK} n \\
\epsilon &= \frac{1 }{1 + GK} r - \frac{G}{1 + GK} d - \frac{G }{1 + GK} n \\
u &= \frac{K }{1 + GK} r - \frac{1}{1 + GK} d - \frac{K }{1 + GK} n
\end{align}
#+HTML : </details>
2020-11-27 23:13:29 +01:00
#+end_exercice
2020-11-30 19:42:57 +01:00
#+begin_important
2020-12-03 01:07:02 +01:00
We can see that they are 4 different closed-loop transfer functions describing the behavior of the feedback system in Figure [[fig:gang_of_four_feedback ]].
2020-11-30 19:42:57 +01:00
These called the *Gang of Four* :
2020-11-30 17:44:13 +01:00
\begin{align}
S &= \frac{1 }{1 + GK}, \quad \text{the sensitivity function} \\
T &= \frac{GK}{1 + GK}, \quad \text{the complementary sensitivity function} \\
GS &= \frac{G }{1 + GK}, \quad \text{the load disturbance sensitivity function} \\
KS &= \frac{K }{1 + GK}, \quad \text{the noise sensitivity function}
\end{align}
2020-11-30 19:42:57 +01:00
#+end_important
2020-11-27 23:13:29 +01:00
2020-11-30 17:44:13 +01:00
#+begin_seealso
If a feedforward controller is included, a *Gang of Six* transfer functions can be defined.
More on that in this [[https://www.youtube.com/watch?v=b_8v8scghh8 ][short video ]].
#+end_seealso
2020-11-27 23:13:29 +01:00
2020-12-03 01:07:02 +01:00
The behavior of the feedback system in Figure [[fig:gang_of_four_feedback ]] is fully described by the following set of equations:
2020-11-30 17:44:13 +01:00
\begin{align}
\epsilon &= S r - GS d - GS n \\
y &= T r + GS d - T n \\
u &= KS r - S d - KS n
\end{align}
2020-12-01 18:49:40 +01:00
Thus, for reference tracking, we have to shape the /closed-loop/ transfer function from $r$ to $\epsilon$, that is the sensitivity function $S(s)$.
Similarly, to reduce the effect of measurement noise $n$ on the output $y$, we have to act on the complementary sensitivity function $T(s)$.
2020-11-30 19:42:57 +01:00
2020-12-03 01:07:02 +01:00
** The Sensitivity Function
2020-11-30 17:44:13 +01:00
<<sec:sensitivity_transfer_functions >>
2020-12-01 18:49:40 +01:00
The sensitivity function is indisputably the most important closed-loop transfer function of a feedback system.
In this section, we will see how the shape of the sensitivity function will impact the performances of the closed-loop system.
2020-12-01 13:41:12 +01:00
Suppose we have developed a "/reference/ " controller $K_r(s)$ and made three small changes to obtained three controllers $K_1(s)$, $K_2(s)$ and $K_3(s)$.
2020-12-03 01:07:02 +01:00
The obtained sensitivity functions for these four controllers are shown in Figure [[fig:sensitivity_shape_effect ]] and the corresponding step responses are shown in Figure [[fig:sensitivity_shape_effect_step ]].
2020-11-30 17:44:13 +01:00
2020-12-01 13:41:12 +01:00
The comparison of the sensitivity functions shapes and their effect on the step response is summarized in Table [[tab:compare_sensitivity_shapes ]].
2020-11-30 17:44:13 +01:00
2020-12-01 13:41:12 +01:00
#+name : tab:compare_sensitivity_shapes
#+caption : Comparison of the sensitivity function shape and the corresponding step response for the three controller variations
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width 0.9\linewidth :align lXX
2020-12-04 23:38:01 +01:00
| *Controller* | *Sensitivity Function Shape* | *Change of the Step Response* |
|--------------+----------------------------------------------------+----------------------------------|
| $K_1(s)$ | Larger bandwidth $\omega_b$ | Faster rise time |
| $K_2(s)$ | Larger peak value $\Vert S\Vert_\infty$ | Large overshoot and oscillations |
| $K_3(s)$ | Larger low frequency gain $\vert S(j\cdot 0)\vert$ | Larger static error |
2020-12-01 13:41:12 +01:00
#+begin_src matlab :exports none
wc = 2*pi*1; L_w = 8; wi = 2*pi*0.02;
Kr = 1/((s + wi)^2) * ... % Double Integrator
(1 + s/(wc/sqrt(L_w)))/(1 + s/(wc*sqrt(L_w))); % Lead
Kr = Kr/abs(evalfr(Kr*G, j*wc));
wc = 2*pi*2; L_w = 8; wi = 2*pi*0.045;
K1 = 1/((s + wi)^2) * ... % Double Integrator
(1 + s/(wc/sqrt(L_w)))/(1 + s/(wc*sqrt(L_w))); % Lead
K1 = K1/abs(evalfr(K1*G, j*wc));
2020-11-30 17:44:13 +01:00
2020-12-01 13:41:12 +01:00
wc = 2*pi*1; L_w = 2; wi = 2*pi*0.03;
K2 = 1/((s + wi)^2) * ... % Double Integrator
(1 + s/(wc/sqrt(L_w)))/(1 + s/(wc*sqrt(L_w))); % Lead
K2 = K2/abs(evalfr(K2*G, j*wc));
wc = 2*pi*1; L_w = 8; wi = 2*pi*0.2;
K3 = 1/((s + wi)^2) * ... % Double Integrator
(1 + s/(wc/sqrt(L_w)))/(1 + s/(wc*sqrt(L_w))); % Lead
K3 = K3/abs(evalfr(K3*G, j*wc));
Sr = 1/(1 + Kr*G);
2020-11-30 17:44:13 +01:00
S1 = 1/(1 + K1*G);
S2 = 1/(1 + K2*G);
S3 = 1/(1 + K3*G);
2020-12-01 13:41:12 +01:00
Tr = Kr*G/(1 + Kr*G);
2020-11-30 17:44:13 +01:00
T1 = K1*G/(1 + K1*G);
T2 = K2*G/(1 + K2*G);
T3 = K3*G/(1 + K3*G);
#+end_src
2020-12-01 13:41:12 +01:00
#+begin_src matlab :exports none
freqs = logspace(-2, 2, 1000);
2020-11-30 17:44:13 +01:00
figure;
hold on;
2020-12-01 13:41:12 +01:00
plot(freqs, abs(squeeze(freqresp(S1, freqs, 'Hz'))), 'DisplayName', '$K_1(s)$');
plot(freqs, abs(squeeze(freqresp(S2, freqs, 'Hz'))), 'DisplayName', '$K_2(s)$');
plot(freqs, abs(squeeze(freqresp(S3, freqs, 'Hz'))), 'DisplayName', '$K_3(s)$');
plot(freqs, abs(squeeze(freqresp(Sr, freqs, 'Hz'))), 'k-', 'DisplayName', '$K_r(s)$');
2020-11-30 17:44:13 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frquency [Hz]'); ylabel('Sensitivity Magnitude');
hold off;
2020-12-01 13:41:12 +01:00
legend('location', 'southeast');
ylim([1e-3, 3]);
#+end_src
2020-11-30 17:44:13 +01:00
2020-12-01 13:41:12 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/sensitivity_shape_effect.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name : fig:sensitivity_shape_effect
#+caption : Sensitivity function magnitude $|S(j\omega)|$ corresponding to the reference controller $K_r(s)$ and the three modified controllers $K_i(s)$
#+RESULTS :
[[file:figs/sensitivity_shape_effect.png ]]
#+begin_src matlab :exports none
t = linspace(0, 5, 1000);
figure;
2020-11-30 17:44:13 +01:00
hold on;
2020-12-01 13:41:12 +01:00
plot(t, step(T1, t), 'DisplayName', '$K_1(s)$')
plot(t, step(T2, t), 'DisplayName', '$K_2(s)$')
plot(t, step(T3, t), 'DisplayName', '$K_3(s)$')
plot(t, step(Tr, t), 'k-', 'DisplayName', '$K_r(s)$')
2020-11-30 17:44:13 +01:00
hold off
xlabel('Time [s]'); ylabel('Step Response');
2020-12-01 13:41:12 +01:00
legend('location', 'northeast');
ylim([0, 1.7])
2020-11-30 17:44:13 +01:00
#+end_src
2020-12-01 13:41:12 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/sensitivity_shape_effect_step.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name : fig:sensitivity_shape_effect_step
#+caption : Step response (response from $r$ to $y$) for the different controllers
#+RESULTS :
[[file:figs/sensitivity_shape_effect_step.png ]]
#+begin_src latex :file h-infinity-spec-S.pdf
\begin{tikzpicture}
\begin{axis}[%
width=8cm,
height=4cm,
at={(0,0)},
xmode=log,
xmin=0.01,
xmax=10000,
ymin=-80,
ymax=40,
ylabel={Magnitude [dB]},
xlabel={Frequency [Hz]},
ytick={40, 20, 0, -20, -40, -60, -80},
xminorgrids,
yminorgrids
]
\addplot [thick, color=black, forget plot]
table[row sep=crcr]{%
0.01 -60\\
0.1 -60\\
190 6\\
10000 6\\
};
\draw[<-] (0.05, -60) -- (0.1, -70);
\draw (0.1, -70) -- (2, -70) node[right, fill=white, draw]{\footnotesize{Small static error}};
\draw[<-] (70, -3) -- (3, -3) node[left, fill=white, draw]{\footnotesize{Speed}};
\draw[<-] (300, 6) -- (200, 20);
\draw (200, 20) -- (10, 20) node[left, fill=white, draw]{\footnotesize{Robustness}};
\end{axis}
\end{tikzpicture}
#+end_src
#+begin_definition
- Closed-Loop Bandwidth ::
The closed-loop bandwidth $\omega_b$ is the frequency where $|S(j\omega)|$ first crosses $1/\sqrt{2} = -3dB$ from below.
In general, a large bandwidth corresponds to a faster rise time.
#+end_definition
#+begin_important
2020-12-03 01:07:02 +01:00
From the simple analysis above, we can draw a first estimation of the wanted shape for the sensitivity function (Figure [[fig:h-infinity-spec-S ]]):
2020-12-01 13:41:12 +01:00
- A small magnitude at low frequency to make the static errors small
- A wanted minimum closed-loop bandwidth in order to have fast rise time and good rejection of perturbations
2020-12-03 01:07:02 +01:00
- A small peak value (small $\mathcal{H}_\infty$ norm) in order to limit large overshoot and oscillations.
2020-12-01 13:41:12 +01:00
This generally means higher robustness.
This will become clear in the next section about the *module margin* .
#+name : fig:h-infinity-spec-S
#+caption : Typical wanted shape of the Sensitivity transfer function
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-12-01 13:41:12 +01:00
[[file:figs/h-infinity-spec-S.png ]]
#+end_important
2020-11-30 17:44:13 +01:00
** Robustness: Module Margin
<<sec:module_margin >>
2020-12-03 01:07:02 +01:00
Let's start this section by an example demonstrating why the phase and gain margins might not be good indicators of robustness.
Will follow a discussion about the module margin, a robustness indicator that can be linked to the $\mathcal{H}_\infty$ norm of $S$ and that will prove to be very useful.
2020-12-01 00:23:13 +01:00
#+begin_exampl
2020-12-03 01:07:02 +01:00
Consider the following plant $G_t(s)$:
2020-12-01 00:23:13 +01:00
#+begin_src matlab
w0 = 2*pi*100;
xi = 0.1;
k = 1e7;
Gt = 1/k*(s/w0/4 + 1)/ (s^2/w0^2 + 2*xi*s/w0 + 1);
#+end_src
2020-12-01 10:54:06 +01:00
Let's say we have designed a controller $K_t(s)$ that gives the loop gain shown in Figure [[fig:phase_gain_margin_model_plant ]].
#+begin_src matlab
Kt = 1.2e6*(s + w0)/s;
#+end_src
2020-12-03 01:07:02 +01:00
The following characteristics can be determined from the Loop gain in Figure [[fig:phase_gain_margin_model_plant ]]:
- Control bandwidth of $\approx 10\, \text{Hz}$
- Infinite gain margin (the phase of the loop-gain never reaches $-180^o$)
- More than $90^o$ of phase margin
2020-12-01 00:23:13 +01:00
2020-12-03 01:07:02 +01:00
This clearly indicate very good robustness of the closed-loop system!
Or does it? Let's find out.
2020-12-01 00:23:13 +01:00
#+begin_src matlab :exports none
freqs = logspace(0, 3, 1000);
figure;
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile([2,1]);
hold on;
plot(freqs, abs(squeeze(freqresp(Gt*Kt, freqs, 'Hz'))), 'DisplayName', '$L(s)$');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Magnitude'); set(gca, 'XTickLabel',[]);
hold off;
legend('location', 'northeast');
ax2 = nexttile;
hold on;
plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(Gt*Kt, freqs, 'Hz')))));
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
yticks(-360:90:360); ylim([-200, 0]);
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');
xlim([freqs(1), freqs(end)]);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/phase_gain_margin_model_plant.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name : fig:phase_gain_margin_model_plant
#+caption : Bode plot of the obtained Loop Gain $L(s)$
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-12-01 00:23:13 +01:00
#+RESULTS :
[[file:figs/phase_gain_margin_model_plant.png ]]
2020-12-03 01:07:02 +01:00
Now let's suppose the controller is implemented in practice, and the "real" plant $G_r(s)$ as a slightly lower damping factor than the one estimated for the model:
2020-12-01 00:23:13 +01:00
#+begin_src matlab
xi = 0.03;
2020-12-01 18:49:40 +01:00
#+end_src
#+begin_src matlab :exports none
2020-12-01 00:23:13 +01:00
Gr = 1/k*(s/w0/4 + 1)/ (s^2/w0^2 + 2*xi*s/w0 + 1);
#+end_src
2020-12-01 10:54:06 +01:00
The obtained "real" loop gain is shown in Figure [[fig:phase_gain_margin_real_plant ]].
2020-12-03 01:07:02 +01:00
At a frequency little bit above 100Hz, the phase of the loop gain reaches -180 degrees while its magnitude is more than one which indicates instability.
2020-12-01 00:23:13 +01:00
It is confirmed by checking the stability of the closed loop system:
#+begin_src matlab :results value replace
2020-12-01 18:49:40 +01:00
isstable(feedback(Gr,K))
2020-12-01 00:23:13 +01:00
#+end_src
#+RESULTS :
: 0
#+begin_src matlab :exports none
freqs = logspace(0, 3, 1000);
figure;
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile([2,1]);
hold on;
plot(freqs, abs(squeeze(freqresp(Gt*Kt, freqs, 'Hz'))), 'DisplayName', '$L(s)$');
plot(freqs, abs(squeeze(freqresp(Gr*Kt, freqs, 'Hz'))), 'DisplayName', '$L_r(s)$');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Magnitude'); set(gca, 'XTickLabel',[]);
hold off;
legend('location', 'northeast');
ax2 = nexttile;
hold on;
plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(Gt*Kt, freqs, 'Hz')))));
plot(freqs, 180/pi*unwrap(angle(squeeze(freqresp(Gr*Kt, freqs, 'Hz')))));
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
yticks(-360:90:360); ylim([-200, 0]);
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');
xlim([freqs(1), freqs(end)]);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/phase_gain_margin_real_plant.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name : fig:phase_gain_margin_real_plant
#+caption : Bode plots of $L(s)$ (loop gain corresponding the nominal plant) and $L_r(s)$ (loop gain corresponding to the real plant)
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-12-01 00:23:13 +01:00
#+RESULTS :
[[file:figs/phase_gain_margin_real_plant.png ]]
2020-12-03 01:07:02 +01:00
Therefore, even a small change of the plant parameter renders the system unstable even though both the gain margin and the phase margin for the nominal plant are excellent.
2020-12-01 00:23:13 +01:00
2020-12-03 01:07:02 +01:00
This is due to the fact that the gain and phase margin are robustness indicators corresponding a *pure* change or gain or a *pure* change of phase but not a combination of both.
2020-12-01 00:23:13 +01:00
#+end_exampl
2020-12-01 10:54:06 +01:00
Let's now determine a new robustness indicator based on the Nyquist Stability Criteria.
#+begin_definition
- Nyquist Stability Criteria (for stable systems) ::
2020-12-04 23:38:01 +01:00
If the open-loop transfer function $L(s)$ is stable, then the closed-loop system will be unstable for any encirclement of the point $-1$ on the Nyquist plot.
2020-12-01 10:54:06 +01:00
- Nyquist Plot ::
The Nyquist plot shows the evolution of $L(j\omega)$ in the complex plane from $\omega = 0 \to \infty$.
#+end_definition
2020-12-01 00:23:13 +01:00
#+begin_seealso
2020-12-01 10:54:06 +01:00
For more information about the /general/ Nyquist Stability Criteria, you may want to look at [[https://www.youtube.com/watch?v=sof3meN96MA ][this ]] video.
2020-12-01 00:23:13 +01:00
#+end_seealso
2020-12-01 18:49:40 +01:00
From the Nyquist stability criteria, it is clear that we want $L(j\omega)$ to be as far as possible from the $-1$ point (called the /unstable point/ ) in the complex plane.
This minimum distance is called the *module margin* .
2020-12-01 00:23:13 +01:00
#+begin_definition
2020-12-01 10:54:06 +01:00
- Module Margin ::
The Module Margin $\Delta M$ is defined as the *minimum distance* between the point $-1$ and the loop gain $L(j\omega)$ in the complex plane.
2020-12-01 00:23:13 +01:00
#+end_definition
2020-12-01 18:49:40 +01:00
#+begin_exampl
2020-12-01 10:54:06 +01:00
A typical Nyquist plot is shown in Figure [[fig:module_margin_example ]].
The gain, phase and module margins are graphically shown to have an idea of what they represent.
#+begin_src matlab :exports none
% Example Plant
k = 1e6; % Stiffness [N/m]
c = 4e2; % Damping [N/(m/s)]
m = 10; % Mass [kg]
G = 1/(m*s^2 + c*s + k); % Plant
% Example Controller
K = 14e8 * ... % Gain
1/(s^2) * ... % Double Integrator
(1 + s/(2*pi*10/sqrt(8)))/(1 + s/(2*pi*10*sqrt(8))); % Lead
L = G*K;
L_resp = squeeze(freqresp(L, freqs, 'Hz'));
2020-12-01 00:23:13 +01:00
2020-12-01 10:54:06 +01:00
% Module Margin
Dm = min(abs(1 + L_resp));
2020-11-30 17:44:13 +01:00
2020-12-01 10:54:06 +01:00
% Phase Gain Margin
[Gm, Pm, Wcg, Wcp] = margin(L);
freqs = logspace(0, 3, 1000);
figure;
hold on;
% Gain Margin
plot([-1, -1/Gm], [0, 0], '-', 'DisplayName', sprintf('$\\Delta G = %.1f$', Gm))
% Phase Margin
theta = -pi:0.01:-pi+Pm*pi/180;
plot(cos(theta), sin(theta), '-', 'DisplayName', sprintf('$\\Delta \\phi = %.1f^o$', Pm));
% Module Margin
theta = 0 : 0.01 : 2*pi;
plot(Dm*cos(theta)-1, Dm*sin(theta), '-', 'DisplayName', sprintf('$\\Delta M = %.1f$', Dm));
% Nyquist Plot
plot(real(L_resp), imag(L_resp), 'k-', 'DisplayName', '$L(j\omega)$')
plot(-1, 0, 'k*', 'HandleVisibility', 'off');
hold off;
xlabel('Real Axis'); ylabel('Imaginary Axis');
xlim([-1.5, 0.5]); ylim([-1, 1]);
axis equal;
legend('location', 'southeast');
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/module_margin_example.pdf', 'width', 'wide', 'height', 'tall');
#+end_src
#+name : fig:module_margin_example
#+caption : Nyquist plot with visual indication of the Gain margin $\Delta G$, Phase margin $\Delta \phi$ and Module margin $\Delta M$
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-12-01 10:54:06 +01:00
#+RESULTS :
[[file:figs/module_margin_example.png ]]
2020-12-01 18:49:40 +01:00
#+end_exampl
As expected from Figure [[fig:module_margin_example ]], there is a close relationship between the module margin and the gain and phase margins.
We can indeed show that for a given value of the module margin $\Delta M$, we have:
\begin{equation}
2020-12-03 01:07:02 +01:00
\Delta G \ge \frac{1}{1 - \Delta M}; \quad \Delta \phi \ge \Delta M
2020-12-01 18:49:40 +01:00
\end{equation}
2020-12-01 10:54:06 +01:00
Let's now try to express the Module margin $\Delta M$ as an $\mathcal{H}_\infty$ norm of a closed-loop transfer function:
\begin{align*}
\Delta M &= \text{minimum distance between } L(j\omega) \text{ and point } (-1) \\
&= \min_\omega |L(j\omega) - (-1)| \\
&= \min_\omega |1 + L(j\omega)| \\
&= \frac{1}{\max_\omega \frac{1}{|1 + L(j\omega)|}} \\
2020-12-03 01:07:02 +01:00
&= \frac{1}{\max_\omega \left| \frac{1}{1 + G(j\omega)K(j\omega)}\right|} \\
2020-12-01 10:54:06 +01:00
&= \frac{1}{\|S\|_\infty}
\end{align*}
2020-11-30 17:44:13 +01:00
2020-12-03 01:07:02 +01:00
Therefore, for a given $\mathcal{H}_\infty$ norm of $S$ ($\|S\|_ \infty = M_S$), we have:
\begin{equation}
\Delta G \ge \frac{M_S}{M_S - 1}; \quad \Delta \phi \ge \frac{1}{M_S}
\end{equation}
2020-12-01 00:23:13 +01:00
#+begin_important
2020-12-01 10:54:06 +01:00
The $\mathcal{H}_\infty$ norm of the sensitivity function $\|S\|_ \infty$ is a measure of the Module margin $\Delta M$ and therefore an indicator of the system robustness.
2020-12-01 00:23:13 +01:00
2020-12-01 10:54:06 +01:00
\begin{equation}
\Delta M = \frac{1}{\|S\|_\infty} \label{eq:module_margin_S}
\end{equation}
The wanted robustness of the closed-loop system can be specified by setting a maximum value on $\|S\|_\infty$.
2020-12-01 00:23:13 +01:00
#+end_important
2020-12-01 10:54:06 +01:00
Note that this is why large peak value of $|S(j\omega)|$ usually indicate robustness problems.
2020-12-03 01:07:02 +01:00
And we now understand why setting an upper bound on the magnitude of $S$ is generally a good idea.
2020-12-01 10:54:06 +01:00
#+begin_exampl
Typical, we require $\|S\|_\infty < 2 (6dB)$ which implies $\Delta G \ge 2$ and $\Delta \phi \ge 29^o$
#+end_exampl
#+begin_seealso
To learn more about module/disk margin, you can check out [[https:/ /www.youtube.com/watch?v=XazdN6eZF80][this]] video.
#+end_seealso
2020-12-03 12:13:53 +01:00
** Summary of typical specification and associated wanted shaping
2020-12-01 18:49:40 +01:00
<<sec:other_requirements >>
#+name : tab:specification_modern
#+caption : Typical Specifications and corresponding wanted norms of open and closed loop tansfer functions
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width 0.9\linewidth :align lXX
2020-12-04 23:38:01 +01:00
| | *Open-Loop Shaping* | *Closed-Loop Shaping* |
|-----------------------------+---------------------+--------------------------------------------|
| Reference Tracking | $L$ large | $S$ small |
| Disturbance Rejection | $L$ large | $GS$ small |
| Measurement Noise Filtering | $L$ small | $T$ small |
| Small Command Amplitude | $K$ and $L$ small | $KS$ small |
| Robustness | Phase/Gain margins | Module margin: $\Vert S\Vert_\infty$ small |
2020-12-01 18:49:40 +01:00
* $\mathcal{H}_\infty$ Shaping of closed-loop transfer functions
<<sec:closed-loop-shaping >>
** Introduction :ignore:
In the previous sections, we have seen that the performances of the system depends on the *shape* of the closed-loop transfer function.
2020-12-03 01:07:02 +01:00
Therefore, the synthesis problem is to design $K(s)$ such that closed-loop system is stable and such that the closed-loop transfer functions such as $S$, $KS$ and $T$ are shaped as wanted.
2020-12-01 18:49:40 +01:00
This is clearly not simple as these closed-loop transfer functions does not depend linearly on $K$.
But don't worry, the $\mathcal{H}_\infty$ synthesis will do this job for us!
2020-12-03 01:07:02 +01:00
To do so, *weighting functions* are included in the generalized plant and the $\mathcal{H}_\infty$ synthesis applied on the *weighted* generalized plant.
Such procedure is presented in Section [[sec:weighting_functions ]].
Some advice on the design of weighting functions are given in Section [[sec:weighting_functions_design ]].
An example of the $\mathcal{H}_\infty$ shaping of the sensitivity function is studied in Section [[sec:sensitivity_shaping_example ]].
Multiple closed-loop transfer functions can be shaped at the same time.
Such synthesis is usually called *Mixed-sensitivity Loop Shaping* and is one of the most powerful tool of the robust control theory.
Some insight on the use and limitations of such techniques are given in Section [[sec:shaping_multiple_tf ]].
2020-12-01 18:49:40 +01:00
** How to Shape closed-loop transfer function? Using Weighting Functions!
2020-11-30 17:44:13 +01:00
<<sec:weighting_functions >>
2020-12-03 01:07:02 +01:00
Suppose we apply the $\mathcal{H}_\infty$ synthesis on the generalized plant $P(s)$ shown in Figure [[fig:loop_shaping_S_without_W ]].
It will generate a controller $K(s)$ such that the $\mathcal{H}_\infty$ norm of closed-loop transfer function from $r$ to $\epsilon$ is minimized which is equal to the sensitivity function $S$.
Therefore, the synthesis objective is to minimize the $\mathcal{H}_\infty$ norm of the sensitivity function: $\|S\|_ \infty$.
2020-11-30 19:42:57 +01:00
2020-12-03 01:07:02 +01:00
However, as the $\mathcal{H}_\infty$ norm is the maximum peak value of the transfer function's magnitude, this synthesis is quite useless as it will just try to decrease of peak value of $S$.
Clearly this does not allow to *shape* the norm of $S(j\omega)$ over all frequencies nor specify the wanted low frequency gain of $S$ or bandwidth requirements.
2020-11-30 17:44:13 +01:00
#+begin_src latex :file loop_shaping_S_without_W.pdf
\begin{tikzpicture}
\node[block] (G) {$G(s)$};
\node[addb={+}{-}{}{}{}, right=0.6 of G] (addw) {};
\coordinate[above right=1.0 and 1.4 of addw] (epsilon);
\coordinate[] (w) at ($(epsilon-|G.west)+(-1.0, 0)$);
\node[block, below left=0.8 and 0 of addw] (K) {$K(s)$};
% Connections
\draw[->] (G.east) -- (addw.west);
2020-12-01 18:49:40 +01:00
\draw[->] ($(addw.east)+(0.4, 0)$)node[branch]{} |- (epsilon) node[above](z1){$z = \epsilon$};
2020-11-30 17:44:13 +01:00
\draw[->] (addw.east) -- (addw-|z1) |- node[near start, right]{$v$} (K.east);
2020-12-01 18:49:40 +01:00
\draw[->] (K.west) -| node[near end, left]{$u$} ($(G-|w)+(0.1, 0)$) -- (G.west);
2020-11-30 17:44:13 +01:00
\draw[->] (w) node[above]{$w = r$} -| (addw.north);
\begin{scope}[on background layer]
\node[fit={(G.south west) ($(z1.north west)+(-0.4, 0)$)}, inner sep=12pt, draw, dashed, fill=black!20!white] (P) {};
\node[below] at (P.north) {Generalized Plant $P(s)$};
\end{scope}
\end{tikzpicture}
#+end_src
#+name : fig:loop_shaping_S_without_W
#+caption : Generalized Plant
#+RESULTS :
[[file:figs/loop_shaping_S_without_W.png ]]
2020-11-27 23:13:29 +01:00
2020-12-01 18:49:40 +01:00
#+begin_important
The /trick/ is to include a *weighting function* $W_S(s)$ in the generalized plant as shown in Figure [[fig:loop_shaping_S_with_W ]].
2020-11-30 17:44:13 +01:00
2020-12-01 18:49:40 +01:00
Now, the closed-loop transfer function from $w$ to $z$ is equal to $W_s(s)S(s)$ and applying the $\mathcal{H}_ \infty$ synthesis to the /weighted/ generalized plant $\tilde{P}(s)$ will generate a controller $K(s)$ such that $\|W_s(s)S(s)\|_ \infty$ is minimized.
#+end_important
2020-11-30 17:44:13 +01:00
2020-12-01 18:49:40 +01:00
Let's now show how this is equivalent as *shaping* the sensitivity function:
2020-11-30 19:42:57 +01:00
\begin{align}
2020-12-01 18:49:40 +01:00
& \left\| W_s(s) S(s) \right\|_ \infty < 1\nonumber \\
2020-11-30 19:42:57 +01:00
\Leftrightarrow & \left| W_s(j\omega) S(j\omega) \right| < 1 \quad \forall \omega\nonumber \\
\Leftrightarrow & \left| S(j\omega) \right| < \frac{1}{\left| W_s(j\omega) \right|} \quad \forall \omega \label{eq:sensitivity_shaping}
\end{align}
2020-11-30 17:44:13 +01:00
#+begin_important
2020-12-03 01:07:02 +01:00
As shown in Equation eqref:eq:sensitivity_shaping, the objective of the $\mathcal{H}_ \infty$ synthesis applied on the /weighted/ plant is to make the norm sensitivity function smaller than the inverse of the norm of the weighting function, and that at all frequencies.
2020-12-01 18:49:40 +01:00
2020-12-03 01:07:02 +01:00
Therefore, the choice of the weighting function $W_s(s)$ is very important: its inverse magnitude will define the wanted *upper bound* of the sensitivity function magnitude over all frequencies.
2020-11-27 23:13:29 +01:00
#+end_important
2020-11-30 17:44:13 +01:00
#+begin_src latex :file loop_shaping_S_with_W.pdf
2020-11-27 23:13:29 +01:00
\begin{tikzpicture}
2020-11-30 17:44:13 +01:00
\node[block] (G) {$G(s)$};
\node[addb={+}{-}{}{}{}, right=0.6 of G] (addw) {};
\node[block, above right=1.0 and 1.0 of addw] (Ws) {$W_s(s)$};
\coordinate[right=0.8 of Ws] (epsilon);
2020-11-27 23:13:29 +01:00
2020-11-30 17:44:13 +01:00
\coordinate[] (w) at ($(epsilon-|G.west)+(-1.0, 0)$);
2020-11-27 23:13:29 +01:00
2020-11-30 17:44:13 +01:00
\begin{scope}[on background layer]
\node[fit={(G.south west) (Ws.north east)}, inner sep=8pt, draw, dashed, fill=black!20!white] (P) {};
\node[above] at (P.north) {Weighted Generalized Plant $\tilde{P}(s)$};
\end{scope}
2020-11-27 23:13:29 +01:00
2020-11-30 17:44:13 +01:00
\node[block, below=0.4 of P] (K) {$K(s)$};
2020-11-27 23:13:29 +01:00
2020-11-30 17:44:13 +01:00
% Connections
\draw[->] (G.east) -- (addw.west);
\draw[->] ($(addw.east)+(0.4, 0)$)node[branch]{} |- (Ws.west)node[above left]{$\epsilon$};
2020-12-01 18:49:40 +01:00
\draw[->] (Ws.east) -- (epsilon) node[above](z1){$z = \tilde{\epsilon}$};
2020-11-30 17:44:13 +01:00
\draw[->] (addw.east) -- (addw-|z1) |- node[near start, right]{$v$} (K.east);
2020-12-01 18:49:40 +01:00
\draw[->] (K.west) -| node[near end, left]{$u$} ($(G-|w)+(0.2, 0)$) -- (G.west);
2020-11-30 17:44:13 +01:00
\draw[->] (w) node[above]{$w = r$} -| (addw.north);
2020-11-27 23:13:29 +01:00
\end{tikzpicture}
#+end_src
2020-11-30 17:44:13 +01:00
#+name : fig:loop_shaping_S_with_W
#+caption : Weighted Generalized Plant
2020-11-27 23:13:29 +01:00
#+RESULTS :
2020-11-30 17:44:13 +01:00
[[file:figs/loop_shaping_S_with_W.png ]]
2020-11-27 23:13:29 +01:00
2020-12-01 18:49:40 +01:00
#+begin_exercice
Using matlab, compute the weighted generalized plant shown in Figure [[fig:first_order_weight ]] as a function of $G(s)$ and $W_S(s)$.
2020-11-25 19:35:11 +01:00
2020-12-01 18:49:40 +01:00
#+HTML : <details><summary>Hint</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Hint}
2020-12-01 18:49:40 +01:00
The weighted generalized plant can be defined in Matlab using two techniques:
- by writing manually the 4 transfer functions from $[w, u]$ to $[\tilde{\epsilon}, v]$
- by pre-multiplying the (non-weighted) generalized plant by a block-diagonal transfer function matrix containing the weights for the outputs $z$ and =1= for the outputs $v$
#+HTML : </details>
#+HTML : <details><summary>Answer</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Answer}
2020-12-01 18:49:40 +01:00
The two solutions below can be used.
2020-11-25 19:35:11 +01:00
2020-11-30 17:44:13 +01:00
#+begin_src matlab :tangle no :eval no
Pw = [Ws -Ws*G;
2020-12-01 18:49:40 +01:00
1 -G];
#+end_src
2020-11-30 17:44:13 +01:00
2020-12-03 01:07:02 +01:00
The second solution is however more general, and can also be used when weights are added at the inputs by post-multiplying instead of pre-multiplying.
2020-12-01 18:49:40 +01:00
#+begin_src matlab :tangle no :eval no
2020-12-03 01:07:02 +01:00
P = [1 -G;
1 -G];
2020-11-30 17:44:13 +01:00
Pw = blkdiag(Ws, 1)*P;
#+end_src
2020-12-01 18:49:40 +01:00
#+HTML : </details>
#+end_exercice
2020-11-30 17:44:13 +01:00
** Design of Weighting Functions
<<sec:weighting_functions_design >>
2020-12-01 18:49:40 +01:00
Weighting function included in the generalized plant must be *proper* , *stable* and *minimum phase* transfer functions.
#+begin_definition
2020-11-30 17:44:13 +01:00
- proper ::
more poles than zeros, this implies $\lim_{\omega \to \infty} |W(j\omega)| < \infty$
- stable ::
no poles in the right half plane
- minimum phase ::
no zeros in the right half plane
2020-12-01 18:49:40 +01:00
#+end_definition
2020-11-30 17:44:13 +01:00
2020-12-03 11:51:44 +01:00
Good guidelines for design of weighting function are given in cite:bibel92_guidel_h.
2020-12-03 01:07:02 +01:00
There is a Matlab function called =makeweight= that allows to design first-order weights by specifying the low frequency gain, high frequency gain, and the gain at a specific frequency:
2020-11-30 17:44:13 +01:00
#+begin_src matlab :tangle no :eval no
W = makeweight(dcgain,[freq,mag],hfgain)
#+end_src
with:
2020-12-01 18:49:40 +01:00
- =dcgain= : low frequency gain
- =[freq,mag]= : frequency =freq= at which the gain is =mag=
- =hfgain= : high frequency gain
2020-11-30 17:44:13 +01:00
#+begin_exampl
2020-12-01 18:49:40 +01:00
The Matlab code below produces a weighting function with the following characteristics (Figure [[fig:first_order_weight ]]):
- Low frequency gain of 100
- Gain of 1 at 10Hz
- High frequency gain of 0.5
2020-11-30 17:44:13 +01:00
2020-12-04 23:38:01 +01:00
#+begin_src matlab :float nil
2020-11-30 17:44:13 +01:00
Ws = makeweight(1e2, [2*pi*10, 1], 1/2);
#+end_src
#+begin_src matlab :exports none
freqs = logspace(-2, 2, 1000);
figure;
hold on;
plot(freqs, abs(squeeze(freqresp(Ws, freqs, 'Hz'))), 'k-');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frquency [Hz]'); ylabel('Magnitude');
hold off;
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/first_order_weight.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name : fig:first_order_weight
#+caption : Obtained Magnitude of the Weighting Function
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-11-30 17:44:13 +01:00
#+RESULTS :
[[file:figs/first_order_weight.png ]]
#+end_exampl
#+begin_seealso
Quite often, higher orders weights are required.
2020-12-01 18:49:40 +01:00
In such case, the following formula can be used:
2020-11-30 17:44:13 +01:00
\begin{equation}
W(s) = \left( \frac{
\frac{1}{\omega_0} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_ \infty}\right)^{\frac{2}{n}}}} s + \left(\frac{G_0}{G_c}\right)^{\frac{1}{n}}
}{
\left(\frac{1}{G_\infty}\right)^{\frac{1}{n}} \frac{1}{\omega_0} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_ \infty}\right)^{\frac{2}{n}}}} s + \left(\frac{1}{G_c}\right)^{\frac{1}{n}}
}\right)^n \label{eq:weight_formula_advanced}
\end{equation}
The parameters permit to specify:
- the low frequency gain: $G_0 = lim_ {\omega \to 0} |W(j\omega)|$
- the high frequency gain: $G_\infty = lim_ {\omega \to \infty} |W(j\omega)|$
- the absolute gain at $\omega_0$: $G_c = |W(j\omega_0)|$
- the absolute slope between high and low frequency: $n$
A Matlab function implementing Equation eqref:eq:weight_formula_advanced is shown below:
#+begin_src matlab :tangle matlab/generateWeight.m :comments none :eval no
function [W] = generateWeight(args)
arguments
args.G0 (1,1) double {mustBeNumeric, mustBePositive} = 0.1
args.G1 (1,1) double {mustBeNumeric, mustBePositive} = 10
args.Gc (1,1) double {mustBeNumeric, mustBePositive} = 1
args.wc (1,1) double {mustBeNumeric, mustBePositive} = 2*pi
args.n (1,1) double {mustBeInteger, mustBePositive} = 1
end
if (args.Gc <= args.G0 && args.Gc <= args.G1) || (args.Gc >= args.G0 && args.Gc >= args.G1)
eid = 'value:range';
msg = 'Gc must be between G0 and G1';
throwAsCaller(MException(eid,msg))
end
s = zpk('s');
2020-12-04 23:38:01 +01:00
W = (((1/args.wc) * sqrt((1-(args.G0/args.Gc)^(2/args.n))/ (1-(args.Gc/args.G1)^(2/args.n)))*s + (args.G0/args.Gc)^(1/args.n)) / ((1/args.G1)^(1/args.n) * (1/args.wc) * sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.G1)^(2/args.n)))*s + (1/args.Gc)^(1/args.n)))^args.n;
2020-11-30 17:44:13 +01:00
end
#+end_src
Let's use this function to generate three weights with the same high and low frequency gains, but but different slopes.
#+begin_src matlab
W1 = generateWeight('G0', 1e2, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 1);
W2 = generateWeight('G0', 1e2, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 2);
W3 = generateWeight('G0', 1e2, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 3);
#+end_src
The obtained shapes are shown in Figure [[fig:high_order_weight ]].
#+begin_src matlab :exports none
freqs = logspace(-2, 2, 1000);
figure;
hold on;
plot(freqs, abs(squeeze(freqresp(W1, freqs, 'Hz'))), ...
'DisplayName', '$n = 1$');
plot(freqs, abs(squeeze(freqresp(W2, freqs, 'Hz'))), ...
'DisplayName', '$n = 2$');
plot(freqs, abs(squeeze(freqresp(W3, freqs, 'Hz'))), ...
'DisplayName', '$n = 3$');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frquency [Hz]'); ylabel('Magnitude');
legend('location', 'northeast');
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/high_order_weight.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name : fig:high_order_weight
#+caption : Higher order weights using Equation eqref:eq:weight_formula_advanced
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-11-30 17:44:13 +01:00
#+RESULTS :
[[file:figs/high_order_weight.png ]]
#+end_seealso
2020-12-01 18:49:40 +01:00
** Shaping the Sensitivity Function
2020-11-30 17:44:13 +01:00
<<sec:sensitivity_shaping_example >>
2020-12-03 01:07:02 +01:00
Let's design a controller using the $\mathcal{H}_\infty$ shaping of the sensitivity function that fulfils the following requirements:
2020-12-01 18:49:40 +01:00
1. Bandwidth of at least 10Hz
2. Small static errors for step responses
3. Robustness: Large module margin $\Delta M > 0.5$ ($\Rightarrow \Delta G > 2$ and $\Delta \phi > 29^o$)
As usual, the plant used is the one presented in Section [[sec:example_system ]].
#+begin_exercice
2020-12-03 01:07:02 +01:00
Translate the requirements as upper bounds on the Sensitivity function and design the corresponding weighting functions using Matlab.
2020-12-01 18:49:40 +01:00
#+HTML : <details><summary>Hint</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Hint}
2020-12-01 18:49:40 +01:00
The typical wanted upper bound of the sensitivity function is shown in Figure [[fig:h-infinity-spec-S-bis ]].
More precisely:
1. Recall that the closed-loop bandwidth is defined as the frequency $|S(j\omega)|$ first crosses $1/\sqrt{2} = -3dB$ from below
2. For the small static error, -60dB is usually enough as other factors (measurement noise, disturbances) will anyhow limit the performances
3. Recall that the module margin is equal to the inverse of the $\mathcal{H}_\infty$ norm of the sensitivity function:
\[ \Delta M = \frac{1}{\|S\|_\infty} \]
Remember that the wanted upper bound of the sensitivity function is defined by the *inverse* magnitude of the weight.
#+name : fig:h-infinity-spec-S-bis
#+caption : Typical wanted shape of the Sensitivity transfer function
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-12-01 18:49:40 +01:00
[[file:figs/h-infinity-spec-S.png ]]
#+HTML : </details>
#+HTML : <details><summary>Answer</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Answer}
2020-12-03 01:07:02 +01:00
We want to design the weighting function $W_s(s)$ such that:
2020-12-01 18:49:40 +01:00
1. $|W_s(j \cdot 2 \pi 10)| = \sqrt{2}$
2. $|W_s(j \cdot 0)| = 10^3$
3. $\|W_s\|_ \infty = 0.5$
Using Matlab, such weighting function can be generated using the =makeweight= function as shown below:
#+begin_src matlab :eval no :tangle no
Ws = makeweight(1e3, [2*pi*10, sqrt(2)], 1/2);
#+end_src
2020-12-01 10:54:06 +01:00
2020-12-01 18:49:40 +01:00
Or using the =generateWeight= function:
#+begin_src matlab :eval no :tangle no
Ws = generateWeight('G0', 1e3, ...
'G1', 1/2, ...
'Gc', sqrt(2), 'wc', 2*pi*10, ...
'n', 2);
#+end_src
#+HTML : </details>
#+end_exercice
2020-11-30 17:44:13 +01:00
2020-12-01 18:49:40 +01:00
Let's say we came up with the following weighting function:
2020-11-30 17:44:13 +01:00
#+begin_src matlab
2020-12-01 18:49:40 +01:00
Ws = generateWeight('G0', 1e3, ...
'G1', 1/2, ...
'Gc', sqrt(2), 'wc', 2*pi*10, ...
'n', 2);
2020-11-30 17:44:13 +01:00
#+end_src
2020-12-01 18:49:40 +01:00
The weighting function is then added to the generalized plant.
2020-11-30 17:44:13 +01:00
#+begin_src matlab
2020-12-01 18:49:40 +01:00
P = [1 -G;
1 -G];
2020-11-30 17:44:13 +01:00
Pw = blkdiag(Ws, 1)*P;
#+end_src
2020-12-01 18:49:40 +01:00
And the $\mathcal{H}_\infty$ synthesis is performed on the /weighted/ generalized plant.
2020-11-30 17:44:13 +01:00
#+begin_src matlab :results output replace
K = hinfsyn(Pw, 1, 1, 'Display', 'on');
#+end_src
#+RESULTS :
#+begin_example
Test bounds: 0.5 <= gamma <= 0.51
gamma X>=0 Y>=0 rho(XY)<1 p/f
2020-12-01 18:49:40 +01:00
5.05e-01 0.0e+00 0.0e+00 3.000e-16 p
2020-11-30 17:44:13 +01:00
Limiting gains...
2020-12-01 18:49:40 +01:00
5.05e-01 0.0e+00 0.0e+00 3.461e-16 p
5.05e-01 -3.5e+01 # -4.9e-14 1.732e-26 f
2020-11-30 17:44:13 +01:00
2020-12-01 18:49:40 +01:00
Best performance (actual): 0.503
2020-11-30 17:44:13 +01:00
#+end_example
2020-12-03 01:07:02 +01:00
$\gamma \approx 0.5$ means that the $\mathcal{H}_\infty$ synthesis generated a controller $K(s)$ that stabilizes the closed-loop system, and such that the $\mathcal{H}_ \infty$ norm of the closed-loop transfer function from $w$ to $z$ is less than $\gamma$:
2020-12-04 23:38:01 +01:00
\begin{align*}
2020-12-01 18:49:40 +01:00
& \| W_s(s) S(s) \|_ \infty \approx 0.5 \\
2020-11-30 17:44:13 +01:00
& \Leftrightarrow |S(j\omega)| < \frac{0.5}{|W_s(j\omega)|} \quad \forall \omega
2020-12-04 23:38:01 +01:00
\end{align*}
2020-11-30 17:44:13 +01:00
This is indeed what we can see by comparing $|S|$ and $|W_S|$ in Figure [[fig:results_sensitivity_hinf ]].
2020-12-01 18:49:40 +01:00
#+begin_important
2020-12-03 01:07:02 +01:00
Obtaining $\gamma < 1$ means that the $\mathcal{H}_\infty$ synthesis found a controller such that the specified closed-loop transfer functions are bellow the specified upper bounds.
2020-12-01 18:49:40 +01:00
2020-12-03 01:07:02 +01:00
Yet, obtaining a $\gamma$ slightly above one does not necessary means the synthesis is unsuccessful.
2020-12-01 18:49:40 +01:00
It just means that at some frequency, one of the closed-loop transfer functions is above the specified upper bound by a factor $\gamma$.
#+end_important
2020-11-30 17:44:13 +01:00
#+begin_src matlab :exports none
figure;
hold on;
plot(freqs, 1./abs(squeeze(freqresp(Ws, freqs, 'Hz'))), 'k--', 'DisplayName', '$|W_s|^{-1}$');
plot(freqs, abs(squeeze(freqresp(1/(1 + K*G), freqs, 'Hz'))), 'k-', 'DisplayName', '$|S|$');
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
legend('location', 'southeast', 'FontSize', 8);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/results_sensitivity_hinf.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name : fig:results_sensitivity_hinf
#+caption : Weighting function and obtained closed-loop sensitivity
#+RESULTS :
[[file:figs/results_sensitivity_hinf.png ]]
2020-12-03 01:07:02 +01:00
** Shaping multiple closed-loop transfer functions - Limitations
2020-12-01 18:49:40 +01:00
<<sec:shaping_multiple_tf >>
2020-11-30 19:42:57 +01:00
2020-12-03 01:07:02 +01:00
*** Introduction :ignore:
2020-11-30 17:44:13 +01:00
2020-12-03 01:07:02 +01:00
As was shown in Section [[sec:modern_interpretation_specification ]], each of the four main closed-loop transfer functions (called the /gang of four/ ) will impact different characteristics of the closed-loop system.
2020-12-03 11:51:44 +01:00
This is summarized in Table [[tab:usual_shaping_gang_four ]].
2020-11-30 17:44:13 +01:00
2020-12-03 01:07:02 +01:00
Therefore, we might want to shape multiple closed-loop transfer functions at the same time.
2020-12-03 11:51:44 +01:00
For instance $S$ could be shape to have good step responses, $KS$ to limit the input usage and $T$ to filter measurement noise.
2020-12-03 01:07:02 +01:00
When multiple closed-loop transfer function are shaped at the same time, it is refereed to as *Mixed-Sensitivity $\mathcal{H}_\infty$ Control* and is the subject of Section [[sec:h_infinity_mixed_sensitivity ]].
2020-11-30 17:44:13 +01:00
2020-12-03 11:51:44 +01:00
#+name : tab:usual_shaping_gang_four
#+caption : Typical specifications and corresponding shaping of the /Gang of four/
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width 0.9\linewidth :align llX
2020-12-04 23:38:01 +01:00
| <l> | <c> | <l> |
| *Specifications* | *TF* | *Wanted shape* |
|-------------------------------+------+------------------------------------------------|
| Fast Reference Tracking | $S$ | Set lower bound on the bandwidth |
| Small Steady State Errors | $S$ | Small low frequency gain |
| Follow Step ref. inputs | $S$ | Slope of +20dB/dec at low frequency |
| Follow Ramp ref. inputs | $S$ | Slope of +40dB/dec at low frequency |
| Follow Sin. ref. inputs | $S$ | Small magnitude centered on the sin. frequency |
|-------------------------------+------+------------------------------------------------|
| Output Disturbance Rejection | $S$ | Small gain in the disturbance bandwidth |
| Input Disturbance Rejection | $GS$ | Small gain in the disturbance bandwidth |
| Prevent notching resonances | $GS$ | Limit gain around resonance |
|-------------------------------+------+------------------------------------------------|
| Small Command Amplitude | $KS$ | Small at high frequency |
| Limitation of the Bandwidth | $T$ | Set an upper bound on the bandwidth |
| Measurement Noise Filtering | $T$ | Small high frequency gain |
|-------------------------------+------+------------------------------------------------|
| Stability margins | $S$ | Module margin: $\Vert S\Vert_\infty$ small |
| Robust to unmodelled dynamics | $T$ | Small at freq. where uncertainty is large |
2020-12-03 11:51:44 +01:00
2020-12-03 01:07:02 +01:00
Depending on which closed-loop transfer function are to be shaped, different weighted generalized plant can be used.
Some of them are described below for reference, it is a good exercise to try to re-design such weighted generalized plants.
2020-11-25 19:35:11 +01:00
2020-11-30 19:42:57 +01:00
*** S KS :ignore:
#+HTML : <details><summary>Shaping of S and KS</summary>
2020-12-04 23:38:01 +01:00
#+latex : \begin{exampl}[after title={~- Shape $S$ and $KS$}]
2020-11-30 19:42:57 +01:00
#+begin_src latex :file general_conf_shaping_S_KS.pdf
\begin{tikzpicture}
% Blocs
\node[block] (G) {$G$};
\node[addb={+}{-}{}{}{}, right=0.6 of G] (addw) {};
\node[block, above right=0.4 and 0.8 of addw] (W2) {$W_2$};
\node[block, above=0.5 of W2] (W1) {$W_1$};
\coordinate (Gin) at ($(G.west)+(-0.5, 0)$);
\begin{scope}[on background layer]
\node[fit={(Gin|-G.south) (W1.north east)}, inner sep=8pt, draw, dashed, fill=black!20!white] (P) {};
\node[above] at (P.north) {Weighted Generalized Plant $P$};
\end{scope}
\node[block, below=0.6 of P] (K) {$K$};
\coordinate[right=0.8 of W1] (z);
\coordinate[above left=1.8 and 1.4 of G] (w);
% Connections
\draw[->] (G.east) -- (addw.west);
\draw[->] ($(addw.east)+(0.2, 0)$)node[branch]{} |- (W1.west);
\draw[->] (Gin)node[branch]{} |- (W2.west);
\draw[->] (W1.east) -- (W1-|z) node[above left](z1){$z_1$};
\draw[->] (W2.east) -- (W2-|z) node[above left](z2){$z_2$};
\draw[->] (addw.east) -- (addw-|z) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} (G-|w) -- (G.west);
\draw[->] (w) node[above right]{$w$} -| (addw.north);
\end{tikzpicture}
#+end_src
#+name : fig:general_conf_shaping_S_KS
#+caption : Generalized Plant to shape $S$ and $KS$
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-11-30 19:42:57 +01:00
#+RESULTS :
[[file:figs/general_conf_shaping_S_KS.png ]]
2020-12-03 01:07:02 +01:00
Weighting functions:
- $W_1(s)$ is used to shape $S$
- $W_2(s)$ is used to shape $KS$
2020-11-30 19:42:57 +01:00
#+begin_src matlab :eval no :tangle no
2020-12-04 23:38:01 +01:00
P = [1 -G
0 1
1 -G];
Pw = blkdiag(W1, W2, 1)*P;
2020-11-30 19:42:57 +01:00
#+end_src
2020-12-04 23:38:01 +01:00
#+latex : \end{exampl}
2020-11-30 19:42:57 +01:00
#+HTML : </details>
*** S T :ignore:
#+HTML : <details><summary>Shaping of S and T</summary>
2020-12-04 23:38:01 +01:00
#+latex : \begin{exampl}[after title={~- Shape $S$ and $T$}]
2020-11-30 19:42:57 +01:00
#+begin_src latex :file general_conf_shaping_S_T.pdf
\begin{tikzpicture}
% Blocs
\node[block] (G) {$G$};
\node[addb={+}{-}{}{}{}, right=0.8 of G] (addw) {};
\node[block, above right=0.4 and 0.8 of addw] (W2) {$W_2$};
\node[block, above=0.5 of W2] (W1) {$W_1$};
\begin{scope}[on background layer]
\node[fit={(G.south west) (W1.north east)}, inner sep=8pt, draw, dashed, fill=black!20!white] (P) {};
\node[above] at (P.north) {Weighted Generalized Plant $P$};
\end{scope}
\node[block, below=0.6 of P] (K) {$K$};
\coordinate[right=0.8 of W1] (z);
\coordinate[above left=1.8 and 0.8 of G] (w);
% Connections
\draw[->] (G.east) -- (addw.west);
\draw[->] ($(addw.east)+(0.3, 0)$)node[branch]{} |- (W1.west);
\draw[->] ($(G.east)+(0.3, 0)$)node[branch]{} |- (W2.west);
\draw[->] (W1.east) -- (W1-|z) node[above left](z1){$z_1$};
\draw[->] (W2.east) -- (W2-|z) node[above left](z2){$z_2$};
\draw[->] (addw.east) -- (addw-|z) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} (G-|w) -- (G.west);
\draw[->] (w) node[above right]{$w$} -| (addw.north);
\end{tikzpicture}
#+end_src
#+name : fig:general_conf_shaping_S_T
#+caption : Generalized Plant to shape $S$ and $T$
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-11-30 19:42:57 +01:00
#+RESULTS :
[[file:figs/general_conf_shaping_S_T.png ]]
2020-12-03 01:07:02 +01:00
Weighting functions:
- $W_1$ is used to shape $S$
- $W_2$ is used to shape $T$
2020-11-30 19:42:57 +01:00
#+begin_src matlab :eval no :tangle no
2020-12-04 23:38:01 +01:00
P = [1 -G
0 G
1 -G];
Pw = blkdiag(W1, W2, 1)*P;
2020-11-30 19:42:57 +01:00
#+end_src
2020-12-04 23:38:01 +01:00
#+latex : \end{exampl}
2020-11-30 19:42:57 +01:00
#+HTML : </details>
2020-12-02 11:00:11 +01:00
*** S GS :ignore:
#+HTML : <details><summary>Shaping of S and GS</summary>
2020-12-04 23:38:01 +01:00
#+latex : \begin{exampl}[after title={~- Shape $S$ and $GS$}]
2020-12-02 11:00:11 +01:00
#+begin_src latex :file general_conf_shaping_S_GS.pdf
\begin{tikzpicture}
% Blocs
\node[block] (G) {$G$};
\node[addb={+}{-}{}{}{}, left=0.8 of G] (addw) {};
\node[block, above right=0.4 and 0.8 of G] (W2) {$W_2$};
\node[block, above=0.5 of W2] (W1) {$W_1$};
\begin{scope}[on background layer]
\node[fit={(addw.west |- G.south) (W1.north east)}, inner sep=10pt, draw, dashed, fill=black!20!white] (P) {};
\node[above] at (P.north) {Weighted Generalized Plant $P$};
\end{scope}
\node[block, below=0.6 of P] (K) {$K$};
\coordinate[right=1.0 of W1] (z);
\coordinate[above left=2.4 and 1.0 of addw] (w);
% Connections
\draw[->] (addw.east) -- (G.west);
\draw[->] ($(addw.east)+(0.3, 0)$)node[branch]{} |- (W1.west);
\draw[->] ($(G.east)+(0.3, 0)$)node[branch]{} |- (W2.west);
\draw[->] (W1.east) -- (W1-|z) node[above left](z1){$z_1$};
\draw[->] (W2.east) -- (W2-|z) node[above left](z2){$z_2$};
\draw[->] (G.east) -- (G-|z) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} (addw-|w) -- (addw.west);
\draw[->] (w) node[above right]{$w$} -| (addw.north);
\end{tikzpicture}
#+end_src
#+name : fig:general_conf_shaping_S_GS
#+caption : Generalized Plant to shape $S$ and $GS$
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-12-02 11:00:11 +01:00
#+RESULTS :
[[file:figs/general_conf_shaping_S_GS.png ]]
2020-12-03 01:07:02 +01:00
Weighting functions:
- $W_1$ is used to shape $S$
- $W_2$ is used to shape $GS$
2020-12-02 11:00:11 +01:00
#+begin_src matlab :eval no :tangle no
2020-12-04 23:38:01 +01:00
P = [1 -1
G -G
G -G];
Pw = blkdiag(W1, W2, 1)*P;
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-04 23:38:01 +01:00
#+latex : \end{exampl}
2020-12-02 11:00:11 +01:00
#+HTML : </details>
2020-11-30 19:42:57 +01:00
*** S T KS :ignore:
#+HTML : <details><summary>Shaping of S, T and KS</summary>
2020-12-04 23:38:01 +01:00
#+latex : \begin{exampl}[after title={~- Shape $S$, $T$ and $KS$}]
2020-11-30 19:42:57 +01:00
#+begin_src latex :file general_conf_shaping_S_T_KS.pdf
\begin{tikzpicture}
% Blocs
\node[block] (G) {$G$};
\node[addb={+}{-}{}{}{}, right=0.8 of G] (addw) {};
\node[block, above right=0.4 and 0.8 of addw] (W3) {$W_3$};
\node[block, above=0.2 of W3] (W2) {$W_2$};
\node[block, above=0.2 of W2] (W1) {$W_1$};
\coordinate (Gin) at ($(G.west)+(-0.5, 0)$);
\begin{scope}[on background layer]
\node[fit={(Gin|-G.south) (W1.north east)}, inner sep=8pt, draw, dashed, fill=black!20!white] (P) {};
\node[above] at (P.north) {Weighted Generalized Plant $P$};
\end{scope}
\node[block, below=0.6 of P] (K) {$K$};
\coordinate[right=0.8 of W1] (z);
\coordinate[above left=1.4 and 1.3 of G] (w);
% Connections
\draw[->] (G.east) -- (addw.west);
\draw[->] ($(addw.east)+(0.3, 0)$)node[branch]{} |- (W1.west);
\draw[->] (Gin)node[branch]{} |- (W2.west);
\draw[->] ($(G.east)+(0.3, 0)$)node[branch]{} |- (W3.west);
\draw[->] (W1.east) -- (W1-|z) node[above left](z1){$z_1$};
\draw[->] (W2.east) -- (W2-|z) node[above left](z2){$z_2$};
\draw[->] (W3.east) -- (W3-|z) node[above left](z3){$z_3$};
\draw[->] (addw.east) -- (addw-|z) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} (G-|w) -- (G.west);
\draw[->] (w) node[above right]{$w$} -| (addw.north);
\end{tikzpicture}
#+end_src
#+name : fig:general_conf_shaping_S_T_KS
#+caption : Generalized Plant to shape $S$, $T$ and $KS$
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-11-30 19:42:57 +01:00
#+RESULTS :
[[file:figs/general_conf_shaping_S_T_KS.png ]]
2020-12-03 01:07:02 +01:00
Weighting functions:
- $W_1$ is used to shape $S$
- $W_2$ is used to shape $KS$
- $W_3$ is used to shape $T$
2020-11-30 19:42:57 +01:00
#+begin_src matlab :eval no :tangle no
2020-12-04 23:38:01 +01:00
P = [1 -G
0 1
0 G
1 -G];
Pw = blkdiag(W1, W2, W3, 1)*P;
2020-11-30 19:42:57 +01:00
#+end_src
2020-12-04 23:38:01 +01:00
#+latex : \end{exampl}
2020-11-30 19:42:57 +01:00
#+HTML : </details>
2020-12-02 11:00:11 +01:00
*** S T GS :ignore:
#+HTML : <details><summary>Shaping of S, T and GS</summary>
2020-12-04 23:38:01 +01:00
#+latex : \begin{exampl}[after title={~- Shape $S$, $T$ and $GS$}]
2020-12-02 11:00:11 +01:00
#+begin_src latex :file general_conf_shaping_S_T_GS.pdf
\begin{tikzpicture}
% Blocs
\node[block] (G) {$G$};
\node[addb={+}{-}{}{}{}, left=0.8 of G] (addw) {};
\node[block, above right=0.4 and 0.8 of G] (W3) {$W_3$};
\node[block, above=0.2 of W3] (W2) {$W_2$};
\node[block, above=0.2 of W2] (W1) {$W_1$};
\coordinate (addwin) at ($(addw.west)+(-0.5, 0)$);
\begin{scope}[on background layer]
\node[fit={(addwin|-G.south) (W1.north east)}, inner sep=8pt, draw, dashed, fill=black!20!white] (P) {};
\node[above] at (P.north) {Weighted Generalized Plant $P$};
\end{scope}
\node[block, below=0.6 of P] (K) {$K$};
\coordinate[right=0.8 of W1] (z);
\coordinate[above left=2.4 and 0.8 of addwin] (w);
% Connections
\draw[->] (addw.east) -- (G.west);
\draw[->] ($(addw.east)+( 0.3, 0)$)node[branch]{} |- (W1.west);
\draw[->] ($(G.east)+(0.3, 0)$)node[branch]{} |- (W2.west);
\draw[->] (addwin)node[branch]{} |- (W3.west);
\draw[->] (W1.east) -- (W1-|z) node[above left](z1){$z_1$};
\draw[->] (W2.east) -- (W2-|z) node[above left](z2){$z_2$};
\draw[->] (W3.east) -- (W3-|z) node[above left](z3){$z_3$};
\draw[->] (G.east) -- (G-|z) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} (addw-|w) -- (addw.west);
\draw[->] (w) node[above right]{$w$} -| (addw.north);
\end{tikzpicture}
#+end_src
#+name : fig:general_conf_shaping_S_T_GS
#+caption : Generalized Plant to shape $S$, $T$ and $GS$
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-12-02 11:00:11 +01:00
#+RESULTS :
[[file:figs/general_conf_shaping_S_T_GS.png ]]
2020-12-03 01:07:02 +01:00
Weighting functions:
- $W_1$ is used to shape $S$
- $W_2$ is used to shape $GS$
- $W_3$ is used to shape $T$
2020-12-02 11:00:11 +01:00
#+begin_src matlab :eval no :tangle no
2020-12-04 23:38:01 +01:00
P = [1 -1
G -G
0 1
G -G];
Pw = blkdiag(W1, W2, W3, 1)*P;
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-04 23:38:01 +01:00
#+latex : \end{exampl}
2020-12-02 11:00:11 +01:00
#+HTML : </details>
2020-11-30 19:42:57 +01:00
*** S T KS GS :ignore:
#+HTML : <details><summary>Shaping of S, T, KS and GS</summary>
2020-12-04 23:38:01 +01:00
#+latex : \begin{exampl}[after title={~- Shape $S$, $T$, $KS$ and $GS$}]
2020-11-30 19:42:57 +01:00
#+begin_src latex :file general_conf_shaping_S_T_KS_GS.pdf
\begin{tikzpicture}
% Blocs
\node[block] (G) {$G$};
\node[addb={+}{-}{}{}{}, right=0.6 of G] (addr) {};
\node[addb, left=0.6 of G] (addd) {};
\node[block, above right=0.4 and 0.8 of addr] (W2) {$W_2$};
\node[block, above=0.5 of W2] (W1) {$W_1$};
\node[block, above left=0.7 and 0.8 of addd] (W3) {$W_3$};
\node[block, above=0.5 of W3] (W4) {$1$};
\begin{scope}[on background layer]
\node[fit={(W3.west|-G.south) (W4.north -| W2.east)}, inner sep=8pt, draw, dashed, fill=black!20!white] (P) {};
\node[above] at (P.north) {Weighted Generalized Plant $P$};
\end{scope}
\node[block, below=0.6 of P] (K) {$K$};
\coordinate[right=1.0 of W1] (z);
\coordinate[left=1.0 of W3] (w);
% Connections
\draw[->] (G.east) -- (addr.west);
\draw[->] ($(addr.east)+( 0.2, 0)$)node[branch]{} |- (W1.west);
\draw[->] ($(addd.west)+(-0.4, 0)$)node[branch]{} |- (W2.west);
\draw[->] (W1.east) -- (W1-|z) node[above left](z1){$z_1$};
\draw[->] (W2.east) -- (W2-|z) node[above left](z2){$z_2$};
\draw[->] (addr.east) -- (addw-|z) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} (addd-|w) -- (addd.west);
\draw[->] (addd.east) -- (G.west);
\draw[->] (W3.east) -| (addd.north);
\draw[->] (W4.east) -| (addr.north);
\draw[->] (w) node[above right]{$w_1$} -- (W3.west);
\draw[->] (w|-W4) node[above right]{$w_2$} -- (W4.west);
\end{tikzpicture}
#+end_src
#+name : fig:general_conf_shaping_S_T_KS_GS
#+caption : Generalized Plant to shape $S$, $T$, $KS$ and $GS$
2020-12-04 23:38:01 +01:00
#+attr_latex : :float nil
2020-11-30 19:42:57 +01:00
#+RESULTS :
[[file:figs/general_conf_shaping_S_T_KS_GS.png ]]
2020-12-03 01:07:02 +01:00
Weighting functions:
- $W_1$ is used to shape $S$
- $W_2$ is used to shape $KS$
- $W_1W_3$ is used to shape $GS$
- $W_2W_3$ is used to shape $T$
2020-11-30 19:42:57 +01:00
#+begin_src matlab :eval no :tangle no
2020-12-04 23:38:01 +01:00
P = [ 1 -G -G
0 0 1
1 -G -G];
Pw = blkdiag(W1, W2, 1)*P*blkdiag(1, W3, 1);
2020-11-30 19:42:57 +01:00
#+end_src
2020-12-04 23:38:01 +01:00
#+latex : \end{exampl}
2020-11-30 19:42:57 +01:00
#+HTML : </details>
2020-12-01 18:49:40 +01:00
*** Limitation :ignore:
2020-12-03 11:51:44 +01:00
#+begin_important
2020-12-03 01:07:02 +01:00
When shaping multiple closed-loop transfer functions, one should be very careful about the three following points that are further discussed:
- The shaped closed-loop transfer functions are linked by mathematical relations and cannot be shaped independently
- Closed-loop transfer function can only be shaped in certain frequency range
2020-12-01 18:49:40 +01:00
- The size of the obtained controller may be very large and not implementable in practice
2020-12-03 11:51:44 +01:00
#+end_important
2020-12-01 18:49:40 +01:00
#+begin_warning
Mathematical relations are linking the closed-loop transfer functions.
2020-12-03 01:07:02 +01:00
For instance, the sensitivity function $S(s)$ and the complementary sensitivity function $T(s)$ are linked by the following well known relation:
2020-12-01 18:49:40 +01:00
\begin{equation}
S(s) + T(s) = 1
\end{equation}
This means that $|S(j\omega)|$ and $|T(j\omega)|$ cannot be made small at the same time!
It is therefore *not* possible to shape the four closed-loop transfer functions independently.
The weighting function should be carefully design such as these fundamental relations are not violated.
#+end_warning
2020-12-03 01:07:02 +01:00
For practical control systems, above some frequency (the control bandwidth), the loop gain is much smaller than 1.
On the other size, there is a frequency range where the loop gain is much larger than 1, this frequency range is called the bandwidth.
Let's see what does that means for the closed-loop transfer function.
First, take the case of the sensibility function:
2020-12-01 18:49:40 +01:00
\begin{align*}
&|G(j\omega) K(j\omega)| \ll 1 \Longrightarrow |S(j\omega)| = \frac{1}{1 + |G(j\omega)K(j\omega)|} \approx 1 \\
&|G(j\omega) K(j\omega)| \gg 1 \Longrightarrow |S(j\omega)| = \frac{1}{1 + |G(j\omega)K(j\omega)|} \approx \frac{1}{|G(j\omega)K(j\omega)|}
\end{align*}
2020-12-03 01:07:02 +01:00
This means that the Sensitivity function cannot be shaped at frequencies where the loop gain is small.
2020-12-01 18:49:40 +01:00
Similar relationship can be found for $T$, $KS$ and $GS$.
#+begin_exercice
Determine the approximate norms of $T$, $KS$ and $GS$ for large loop gains ($|G(j\omega) K(j\omega)| \gg 1$) and small loop gains ($|G(j\omega) K(j\omega)| \ll 1$).
#+HTML : <details><summary>Hint</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Hint}
2020-12-01 18:49:40 +01:00
You can follows this procedure for $T$, $KS$ and $GS$:
2020-12-03 01:07:02 +01:00
1. Write the closed-loop transfer function as a function of $K(s)$ and $G(s)$
2. Take $|K(j\omega)G(j\omega)| \gg 1$ and conclude on the norm of the closed-loop transfer function
3. Take $|K(j\omega)G(j\omega)| \ll 1$ and conclude
2020-12-01 18:49:40 +01:00
#+HTML : </details>
#+HTML : <details><summary>Answer</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Answer}
2020-12-01 18:49:40 +01:00
The obtained constrains are shown in Figure [[fig:h-infinity-4-blocs-constrains ]].
#+HTML : </details>
#+end_exercice
2020-12-03 01:07:02 +01:00
Depending on the frequency band, the norms of the closed-loop transfer functions are a function of the controller $K$ and therefore can be shaped.
However, in some frequency band, the norms do not depend on the controller and therefore *cannot* be shaped.
2020-12-01 18:49:40 +01:00
Therefore the weighting functions should only focus on certainty frequency range depending on the transfer function being shaped.
These regions are summarized in Figure [[fig:h-infinity-4-blocs-constrains ]].
#+begin_src latex :file h-infinity-4-blocs-constrains.pdf
2020-11-30 19:42:57 +01:00
\begin{tikzpicture}
\begin{scope}[shift={(0, 0)}]
\draw[fill=blue!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -0.5) node[]{$\sim GK^{-1}$};
\draw[fill=red!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.5) node[]{$\sim 1$};
\draw[fill=red!20] (2.5, 0.15) circle (0.15);
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,-2) to[out=45,in=180+45] (2,0) to[out=45,in=180] (2.5,0.3) to[out=0,in=180] (3.5,0) to[out=0,in=180] (5, 0);
2020-12-01 18:49:40 +01:00
\draw[dashed] rectangle ;
\begin{scope}[on background layer]
\node[fit={(-0.5, -2.7) (5.5, 1.4)}, inner sep=0pt, draw, dashed, fill=black!20!white] (S) {};
\node[below] at (S.north) {$S$};
\end{scope}
2020-11-30 19:42:57 +01:00
\end{scope}
\begin{scope}[shift={(6.4, 0)}]
2020-12-01 18:49:40 +01:00
\draw[fill=blue!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -0.5) node[]{$\sim K^{-1}$};
\draw[fill=red!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.5) node[]{$\sim G$};
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,-2) to[out=45,in=180+45] (1, -1) to[out=45, in=180] (2.5,-0.2) to[out=0,in=180-45] (4,-1) to[out= -45,in=180-45] (5, -2);
\begin{scope}[on background layer]
\node[fit={(-0.5, -2.7) (5.5, 1.4)}, inner sep=0pt, draw, dashed, fill=black!20!white] (GS) {};
\node[below] at (GS.north) {$GS$};
\end{scope}
\end{scope}
\begin{scope}[shift={(0, -4.4)}]
\draw[fill=red!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -1.8) node[]{$\sim G^{-1}$};
\draw[fill=blue!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.3) node[]{$\sim K$};
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,-1.5) to[out=45,in=180+45] (1, -0.5) to[out=45, in=180] (2.5,0.3) to[out=0,in=180-45] (4,-0.5) to[out= -45,in=180-45] (5, -1.5);
\begin{scope}[on background layer]
\node[fit={(-0.5, -2.7) (5.5, 1.4)}, inner sep=0pt, draw, dashed, fill=black!20!white] (KS) {};
\node[below] at (KS.north) {$KS$};
\end{scope}
\end{scope}
\begin{scope}[shift={(6.4, -4.4)}]
2020-11-30 19:42:57 +01:00
\draw[fill=red!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -0.5) node[]{$\sim 1$};
\draw[fill=blue!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.5) node[]{$\sim GK$};
\draw[fill=red!20] (2.5, 0.15) circle (0.15);
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,0) to[out=0,in=180] (1.5,0) to[out=0,in=180] (2.5,0.3) to[out=0,in= -45] (3,0) to[out=-45,in=180-45] (5, -2);
2020-12-01 18:49:40 +01:00
\begin{scope}[on background layer]
\node[fit={(-0.5, -2.7) (5.5, 1.4)}, inner sep=0pt, draw, dashed, fill=black!20!white] (T) {};
\node[below] at (T.north) {$T$};
\end{scope}
2020-11-30 19:42:57 +01:00
\end{scope}
\end{tikzpicture}
#+end_src
2020-12-01 18:49:40 +01:00
#+name : fig:h-infinity-4-blocs-constrains
2020-12-03 01:07:02 +01:00
#+caption : Shaping the Gang of Four. Blue regions indicate that the transfer function can be shaped using $K$. Red regions indicate this is not the case
2020-11-30 19:42:57 +01:00
#+RESULTS :
2020-12-01 18:49:40 +01:00
[[file:figs/h-infinity-4-blocs-constrains.png ]]
#+begin_warning
2020-12-03 01:07:02 +01:00
The order (e.g. number of state) of the controller given by the $\mathcal{H}_\infty$ synthesis is equal to the order (e.g. number of state) of the weighted generalized plant.
2020-12-01 18:49:40 +01:00
It is thus equal to the *sum* of the number of state of the non-weighted generalized plant and the number of state of all the weighting functions.
2020-12-03 01:07:02 +01:00
Then, the $\mathcal{H}_\infty$ synthesis usually generate a controller with a very high order that is not implementable in practice.
2020-11-30 19:42:57 +01:00
2020-12-01 18:49:40 +01:00
Two approaches can be used to obtain controllers with reasonable order:
1. use simple weights (usually first order)
2. perform a model reduction on the obtained high order controller
#+end_warning
* Mixed-Sensitivity $\mathcal{H}_\infty$ Control - Example
<<sec:h_infinity_mixed_sensitivity >>
2020-12-03 11:51:44 +01:00
** Introduction :ignore:
Let's now apply the $\mathcal{H}_\infty$ Shaping control procedure on a practical example.
In Section [[sec:ex_control_problem ]] the control problem is presented.
2020-12-03 12:13:53 +01:00
The design procedure used to apply the $\mathcal{H}_\infty$ Mixed Sensitivity synthesis is described in Section [[sec:ex_control_procedure ]].
2020-12-03 11:51:44 +01:00
2020-12-03 12:13:53 +01:00
The important step of interpreting the specifications as wanted shape of closed-loop transfer functions is performed in Section [[sec:ex_specification_interpretation ]].
2020-12-03 11:51:44 +01:00
2020-12-03 12:13:53 +01:00
Finally, the shaping of closed-loop transfer functions is performed in Sections [[sec:ex_shaping_S ]], [[sec:ex_shaping_GS ]] and [[sec:ex_shaping_T ]].
2020-12-03 11:51:44 +01:00
2020-12-02 11:00:11 +01:00
** Control Problem
2020-12-03 11:51:44 +01:00
<<sec:ex_control_problem >>
2020-12-03 12:13:53 +01:00
Let's consider our usual /test system/ shown in Figure [[fig:ex_test_system ]].
2020-12-03 11:51:44 +01:00
#+begin_src latex :file ex_test_system.png
\begin{tikzpicture}
% Parameters
\def\massw{3}
\def\massh{1}
\def\spaceh{1.8}
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
% Ground
\draw[] (-0.5*\massw, 0) -- (0.5* \massw, 0);
% Mass
\draw[fill=white] (-0.5*\massw, \spaceh) rectangle (0.5* \massw, \spaceh+\massh) node[pos=0.5](m){$m$};
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
% Spring, Damper, and Actuator
\draw[spring] (-0.3*\massw, 0) -- (-0.3* \massw, \spaceh) node[midway, left=0.1]{$k$};
\draw[damper] ( 0, 0) -- ( 0, \spaceh) node[midway, left=0.3]{$c$};
\draw[actuator] ( 0.3*\massw, 0) -- (0.3* \massw, \spaceh) node[midway](F){};
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
% Displacements
\draw[dashed] (0.5*\massw, 0) -- ++(0.5, 0);
\draw[->] (0.6*\massw, 0) -- ++(0, 0.5) node[below right]{$d$};
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
% Inertial Sensor
\node[inertialsensor] (inertials) at (0.5*\massw, \spaceh+\massh){};
\node[addb={+}{}{}{}{}, right=0.8 of inertials] (addn) {};
\node[addb={+}{-}{}{}{}, right=0.8 of addn] (subf) {};
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
\node[block, below=0.4 of subf] (K){$K(s)$};
\draw[->] (inertials.east) node[above right]{$y$} -- (addn.west);
\draw[->] (addn.east) -- (subf.west);
\draw[<-] (addn.north) -- ++(0, 0.6) node[below right]{$n$};
\draw[<-] (subf.north) -- ++(0, 0.6) node[below right]{$r$};
\draw[->] (subf.south) -- (K.north) node[above right]{$\epsilon$};
\draw[->] (K.south) |- (F.east) node[above right]{$u$};
\end{tikzpicture}
#+end_src
#+name : fig:ex_test_system
#+caption : Test System consisting of a payload with a mass $m$ on top of an active system with a stiffness $k$, damping $c$ and an actuator. A feedback controller $K(s)$ is added to position / isolate the payload.
#+RESULTS :
[[file:figs/ex_test_system.png ]]
#+begin_important
The control specifications are:
- The displacement $y$ should follow reference inputs $r$ with negligible static error after 0.1s
- Reject disturbances $d$ in less than 0.1s
2020-12-03 12:13:53 +01:00
- Limit the effect of measurement noise $n$ on the output displacement $y$
2020-12-03 11:51:44 +01:00
- Obtain a Robust System with good stability margins
#+end_important
The considered inputs are:
- disturbances $d$ as step inputs with an amplitude of $5\,\mu m$
- reference inputs with are ramp inputs with a slope of $100\,\mu m/s$ and a time duration of $0.2\,s$
- measurement noise $n$ with a large spectral density at high frequency (increasing starting from 100Hz)
** Control Design Procedure
<<sec:ex_control_procedure >>
Here is the general design procedure that will be followed:
1. Compute the model of the plant
2020-12-03 12:13:53 +01:00
2. Write the control system as a general control problem
3. Translate the specifications into the wanted shape of closed-loop transfer functions
4. Chose the suitable weighted general plant to shape the wanted quantities
5. Shape sequentially the chosen closed-loop transfer functions
2020-12-03 11:51:44 +01:00
2020-12-04 23:38:01 +01:00
Let's first convert the system of Figure [[fig:ex_test_system ]] into the classical feedback architecture of Figure [[fig:classical_feedback_test_system_bis ]].
2020-12-03 11:51:44 +01:00
#+begin_src latex :file ex_test_system_feedback.pdf
\begin{tikzpicture}
\node[addb={+}{}{}{}{-}] (addfb) at (0, 0){};
\node[block, right=0.8 of addfb] (K){$K(s)$};
\node[block, right=0.8 of K] (G){$G(s)$};
\node[addb={+}{}{}{}{}, right=0.8 of G] (addd){};
\node[block, above=0.5 of addd] (Gd){$G_d(s)$};
\node[addb, below right=0.8 and 0.4 of addd] (addn){};
\draw[<-] (addfb.west) -- ++(-0.8, 0) node[above right]{$r$};
\draw[->] (addfb.east) -- (K.west) node[above left]{$\epsilon$};
\draw[->] (K.east) -- (G.west) node[above left]{$u$};
\draw[->] (G.east) -- (addd.west);
\draw[<-] (Gd.north) -- ++(0, 0.8) node[below right]{$d$};
\draw[->] (Gd.south) -- (addd.north);
\draw[->] (addd.east) -- ++(1.5, 0) coordinate(y);
\draw[->] (addd-|addn) node[branch]{} node[above]{$y$} -- (addn.north);
\draw[->] (addn.west) -| (addfb.south);
\draw[<-] (addn.east) -- (addn-|y) node[above left]{$n$};
\end{tikzpicture}
#+end_src
2020-12-04 23:38:01 +01:00
#+name : fig:classical_feedback_test_system_bis
2020-12-03 11:51:44 +01:00
#+caption : Block diagram corresponding to the example system
#+RESULTS :
[[file:figs/ex_test_system_feedback.png ]]
The two transfer functions present in the system are derived and defined below:
#+begin_src matlab -n
2020-12-02 11:00:11 +01:00
k = 1e6; % Stiffness [N/m]
c = 4e2; % Damping [N/(m/s)]
m = 10; % Mass [kg]
2020-12-03 11:51:44 +01:00
% Control Plant
G = 1/(m*s^2 + c*s + k);
% Disturbance dynamics
Gd = (c*s + k)/(m*s^2 + c*s + k);
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
We also define the inputs signals that will be used for time domain simulations.
They are graphically shown in Figure [[fig:ex_inputs_signals ]].
#+begin_src matlab +n
% Time Vector
t = 0:1e-4:0.5;
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
% Reference Input
2020-12-02 11:00:11 +01:00
r = zeros(size(t));
2020-12-03 11:51:44 +01:00
r(t>0.05 & t<=0.25) = 1e-4*(t(t >0.05 & t<=0.25)-0.05);
r(t>0.25) = 2e-5;
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
% Measurement Noise
2020-12-02 11:00:11 +01:00
Fs = 1e3; % Sampling Frequency [Hz]
Ts = 1/Fs; % Sampling Time [s]
n = sqrt(Fs/2)*randn(1, length(t)); % Signal with an ASD equal to one
2020-12-03 11:51:44 +01:00
n = lsim(1e-6*(s + 2*pi*1e2)^2/(s + 2*pi*1e3)^2/(1+s/2/pi/500), n, t)'; % Shaped noise
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
% Disturbance
2020-12-02 11:00:11 +01:00
d = zeros(size(t));
2020-12-03 11:51:44 +01:00
d(t>0.3) = 5e-6;
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :exports none
figure;
tiledlayout(2, 2, 'TileSpacing', 'None', 'Padding', 'None');
nexttile;
plot(t, 1e6*r, 'k-')
xlabel('Time [s]');
ylabel('Reference Signal $[\mu m]$');
nexttile;
plot(t, 1e6*n, 'k-')
xlabel('Time [s]');
ylabel('Measurement Noise $[\mu m]$');
nexttile;
plot(t, 1e6*d, 'k-')
xlabel('Time [s]');
ylabel('Disturbance Motion $[\mu m]$');
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_inputs_signals.pdf', 'width', 'full', 'height', 'tall');
#+end_src
#+name : fig:ex_inputs_signals
#+caption : Time domain inputs signals
#+RESULTS :
[[file:figs/ex_inputs_signals.png ]]
We also define the generalized plant corresponding to the system and that will be used for time domain simulations (Figure [[fig:ex_general_plant_sim ]]).
#+begin_src latex :file ex_general_plant_sim.pdf
\begin{tikzpicture}
\node[block] (G) {$G(s)$};
\node[block, above=0.4 of G] (Gd) {$G_d(s)$};
\node[addb={+}{}{}{}{}, right=0.6 of G] (addw) {};
\node[addb={+}{}{}{}{}, right=0.8 of addw] (addn) {};
\node[addb={+}{-}{}{}{}, right=0.6 of addn] (addr) {};
\coordinate[above right=1.8 and 1.4 of addr] (u);
\coordinate[above=0.6 of u] (y);
\coordinate[left=1.4 of Gd] (d);
\coordinate[above=0.8 of d] (n);
\coordinate[above=0.8 of n] (r);
\node[branch, left=0.6 of G] (uin) {};
\node[block, below right=0.8 and 0.6 of G] (K) {$K(s)$};
% Connections
\draw[->] (G.east) -- (addw.west);
\draw[->] ($(addw.east)+(0.3, 0)$)node[branch]{} |- (y) node[above left](z1){$y$};
\draw[->] (addw.east) -- (addn.west);
\draw[->] (addn.east) -- (addr.west);
\draw[->] (uin) |- (u) node[above left](z2){$u$};
2020-12-03 12:13:53 +01:00
\draw[->] (addr.east) -- (addw-|z1) |- node[near start, right]{$\epsilon$} (K.east);
2020-12-03 11:51:44 +01:00
\draw[->] (K.west) -| node[near end, left]{$u$} (G-|d) -- (G.west);
\draw[->] (Gd.east) -| (addw.north);
\draw[->] (d) node[above right]{$d$} -- (Gd.west);
\draw[->] (n) node[above right]{$n$} -| (addn.north);
\draw[->] (r) node[above right]{$r$} -| (addr.north);
\begin{scope}[on background layer]
\node[fit={(G.south-|uin) ($(z1.north west)+(-0.4, 0)$)}, inner sep=6pt, draw, dashed, fill=black!20!white] (P) {};
\node[above] at (P.north) {Generalized Plant $P_{\text{sim}}(s)$};
\end{scope}
\end{tikzpicture}
#+end_src
#+name : fig:ex_general_plant_sim
#+caption : Generalized plant that will be used for simulations
#+RESULTS :
[[file:figs/ex_general_plant_sim.png ]]
The Generalized plant of Figure [[fig:ex_general_plant_sim ]] is defined on Matlab as follows:
#+begin_src matlab +n
Psim = [0 0 Gd G
0 0 0 1
1 -1 -Gd -G];
Psim.InputName = {'r', 'n', 'd', 'u'};
Psim.OutputName = {'y', 'u', 'e'};
#+end_src
Time domain simulations will be performed by first computing the closed-loop system using the =lft= command and then using the =lsim= command on the closed-loop system:
#+begin_src matlab +n :tangle no :exec :no
% Compute the closed-Loop System, K is the controller
P_CL = lft(Psim, K);
% Time simulation of the closed-loop system with specified inputs
z = lsim(P_CL, [r; n; d], t);
% The two outputs are
y = z(:,1); % Output Motion [m]
u = z(:,2); % Input usage [N]
#+end_src
** Modern Interpretation of control specifications
<<sec:ex_specification_interpretation >>
#+begin_exercice
1. Translate the control specifications into wanted shape of closed-loop transfer functions
2. Conclude and the closed-loop transfer functions to be shaped
2020-12-03 12:13:53 +01:00
3. Chose a general configuration architecture that allows to shape these transfer function
2020-12-03 11:51:44 +01:00
4. Using Matlab, define the generalized plant
#+HTML : <details><summary>Hint</summary>
2020-12-04 23:38:01 +01:00
#+LATEX : \tcbsubtitle{Hint}
2020-12-03 11:51:44 +01:00
1. Make use of Table [[tab:usual_shaping_gang_four ]]
2. Make use of Table [[tab:usual_shaping_gang_four ]]
3. See Section [[sec:shaping_multiple_tf ]]
4. See Section [[sec:shaping_multiple_tf ]]
#+HTML : </details>
#+end_exercice
After converting the control specifications into wanted shape of closed-loop transfer functions, we might come up with the Table [[tab:ex_specification_shapes ]].
In such case, we want to shape $S$, $GS$ and $T$.
#+name : tab:ex_specification_shapes
#+caption : Control Specifications and associated wanted shape of the closed-loop transfer functions
2020-12-04 23:54:53 +01:00
#+attr_latex : :environment tabularx :width 0.7\linewidth :align llX
2020-12-04 23:38:01 +01:00
| <l> | <c> | <l> |
| *Specification* | *TF* | *Wanted Shape* |
|--------------------------+-----------+------------------------------------|
| Follow Step Reference | $S$ | +40dB of slope at low frequency |
| Reject Disturbances | $S$, $GS$ | Small gain |
| Reject measurement noise | $T$ | Small high frequency (>100Hz) gain |
| Robust System | $S$ | Small $\Vert S \Vert_\infty$ |
2020-12-03 11:51:44 +01:00
To do so, we use to generalized plant shown in Figure [[fig:ex_general_plant ]] for the synthesis where the three closed-loop tranfert functions from $w$ to $[z_1\,,z_2\,,z_3]$ are respectively $S$, $GS$ and $T$.
This generalized plant is defined on Matlab as follows:
#+begin_src matlab +n :tangle no :exec no
P = [1 -1
G -G
0 1
G -G];
#+end_src
#+begin_src latex :file ex_general_plant.pdf
\begin{tikzpicture}
% Blocs
\node[block] (G) {$G$};
\node[addb={+}{-}{}{}{}, left=0.8 of G] (addw) {};
\coordinate[above right=0.6 and 1.2 of G] (z3);
\coordinate[above=0.8 of z3] (z2);
\coordinate[above=0.8 of z2] (z1);
\coordinate (addwin) at ($(addw.west)+(-0.5, 0)$);
\begin{scope}[on background layer]
\node[fit={(addwin|-G.south) ($(z1)+(-1.0, 0)$)}, inner sep=8pt, draw, dashed, fill=black!20!white] (P) {};
\node[above] at (P.north) {Generalized Plant $P$};
\end{scope}
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
\node[block, below=0.6 of P] (K) {$K$};
\coordinate[above left=2.4 and 0.8 of addwin] (w);
% Connections
\draw[->] (addw.east) -- (G.west);
\draw[->] ($(addw.east)+( 0.3, 0)$)node[branch]{} |- (z1) node[above left](z1){$z_1$};
\draw[->] ($(G.east)+(0.3, 0)$)node[branch]{} |- (z2) node[above left](z2){$z_2$};
\draw[->] (addwin)node[branch]{} |- (z3) node[above left](z3){$z_3$};
\draw[->] (G.east) -- (G-|z1) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} (addw-|w) -- (addw.west);
\draw[->] (w) node[above right]{$w$} -| (addw.north);
\end{tikzpicture}
#+end_src
#+name : fig:ex_general_plant
#+caption : Generalized plant chosen for the shaping of $S$, $GS$ $T$
#+RESULTS :
[[file:figs/ex_general_plant.png ]]
However, to performed the $\mathcal{H}_\infty$ loop shaping, we have to include *weighting function* to the Generalized plant.
We obtain the *weighted generalized plant* in Figure [[fig:ex_general_weighted_plant ]], and that is computed using Matlab as follows:
#+begin_src matlab +n :eval no :tangle no
Pw = blkdiag(W1, W2, W3, 1)*P;
#+end_src
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
#+begin_src latex :file ex_general_weighted_plant.png
2020-12-02 11:00:11 +01:00
\begin{tikzpicture}
% Blocs
\node[block] (G) {$G$};
2020-12-03 11:51:44 +01:00
\node[addb={+}{-}{}{}{}, left=0.8 of G] (addw) {};
\node[block, above right=0.4 and 0.8 of G] (W3) {$W_3$};
2020-12-02 11:00:11 +01:00
\node[block, above=0.2 of W3] (W2) {$W_2$};
\node[block, above=0.2 of W2] (W1) {$W_1$};
2020-12-03 11:51:44 +01:00
\coordinate (addwin) at ($(addw.west)+(-0.5, 0)$);
2020-12-02 11:00:11 +01:00
\begin{scope}[on background layer]
2020-12-03 11:51:44 +01:00
\node[fit={(addwin|-G.south) (W1.north east)}, inner sep=8pt, draw, dashed, fill=black!20!white] (P) {};
2020-12-02 11:00:11 +01:00
\node[above] at (P.north) {Weighted Generalized Plant $P$};
\end{scope}
\node[block, below=0.6 of P] (K) {$K$};
\coordinate[right=0.8 of W1] (z);
2020-12-03 11:51:44 +01:00
\coordinate[above left=2.4 and 0.8 of addwin] (w);
2020-12-02 11:00:11 +01:00
% Connections
2020-12-03 11:51:44 +01:00
\draw[->] (addw.east) -- (G.west);
\draw[->] ($(addw.east)+( 0.3, 0)$)node[branch]{} |- (W1.west);
\draw[->] ($(G.east)+(0.3, 0)$)node[branch]{} |- (W2.west);
\draw[->] (addwin)node[branch]{} |- (W3.west);
2020-12-02 11:00:11 +01:00
\draw[->] (W1.east) -- (W1-|z) node[above left](z1){$z_1$};
\draw[->] (W2.east) -- (W2-|z) node[above left](z2){$z_2$};
\draw[->] (W3.east) -- (W3-|z) node[above left](z3){$z_3$};
2020-12-03 11:51:44 +01:00
\draw[->] (G.east) -- (G-|z) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} (addw-|w) -- (addw.west);
2020-12-02 11:00:11 +01:00
\draw[->] (w) node[above right]{$w$} -| (addw.north);
\end{tikzpicture}
#+end_src
2020-12-03 11:51:44 +01:00
#+name : fig:ex_general_weighted_plant
#+caption : Generalized weighted plant used for the $\mathcal{H}_\infty$ Synthesis
2020-12-02 11:00:11 +01:00
#+RESULTS :
2020-12-03 11:51:44 +01:00
[[file:figs/ex_general_weighted_plant.png ]]
2020-12-02 11:00:11 +01:00
2020-12-03 12:13:53 +01:00
Finlay, performing the $\mathcal{H}_\infty$ Shaping of $S$, $GS$ and $T$ is as simple as ruining the =hinfsyn= command:
2020-12-03 11:51:44 +01:00
#+begin_src matlab +n :eval no :tangle no
K = hinfsyn(Pw, 1, 1);
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 12:13:53 +01:00
Now let's shape the three closed-loop transfer functions sequentially:
2020-12-03 11:51:44 +01:00
- $S$ is shaped in Section [[sec:ex_shaping_S ]]
- $GS$ is shaped in Section [[sec:ex_shaping_GS ]]
- $T$ is shaped in Section [[sec:ex_shaping_T ]]
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
** Step 1 - Shaping of $S$
<<sec:ex_shaping_S >>
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
Let's first shape the Sensitivity function as it is usually the most important of the /Gang of four/ closed-loop transfer functions.
To do so, we have to create a weight $W_1(s)$ that defines the wanted upper bound on $|S(j\omega)|$:
- small low frequency gain: $|S(j\cdot 0)| = 10^{-3}$
- minimum crossover frequency of $\approx 10Hz$: $|S(j2\pi 10)| < \frac{1}{\sqrt{2}}$
- small maximum peak magnitude for robustness properties: $\|S\|_\infty < 2$
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
The weighting function is design using the =generateWeigh= function and its inverse shape can be seen in Figure
#+begin_src matlab +n
2020-12-02 11:00:11 +01:00
W1 = generateWeight('G0', 1e3, ...
'G1', 1/2, ...
'Gc', sqrt(2), 'wc', 2*pi*10, ...
'n', 1);
#+end_src
2020-12-03 11:51:44 +01:00
To not constrain $GS$ and $T$ for the shaping of $S$, $W_2$ and $W_3$ are first taken as very small gains:
#+begin_src matlab +n
W2 = tf(1e-8);
W3 = tf(1e-8);
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
The $\mathcal{H}_\infty$ synthesis is performed and the obtained closed-loop transfer functions $S$, $GS$, and $T$ and compared with the upper bounds set by the weighting functions in Figure [[fig:ex_results_1 ]].
2020-12-03 12:13:53 +01:00
#+begin_src matlab +n :results output replace
2020-12-03 11:51:44 +01:00
Pw = blkdiag(W1, W2, W3, 1)*P;
2020-12-02 11:00:11 +01:00
K1 = hinfsyn(Pw, 1, 1, 'Display', 'on');
#+end_src
#+RESULTS :
#+begin_example
2020-12-03 11:51:44 +01:00
Test bounds: 0.5 <= gamma <= 0.51
2020-12-02 11:00:11 +01:00
gamma X>=0 Y>=0 rho(XY)<1 p/f
2020-12-03 11:51:44 +01:00
5.05e-01 0.0e+00 0.0e+00 5.511e-14 p
2020-12-02 11:00:11 +01:00
Limiting gains...
2020-12-03 11:51:44 +01:00
5.05e-01 0.0e+00 0.0e+00 1.867e-14 p
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
Best performance (actual): 0.502
2020-12-02 11:00:11 +01:00
#+end_example
2020-12-03 11:51:44 +01:00
#+begin_src matlab :exports none
% Closed-loop tranfer functions are computed
2020-12-02 11:00:11 +01:00
Z1 = lft(P, K1);
#+end_src
#+begin_src matlab :exports none
2020-12-03 11:51:44 +01:00
freqs = logspace(-1, 3, 1000);
2020-12-02 11:00:11 +01:00
figure;
2020-12-03 11:51:44 +01:00
tiledlayout(2, 2, 'TileSpacing', 'None', 'Padding', 'None');
2020-12-02 11:00:11 +01:00
ax1 = nexttile;
hold on;
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 1');
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), 'k--', 'DisplayName', '$|W|^{-1}$');
2020-12-02 11:00:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('S');
2020-12-03 11:51:44 +01:00
legend('location', 'southeast');
2020-12-02 11:00:11 +01:00
ax2 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(Z1(2,1), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
2020-12-03 11:51:44 +01:00
title('GS');
2020-12-02 11:00:11 +01:00
ax3 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(Z1(3,1), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('T');
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_results_1.pdf', 'width', 'full', 'height', 'full');
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
#+name : fig:ex_results_1
#+caption : Obtained Shape Closed-Loop transfer functions (dashed black lines indicate inverse magnitude of the weighting functions)
#+RESULTS :
[[file:figs/ex_results_1.png ]]
Time domain simulation is then performed and the obtained output displacement and control inputs are shown in Figure [[fig:ex_time_domain_1 ]].
We can see:
- we are not able to follow the ramp input. This have to be solved by modifying the weighting function $W_1(s)$
- we have poor rejection of disturbances. This we be solve by shaping $GS$ in Section [[sec:ex_shaping_GS ]]
- we have quite large effect of the measurement noise. This will be solved by shaping $T$ in Section [[sec:ex_shaping_T ]]
#+begin_src matlab :exports none
% Closed-loop simulation
Z1sim = lft(Psim, K1);
2020-12-02 11:00:11 +01:00
z = lsim(Z1sim, [r;n;d], t);
y1 = z(:,1);
u1 = z(:,2);
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :exports none
2020-12-02 11:00:11 +01:00
figure;
tiledlayout(1, 2, 'TileSpacing', 'None', 'Padding', 'None');
nexttile;
hold on;
2020-12-03 11:51:44 +01:00
plot(t, 1e6*y1, 'DisplayName', 'Step 1');
plot(t, 1e6*r, 'k--', 'DisplayName', '$r$');
2020-12-02 11:00:11 +01:00
hold off;
2020-12-03 11:51:44 +01:00
xlabel('Time [s]'); ylabel('Output $y$ [$\mu m$]');
legend('location', 'southeast');
2020-12-02 11:00:11 +01:00
nexttile;
hold on;
plot(t, u1);
hold off;
xlabel('Time [s]'); ylabel('Control Input $u$ [N]');
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_time_domain_1.pdf', 'width', 'full', 'height', 'tall');
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
#+name : fig:ex_time_domain_1
#+caption : Time domain simulation results
#+RESULTS :
[[file:figs/ex_time_domain_1.png ]]
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
Remember that in order to follow ramp inputs, the sensitivity function should have a slope of +40dB/dec at low frequency (Table [[tab:usual_shaping_gang_four ]]).
To do so, let's modify $W_1$ to impose a slope of +40dB/dec at low frequency.
This can simple be done by using a second order weight:
2020-12-03 12:13:53 +01:00
#+begin_src matlab +n
2020-12-03 11:51:44 +01:00
W1 = generateWeight('G0', 1e3, ...
'G1', 1/2, ...
'Gc', sqrt(2), 'wc', 2*pi*15, ...
'n', 2);
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
The $\mathcal{H}_\infty$ synthesis is performed using the new weights and the obtained closed-loop shaped are shown in figure [[fig:ex_results_1b ]].
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
The time domain signals are shown in Figure [[fig:ex_time_domain_1b ]] and it is confirmed that the ramps are now follows without static errors.
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
#+begin_src matlab :exports none
Pw = blkdiag(W1, W2, W3, 1)*P;
K1b = hinfsyn(Pw, 1, 1, 'Display', 'on');
#+end_src
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
#+begin_src matlab :exports none
% Compute the closed-loop transfer function
Z1b = lft(P, K1b);
2020-12-02 11:00:11 +01:00
#+end_src
#+begin_src matlab :exports none
freqs = logspace(-1, 3, 1000);
figure;
2020-12-03 11:51:44 +01:00
tiledlayout(2, 2, 'TileSpacing', 'None', 'Padding', 'None');
2020-12-01 18:49:40 +01:00
2020-12-02 11:00:11 +01:00
ax1 = nexttile;
hold on;
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 1');
plot(freqs, abs(squeeze(freqresp(Z1b(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 1b');
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), 'k--', 'DisplayName', '$|W^{-1}|$');
2020-12-02 11:00:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('S');
2020-12-03 11:51:44 +01:00
legend('location', 'southeast');
2020-12-02 11:00:11 +01:00
ax2 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(Z1(2,1), freqs, 'Hz'))));
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1b(2,1), freqs, 'Hz'))));
2020-12-02 11:00:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('GS');
ax3 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(Z1(3,1), freqs, 'Hz'))));
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1b(3,1), freqs, 'Hz'))));
2020-12-02 11:00:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('T');
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_results_1b.pdf', 'width', 'full', 'height', 'full');
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
#+name : fig:ex_results_1b
#+caption : Obtained Shape Closed-Loop transfer functions
2020-12-02 11:00:11 +01:00
#+RESULTS :
2020-12-03 11:51:44 +01:00
[[file:figs/ex_results_1b.png ]]
2020-12-02 11:00:11 +01:00
#+begin_src matlab :exports none
2020-12-03 11:51:44 +01:00
% Closed-loop simulations
2020-12-02 11:00:11 +01:00
Z1bsim = lft(Psim, K1b);
z = lsim(Z1bsim, [r;n;d], t);
y1b = z(:,1);
u1b = z(:,2);
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :exports none
2020-12-02 11:00:11 +01:00
figure;
tiledlayout(1, 2, 'TileSpacing', 'None', 'Padding', 'None');
nexttile;
hold on;
2020-12-03 11:51:44 +01:00
plot(t, 1e6*y1, 'DisplayName', 'Step 1');
plot(t, 1e6*y1b, 'DisplayName', 'Step 1b');
plot(t, 1e6*r, 'k--', 'DisplayName', '$r$');
2020-12-02 11:00:11 +01:00
hold off;
2020-12-03 11:51:44 +01:00
xlabel('Time [s]'); ylabel('Output $y$ [$\mu m$]');
legend('location', 'southeast');
2020-12-02 11:00:11 +01:00
nexttile;
hold on;
plot(t, u1);
plot(t, u1b);
hold off;
xlabel('Time [s]'); ylabel('Control Input $u$ [N]');
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_time_domain_1b.pdf', 'width', 'full', 'height', 'tall');
#+end_src
#+name : fig:ex_time_domain_1b
#+caption : Time domain simulation results
#+RESULTS :
[[file:figs/ex_time_domain_1b.png ]]
2020-12-02 11:00:11 +01:00
** Step 2 - Shaping of $GS$
2020-12-03 11:51:44 +01:00
<<sec:ex_shaping_GS >>
Looking at Figure [[fig:ex_results_2 ]], it is clear that the rejection of disturbances is not satisfactory.
This can also be seen by the large peak of $GS$ in Figure [[fig:ex_results_1b ]].
This poor rejection of disturbances is actually due to the fact that the obtain controller has at notch at the resonance frequency of the plant.
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
To overcome this issue, we can simply increase the magnitude of $W_2$ to limit the peak magnitude of $GS$
Let's take $W_2$ as a simple constant gain:
2020-12-03 12:13:53 +01:00
#+begin_src matlab +n
2020-12-02 11:00:11 +01:00
W2 = tf(4e5);
#+end_src
2020-12-03 11:51:44 +01:00
The $\mathcal{H}_\infty$ Synthesis is performed and the obtained closed-loop transfer functions are shown in Figure [[fig:ex_results_2 ]].
#+begin_src matlab :exports none
2020-12-02 11:00:11 +01:00
Pw = blkdiag(W1, W2, W3, 1)*P;
K2 = hinfsyn(Pw, 1, 1, 'Display', 'on');
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :exports none
2020-12-02 11:00:11 +01:00
Z2 = lft(P, K2);
#+end_src
#+begin_src matlab :exports none
freqs = logspace(-1, 3, 1000);
figure;
2020-12-03 11:51:44 +01:00
tiledlayout(2, 2, 'TileSpacing', 'None', 'Padding', 'None');
2020-12-02 11:00:11 +01:00
ax1 = nexttile;
hold on;
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 1');
plot(freqs, abs(squeeze(freqresp(Z1b(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 1b');
plot(freqs, abs(squeeze(freqresp(Z2(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 2');
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), 'k--', 'DisplayName', '$|W^{-1}|$');
2020-12-02 11:00:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('S');
2020-12-03 11:51:44 +01:00
legend('location', 'southeast');
2020-12-02 11:00:11 +01:00
ax2 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(Z1(2,1), freqs, 'Hz'))));
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1b(2,1), freqs, 'Hz'))));
2020-12-02 11:00:11 +01:00
plot(freqs, abs(squeeze(freqresp(Z2(2,1), freqs, 'Hz'))));
2020-12-03 11:51:44 +01:00
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), 'k--');
2020-12-02 11:00:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('GS');
ax3 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(Z1(3,1), freqs, 'Hz'))));
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1b(3,1), freqs, 'Hz'))));
2020-12-02 11:00:11 +01:00
plot(freqs, abs(squeeze(freqresp(Z2(3,1), freqs, 'Hz'))));
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('T');
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_results_2.pdf', 'width', 'full', 'height', 'full');
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
#+name : fig:ex_results_2
#+caption : Obtained Shape Closed-Loop transfer functions
#+RESULTS :
[[file:figs/ex_results_2.png ]]
Time domain simulation results are shown in Figure [[fig:ex_time_domain_2 ]].
If is shown that indeed, the disturbance rejection performance are much better and only very small oscillation is obtained.
#+begin_src matlab :exports none
Z2sim = lft(Psim, K2);
2020-12-02 11:00:11 +01:00
z = lsim(Z2sim, [r;n;d], t);
y2 = z(:,1);
u2 = z(:,2);
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :exports none
2020-12-02 11:00:11 +01:00
figure;
tiledlayout(1, 2, 'TileSpacing', 'None', 'Padding', 'None');
nexttile;
hold on;
2020-12-03 11:51:44 +01:00
plot(t, 1e6*y1, 'DisplayName', 'Step 1');
plot(t, 1e6*y1b, 'DisplayName', 'Step 1b');
plot(t, 1e6*y2, 'DisplayName', 'Step 2');
plot(t, 1e6*r, 'k--', 'DisplayName', '$r$');
2020-12-02 11:00:11 +01:00
hold off;
2020-12-03 11:51:44 +01:00
xlabel('Time [s]'); ylabel('Output $y$ [$\mu m$]');
legend('location', 'southeast');
2020-12-02 11:00:11 +01:00
nexttile;
hold on;
plot(t, u1);
2020-12-03 11:51:44 +01:00
plot(t, u1b);
2020-12-02 11:00:11 +01:00
plot(t, u2);
hold off;
xlabel('Time [s]'); ylabel('Control Input $u$ [N]');
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_time_domain_2.pdf', 'width', 'full', 'height', 'tall');
#+end_src
#+name : fig:ex_time_domain_2
#+caption : Time domain simulation results
#+RESULTS :
[[file:figs/ex_time_domain_2.png ]]
2020-12-02 11:00:11 +01:00
** Step 3 - Shaping of $T$
2020-12-03 11:51:44 +01:00
<<sec:ex_shaping_T >>
Finally, we want to limit the effect of the noise on the displacement output.
To do so, $T$ is shaped such that its high frequency gain is reduced.
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
This is done by increasing the high frequency gain of the weighting function $W_3$ until the $\mathcal{H}_ \infty$ synthesis gives $\gamma \approx 1$.
The final weighting function $W_3$ is defined as follows:
2020-12-03 12:13:53 +01:00
#+begin_src matlab +n
2020-12-02 11:00:11 +01:00
W3 = generateWeight('G0', 1e-1, ...
'G1', 1e4, ...
'Gc', 1, 'wc', 2*pi*70, ...
'n', 2);
#+end_src
2020-12-03 11:51:44 +01:00
The $\mathcal{H}_\infty$ synthesis is performed and $\gamma$ is closed to one.
#+begin_src matlab :exports none :results output replace
2020-12-02 11:00:11 +01:00
Pw = blkdiag(W1, W2, W3, 1)*P;
K3 = hinfsyn(Pw, 1, 1, 'Display', 'on');
#+end_src
#+RESULTS :
#+begin_example
2020-12-03 11:51:44 +01:00
Test bounds: 0.622 <= gamma <= 1.62
2020-12-02 11:00:11 +01:00
gamma X>=0 Y>=0 rho(XY)<1 p/f
2020-12-03 11:51:44 +01:00
1.01e+00 -1.3e+07 # -6.4e-18 3.459e-04 f
1.28e+00 0.0e+00 0.0e+00 5.369e-02 p
1.13e+00 3.8e-15 0.0e+00 1.695e-01 p
1.07e+00 -5.0e-08 -1.2e-19 1.622e+00 # f
1.10e+00 0.0e+00 0.0e+00 3.147e-01 p
1.08e+00 0.0e+00 0.0e+00 5.327e-01 p
1.08e+00 3.4e-15 0.0e+00 8.052e-01 p
Best performance (actual): 1.08
2020-12-02 11:00:11 +01:00
#+end_example
2020-12-03 11:51:44 +01:00
The obtained closed-loop transfer functions are shown in Figure [[fig:ex_results_3 ]] and we can obverse that:
- The high frequency gain of $T$ is indeed reduced
- This comes as the expense of a large magnitude both $GS$ and $S$.
This means we will probably have slightly less good disturbance rejection and tracking performances.
#+begin_src matlab :exports none
2020-12-02 11:00:11 +01:00
Z3 = lft(P, K3);
#+end_src
#+begin_src matlab :exports none
freqs = logspace(-1, 3, 1000);
figure;
2020-12-03 11:51:44 +01:00
tiledlayout(2, 2, 'TileSpacing', 'None', 'Padding', 'None');
2020-12-02 11:00:11 +01:00
ax1 = nexttile;
hold on;
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 1');
plot(freqs, abs(squeeze(freqresp(Z1b(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 1b');
plot(freqs, abs(squeeze(freqresp(Z2(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 2');
plot(freqs, abs(squeeze(freqresp(Z3(1,1), freqs, 'Hz'))), 'DisplayName', 'Step 3');
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), 'k--', 'DisplayName', '$|W^{-1}|$');
2020-12-02 11:00:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('S');
2020-12-03 11:51:44 +01:00
legend('location', 'southeast');
2020-12-02 11:00:11 +01:00
ax2 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(Z1(2,1), freqs, 'Hz'))));
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1b(2,1), freqs, 'Hz'))));
2020-12-02 11:00:11 +01:00
plot(freqs, abs(squeeze(freqresp(Z2(2,1), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Z3(2,1), freqs, 'Hz'))));
2020-12-03 11:51:44 +01:00
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), 'k--');
2020-12-02 11:00:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('GS');
ax3 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(Z1(3,1), freqs, 'Hz'))));
2020-12-03 11:51:44 +01:00
plot(freqs, abs(squeeze(freqresp(Z1b(3,1), freqs, 'Hz'))));
2020-12-02 11:00:11 +01:00
plot(freqs, abs(squeeze(freqresp(Z2(3,1), freqs, 'Hz'))));
plot(freqs, abs(squeeze(freqresp(Z3(3,1), freqs, 'Hz'))));
2020-12-03 11:51:44 +01:00
plot(freqs, 1./abs(squeeze(freqresp(W3, freqs, 'Hz'))), 'k--');
2020-12-02 11:00:11 +01:00
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
title('T');
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_results_3.pdf', 'width', 'full', 'height', 'full');
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
#+name : fig:ex_results_3
#+caption : Obtained Shape Closed-Loop transfer functions
#+RESULTS :
[[file:figs/ex_results_3.png ]]
The time domain simulation signals are shown in Figure [[fig:ex_time_domain_3 ]].
We can indeed see a slightly less good disturbance rejection.
However, the vibrations induced by the sensor noise is well reduced.
This can be seen when zooming on the output signal in Figure [[fig:ex_time_domaim_3_zoom ]].
#+begin_src matlab :exports none
Z3sim = lft(Psim, K3);
2020-12-02 11:00:11 +01:00
z = lsim(Z3sim, [r;n;d], t);
y3 = z(:,1);
u3 = z(:,2);
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :exports none
2020-12-02 11:00:11 +01:00
figure;
tiledlayout(1, 2, 'TileSpacing', 'None', 'Padding', 'None');
nexttile;
hold on;
2020-12-03 11:51:44 +01:00
plot(t, 1e6*y1, 'DisplayName', 'Step 1');
plot(t, 1e6*y1b, 'DisplayName', 'Step 1b');
plot(t, 1e6*y2, 'DisplayName', 'Step 2');
plot(t, 1e6*y3, 'DisplayName', 'Step 3');
plot(t, 1e6*r, 'k--', 'DisplayName', '$r$');
2020-12-02 11:00:11 +01:00
hold off;
2020-12-03 11:51:44 +01:00
xlabel('Time [s]'); ylabel('Output $y$ [$\mu m$]');
legend('location', 'southeast');
2020-12-02 11:00:11 +01:00
nexttile;
hold on;
plot(t, u1);
2020-12-03 11:51:44 +01:00
plot(t, u1b);
2020-12-02 11:00:11 +01:00
plot(t, u2);
plot(t, u3);
hold off;
xlabel('Time [s]'); ylabel('Control Input $u$ [N]');
#+end_src
2020-12-03 11:51:44 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_time_domain_3.pdf', 'width', 'full', 'height', 'tall');
#+end_src
#+name : fig:ex_time_domain_3
#+caption : Time domain simulation results
#+RESULTS :
[[file:figs/ex_time_domain_3.png ]]
2020-12-02 11:00:11 +01:00
#+begin_src matlab :exports none
figure;
hold on;
2020-12-03 11:51:44 +01:00
plot(t, 1e6*y1, 'DisplayName', 'Step 1');
plot(t, 1e6*y1b, 'DisplayName', 'Step 1b');
plot(t, 1e6*y2, 'DisplayName', 'Step 2');
plot(t, 1e6*y3, 'DisplayName', 'Step 3');
plot(t, 1e6*r, 'k--', 'DisplayName', '$r$');
2020-12-02 11:00:11 +01:00
hold off;
2020-12-03 11:51:44 +01:00
xlabel('Time [s]'); ylabel('Output $y$ [$\mu m$]');
legend('location', 'southeast');
xlim([0.4, 0.5])
#+end_src
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/ex_time_domaim_3_zoom.pdf', 'width', 'wide', 'height', 'normal');
2020-12-02 11:00:11 +01:00
#+end_src
2020-12-03 11:51:44 +01:00
#+name : fig:ex_time_domaim_3_zoom
#+caption : Zoom on the output signal
#+RESULTS :
[[file:figs/ex_time_domaim_3_zoom.png ]]
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
** Conclusion and Discussion
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
Hopefully this practical example will help you apply the $\mathcal{H}_\infty$ Shaping synthesis on other control problems.
2020-12-02 11:00:11 +01:00
2020-12-03 11:51:44 +01:00
As an exercise, plot and analyze the evolution of the controller and loop gain transfer functions during the 3 synthesis steps.
If the large input usage is considered to be not acceptable, the shaping of $KS$ could be included in the synthesis and all the /Gang of four/ closed-loop transfer function shapes.
2020-12-01 18:49:40 +01:00
* Conclusion
<<sec:conclusion >>
2020-11-25 19:35:11 +01:00
2020-12-03 11:51:44 +01:00
Hopefully, this document gave you a glimpse on how useful and powerful the $\mathcal{H}_\infty$ loop shaping synthesis can be.
One of the true power of $\mathcal{H}_\infty$ synthesis is that is can easily be applied to multi-input multi-output systems!
If you want to know more about the "$\mathcal{H}_\infty$ and robust control world" some resources are given below.
2020-11-25 19:35:11 +01:00
* Resources
2020-12-01 18:49:40 +01:00
:PROPERTIES:
:UNNUMBERED: notoc
:END:
2020-11-25 19:35:11 +01:00
2020-12-03 11:51:44 +01:00
For a complete treatment of multivariable robust control, I would highly recommend this book cite:skogestad07_multiv_feedb_contr.
If you want to nice reference book in French, look at cite:duc99_comman_h.
You can also look at the very good lectures below.
2020-12-04 23:38:01 +01:00
[[yt:?listType=playlist&list=PLn8PRpmsu08qFLMfgTEzR8DxOPE7fBiin ][Robust Control - Brian Douglas ]]
[[yt:?listType=playlist&list=PLsjPUqcL7ZIFHCObUU_9xPUImZ203gB4o ][Control Bootcamp - Steve Brunton ]]
2020-11-25 19:35:11 +01:00
2020-12-04 23:38:01 +01:00
#+latex : \printbibliography