Wednesday, 2 March 2011

Message Sequence Chart

Sometimes there is a need to create interaction diagrams, similar to the UML's sequence diagrams. If you don't want to use UML or to draw the diagrams on some kind of drawing app, you can use Message Sequence Chart.

Message Sequence Chart is an interaction diagram from the SDL family. The main area of application for MSC is as for communication behaviour in real-time systems.

I've started used MSC to create some interaction diagrams to include on my MsC dissertation because it's really simple and straightforward.

This tutorial will guide you thought the steps to create a MSC diagram.

So, first you need a MSC Generator. I've used mscgen in order to parse and render my .msc files. You can download it in: http://www.mcternan.me.uk/mscgen/

Now let's create an .msc file. For an example let's start with a simple one. Use your favorite editor and start writing:

msc {

a,b,c;


a->b [label="ab()"] ;

b->c [label="bc(TRUE)"];

c=>c [label="process(1)"];

c=>c [label="process(2)"];

...;

c=>c [label="process(n)"];

c=>c [label="process(END)"];

a<<=c [label="callback()"];

--- [label="If more to run", ID="*"];

a->a [label="next()"];

a->c [label="ac()"];

b<-c [label="cb(TRUE)"];

b->b [label="stalled(...)"];

a<-b [label="ab() = FALSE"];

}


Now let's render it.

$./mscgen -T png -i foo.msc -o bar.png

And it's done! You will obtain this diagram:


You can find more documentation and all the
MSC functions and options on the mscgen web page http://www.mcternan.me.uk/mscgen/

No comments:

Post a Comment