帮助反激式转换器上的电压标签

帮助反激式转换器上的电压标签

我有以下用乳胶制成的反激式转换器电路

\begin{tikzpicture}
 
% Circuit style
\ctikzset{
    resistor = american,
    voltage = american ,
    voltage dir = RP,
    quadpoles/transformer core/inner = 1, %Eliminates the horizontal bars on the transformer
    quadpoles/transformer core/width = 0.6, %Adjusts the width so that the transformers are closer
    diodes/scale = 0.7,
    capacitors/scale = 0.8,
    resistors/scale = 0.8
}
%draw tri and quadpoles
\node[transformer core, anchor = A1, scale = 0.8](transformer) at (2,2){};
\node[circ](c1) at (transformer.inner dot A1){};
\node[circ](c2) at (transformer.inner dot B2){};
\node[npn, anchor = collector, scale = 0.8](npn) at (2,0.25){};

%Primary
\draw (0,0) to [vsource,v=V] ++ (0,2)
 to (0,2) |- (transformer.A1)
 (transformer.A2) -- (npn.collector)
 (npn.emitter) -| (0,0);
 
%Secondary
 \draw (transformer.B1) to[Do] ++ (2,0) coordinate(A)
 (A) to[C] (A |- transformer.B2)
 (transformer.B2) to[short,i = $i_s$] (A |- transformer.B2);
 
 \draw (A) ++(1,0) coordinate(B)
 (A)--(B)
 (B) to [R,v=U] (B|- transformer.B2)
 (B|- transformer.B2) -- (A |- transformer.B2);

\end{tikzpicture}

反激式转换器

现在。我需要能够绘制一些电压标签。特别是我需要变压器初级和次级绕组中的电压以及晶体管集电极发射极和基极发射极之间的电压。由于节点不允许使用电流标签,我尝试使用 \draw [open]

我只是在 tikzpicture 的末尾添加了以下几行

\draw (transformer.A1) to [open, v = $v_p$ , f = $i_p$] (transformer.A2);
\draw (transformer.B1) to [open, v = $v_s$] (transformer.B2);
\draw (npn.collector) to [open, v = $v_Q$] (npn.emitter);
\draw (npn.base) to [open, v = $v_{be}$] (npn.emitter);

带标签的反激式转换器

如您所见,标签与组件重叠,这对于可读性来说不是很好

我或多或少设法通过对绘制标签的代码进行以下修改来解决这个问题

\draw ([xshift = -20]transformer.A1) to [open, v = $v_p$ , f = $i_p$] ([xshift = -20]transformer.A2);
\draw ([xshift = 10]transformer.B1) to [open, v = $v_s$] ([xshift = 10]transformer.B2);
\draw ([xshift = 10]npn.collector) to [open, v = $v_Q$] ([xshift = 10]npn.emitter);
\draw ([xshift = -5,yshift = -5]npn.base) to [open, v = $v_{be}$] (npn.emitter);

具有更好标签的反激式转换器

我的问题:

如您所见,这很好地解决了这个问题。但是,我想知道是否有更好的方法来做到这一点。

也可以随时指出整个电路的任何其他错误/问题。我对这个包很陌生,我才刚刚开始学习

提前致谢

答案1

OP 提出的解决方案是正确的;我在这里提出了一个替代方案。电压开启open通常被认为是标记中心电压,但您可以使用选项legacy让它open voltage position表现得像您想要的那样。您可以定义一种样式来简化定位。请注意,数量voltage shift有点反复试验,代码的这一部分确实很少使用,我会研究它;它似乎在范围之外很不稳定-1,1

此外,您似乎更喜欢raised电压选项,而不是一个american,所以让我们在整个图表中一致地使用它们。为了达到同样的一致性,样式选项更适合文档的序言。

short通常,最好将当前添加到元素或路径元素中,这样在语义上更清楚它在哪里......

总的来说,我发现绘图对于您想要添加的信息量来说太紧凑了,所以我给它留了一些空间 --- 尽管我可能更喜欢它更有空间。

\documentclass[border=10pt]{standalone}
% Circuit style
\usepackage{circuitikz}
\ctikzset{
    resistor = american,
    voltage = raised ,
    voltage dir = RP,
    quadpoles/transformer core/inner = 1, %Eliminates the horizontal bars on the transformer
    quadpoles/transformer core/width = 0.6, %Adjusts the width so that the transformers are closer
    diodes/scale = 0.7,
    capacitors/scale = 0.8,
    resistors/scale = 0.8
}

%% shifted open voltage 
\tikzset{open shifted/.style={
    open ,open voltage position=legacy, voltage shift=-0.9}
}

\begin{document}
\begin{tikzpicture}[]
%draw tri and quadpoles
\node[transformer core, anchor = A1, scale = 0.8](transformer) at (2,2){};
\node[circ](c1) at (transformer.inner dot A1){};
\node[circ](c2) at (transformer.inner dot B2){};
\node[npn, anchor = collector, scale = 0.8](npn) at (2,0){};

%Primary
\draw (0,0) to [vsource,v=V] ++(0,2)
 to [short, f=$i_p$] (transformer.A1) % current here
 (transformer.A2) -- (npn.collector)
 (npn.emitter) --++(0,-0.5) -| (0,0);

%Secondary
 \draw (transformer.B1) to[Do] ++ (2,0) coordinate(A)
 (A) to[C] (A |- transformer.B2)
 (transformer.B2) to[short,i = $i_s$] (A |- transformer.B2);

 \draw (A) ++(1,0) coordinate(B)
 (A)--(B)
 (B) to [R,v^=U] (B|- transformer.B2)
 (B|- transformer.B2) -- (A |- transformer.B2);

\draw (npn.C) to[open shifted, v^=$v_Q$](npn.E);
\draw (npn.B) to[open shifted, v=$v_{be}$, voltage shift=-1](npn.E);
\draw (transformer.A1) to[open shifted, v=$v_p$](transformer.A2);
\draw (transformer.B1) to[open shifted, v^=$v_s$](transformer.B2);

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容