How to design a timing diagram - taking the APA automatic parking system as an example (I)

Publisher:EnigmaticCharmLatest update time:2023-07-21 Source: 喵星智能车Author: Lemontree Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Timing diagram description

A sequence diagram is a type of UML (Unified Modeling Language) diagram that illustrates the interactions between objects in a system over time and is often used to visualize the flow of messages and the order of method calls between objects in a software system.

The sequence diagram shows the order of interaction between objects, models the interaction behavior as message passing, and dynamically displays the interaction between objects by describing how messages are sent and received between objects. Compared with other UML diagrams, the sequence diagram emphasizes the time order of interaction and can intuitively describe concurrent processes.

2. Drawing principles

The drawing principle is relatively simple, but if you want to describe the real interaction in detail, you need to pay more attention to the details and have a clear grasp of the overall process. In the recent work process of drawing timing diagrams, I feel that my understanding of the system has become much deeper and clearer, and the parts that I didn't understand very well suddenly became clear.

1. Role (tor)

System roles can be people, machines, other systems, or subsystems; they are represented in the sequence diagram as shown below.

2. Object and Lifeline

Objects: The left-right order of objects is not important, but in order to make the drawing clear and neat, the following two principles should generally be followed: 1. Place objects that interact frequently as close together as possible; 2. Place the object that initiates the entire interactive activity at the far left.

Lifeline: In a timing diagram, it is represented as a dotted line extending downward from the object icon, indicating the time the object exists.

3. Focus of Control

Also known as the activation period, it is a symbol that represents the time period during which the object will perform the corresponding operation. It can be understood as the content in a pair of curly braces { } in semantics; it is represented by a small rectangle.

4. Message

Synchronous Message: The sender of the message passes control to the receiver of the message, then stops the activity and waits for the receiver of the message to give up or return control. It is used to express the meaning of synchronization.

Asynchronous Message: The sender of a message passes the message to the receiver of the message, and then continues its own activities without waiting for the receiver to return the message or control. The receiver and sender of an asynchronous message work concurrently.

Return Message: Return message indicates return from a procedure call.

5. Self-association messages

Indicates that a method calls itself or a method within an object calls another method.

6. Combined Fragments

Combined fragments are used to solve the conditions and methods of interactive execution. They allow logical components to be directly represented in sequence diagrams. They are used to define special conditions and subprocesses for any part of any lifeline by specifying the application area of ​​the conditions or subprocesses. The main names and meanings of combined fragments are as follows:

3. Drawing suggestions

The most important thing about the sequence diagram is that it should clearly and accurately express the interactions and behaviors of the system. It is best to communicate and provide feedback with team members as needed to ensure that the sequence diagram can accurately convey the design intent and can prevent developers from misunderstanding.

The following are some of my personal experiences in drawing timing diagrams:

  1. Identify your goals : Be clear about what you are trying to do with the sequence diagram. Is it to understand the interaction flow of the system, or is it to perform design and debugging work? This helps determine the level of detail required and where to focus.
  2. Choose the appropriate granularity : According to the goals and requirements determined in the previous article, choose the appropriate granularity to represent objects and messages. Too fine granularity may make the sequence diagram complex and difficult to understand, while too coarse granularity may lose some important details. It is certain that we cannot convey all the information, and we need to choose the description tendency according to the purpose of the sequence diagram.
  3. Use clear naming : Choose clear and accurate names for each role, object, and message to ensure the readability and understanding of the sequence diagram. Avoid using vague or ambiguous terms and try to use terms related to the business domain.
  4. Reasonable organization and layout : When drawing a sequence diagram, organize and layout objects, lifelines, and messages reasonably to make them easy to understand. You can arrange objects and messages in chronological order and use alignment and spacing to improve readability.
  5. Use comments and notes : Use comments and notes in sequence diagrams to provide additional explanation and contextual information. This can help readers better understand the sequence diagram, especially for complex interactions and control flows.
  6. Simplification and abstraction : For complex systems and interactions, consider using simplified and abstract ways to draw sequence diagrams to highlight key points and reduce confusion. You can use hierarchical and nested sequence diagrams, or use critical paths and key messages to highlight.
  7. Use tool support : Consider using professional sequence diagram drawing tools, such as UML modeling tools or online drawing tools. These tools provide more functions and automation support, which can make drawing and editing sequence diagrams more efficient and convenient.

4. Drawing Tools

Sharpening the knife does not delay the chopping of wood. In the information age, good tools can improve our work efficiency exponentially. The following introduces commonly used timing diagram drawing tools.

  1. Enrprise Architect : EA (Enterprise Architect) is a powerful modeling and design tool, widely used in software development, system engineering and business process modeling.
  2. Draw.io : Draw.io is an online drawing tool that provides drawing capabilities for various chart types, including timing diagrams. It has an intuitive user interface and a rich graphics library that makes it easy to draw and edit timing diagrams. Draw.io also supports integration with cloud storage services such as Google Drive and Dropbox to facilitate team collaboration and file sharing.
  3. Microsoft Visio : Microsoft Visio is a popular commercial drawing tool with a rich graphics library and templates that can be used to create a variety of charts and graphs, including timing diagrams. Visio provides an intuitive interface and powerful drawing capabilities, suitable for more complex timing diagram drawing needs.
  4. Lucihart : Lucidchart is another online drawing tool with an easy-to-use interface and an extensive graphics library. It supports the drawing of time series diagrams and provides a range of interactive elements and layout options to facilitate the drawing and adjustment of the structure and style of time series diagrams. Lucidchart also provides integration with tools such as Google Drive and Slack to facilitate team collaboration and sharing.
  5. PlantUML : PlantUML is a text-based drawing tool that can generate various UML diagrams, including timing diagrams, from simple text descriptions. It has a simple and easy-to-use syntax and supports multiple output formats. You can use PlantUML to write timing diagrams in any text editor and convert them to images using the command line or plug-ins.

Let me talk about the two tools I have used in detail, EA and Draw.io :

Needless to say, EA is well-known in the automotive industry. We have seen a large number of design drawings coming from EA. The software has built-in special state machine drawing modules, software deployment, autosar, timing diagrams, etc., and can automatically generate code. It is very convenient to use and looks beautiful and neat.

However, due to the charges for the professional version, several companies I worked for did not buy the genuine version (sweat), and could only use it at home for fun, or use the trial version, which has a 30-day free trial (there will be a watermark on exported images).

Timing diagram template provided by EA

The biggest advantage of Draw.io is its convenience. It can be drawn online, has a variety of templates, and is automatically updated online, making it convenient for team collaboration. You can download the application on Github, and the experience is exactly the same as the online version, perfectly realizing office work without environmental dependence.

Timing diagram templates provided by Draw.io

Reference address:How to design a timing diagram - taking the APA automatic parking system as an example (I)

Previous article:The main difference between robot welder and ordinary welder
Next article:Analysis of PROFIBUS-DP Communication Technology between FANUC Robot and SIEMENS PLC

Latest robot Articles
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号