Example: UML sequence diagrams

Published 2008-03-06 | Author: Xy Yuan

Demonstration of pgf-umlsd.sty, a set of convenient macros for drawing UML sequence diagrams.

To compile the example you will need the following style file:

The macros are documented in the style file.

Update: pgf-umlsd is now hosted at Google code.

Author:Xu Yuan, Southeast University, China

Download as: [PDF] [TEX]  •  [Open in writeLaTeX]

UML sequence diagrams

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de.

% Demonstration of pgf-umlsd.sty, a set of convenient macros for drawing
% UML sequence diagrams. Written by Xu Yuan <xuyuan.cn AT gmail.com> from
% Southeast University, China.
% The project is hosted at Google code: http://code.google.com/p/pgf-umlsd/ 
\documentclass{article}

\usepackage{tikz}
\usepackage{pgf-umlsd}
\usepgflibrary{arrows} % for pgf-umlsd
\begin{document}

\begin{figure}
  \centering

  \begin{sequencediagram}
    \newthread{ss}{}{SimulationServer}
    \newinst{ctr}{}{SimControlNode}
    \newinst{ps}{}{PhysicsServer}
    \newinst[1]{sense}{}{SenseServer}

    \begin{call}{ss}{Initialize()}{sense}{}
    \end{call}
    \begin{sdloop}{Run Loop}
      \begin{call}{ss}{StartCycle()}{ctr}{}
        \begin{call}{ctr}{ActAgent()}{sense}{}
        \end{call}
      \end{call}
      \begin{call}{ss}{Update()}{ps}{}
        \begin{call}{ps}{PrePhysicsUpdate()}{sense}{state}
        \end{call}
        \begin{callself}{ps}{PhysicsUpdate()}{}
        \end{callself}
        \begin{call}{ps}{PostPhysicsUpdate()}{sense}{}
        \end{call}
      \end{call}
      \begin{call}{ss}{EndCycle()}{ctr}{}
        \begin{call}{ctr}{SenseAgent()}{sense}{}
        \end{call}
      \end{call}
    \end{sdloop}
  \end{sequencediagram}

  \caption{UML sequence diagram demo.}
\end{figure}

\begin{figure}
  \centering

  \begin{sequencediagram}
    \newthread{ss}{}{SimulationServer}
    \newinst{ps}{}{PhysicsServer}
    \newinst[1]{sense}{}{SenseServer}
    \newthread[red]{ctr}{}{SimControlNode}

    \begin{sdloop}[green!20]{Run Loop}
      \mess{ctr}{StartCycle}{ss}
      \begin{call}{ss}{Update()}{ps}{}
        \prelevel
        \begin{callself}{ctr}{SenseAgent()}{}
          \begin{call}[3]{ctr}{Read}{sense}{}
          \end{call}
        \end{callself}
        \prelevel\prelevel\prelevel\prelevel
        \setthreadbias{west}
        \begin{call}{ps}{PrePhysicsUpdate()}{sense}{}
        \end{call}
        \setthreadbias{center}
        \begin{callself}{ps}{Update()}{}
        \end{callself}
        \begin{call}{ps}{PostPhysicsUpdate()}{sense}{}
        \end{call}
      \end{call}
      \mess{ss}{EndCycle}{ctr}
      \begin{callself}{ctr}{ActAgent()}{}
        \begin{call}{ctr}{Write}{sense}{}
        \end{call}
      \end{callself}
    \end{sdloop}

  \end{sequencediagram}

  \caption{Example of a sequence with parallel activities.}
\end{figure}

\end{document}

Comments

  • #1 km, November 9, 2008 at 8:35 a.m.

    pgf-umlsd.sty is wrong. It is giving me errors

  • #2 Kjell Magne Fauske, November 10, 2008 at 8:03 a.m.

    Apparently pgf-umlsd.sty is not compatible with the CVS version of PGF. I will inform the author about this issue.

  • #3 Kjell Magne Fauske, November 11, 2008 at 11:28 a.m.

    Update. pgf-umlsd.sty has been updated and is now compatible with the CVS version of PGF. You can find the new version here: http://code.google.com/p/pgf-umlsd/source/browse/#svn/trunk

    Note: The code on this page is not fully compatible with the new version. I will update the example soon.

  • #4 Juhana, November 27, 2008 at 10:06 a.m.

    I am having difficulties to compile basic examples from

    https://haspe.homeip.net/projekte/ddi/browser/tex/sty

    Any advice on this?

  • #5 Kjell Magne Fauske, November 27, 2008 at 10:21 a.m.

    @Juhana Do you mean the file pgf-umlsd-demo2.tex? To run that you'll need the pgf-umlsd.sty file. If you run a CVS version of PGF you'll need version 0.3. If you are using PGF 2.0 you'll probably need version 0.2.

  • #6 Juhana, November 28, 2008 at 2:25 p.m.

    Hi Thanks for a speedy response. I am trying to compile the basic example from http://pgf-umlsd.googlecode.com/files/pgf-umlsd-0.3.tar.gz

    but I am not succesful. I am getting the following errors

    ! Use of \t doesn't match its definition. \tikz@scan@no@calculator ...\edef \tikz@temp {(#2) }\expandafter \tikz@@scan@... l.44 \end{sequencediagram}

    ?

    ! Package PGF Math Error: Unknown function `inst'.

    See the PGF Math package documentation for explanation. Type H for immediate help. ...

    l.44 \end{sequencediagram}

    ?

    ! Package PGF Math Error: Unknown function `inst'.

    See the PGF Math package documentation for explanation. Type H for immediate help. ...

    l.44 \end{sequencediagram}

    Errors keep comming if I try to supperess them with enter. I am using MikTex Latex on windows Vista. This is too bad since I would use a figure like in the above picture.

  • #7 Kjell Magne Fauske, November 30, 2008 at 10:33 a.m.

    To run the 0.3 release of pgf-umlsd you need a recent CVS version of PGF. If you are using Miktex you are probably running PGF 2.0. Try using the 0.2 release of pgf-umlsd instead.

  • #8 ron, December 27, 2008 at 7:10 p.m.

    Hi I was happy to find a LaTeX tool to set sequence diagrams within my project requirements. I am using MikTEX 2.7 and tryed the above example with mor than 100 errors

    What did I wrong?

    Thanks for your help RON

  • #9 Kjell Magne Fauske, December 28, 2008 at 11:10 a.m.

    @Ron. It is difficult to know what the problem is without more details. Have you downloaded the pgf-umlsd.sty file? Have you updated PGF to 2.0 or later? Some of the hints in the above comments may also apply to your case.

  • #10 Prosser Thomas, February 3, 2009 at 12:59 p.m.

    Great Tool, you have made! Is there a possibility to increase the vertical space between the self calls, or to configure the variables defining it? Thanks :) Thomas

  • #11 Kjell Magne Fauske, February 3, 2009 at 2:51 p.m.

    @Thomas. I don't know if Xu Yuan monitors this page. pgf-umlsd has a dedicated Google code project page. There you can file feature requests or contact the author directly.

  • #12 stbn, February 11, 2009 at 5:47 p.m.

    hi, I'm trying use \usepackage{pgf-umlsd} on Miktex 2.7, because pgf-umlsd there isn´t at browse repository. I did this:

    1.- I make a directory with name "pgf-umlsd" at this path "C:\Program Files\MiKTeX 2.7\tex\latex\pgf-umlsd"

    2.- I copy the file pgf-umlsd.sty inside at above directory

    But he doesn´t works. he doesn´t file sty, where Miktex search?.

    Anybody have pgf-umld works? and whom environment. Anybody runs on kile?

    Thanks in advanced!!

  • #13 stbn, February 11, 2009 at 5:57 p.m.

    ok, this works, only need update Miktex's repository.

    Miktex settings -> general -> manteinance -> button Refresh FNBD. And miktex found the sty file.

  • #14 Qinghai Zhang, March 11, 2009 at 1:02 a.m.

    My compiling pgf-umlsd-demo.tex generates the following error message:

    ------------
    ERROR: I can't find file `pgflibrarytikzshadows.code.tex'.
    -------------
    

    This error message remains the same no matter what version (0.2, 0.3, 0.4) I use. I also checked out the latest pgf using

    --------------------
    cvs -d:pserver:anonymous@pgf.cvs.sourceforge.net:/cvsroot/pgf login
    
    cvs -z3 -d:pserver:anonymous@pgf.cvs.sourceforge.net:/cvsroot/pgf co -P pgf
    ------------------------------------
    

    After texhash, the problem remains. Actually in the checked out files, there is no `pgflibrarytikzshadows.code.tex' either.

    I am using openSUSE 11.1 with texlive. Could anyone please help me with this?

  • #15 Kjell Magne Fauske, March 11, 2009 at 8:07 a.m.

    The shadows library was added in PGF 2.0. The problem could be that you are running PGF 1.18. Are you using texlive 2008? If not, you could try upgrading, because PGF 2.0 is included.

  • #16 Tom, June 3, 2009 at 2:43 p.m.

    I have the same problem as ron. I have copied the code from this page here in a new latex file. Moreover I have put the pgf-umlsd.sty in the same folder as this Latex file. If I press make I get 101 errors.

    I'm using MikTex 2.7.

  • #17 Lem, July 31, 2009 at 3:47 p.m.

    As Kjell already answered: Everyone who's using MikTex 2.7 should try v0.2 - This will work without errors.

  • #18 Xu, Yuan, September 30, 2009 at 6:24 p.m.

    Hey guys, thanks for your feedback. Version 0.5 is just released!

  • #19 Rob, November 2, 2009 at 12:08 p.m.

    The Message Sequence Chart (MSC) is also quite flexible and is worth checking out.

    http://www.win.tue.nl/~sjouke/misc/mscpackage/

  • #20 AndreasT, January 7, 2010 at 12:51 p.m.

    Thx for this! It works incredibly well! The example runs only with the old style file from google code (0.2 I think). But then it rocks the house! Please make more macro packages like this one! It is easy to use and even easy to read. Instructional and practical... nice!

  • #21 Artem Pylypchuk, February 16, 2010 at 8:14 p.m.

    Nice software, good work!

  • #22 Markus, August 21, 2010 at 10:06 a.m.

    Version 0.2 works fine!

  • #23 bobkomas, October 7, 2010 at 5:30 a.m.

    I love music like "Queen". What about you?

  • #24 Clailycle, July 15, 2012 at 3:27 a.m.

    http://manual-profi.ru/img/foto2.png

    Мануальная терапия и массаж – мероприятия, популярные в медицине в наше время. Но необходимо учитывать, что работать с вами обязаны только опытные медицинские работники. С помощью мануальной терапии возможно излечиться от массы недугов, но только если проводить процедуры будет действительно медицинский работник. Дмитрий Пахомов – настоящий мастер своей профессии - профессионального массажа, имеет действительно профильное образование и более десятилетия опыта работы по специальности.

    лечение сколиоза массажем

    лечебный массаж позвоночника

    Массажист проводит услуги профессионального массажа на дому, если по каким-то обстоятельствам вы не смогли попасть к этому специалисту на приём, или возможен массаж в других удобных как раз для вас местах (офис, сауна и т.п.). Постоянные клиенты могут заказать массажиста с целью постоянного обслуживания в командировках, путешествиях и т.д.

    методики лечебного массажа

    техника баночного массажа

Adding comments is currently not enabled.

There are currently 24 comments on this entry.

Features
Tags
Scientific and technical areas

Creative Commons License