














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
This package allows you to plot bode, black, and nyquist diagrams using gnuplot and tikz. It provides various commands and styles to customize the appearance of the diagrams, including options for setting the grid, axis labels, and marker styles. The package supports plotting functions with both amplitude and phase information, and includes examples of how to use the different commands. Topics such as semi-log grids, bode point markers, black-nichols grids and abaques, and nyquist graph plotting. It is a comprehensive resource for anyone working with control system analysis and visualization using latex and related tools.
Typology: Assignments
1 / 22
This page cannot be seen from the preview
Don't miss anything!
version 1.4 09/10/2010 : modification du répertoire par défaut des fichiers gnuplot.
version 1.3 1/05/2010 :
version 1.2 : 22/08/2009,
version 1.1 : 03/05/2009, ajout ;
version 1 : mise en ligne de la version initiale 06/04/2009.
Ce package permet de tracer les diagrammes de Bode, Black et Nyquist à l’aide de Gnuplot et Tikz. Les fonc- tions de transfert élémentaires et les correcteurs cou- rants sont préprogrammés pour être utilisés dans les fonctions de tracé.
This package allows you to draw the Bode plots, Ny- quist, and Black using Gnuplot and Tikz. Elementary Functions Transfer and basics correctors are prepro- grammed to be used.
Pour fonctionner ce package a besoin :
To run this package requires :
∗Merci à Germain Gondor pour ses remarques
1.2 Composition du package / Composition of Package
Ce package est constitué de trois fichiers :
Alain Matthes. Les courbes gnuplot précalculées sont dans le réper- toire /gnuplot/.
Package This package consists of three files :
Gnuplot precomputed curves are in the directory /gnuplot/.
1.3 Utilisation / Use
Décompresser l’archive du package dans votre réper- toire personnel. Rajouter dans l’entête la commande usepackage{bodegraph}.
Unzip the archive package in your home directory. Add in the header control usepackage{bodegraph}..
1.4 ToDo
2.2 Grille semilog sans graduation / grid without graduation
paramètre est le nombre de décade, le second l’amplitude des ordonées.
\begin{tikzpicture}[yscale=3/50,xscale=\textwidth/3cm] \semilogNG{3}{50} \end{tikzpicture}
2.3 Paramètres de configuration des diagrammes / parameters
100 101 102 103
− 20
− 10
0
10
20
30
100 101 102 103
− 20
− 10
0
10
20
30
\begin{tikzpicture} \begin{scope}[yscale=2/50, xscale=0.9\textwidth/3cm] \semilog{0}{3}{-20}{30} \end{scope} \begin{scope}[yshift=-3cm, yscale=2/50,xscale=0.9\textwidth/3cm] \tikzset{ semilog lines/.style={thin, blue}, semilog lines 2/.style={semilog lines, red!50 }, semilog half lines/.style={semilog lines 2, dotted }, semilog label x/.style={semilog lines, below,font=\tiny}, semilog label y/.style={semilog lines, right,font=\tiny} } \semilog{0}{3}{-20}{30} \end{scope} \end{tikzpicture}
2.4 Tracé des diagrammes / Drawing bode graph
votre distribution LATEX. Trois commandes permettent de tracer les diagrammes d’amplitude et de phase (figure 2).
Ainsi pour tracer le diagramme d’amplitude de la fonction du premier ordre, H ( s ) =
1 + 0.3 · s
entre 10−^2 rad/s et
102 rad/s sur une grille semi logarithmique, on utilise la séquence de commandes ci-dessous.
10 −^2 10 −^1 100 101
− 20
− 10
0
10 \begin{tikzpicture}[xscale=7/4,yscale=5/30] \semilog{-2}{2}{-20}{10} \BodeGraph{-2:2}{20log10(abs(3/sqrt (1+(0.310t)2)))} \end{tikzpicture}
FIGURE 2 – Utilisation de BodeGraph
10 −^2 10 −^1 100 101
− 20
− 10
0
10
20
10 −^2 10 −^1 100 101
− 90
− 80
− 70
− 60
− 50
− 40
− 30
− 20
− 10
0
\begin{tikzpicture}[xscale=7/4] \begin{scope}[yscale=3/40] \semilog{-2}{2}{-20}{20} \BodeGraph[asymp lines,samples=100]{-2:2} {\POAmpAsymp{6}{0.3}} \BodeGraph{-2:2}{\POAmp{6}{0.3}} \end{scope}
\begin{scope}[yshift=-2.5cm,yscale=3/90] \semilog{-2}{2}{-90}{0} \BodeGraph[asymp lines,samples=100, const plot]{-2:2} {\POArgAsymp{6}{0.3}} \BodeGraph{-2:2}{\POArg{6}{0.3}} \end{scope} \end{tikzpicture}
FIGURE 4 – Premier ordre
10 −^1 100 101
− 20
− 10
0
10
20 dB
rad/s
10 −^1 100 101
− 180
− 150
− 120
− 90
− 60
− 30
0 ◦
rad/s
\begin{tikzpicture}[xscale=7/3] \tikzset{ mylines/.style={very thick, red}, myasymp/.style={Bode lines,thin,black}, } \begin{scope}[yscale=3/40] \UnitedB \semilog{-1}{2}{-20}{20} \BodeGraph[myasymp]{-1:1.7} {+\SOAmpAsymp{6}{0.3}{10}} \BodeGraph[mylines,samples=101]{-1:1.7} {\SOAmp{6}{0.3}{10}} \end{scope} \begin{scope}[yshift=-2.5cm,yscale=3/180] \OrdBode{30} \UniteDegre \semilog{-1}{2}{-180}{0} \BodeGraph[myasymp]{-1:0.999} {\SOArgAsymp{6}{0.3}{10}} \BodeGraph[myasymp]{1:2} {\SOArgAsymp{6}{0.3}{10}} \BodeGraph[mylines]{-1:2} {\SOArg{6}{0.3}{10}} \end{scope} \end{tikzpicture}
FIGURE 5 – Second ordre
2.5.3 Intégrateur
Hi ( s ) =
s
(figure 6)
10 −^2 10 −^1 100 101
− 40
− 30
− 20
− 10
0
10
20
30
40
10 −^2 10 −^1 100 101
− 100
− 90
− 80
− 70
− 60
− 50
− 40
− 30
− 20
− 10
0
10
\begin{tikzpicture} \begin{scope}[xscale=7/4,yscale=3/80] \semilog{-2}{2}{-40}{40} \BodeGraph{-2:2}{\IntAmp{1}} \end{scope}
\begin{scope}[yshift=-2.5cm, xscale=7/4,yscale=3/110] \semilog{-2}{2}{-100}{10} \BodeGraph{-2:2}{+\IntArg{1}} \end{scope} \end{tikzpicture}
FIGURE 6 – Intégrateur
2.5.4 Gain seul
2.5.5 Retard
Hr ( s ) = e − Tr^ · s^ (figure 7)
2.5.6 Premier Ordre généralisé
H ( p ) = K
a 1 + a 2 · p b 1 + b 2 · p
(figure 8)
Courbes réelles
Asymptotes
a 1 et b 1 ne doivent pas être nuls.
2.5.7 Fonctions inverses
À partir des fonctions élémentaires ci dessus il est facile de tracer les fonctions inverses en changeant uniquement le signe.
10 −^2 10 −^1 100 101
− 40
− 30
− 20
− 10
0
10
20
30
40
10 −^2 10 −^1 100 101
−^ − 9080
−^ − 7060
−^ − 5040
−^ − 3020
− 100
1020
3040
5060
7080
90
\begin{tikzpicture} \begin{scope}[xscale=7/4,yscale=3/80] \semilog{-2}{2}{-40}{40} \BodeGraph{-2:2}{\POgAmp{3}{4}{5}{6}{70}} \BodeGraph[thin,red]{-2:2} {0+\POgAmpAsymp{3}{4}{5}{6}{70}} \end{scope}
\begin{scope}[yshift=-3.5cm, xscale=7/4,yscale=3/180] \semilog{-2}{2}{-90}{90} \BodeGraph{-2:2}{\POgArg{3}{4}{5}{6}{70}} \BodeGraph[thin,red,const plot]{-2:2} {0+\POgArgAsymp{3}{4}{5}{6}{70}} \end{scope} \end{tikzpicture}
FIGURE 8 – Premier ordre généralisé
Correcteur PI C ( s ) = Kp ·
1 + Ti · s Ti · s
(figure 9)
2.6.1 Correcteur PD
C ( p ) = Kp ·
1 + Td · p
, le correcteur PD programmé est un correcteur idéal, pour réaliser un correcteur réel, on utilisera le correcteur à avance de phase (figure 10).
2.6.2 Correcteur à Avance de phase
C (^) AP ( p ) = Kp ·
1 + a · T 1 · p 1 + T 1 · p
(figure 11)
Courbes réelles
Asymptotes
100 101 102 103
− 10
0
10
20
30 dB
rad/s
100 101 102 103
− 90
− 80
− 70
− 60
− 50
− 40
− 30
− 20
− 10
0 ◦
rad/s
\begin{tikzpicture}[xscale=7/3] \begin{scope}[yscale=3/40] \UnitedB %\node{\tiny \PIAmp{3}{0.5}}; \BodeGraph[thick]{0:3} {\PIAmp{2}{0.08}} \BodeGraph[black]{0:3} {\PIAmpAsymp{2}{0.08}} \semilog{0}{3}{-10}{30} \end{scope} \begin{scope}[yshift=-1cm,yscale=3/90] \UniteDegre \semilog{0}{3}{-90}{0} \BodeGraph[thick]{0:3} {\PIArg{2}{0.08}} \BodeGraph[samples=2,black ,samples=201]{0:3}{\PIArgAsymp{2}{0.08}} \end{scope} \end{tikzpicture}
FIGURE 9 – Correcteur P.I
100 101 102 103
0
10
20
30
40
50 dB
rad/s
100 101 102 103
0
10
20
30
40
50
60
70
80
90 ◦
rad/s
\begin{tikzpicture}[xscale=7/3] \begin{scope}[yscale=3/50] \UnitedB \BodeGraph[thick]{0:3}{\PDAmp{2}{0.08}} \BodeGraph[black]{0:3}{\PDAmpAsymp{2}{0.08}} \semilog{0}{3}{0}{50} \end{scope} \begin{scope}[yshift=-3.5cm,yscale=3/90] \UniteDegre \semilog{0}{3}{0}{90} \BodeGraph[thick]{0:3}{\PDArg{2}{0.08}} \BodeGraph[samples=2,black,samples=201] {0:3}{\PDArgAsymp{2}{0.08}} \end{scope} \end{tikzpicture}
FIGURE 10 – Correcteur P.D
2.6.3 Correcteur à Retard de phase
CRP ( p ) = Kp ·
1 + T 1 · p 1 + a · T 1 · p
(figure 12)
100 101 102 103
− 10
0
10
20
30 dB
rad/s
100 101 102 103
− 90
− 60
− 30
0
30
60
90 ◦
rad/s
\begin{tikzpicture}[xscale=7/3] \begin{scope}[yscale=3/40] \UnitedB \semilog{0}{3}{-10}{30} \BodeGraph{0:3} {\PIDAmp{2}{0.08}{0.02}} \BodeGraph[black] {0:3}{\PIDAmpAsymp{2}{0.08}{0.02}} \end{scope} \begin{scope}[yshift=-3cm,yscale=3/180] \UniteDegre \OrdBode{30} \semilog{0}{3}{-90}{90} \BodeGraph{0:3} {\PIDArg{2}{0.08}{0.02}} \BodeGraph[samples=2, black,samples=201] {0:3}{\PIDArgAsymp{2}{0.08}{0.02}} \end{scope} \end{tikzpicture}
FIGURE 13 – Correcteur P.I.D série
2.7 Fonctions de transfert complexe
Pour tracé les diagrammes de Bode d’un fonction de transfert complexe, définie par le produit de fonctions élé- mentaires, il suffit de sommer les représentation, aussi bien pour le tracé de la fonction que pour les asymptotes.
2.7.1 Exemples
Premier ordre + intégrateur : H ( s ) =
s · (1 + 0.5 · s )
(figure 14)
10 −^2 10 −^1 100 101
− 40
− 30
− 20
− 10
0
10
20
30
40
50
60
10 −^2 10 −^1 100 101
− 200
− 180
− 160
− 140
− 120
− 100
− 80
− 60
− 40
− 20
0
\begin{tikzpicture}[xscale=7/4] \begin{scope}[yscale=2.5/100] \semilog{-2}{2}{-40}{60} \BodeGraph[thin,samples=100]{-1.5:1.5} {\POAmpAsymp{8}{0.5}+\IntAmp{1}} \BodeGraph{-1.5:1.5}{\POAmp{8}{0.5}+\IntAmp{1}} \end{scope} \begin{scope}[yshift=-2cm,yscale=2.5/200] \OrdBode{20} \semilog{-2}{2}{-200}{0} \BodeGraph[samples=100,thin]{-2:2} {\POArgAsymp{8}{0.5}+\IntArg{1}} \BodeGraph{-2:2}{\POArg{8}{0.5}+\IntArg{1}} \end{scope} \end{tikzpicture}
FIGURE 14 – Premier ordre + intégrateur
Second ordre généralisé : 5 ·
1 + 0.01 · s
1 +
· s +
s^2 152
(figure 15)
10 −^1 100 101 102 103
− 50
− 40
− 30
− 20
− 10
0
10
20
30
10 −^1 100 101 102 103
− 200
− 180
− 160
− 140
− 120
− 100
− 80
− 60
− 40
− 20
0
\begin{tikzpicture}[xscale=7/5] \begin{scope}[yscale=3/80] \semilog{-1}{4}{-50}{30} \BodeGraph[thin]{-1:4} {\SOAmpAsymp{5}{15}-\POAmpAsymp{1}{0.01}} \BodeGraph[smooth,samples=100]{-1:4} {\SOAmp{5}{0.3}{15}-\POAmp{1}{0.01}} \end{scope} \begin{scope}[yshift=-2.5cm,yscale=3/210] \OrdBode{20} \semilog{-1}{4}{-200}{10} \BodeGraph[thin,samples=100]{-1:4} {\SOArgAsymp{5}{15}-\POArgAsymp{1}{0.01}} \BodeGraph{-1:4}{\SOArg{5}{0.3}{15}-\POArg{1}{0.01}} \end{scope} \end{tikzpicture}
FIGURE 15 – Second ordre généralisé
3 Diagramme de Black
3.1 Lieu de Black
Trois commandes (et 3 étoilées) et permettent de tracer et commenter le lieu de Black d’une fonction (figure 16).
nies au dessus pour les diagrammes de Bode pour ces fonctions.
◦
dB
-180 -135 -90 -45 0
H 1
H 3
1
3
12
65
25
80
500
1500
4000 H 4
\begin{tikzpicture} \begin{scope}[xscale=6/180,yscale=8/60] \BlackGraph[samples=150,red,smooth,ultra thick,-<] {-2:1}{\SOBlack{1}{0.1}{1500}} {[red,right]{\footnotesize $H_1$}} \BlackGraph[samples=150,black,smooth,ultra thick] {-1:3.5}{\SOArg{5}{0.2}{150},\SOAmp{5}{0.2}{150}} {[right]{$H_2 $}} \BlackGraph[samples=150,blue,smooth,ultra thick] {1:5}{\SOArg{1}{0.1}{1500}+\IntArg{0.43/0.0009} -2\POArg{1}{0.0009},\SOAmp{1}{0.1}{1500}+ \IntAmp{0.43/0.0009}-2\POAmp{1}{0.0009}}
\BlackGraph*[samples=100,purple,smooth] {-3:2}{\POArg{5}{3},\POAmp{5}{3}} {[purple!50,right]{\footnotesize $H_3$}}
\BlackPoint[purple]{0.1,1,3,12,65} {\POArg{5}{3},\POAmp{5}{3}}
\BlackPoint[black]{25/right, 80/above right,500/above,1500/above,4000/right} {\SOArg{1}{0.1}{1500}+\IntArg{0.43/0.0009} -2\POArg{1}{0.0009},\SOAmp{1}{0.1}{1500}+ \IntAmp{0.43/0.0009}-2*\POAmp{1}{0.0009}}
\BlackText[blue]{5000/left/{\normalsize $H_4$}} {\SOArg{1}{0.1}{1500}+\IntArg{0.43/0.0009} -2\POArg{1}{0.0009},\SOAmp{1}{0.1}{1500}+ \IntAmp{0.43/0.0009}-2\POAmp{1}{0.0009}}
\BlackGrid \end{scope} \end{tikzpicture}
FIGURE 16 – Diagramme de Black
3.3 Exemples
Sur l’exemple figure 16 sont représentées les fonctions suivantes :
1
1 +
2 · 0. 1500
· p +
p^2 15002
,
5
1 +
2 · 0. 150
· p +
p^2 1502
,
5 1 + 3 · p
,
1
1 +
2 · 0. 1500
· p +
p^2 15002
·
0.43 ·
( 1 + 0.0009 · p
) 2
0.0009 · p
4 Diagramme de Nyquist
Le package permet aussi de tracer le diagramme de Nyquist (figure 18) d’une fonction linéaire, le tracé est réalisé à partir de la description polaire de la fonction de transfert H ( i · o meg a ) = ‖ H ( i · ω )‖ · e arg( H^ ( i^ · ω )). Cela permet de
−30dB
−25dB
−20dB
−15dB
−12dB
−10dB
−8dB
−6dB
−5dB
−4dB
−3dB
−2dB
−1dB
−0.5dB
−0.2dB
0dB
0.2dB
0.5dB
1dB
2dB 2.3dB 3dB 4dB 5dB 6dB 8dB 10dB
− 359 ◦
− 357 ◦ − (^354) − 350 ◦◦ − 345 ◦ − (^340) −◦ 330 ◦ − 315 ◦ − 300 ◦ − 285 ◦ − 270 ◦ − 255 ◦ − 240 ◦ − 225 ◦ − 210 ◦ − 195 − (^190) ◦◦^ − (^170) − 165 ◦◦ − 150 ◦
− 135 ◦
− 120 ◦^ −^105
◦−^90
◦−^75
◦−^60 ◦
− 45 ◦
− 30 −◦^20
− (^15) ◦
− (^10) ◦ − (^6) ◦◦
− 3 ◦
− 1 ◦
◦
dB
-360 -315 -270 -225 -180 -135 -90 -45 0
2.3dB
ωr ≈ 2.6 r ad / sec
\begin{tikzpicture} \begin{scope} [xscale=11/360, yscale=12/60]
\BlackGraph[samples=100, purple,smooth] {-1:1}{\IntArg{0.3}+ \SOArg{3.9}{0.4}{3}, \IntAmp{0.3}+ \SOAmp{3.9}{0.4}{3}}
\def\valmaxBf{-360} %\StyleIsoM[blue!50,dashed] %\StyleIsoA[green,thin] \AbaqueBlack
\StyleIsoM[blue,thick] \IsoModule[2.3]
\BlackGrid
\BlackText[black]{2.6/right/ {\normalsize $\omega_r \approx 2.6~rad/sec$}} {\IntArg{0.3}+ \SOArg{3.9}{0.4}{3}, \IntAmp{0.3}+ \SOAmp{3.9}{0.4}{3}}
\end{scope} \end{tikzpicture}
FIGURE 17 – Abaque de Black
tracer le diagramme de Nyquist à partir des définitions précédentes du module et de l’argument.
4.0.1 Styles par défaut
Comme pour le diagramme de Black, des styles par défaut sont proposés :
4.1 Quelques exemples de tracé de lieu de Nyquist
Sur l’exemple figure 18 sont représentées les fonctions suivantes :
· p +
p^2 15002
· p +
p^2 1502
1 + 3 · p
· p +
p^2 15002
1 + 0.0009 · p
0.0009 · p
5 Réponse temporelle
figure 19
t
s
(^00 )
1
1
2
\begin{tikzpicture}[xscale=5/2,yscale=7/2] \RepTemp[color=black,samples=31,smooth, ]{0:1.8}{ -.198exp(-35.4x)-.638exp(-2.28x)cos(18.3x) -.462exp(-2.28x)sin(18.3x)+. }{[right]{\small 1}} \RepTemp[color=blue,samples=31,smooth ,]{0:1.8}{ 1-.117exp(-24.1x)-.883exp(-2.94x)cos(7.03x) -.769exp(-2.94x)sin(7.03x) }{[right]{\small 2}} \def\valmaxx{1.8} \def\valmaxy{1.2} \TempGrid[xstep=0.2,ystep=0.2] \end{tikzpicture}
FIGURE 19 – Réponse temporelle
5.1 styles
Plusieurs styles sont définis par défaut :