Visual Paradigm logo

What is Timing Diagram?

Timing diagrams are UML interaction diagrams used to show interactions when a primary purpose of the diagram is to reason about time.

Timing Diagram in UML Diagram Hierarchy

Timing diagrams focus 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.

Time Diagram at a Glance

State Timeline Representation

Changes from one state to another are represented by a change in the level of the lifeline. For the period of time when the object is a given state, the timeline runs parallel to that state. A change in state appears as a vertical change from one level to another. The cause of the change, as is the case in a state or sequence diagram, is the receipt of a message, an event that causes a change, a condition within the system, or even just the passage of time.

Timing Diagram Example

Value lifeline Representation

The figure below shows an alternative notation of UML Timing diagram. It shows the state of the object between two horizontal lines that cross with each other each time the state changes.

Compact view of Timing Diagram

Basic Concepts of Timing Diagrams

Major elements of timing UML diagram - lifeline, timeline, state or condition, message, duration constraint, timing ruler.

Lifeline

A lifeline in a Timing diagram forms a rectangular space within the content area of a frame. Lifeline is a named element which represents an individual participant in the interaction. It is typically aligned horizontally to read from left to right.

Timing Diagram with One Lifeline

Multiple lifelines may be stacked within the same frame to model the interaction between them.

Timing Diagram with Multiple lifelines

State Timeline in Timing Diagram

A state or condition timeline represents the set of valid states and time. The states are stacked on the left margin of the lifeline from top to bottom.

State Timeline in Timing Diagram

The cause of the change, as is the case in a state or sequence diagram, is the receipt of a message, an event that causes a change, a condition within the system, or even just the passage of time.

Multiple Compartments

It is possible to stack several life lines of different objects in the same timing diagram. One life line above the other. Messages sent from one object to another can be depicted using simple arrows. The start and the end points of each arrow indicate when each message was sent and when it was received.

Mutliple Lifelines in Timing Frame

State Lifeline

A state lifeline shows the change of state of an item over time. The X-axis displays elapsed time in whatever units are chosen while the Y-axis is labelled with a given list of states. A state lifeline is shown below:

Timing Frame with Lifeline

Value Lifeline

A value lifeline shows the change of value of an item over time. The X-axis displays elapsed time in whatever units are chosen, the same as for the state lifeline. The value is shown between the pair of horizontal lines which crosses over at each change in value.

State Timing Diagram Value Lifeline

Timeline and Constraints

We can use the length of a timeline to indicate how long the object remains in a particular state by reading it from left to right. To associate time measurements, you show tick marks online the bottom part of the frame.

The example below shows that the Login event is received three time units after the start of the sequence. To show relative times, you can mark a specific instance in time using a variable name. The figure marks the time the sendMail event is received as time

Timeline and Constraints in Timing Diagram

You can use relative time marks in constraints to indicate that a message must be received within a specified amount of time.

State and Value Lifeline Side-by-Side

State and Value Lifelines can be put one after the other in any combination. Messages can be passed from one lifeline to another. Each state or value transition can have a defined event, a time constraint which indicates when an event must occur, and a duration constraint which indicates how long a state or value must be in effect for.

State and Value Presentation of Timing Diagram

Model Consistency among Interaction Diagrams

Timing diagram should always be consistent with the relevant sequence diagram and state machine. To do this we can attach states in the lifeline for each of the objects in the sequence diagram. We can then derive the corresponding timing diagram much easier by inspecting the message passing between the objects against the states attached in the lifeline. The Carpark example below shows the model consistency between two interaction diagrams.

Sequence Diagram Example

The figure above shows a sequence diagarm of the car park example, while the figure below presents the corresponding timing diagram of the car park example. The various parts of the timing diagram refer to the content of sequence diagram.

Timing Diagram of an Interaction

Turn every software project into a successful one.