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.

I would like to draw a signalling protocol message exchange, like the picture below.

enter image description here

I tried to draw the diagram with the package pgf-umlsd and 90% are able to realize the scheme. this is the code:

\documentclass{article}
\usepackage[margin=12mm]{geometry}
\usepackage{hyperref}
\usepackage[underline=true]{pgf-umlsd}
\usepackage{listings}
\usepackage{color}
\definecolor{listinggray}{gray}{0.92}
\lstset{ %
   language=[LaTeX]TeX,
   breaklines=true,
   frame=single,
   basicstyle=\footnotesize\ttfamily,
   backgroundcolor=\color{listinggray},
   keywordstyle=\color{blue}
}

\begin{document}

\begin{sequencediagram}
\newinst{ue}{UE}
\newinst[3]{nodeb}{Node B}
\newinst[3]{rnc}{RNC}
\mess{ue}{RRC Connection Request}{rnc}
\mess{rnc}{Radio Link Setup Request}{nodeb}
\mess{nodeb}{Radio Link Setup Response}{rnc}
\mess{rnc}{Establish Request}{nodeb}
\mess{nodeb}{Establish Confirm}{rnc}
\mess{rnc}{RRC Connection Setup}{ue}
\mess{nodeb}{Synchronization Indication}{rnc}
\mess{ue}{RRC Connection Setup Complete}{rnc}
\end{sequencediagram}

\end{document}

using the package I am not able to enter the rectangle labeled "L1 synchronization" between the messages "RRC Connection Setup" and "Synchronization Indication".

Can you suggest a more customizable alternative to the diagram shown?

share|improve this question
    
May be answers to Drawing networks protocols could help you. MSC package is supposed to help you. –  Ignasi Feb 25 '13 at 11:19
    
thanks for the tip. Wondering if anyone has any suggestions as an alternative to the packages pgf-umlsd and msc. –  user21431 Feb 25 '13 at 12:30
    
I have another suggestion ;-) You could try tikz-uml (ensta-paristech.fr/~kielbasi/tikzuml/index.php?lang=en). I have no expirience with it. But it looks good to me. I'll try to typeset your diagram in it. –  Dave Feb 26 '13 at 9:48
    
can someone post some sample code? –  user21431 Feb 27 '13 at 8:48
    
Hi, Leo. You don't have to sign with your name since it automatically appears in the lower right corner of your post. So I suggest that you change your user name to something more telling (like Leo :) –  hpesoj626 Mar 17 '13 at 14:53
add comment

3 Answers 3

up vote 5 down vote accepted
+50

You can complete your diagram without leaving pgf-umlsd:

Diagram

To do so, you only need to know some things about pgf-umlsd:

  • Macro \postlevel increases a "unit of time" the timing of the next message, so it serves to leave a gap between "RRC Connection Setup" and "Synchronizacion indication", to insert your rectangle.

  • pgf-umlsd defines a pair of named nodes for each message, which you can use later to draw things relative to those nodes. They are called (<message label> from) and (<message label> to), where <message label> is the text written above the message.

You can use those named nodes to specify the corners of the shaded rectangle. I used calc library to do so.

So, in your case, to draw the rectangle at the desired point, you have to find which messages are near the corners of the rectangle. We find that the top left corner is near the ending of message "RRC Connection Setup", and the bottom right corner is near the starting of message "Synchronization Indication", so the corners of the rectangle are:

(RRC Connection Setup to) rectangle (Synchronization Indication from)

But those would produce a rectangle too close to the messages, so we have displace a bit the y coordinate to separate it from each message. I used the following expression to separate it 0.3 units of each:

($(RRC Connection Setup to)+(0,-.3)$) rectangle ($(Synchronization Indication from) +(0,.3)$)

If you want the rectangle spanning other columns, you have to find which message endings are nearby to the desired rectangle corners. For example, for having the rectangle from "Node B" to "RNC", yo may use:

 ($(RR Connection Setup from)+(0,-.3)$) rectangle ($(Synchronization Indication from) +(0,.5)$)

and so on

\documentclass{article}
\usepackage[margin=12mm]{geometry}
\usepackage{hyperref}
\usepackage[underline=true]{pgf-umlsd}
\usetikzlibrary{calc}
\begin{document}

\begin{sequencediagram}
\newinst{ue}{UE}
\newinst[3]{nodeb}{Node B}
\newinst[3]{rnc}{RNC}
\mess{ue}{RRC Connection Request}{rnc}
\mess{rnc}{Radio Link Setup Request}{nodeb}
\mess{nodeb}{Radio Link Setup Response}{rnc}
\mess{rnc}{Establish Request}{nodeb}
\mess{nodeb}{Establish Confirm}{rnc}
\mess{rnc}{RRC Connection Setup}{ue}
\postlevel
\mess{nodeb}{Synchronization Indication}{rnc}
\filldraw[fill=black!30] ($(RRC Connection Setup to)+(0,-.3)$) rectangle ($(Synchronization Indication from) +(0,.3)$)
  node[midway] {L1 Synchronization};
\mess{ue}{RRC Connection Setup Complete}{rnc}
\end{sequencediagram}

\end{document}
share|improve this answer
    
thanks jLDiaz, this was exactly what I wanted to achieve. –  user21431 Mar 11 '13 at 10:20
    
and how can I control the position of the rectangle? I mean, if I would position the rectangle between node ue and rnc? or between nodeb and rnc? –  user21431 Mar 11 '13 at 10:35
    
@user21431 I edited my answer with further explanations and examples –  JLDiaz Mar 11 '13 at 10:52
    
thanks for the clarity –  user21431 Mar 11 '13 at 11:02
    
Is it possible assign a different color to pairs of arrows and put a legend with the colors for each protocol layer? –  user21431 Mar 15 '13 at 10:45
show 4 more comments

Actually,you can use pgf-umlsd and change any style as you wish:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,shadows,calc}
\usepackage{pgf-umlsd}

\begin{document}

\begin{sequencediagram}
\tikzstyle{inststyle}=[rectangle,anchor=west,minimum
    height=0.8cm, minimum width=1.6cm, fill=white]
\tikzstyle{dotted}=[line width=2pt,red!50]
\newinst{ue}{UE}
\newinst[3]{nodeb}{Node B}
\newinst[3]{rnc}{RNC}
\mess{ue}{RRC Connection Request}{rnc}
\mess{rnc}{Radio Link Setup Request}{nodeb}
\mess{nodeb}{Radio Link Setup Response}{rnc}
\mess{rnc}{Establish Request}{nodeb}
\mess{nodeb}{Establish Confirm}{rnc}
\mess{rnc}{RRC Connection Setup}{ue}
\postlevel
\mess{nodeb}{Synchronization Indication}{rnc}
\filldraw[fill=black!30] ($(RRC Connection Setup to)+(0,-.3)$) rectangle ($(Synchronization Indication from) +(0,.3)$)
  node[midway] {L1 Synchronization};
\mess{ue}{RRC Connection Setup Complete}{rnc}
\end{sequencediagram}

\end{document}

The output as below:

enter image description here

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.