circuitikz 中的变压器

circuitikz 中的变压器

您能帮我画一下变压器吗(见下文)?我对库没有足够的经验circuitikz,目前看来,这个块不是circuitikz双偶极子的一部分(这可能是绘制变压器的不寻常方式)

在此处输入图片描述

答案1

你总是可以做的是查找类似元素的定义,将其定义复制到 TeX 文件的序言中并进行修改。这是一个基于形状的示例gyrator。我强调一下,我对 circuitiz 一无所知,只知道它基于 TiZ,而且我也没有关于电路的实践知识,但我成功避免了学习这些知识 ;-)。

\documentclass[border=3.14mm]{standalone}
\usepackage{tikz}
\usepackage{circuitikz}
\makeatletter
\pgfcircdeclarequadpole{my transformer}{

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
    \pgfpatharc{-45}{315}{0.6\pgf@circ@res@down}
    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{0.61\pgf@circ@res@left}{0.43\pgf@circ@res@down}}


    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
    \pgfpatharc{225}{-135}{0.6\pgf@circ@res@down}
    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{0.61\pgf@circ@res@right}{0.43\pgf@circ@res@down}}
    \pgfusepath{draw}

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{0.6\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{0.6\pgf@circ@res@up}}
    \pgfsetarrowsend{latex}
    \pgfusepath{draw}

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{0.6\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0.6\pgf@circ@res@up}}
    \pgfsetarrowsend{latex}
    \pgfusepath{draw}

    \pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@right}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{\pgf@circ@res@up}}
    \pgfsetarrowsend{latex}
    \pgfusepath{draw}

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{\pgf@circ@res@up}}
    \pgfsetarrowsend{latex}
    \pgfusepath{draw}
}{}

\makeatother    
\ctikzset{quadpoles/my transformer/width/.initial=1.5}
\ctikzset{quadpoles/my transformer/height/.initial=1}

\begin{document}
\begin{circuitikz}
\draw  node[my transformer,anchor=north west] (my trafo){}
node[anchor=east]  at (my trafo.west){$V_1$}
node[anchor=west]  at (my trafo.east){$V_2$}
node[anchor=south]  at (my trafo.north west){$I_1$}
node[anchor=south]  at (my trafo.north east){$I_2$};
\end{circuitikz}

\end{document}

在此处输入图片描述

答案2

根据我的示例,您可以组合包中的元素来创建新的元素TL431 组件,您可以定义一个新组件,将 circuitikz 宏和图纸与 Tikz 代码混合,在范围结构下定义一个宏,您可以命名组件端子的坐标并为它们添加标识符,这样您就可以使用任意数量的组件并使用它们的端子名称连接它们,这里有一个例子,电路只是为了测试连接,它没有电气设计标准。

结果:

在此处输入图片描述

梅威瑟:

% By J. Leon V.  coded based on the BSD, MIT, Beerware licences.
\documentclass[border=30pt]{standalone}
\usepackage{tikz}
\usepackage{circuitikz}
\begin{document}
\ctikzset{bipoles/length=.8cm} % to navoid modify text sizes and separations.
\begin{tikzpicture}[]

% Creating new electronic part
 \def\TL431(#1)#2{%#1: Position #2: Identifier.
  \begin{scope}[shift={(#1)}] % using to make coordinate objet.
    \draw(0,0) coordinate (A) coordinate (A #2)  %set this coordinate as anode
    to [sD*,-](0,2) coordinate (B) coordinate (K #2); % set this coordinate to kathode (sD* is circuittikz objet)
    \coordinate (C) at ($(A)!0.5!(B)$); % Find the center point between A and B
    \coordinate (D) at ($(A)!1!90:(C)$); % find a point orthogonal. 
    \node at (C) [rectangle, minimum size=7mm,draw=black,thick] {};%put the rectangle.
    \draw (C) -- +(D) coordinate (R #2);% draw the Vref pin and set tho coordinate Ref
    % Set the labels
    \draw (0,0.5) node[right] {\scriptsize A};
    \draw (0,1.5) node[right] {\scriptsize K};
    \draw (-.7,0.8) node[right] {\scriptsize R};
    \draw (.4,1) node[right] {\small D - #2}; % Diode label identifier
  \end{scope}
}

% Creating new electric component
 \def\Trafo(#1)#2{%#1: Position#2: Identifier.
  \begin{scope}[shift={(#1)}] % using to make coordinate objet.
    % Terminal P1-identifier
    \draw (0,0) coordinate (P1-#2) to [short,o-,i=$i_{1-#2}$] (0.5,0);
    \draw (.5,0) -- ++(.25,-.6); % Wire
    \draw (1.2,-1) circle (6mm); % Primary
    \draw (0.5,-2) -- ++(.25,.6);% Wire
    % Terminal P2-identifier
    \draw (0,-2) coordinate (P2-#2) to [short,o-] (0.5,-2);
    % Terminal s1-identifier
    \draw (3,0)  coordinate (S1-#2) to [short,o-,i_<=$i_{2-#2}$] (2.5,0);
    \draw (2.5,0) -- ++(-.25,-.6); %Wire
    \draw (1.8,-1) circle (6mm); % Secondary
    \draw (2.5,-2) -- ++(-.25,.6); %Wire
    % Terminal S2-identifier
    \draw (3,-2) coordinate (S2-#2) to [short,o-] (2.5,-2);
    \draw (1.5,0) node[] {\small T - #2}; % Trafo label identifier
    \draw (P1-#2) to [open, v_<=$V_{P-#2}$] (P2-#2); % Primary voltage
    \draw (S1-#2) to [open, v^<=$V_{S-#2}$] (S2-#2); % Secondary voltaje
  \end{scope}
}


 %Drawing first line input - R 
 \draw (0,0) 
    node [anchor=east]{Input}
    to[R,o-*](2,0);
% Insert TL431 in position 2,-3 and identified as 1
\TL431(2,-3){1};

% Conect first line and TL431 
\draw
    (2,0) to [short,-*] (K 1); % K 1 is the identified coordinate kathode

% Conect TL431 to ground % A 1 is the identified coordinate of anode
\draw (A 1) to (2,-5.5) coordinate (GND) node [ground]{};

%Draw the close loop between Ref and kathode
\draw[-] (R 1) |- (K 1);

%Draw the Vref 
\draw (R 1) 
    to [short, -o] (1,-3.5)
    to [open,v=Vref] (1,-4.5)
    to [short, o-] (1,-5.5) node[ground]{};

% Drawing the trafos
\Trafo(4.5,0){1}
\Trafo(4.5,-3){2}

% Conecting the trafos
\draw (2,0) to [R,-] (P1-1);
\draw (P2-1) -- ++(-0.3,0) |- (P1-2);
\draw (P2-2)
    to [short,-*] (P2-2 -| GND);

\end{tikzpicture}
\end{document}

相关内容