Design and Implementation of Software for Vehicle Dynamic Weighing System Based on VC++

0 Introduction With the development of China's economy, the amount of road traffic as the lifeline of the country's economy has also increased sharply, and the proportion of overweight vehicles has also increased. This has caused serious threats to traffic safety and road life. Under this circumstance, the traditional static weighing has the disadvantages of low efficiency, large floor space and inconvenient movement, which cannot meet the needs of development. Therefore, Weigh in Motion (WIM) has been widely studied and developed rapidly as a smart weighing technology. The main problem facing the development of dynamic weighing systems is how to increase the speed of vehicle passing and reduce costs while maintaining high precision. There are two solutions, one is the introduction of foreign complete sets of equipment; the second is independent research and development. Among them, the introduction of foreign equipment, due to many factors such as high price and inconvenient maintenance, can not be widely applied; domestic research and production of dynamic weighing systems is later than abroad, but it is developing rapidly and becoming more mature. At present, the most popular in China is the axle load measurement, that is, the axle weight of each axle of the vehicle is measured separately, and the weight of the vehicle is calculated by the weighing system. The entire system consists of sensors, data acquisition cards, application software, database systems, as well as microprocessors, LCDs, and printers. In this paper, based on the characteristics of data acquisition, analysis, processing, display and preservation in the dynamic weighing system, the object-oriented design idea is adopted, and the dynamic weighing system application software is developed under the VC++ platform. The software is practical and reusable. Sexuality, easy expansion and easy maintenance.

1 Error Analysis and Processing Error sources for dynamic weighing systems include dynamic factors and static factors. The dynamic factors mainly include the vibration of the car itself, the unevenness of the road surface in the weighing area, and the speed and acceleration of the car passing through the area. The static factors are mainly reflected in the changes of the objective environment and the hardware itself, such as the temperature of the system at that time, whether the sensor is running well, and the resolution of the analog/digital conversion. The source of the error determines how the error is handled. On the one hand, it avoids unnecessary errors by setting the detection hardware conditions and detection methods. On the other hand, through good data processing methods to improve the accuracy of software processing data, there are mainly the following methods: ADV method, DV method, V method, displacement integral method, compensation method, expert system, parameter estimation method, neural network. The filtering methods in the dynamic weighing system mainly include: finite amplitude filtering, median filtering, arithmetic mean, moving average, weighted average filtering, and composite filtering. The software uses sliding weighted average filtering, that is, a data buffer is stored in sequence for N times of sampling data. Each time a new data is acquired, the first collected data is discarded, and then N data including new data is obtained. The weighted average gives the valid data for that sample.

This article refers to the address: http://


among them:


Where: Xn is the filtered output of the nth sample; Xn-i is the unfiltered nith sample; N is the moving average; Ci is the weight.

2 The overall design of the application software
2.1 System structure and main modules
The system is based on C/S three-tier architecture. The user interface layer adopts a friendly GUI interface, which is mainly the realization of user-related operations and data display. The business logic layer is modularized, including parameter settings. Data collection, transmission and processing; the database server layer encapsulates the operation of the database, mainly to save and maintain the data. The whole software function module diagram is shown in Figure 1. It includes four modules: data transmission, data processing, input/output, and data display. Taking the processing and display of the signal as the core, the flow of the signal is as shown in Fig. 2. Firstly, the voltage signal collected by the gravity sensor is continuously obtained in the weighing area, filtering, amplifying, A/D conversion, and the collected data is based on The initialization mode of the host computer system is transmitted by serial port or network communication. After the host computer judges the received data, it filters, calculates, stores and displays the result, and returns the result to the owner with a decision or invoice. .

2.2 Class diagram Through this type of diagram, the internal static structure of the dynamic weighing system software of this car is completely displayed, as shown in Figure 3. Among them, CDatabase, CDis-pose, CDisplay, CTransport, CPrint, CQuery, CMotion-Line, CStaticLine respectively represent database connection class, data processing class, data display class, communication class, report printing class, query class, dynamic curve and static curve class. Data processing classes have dependencies on data transfer classes.

3 software implementation
3.1 Transmission
The data communication of the industrial control system is generally based on the serial port, but since the serial communication can only be used for short-distance communication, the network communication has also been applied. The system realizes serial port and network communication under the premise of universality. Considering the real-time and reliability requirements of the vehicle dynamic weighing system, the multi-threaded encapsulation of the communication class realizes real-time data acquisition of the active transmission serial port and network monitoring, and improves the real-time data transmission efficiency. There are two thread functions used, one is the listener thread function UINT ListenThread(LPVOID pParam), and the other is the read data thread UINT ReadTread(LPVOID pParam). Since the system reads and writes to the same serial port at different times, there is no synchronous operation, and the listening thread in the background passes the listening call of the WaitCommEvent event, and the reading thread completes the receiving of the lower computer data.

3.2 Data processing implementation Because there are a large number of dynamic interference factors in the dynamic weighing process, it is easy to cause large errors in the data transmitted by the transmission module. Therefore, the algorithm is first selected to pre-process the received data filtering, and then scale conversion. The numerical calculation calculates the axial weight, and the filtering is the core of this part. The main implementation code of the weighted moving average filtering is given below:

3.3 Data display The display module mainly completes three aspects: the dynamic curve display of the collected real-time data, the static curve display of the processed data and the interface display of the entire software. The dynamic curve and the static curve respectively inherit the class CDisplay. This class only provides an interface in the form of a virtual function, and is not specifically implemented; the subclass is implemented separately according to its actual situation after inheritance. The display class is designed as follows:

By encapsulating the CDrawItem class, the display of the software interface is based on the Windows system, and the user and the control are kept under the control, thereby reducing the memory burden of the user and maintaining the principle of consistent interface.
3.4 Database Class Design After data transmission and processing are completed, the data to be stored should be stored for query and statistics. Through the comparison of database access technology, ADO database access technology has the advantages of easy to use, fast speed, and low memory expenditure. The system chooses MFC as the basis, and encapsulates the properties and methods of its three main objects Connection, Command, Recordset, and named it CWimDataBase class. In any place where you want to use the database, you only need to add its header file "CWimData-Base.h" and declare the object, then call its public properties and methods to perform database operations.
For example, use the m_WimDb object to call the function ConnectDb to connect to the database.



4 Conclusion <br> According to the characteristics of the current mainstream dynamic weighing system hardware structure and data processing process, the application software is designed and implemented by object-oriented programming method, making full use of object-oriented inheritance, encapsulation and polymorphism. And so on, the software is modularized, achieving high cohesion and low coupling between modules. Application testing shows that the software is practical, reusable, easy to expand, easy to maintain and user-friendly, in line with practical application needs.

Twins Bluetooth Earphone are popular for its idea, function and beauty. Barrier-free transmission distance over 10 meters, connection is not stuck, and strong penetration. Answer/end/reject/transfer, call waiting, redial, mute, multi-purpose devices connection, music pause/play/next, noise reduction, stereo, etc. It should be the first choice of Bluetooth Earphone.

Twins Bluetooth Earphone

Twins Bluetooth Earphone,Twins Wireless Bluetooth Earphone,Twins Wireless Earbuds,Double Earphones

ShenDaDian(China) Digital Electronics Co.,Ltd , http://www.btearbuds.com

This entry was posted in on