Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

enter image description here

I'm trying to draw above image. What I've got so far is:

enter image description here

Not very close. I'm struggling in leveling outer box and first box and also drawing arrows. I'm not sure when I'm anchoring to north, why would there be so much mis-match. Code is below:

\begin{figure}
\centering
\begin{tikzpicture}[scale=2]
  \node [draw=black,rotate=90,anchor=north,minimum width=3cm,minimum height=0.75cm] (io) {I/O interface};
  \node [draw=black,minimum width=3cm,minimum height=0.75cm, right =1cm of io] (io2) {SSD System};
  \node [draw=black,minimum width=3cm,minimum height=0.75cm, below =0.32cm of io2] (io3) {Fuzzy Logic ACC};
  \draw[red,thick,dotted] ($(io2.north west)+(-0.1,0.22)$)  rectangle ($(io3.south east)+(0.1,-0.22)$);
\end{tikzpicture}
\end{figure} 

Any help, suggestions or ideas would be appreciated. Thank you!

EDIT: With Kevin's answer I'm able to make good progress, this is what I've got so far. I got somewhat arrows drawn, now I need to figure out how to make text and put labels beside I/O interface.

:enter image description here

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

I would place the io node relative to the io2-io3 block. This way, io can be vertically centered relative to the other two nodes.

Code

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}

\begin{document}
\begin{tikzpicture}[scale=2]
  \tikzset{
    box/.style={draw=black,minimum width=3cm,minimum height=.75cm},
    >=latex,
  }
  \node(io2)[box]{SSD System};
  \node(io3)[box,below=.32cm of io2]{Fuzzy Logic ACC};
  \draw[red,thick,dotted] ($(io2.north west)+(-0.1,0.22)$) rectangle ($(io3.south east)+(0.1,-0.22)$);  
  \coordinate(mid left)at($(io2.west)!.5!(io3.west)$);
  \node(io)[box,rotate=90,left=1cm of mid left,anchor=center]{I/O interface};

  % drawing arrows
  \path(io.south west)--(io.south east) coordinate[pos=.33](x1) coordinate[pos=.67](x2);
  \draw[->](x2)--+(.2,0);
  \draw[<-](x1)--+(.2,0);

  \path(io2.south west)--(io2.south east) coordinate[pos=.33](y1) coordinate[pos=.67](y2);
  \draw[->](y1)--+(0,-.15);
  \draw[<-](y2)--+(0,-.15);

  \path(io.north east)--(io.north west) coordinate[pos=.2](z1) coordinate[pos=.4](z2) coordinate[pos=.6](z3) coordinate[pos=.8](z4);
  \draw[<-](z1)--+(-.5,0) node[anchor=east]{Distance Sensor};
  \draw[<-](z2)--+(-.5,0) node[anchor=east]{Video Input};
  \draw[<-](z3)--+(-.5,0) node[anchor=east]{Set Speed Limit};
  \draw[->](z4)--+(-.5,0) node[anchor=east]{Factored Acceleration};
\end{tikzpicture}
\end{document}

Output

enter image description here

share|improve this answer
    
Thank you. Is it possible to draw arrow from I/O to red dotted block? –  Shivam Kalra Jan 8 at 4:31
    
@ShivamKalra: See my updated answer. –  Kevin C Jan 8 at 5:01
2  
You can also use fit for red dotted rectangle. –  Harish Kumar Jan 8 at 5:20
add comment

Another solution using fit library.

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{fit,positioning,calc}
\tikzset{decision/.style = {diamond, draw, fill=blue!20, text width=4.5em, text badly centered, node
                            distance=3cm, inner sep=0pt},
         block/.style    = {rectangle, draw, fill=black!25, text width=5em, text centered, rounded
                            corners, minimum height=4em},
         line/.style     = {draw, -latex'},
         cloud/.style    = {draw, ellipse,fill=red!20, node distance=3cm, minimum height=2em}
}
\begin{document}
    \begin{tikzpicture}[scale=2,font=\small]
        \node [draw=black,minimum width=3cm,minimum height=0.85cm] (io2) {SSD System};
        \node [draw=black,minimum width=3cm,minimum height=0.85cm, below =0.32cm of io2] (io3) {Fuzzy Logic ACC};
        \draw [latex-] ($(io2.south east)!0.33!(io2.south west)$) -- ($(io3.north east)!0.33!(io3.north west)$);
        \draw [-latex] ($(io2.south east)!0.66!(io2.south west)$) -- ($(io3.north east)!0.66!(io3.north west)$);
        \node[fit=(io2) (io3), draw=red, dotted,minimum height=3cm] (fit) {};
        \node[anchor=south] at (fit.north) {ADAS};
        \node [draw=black,rotate=90,anchor=north,minimum width=3cm,minimum height=0.75cm,left=1cm of fit,anchor=south] (io) {I/O interface};
        \draw[-latex] ($(io.south east)!0.3!(io.south west)$) -- ($(fit.north west)!0.3!(fit.south west)$);
        \draw[latex-] ($(io.south east)!0.7!(io.south west)$) -- ($(fit.north west)!0.7!(fit.south west)$);
        \foreach \x/\a in {0.2/2,0.4/4,0.6/6,0.8/8}{
        \coordinate (z\a) at ($(io.north east)!\x!(io.north west)$);
        }
        \draw[latex-](z2)--+(-.5,0) node[anchor=east]{Distance Sensor};
        \draw[latex-](z4)--+(-.5,0) node[anchor=east]{Video Input};
        \draw[latex-](z6)--+(-.5,0) node[anchor=east]{Set Speed Limit};
        \draw[-latex](z8)--+(-.5,0) node[anchor=east,minimum width=3.1cm,align=left]{Factored \\ Acceleration}; 
\end{tikzpicture}
\end{document}

enter image description here

share|improve this answer
    
I was just trying to update my answer using fit. But I guess there's no need now :) –  Kevin C Jan 8 at 6:25
    
@KevinC Ohho!. Sorry Kevin. I think I would have waited :-) –  Harish Kumar Jan 8 at 6:26
add comment

Another solution

enter image description here

\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{fit,calc,arrows,positioning}
\begin{document}
\tikzstyle{line} = [draw, -latex']
\begin{figure}
\centering
\begin{tikzpicture}[scale=1]
  \node [draw=black,rotate=90,minimum width=3cm,minimum height=0.75cm]  (io) {I/O interface};
  \node [xshift=1cm,draw=black, minimum width=3cm,minimum height=0.75cm, below right =0.7cm of io]          (io2) {SSD System};
  \node [draw=black, minimum width=3cm,minimum height=0.75cm, below =0.35cm of io2] (io3) {Fuzzy Logic ACC};
 \draw [line] ([xshift=-0.5cm]io2.south)--([xshift=-0.5cm]io3.north);
 \draw [line] ([xshift=0.5cm]io3.north)--([xshift=0.5cm]io2.south);
  \node [fit=(io2)(io3),  draw,  inner sep=0.5cm](Box){};
  \draw [line] ([shift={(-3cm,1cm)}]io.north) node (a) {Distance center} +(2,0) -- (a-|io.north);
 \draw [line] ([shift={(-3cm,0.5cm)}]io.north) node (b) {Distance Sensor} +(2,0) -- (b-|io.north);
 \draw [line] ([shift={(-3cm,0cm)}]io.north) node (c) {Vedio Input} +(2,0)-- (c-|io.north);
 \draw [line] ([shift={(-3cm,-0.5cm)}]io.north) node (d) {Set Speed Limit} +(2,0)-- (d-|io.north);
 \draw [latex'-] ([shift={(-3cm,-1cm)}]io.north) node (e) {Factored Acceleration} +(2,0)-- (e-|io.north);
  \node[anchor=south,at=(Box.north)]  {ADAS};
\draw [line] ([shift={(0.4,-1cm)}]io.east) node(f){} -- (f-|Box.west){};
\draw [latex'-] ([shift={(0.4,-2cm)}]io.east) node(g){} -- (g-|Box.west){};
\end{tikzpicture}
\end{figure} 
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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