Keywords

1 Introduction

Mathematical morphology has always been applied to digital image processing technology since it was proposed, and now in various aspects like language, electric power, ecg and eeg signals has applied successfully. Mathematical morphology in one-dimensional mechanical vibration signal is at the beginning stage. In recent years, mathematical morphology has got more and more research results in mechanical fault diagnosis of vibration signal processing. An Liansuo proposed on - off and closed - composite morphological filter which is used for the purification of rotor axis trajectory [1]. Zhang Lijun used form closed operation method to extract the impact of the gear fault feature [2]. Hu Aijun used combinatorial mathematics morphology filter to reduce the rotating machinery vibration signal noise [3]. Du Biqiang used morphology filter(MF) to process rotating machinery vibration signal [4]. Zhang Wenbin used adaptive morphological filtering method to purify the rotor axis trajectory [5]. Shen Lu used generalized morphological filter to reduce rotating machinery vibration signal noise. But, MF technology applied in diesel engine vibration signal is relatively rare. At present, the morphology applied in the vibration signal of engine has obtained certain research results [7, 8]. This paper, according to the characteristics of the diesel engine vibration signal, has explored the application of morphology in the diesel engine vibration signal de-noising.

2 Basic Principle of Mathematical Morphology Filter

Mathematical morphology abandons the traditional view of numerical modeling, and uses the collection to depict and analyze the object, and uses probe (structural elements) to detect the target signal of each location, so as to obtain the geometry information and the relationship between them. This method does not need to analyze the signal frequency domain information, and its algorithm is simple with fast computing speed. The collected mechanical vibration signals in the experiments is generally a one-dimensional discrete time sequence, gray value is done in the morphological transform. Common morphological operators are corrosion, expansion, opening operation and closing operation and cascade combination between them. \( F = (0,1, \cdots, N - 1) \) whose discrete function is a vibration signal f(n), \( G = (0,1, \cdots ,M - 1) \) whose discrete function is structural elements g(n), N ≫ M. f(n) and g(n) whose corrosion and expansion operations are respectively defined as:

$$ (f\Theta g)(n) = \hbox{min} [f(n + m) - g(m)] $$
(1)
$$ (f \oplus g)(n) = \hbox{max} [f(n - m) + g(m)] $$
(2)

By (1) and (2) can lead to morphological open operation and closing operation, whose mathematical expressions are respectively defined as:

$$ (f \circ g)(n) = (f\Theta g \oplus g)(n) $$
(3)
$$ (f \bullet g)(n) = (f \oplus g\Theta g)(n) $$
(4)

From (1) to (4), min is minimum operation, max is maximum operation, Θ is corrosion operation, ⊕ is Expansion operation, ○ is open operation, ● is close operation. Based on morphological open operation and close operation can also build three types of filter: alternately filter, hybrid filter and alternating hybrid filter [9].

Alternate filter has two kinds, form on-off and form off-on, whose mathematical expressions are respectively as follows:

$$ [(f)oc(g)](n) = (f \circ g \bullet g)(n) $$
(5)
$$ [(f)co(g)](n) = (f \bullet g \circ g)(n) $$
(6)

Hybrid filter is the arithmetic average of open operation and close operation, whose formula is defined as follows:

$$ [(f)hf(g)](n) = (f \circ g + f \bullet g)(n)/2 $$
(7)

Alternating hybrid filter its formula is defined as follows:

$$ [(f)ah(g)](n) = [(f)oc(g) + (f)co(g)](n)/2 $$
(8)

Form (5) to (8), oc is the form on-off alternate filtering operation, co is the form off-on alternate filtering operation, hf is the hybrid filter operation, ah is the alternating hybrid filter operation.

3 Choice of Structural Elements

Structural elements are the most important factors that influence the effect of morphological filtering. Structural elements in morphological transform is similar to a filter window or referential template. Three elements of the structural elements: shape, width (the width of the domain of definition) and height (amplitude). When the selected structural elements and the processing signals match well, the morphological filtering performs well.

3.1 Shape of Structural Elements

In the morphological transform, there are many kinds of types of structural elements. Common type of structural elements: flat shape (straight), triangle (upper triangle or lower triangle), sinusoid, semicircle (the upper half of circle or the lower half of circle) and so on. In general, the selection of structural elements is made according to the characteristics of the signal. Relevant researches showed that in the procedure of vibration signal de-noising, structural elements of the flat shape (straight), semicircle and triangle type can obtain good filtering effects. Flat-shape-type structural element can hold the shape characteristics of the signal, semicircle-type structural element makes for reducing the interference of random noise, and triangle-type structural element has a good effect when processing the interference of pulse signal. There are some random noise when diesel engine running. According to the characteristics of the signal, semicircle-type structural elements is selected in this paper, of which formula is as shown in (9).

$$ g(i) = H \times \sqrt {1 - (\frac{2i}{L - 1})^{2} } \mathop {}\nolimits^{{}} ,(i = - \frac{L - 1}{2}, \cdots ,\frac{L - 1}{2}) $$
(9)

The width of the structural elements L takes for odd number commonly, as the peak of such structural elements can be located at the origin. H is the height of the structural elements.

3.2 Width of Structural Elements

The vibration signal of the diesel engine \( X = \{ x_{i} /i = 1,2, \ldots ,N\} \), in which N is the amount of data of the original signal. Remove the trend item of original signals, and pre-process by low-pass filter and calculate the local maximum value and the local minimum value of the signal sequence. The local maximum value sequence is denoted as \( PE = \left\{ {x_{i} |i = 1, 2, \ldots ,N_{PE} } \right\} \), and the local minimum value sequence is denoted as \( NE = \left\{ {x_{i} |i = 1, 2, \ldots ,N_{NE} } \right\} \), in which N PE and N NE is the number of local maximum and small values respectively. Let the interval of the local maximum value \( D_{p} = \left\{ {d_{p} |d_{pi} = PE_{i + 1} {-}PE_{i} ,i = 1, 2, \ldots ,N_{PE} {-} 1} \right\} \), and the interval of the local minimum value \( D_{N} = \left\{ {d_{N} |d_{Ni} = NE_{i + 1} {-}NE_{i} ,i = 1, 2, \ldots ,N_{NE} {-} 1} \right\} \). According to the maximum interval and minimum interval of the elements, the maximum and minimum values of the width of the structural elements can be calculated:

$$ \begin{aligned} K_{l\hbox{max} } & = \hbox{max} (\left\lfloor {\hbox{max} (d_{Pi} ) - 1)/2} \right\rfloor ,\left\lfloor {\hbox{max} (d_{Ni} ) - 1)/2} \right\rfloor ) \\ K_{l\hbox{min} } & = \hbox{min} (\left\lceil {\hbox{min} (d_{Pi} ) - 1)/2} \right\rceil ,\left\lceil {\hbox{min} (d_{Ni} ) - 1)/2} \right\rceil ). \\ \end{aligned} $$

In the formula, \( \left\lfloor \bullet \right\rfloor ,\left\lceil \bullet \right\rceil \) is the operation of rounding down and rounding up respectively.

Then, the sequence of the width of structure elements is:

$$ K_{l} = \left\{ {K_{l\hbox{min} } ,K_{l\hbox{min} } + 1, \cdots ,K_{l\hbox{max} } - 1,K_{l\hbox{max} } } \right\} $$

The scale sequence of the width of the structural elements in the upper formula can be used to local feature of the signal, thus avoiding the blindness and the uncertainty in the selection of the width of the structure elements.

3.3 Height of Structural Elements

In general, the structural elements of the height can be selected according to the experience, it is appropriate that in the vibration signal the height takes usually 1 %–5 % of the height of the original signal (profile of main wave), but such a value is with a certain blindness in experience. Then, the local maximum and local minimum of the signal is defined, and can be used to determine the height of the structural element. Set the maximum value and minimum value of amplitudes of the local maximum value sequence for P Pmax, P Pmin, and similarly the maximum value and minimum value of amplitudes of local minimum value sequence for P Nmax, P Nmin. The difference in height between local maximum and local minimum of the signal \( H_{Pe} = P_{{P{ \hbox{max} }}} {-}P_{{P{ \hbox{min} }}} ,H_{Ne} = P_{{N{ \hbox{max} }}} {-}P_{{N{ \hbox{min} }}} \), the amplitude of local extremum of the signal H e  = max (H Pe , H Ne ). Let the height sequence of the structural elements H l and the width of the scale K l correspond, and define the height sequence H l as:

$$ \begin{aligned} H_{l} & = \left\{ {\alpha [H_{e} /(K_{l\hbox{max} } - K_{l\hbox{min} } + 1) + (j - 1)H_{e} /(K_{l\hbox{max} } - K_{l\hbox{min} } + 1)]} \right\} \\ j & = 1,2, \cdots ,K_{l\hbox{max} } - K_{l\hbox{min} } + 1 \\ \end{aligned} $$
(10)

In the formula, α is a high proportion factor, generally can be based on practical experience value.

4 Design of Generalized Morphological Filter

Corrosion arithmetic eliminates the positive pulse and enhances the negative pulse; expansion operation eliminates the negative pulse and enhances positive pulse; open operation eliminates the positive pulse and reserves the negative pulse; close operation eliminates the negative pulse but reserves the positive pulse. Form closed operation has extensibility, while form open operation has the contrary extensibility. In addition to eliminate the negative pulse at the same time also strength the positive pulse, the open operation cannot effectively filter all of the positive pulse, nor can form on-off operation efficiently filter out all the negative pulse. Therefore, the traditional morphological filters can’t completely filter out noise. With the lack of a priory knowledge of signal, so it is difficult to obtain the signal characteristics. Diesel engine contains a variety of noise signal, the distribution of noise in the signal is often uneven. Therefore, in order to overcome this shortcoming here uses the different scales of structural elements of the diesel engine signal composite filtering. Through the signal of local maximum value and the local minimum value, it determines the scope of the structural elements of the width and height, according to the characteristics of the signal itself to select structure element. Then, construct three kinds of generalized morphological filter (GMF).

  1. (a)

    Morphological corrosion and inflation mean filter:

    $$ G_{1} (f) = \frac{1}{4}(f\Theta g_{1} + f \oplus g_{1} + f\Theta g_{2} + f \oplus g_{2} )(n) $$
    (11)
  2. (b)

    Morphology and closed mean filter:

    $$ G_{2} (f) = \frac{1}{2}(f\Theta g_{1} \oplus g_{2} + f \oplus g_{1}\Theta g_{2} )(n) $$
    (12)
  3. (c)

    Morphological on-off and off-on mean filter:

    $$ G_{3} (f) = \frac{1}{2}(f \circ g_{1} \bullet g_{2} + f \bullet g_{1} \circ g_{2} )(n) $$
    (13)

Above the formulas, f(n) is the input of discrete signal, G1, G2 whose structural element functions respectively are \( g1,g2,g1 \subseteq g2,G_{1} \subseteq G_{2} . \)

This paper applies adaptive generalized morphological filter method to the noise reduction of diesel engine vibration signal. First, preprocess the diesel engine vibration signal. Diesel engine R6105AZLD with speed of 1200 r/min, in normal working condition of a cycle of the vibration signal is analyzed. For four-stroke diesel engine, the crankshaft turns two laps for each cycle; the sampling frequency is 48 kHz, a period of time is T = 2 × 60/1200 = 0.1 s, each cycle analysis points reach to 4800 points. Eliminate trend item by the least squares method, and then filter part of the high frequency signal through a low-pass filter so as to preprocess the original signal.

The maximum interval and minimum interval of local maximum value and the local minimum values are as follows:

$$ max\left( {D_{p} } \right) = 19,max\left( {D_{n} } \right) = 26,min\left( {D_{p} } \right) = 2, \, min\left( {D_{n} } \right) = 2 $$

The width of the structural elements for scale sequence is Kl = [1 2 3 4 5 6 7 8 9 10 11 12 13]. The width of structural elements has the largest influence on filtering effect. In this paper, after the normal signal was tested a few times, when the width of the semi-circular structure elements was L1 = 3, L2 = 5, it achieved the best noise reduction effect. At the same time, it calculated the local extreme amplitude of signal is He = 397.1551, spacing is Klmax – Klmin + 1=13.

The height of the structure element has a little influence on the filter effect. It is appropriate to take the vibration signal height from 1 % to 5 %. In this paper, the main outline of the signal is between 50 ~ 150, and its structural elements height generally between 0.57.5 is more appropriate. Therefore, the value of α is general according to the experience. This article α is 0.03, the width of the scale sequence for the corresponding height sequence is as follows:

H l  = [0.9165 1.8330 2.7495 3.6660 4.5825 5.4990 6.4155 7.3320 8.2486 9.1651 10.0816 10.9981 11.9146].

The widths of the two structural elements are L1 = 3, L2 = 5, corresponding heights are H1 = 2.75, H2 = 4.58.

The above three kinds of average filter in signal de-noising effect evaluation index [10] are shown in Table 1. The signal-to-noise ratio (SNR) formula and root mean square error (RMSE) formula are as follows:

$$ SNR = 10\log \frac{{\frac{1}{N}\sum\limits_{k = 1}^{N} {x^{2} (k)} }}{{\frac{1}{N}\sum\limits_{k = 1}^{N} {[x(k) - y(k)]^{2} } }} $$
(14)
$$ RMSE = \sqrt {\frac{1}{N}\sum\limits_{k = 1}^{N} {[x(k) - y(k)]^{2} } } $$
(15)
Table 1. Noise reduction effect of three kinds of filter

From Table 1, it can come to a conclusion that open and close mean filter has the best de-noise effect, whose signal-to-noise ratio is maximum and root mean square error is minimal. So this paper chosen open and close mean filter.

Because it is the mean filter, its weight coefficient as a fixed value 0.5; if such weight in the process of filter coefficient remain fixed, it will make filtering is not adaptive to achieve the best effect. In order to make the filter to achieve the optimal effect, this article used the Gradient method [11] (Gradient) to determine the optimal weight value.

The actual input of the original signal is x(n) = s(n) + i(n), (n = 0,1, …, N − 1), in which s(n) is the ideal signal, i(n) is the noise signal. e(n) is the error signal, which is the ideal signal minuses the output signal of filter, namely e(n) = s(n)−y(n). The formulas of the generalized morphological opening and closing are as follows:

$$ y_{1} (n) = G_{o} = (x\Theta g_{1} \oplus g_{2} )(n) $$
(16)
$$ y_{2} (n) = G_{c} = (x \oplus g_{1}\Theta g_{2} )(n) $$
(17)

So the output signal of filter is:

$$ y(n) = a_{1} (n)y_{1} (n) + a_{2} (n)y_{2} (n) = \sum\limits_{i = 1}^{2} {a_{i} (n)y_{i} (n)} $$
(18)

Mean square error of the output signal is:

$$ E[e^{2} (n)] = E[\left| {s(n) - y(n)} \right|^{2} ] = E\left[ {\left| {s(n) - \sum\limits_{i = 1}^{2} {a_{i} (n)y_{i} (n)} } \right|^{2} } \right] $$
(19)

Here by gradient method to gradually modified weight coefficient, it makes the output signal in the minimum mean square error (LMS) condition so as to reach the ideal signal. Here takes a single sample error square of e 2 (n) to estimate the mean square error E[e 2 (n)], e 2 (n) to the weight coefficient of the gradient is defined as:

$$ \nabla e^{2} (n) = \left[ {\frac{{\partial [e^{2} (n)]}}{{\partial a_{1} (n)}}\mathop {}\limits^{{}} \frac{{\partial [e^{2} (n)]}}{{\partial a_{2} (n)}}} \right]^{T} = [T_{1} \mathop {}\limits^{{}} T_{2} ]^{T} $$
(20)

Based on the gradient method of adaptive morphological filtering iterative calculation process is as follows:

  1. (a)

    To process the original signal by generalized morphological opened and generalized morphological closing operation, it will get y 1 (n) and y 2 (n), after calculated by k times, the k iteration filter output is:

    $$ y^{k} (n) = a_{1}^{k} (n)y_{1} (n) + a_{2}^{k} (n)y_{2} (n) = \sum\limits_{i = 1}^{2} {a_{i}^{k} (n)y_{i} (n)} $$
    (21)

In which \( a_{i}^{k} (i = 1,2) \) is the weight coefficient of k iteration

  1. (b)

    A single sample of error is:

    $$ [e(n)]^{k} = y^{k - 1} (n) - y^{k} (n) $$
    (22)

Here \( y^{k - 1} (n) \) replaces s(n), so the gradient is:

$$ \left[ {\nabla e^{2} (n)} \right]^{k} = = [T_{1}^{k} \mathop {}\limits^{{}} T_{2}^{k} ]^{T} $$
(23)
  1. (c)

    Direction vector and weight are as follows:

    $$ p^{k} = [\begin{array}{*{20}c} {p_{1}^{k} } & {p_{2}^{k} } \\ \end{array} ]^{T} $$
    (24)
    $$ p_{i}^{k} =-T_{i}^{k} + \beta_{i}^{k} p_{i}^{k - 1} $$
    (25)

\( p_{i}^{k} \) is the ith component of direction vector of the k iteration, i = 1, 2.

  1. (d)

    The coefficient is:

    $$ \beta_{i}^{k} = \frac{{\left( {T_{i}^{k} } \right)^{T} T_{i}^{k} }}{{\left( {T_{i}^{k - 1} } \right)^{T} T_{i}^{k - 1} }} $$
    (26)

Weight coefficient is:

$$ a_{i}^{k + 1} = a_{i}^{k} + \mu p_{i}^{k} $$
(27)

In the formula, if μ, the step length is too large, it will cause a oscillation during the convergence then lead to instabilities of the system; and if μ is too small, the convergence rate of the system is affected. In this paper, μ is set to 0.05 through tests.

\( k\;(k=0, 1, 2, \cdots) \) is the number of iterations. Initial weight coefficient a i  = 0.5. Set \( \beta_{i}^{0} = 0 \), then \( p_{i}^{0} = - T_{i}^{0} \mathop {}\nolimits_{{}} (i = 1,2) \). In the first round of iteration, set [e(n)]0 = x(n) − y0(n). Use formula (21) to (27) to adaptive correct weight coefficient. The schematic diagram of adaptive generalized morphological filter based on gradient method is shown in Fig. 1.

Fig. 1.
figure 1

Schematic diagram of adaptive generalized morphological filter based on gradient method

Adaptive adjust weight according to gradient method, when a1 = 0.5110 a2 = 0.489 is obtained, the minimum mean square error (MSE) is 154.40. The relationship between the weights A1 and the mean square error is shown in Fig. 2. Time domain diagram of adaptive morphological filtering in normal condition is shown in Fig. 3.

Fig. 2.
figure 2

Relationship between the weights A1 and MSE

Fig. 3.
figure 3

Time domain diagram of adaptive MF in normal condition

In order to demonstrate the effect of adaptive morphological noise reduction, the wavelet de-noising is used in this paper to conduct a comparison. First, wavelet threshold function wbmpen is used to obtain adaptive threshold; then wavelet threshold de-noising function wdencmp is used to de-noise the pre-processed signal, in which the wavelet base is ‘DB2’, and 5 layer decomposition. The wavelet de-noising time-domain diagram in normal working condition is as shown in Fig. 4.

Fig. 4.
figure 4

Wavelet de-noising time-domain diagram in normal working condition

The comparison of the wavelet de-noising, morphological opening and closing mean filtering and adaptive morphological filtering is as shown in Table 2.

Table 2. Comparison of evaluation index of noise reduction method

In Table 2, it is shown that compared to the wavelet de-noising, the adaptive generalized morphological filtering has a larger SNR and the smaller mean square error after the noise reduction of the signal, indicating that the semi circular structural element can effectively filter random noise interference, and morphological filtering technology can effectively utilize to diesel engine vibration signal processing; the signal to noise ratio after adaptive adjustment of the weights is slightly larger than that of mean filtering, and the root mean square error is slightly smaller, indicating that the adaption is adjusted to the best filtering effect.

5 Conclusion

  1. (1)

    The corrosion and expansion mean filter, the opening and closing mean filter, and the open-close-open mean filter are designed. In contrast, the noise reduction effect of morphological opening and closing mean filter is optimal.

  2. (2)

    In this paper, aiming at diesel engine vibration signal characteristics, a kind of adaptive generalized morphological filter is designed and used to reduce the noise of the diesel engine vibration signal. Compared with the traditional wavelet de-noising, the morphological filters designed in this paper made better noise reduction effect.