Circuitikz 自定义符号

Circuitikz 自定义符号

我想重现下面的电路:

在此处输入图片描述

我如何才能重现循环器符号?Circuitikz 有一些热力学符号库吗?

我的代码:

\documentclass{standalone}
\usepackage{circuitikz}

\begin{document}

    \begin{circuitikz}[scale=1.5]
        \draw (0,0) to (0,1.5);
        \draw (0,1.5) to (0.5,1.5);
        \draw (0.5,1.5) to [R, l_=$q_{refrigerator}$](1.5,1.5);
        \draw (1.5, 1.5) to (4,1.5);
        \draw (4,1.5) to (4,0);
        \draw (4,0) to [R, l_=$q$](0,0);
        \draw[dashed] (0.25,1.25) rectangle ++(1.5,2);
        \node[font=\sffamily, align = center] at (1,2.75) {Refrigerator\\or storage\\reservoir};
        \node[font=\sffamily, align = center] at (2,-0.5) {Channels of internally\\cooled device};
        \node[font=\sffamily, align = center] at (3,2.75) {Pump or\\compressor};
    \end{circuitikz}
\end{document}

在此处输入图片描述

谢谢!

答案1

第二版

我以前使用的方法(你可以在答案的历史记录中查看)是错误的。最后有一个解释。

您可以在此处利用空源,使用标签的标准“装饰”和箭头 --- 类似于直电压。然后,您可以将线条添加到形状中。命名P形状后,您将获得一组可用的锚点。在本例中,我使用了表达式(需要calc,但由 加载circuitikz):

($(P.center)!1!60:(P.east)$)

P.center该表达式的意思是:考虑从到 的线P.east,全长(这是1),然后将其旋转60度以找到所需的坐标。参见Z 手册第 147 页左右,“部分修饰语的语法”

我在代码中添加了注释来解释。

\documentclass[border=2.78mm]{standalone}
\usepackage[RPvoltages]{circuitikz}
\begin{document}

    \begin{circuitikz}[scale=1.5]
        \draw (0,0) to (0,1.5);
        \draw (0,1.5) to (0.5,1.5);
        % notice also how I have written the symbol here, and compare 
        % the position of the "f"
        \draw (0.5,1.5) to [R, l^=$\dot{q}_{\mathit{refrigerator}}$](1.5,1.5);
        % an empty generator with name "P" and its labels...
        \draw (1.5, 1.5) to[esource, name=P,
            l=$\dot{q}_{\mathit{circulator}}$,
            voltage=straight, v_<=$\dot{m}$,
            ] (4,1.5);
        % let's decorate it. Look at Ti*k*Z manual, page 147
        \draw [thick] ($(P.center)!1!60:(P.east)$) -- ($(P.center)!1!170:(P.east)$);
        \draw [thick] ($(P.center)!1!-60:(P.east)$) -- ($(P.center)!1!-170:(P.east)$);
        \draw (4,1.5) to (4,0);
        \draw (4,0) to [R, l_=$q$](0,0);
        \draw[dashed] (0.25,1.25) rectangle ++(1.5,2);
        \node[font=\sffamily, align = center] at (1,2.75) {Refrigerator\\or storage\\reservoir};
        \node[font=\sffamily, align = center] at (2,-0.5) {Channels of internally\\cooled device};
        \node[font=\sffamily, align = center] at (3,2.75) {Pump or\\compressor};
    \end{circuitikz}
\end{document}

在此处输入图片描述

附录旧答案使用了边框锚点,但手册中明确指出,它不应该用于此目的。它们用于定位标签、电压等,并且跟踪符号周围的矩形,而不是符号本身。事情太复杂了,无法以向后兼容的方式更改它们,所以……

相关内容