Design and Implementation of object-oriented method (UML) Serial Communication

Source: Internet
Author: User

In a recent software and hardware integration enterprise production management application software project, a certain number of hardware devices of different types are used, including the electronic dashboard, parameter acquisition of Enterprise Customer production equipment, and card reading equipment. The purpose of using these equipment is to provide equipment operation and management data at the production site for the software system, and display the production status at the site. According to the system plan, these different types of devices communicate with the software system through the 485 bus to achieve stable operation and information collection of the equipment and software system 24 hours a day. To achieve this, the system must achieve the following goals:

1) Upload and delivery of electronic panel data;

2) upload the data of the device collector;

3) upload the data of the card reader.

4) saves system data and automatically delivers the data to the database.

 

 

 

When I collect and search for relevant information about the implementation of serial communication on the Internet, I find that there is less information in this regard, and the program design and implementation are relatively simple. Due to the lack of good design concepts, this results in poor program reusability. So in the Process of program design and implementation, I introduced the idea of Object-Oriented Analysis and Design, improved the design efficiency of the program through UML, and increased the reusability of the program. The advantage of doing so is that the maintainability of the program can be increased, and the Development difficulty and cost can be effectively reduced. The following briefly introduces the development idea of the system and provides some valuable reference for colleagues engaged in serial communication development.

First, we planned the architecture based on the system objectives. From the perspective of hierarchical design, the program is divided into the following five layers: 1-system presentation layer: Some parameter settings and configuration monitoring through the program interface, such as setting the communication address of hardware equipment, browsing by uploading and distributing devices. 2-system business layer: implementation of related business logic supported by various devices, such as extracting information about the processing plan being executed from the production management system software and distributing it to the electronic panel of the corresponding station for display, to indicate the processing requirements of the station; and combined with the uploaded production data into effective real-time production data, reflecting the production status. 3-system transmission layer: Implements conversion and transmission between hardware commands and Logical Data by decoding and Decoding Based on the communication protocols of different hardware devices; 4-system receiving and receiving layer: To correspond to different types of hardware devices, basic operations for data transmission and receiving are extracted to form a common base class, that is, after the development is stable, the application can be easily expanded to other types of devices, which increases the maintainability of the system and the stability of data transmission.

 

 

 

In this way, the program architecture is designed. The next task is to design various business classes at different layers. Different designers may have their own design methods here. My method is based on the main business to be implemented in the export communication, using the UML time sequence diagram, reflects the interaction and call relationships between objects of different classes at each logic layer, and finally abstracts the operations that each class should perform, forms methods of each class, and finally completes the class design, in this way, the system design is basically complete.

 

 

 

 

Next, you can use the required programming language to design the program according to the program requirements. Because of the use of the object-oriented method for program design, we have achieved a reasonable and clear program implementation method, the program to achieve the goal is clear and simple, debugging is easier to locate the problem, more simple. What's better is that program reusability improves the applicability of our program and can easily expand on different devices. The system has a good architecture design. After a period of operation test, it proves that the system is stable and has achieved the expected design goal.

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.