我想绘制附图。我可以使用哪些 TikZ 包来实现此目的?

我想绘制附图。我可以使用哪些 TikZ 包来实现此目的?

我不确定使用什么工具绘制了此图像。我假设使用 TikZ。

有没有关于我可以使用哪个 TikZ 包来绘制这个的指导?

在此处输入图片描述

答案1

只是为了好玩,一个不完整的选项,因为有很多元素需要绘制,这结束了乐趣;但是绘图有一些有趣的细节需要实现,例如带有电流控制输入的节点,不同风格的电压参考,一些用表面代码定义的元素(没有在circuitikz风格中声明新组件)来绘制传感器和变压器,然后是一些箭头中的线条标记解决方案。我认为有了这个,其他组件也是可以实现的。当然,请原谅代码中的混乱。

不完整的结果:

在此处输入图片描述

梅威瑟:

\documentclass[border=20pt]{standalone}
\usepackage[scaled]{helvet}
\usepackage{circuitikz}
\usepackage{siunitx}
\usepackage{bm}%Bold math
\usepackage{amsmath}
\usetikzlibrary{positioning,arrows.meta,decorations.markings}

\begin{document}
    \begin{tikzpicture}[
        %Environment Config
        >={Triangle[length=3pt,angle=60:4]},
        font=\sffamily,
        %Style Variable
        Lines/.store in=\lines,Lines=2,
        Rotate lines/.store in=\rlines,Rotate lines=0,
        Mark pos/.store in=\mpos,Mark pos=0.6,
        LineMark/.style={%Style for the voltage reference
            draw,
            postaction={
                decorate,
                decoration={
                    markings,
                    mark=at position \mpos with {
                    \begin{scope}[rotate=\rlines]
                    \ifnum\lines=2 \draw[-,yshift=0.7pt] (-45:3pt) -- (135:3pt);\draw[-,yshift=-0.7pt] (-45:3pt) -- (135:3pt);\fi
                    \ifnum\lines=3 \draw[-,yshift=1.2pt] (-45:3pt) -- (135:3pt);\draw[-,yshift=-1.2pt] (-45:3pt) -- (135:3pt);\draw[-] (-45:3pt) -- (135:3pt);\fi
                    \end{scope}
                    }
                }
            }
        },
        Vref/.style={%Style for the voltage reference
            draw=none,
            postaction={decorate,decoration={markings,mark=at position 0.5 with {\node[inner sep=0](a){ #1};}}},
            postaction={decorate,decoration={markings,mark=at position 0.1 with {\node[inner sep=1pt](b){\scriptsize $\bm{+}$};}}},
            postaction={
                decorate,
                decoration={
                    markings,
                    mark=at position 0.9 with {
                        \node[inner sep=1pt](c){\scriptsize $\bm{-}$};
                        \draw[->] (a.90)--(b.-90);
                        \draw[->] (a.-90)--(c.90);
                    }
                }
            }
        },
        Myground/.style={
            ground,
            scale=1.5,
            yshift=5pt
        }
    ]
    %Size adjust
    \ctikzset{nodes width/.initial=0.05}
    \ctikzset{bipoles/length=0.6cm}
    \ctikzset{label/align = rotate}
    \ctikzset{bipoles/resistor/height=.6}
    \ctikzset{bipoles/americaninductor/coil height=0.7}
    \ctikzset{bipoles/americaninductor/height=1.5}
    %Draw circuit
    %Objet Current controller
    \def\CC[#1](#2)#3#4{%1:position 2:node_name 3:Inputs 4:Node_text
        \foreach \k [count=\n] in {#3}{}
            \draw node[
                #1,
                rectangle,
                draw,
                fill=blue!50!cyan!7!white,
                inner ysep=2pt,
                minimum width=\n*0.7cm,
                font=\sffamily\scriptsize,
                align=center
            ](#2){#4};
        \foreach \k [count=\i from 0]in {#3}{
            \draw[<-](#2.south west)++(0.35+\i*0.7,0) -- ++(0,-0.5) node[anchor=0,rotate=90,xshift=3pt]{$\k$};
        }
    }
    %Object Transducer
    \def\Transducer[#1](#2)#3#4{%1: Position 2:Node_name 3:text below left 4: Text above right
        \draw
            node[
                #1,
                draw,
                fill=blue!50!cyan!7!white,
                minimum height=0.6cm,
                minimum width=1.4cm
            ](#2){}
            (#2.center)
                ++(8pt,4pt) node{\it\sffamily #4}
            (#2.center)
                ++(-8pt,-3pt) node{\it\sffamily #3};
        \draw[
            shorten >=1pt,
            shorten <=1pt
        ]
            (#2.north west)
                -- (#2.south east);
    }
    %Object VSC
    \def\VSC[#1](#2)[#3]{%1: Position 2:Node_name 3:Xscale to get mirrored content values 1 or -1
        \begin{scope}[transform shape, xscale=#3]
        \draw
            node[
                #1,
                draw,
                fill=blue!50!cyan!7!white,
                minimum height=2cm,
                minimum width=1.1cm
            ](#2){};
        \draw[dashed]
            (#2.center)++(3pt,-0.5) circle (9pt)
            (#2.center)++(3pt,0.5)circle (9pt);
        \draw
            (#2.center)++(3pt,-0.5) node[nigbt,bodydiode,scale=0.8](IGBT1){}
            (#2.center)++(3pt,0.5) node[nigbt,bodydiode,scale=0.8](IGBT2){}
            (IGBT1.D) -- (IGBT2.E) (#2.center)++(3pt,0) to [short,*-]++(10pt,0);
        \end{scope}
        \draw (#2.north)++(0,5pt) node{#2};
    }
    %Object Transformer
    \def\Tr[#1][#2](#3)#4{%1:Position 2:Orientation 3:Node_name 4:Node text (not implemented yet)
        \begin{scope}[rotate=#2]
            \draw[thick]node[#1](#3){}
                (#3.center)++(8pt,0)coordinate (#3-star) circle (10pt)
                (#3.center)++(-8pt,0)coordinate(#3-delta) circle (10pt)
                (#3-delta)+(90-#2:7pt) -- +(210-#2:7pt) -- +(330-#2:7pt) -- cycle
                (#3-star) edge +(30-#2:7pt) edge +(150-#2:7pt) edge +(270-#2:7pt)
                (#3.center)++(18pt,0) coordinate (#3-S)
                (#3.center)++(-18pt,0) coordinate (#3-D);
        \end{scope}
    }
    %Start drawing the thing...

    \CC[](N1){
        i_{rdref},
        i_{rqref},
        i_{rd},
        i_{rq},
        v_{Link},
        \omega_{\tau}%
    }{Rotor-side\\Current Controller}

    \CC[right=1cm of N1](N2){
        i_{rdref},
        i_{rqref},
        i_{rd},
        i_{rq},
        i_{sd_\ell},
        i_{sq_\ell},
        v_{Link},
        \omega_{\tau}%
    }{Grid-side\\Current Controller}

    \Transducer[above right= 0.5 and -2 of N1](TD1){dq}{abc}    
    \Transducer[above left= 0.5 and -2.5 of N2](TD2){dq}{abc}

    \VSC[above=0.5 of TD1](VSC1)[-1]
    \VSC[above=0.5 of TD2](VSC2)[1]

    %Circuit 1
    \draw 
    (VSC1.125)
        to [short,-*] ++(2,0) coordinate (div0)
        to [short] (VSC2.125)
    (VSC1.-125)
        to [short] (VSC2.-125)
    (div0)
        to [C,l={\rotatebox{180}{$C_{Link}$}},-*] (div0 |- VSC2.-125);
    \draw[Vref=$v_{link}$]
    (div0)++(-1,0) coordinate (temp)
    (temp) -- (temp |- VSC2.-125);

    %Arrows rotor side
    \draw[Lines=2,LineMark,<-] (TD1) -- (TD1 |- N1.north) node [midway,right]{$m_{rdq}$};
    \draw[Lines=3,LineMark,<-] (VSC1) -- (TD1);
    \draw[<-] (TD1.west) -- ++(-0.5,0)node[anchor=east]{$\theta_c$};
    %Arrows grid side
    \draw[Lines=2,LineMark,<-] (TD2) -- (TD2 |- N1.north) node [midway,right]{$m_{tdq}$};
    \draw[Lines=3,LineMark,<-] (VSC2) -- (TD2);
    \draw[<-] (TD2.west) -- ++(-0.5,0)node[anchor=east]{$\theta_\ell$};
    %Circuit 2
    \draw[Lines=3,LineMark,Mark pos=0.7,Rotate lines=90] (VSC2.0) -- ++(0.75,0) coordinate (circ2-start) node[pos=0.7,above]{$v_{t-abc}$};
    \Tr[above right= 0.5 and 3.5 of VSC2][-90](TR2){$T_{\tau 2}$}
    \draw
    (circ2-start)
        to [R,l=$R_t$] ++(1,0)
        to [american inductor,l=$L_t$] ++ (1,0)
        edge [->] ++(0.4,0)
        -| (TR2-S) node[pos=0.2,above]{$i_{t-abc}$}
    (TR2-star) -- ++(0.5,-0.3) node[ground]{}
    (TR2-D)
        to [short,-*] ++ (0,1) coordinate (circuit3) node[anchor=-90]{$v_{s-abc}$};
    \draw[Lines=3,LineMark,Rotate lines=90] (TR2-D) -- (circuit3);

    \draw node[above right= 0.5 and 0.2 of VSC2](temp){\Large $P_t$}
    (temp.center)++(0,-0.5) node(temp2){\Large $Q_t$};
    \draw[ultra thick,->](temp) -- ++(1,0);
    \draw[ultra thick,->](temp2) -- ++(1,0);

    \draw node[above right= 1 and 2.5 of VSC2,rotate=90](temp){\Large $P_c$}
    (temp.center)++(0.5,0) node[rotate=90](temp2){\Large $Q_c$};
    \draw[ultra thick,->](temp) -- ++(0,1);
    \draw[ultra thick,->](temp2) -- ++(0,1);
    \end{tikzpicture}
\end{document}

相关内容