This application is based on and incorporates herein by reference Japanese Patent Application No. 2004-056641 filed on Mar. 1, 2004.
1. Field of Application
The present invention relates to a digital filter that performs filter calculations (specifically, convolution calculations) whereby each of respective data values that are successively acquired at fixed periodic intervals is multiplied by a corresponding filter coefficient, with the resultant products being summed.
A digital filter according to the present invention can for example be used in conjunction with an engine ECU (electronic control unit) for processing of frequencies of vibration of a vehicle engine, to detect any occurrence of engine knock.
2. Description of Prior Art
FIR (Finite Impulse Response) filters are widely used in such a type of filter processing application. A FIR filter can be implemented by storing each of respective data values (where the term “data value” is used herein to refer to a datum expressed as a digital value) successively acquired at fixed periodic intervals, in a storage device such as a RAM (Random Access Memory), with the data values being stored one at a time in respective storage locations of the storage device such that when a most recently acquired data value is stored, it replaces the oldest stored data value. In that way it is ensured that a set of data values, consisting of a fixed number of values, are held in respective storage locations, with these data values extending from the most recently stored value to the oldest stored value.
With such a method of sequentially storing data, when the amount of filter calculation processing that must be executed becomes large, the amount of data used in the calculations also becomes large, and in addition the amount of data that must be moved (in the process of performing the filter calculations) becomes accordingly large. Hence a substantial increase in processing load occurs as a result of processing that must be performed for transferring data.
If a ring buffer (i.e., circular buffer) configuration is used for storing the inputted data values that are used in the filter calculations, then it is only necessary to replace the oldest data value by the newest data value, without changing the storage locations of the remaining data values. However in that case, in order to establish a requisite corresponding between the stored data values and the respective filter coefficients, it is necessary to rearrange the data values in order of their input sequence (i.e., time axis sequence), with the rearranged data being stored in another buffer. Hence it becomes necessary to provide additional data storage capacity for the rearranged data, and in addition the processing load is increased by the need to perform the rearrangement operations.
Furthermore when such a ring buffer arrangement is used, it is possible to use relative addresses for specifying the addresses from which data values are to be read out from the ring buffer, while establishing the requisite correspondence between the data values and the filter coefficients. However in that case, each time a data value is read out, it is necessary to judge whether or not the address from which that data value is read out is the final address of the ring buffer, and if so, to set the address which immediately follows the final address as being the leading address. Hence, the calculation processing load is increased by the need to perform such judgement and setting processing operations.
A digital filter designed to overcome the above problems has been previously proposed by the assignee of the present invention, in Japanese patent laid-open No. 2003-87098, referred to in the following as reference document 1. With the digital filter of reference document 1, 2N storage locations are provided, i.e., capable of storing respective ones of 2N data values (where the number of data values required to perform a filter calculation is N). When the most recent data value (i.e., obtained by D/A conversion) is acquired, that data value is stored concurrently in two storage locations that are disposed N locations apart from one another. The storage location for the most recent data value is incremented by one each time that such a storage operation is performed. When a condition has been reached whereby one of the two storage location of a data value has become the final one of the 2N storage locations, then the pair of storage destinations for the newest input data value are reset to become the leading one of the 2N storage locations, and a storage location that is separated by N locations from the leading storage location, respectively.
The terms “leading storage location” and “final storage location” of a continuous sequence of storage locations, as used herein, can for example correspond to the lowest-numbered and the highest-numbered ones of a continuous sequence of memory addresses, that can be consecutively selected by successively incrementing an index pointer (i.e., address pointer).
With such a method of storing data, whereby each of the N data values used in a filter calculation is stored in two different storage locations, the data are stored in a continuous sequence of storage locations. Hence, as data values are read out, it is only necessary to continuously update the addresses, without the need for judging whether or not a final address has been reached. Thus, the calculation processing load can be reduced, and the speed of filter calculation processing can be increased.
However with such a form of digital filter, it is necessary to store each newest data value concurrently in two different storage locations. Hence, the processing time required to execute a convolution calculation, as a filter processing operation, becomes increased. It would therefore be desirable to provide a digital filter which provides not only a reduction of the processing load that results from performing such a calculation, but also enables a reduction in the time required to execute each calculation.
It is an objective of the present invention to overcome the above problems of the prior art by providing an improved digital filter whereby the processing load and the time required to perform filter processing operations can be reduced.
To achieve the above objective, the invention provides a digital filter for operating on each of successive sets of N data values where N is a plural integer, to perform a filter processing operation that includes multiplying each of the N data values by a corresponding one of a set of N filter coefficient, with each of the successive sets being formed by updating to replace an oldest data value of the set by a newly acquired data value, with the digital filter including:
In executing a convolution calculation, the N filter coefficients are read out in succession from consecutive locations of the filter coefficient storage means, commencing from the storage location that is designated by the index means. As each filter coefficient is read out, it is used to multiply the corresponding one of the data values, read out from the data storage means.
The advantages of this are as follows. Firstly, it is only necessary to provide data storage means for storing the most recently acquired N data values. Secondly, it is not necessary to perform processing to judge the storage locations from which the filter coefficients are successively read out (i.e., to determine when it is necessary to jump to a non-consecutive storage location in the filter coefficient storage means). Instead, it is only necessary to successively select N consecutive storage locations in the filter coefficient storage means, during a filter calculation operation. Thus, the processing is substantially simplified by comparison with the prior art. This is due to the fact that, when a convolution calculation is started, then irrespective of the particular storage location that is designated by the index means as corresponding to the data value stored in the leading storage location of the data storage means, an appropriate set of N successive locations in the filter coefficient storage means can be consecutively selected for readout of respective filter coefficients, without the possibility of reaching the end of the aforementioned single continuous sequence of storage locations.
Moreover, control of the index means can be simple. Specifically, the location in the filter coefficient storage means that is indicated by the index means is shifted by one storage location position, along the same shift direction, each time a new data value is written into the data storage means.
Referring again to
The sensor selector 10, preamplifier 20 and LPF 30 are constituted as respective analog circuits, disposed external to an ECU 40 that is described in the following.
The high-frequency components of the amplified knock signal that are extracted by the LPF 30 are inputted to an A/D converter 50 in the ECU 40. The ECU 40 further includes a digital filter section 60 and a knock judgement section 70 as shown. The A/D converter 50 converts the input signal from the LPF 30 from analog to digital signal form, by periodically sampling that input signal and converting the samples to respective (digital) data values. The resultant sequence of data values are inputted to the digital filter section 60, which performs digital BPF (bandpass filter) processing of these to extract signal components that are within specific frequency bands. In this embodiment, it is assumed that these frequency bands are respectively centered on 5.6 kHz, 7.7 kHz and 11.5 kHz, with each having a predetermined bandwidth.
Thus, the digital filter section 60 of this embodiment performs filter processing that is equivalent to applying three BPFs 60a, 60b and 60c, as shown conceptually shown in
The knock judgement section 70 judges whether engine knock is occurring, based upon the signal components in the respective frequency bands that have been processed by the digital filter section 60. For example, a decision can be made as to the occurrence of engine knock by judging the degree of pattern matching between the signal components in the respective frequency bands and a set of characteristic patterns that respectively correspond to these frequency bands and that are indicative of occurrence of engine knock. An example of such a set of characteristic patterns is shown in
By performing frequency analysis of the knock signals using digital filtering as described above, the accuracy of judging the occurrence of engine knock can be substantially enhanced, with that accuracy being less affected by noise than would be the case if analog filtering were to be employed.
Although not shown in the drawings, the ECU 40 has a function of appropriately adjusting the ignition timing of the vehicle engine operation (specifically, the ignition timing delay angle), when it is detected that engine knock is occurring.
It can thus be understood that with this embodiment, the ECU 40 that performs engine control is also configured to perform digital signal processing. However if the ECU 40 were to be configured to implement a conventional type of digital filter for performing such frequency analysis processing, then the manufacturing cost of the ECU 40 would become excessive, making it impractical to utilize such an engine ECU. Even if a dedicated ECU were to be employed to perform such frequency analysis processing for knock detection (i.e., separate from the engine ECU), it would be difficult to achieve satisfactory operating by using a conventional type of digital filter configuration, due to large amounts of processing delay that would occur.
The greatest source of processing load that is imposed by frequency analysis processing using a digital filter is that of convolution calculations, described hereinafter. The present invention makes it possible to reduce the amount of processing required to perform such convolution calculations, so that the ECU 40 can perform such processing while also performing engine control functions.
The configuration and operation of the digital filter section 60 of the ECU 40 of this embodiment, whereby the amount of processing required to perform the convolution calculations for digital filter processing can be reduced, will be described in the following.
Successive changes in the storage location of the data buffer 62 into which a most recently acquired data value is written will be described in the following, referring to
As a result, the next most recently acquired data value (DataN+1) is written into the leading storage location, replacing the oldest data value (Data1), as shown in
By using the buffer pointer DataPos in that way to designate successive storage locations of the data buffer 62, the destination storage location for the most recently acquired data value is successively returned from the final storage location to the leading storage location. In addition, it is ensured that the data buffer 62 always holds a set of N data values that extend from the most recently acquired data value to an oldest acquired data value.
Each time that write-in of a most recently acquired data value has been completed, the N data values that are currently held in the data buffer 62 are then successively read out while at the same time the filter coefficients respectively corresponding to these data values are successively read out from the filter coefficient storage section 64, and a convolution calculation is performed by the calculation section 66, utilizing the read-out data values and filter coefficients. The result is stored in the filter result buffer 68, to be supplied to the knock judgement section 70.
The above operations are performed respectively separately for each of the plurality of frequency bands that are to be selected, and respectively separate sets of filter coefficients are held in the filter coefficient storage section 64, corresponding to the different frequency bands. To perform a convolution calculation for a specific frequency band (i.e., to implement the function of a specific one of the BPFs 60a, 60b, 60c), the corresponding set of filter coefficients are read out from the filter coefficient storage section 64, and used in conjunction with the N data values that are read out from the data buffer 62 as described above, to obtain a filter result value that is then registered in the filter result buffer 68.
A simple description of the convolution calculation will be given referring to
With this embodiment as shown in
Specifically, by using a convolution start pointer FilPos as shown in
That is to say, when a filter coefficient is read out, it is not necessary to judge whether the final storage location of the filter coefficient storage section 64 has been reached, and it is only necessary to update the storage location indicated by the convolution start pointer FilPos (i.e., by incrementing the pointer value by 1). In that way, the filter coefficients can be successively read out from the filter coefficient storage section 64 together with successive read-out of the corresponding data values from the data buffer 62.
With the example shown in
The above description of utilizing the convolution start pointer FilPos has been given on the assumption that the leading filter coefficient of the No. 1 set of coefficients is omitted. However it would be equally possible to instead omit the final filter coefficient of the No. 2 set of filter coefficients. This will be made clear by the following description of the operation example of
Next, as shown in
With this example, when the next data value (Data7) has been inputted from the A/D converter 50, the value of FilPos is shifted to designate the leading storage location of set No. 1 of the stored filter coefficients. It will be understood that if this method is applied, then it is not actually necessary to store the final filter coefficient (FilterData4) of set No. 2 of the filter coefficients held in the filter coefficient storage section 64, i.e., the total number of stored filter coefficients can be (2N−1).
An alternative example is shown in
As can be understood from the above description, when performing a filter calculation (convolution) operation, the N data values currently held in the data buffer 62 can be respectively read out at the same timings as the corresponding ones of the N filter coefficients are read out from the filter coefficient storage section 64, simply by reading out these data values and filter coefficients from successive ones of a continuous sequence of storage locations (e.g., successively increasing memory address values), with no processing being required to judge whether a jump to a non-consecutive storage location is required, and for calculating the address of such a new storage location. This is achieved by ensuring that, prior to the commencement of a convolution calculation, the convolution start pointer FilPos designates the initial location of a continuous sequence of storage locations in the filter coefficient storage section 64 from which an appropriate set of N filter coefficients will be successively read out for use in the calculation.
Hence, the amount of processing required for read out of data and filter coefficients is greatly reduced by comparison with the prior art.
In addition, the invention has the advantage that it is only necessary to store the N most recently acquired data values, i.e., it is not necessary to store any data values concurrently in two different storage locations, as is necessary with the prior art. Hence by comparison with a prior art type of digital filter, the storage capacity requirements and the amount of processing required to execute a filter calculation are further reduced.
With the example of
A specific example of this filter processing will be described in the following, that is applicable to the input data value storage and filter coefficient storage configurations of
When power is applied to the ECU 40, then as shown in
Next in step S20 the buffer pointer DataPos is set to 1, to designate the destination storage location for the first data value that will be inputted from the A/D converter 50. As a result, the leading storage location in the data buffer 62 is designated as that destination storage location. In step S30, a storage position pointer StorePos (which indicates a storage location in the filter result buffer 68 in which the filter calculation result will be registered) is set to 1. In that way, the leading storage location in the filter result buffer 68 is specified as being the destination for registering the first filter coefficient result.
The overall flow of processing for inputting A/D converted data values from the A/D converter 50 will be described referring to
The processing executed in steps S120 to S140 serves to alter the value of the buffer pointer DataPos such as to designate the appropriate storage location for the next A/D converted value that will be supplied from the A/D converter 50. As a result of successive executions of that processing, the value of the buffer pointer DataPos successively increases from 1 to DATA_MAX, and is reset to 1 each time that DATA_MAX has been reached.
When an A/D converted value acquisition operation has been completed, operation proceeds to step 200 shown in
Firstly in step S210 of
In that step S240, using the variable “i”, the A/D converted values Data[i] are successively read out starting from the leading storage location of the data buffer 62, up to the final storage location. In addition, using the variable “i” and the convolution start pointer FilPos, the filter coefficients Fil[i−1+FilPos] respectively corresponding to the data values Data[i] are read out from the filter coefficient storage section 64, with each data value being multiplied by the corresponding filter coefficient. Each multiplication result thereby obtained is added to the filter result value FilResult.
In step S250, the variable “i” is incremented, and operation returns to step S230. In that way, by successive repetitions of the processing of steps S250 to S250 until the value of the variable “i” reaches DATA_MAX, a convolution calculation using all of the N data values held in the data buffer 62 is completed. When there is a NO decision in step S230, the processing of
On completion of such a filter calculation operation, an updated value for the convolution start pointer FilPos is calculated in step S300 of
In that way, after N A/D converted values have been stored in the data buffer 62, then thereafter each time a new A/D converted value is inputted from the A/D converter 50, the value of the convolution start pointer FilPos will be decremented by 1, starting from an initial value of DATA_MAX. It is thereby ensured that each filter coefficient storage location that is indicated by the convolution start pointer FilPos will always correspond to the correct one of the storage locations of the data buffer 62.
When the calculation processing of the convolution start pointer FilPos has been completed, then in step S400 of
Firstly in step S410, a decision is made as to whether the aforementioned storage position pointer StorePos is smaller than a max value STOREMAX, which is a maximum number of convolution calculation results that can be stored. If there is a YES decision in step S410, operation proceeds to step S420, in which the storage position pointer StorePos is incremented by 1. However if StorePos has reached the maximum value STOREMAX, so that there is a NO decision, then operation proceeds to step S430 in which StorePos is set to 1.
Following either of steps S420 or S430, step S440 is then executed, in which the filter result value FilResult is stored in the location Result[StorePos] designated by the storage position pointer StorePos, whose value has been established as described above. In that way a filter processing result, constituting part of the digital filter processing results illustrated in
It should be noted that the invention is not limited to the preferred embodiment described above, and various modifications could be envisaged. For example with the above embodiment, when (2N−1) filter coefficients are stored as two sets of filter coefficients (as shown in
Furthermore although with the above embodiment, (2N−1) filter coefficients are stored and utilized, it would be equally possible to use a greater number of filter coefficients, e.g., 2N filter coefficients. If that is done, then the aforementioned No. 1 and No. 2 sets of filter coefficients would be stored without omitting the leading filter coefficient or the final filter coefficient from either of these sets. The essential point is that it must be possible to successively read out the N filter coefficients from a continuous sequence of storage locations, while performing a convolution calculation, so that it is unnecessary to perform any processing relating to judging whether a final one of a sequence of filter coefficient storage locations has been reached and to perform any processing that might be required by the result of such judgement. Thus, each convolution calculation can be performed with a minimum of processing load being imposed on the ECU, and in addition can be rapidly performed.
With the above embodiment, the convolution start pointer FilPos is used to determine the initial location from which to read out a filter coefficient from a set of (2N−1) filter coefficient storage locations. However it would be equally possible to determine the initial location from which a filter coefficient is to be read out by referring to the buffer pointer DataPos of the data buffer 62.
It should thus be understood that although the invention has been described above referring to a specific embodiment, various modifications could be envisaged that fall within the scope claimed for the invention.
Number | Date | Country | Kind |
---|---|---|---|
2004-56641 | Mar 2004 | JP | national |