CN107425825A - A kind of algorithm for the filtering of vehicle electronics sensor voltage signal - Google Patents

A kind of algorithm for the filtering of vehicle electronics sensor voltage signal Download PDF

Info

Publication number
CN107425825A
CN107425825A CN201710607347.6A CN201710607347A CN107425825A CN 107425825 A CN107425825 A CN 107425825A CN 201710607347 A CN201710607347 A CN 201710607347A CN 107425825 A CN107425825 A CN 107425825A
Authority
CN
China
Prior art keywords
data
array
assigned
equal
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710607347.6A
Other languages
Chinese (zh)
Inventor
夏亚军
林尚栋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wenzhou Changjiang Automobile Electronic System Co Ltd
Original Assignee
Wenzhou Changjiang Automobile Electronic System Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wenzhou Changjiang Automobile Electronic System Co Ltd filed Critical Wenzhou Changjiang Automobile Electronic System Co Ltd
Priority to CN201710607347.6A priority Critical patent/CN107425825A/en
Publication of CN107425825A publication Critical patent/CN107425825A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03HIMPEDANCE NETWORKS, e.g. RESONANT CIRCUITS; RESONATORS
    • H03H17/00Networks using digital techniques
    • H03H17/02Frequency selective networks
    • H03H17/0201Wave digital filters

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Control By Computers (AREA)

Abstract

The present invention relates to a kind of algorithm for the filtering of vehicle electronics sensor voltage signal, including(1)Sensor assembly is initialized, including the initializing of a/d converter driving, the configuration of corresponding I/O port, the definition of array size, array data are initialized as 0xFFFF, module variable initializer show etc., start the data sampling of AD mouths;(2)The periodic duty of sensor assembly is run, the size in general cycle is depending on the factors such as the number of channels, data precision and system resource allocation of sensor.Technical solution of the present invention, the problems such as precision that efficiently solves existing method is low, poor real.

Description

A kind of algorithm for the filtering of vehicle electronics sensor voltage signal
Technical field
The present invention relates to a kind of New Algorithm for being applicable the filtering of vehicle electronics sensor voltage signal, belong to automotive electronics skill Art field, is also applied for EMBEDDED AVIONICS.
Background technology
With the fast development of intelligent automobile electronic technology, use of the various kinds of sensors on automobile is more and more extensive, though Right computing device speed also greatly improves, but number of sensors is also being multiplied, and considers various kinds of sensors signal Comprehensive and relevance so that the factor more and more higher such as real-time and accuracy to various kinds of sensors signal virtual value, just It is required that a set of efficient data processing algorithm.
And currently used sensing data Processing Algorithm is averaged and seeks median scheduling algorithm with bubble sort.
Algorithm comparison of averaging is simple, has exactly gathered the data of corresponding number, and summation is averaged again to draw effectively Value, but if the transient fluctuation of vehicle body voltage signal is very big, averaging, the useful signal value deviation drawn is very big, and accuracy is very It is low.
Bubble sort seeks middle value-based algorithm, and by being ranked up to data, removing the value at both ends, to take median be virtual value, So that effective value precision improves, but bubble sort such as is usually at the data source of the full corresponding number of a/d converter collection, then to data Source is ranked up.And application program is periodically to go to read virtual value, it is difficult to ensure that it is newest that random time point, which reads virtual value, The virtual value that data source is obtained, if the cycle read is less than the cycle for having gathered corresponding data, also result in data sorting mistake The problems such as random, real-time property are very poor.
The conventional algorithm of obvious both the above can not meet the fast development of existing automotive electronics.
The content of the invention
In order to solve the deficiency of available data filtering algorithm, the present invention proposes a kind of vehicle electronics sensor voltage signal The New Algorithm of filtering, with reference to the self-law of Data Stream Processing, by constantly gathering signal and being carried out to data constantly quick Sequence, precision height and the good useful signal value of real-time are drawn, is easy to application layer to judge have to the signal of sensor in time Effect solves the problems such as precision is low, poor real of existing method.
The present invention is that new departure is used by solving its existing algorithmic issue:Provide a kind of vehicle electronics sensor electricity The New Algorithm of signal acquisition filtering is pressed, only the algorithm of a passage is illustrated in this invention, but this invention is also suitable Multiple passages, and be the median after filling up in access group using transient voltage as virtual value before data source fills up array It is for virtual value, the sampling precision positioning 12bit of a/d converter, the data effective range of sampling【0,0xFFF】.It is wherein single logical The data filtering algorithm in road comprises the following steps:
(1)Sensor assembly is initialized, including the initializing of a/d converter driving, the configuration of corresponding I/O port, array are big Small definition, array data are initialized as 0xFFFF, module variable initializer show etc., start the data sampling of AD mouths;
(2)Run the periodic duty of sensor assembly, the size in general cycle according to the number of channels of sensor, data precision and Depending on the factors such as system resource allocation, the cycle of task run is set in the present invention as 5 milliseconds;
(a1)Whether cyclic polling AD samplings convert, if completed, the data being collected are assigned to x1, enter back into step (a2);
(a2)Data to be covered in data source array are assigned to x2, into step(a3);
(a3)X2 position is found in the array that sorts, the data behind x2 sequence numbers are moved along, such x2 is in sequence array In be capped, while last data is arranged to invalid value(0xFFFF), into step(a4);
(a4)In the array that sorts, according to from small to large find the positions to be inserted of x1 in proper order, current location and below Data move a position backward, then x1 is inserted current location, into step(a5);
(a5)X1 is stored in the current location in data source array, while the sequence number in data source adds 1, if sequence number>=maximum Value, sequence number clear 0, into step(a6);
(a6)Judge whether x2 is equal to 0xFFFF, if unequal, the median in sequence array is assigned to x as virtual value; If equal, x1 value is assigned to x as virtual value, into step(a7);
(a7)Virtual value x is returned, is read for application program.
If the deletion and insertion data to quick sorting algorithm optimize, into step(b1)To step(b7):
(b1)Whether cyclic polling AD samplings convert, if completed, the data being collected are assigned to x1, enter back into step (b2);
(b2)Data to be covered in data source array are assigned to x2, into step(b3);
(b3)The position that data are equal to x2 is found in the array that sorts, into step(b4);
(b4)In the array that sorts, x1 and x2 size are judged, if x1<X2, then before the x2 positions in the array that sorts, According to insertion x1 in proper order from small to large, the Data Position equal to x2 is capped;If x1>X2, then in the array that sorts After x2 positions, according to insertion x1 in proper order from small to large, the Data Position equal to x2 is capped, into step(b5);
(b5)X1 is stored in the current location in data source array, while the sequence number in data source adds 1, if sequence number>=maximum Value, sequence number clear 0, into step(b6);
(b6)Judge whether x2 is equal to 0xFFFF, if unequal, the median in sequence array is assigned to x as virtual value; If equal, x1 value is assigned to x as virtual value, into step(b7);
(b7)Virtual value x is returned, is read for application program.
The present invention is based on beneficial effect possessed by its technical scheme:
1st, the present invention utilizes two arrays, and an array preserves the number of newest regulation number according to the sequencing of gathered data According to this ensure that being most freshly harvested data all the time in array;Another array is ranked up to latest data, after sequence Median as virtual value, return to application program and be applicable so that application program obtains good effective of high-precision, real-time Value;
2nd, the present invention utilizes quick sort, and the data gathered every time are immediately inserted into according to sequencing from small to large In the array that sorts, with respect to Bubble Sort Algorithm, this quick insertion sort algorithm code is simple, and execution efficiency is just much higher, is adapted to Sampling algorithm while multiple sensor;
3rd, the data filtering algorithm that the present invention utilizes, quicksort is carried out according to collection period, just obtained immediately in the minimum period Go out current virtual value.And conventional average algorithm and Bubble Sort Algorithm, it is required for after having gathered defined data, then It is ranked up and draws virtual value.So the data quicksort filtering algorithm of the present invention, show that the real-time of virtual value is fine, root Virtual value is quickly updated according to collection period;
4th, the present invention is not limited to application program, and very well, application program can arbitrarily read virtual value to compatibility in this world.But If the cycle of Bubble Sort Algorithm is less than the cycle for having gathered regulation data, after sequence, the order of available data can be upset, can It is not newest data problem that can cause to exist in data, and final virtual value there is a possibility that deviation;
5th, the data movement and insertion in the present invention to quick sorting algorithm, step(a3)With(a4)There is a mobile data twice, one Secondary movement is data of the covering equal to x2, and it is the data for inserting x1 once to move.Step(b3)With(b4)Using x2 as line of demarcation, Sequence array is divided into two parts, compares x1 and x2 size, to determine in forward part or rear partial insertion x1, the method As long as mobile once can be inserted into x1, and mobile data mean number reduces half so that efficiency further improves, special When not being that x1 is equal to x2, without carrying out the operation such as inserting to sequence array.
Brief description of the drawings
Fig. 1 is the fast filtering algorithm flow chart schematic diagram of the present invention;
The fast filtering algorithm Optimizing Flow diagram that Fig. 2 is the present invention is intended to;
Fig. 3 is the fast filtering algorithm data flow diagram of the present invention;
Fig. 4 is the fast filtering algorithm optimization data flow diagram of the present invention;
Fig. 5 is the flow chart of the insertion data after inventive algorithm optimization.
Embodiment
With reference to example, the invention will be further described.
Reference picture 1-5, it is real the invention provides a kind of New Algorithm for being applicable the filtering of vehicle electronics sensor voltage signal 5 sample datas of setting sampling in example, data source array are defined as SrcData [5], and sequence array is defined as DesData [5], The sequence number of data source array is defined as i, comprises the following steps:
(1)Sensor assembly is initialized, including SrcData [5] definition, DesData [5] definition, a/d converter The initializing of driving, the configuration of corresponding I/O port, module variable initializer show, i are initialized as 0, SrcData [5] and DesData [5] data initialization is 0xFFFF (expression invalid value), x1 and x2 is initialized as 0xFFFF (expression invalid value) etc., starts AD The data sampling of mouth;
(2)Run the periodic duty of sensor assembly, the size in general cycle according to the number of channels of sensor, data precision and Depending on the factors such as system resource allocation, the cycle of task run is set in the present invention as 5 milliseconds;
(a1)Whether cyclic polling AD samplings are converted, if completed, the data being collected are assigned to x1.Enter back into step(a2);
(a2)SrcData [i] is assigned to x2, into step(a3);
(a3)X2 position is found in array DesData [5], the data behind x2 sequence numbers are moved along, such x2 exists Data in array DesData [5] are capped.DesData [4] data are arranged to 0xFFFF simultaneously.Into step(a4);
(a4)In DesData [5], according to from small to large find the positions to be inserted of x1 in proper order, current location and below Data move a position backward, then x1 is inserted current location.Into step(a5);
(a5)X1 is stored in SrcData [i], while i adds 1, if i>=5, i clear 0.Into step(a6);
(a6)Judge whether x2 is equal to 0xFFFF, if unequal, x is assigned to using DesData [2] as virtual value;If equal, X1 value is assigned to x as virtual value, into step(a7);
(a7)Virtual value x is returned, is read for application program.
If the deletion and insertion data to quick sorting algorithm optimize, into step(b1)To step(b7):
(b1)Whether cyclic polling AD samplings are converted, if completed, the data being collected are assigned to x1.Enter back into step(b2);
(b2)SrcData [i] is assigned to x2, into step(b3);
(b3)The position that data are equal to x2 is found in DesData [5], into step(b4);
(b4)X1 and x2 size are judged, if x1<X2, then in DesData [5] before position of the data equal to x2, root According to insertion x1 in proper order from small to large, while x2 is capped;If x1>X2, then data are equal to x2's in DesData [5] After position, according to insertion x1 in proper order from small to large, x2 is capped.Into step(b5);
(b5)X1 is stored in SrcData [i], while i adds 1, if i>=5, i clear 0.Into step(b6);
(b6)Judge whether x2 is equal to 0xFFFF, if unequal, x is assigned to using DesData [2] as virtual value;If equal, X1 value is assigned to x as virtual value, into step(b7);
(b7)Virtual value x is returned, is read for application program.The flow chart that data are inserted in this method is as shown in Figure 5.
This method is deployed mainly around a passage gathered data and filtering algorithm, but the similarly suitable multichannel of the method is comprehensive Close data processing.

Claims (1)

  1. A kind of 1. algorithm for the filtering of vehicle electronics sensor voltage signal, it is characterised in that:Comprise the following steps:
    Step 1: initialized to sensor assembly, including the initializing of a/d converter driving, the configuring of corresponding I/O port, number Definition, the array data of group size are initialized as 0xFFFF, module variable initializer show etc., start the data sampling of AD mouths;
    Step 2: the periodic duty of operation sensor assembly,
    If the deletion to quick sorting algorithm and insertion data do not optimize, into step(a1)To step(a7):
    (a1)Whether cyclic polling AD samplings convert, if completed, the data being collected are assigned to x1, enter back into step(a2);
    (a2)Data to be covered in data source array are assigned to x2, into step(a3);
    (a3)X2 position is found in the array that sorts, the data behind x2 sequence numbers are moved along, such x2 is in sequence array In be capped, while last data is arranged to invalid value(0xFFFF), into step(a4);
    (a4)In the array that sorts, according to from small to large find the positions to be inserted of x1 in proper order, current location and below Data move a position backward, then x1 is inserted current location, into step(a5);
    (a5)X1 is stored in the current location in data source array, while the sequence number in data source adds 1, if sequence number>=maximum Value, sequence number clear 0, into step(a6);
    (a6)Judge whether x2 is equal to 0xFFFF, if unequal, the median in sequence array is assigned to x as virtual value; If equal, x1 value is assigned to x as virtual value, into step(a7);
    (a7)Virtual value x is returned, is read for application program;
    If the deletion and insertion data to quick sorting algorithm optimize, into step(b1)To step(b7):
    (b1)Whether cyclic polling AD samplings convert, if completed, the data being collected are assigned to x1, enter back into step(b2);
    (b2)Data to be covered in data source array are assigned to x2, into step(b3);
    (b3)The position that data are equal to x2 is found in the array that sorts, into step(b4);
    (b4)In the array that sorts, x1 and x2 size are judged, if x1<X2, then before the x2 positions in the array that sorts, According to insertion x1 in proper order from small to large, the Data Position equal to x2 is capped;If x1>X2, then in the array that sorts After x2 positions, according to insertion x1 in proper order from small to large, the Data Position equal to x2 is capped, into step(b5);
    (b5)X1 is stored in the current location in data source array, while the sequence number in data source adds 1, if sequence number>=maximum Value, sequence number clear 0, into step(b6);
    (b6)Judge whether x2 is equal to 0xFFFF, if unequal, the median in sequence array is assigned to x as virtual value; If equal, x1 value is assigned to x as virtual value, into step(b7);
    (b7)Virtual value x is returned, is read for application program.
CN201710607347.6A 2017-07-24 2017-07-24 A kind of algorithm for the filtering of vehicle electronics sensor voltage signal Pending CN107425825A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710607347.6A CN107425825A (en) 2017-07-24 2017-07-24 A kind of algorithm for the filtering of vehicle electronics sensor voltage signal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710607347.6A CN107425825A (en) 2017-07-24 2017-07-24 A kind of algorithm for the filtering of vehicle electronics sensor voltage signal

Publications (1)

Publication Number Publication Date
CN107425825A true CN107425825A (en) 2017-12-01

Family

ID=60431108

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710607347.6A Pending CN107425825A (en) 2017-07-24 2017-07-24 A kind of algorithm for the filtering of vehicle electronics sensor voltage signal

Country Status (1)

Country Link
CN (1) CN107425825A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105071385A (en) * 2015-08-10 2015-11-18 国家电网公司 Power grid operating data real-time analysis system
CN106445886A (en) * 2016-08-31 2017-02-22 温州长江汽车电子有限公司 Algorithm used for filtering of voltage signal of vehicle sensor
US20170097924A1 (en) * 2004-12-15 2017-04-06 Microsoft Technology Licensing, Llc Filter and sort by format

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170097924A1 (en) * 2004-12-15 2017-04-06 Microsoft Technology Licensing, Llc Filter and sort by format
CN105071385A (en) * 2015-08-10 2015-11-18 国家电网公司 Power grid operating data real-time analysis system
CN106445886A (en) * 2016-08-31 2017-02-22 温州长江汽车电子有限公司 Algorithm used for filtering of voltage signal of vehicle sensor

Similar Documents

Publication Publication Date Title
CN101968714B (en) Method and system for identifying operation locus input on mobile terminal interface
CN102772211A (en) Human movement state detection system and detection method
CN108569297B (en) Vehicle driving condition identification method and system
CN106445886A (en) Algorithm used for filtering of voltage signal of vehicle sensor
CN109101390A (en) Timed task abnormality monitoring method, electronic device and medium based on Gaussian Profile
CN107425825A (en) A kind of algorithm for the filtering of vehicle electronics sensor voltage signal
CN103592455A (en) Digital detection device and method for speed of electric bicycle
CN112047209B (en) Automatic calibration method, medium, terminal and device for elevator floors
CN111506408A (en) Edge computing task scheduling method based on associated data set
CN103488990A (en) Method and device for extracting eyelash image and locating pupil through cross neighborhood method
CN101430741A (en) Short sequence mapping method and system
CN203727307U (en) Battery electric vehicle control module
CN103699653A (en) Method and device for clustering data
CN104808561A (en) Multi-state switch state collection device and method
CN103514596A (en) Method and device for processing image
CN204775060U (en) Speed of a motor vehicle signal conditioning transition system
CN210040455U (en) Battery management system and voltage sampling control circuit and electric automobile thereof
CN111306292A (en) Domestic microcontroller gearbox shift controller TCU system
CN112181145A (en) Intelligent glove sign language recognition method
CN214312052U (en) Armored vehicle Flexray bus collector
CN105180975B (en) Voltage x current compatible type rate signal Acquisition Circuit
CN107391728B (en) Data mining method and data mining device
CN110362615B (en) Multi-object intelligent data table driving method and device with complex interface
CN206627244U (en) Data collecting system circuit
CN103699574A (en) Retrieval optimization method and system for complex retrieval formula

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20171201

WD01 Invention patent application deemed withdrawn after publication