2
\documentclass{article}
\usepackage{tikz} 
\usepackage{circuitikz}
\usetikzlibrary{chains}
\begin{document}


\begin{tikzpicture}[
      start chain=going right,
      box/.style={
        on chain,join,draw,
        minimum height=3cm,
        text centered,
        minimum width=2cm,
      },
      every join/.style={ultra thick},
      node distance=5mm
    ]

    \node [on chain] {$in$}; % Chain starts here

    \node [box,xshift=5mm,label=above:Some] (rec) {
      \begin{circuitikz}[american currents]
        \draw (0,0) to[C] (0,2);
      \end{circuitikz}
    };

    \node [on chain,join,draw, 
      text width=1cm,
      minimum width=2cm,
      text centered,
      minimum height=3cm,
      label=above:Six,
    ] (ic) {
      \begin{circuitikz}[american currents]
        %\draw (0,0) to[Do] (0,2);
        \draw (0,0) to[cI] (0,-2);
      \end{circuitikz}
    };

    \node [box,label=above:Five] (inv) {
      \begin{circuitikz}
        %\draw (0,0) node[nigbt] {};
        \draw (0,0) to[C] (0,-2);
      \end{circuitikz}
    };

    \node [on chain,join,xshift=5mm]{$out$};
    % Chain ends here

    % CU box
    \node [
      rectangle,draw,
      below=5mm of ic,
      minimum width=8cm,
      minimum height=1cm,
    ] (cu) {\textbf{XXX}};

    % PU box
    \node [
      rectangle,draw,
      above=2mm of cu,
      minimum width=8cm,
      minimum height=4cm,
      label=\textbf{YYY},
    ] (pu) {};

    % Connections between CU and PU
    \draw[<->] (rec.south) -- ++(0,-5mm);
    \draw[<->] (cu.north) to (ic.south);
    \draw[<->] (inv.south) -- ++(0,-5mm);
    \end{tikzpicture}
\end{document}

Hi all,

My question is that middle box labelled "Six", I wish to draw controlled current with both of its legs/leads from its two ends shown . At the moment, from the picture attached, it only shows one leg. Any help is appreciated.

Cheers, Menghan

enter image description here

1
  • 1
    Do you mean \draw (0,0) to[cI] (0,-1) -- (0,-2);? – Torbjørn T. Sep 25 '15 at 7:31
1

This is a good example of why you shouldn't call tikz inside a tikz node.

\documentclass{article}
\usepackage{tikz} 
\usepackage{circuitikz}
\usetikzlibrary{chains}
\newsavebox{\tempbox}
\begin{document}

\savebox{\tempbox}{%
\begin{circuitikz}[american currents]
   \draw (0,0) to[cI] (0,-2);
\end{circuitikz}}


\begin{tikzpicture}[
      start chain=going right,
      box/.style={
        on chain,join,draw,
        minimum height=3cm,
        text centered,
        minimum width=2cm,
      },
      every join/.style={ultra thick},
      node distance=5mm
    ]

    \node [on chain] {$in$}; % Chain starts here

    \node [box,xshift=5mm,label=above:Some] (rec) {
      \begin{circuitikz}[american currents]
        \draw (0,0) to[C] (0,2);
      \end{circuitikz}
    };

    \node [on chain,join,draw, 
      text width=1cm,
      minimum width=2cm,
      text centered,
      minimum height=3cm,
      label=above:Six,
    ] (ic) {\usebox{\tempbox}};

    \node [box,label=above:Five] (inv) {
      \begin{circuitikz}
        %\draw (0,0) node[nigbt] {};
        \draw (0,0) to[C] (0,-2);
      \end{circuitikz}
    };

    \node [on chain,join,xshift=5mm]{$out$};
    % Chain ends here

    % CU box
    \node [
      rectangle,draw,
      below=5mm of ic,
      minimum width=8cm,
      minimum height=1cm,
    ] (cu) {\textbf{XXX}};

    % PU box
    \node [
      rectangle,draw,
      above=2mm of cu,
      minimum width=8cm,
      minimum height=4cm,
      label=\textbf{YYY},
    ] (pu) {};

    % Connections between CU and PU
    \draw[<->] (rec.south) -- ++(0,-5mm);
    \draw[<->] (cu.north) to (ic.south);
    \draw[<->] (inv.south) -- ++(0,-5mm);
    \end{tikzpicture}
\end{document}

circuitiz components

1
  • The node labeled "Six" has repeated all parameters otherwise collected in box/.style .... So, it can be shortly defined as\node [box,label=above:Six] (ic) {\usebox{\tempbox}};. – Zarko Sep 26 '15 at 17:36
0

Alternative solution without nesting tikz/ciciutikz images:

\documentclass{article}
    \usepackage{circuitikz}
\usetikzlibrary{calc,fit,positioning}

    \begin{document}
    \begin{circuitikz}[american currents,
       box/.style = {draw, 
                     inner ysep = 5mm,
                     minimum width=2cm,
                    },
      node distance=24mm
                        ]
\coordinate (some);
\coordinate[right=of some]  (six);
\coordinate[right=of six]   (five);
% electrical elements
\draw   (some) to [C]   ++ (0,-2) coordinate (some')
        (six)  to [cI]  ++ (0,-2) coordinate (six')  
        (five) to [C]   ++ (0,-2) coordinate (five');
% boxes around electrical elements
\node (in)  [box,fit=(some) (some')]    {};
\node (mid) [box,fit=(six)  (six') ]    {};
\node (out) [box,fit=(five) (five')]    {};
% input, output
\node (input)  [left =8mm of in ] {$in$};
\node (output) [right=8mm of out] {$out$};
% Connections nodes on chain
\draw[ultra thick]  (input) -- (in)  (in)  -- (mid)
                    (mid)   -- (out) (out) -- (output);
% PU box
\node (pu)  [draw,inner sep=4mm, fit= (in) (out),
             label=\textbf{YYY}]        {};
% CU box
\path   let \p1 = (pu.west),
            \p2 = (pu.east),
            \n1 = {veclen(\x2-\x1,\y2-\y1)} in
        node [draw, minimum width=\n1, minimum height=10mm,
              below=4mm of pu] (cu) {\textbf{XXX}};
% Connections between CU and PU
\path[draw,thick,<->] 
    (in) edge (in |- cu.north)
    (mid) edge (cu.north)
    (out)  --  (out |- cu.north);
    \end{circuitikz}
\end{document}

It gives the following image:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.