当我向我的 circuitikz 添加箭头时,文档无法编译

当我向我的 circuitikz 添加箭头时,文档无法编译

我想为我的项目制作以下设置图,但是当我尝试添加动力流箭头时,文档无法编译。

代码如下

    \begin{circuitikz}[american]
    \draw (0,0)
    % PV Block
    to [short] (0,2.5)    
    to [short] (2,2.5)
    to [short] (2,0)
    to [short] (0,0)
    (0,2.5) to [short] (1,1.5)
    to [short] (2,2.5)
    
    % Lines to DC Boost
    (2,0.75) to [short] (4,0.75)
    (2,1.75) to [short] (4,1.75)
    (3,1.75) to [C] (3,0.75)
    
    % Boost converter
    (4,0.25) to [short] (4,2.25)
    to [short] (6,2.25)
    to [short] (6,0.25)
    to [short] (4,0.25)
    to [short] (6,2.25)
    
    %Lines to DC/AC
    (6,0.75) to [short] (10,0.75)
    (6,1.75) to [short] (10,1.75)
    (7,1.75) to [C] (7,0.75)
    
    % DC/AC
    (10,0.25) to [short] (10,2.25)
    to [short] (12,2.25)
    to [short] (12,0.25)
    to [short] (10,0.25)
    to [short] (12,2.25)
    
    % Lines to DC/DC Bidrectional
    (7.5,0.75) to [short] (7.5,-0.75)
    (8.5,1.75) to [short] (8.5,1)
    (8.5,0.5) to [short] (8.5,-0.75)
    (8.5,1) to [crossing] (8.5,0.5)
    
    % Bidirectional DC/DC
    (7,-0.75) to [short] (9,-0.75)
    to [short] (9, -2.75)
    to [short] (7,-2.75)
    to [short] (7,-0.75)
    (9,-0.75) to [short] (7,-2.75)
    
    % Lines to BESS
    (7.5,-2.75) to [short] (7.5,-3.5)
    (8.5,-2.75) to [short] (8.5,-3.5)
    
    % BESS
    (7,-3.5) to [short] (9,-3.5)
    to [short] (9, -4.5)
    to [short] (7,-4.5)
    to [short] (7,-3.5)
    
    % Display names
    (1,0.5) node[align=center]{PV Array}
    (4.5,1.65) node[align=center]{DC}
    (5.5,0.85) node[align=center]{DC}
    (10.5,1.65) node[align=center]{DC}
    (11.5,0.85) node[align=center]{AC}
    (8.5,-2.25) node[align=center]{DC}
    (7.5,-1.25) node[align=center]{DC}
    (8,-4) node[align=center]{BESS}
    
    % Arrows
    %\draw[-latex] (4,3) -- (6,3);
    
    \end{circuitikz}

非常感谢你的回答

答案1

我完全不明白为什么您要手动重新构建块circuitikz(所有块都可用),然后使用to[short]...在这种情况下您就可以使用--,没有区别。

无论如何,如果你将代码的最后几行改为:

[...]
  (8,-4) node[align=center]{BESS}; %<--- Add a semicolon here!
    
    % Arrows
    \draw[-latex] (4,3) -- (6,3);
[...]

它编译并给出

在此处输入图片描述

梅威瑟:

\documentclass[margin=5mm]{standalone}

\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[american]
    \draw (0,0)
    % PV Block
    -- (0,2.5) -- (2,2.5) -- (2,0) -- (0,0) (0,2.5) -- (1,1.5) -- (2,2.5)
    % Lines to DC Boost
    (2,0.75) -- (4,0.75) (2,1.75) -- (4,1.75) (3,1.75) to [C] (3,0.75)
    % Boost converter
    (4,0.25) -- (4,2.25) -- (6,2.25) -- (6,0.25) -- (4,0.25) -- (6,2.25)
    %Lines to DC/AC
    (6,0.75) -- (10,0.75) (6,1.75) -- (10,1.75) (7,1.75) to [C] (7,0.75)
    % DC/AC
    (10,0.25) -- (10,2.25) -- (12,2.25) -- (12,0.25) -- (10,0.25) -- (12,2.25)
    % Lines to DC/DC Bidrectional
    (7.5,0.75) -- (7.5,-0.75) (8.5,1.75) -- (8.5,1) (8.5,0.5) 
    -- (8.5,-0.75) (8.5,1) to [crossing] (8.5,0.5)
    % Bidirectional DC/DC
    (7,-0.75) -- (9,-0.75) -- (9, -2.75) -- (7,-2.75) -- (7,-0.75)
    (9,-0.75) -- (7,-2.75)
    % Lines to BESS
    (7.5,-2.75) -- (7.5,-3.5) (8.5,-2.75) -- (8.5,-3.5)
    % BESS
    (7,-3.5) -- (9,-3.5) -- (9, -4.5) -- (7,-4.5) -- (7,-3.5)
    % Display names
    (1,0.5) node[align=center]{PV Array}
    (4.5,1.65) node[align=center]{DC}
    (5.5,0.85) node[align=center]{DC}
    (10.5,1.65) node[align=center]{DC}
    (11.5,0.85) node[align=center]{AC}
    (8.5,-2.25) node[align=center]{DC}
    (7.5,-1.25) node[align=center]{DC}
    (8,-4) node[align=center]{BESS};
    % Arrows
    \draw[-latex] (4,3) -- (6,3);
    \end{circuitikz}
\end{document}

相关内容