Design and Implementation of Automobile Dynamic Weighing System Software Based on VC

Design and Implementation of Automobile Dynamic Weighing System Software Based on VC

With the development of China's economy, the volume of road transportation, which is the lifeblood of the country's economy, has also increased dramatically, and the proportion of overweight vehicles has also increased day by day, which has posed a serious threat to traffic safety and road life. In this case, due to the disadvantages of traditional static weighing, such as low efficiency, large floor area, and inconvenient movement, it has been unable to meet the needs of development. Therefore, vehicle weighing technology (Weigh in MoTIon, WIM) has been widely researched and developed rapidly as an intelligent weighing technology. The main problem facing the development of dynamic weighing systems is how to increase the speed of vehicles and reduce costs while maintaining high accuracy. There are two solutions, one is the introduction of foreign complete sets of equipment; the other is independent research and development. Among them, the introduction of foreign equipment can not be widely used due to many factors such as high price and inconvenient maintenance. Domestic research and production of dynamic weighing systems are a little later than abroad, but they have developed rapidly and become more mature. At present, the axle load measurement is more popular in China, that is, the axle weight of each axle of the vehicle is measured separately, and then the whole vehicle weight is calculated by the weighing system. The entire system consists of sensors, data acquisition cards, application software, database systems, and microprocessors, LCDs, and printers. This article aims at the characteristics of data collection, analysis, processing, display, storage and other aspects of the dynamic weighing system, adopts the object-oriented design idea, and develops the dynamic weighing system application software under the VC ++ platform. The software is practical and reusable. Features such as sex, easy expansion and easy maintenance.

1 Error analysis and processing Error sources of dynamic weighing system 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 this area. Static factors are mainly reflected in changes in the objective environment and hardware problems, such as: the temperature of the system at that time, whether the sensor is operating well, and the resolution of the analog-to-digital conversion. The source of the error determines how the error is handled. On the one hand, by setting the detection hardware conditions and detection methods to avoid unnecessary errors, on the other hand, through good data processing methods to improve the accuracy of software processing data, there are currently the following methods: ADV method, DV method, V method, displacement integration method, compensation method, expert system, parameter estimation method, neural network. The filtering methods in the dynamic weighing system mainly include: limited amplitude filtering, median filtering, arithmetic average, moving average, weighted average filtering, composite filtering and other methods. The software uses sliding weighted average filtering, that is, a data buffer is set to store N sampled data in sequence. Each time a new data is collected, the first collected data is discarded, and then the N data including the new data is obtained. The weighted average results in valid data for that sample.


among them:


In the formula: Xn is the filtered output of the nth sampling; Xn-i is the unfiltered nith sampling value; N is the number of moving average items; Ci is the weighting

2 The overall design of the application software
2.1 System structure and main modules The system is based on the C / S three-tier architecture. The user interface layer uses a friendly GUI interface, which is mainly the realization of user-related operations and data display; the business logic layer is modularly designed, including parameter settings , Data collection, transmission and processing; the database server layer encapsulates the operation of the database, mainly to complete the preservation and maintenance of data. The entire software functional block diagram is shown in Figure 1, which includes four modules: data transmission, data processing, input / output, and data display. Taking signal processing and display as the core, the signal flow direction is shown in Figure 2. First, the voltage signal collected by the gravity sensor is continuously obtained in the weighing area, filtered, amplified, A / D converted, and the collected data is based on The host computer system is initialized in the form of serial port or network communication. After the host computer judges the received data, it filters, calculates, stores, and displays the results, and returns the results to the owner with a written decision or invoice. .

2.2 Class diagrams Through this kind of diagrams, the internal static structure of the vehicle's dynamic weighing system software 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. The data processing class has a dependency on the data transmission class.

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

3.2 Data processing realization Because there are a lot of dynamic interference factors in the dynamic weighing process, it is easy to cause large errors in the data transmitted by the transmission module, so first select the algorithm to preprocess the received data filtering, and then perform the scale conversion. Numerical calculation finds the axle weight, and filtering is the core of this part. The main implementation code of 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 interfaces in the form of virtual functions, which are not specifically implemented; the subclasses are implemented separately according to their actual conditions after inheritance. The design of the display class is as follows:

By encapsulating the CDrawItem class, the display of the software interface is based on the Windows system, and it adheres to the principle of placing the user and control, reducing the user's memory burden, and keeping the interface consistent.
3.4 Design of database class After the data transmission and processing are completed, the obtained data should be stored for query and statistics. Through the comparison of database access technology, it is found that ADO database access technology has the advantages of easy to use, fast speed, and low memory expenditure. This system chooses to use MFC as the basis, encapsulates the properties and methods of its three main objects ConnecTIon, Command, Recordset, and named it CWimDataBase class. Wherever you want to use database operations, just 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 In view of the characteristics of the current mainstream dynamic weighing system hardware structure and data processing process, this application software is designed and implemented using object-oriented programming methods, making full use of object-oriented inheritance, packaging and polymorphism, etc., The modularization of software is realized, and high cohesion and low coupling between modules are achieved. Application tests show that the software is practical, reusable, easy to expand, easy to maintain, and friendly interface, which meets the actual application needs.

Ultrathin Ceiling Lamp

Smart Ceiling Light,Cheap Ceiling Lights,Ultrathin Ceiling Lamp,Ultra Thin Led Lights

Changxing Fanya Lighting Co.,Ltd , https://www.fyledlights.com

Posted on