Vehicle frequency signal processing system
By designing a vehicle frequency signal processing system, using the interrupt module and frequency calculation module combined with the filter module sorting and sliding average method, the problem of spike pulse interference in vehicle frequency signal acquisition is solved, and the effective smoothing and accuracy of data is improved.
Patent Information
- Application Number
- CN202411747213.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-04-11
AI Technical Summary
During the process of vehicle frequency signal acquisition, a small number of spike pulse interference in the environment leads to inaccurate data, and it is difficult for the prior art to effectively filter and smooth.
Design a vehicle frequency signal processing system, including a time interrupt module, an interrupt counting module, a frequency calculation module and a filtering module. Smoothing is performed by counting time, processing pulse interruptions, calculating vehicle frequency, and sorting and removing extreme values and sliding average.
While retaining the actual frequency and response speed, it reduces clutter interference such as spike pulses, makes the data acquisition more effective and alleviates errors when the usage environment is poor. The calculation process is simple and does not increase unnecessary calculation amount.
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vehicle signal filtering, and specifically relates to a vehicle frequency signal processing system, which can be used for filtering and smoothing when there is a small amount of spike pulse interference in the environment. Frequency sampling uses different calculation methods in low-frequency and high-frequency states, and the collected frequency data is processed. Background Art
[0002] The acquisition of vehicle frequency signals requires relatively stable electrical conditions. Poor electrical conditions such as unstable electrical levels may result in inaccurate data collection, which is even more important for vehicle frequency signals. Due to the use environment, number of cables and other reasons, it is difficult to ensure that the equipment works under appropriate conditions in some scenarios, especially when the circuit contains power devices. Hardware filtering design can reduce the impact of factors such as unstable electrical levels on the collected data. However, for vehicle frequency signals, excessive hardware filtering will affect the acquisition of normal signals. Therefore, in addition to hardware design optimization, software frequency acquisition optimization is also particularly important. Summary of the invention
[0003] 1. Technical issues to be resolved
[0004] The technical problem to be solved by the present invention is: how to provide a vehicle frequency signal processing system to achieve filtering and smoothing when there is a small amount of spike pulse interference in the environment.
[0005] (II) Technical solution
[0006] In order to solve the above technical problems, the present invention provides a vehicle frequency signal processing system, the system is used to calculate and filter the frequency signal, the system comprises: a time interrupt module, an interrupt counting module, a frequency calculation module and a filtering module;
[0007] The time interrupt module is used to count time;
[0008] The interrupt counting module is used to process the counting-related functions during pulse interruption;
[0009] The frequency calculation module calculates the vehicle frequency according to the calculation mode flag variable and the interruption number variable transmitted by the interruption counting module;
[0010] The filtering module is used to receive the vehicle frequency obtained by the frequency calculation module, and smooth the vehicle frequency data by sorting, removing extreme values, and sliding average.
[0011] The time interrupt module is used to count time;
[0012] The time interrupt module includes a flag variable timeflag1 for marking whether the counting judgment time has arrived, and a flag variable timeflag2 for marking whether the filtering sampling time has arrived;
[0013] When the counting time is up, the status of "timing time up" is written into the flag variable timeflag1, and the flag variable timeflag1 is passed to the interrupt counting module;
[0014] When the sampling timing time is reached, the status of "timing time reached" is written into the flag variable timeflag2, and the flag variable timeflag2 is passed to the filtering module.
[0015] The counting timing time is 1s.
[0016] The sampling timing time is 0.5s.
[0017] The interrupt counting module is used to process the counting-related functions during pulse interruption;
[0018] The interrupt counting module includes the flag variable timeflag1 passed by the time interrupt module, the interrupt number variable count used to count the number of interrupts, the flag variable freqflag used to record the calculation method to be passed to the frequency calculation module, the variables intTime1 and intTime2 used to record the interrupt time, and the flag variable secondFlag used to record whether the interrupt time is counted twice;
[0019] The interruption count variable count is used to determine the number of interrupts triggered within a period of time; if the value of the flag variable timeflag1 is "timing time is up", it is determined whether the number of times within this period exceeds the preset value; if it has exceeded the preset value, the state of "using high-frequency algorithm" is written into the calculation mode flag variable freqflag; otherwise, the state of "using low-frequency algorithm" is written into the calculation mode flag variable freqflag;
[0020] If the value of the flag variable secondFlag is 1, the current time is saved in the variable intTime1; if the value of the flag variable secondFlag is 2, the current time is saved in the variable intTime2; when the above processing is completed, the interrupt counting module calls the frequency calculation module and passes the calculation method flag variable freqflag, the number of interrupts variable count, the flag variable secondFlag, the variable intTime1, and the variable intTime2 to the frequency calculation module.
[0021] The preset value is 20 times within 1 second.
[0022] The frequency calculation module includes a calculation mode flag variable freqflag and an interruption number variable count, a flag variable secondFlag, a variable intTime1, and a variable intTime2 transmitted from the interrupt counting module;
[0023] If the calculation mode flag variable freqflag is "use low frequency algorithm", the vehicle frequency is calculated by calculating the number of pulses generated per second according to the number of interruption times variable count;
[0024] Otherwise, the time difference between variables intTime1 and intTime2 is used to calculate the number of cycles per second to calculate the vehicle frequency;
[0025] When the variable count is less than a certain value, the vehicle frequency value is zero.
[0026] The set value is set to 2, which is a set value much smaller than the value that may occur.
[0027] The filtering module receives the vehicle frequency obtained by the frequency calculation module, and smoothes the frequency data by sorting, removing extreme values, and sliding average.
[0028] Among them, the smoothing filtering principle of the vehicle frequency signal is: when the single-chip hardware collects the edge of the frequency pulse, it will trigger an interrupt; record the number and time of the interruption, and determine whether to use the counting method or the time length method to calculate the frequency according to the number of interruptions within a period of time, remove all data with frequencies lower than the reasonable value, and use the sorting method to remove extreme values and the sliding average method to smooth the data.
[0029] (III) Beneficial effects
[0030] The present invention uses a processing algorithm in the vehicle frequency acquisition process, which can reduce the interference of spike pulses and other similar clutter while retaining the actual frequency and response speed, making the acquisition data more effective.
[0031] Compared with the prior art, the beneficial effects of the present invention using the above scheme are:
[0032] (1) Alleviate the large errors generated in poor operating environments, especially the errors when the data is at zero position;
[0033] (2) The calculation process is relatively simple, does not increase unnecessary calculation amount, and has little impact on existing software. DETAILED DESCRIPTION
[0034] In order to make the purpose, content, and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with embodiments.
[0035] In order to solve the above technical problems, the present invention provides a vehicle frequency signal processing system, the system is used to calculate and filter the frequency signal, the system comprises: a time interrupt module, an interrupt counting module, a frequency calculation module and a filtering module;
[0036] The time interrupt module is used to count time;
[0037] The interrupt counting module is used to process the counting-related functions during pulse interruption;
[0038] The frequency calculation module calculates the vehicle frequency according to the calculation mode flag variable and the interruption number variable transmitted by the interruption counting module;
[0039] The filtering module is used to receive the vehicle frequency obtained by the frequency calculation module, and smooth the vehicle frequency data by sorting, removing extreme values, and sliding average.
[0040] The time interrupt module is used to count time;
[0041] The time interrupt module includes a flag variable timeflag1 for marking whether the counting judgment time has arrived, and a flag variable timeflag2 for marking whether the filtering sampling time has arrived;
[0042] When the counting time is up, the status of "timing time up" is written into the flag variable timeflag1, and the flag variable timeflag1 is passed to the interrupt counting module;
[0043] When the sampling timing time is reached, the status of "timing time reached" is written into the flag variable timeflag2, and the flag variable timeflag2 is passed to the filtering module.
[0044] The counting timing time is 1s.
[0045] The sampling timing time is 0.5s.
[0046] The interrupt counting module is used to process the counting-related functions during pulse interruption;
[0047] The interrupt counting module includes the flag variable timeflag1 passed by the time interrupt module, the interrupt number variable count used to count the number of interrupts, the flag variable freqflag used to record the calculation method to be passed to the frequency calculation module, the variables intTime1 and intTime2 used to record the interrupt time, and the flag variable secondFlag used to record whether the interrupt time is counted twice;
[0048] The interruption count variable count is used to determine the number of interrupts triggered within a period of time; if the value of the flag variable timeflag1 is "timing time is up", it is determined whether the number of times within this period exceeds the preset value; if it has exceeded the preset value, the state of "using high-frequency algorithm" is written into the calculation mode flag variable freqflag; otherwise, the state of "using low-frequency algorithm" is written into the calculation mode flag variable freqflag;
[0049] If the value of the flag variable secondFlag is 1, the current time is saved in the variable intTime1; if the value of the flag variable secondFlag is 2, the current time is saved in the variable intTime2; when the above processing is completed, the interrupt counting module calls the frequency calculation module and passes the calculation method flag variable freqflag, the number of interrupts variable count, the flag variable secondFlag, the variable intTime1, and the variable intTime2 to the frequency calculation module.
[0050] The preset value is 20 times within 1 second.
[0051] The frequency calculation module includes a calculation mode flag variable freqflag and an interruption number variable count, a flag variable secondFlag, a variable intTime1, and a variable intTime2 transmitted from the interrupt counting module;
[0052] If the calculation mode flag variable freqflag is "use low frequency algorithm", the vehicle frequency is calculated by calculating the number of pulses generated per second according to the number of interruption times variable count;
[0053] Otherwise, the time difference between variables intTime1 and intTime2 is used to calculate the number of cycles per second to calculate the vehicle frequency;
[0054] When the variable count is less than a certain value, the vehicle frequency value is zero.
[0055] The set value is set to 2, which is a set value much smaller than the value that may occur.
[0056] The filtering module receives the vehicle frequency obtained by the frequency calculation module, and smoothes the frequency data by sorting, removing extreme values, and sliding average.
[0057] Among them, the smoothing filtering principle of the vehicle frequency signal is: when the single-chip hardware collects the edge of the frequency pulse, it will trigger an interrupt; record the number and time of the interruption, and determine whether to use the counting method or the time length method to calculate the frequency according to the number of interruptions within a period of time, remove all data with frequencies lower than the reasonable value, and use the sorting method to remove extreme values and the sliding average method to smooth the data.
[0058] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A vehicle frequency signal processing system, characterized in that: The system is used to calculate and filter the frequency signal, and the system includes: a time interrupt module, an interrupt counting module, a frequency calculation module and a filtering module; The time interrupt module is used to count time; The interrupt counting module is used to process the counting-related functions during pulse interruption; The frequency calculation module calculates the vehicle frequency according to the calculation mode flag variable and the interruption number variable transmitted by the interruption counting module; The filtering module is used to receive the vehicle frequency obtained by the frequency calculation module, and smooth the vehicle frequency data by sorting, removing extreme values, and sliding average.
2. The vehicle frequency signal processing system according to claim 1, characterized in that: The time interrupt module is used to count time; The time interrupt module includes a flag variable timeflag1 for marking whether the counting judgment time has arrived, and a flag variable timeflag2 for marking whether the filtering sampling time has arrived; When the counting time is up, the status of "timing time up" is written into the flag variable timeflag1, and the flag variable timeflag1 is passed to the interrupt counting module; When the sampling timing time is reached, the status of "timing time reached" is written into the flag variable timeflag2, and the flag variable timeflag2 is passed to the filtering module.
3. The vehicle frequency signal processing system according to claim 1, characterized in that: The counting timing time is 1s.
4. The vehicle frequency signal processing system according to claim 1, characterized in that: The sampling timing time is 0.5s.
5. The vehicle frequency signal processing system according to claim 2, characterized in that: The interrupt counting module is used to process the counting-related functions during pulse interruption; The interrupt counting module includes the flag variable timeflag1 passed by the time interrupt module, the interrupt number variable count used to count the number of interrupts, the flag variable freqflag used to record the calculation method to be passed to the frequency calculation module, the variables intTime1 and intTime2 used to record the interrupt time, and the flag variable secondFlag used to record whether the interrupt time is counted twice; The interruption count variable count is used to determine the number of interruptions triggered within a period of time; If the value of the flag variable timeflag1 is "timing time is up", determine whether the number of times during this period exceeds the preset value; if it has exceeded the preset value, write the state of "using high-frequency algorithm" into the calculation mode flag variable freqflag; otherwise, write the state of "using low-frequency algorithm" into the calculation mode flag variable freqflag; If the value of the flag variable secondFlag is 1, the current time is saved in the variable intTime1; if the value of the flag variable secondFlag is 2, the current time is saved in the variable intTime2; when the above processing is completed, the interrupt counting module calls the frequency calculation module and passes the calculation method flag variable freqflag, the number of interrupts variable count, the flag variable secondFlag, the variable intTime1, and the variable intTime2 to the frequency calculation module.
6. The vehicle frequency signal processing system according to claim 5, characterized in that: The preset value is 20 times within 1 second.
7. The vehicle frequency signal processing system according to claim 5, characterized in that: The frequency calculation module includes a calculation mode flag variable freqflag and an interruption number variable count, a flag variable secondFlag, a variable intTime1, and a variable intTime2 transmitted from the interrupt counting module; If the calculation mode flag variable freqflag is "use low frequency algorithm", the vehicle frequency is calculated by calculating the number of pulses generated per second according to the number of interruption times variable count; Otherwise, the time difference between variables intTime1 and intTime2 is used to calculate the number of cycles per second to calculate the vehicle frequency; When the variable count is less than a certain value, the vehicle frequency value is zero.
8. The vehicle frequency signal processing system according to claim 7, characterized in that: The set value is set to 2, which is a set value much smaller than the value that may occur.
9. The vehicle frequency signal processing system according to claim 7, characterized in that: The filtering module receives the vehicle frequency obtained by the frequency calculation module, and smoothes the frequency data by sorting, removing extreme values, and sliding average.
10. The vehicle frequency signal processing system according to claim 9, characterized in that: The smoothing filtering principle of the vehicle frequency signal is as follows: when the single-chip microcomputer hardware collects the edge of the frequency pulse, an interrupt will be triggered; the number and time of the interruption are recorded, and the frequency is calculated based on the number of interruptions within a period of time. The counting method or the time length method is used to determine whether the frequency is calculated, and all data with frequencies lower than the reasonable value are removed, and the data is smoothed using the method of sorting to remove extreme values and sliding average.