8
votes

I want to design a simple embedded system. The special thing about this is that I want to design its architecture using UML. Among other diagrams I'm using, I have a Sequence Diagram as the one shown in the below image.

enter image description here

What I'm trying to depict here is that the sequence enclosed in the "LOOP" fragment is being executing again and again while there is no event.

The Interrupt Service Routine (ISR) block at the far right of the diagram is a block that executes asynchronously and generates the waited event.

The problem here is that, as the event may be generated at any time during the loop sequence, just once every while, for example, every 10ms, and sent to the "Module 2", I don't know how to represent this.

If I just put a message arrowhead pointing from the "ISR" block to "Module 2" I understand that this means that the message containing the event is going to be sent from "ISR" to "Module 2" as part of the loop, every time the loop executes, but that is not what I need. I need to depict the fact that the message from "ISR" to "Module 2" is only sent every X milliseconds, or randomly in time (in case of a hardware interrupt).

Any suggestions?

2

2 Answers

5
votes

Sequence diagram is dedicated to describe a particular execution. To describe all possible execution, you should use a state machine diagram.

2
votes

I am not 100% sure of that but I guess that is not possible only with sequence diagrams (I will continue to look at it...). I would keep this sequence diagram for modelling the loop core and use an activity diagram in order to model the exception. The general idea would be to model, as depicted below, at least a CallBehavior which will call your sequence, an ExceptionHandler in order to catch your Exception, and a treatment of your exception which can be another call behavior or what you want. Hoping it helps, Modelio Exception