Sequence Diagram For Each Loop

Sequence diagram examples and instruction. Below follows a examples of all different sequence diagram UML elements supported by the editor. Click the copy icon below the sequence diagram images to copy the source script and past it in the source editor. In some abstract sequence diagrams you have a loop combined fragment with a condition along the lines of e.g. for each item. On a sequence diagram featuring Java implementation; what would you use as a loop guard? If all lifelines must represent an object instance, how would you show that i: Item is not a single instance, but on each.

A control loop is the fundamental building block of industrial control systems. It consists of all the physical components and control functions necessary to automatically adjust the value of a measured process variable (PV) to equal the value of a desired set-point (SP). It includes the process sensor, the controller function, and the final control element (FCE) which are all required for automatic control.


Example of a single industrial control loop; showing continuously modulated control of process flow.

The accompanying diagram shows a control loop with a single PV input, a control function, and the control output (CO) which modulates the action of the final control element (FCE) to alter the value of the manipulated variable (MV). In this example, a flow control loop is shown, but can be level, temperature, or any one of many process parameters which need to be controlled. The control function shown is an 'intermediate type' such as a PID controller which means it can generate a full range of output signals anywhere between 0-100%, rather than just an on/off signal. [1]

In this example the value of the PV is always the same as the MV, as they are in series in the pipeline. However, if the feed from the valve was to a tank, and the controller function was to control level using the fill valve, the PV would be the tank level, and the MV would be the flow to the tank.

The controller function can be a discrete controller, or a function block in a computerised control system such as a distributed control system or a programmable logic controller. In all cases, a control loop diagram is a very convenient and useful way of representing the control function and its interaction with plant. In practice at a process control level, control loops are normally abbreviated using standard symbols in a Piping and instrumentation diagram, which shows all elements of the process measurement and control based on a process flow diagram.[2]

At a detailed level the control loop connection diagram is created to show the electrical and pneumatic connections. This greatly aids diagnostics and repair, as all the connections for a single control function are on one diagram.

Loop and control equipment tagging[edit]

To aid unique identification of equipment, each loop and its elements are identified by a 'tagging' system and each element has a unique tag identification.[3]

Based on the standards ANSI/ISA S5.1 and ISO 14617-6, the identifications consist of up to 5 letters.

The first identification letter is for the measured value, the second is a modifier, 3rd indicates passive/readout function, 4th - active/output function, and the 5th is the function modifier. This is followed by loop number, which is unique to that loop.

For instance FIC045 means it is the Flow Indicating Controller in control loop 045. This is also known as the 'tag' identifier of the field device, which is normally given to the location and function of the instrument. The same loop may have FT045 - which is the flow transmitter in the same loop.

LetterColumn 1 Measured valueColumn 2 ModifierColumn 3 Readout/passive functionColumn 4 Output/active functionColumn 5 Function modifier
BBurner, combustionUser choiceUser choiceUser choice
CUser's choice - usually conductivityControlClose
DUser's choice - usually densityDifferenceDeviation
FFlow rateRatio
GUser's choice (usually gaging/gauging)GasGlass/gauge/viewing
KTime, time scheduleTime rate of changeControl station
MUser's choiceMiddle / intermediate
NUser's choice (usually torque)User choiceUser choiceUser choice
OUser's choiceOrificeOpen
PPressurePoint/test connection
SSpeed, frequencySwitchStop
VVibration, mechanical analysisValve or damper
WWeight, forceWell or probe
XUser's choice - usually on-off valve as XVX-axisAccessory devices, unclassifiedUnclassifiedUnclassified
YEvent, state, presenceY-axisAuxiliary devices
ZPosition, dimensionZ-axis or SafetyActuator, driver or unclassified final control element

For reference designation of any equipment in industrial systems the standard IEC 61346 (Industrial systems, installations and equipment and industrial products — Structuring principles and reference


  1. ^Cooper, Douglas. 'Control Guru'. Control Guru terminology. Retrieved 16 September 2017.CS1 maint: discouraged parameter (link)
  2. ^'Piping and instrumentation diagram P&ID'. Process Flow Systems. Retrieved 16 September 2017.CS1 maint: discouraged parameter (link)
  3. ^'Components of control loops and ISA symbology'(PDF). Instrumentation and control - process control fundamentals. Retrieved 16 September 2017.CS1 maint: discouraged parameter (link)
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Control_loop&oldid=1022113297'

Uml Sequence Diagram Loop


Home > Articles > Software Development & Management > UML

  1. Loops, Conditionals, and the Like
< BackPage 2 of 4Next >
This chapter is from the book

Sequence Diagram For Each Loop Diagram

UML Distilled: A Brief Guide to the Standard Object Modeling Language, 3rd Edition

This chapter is from the book

This chapter is from the book

UML Distilled: A Brief Guide to the Standard Object Modeling Language, 3rd Edition

A common issue with sequence diagrams is how to show looping and conditional behavior. The first thing to point out is that this isn’t what sequence diagrams are good at. If you want to show control structures like this, you are better off with an activity diagram or indeed with code itself. Treat sequence diagrams as a visualization of how objects interact rather than as a way of modeling control logic.

That said, here’s the notation to use. Both loops and conditionals use interaction frames, which are ways of marking off a piece of a sequence diagram. Figure 4.4 shows a simple algorithm based on the following pseudocode:

Figure 4.4. Interaction frames

In general, frames consist of some region of a sequence diagram that is divided into one or more fragments. Each frame has an operator and each fragment may have a guard. (Table 4.1 lists common operators for interaction frames.) To show a loop, you use the loop operand with a single fragment and put the basis of the iteration in the guard. For conditional logic, you can use an alt operator and put a condition on each fragment. Only the fragment whose guard is true will execute. If you have only one region, there is an opt operator.

Interaction frames are new in UML 2. As a result, you may see diagrams prepared before UML 2 and that use a different approach; also, some people don’t like the frames and prefer some of the older conventions. Figure 4.5 shows some of these unofficial tweaks.

Figure 4.5. Older conventions for control logic

UML 1 used iteration markers and guards. An iteration marker is a * added to the message name. You can add some text in square brackets to indicate the basis of the iteration. Guards are a conditional expression placed in square brackets and indicate that the message is sent only if the guard is true. While these notations have been dropped from sequence diagrams in UML 2, they are still legal on communication diagrams.

Table 4.1. Common Operators for Interaction Frames




Alternative multiple fragments; only the one whose condition is true will execute (Figure 4.4).


Optional; the fragment executes only if the supplied condition is true. Equivalent to an alt with only one trace (Figure 4.4).


Parallel; each fragment is run in parallel.


Loop; the fragment may execute multiple times, and the guard indicates the basis of iteration (Figure 4.4).


Critical region; the fragment can have only one thread executing it at once.


Negative; the fragment shows an invalid interaction.


Reference; refers to an interaction defined on another diagram. The frame is drawn to cover the lifelines involved in the interaction. You can define parameters and a return value.


Sequence diagram; used to surround an entire sequence diagram, if you wish.

Although iteration markers and guards can help, they do have weaknesses. The guards can’t indicate that a set of guards are mutually exclusive, such as the two on Figure 4.5. Both notations work only with a single message send and don’t work well when several messages coming out of a single activation are within the same loop or conditional block.

Sequence Diagram For Each Loop In Python

To get around this last problem, an unofficial convention that’s become popular is to use a pseudomessage, with the loop condition or the guard on a variation of the self-call notation. In Figure 4.5, I’ve shown this without a message arrow; some people include a message arrow, but leaving it out helps reinforce that this isn’t a real call. Some also like to gray shade the pseudomessage’s activation bar. If you have alterative behavior, you can show that with an alternative marker between the activations.

Although I find activations very helpful, they don’t add much in the case of the dispatch method, whereby you send a message and nothing else happens within the receiver’s activation. A common convention that I’ve shown on Figure 4.5 is to drop the activation for those simple calls.

The UML standard has no graphic device to show passing data; instead, it’s shown by parameters in the message name and return arrows. Data tadpoles have been around in many methods to indicate the movement of data, and many people still like to use them with the UML.

Sequence Diagram For Each Loop In One

All in all, although various schemes can add notation for conditional logic to sequence diagrams, I don’t find that they work any better than code or at least pseudocode. In particular, I find the interaction frames very heavy, obscuring the main point of the diagram, so I prefer pseudomessages.