Understanding UML is an important part of your toolkit

Engineering and IT Insight: Control system development requires information exchange among many people and systems. Unified modeling language (UML) can help bring out inconsistencies, remove ambiguity, and provide a “standard” way to communicate project information.

By Dennis Brandl January 24, 2012

The development of control systems demands that a lot of detailed and accurate information is exchanged among users and developers, customers and vendors, coders and analysts, and management and staff. Languages are tools used to communicate this information, but natural languages (Chinese, English, Spanish, French, etc.) are notoriously ambiguous. Natural languages rely on contextual information and are often vague and incomplete. They regularly contain inferences and references to information that is assumed to be commonly known. (See The Story of Human Language, Professor John McWhorter, The Great Courses, www.thegreatcourses.com.)

Developing control systems cannot rely on assumed information and ambiguous definitions. To address this problem the software engineering community, as well as other engineering communities, has developed artificial languages to unambiguously define requirements, specifications, and designs. Every engineering discipline has developed artificial languages. For example, electrical engineering has circuit diagrams, and chemical engineering has piping and instrumentation diagrams (P&ID) and process flow diagrams (PFD). Unless you have specific software engineering training, you may not be familiar with software engineering languages. Knowledge of these languages will allow you to define better requirements and designs, and it is an important part of any professional control engineer’s knowledge base.

Artificial engineering languages all have something in common: They have an annotated graphical component with symbols and text arranged in a diagram using well-defined and rigid rule sets. Software engineering’s artificial language for specifications and design is called UML, the Unified Modeling Language. UML has been officially defined in the ISO/IEC 19501 specification and is commonly used in other IEC and ISO standards. Unfortunately, standards are not tutorials and are not the best way to learn about UML, but there are many good books that teach about UML. (See Learning UML 2.0, Russ Miles and Kim Hamilton, ISBN 978-0596009823; UML Distilled: A Brief Guide to the Standard Object Modeling Language, Martin Fowler, ISBN 978-0321193681; and Object-Oriented Software Engineering Using UML, Patterns, and Java, Bernd Bruegge and Allen H. Dutoit, ISBN 978-0136061250.)

UML consists of 14 types of diagrams, divided into two categories: structural information and behavior information. While 14 diagram notations can be intimidating, most users of UML focus on five diagram types: class diagrams, object diagrams, state diagrams, use case diagrams, and sequence diagrams. The official UML specification does not restrict diagram elements to a certain diagram type, so generally any UML element may appear on almost any type of diagram. However, each diagram type has a specific purpose, and common use restricts diagram elements to their related diagram types.

Understanding the structure of information diagrams helps. The two most commonly used structural information diagrams are class diagrams and object diagrams. Class diagrams are used to describe the structure of the system classes and their relationships. Classes are used to define problem-specific collections of elements. For example, you may define a class of motors, a class of sensors, and a class of materials for a material movement system. Classes are an abstraction, and learning how to abstract a problem and define it so that others understand it is one of the most important lessons that can be learned using UML. Classes are represented by rectangles, and relationships are represented as lines between rectangles. The class diagram is a graphical representation of a set of relations and information about the class. For example, a specification may have hundreds of lines, such as the following: a case packer contains a PLC program, a case packer uses a failure sensor, a PLC program has an author, and a PLC program has a version. These statements can be concisely represented in class diagrams, reducing pages of dense text to a few simple diagrams. We are much better at recognizing patterns through diagrams than in strings of text, and UML class diagrams take advantage of our pattern-recognition abilities. Class figures may contain the attributes associated with the class, such as a serial number for a motor. The class figures may also contain the operations that can be performed on the class, such as “Start the motor”. Each sentence in a specification that uses the “has a” verb, such as “a motor has a serial number”, defines an attribute. Each sentence in a specification that uses the “can” verb, such as “a motor can be started”, defines an operation. Class figures unambiguously represent information about objects in the class and what can be done to the objects.

Class diagrams can also show more complex relationships such as aggregations, compositions, and sub-types. Aggregations represent bi-directional and asymmetric relationships, such as “a server provides domain name services to other servers”. A composition is a stronger aggregation, such as “a PLC contains an IO rack”. Subtypes are a form of generalization, such as “a PLC is a managed device”. These relationships are defined using annotations and symbols on the lines between the classes.

UML Class diagrams are widely used in specifications because of the ability to represent structural problem-specific information in an easy-to-understand format. They display complex relationships through simple patterns and provide a good way to formally document your specifications, requirements, and designs.

UML also defines object diagrams, which show examples of the system for selected objects at a specific instance in time. They present a view of the structure of an actual system, versus the abstract view of the class diagram. Usually an object diagram is only a partial view of an entire system, used to illustrate how relationships actually are used in specific situations. In simple projects, where there are only a small number of objects, an object diagram can be used to document the actual implementation. For example, a small project may have five motors and 10 sensors and can be documented on one diagram. However, in most projects, object diagrams are used only as examples to aid in understanding the class diagrams.

Understanding UML is important for all control engineers. UML will help bring out inconsistencies, remove ambiguity, and provide a “standard” way to communicate project information. Make UML knowledge part of your control engineering toolkit.

– Dennis Brandl is president of BR&L Consulting in Cary, N.C., www.brlconsulting.com. His firm focuses on manufacturing IT. Contact him at dbrandl@brlconsulting.com. Edited by Mark T. Hoske, Control Engineering, www.controleng.com.

Related reading

Save time: Don’t repeat basic arguments about project direction: What are your manufacturing IT project principles?

What are your manufacturing IT project principles?