Design of Dynamic Signal Analysis System Based on VC++

Publisher:WiseThinkerLatest update time:2014-03-10 Source: 21ICKeywords:VC++ Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the continuous improvement of science and technology, mechanical engineering vibration testing technology has also entered a new stage. Dynamic signal analysis, as a comprehensive technology aimed at capturing and processing various dynamic information, occupies a very important position in contemporary science and technology. In recent years, multi-channel, high-performance dynamic signal analysis systems have been launched and widely used in various fields. And as users' needs for dynamic signal analysis become more and more diversified, flexible design has become the mainstream direction of the development of dynamic signal analysis systems. Foreign dynamic signal instruments have high sampling accuracy and powerful functions, but the price of the products is relatively high. At present, there is still a certain gap between domestic test and analysis systems and foreign ones. Therefore, the development of a real-time dynamic signal analysis system with independent intellectual property rights has very realistic scientific significance and engineering practical value.

Based on this, this paper uses Windows XP system as the development platform, object-oriented programming technology and VC++ as the development tool to develop a dynamic signal analysis system based on VC++. The software development adopts modular design, objectifies and encapsulates various functions, and improves the portability and reusability of each module. The system can realize real-time synchronous acquisition of single and multiple signals, analyze and process signals, and realize segmented data storage and waveform playback.

1 Overall system design

The quality of the overall system design is directly related to the success or failure of the entire test and analysis task and the quality of completion. From the hardware point of view, the system is generally composed of computers, USB interfaces, data acquisition hardware, sensors, etc.

From the software point of view, the system includes firmware programs, drivers and application software.

The firmware program is a program written by the capture card merchant and burned into the capture card hardware, which is responsible for the capture work of the capture card.

The driver and application software are installed in the computer. The driver is a program written in accordance with the USB protocol and is responsible for the normal communication between the application software and the acquisition card.

Application software is the human-computer interaction interface and is the key part in realizing various functions of signal analysis and processing.

Software system design and development is the focus and difficulty of this project. Using VC++ as the development platform, the system software design is carried out. The software system design of this project mainly includes: software system overall framework design, data acquisition module design, signal analysis and processing module design, data storage module design, etc.

The overall design block diagram of the dynamic signal analysis system is shown in Figure 1.

2 System Unified Architecture

The software design uses Windows XP system as the development platform, object-oriented programming technology and VC++ 6.0 as the development tool. The software development adopts modular design, objectifies and encapsulates various functions, and improves the portability and reusability of each module. A unified software system and overall module composition structure are adopted, that is, each module contains four sub-modules: program control, parameter setting, data analysis and data display.

The parameter setting module, data analysis module and data display module are functional modules, and the program control module is the core of the system. It is responsible for coordinating the effective cooperation and work of each module, accepting various instructions given by the operator, calling the corresponding analysis module algorithm, and displaying the analysis results to the user through the data visualization interface. The menu, toolbar and shortcut keys of the submodule are the external manifestations of the program control module, and interact with the operator through these external manifestations, converting them into internal instructions that can be understood by each functional module, and uniformly calling the functional modules to achieve the user's expected instruction goals.

The data analysis module uses dynamic link library technology to integrate and encapsulate the algorithms required by the system and provides an interface for the program control module to call. It is the core part of each sub-module.

The data display module is responsible for presenting the results of data processing to users in a rich manner so that users can judge or further process the processing results.

The composition relationship of the four sub-modules is shown in Figure 2.

3 System software design

Software system design and development is the key and difficulty of the entire analysis system development. VC++ is used as the development platform for system software design.

Software system design mainly includes: software system overall architecture design, data acquisition module design, signal analysis and processing module design, data storage module design, etc.

The overall architecture design of the software system is shown in Part 2 and will not be repeated here. The three modules are interconnected, including data acquisition module, data analysis and processing module, and data storage module. Their functions are as follows:

Data acquisition module: acquisition card parameter settings, acquisition equipment start and stop control and reset, to achieve data acquisition function (continuous acquisition or single acquisition); data analysis and processing module: by obtaining data from the data acquisition module or storage module, combined with the setting of analysis parameters, to achieve real-time signal waveform display, spectrum analysis, correlation analysis, envelope spectrum analysis, statistical feature analysis, etc.; data storage module: to achieve data storage and reading, as well as playback display, analysis and processing functions.

3.1 System interface design

In programming, a single document structure is used to compile applications.

The basic layout is designed as follows: the top of the window is the menu toolbar area, the lower left part is the data display area, and the lower right part is the data information browsing and control area. The main interface of the system is shown in Figure 3.

First, the client area is divided into two parts, 1 row and 2 columns: the left side is the voltage value digital display window, the associated class is CADDigitView (derived from CScrollView); the right side is the graphic display window, the associated class is CAD-WaveView (derived from CScrollView). Parameter setting and analysis control use two dialog bars, derived from CDialogBar, through which users can set acquisition card parameters and control signal acquisition and analysis. Since the program functions are relatively simple, almost all operations can be performed on the interface, which is extremely convenient to use.

3.2 Main processing algorithm

3.2.1 FFT

Spectrum analysis is a very important means of digital signal processing technology, so that the spectrum distribution of a waveform can be clearly seen. To perform spectrum analysis on an input signal source and transform it from a time domain signal to a frequency domain signal, Fourier analysis must be used. The rapid development of Fast Fourier Transform (FFT) has made breakthrough progress in digital spectrum analysis. There are many types of FFT algorithms, and the methods of selecting and using them are also different. This article uses time-selected parity decomposition fast discrete Fourier transform.

The steps of the radix-2 FFT algorithm are as follows:

(1) The original sequence is continuously decomposed according to the odd or even properties of the index until it is decomposed from an N-term sequence into N single-term rearranged sequences;

(2) Calculate the DFT of N single-term sequences. In this case, N = 1, and 0  n  N - 1, so n = k = 0, thus:

That is, the DFT of a single sequence is itself, so the DFT of N single rearranged sequences is obtained;

(3) The DFTs of the N single-term rearranged subsequences are synthesized pairwise to finally obtain the DFT of an N-term sequence, which is the DFT of the original sequence.

Based on the above guiding ideas, the FFT calculation program can be compiled.

When performing FFT, the input time domain sequence is sorted according to the sequence after odd-even decomposition according to the calculation method described by the "butterfly diagram", and the output frequency domain sequence is still arranged in natural order. This method does not require an intermediate storage unit, but it needs to be reversed.

The following code is used to complete the fast Fourier transform of the original sampled time domain sequence. A and M represent the pointer to the original sampled data array and the integer power of 2 of the sequence length respectively:

The spectrum of 1 kHz rectangular wave, including real spectrum, imaginary spectrum, amplitude spectrum and phase spectrum, is shown in Figure 4.

3.2.2 Correlation Analysis

In signal analysis, correlation is a very important concept, which expresses the degree of linear correlation between two signals (or a signal at different times).

The calculation formula of the correlation function and its discretized data is:

Where: N is the number of sampling points; Δt is the sampling interval; n is the time series; r is the delay sequence (time displacement number).

Autocorrelation analysis algorithm:

(1) Standard method

According to formula (3), the average product between the sampled data is directly calculated, and then used as the autocorrelation function estimate. This method is used to design the algorithm;

(2) Indirect method

This method does not obtain the usual autocorrelation function, but a "circular" correlation function. This method obtains the autocorrelation function by filling the original data with 0s, performing FFT, calculating its autopower spectrum, and then performing IFFT, taking the first half.

The calculation formula of the cross-correlation function and its discretized data is:

Cross-correlation analysis algorithm:

(1) Standard method

According to formula (5), the average product between the sampled data is directly calculated, and then used as the cross-correlation function estimate. This method is used to design the algorithm;

(2) Indirect method

This method is the same as FFT. After calculating its cross-power spectrum, do IFFT and take the first half to get its cross-correlation function.

The correlation signals of two sine wave signals with different frequencies are shown in FIG5 . Because the frequencies are different, they are uncorrelated, and their waveforms are close to a straight line with a constant value of zero.

3.2.3 Envelope analysis

There are usually three methods to extract the envelope of a signal: Hilbert amplitude demodulation, detection-filtering, and high-pass absolute value demodulation.

The envelope demodulated by the Hilbert method is the envelope of the absolute value of the signal, and its demodulated amplitude represents the real envelope. In the ARM system, the Hilbert transform can be easily implemented with the help of FFT. Therefore, this paper uses the Hilbert transform method to extract the envelope of the signal.

The specific steps are as follows:

(1) Perform FFT on x(t) to obtain X(k), where k = 0, 1, 2, -, N - 1. Note that k = N 2, -, N - 1 corresponds to negative frequencies;

(2) The value of Z(k):

(3) Perform inverse FFT on Z(k) to obtain the analytical signal z(n) of x(n);

(4)| z(n)| is the envelope of x(n).

Through the above analysis and programming, the envelope demodulation of the signal is realized.

FIG6 shows a modulated waveform, and envelope analysis is performed on it, and the result is shown in FIG7 .

4 Screen flickering phenomenon and its solution

In the programs written based on MFC in VC, window movement, scaling, mouse clicks and other operations will cause the window to be redrawn. This application uses drawing methods to output collected data, signal waveforms, spectrum diagrams, etc. The drawing is relatively complex and consumes more CPU time. Therefore, frequent redrawing will cause the screen to flicker and affect the dynamic display and analysis of the signal. For this reason, double buffering technology is used here to solve the screen flicker problem.

Double buffering technology is to prepare an area in the memory first, load the bitmap to be displayed into the memory, and then call the BitBlt function to copy the memory device to the display device. This process is relatively simple, that is, each pixel of the image is copied to the output device once, which does not take too much time, thus preventing screen flickering and improving display effects.

The main code for double buffer drawing is as follows:

5 System Test Analysis

To verify the correctness and reliability of the system, the following signals are generated:

Take the analysis length (time block) T = 10 s. It can be seen from the formula that there are four frequency components, namely 1 Hz, 6 Hz, 9 Hz, and 20 Hz. Take the sampling interval as 0.01 s, and draw its time domain waveform and spectrum as shown in Figure 8 and Figure 9 respectively.

Through the FFT data, it is found that the spectrum amplitude at each frequency point (not marked in the figure) is 500, 1 000, 1 000, and 500, respectively. After calculation, it is consistent with the signal amplitude in the time domain being 1, 2, 2, and 1, respectively. In addition, through FFT, four frequency components in the original signal are successfully separated: 1 Hz, 6 Hz, 9 Hz, and 20 Hz, which also verifies the frequency resolution capability of the FFT algorithm.

6 Conclusion

In view of the current status of dynamic signal test and analysis systems, this paper proposes a design scheme for a dynamic signal analysis system based on VC++, using Windows XP system as the development platform, object-oriented programming technology and VC++ as the development tool. The scheme can realize the real-time synchronous acquisition of single and multiple signals, analyze and process the signals, and realize the segmented storage of data and the playback and viewing of waveforms. Through experimental tests, the developed system can meet various analysis requirements in the test, verifying the reliability and practicality of this scheme.

Keywords:VC++ Reference address:Design of Dynamic Signal Analysis System Based on VC++

Previous article:Research on real-time drawing of high sampling rate dynamic signals based on C++ builder
Next article:Design of Beidou terminal communication module based on Bluetooth technology

Recommended ReadingLatest update time:2024-11-16 16:02

Parallel boot solution for dual-core DSP chip TMS320VC5421
  1 Introduction   TMS320VC5421  1, 2  (hereinafter referred to as VC5421) is a dual-core fixed-point DSP chip launched by TI. It has two DSP subsystems, each subsystem has a DSP core, and has independent data and program storage space. , communication between the two cores can be carried out, and the two subsyste
[Embedded]
Latest Power Management Articles
Change More Related Popular Components

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号