Introduction – An Introduction
The primary purpose of the timing diagram is to show the change in state or condition of a lifeline (representing a Classifier Instance or Classifier Role) over linear time. Timing diagrams are another type of interaction diagram focusing on conditions changing within and among Lifelines along a linear time axis. Timing diagrams describe behavior of both individual classifiers and interactions of classifiers, focusing attention on time of occurrence of events causing changes in the modeled conditions of the Lifelines. In other words, this diagram works better for tracking several objects, versus one object for a state diagram.
How to Draw a Timing Diagram?
Start with a timeline, with time advancing to the right. Define the possible states of your object(s), and then pick what style of timing diagram to be used. The first style is to draw a simple lines, which move up and down to show state changes and the second style is represented by bars, which form X’s at transitions. Identify the conditions which cause state transitions for any of the objects. Use dimensioning lines to show the allowable duration between events.
An Example: Card Access Control System
1. The user send a message Code and its duration is measured.
2. The ATM will send two messages back to the user.
3. CardOut is constrained to last between 0 to 13 time units.
4. The Interval between the sending of Code and reception of OK is constrained to last between d and 3*d where d is the measured duration of the Code signal
The most common usage is to show the change in state of an object over time in response to accepted events or stimuli. The received events are annotated as shown when it is desirable to show the event causing the change in condition or state.
Timing diagrams show change in state or other condition of a structural element over time. There are a few forms in use. I will give examples on the simplest as shown in Figure 1. Sometimes it is more economical and condensed to show the state or condition on the vertical Lifeline as a compact from as shown in Figure 2.
Figure 1 – Simplest Form of Timing Diagram
Figure 2 – Compact Form of a Timing Diagram
Timing Diagram in Elaborated From
Finally, we may have an elaborated form of timing diagrams where more than one Lifeline shown in two separate compartments (one on the top and the other in the bottom). The Top lifeline describes the User and the bottom one represents the Door Access Control System.
Figure 3 – Elaborated Timing Diagram
Comparing Timing and Sequence Diagram
Sequence Diagrams as the primary form of Interactions may also depict time observation and timing constraints which make it possible to express semantically equivalent representation as a timing diagram. For example, the “Access Door with Card” scenario of the Sequence Diagram in Figure 4 is depicted that equivalent to a simple Timing Diagram in Figure 1.
Figure 4 – An Equivalent Sequence Diagram with Timing Concepts