From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- graphics/pgf/contrib/bloques/README | 13 ++ graphics/pgf/contrib/bloques/bloques.sty | 202 ++++++++++++++++++++ graphics/pgf/contrib/bloques/example.pdf | Bin 0 -> 130623 bytes graphics/pgf/contrib/bloques/example.tex | 305 +++++++++++++++++++++++++++++++ 4 files changed, 520 insertions(+) create mode 100644 graphics/pgf/contrib/bloques/README create mode 100644 graphics/pgf/contrib/bloques/bloques.sty create mode 100644 graphics/pgf/contrib/bloques/example.pdf create mode 100644 graphics/pgf/contrib/bloques/example.tex (limited to 'graphics/pgf/contrib/bloques') diff --git a/graphics/pgf/contrib/bloques/README b/graphics/pgf/contrib/bloques/README new file mode 100644 index 0000000000..050c1bc2a2 --- /dev/null +++ b/graphics/pgf/contrib/bloques/README @@ -0,0 +1,13 @@ +% bloques.sty +% package based on tikz for control diagrams in power electronics. +% version 1.0 +% author: Alejandro Garces +% alejandrogarces@gmail.com +% License: LPPL +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. \ No newline at end of file diff --git a/graphics/pgf/contrib/bloques/bloques.sty b/graphics/pgf/contrib/bloques/bloques.sty new file mode 100644 index 0000000000..949deef40a --- /dev/null +++ b/graphics/pgf/contrib/bloques/bloques.sty @@ -0,0 +1,202 @@ +% bloques.sty +% package based on tikz for control diagrams in power electronics. +% version 1.0 +% author: Alejandro Garces +% alejandrogarces@gmail.com +% License: LPPL +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. + + + +\usepackage{tikz} +\usepgflibrary{shapes.misc} +\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,shadows} + +\newcommand{\xdistancia}{1.5cm} +\newcommand{\ydistancia}{1.2cm} +\newcommand{\minaltura}{0.7cm} +\newcommand{\tamano}{\footnotesize} +\newcommand{\colorfondo}{white} +\newcommand{\colortexto}{black} +\newcommand{\colorlinea}{black} +\newcommand{\sombra}{0} +\newcommand{\ancholinea}{thick} + +\newcommand{\bShadow}{\renewcommand{\sombra}{1}} +\newcommand{\bColorB}[1]{\renewcommand{\colorfondo}{#1}} +\newcommand{\bColorT}[1]{\renewcommand{\colortexto}{#1}} +\newcommand{\bColorL}[1]{\renewcommand{\colorlinea}{#1}} +\newcommand{\ydistance}[1]{\renewcommand{\ydistancia}{#1}} + + + +\newcommand{\bStart}[1]{\node [] (NODO1) {\tamano{#1}};} + +\newcommand{\bPlusDown}[1]{ + \node [draw=\colorlinea, circle,minimum size=1.5em, right of=NODO1, node distance= \xdistancia,\ancholinea, fill=\colorfondo, + drop shadow={opacity=\sombra}] (SUMA) {}; + \node [draw=gray!50, cross out, minimum size=1.0em, right of=NODO1, node distance= \xdistancia, thin] {}; + \node [left of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \node [below of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \draw [-latex,\colorlinea] (NODO1) -- (SUMA); + \node [below of = SUMA, node distance = \ydistancia] (VARIABLE) {\tamano{#1}}; + \draw [-latex, \colorlinea] (VARIABLE) -- (SUMA); + \node at (SUMA) [anchor = west] (NODO1) {}; +} + + +\newcommand{\bPlusUp}[1]{ + \node [draw=\colorlinea, circle,minimum size=1.5em, right of=NODO1, node distance= \xdistancia,\ancholinea, fill=\colorfondo, + drop shadow={opacity=\sombra}] (SUMA) {}; + \node [draw=gray!50, cross out, minimum size=1.0em, right of=NODO1, node distance= \xdistancia, thin, draw=gray!50] {}; + \node [left of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \node [above of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \draw [-latex, \colorlinea] (NODO1) -- (SUMA); + \node [above of = SUMA, node distance = \ydistancia] (VARIABLE) {\tamano{#1}}; + \draw [-latex, \colorlinea] (VARIABLE) -- (SUMA); + \node at (SUMA) [anchor = west] (NODO1) {}; +} + + +\newcommand{\bMinusDown}[1]{ + \node [draw=\colorlinea, circle,minimum size=1.5em, right of=NODO1, node distance= \xdistancia,\ancholinea, fill=\colorfondo, + drop shadow={opacity=\sombra}] (SUMA) {}; + \node [cross out, minimum size=1.0em, right of=NODO1, node distance= \xdistancia, thin, draw=gray!50] {}; + \node [left of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \node [below of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$-$}}; + \draw [-latex,\colorlinea] (NODO1) -- (SUMA); + \node [below of = SUMA, node distance = \ydistancia] (VARIABLE) {\tamano{#1}}; + \draw [-latex,\colorlinea] (VARIABLE) -- (SUMA); + \node at (SUMA) [anchor = west] (NODO1) {}; + +} + + +\newcommand{\bMinusUp}[1]{ + \node [draw=\colorlinea, circle,minimum size=1.5em, right of=NODO1, node distance= \xdistancia,\ancholinea, fill=\colorfondo, + drop shadow={opacity=\sombra}] (SUMA) {}; + \node [thin, cross out, minimum size=1.0em, right of=NODO1, node distance= \xdistancia, draw=gray!50] {}; + \node [left of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \node [above of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$-$}}; + \draw [-latex, \colorlinea] (NODO1) -- (SUMA); + \node [above of = SUMA, node distance = \ydistancia] (VARIABLE) {\tamano{#1}}; + \draw [-latex, \colorlinea] (VARIABLE) -- (SUMA); + \node at (SUMA) [anchor = west] (NODO1) {}; +} + +\newcommand{\bEnd}[1]{ + \node [right of = NODO1, node distance = 1.7cm] (F) {#1}; + \draw [-latex,\colorlinea] (NODO1) -- (F); + \node at (F) [anchor = west] (NODO1) {}; +} + + +\newcommand{\bGain}[1]{ + \node [draw=\colorlinea, rectangle, right of = NODO1, node distance= \xdistancia, minimum height = \minaltura, + \ancholinea, fill=\colorfondo,drop shadow={opacity=\sombra}] (NODO2) { \color{\colortexto}\tamano{#1}}; + \draw [-latex, \colorlinea] (NODO1)--(NODO2); + \node at (NODO2.east) [anchor = east] (NODO1) {}; + +} + + +\newcommand{\bGainPlus}[2]{ + + \node [draw=\colorlinea, circle,minimum size=1.5em, right of=NODO1, node distance= \xdistancia,\ancholinea, fill=\colorfondo, + drop shadow={opacity=\sombra}] (SUMA) {}; + \node [thin, cross out, minimum size=1.0em, right of=NODO1, node distance= \xdistancia, draw=gray!50] {}; + \node [left of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \node [below of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \draw [-latex, \colorlinea] (NODO1) -- (SUMA); + + \node [draw=\colorlinea, rectangle, below of = SUMA, node distance = \xdistancia,xshift=-0.3cm, minimum height = \minaltura,\ancholinea, + fill=\colorfondo,drop shadow={opacity=\sombra}, anchor = east] (NODOG) {\color{\colortexto}\tamano{#2}}; + \node [left of = NODOG, node distance = \xdistancia] (VARIABLE) {\tamano{#1}}; + \draw [-latex, \colorlinea] (VARIABLE) -- (NODOG); + \draw [-latex, \colorlinea] (NODOG) -| (SUMA); + \node at (SUMA) [anchor = west] (NODO1) {}; +} + +\newcommand{\bGainMinus}[2]{ + + \node [draw=\colorlinea, circle,minimum size=1.5em, right of=NODO1, node distance= \xdistancia,\ancholinea, fill=\colorfondo, + drop shadow={opacity=\sombra}] (SUMA) {}; + \node [thin, cross out, minimum size=1.0em, right of=NODO1, node distance= \xdistancia, draw=gray!50] {}; + \node [left of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \node [below of = SUMA, node distance = 0.45em] () { \color{\colortexto}\tiny{$-$}}; + \draw [-latex, \colorlinea] (NODO1) -- (SUMA); + + \node [draw=\colorlinea, rectangle, below of = SUMA, node distance = \xdistancia,xshift=-0.3cm, minimum height = \minaltura,\ancholinea, + fill=\colorfondo,drop shadow={opacity=\sombra}, anchor = east] (NODOG) {\color{\colortexto}\tamano{#2}}; + \node [left of = NODOG, node distance = \xdistancia] (VARIABLE) {\tamano{#1}}; + \draw [-latex, \colorlinea] (VARIABLE) -- (NODOG); + \draw [-latex, \colorlinea] (NODOG) -| (SUMA); + \node at (SUMA) [anchor = west] (NODO1) {}; +} + + +\newcommand{\bMinusF}[1]{ + \node [draw=\colorlinea, circle,minimum size=1.5em, right of=NODO1, node distance= \xdistancia,\ancholinea, fill=\colorfondo, + drop shadow={opacity=\sombra}] (#1) {}; + \node [draw, cross out, minimum size=1.0em, right of=NODO1, node distance= \xdistancia, thin, draw=gray!50] {}; + \node [left of = #1, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \node [below of = #1, node distance = 0.45em] () { \color{\colortexto}\tiny{$-$}}; + \draw [-latex, \colorlinea] (NODO1) -- (#1); + \node at (#1) [anchor = west] (NODO1) {}; + +} + + +\newcommand{\bPlusF}[1]{ + \node [draw=\colorlinea, circle,minimum size=1.5em, right of=NODO1, node distance= \xdistancia,\ancholinea, fill=\colorfondo, + drop shadow={opacity=\sombra}] (#1) {}; + \node [thin, cross out, minimum size=1.0em, right of=NODO1, node distance= \xdistancia, draw=gray!50] {}; + \node [left of = #1, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \node [below of = #1, node distance = 0.45em] () { \color{\colortexto}\tiny{$+$}}; + \draw [-latex, \colorlinea] (NODO1) -- (#1); + \node at (#1) [anchor = west] (NODO1) {}; + +} + + +\newcommand{\bFeedBack}[2]{ + \node [draw=\colorlinea, rectangle, below left of = NODO1, node distance = \ydistancia, minimum height = \minaltura,\ancholinea, + fill=\colorfondo,drop shadow={opacity=\sombra}, anchor = west] (NODOG) {\color{\colortexto}\tamano{#1}}; + \draw [-latex, \colorlinea] (NODO1) -- +(0.5,0) |- (NODOG); + \draw [-latex, \colorlinea] (NODOG) -| (#2); +} + + +\newcommand{\bCrossGain}[3]{ + \node [draw=\colorlinea, rectangle, above right of = #2, minimum height = \minaltura,\ancholinea, + fill=\colorfondo,drop shadow={opacity=\sombra}, anchor = west] (NODOG) {\color{\colortexto}\tamano{#1}}; + \draw [-latex, \colorlinea] (#2) |- (NODOG); + \draw [-latex, \colorlinea] (NODOG) -| (#3); +} + + +\newcommand{\bNewStart}[2]{ + \node at #2 (NODO1) {\tamano{#1}}; +} + + +\newcommand{\bMarkNode}[1]{ + \node at (NODO1) (#1) {}; +} + + +\newcommand{\bMarkNodeUp}[1]{ + \node[above of = NODO1, node distance = \ydistancia] (#1) {}; +} + + +\newcommand{\bMarkNodeDown}[1]{ + \node[below of = NODO1,node distance = \ydistancia] (#1) {}; +} + diff --git a/graphics/pgf/contrib/bloques/example.pdf b/graphics/pgf/contrib/bloques/example.pdf new file mode 100644 index 0000000000..4d8d556045 Binary files /dev/null and b/graphics/pgf/contrib/bloques/example.pdf differ diff --git a/graphics/pgf/contrib/bloques/example.tex b/graphics/pgf/contrib/bloques/example.tex new file mode 100644 index 0000000000..54497472d3 --- /dev/null +++ b/graphics/pgf/contrib/bloques/example.tex @@ -0,0 +1,305 @@ +\documentclass[a4paper,onecolumn]{IEEETran} +\usepackage{bloques} +\usepackage{verbatim} +\oddsidemargin=-1.5cm + + +\title{The Bloques Package} +\author{Alejandro Garces Ruiz \\ alejandrogarces@gmail.com} + +\begin{document} + +\maketitle + +\section{Functions} + + +The \textbf{bloques} package is a very simple set of commands based on \textbf{tikz} to generate control blocks. The only packages required in the definition are: + +\begin{verbatim} + \usepackage{tikz} + \usepackage{bloques} +\end{verbatim} + +The package is very efficient for sequential blocks as follow: + +\begin{verbatim} +\bStart{TEXT} +\bPlusDown{TEXT} +\bPlusUp{TEXT} +\bMinusDown{TEXT} +\bMinusUp{TEXT} +\bEnd{TEXT} +\bGain{TEXT} + +\bGainPlus{TEXT1}{TEXT2} +\bGainMinus{TEXT1}{TEXT2} + + +\end{verbatim} + +For Feedback controls, it is required to mark the nodes with the following functions: + +\begin{verbatim} + +\bMinusF{NODENAME} +\bPlusF{NODENAME} +\bFeedBack{TEXT}{NODENAME} +\bCrossGain{TEXT}{NODENAME1}{NODENAME2} +\bNewStart{TEXT}{POSITION} +\bMarkNode{NODENAME} +\bMarkNodeUp{NODENAME} +\bMarkNodeDown{NODENAME} +\end{verbatim} + + +To change colors and distances, the following functions are available + +\begin{verbatim} + \bShadow{NUMBER} % default = 0 + \bColorB{COLOR} % default = white + \bColorT{COLOR} % default = black + \ydistance{NUMBER} % default = 1.2 cm +\end{verbatim} + +\newpage + +\section{examples} + +\begin{figure}[h!] +\begin{tikzpicture} + \bStart{$X_{ref}$} + \bMinusDown{$X$} + \bGain{$k_{p}$} + \bPlusUp{$Y$} + \bGainPlus{$U$}{$\omega L$} + \bEnd{$V_{x}$} + \node[right of = NODO1, text width=8.5cm, node distance = 6.0cm, drop shadow={opacity=1}, fill=blue!20, rounded corners] (C4) + { + \begin{verbatim} + \begin{figure} + \begin{tikzpicture} + \bStart{$X_{ref}$} + \bMinusDown{$X$} + \bGain{$k_{p}$} + \bPlusUp{$Y$} + \bGainPlus{$U$}{$\omega L$} + \bEnd{$V_{x}$} + \end{tikzpicture} + \end{figure} + \end{verbatim} + }; + +\end{tikzpicture} +\caption{Simple Control diagram } +\end{figure} + + + +\begin{figure}[h!] +\begin{tikzpicture} + \bShadow + \bStart{$X_{ref}$} + \bMinusDown{$X$} + \bGain{$k_{p}$} + \bPlusUp{$Y$} + \bGainPlus{$U$}{$\omega L$} + \bEnd{$V_{x}$} + \node[right of = NODO1, text width=8.5cm, node distance = 6.0cm, drop shadow={opacity=1}, fill=blue!20, rounded corners] (C4) + { + \begin{verbatim} + \begin{figure} + \begin{tikzpicture} + \bShadow + \bStart{$X_{ref}$} + \bMinusDown{$X$} + \bGain{$k_{p}$} + \bPlusUp{$Y$} + \bGainPlus{$U$}{$\omega L$} + \bEnd{$V_{x}$} + \end{tikzpicture} + \end{figure} + \end{verbatim} + }; + +\end{tikzpicture} +\caption{Control diagram with shadow} +\end{figure} + + + +\begin{figure}[h!] +\begin{tikzpicture}[thick] + \draw[fill=blue!20, draw=white] (-0.5,-3) rectangle (8,2); + \draw[fill=green!20, dashed,thick] (4,-2) rectangle (7,0.5); + \bShadow + \bColorB{blue!80!green!50} + \bColorT{yellow} + \bColorL{white} + \bStart{$X_{ref}$} + \bMinusDown{$X$} + \bGain{$k_{p}$} + \bColorB{blue!30!green!80} + \bPlusUp{$Y$} + \bGainPlus{$U$}{$\omega L$} + \bEnd{$V_{x}$} + \node[right of = NODO1, text width=8.5cm, node distance = 6.0cm, drop shadow={opacity=1}, fill=blue!20, rounded corners] (C4) + { + \begin{verbatim} + \begin{figure} + \begin{tikzpicture}[thick] + \draw[fill=blue!20, draw=white] + (-0.5,-3) rectangle (8,2); + \draw[fill=green!20, dashed] + (4,-2) rectangle (7,0.5); + + \bShadow + \bColorB{blue!50!green!45} + \bColorT{yellow} + \bColorL{white} + \bStart{$X_{ref}$} + \bMinusDown{$X$} + \bGain{$k_{p}$} + \bColorB{blue!30!green!80} + \bPlusUp{$Y$} + \bGainPlus{$U$}{$\omega L$} + \bEnd{$V_{x}$} + \end{tikzpicture} + \end{figure} + \end{verbatim} + }; + +\end{tikzpicture} +\caption{Control diagram with shadow and different colors} +\end{figure} + + + + +\begin{figure}[h!] + \begin{tikzpicture} + \bColorB{blue!70!green!20} + \bStart{$X_{r}$} + \bMinusF{NODEX} + \bGain{$k_{p}+\frac{k_{i}}{S}$} + \bFeedBack{$k_{x}$}{NODEX} + \bEnd{$X$} + + \node[right of = NODO1, text width=8.5cm, node distance = 6.0cm, drop shadow={opacity=1}, fill=blue!20, rounded corners] (C4) + { + \begin{verbatim} +\begin{figure} + \begin{tikzpicture} + \bColorB{blue!70!green!20} + \bStart{$X_{r}$} + \bMinusF{NODEX} + \bGain{$k_{p}+\frac{k_{i}}{S}$} + \bFeedBack{$k_{x}$}{NODEX} + \bEnd{$X$} + \end{tikzpicture} +\end{figure} + \end{verbatim} + } ; + + \end{tikzpicture} + \caption{Control diagram with feedback} +\end{figure} + + + + +\begin{figure}[h!] + \begin{tikzpicture} + \bColorB{blue!30!green!50} + \bColorT{white} + \bStart{$X_{r}$} + \bMinusF{NODEX} + \bGain{$k_{p}+\frac{k_{i}}{S}$} + \bGain{$K_{2}$} + \bPlusDown{$Y$} + \ydistance{2.5cm} + \bFeedBack{$k_{x}$}{NODEX} + \bEnd{$X$} + +\node[right of = NODO1, text width=8.5cm, node distance = 6.0cm, drop shadow={opacity=1}, fill=blue!20, rounded corners] (C4) + { + \begin{verbatim} + +\begin{figure} + \begin{tikzpicture} + \bColorB{blue!30!green!50} + \bColorT{white} + \bStart{$X_{r}$} + \bMinusF{NODEX} + \bGain{$k_{p}+\frac{k_{i}}{S}$} + \bGain{$K_{2}$} + \bPlusDown{$Y$} + \ydistance{2.5cm} + \bFeedBack{$k_{x}$}{NODEX} + \bEnd{$X$} + \end{tikzpicture} +\end{figure} + + + \end{verbatim} + } ; + + + \end{tikzpicture} + \caption{Change the ydistance} +\end{figure} + + +\begin{figure}[h!] + \begin{tikzpicture} + \bStart{$I_{d(ref)}=0$} + \bMinusDown{$I_{d}$} + \bGain{PI1} + \bPlusF{NODET} + \bEnd{$V_{d}$} + \bNewStart{$\omega_{ref}$}{(-2,-4)} + \bMinusDown{$\omega_{s}$} + \bGain{PI2} + \bMinusUp{$I_{q}$} + \bMarkNodeUp{NODEX} + \bGain{PI3} + \bEnd{$V_{q}$} + \bCrossGain{$\omega L$} {NODEX} {NODET} + + + \node[right of = NODO1, text width=8.5cm, node distance = 6.0cm, drop shadow={opacity=1}, fill=blue!20, rounded corners] (C4) + { + \begin{verbatim} + + +\begin{figure} + \begin{tikzpicture} + \bStart{$I_{d(ref)}=0$} + \bMinusDown{$I_{d}$} + \bGain{PI1} + \bPlusF{NODET} + \bEnd{$V_{d}$} + \bNewStart{$\omega_{ref}$}{(-2,-4)} + \bMinusDown{$\omega_{s}$} + \bGain{PI2} + \bMinusUp{$I_{q}$} + \bMarkNodeUp{NODEX} + \bGain{PI3} + \bEnd{$V_{q}$} + \bCrossGain{$\omega L$} {NODEX} {NODET} + \end{tikzpicture} +\end{figure} + + \end{verbatim} + }; + + \end{tikzpicture} + \caption{More compex controls} +\end{figure} + + +\end{document} + + + + -- cgit v1.2.3