[Tex/LaTex] How to draw architecture with tikz

chartstikz-pgftikz-styles

I'm learning tiKz packages for the drawing of charts etc in LaTex but I have to draw an architecture that is quite difficult for me.

I need to draw the architecture in the figure below and, in addition, draw the modules in alignment.
Can anyone help me?

enter image description here

Best Answer

Probably needs some work and may not fit with your existing approach, but something like this might work:

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{positioning,fit,shapes.arrows,shadows}
\newcounter{module}
\setcounter{module}{0}
\renewcommand*\themodule{\Alph{module}}
\tikzset{%
  module/.style={rounded corners, align=center, font=\sffamily, thick},
  simple module/.style={module, top color=blue!10, bottom color=blue!35, draw=blue!75, text width=40mm, minimum height=15mm, drop shadow},
  square module/.style={module, draw=orange!75!black, minimum height=20mm, text width=20mm},
  long module/.style={module, draw=orange!75!black, minimum height=20mm, text width=50mm},
  combo module/.style={module, draw=blue!75!black},
  simple module/.pic={
    \stepcounter{module}
    \node (module \themodule) [simple module] {Module \themodule};
  },
  module down arrow/.style={module arrow, shape border rotate=-90, yshift=1.25mm},
  module right arrow/.style={module arrow, xshift=-1.25mm},
  pics/horizontal module/.style n args=2{
    code={
      \stepcounter{module}
      \coordinate (c) at (0,0);
      \node [module right arrow] at (c) {};
      \node (module \themodule-1) [square module, left=7.5mm of c] {#1};
      \node (module \themodule-2) [square module, right=7.5mm of c] {#2};
      \node (module \themodule-3) [below=1.5mm of c |- module \themodule-2.south, module] {Module \themodule};
      \node (module \themodule) [fit=(module \themodule-1) (module \themodule-2) (module \themodule-3), combo module] {};
    }
  },
  pics/vertical module/.style n args=2{
    code={
      \stepcounter{module}
      \coordinate (c) at (0,0);
      \node [module down arrow] at (c) {};
      \node (module \themodule-1) [long module, above=7.5mm of c] {#1};
      \node (module \themodule-2) [long module, below=7.5mm of c] {#2};
      \node (module \themodule-3) [above=1.5mm of module \themodule-1.north, module] {Module \themodule};
      \node (module \themodule) [fit=(module \themodule-1) (module \themodule-2) (module \themodule-3), combo module] {};
    }
  },
  module arrow/.style={single arrow, single arrow head extend=2.5mm, drop shadow, draw=gray!75, inner color=gray!20, outer color=gray!35, thick, shape border uses incircle, text height=1.5mm, text width=2.5mm, anchor=center},
}
\begin{document}
\begin{tikzpicture}
  \pic {simple module};
  \node [module down arrow] at ([yshift=-7.5mm]module A.south) {};
  \pic [below=27.5mm of module A.south] {horizontal module={Description 1}{Description 2}};
  \node [module right arrow] at ([xshift=7.5mm]module B.east) {};
  \pic [right=42.5mm of module B.east] {vertical module={Description 3}{Description 4}};
  \node [module down arrow] at ([yshift=-7.5mm]module C.south) {};
  \pic [below=27.5mm of module C.south] {horizontal module={Description 5}{Description 6}};
  \node [module down arrow] at ([yshift=-7.5mm]module D.south) {};
  \pic [below=17.5mm of module D.south] {simple module};
\end{tikzpicture}
\end{document}

modules and arrows

EDIT

This version adds a little more depth and tries to simplify placement somewhat:

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{positioning,fit,shapes.arrows,shadows,backgrounds}
\newcounter{module}
\setcounter{module}{0}
\renewcommand*\themodule{\Alph{module}}
\tikzset{%
  module/.style={rounded corners, align=center, font=\sffamily, thick, fill=white},
  simple module/.style={module, top color=blue!10, bottom color=blue!35, draw=blue!75, text width=40mm, minimum height=15mm, drop shadow},
  square module/.style={module, draw=orange!75!black, inner color=white, outer color=orange!75!black!5, minimum height=20mm, text width=20mm},
  long module/.style={module, draw=orange!75!black, inner color=white, outer color=orange!75!black!5, minimum height=20mm, text width=50mm},
  combo module/.style={module, draw=blue!75!black, inner color=white, outer color=blue!75!black!5, drop shadow},
  simple module/.pic={
    \stepcounter{module}
    \node (module \themodule) [simple module] {Module \themodule};
  },
  module down arrow/.style={module arrow, shape border rotate=-90, yshift=1.25mm, anchor=north},
  module right arrow/.style={module arrow, xshift=-1.25mm, anchor=west},
  pics/horizontal module/.style n args=2{
    code={
      \stepcounter{module}
      \coordinate (c) at (0,0);
      \node (arrow \themodule-1) [module right arrow, anchor=center] at (c) {};
      \node (module \themodule-1) [square module, left=2.5mm of arrow \themodule-1.west] {#1};
      \node (module \themodule-2) [square module, right=2.5mm of arrow \themodule-1.tip] {#2};
      \node (module \themodule-3) [below=1.5mm of c |- module \themodule-2.south, module] {Module \themodule};
      \scoped[on background layer]{\node (module \themodule) [fit=(module \themodule-1) (module \themodule-2) (module \themodule-3), combo module] {};}
    }
  },
  pics/vertical module/.style n args=2{
    code={
      \stepcounter{module}
      \coordinate (c) at (0,0);
      \node (arrow \themodule-1) [module down arrow] at (c) {};
      \node (module \themodule-1) [long module, above=2.5mm of arrow \themodule-1.north] {#1};
      \node (module \themodule-2) [long module, below=2.5mm of arrow \themodule-1.tip] {#2};
      \node (module \themodule-3) [above=1.5mm of module \themodule-1.north, module] {Module \themodule};
      \scoped[on background layer]{\node (module \themodule) [fit=(module \themodule-1) (module \themodule-2) (module \themodule-3), combo module] {};}
    }
  },
  module arrow/.style={single arrow, single arrow head extend=2.5mm, drop shadow, draw=gray!75, inner color=gray!20, outer color=gray!35, thick, shape border uses incircle, text height=1.5mm, text width=2.5mm, anchor=center},
}
\begin{document}
\begin{tikzpicture}
  \pic {simple module};
  \node (arrow AB) [module down arrow, below=5mm of module A] {};
  \pic [below=15mm of arrow AB.tip] {horizontal module={Description 1}{Description 2}};
  \node (arrow BC)  [module right arrow, right=5mm of module B] {};
  \pic [right=30mm of arrow BC.tip] {vertical module={Description 3}{Description 4}};
  \node (arrow CD) [module down arrow, below=5mm of module C] {};
  \pic [below=15mm of arrow CD.tip] {horizontal module={Description 5}{Description 6}};
  \node (arrow DE) [module down arrow, below=5mm of module D] {};
  \pic [below=5mm of arrow DE.tip] {simple module};
\end{tikzpicture}
\end{document}

modules and arrows