Anti-electromagnetic interference vibrating wire sensor frequency measurement method and device
By using a microcontroller to capture and screen algorithm to process signals during the free vibration of the vibrating string sensor, the waveform instability and electromagnetic interference problems of the pulse counting method are solved, and the accuracy of frequency measurement and anti-interference ability are improved.
Patent Information
- Application Number
- CN202410973290.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-01
AI Technical Summary
The existing isometric frequency measurement method based on the pulse counting principle leads to frequency measurement errors and even errors when waveform is unstable, time interval selection, and electromagnetic interference. The spectrum analysis method has high hardware resource requirements and complex algorithms.
During the entire vibrating free vibration of the string after the excitation signal is stopped, the microcontroller with the input capture function captures all the responses after the vibrating string are excited, and the frequency of the vibrating string signal is analyzed and processed using the screening algorithm to reduce electrical noise and enhance the Anti-electromagnetic interference performance.
It improves the accuracy of frequency measurement of vibrating instruments and anti-electromagnetic interference capabilities, adapts to various types of vibrating sensors, and avoids problems with high hardware resources and complex algorithms.
Smart Images

Figure CN118882811A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of geotechnical engineering health monitoring, and in particular to a frequency measurement method and device of a vibrating string sensor resistant to electromagnetic interference. Background Art
[0002] In the safety monitoring of geotechnical engineering, safety monitoring instruments such as vibrating string (or steel string) instruments are usually used to monitor physical quantities such as stress and strain, temperature, joint opening, leakage and deformation of geotechnical engineering to analyze and judge the safety of geotechnical engineering.
[0003] The vibrating string instrument (or vibrating string sensor) consists of a homogeneous steel string fixed at both ends. When sensing external forces (which can be stress and strain, temperature, joint opening, leakage and deformation in geotechnical engineering), the steel string will produce tensile deformation, resulting in a specific natural frequency of the steel string. By measuring the mechanical vibration natural frequency of the steel string, the external force information applied to the vibrating string sensor can be inferred. Therefore, the mechanical vibration natural frequency of the steel string is the most critical measurement factor in the vibrating string sensor, which directly affects the sensitivity, response speed and measurement accuracy of the vibrating string sensor.
[0004] The method of excitation and vibration pickup is usually used to measure the mechanical vibration natural frequency of a steel string (vibration frequency or frequency parameter for short). The steel string is placed in a magnetic field composed of a frequency measuring coil and a permanent magnet. The steel string is excited to vibrate freely. The freely vibrating steel string cuts the magnetic lines of force in the magnetic field, generating an induced electromotive force in the measuring coil. The frequency of the weak induced electromotive force generated in the measuring coil is picked up by the vibration pickup method, which is the mechanical vibration natural frequency of the steel string.
[0005] Existing vibration pickup methods mostly use the method of exciting the steel string, amplifying, filtering, and shaping the induced electromotive force generated in the measuring coil into a square wave signal, and then using an equal-precision frequency measurement method based on the pulse counting principle to measure the frequency of the signal; or amplifying, filtering, sampling and digitizing the weak electromotive force signal generated after the steel string is excited, and using spectrum analysis methods such as FFT to calculate the vibration frequency of the steel string.
[0006] Among them, for the equal-precision frequency measurement method based on the pulse counting principle, the measurement principle is as follows Figure 1 As shown. The method used is to select a time interval Δt of "waveform stability" after excitation, and calculate the frequency of the pulse signal to be measured by simultaneously counting the number of pulse signals to be measured Nx and the number of known high-frequency time bases Ns within Δt. Counter CNT1 counts the pulse signal to be measured, and counter CNT2 counts the high-frequency time base signal. The calculation formula for the frequency fx of the signal to be measured is obtained as follows:
[0007] fx=fs*Nx / Ns (1)
[0008] In formula (1), fs is the high-frequency time base frequency, which is a constant value. After the software preset gate is started, when the first rising edge / falling edge of the measured signal arrives, counters CNT1 and CNT2 start counting at the same time; after the software preset gate is closed, when the first rising edge / falling edge of the measured pulse signal arrives, CNT1 and CNT2 stop counting; because the counting is synchronized with the rising edge / falling edge of the measured pulse signal, the count value of Nx does not have a count error of ±1 word. Therefore, in formula (1), the fx error is determined by the error of the count value Ns of CNT2.
[0009] This frequency measurement method selects the frequency of the pulse signal in a certain time period Δt of the vibrating-string sensor after being excited as the measured value of the sensor's natural frequency f. If the waveform in the selected Δt time period is unstable or the Δt interval is improperly selected, it will cause measurement errors in the frequency of the signal to be measured. Moreover, if the sensor or the acquisition device is subject to electromagnetic interference, the interference signal will be superimposed on the signal, causing the rising or falling edge of the waveform to jitter, resulting in an error in the count value, which directly causes an error or even error in the frequency measurement; that is, within the Δt time period, if any pulse signal waveform of the pulse signal fx to be measured is interfered with, that is, the rising or falling edge jitters, it will affect the count value Nx of CNT1, resulting in an error in the frequency fx of the signal to be measured calculated according to formula (1).
[0010] Although the frequency measurement method using spectrum analysis such as FFT has better solved the problem of anti-electromagnetic interference of sensors and measuring devices, the implementation of this method requires high hardware resources and the algorithm for analyzing signal frequency is relatively complex. Summary of the invention
[0011] The present invention aims at the problems that the existing equal-precision frequency measurement method based on the pulse counting principle may cause errors or even mistakes in frequency measurement when the waveform is unstable, the time interval is improperly selected, and the frequency measurement is affected by electromagnetic interference, and the existing frequency measurement method based on spectrum analysis has high hardware resource requirements and the algorithm for analyzing the signal frequency is relatively complex. The present invention provides a frequency measurement method for a vibrating string sensor that is resistant to electromagnetic interference. The method is an improved frequency measurement method for a vibrating string instrument based on the pulse counting principle. During the entire free vibration period of the vibrating string after the excitation signal stops, the entire response of the vibrating string after being excited is captured by a single-chip microcomputer with an input capture function, and then the frequency of the vibrating string signal is estimated by analyzing and processing the data of the entire response through a screening algorithm. In terms of the accuracy of frequency measurement, the method is superior to the equal-precision frequency measurement method based on pulse counting. The present invention also relates to a frequency measurement device for a vibrating string sensor that is resistant to electromagnetic interference.
[0012] The technical solution of the present invention is as follows:
[0013] A method for measuring the frequency of a vibrating-wire sensor resistant to electromagnetic interference, characterized in that it comprises the following steps:
[0014] The vibrating string free vibration signal generation step includes applying an excitation signal to both ends of the frequency measurement coil of the vibrating string sensor, causing the vibrating string to vibrate mechanically under the action of an alternating electromagnetic force, and then stopping the excitation signal, causing the vibrating string to vibrate freely, and converting the induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measurement coil into a square wave signal after processing, and then converting it into a pulse square wave signal after photoelectric isolation, and sending it to an input capture pin of a single-chip microcomputer with an input capture function;
[0015] The whole process capturing step during the continuation of the free vibration of the vibrating string is to capture the rising edge / falling edge of the pulse square wave signal input during the continuation of the free vibration of the vibrating string sensor through a single-chip microcomputer with an input capturing function. At each rising edge / falling edge of the pulse square wave signal, the current timer count value is automatically stored in the capture register in the single-chip microcomputer, so as to obtain a series of timer count values at all rising edge / falling edge moments during the whole process capturing;
[0016] The step of estimating the frequency of the vibrating string signal is to obtain a signal waveform period of the pulse square wave signal to be measured according to the difference between the count values of two adjacent captured timers, and then calculate the signal waveform period series of each pulse square wave signal during the whole capture process, and then estimate the frequency of the vibrating string signal through the screening algorithm.
[0017] Preferably, in the step of estimating the frequency of the vibrating string signal, after calculating the signal waveform period series of each pulse square wave signal during the whole process capture, the signal waveform period series is first sorted as a number of initial data points to form an initial data set, and the mean and standard deviation of the initial data set are calculated, and then a first data set is formed by discarding X% of the initial data points from the head and the tail through a screening algorithm, and the mean and standard deviation of the first data set, as well as a first mean deviation between the first data set and the initial data set are calculated, and the first mean deviation is compared with a preset measurement error. When the first mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the initial data set; when the first mean deviation is greater than the preset measurement error, a second data set is formed by discarding 2X% of the initial data points from the head and the tail through a screening algorithm, and the mean and standard deviation of the second data set are calculated, and the second mean deviation is calculated. The second mean deviation of the data set and the first data set is compared, and the second mean deviation is compared with the preset measurement error. When the second mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the first data set; when the second mean deviation is greater than the preset measurement error, the initial data points of 3X% are discarded from the head and the tail through the screening algorithm to form a third data set, and the mean and standard deviation of the third data set, as well as the third mean deviation of the third data set and the second data set are calculated, and the third mean deviation is compared with the preset measurement error. When the third mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the second data set. Otherwise, this is repeated until the nth data set is formed by discarding the initial data points of nX% from the head and the tail through the screening algorithm, and the same judgment and comparison processing is performed to estimate the frequency of the vibrating string signal.
[0018] Preferably, in the step of estimating the frequency of the vibrating string signal, when the percentage nX% of initial data points discarded from the head and the tail by the screening algorithm reaches 60%-70% of the initial data points, an nth data set is formed, and the mean and standard deviation of the nth data set, as well as the nth mean deviation between the nth data set and the n-1th data set are calculated, and the nth mean deviation is compared with a preset measurement error. When the nth mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated based on the mean and standard deviation of the n-1th data set; when the nth mean deviation is greater than the preset measurement error, the measurement fails.
[0019] Preferably, in the vibrating string free vibration signal generating step, the induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measuring coil is converted into a square wave signal after voltage amplification, bandpass filtering and shaping, and then converted into a pulse square wave signal directly processed by the single chip microcomputer after photoelectric isolation.
[0020] Preferably, the whole process capture step during the free vibration of the vibrating string adopts an STM32 series single chip microcomputer with input capture function, and the input capture initialization, capture channel configuration, input capture start, input capture stop and interrupt processing are performed by calling the HAL function.
[0021] A frequency measurement device for a vibrating string sensor that is resistant to electromagnetic interference, comprising an excitation device, wherein the excitation device applies an excitation signal to both ends of a frequency measurement coil of the vibrating string sensor, and the vibrating string vibrates mechanically under the action of an alternating electromagnetic force. The device is characterized in that it also comprises a vibration pickup device, wherein the vibration pickup device comprises a vibrating string free vibration signal generating module, a vibrating string free vibration period full process capture module, and a vibrating string signal frequency estimation module, which are connected in sequence. When the excitation device stops the excitation signal, the vibrating string begins to vibrate freely. The vibrating string free vibration signal generating module converts the induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measurement coil into a square wave signal after processing, and then converts it into a pulse square wave signal after photoelectric isolation, and sends it to an input capture pin of a single-chip microcomputer with an input capture function. The whole process capture module during the duration of the vibration is used to capture the rising edge / falling edge of the pulse square wave signal input during the duration of the free vibration of the vibrating string of the vibrating string sensor through a single chip microcomputer with an input capture function. At each rising edge / falling edge of the pulse square wave signal, the current timer count value is automatically stored in the capture register in the single chip microcomputer to obtain a series of timer count values at all rising edge / falling edge moments during the whole process of capture; the vibrating string signal frequency estimation module is used to obtain a signal waveform period of the pulse square wave signal to be measured according to the difference between two adjacent captured timer count values by the single chip microcomputer with an input capture function, and then calculate the signal waveform period series of each pulse square wave signal during the whole process of capture, and then estimate the frequency of the vibrating string signal through a screening algorithm for each signal waveform period series.
[0022] Preferably, in the vibration signal frequency estimation module, after calculating the signal waveform period series of each pulse square wave signal during the whole process capture, the signal waveform period series is first sorted as a number of initial data points to form an initial data set, and the mean and standard deviation of the initial data set are calculated, and then the initial data points of X% are discarded from the head and tail by a screening algorithm to form a first data set, and the mean and standard deviation of the first data set, as well as the first mean deviation between the first data set and the initial data set are calculated, and the first mean deviation is compared with a preset measurement error. When the first mean deviation is less than or equal to the preset measurement error, the vibration signal frequency is estimated according to the mean and standard deviation of the initial data set; when the first mean deviation is greater than the preset measurement error, the initial data points of 2X% are discarded from the head and tail by a screening algorithm to form a second data set, and the mean and standard deviation of the second data set are calculated, and the second mean deviation is calculated. The second mean deviation of the data set and the first data set is compared, and the second mean deviation is compared with the preset measurement error. When the second mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the first data set; when the second mean deviation is greater than the preset measurement error, the initial data points of 3X% are discarded from the head and the tail through the screening algorithm to form a third data set, and the mean and standard deviation of the third data set, as well as the third mean deviation of the third data set and the second data set are calculated, and the third mean deviation is compared with the preset measurement error. When the third mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the second data set. Otherwise, this is repeated until the nth data set is formed by discarding the initial data points of nX% from the head and the tail through the screening algorithm, and the same judgment and comparison processing is performed to estimate the frequency of the vibrating string signal.
[0023] Preferably, in the vibration signal frequency estimation module, a first data set is formed by discarding 5% of the initial data points from both the head and the tail with a percentage of 2.5% through a screening algorithm, a second data set is formed by discarding 10% of the initial data points from both the head and the tail with a percentage of 5% through a screening algorithm, and a third data set is formed by discarding 15% of the initial data points from both the head and the tail with a percentage of 7.5% through a screening algorithm, and so on, until a twelfth data set is formed by discarding 60% of the initial data points from both the head and the tail with a percentage of 30% through a screening algorithm. When the calculated 12 mean deviations are all greater than the preset measurement error, the measurement fails.
[0024] Preferably, the vibrating string free vibration signal generating module comprises a voltage amplifier circuit, a bandpass filter circuit, a shaping circuit and a photoelectric isolation circuit which are connected in sequence. The induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measurement coil is converted into a square wave signal after voltage amplification, bandpass filtering and shaping in sequence, and then converted into a pulse square wave signal directly processed by a single-chip microcomputer after photoelectric isolation, and sent to the input capture pin of the single-chip microcomputer with input capture function.
[0025] Preferably, the module for capturing the entire process during the free vibration of the vibrating string includes an STM32 series single-chip microcomputer with an input capture function, and performs input capture initialization, capture channel configuration, input capture startup, input capture stop, and interrupt processing by calling a HAL function.
[0026] The technical effects of the present invention are as follows:
[0027] The present invention relates to a frequency measurement method of a vibrating string sensor with anti-electromagnetic interference, which is a frequency measurement method of a vibrating string instrument used in a geotechnical engineering safety monitoring instrument, comprising: a vibrating string free vibration signal generation step, after the excitation signal stops, the vibrating string starts to vibrate freely, the induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measurement coil is processed and converted into a square wave signal, and then converted into a pulse square wave signal after photoelectric isolation, and sent to the input capture pin of a single-chip microcomputer with an input capture function, the induced electromotive force signal is converted into a square wave signal and then photoelectrically isolated, which can effectively reduce electrical noise and suppress interference during signal transmission, enhance anti-electromagnetic interference performance, and can also be converted into a pulse square wave signal that can be directly processed by the subsequent single-chip microcomputer; a whole process capture step during the continuation of the free vibration of the vibrating string, through the input capture pin of a single-chip microcomputer with an input capture function The single-chip microcomputer with input capture function performs full-process capture of the rising edge / falling edge of the pulse square wave signal input during the free vibration of the vibrating string of the vibrating string sensor, that is, during the entire free vibration period of the vibrating string after the excitation signal stops, the single-chip microcomputer with input capture function captures all responses of the vibrating string after being excited, and the current timer count value is automatically stored in the capture register in the single-chip microcomputer to obtain a series of timer count values at all rising edge / falling edge moments during the whole process of capture; the step of estimating the frequency of the vibrating string signal, according to the difference between two adjacent captured timer count values, obtains a signal waveform period of the pulse square wave signal to be measured, and then calculates to obtain a signal waveform period series of each pulse square wave signal during the whole process of capture, and then estimates each signal waveform period series through a screening algorithm to obtain the frequency of the vibrating string signal. The present invention improves the accuracy of frequency measurement of a vibrating string instrument: by capturing the entire process of each pulse signal converted from all induced electromotive force signals generated by the vibration of the steel string in the measuring coil through a single chip microcomputer with an input capture function, and analyzing the capture timer count values of all rising edges (or falling edges) within the duration of the entire square wave signal, it can be understood as a vibrating string instrument frequency estimation method that captures the entire process during the duration of the free vibration of the vibrating string + analyzes and processes data. Based on the pulse counting principle, during the entire free vibration period of the vibrating string after the excitation signal stops, the single chip microcomputer with an input capture function captures all responses of the vibrating string after being excited, and then the frequency of the vibrating string signal is estimated through the screening algorithm analysis and processing of all response data. In terms of the accuracy of frequency measurement, it is superior to the equal-precision frequency measurement method based on pulse counting, and the method of the present invention can be adapted to the frequency measurement of various types of vibrating string sensors, can be widely promoted as an optimization scheme, and has certain application prospects in geotechnical engineering.
[0028] The present invention enhances the adaptability of frequency measurement of vibrating string instruments: conventional equal-precision frequency measurement methods based on the pulse counting principle often set a relatively fixed time period Δt (such as 300-400ms), and measure the frequency by simultaneously counting the number of induced electromotive force signals and time base signals within Δt. This will bring two limitations. First, the fixed time period Δt selected for frequency measurement is part of the entire vibrating string free vibration time period, and there is a problem of improper selection; second, vibrating string instruments vary greatly, and the duration of the induced electromotive force after excitation varies due to different sensors or sensors in different stress states. Selecting a relatively fixed time period Δt cannot adapt to all situations. The present invention captures the frequency of each pulse signal converted from the induced electromotive force signal during the entire time period of free vibration after the vibrating string instrument is excited through the whole process, and will not change due to differences in signal duration, which can solve the above problems well.
[0029] The present invention enhances the anti-electromagnetic interference capability of the frequency measurement of the vibrating string instrument: the equal-precision frequency measurement method based on the pulse counting principle, if it is subject to electromagnetic interference during the measurement process, the interference signal enters the measurement link, and the direct impact is that the rising and falling edges of the square wave will jitter, and the jitter will cause the timer to be falsely triggered, and the wrong count value of this counter cannot be eliminated, which will directly lead to frequency measurement errors or errors. The present invention captures the frequency of each pulse signal converted from all induced electromotive force signals during the entire free vibration of the vibrating string. Although from a single or limited capture process, due to the electromagnetic interference of the pulse signal to be measured, the jitter of the rising or falling edge will also cause capture errors, but local errors will not destroy the whole, and the capture errors of a single or limited number of pulses can be eliminated through data processing screening in the subsequent vibrating string signal frequency estimation step. Therefore, occasional electromagnetic interference will not affect the frequency estimation of the entire measurement process, greatly improving the anti-electromagnetic interference capability of the frequency measurement.
[0030] The present invention also relates to a frequency measurement device of a vibrating string sensor resistant to electromagnetic interference. The device corresponds to the above-mentioned frequency measurement method of a vibrating string sensor resistant to electromagnetic interference, and can be understood as a device for implementing the above-mentioned frequency measurement method of a vibrating string sensor resistant to electromagnetic interference, including an excitation device and a vibration pickup device, wherein the vibration pickup device includes a vibrating string free vibration signal generating module, a whole process capture module during the continuation of the free vibration of the vibrating string, and a vibrating string signal frequency estimation module connected in sequence, each module cooperates with each other to generate a vibrating string free vibration signal, capture the whole process during the continuation of the free vibration of the vibrating string, and estimate the frequency of the vibrating string signal in sequence. After the excitation signal stops, during the entire free vibration of the vibrating string, each pulse signal frequency converted from all induced electromotive force signals generated in the frequency measurement coil during the free vibration period is captured by a single-chip microcomputer with an input capture function, and the frequency of the vibrating string signal is estimated by a screening algorithm, thereby forming a The invention provides a frequency estimation device for a vibrating string instrument which can capture the whole process during the free vibration of the vibrating string, analyze and process the data, and solves the problems of the current equal-precision frequency measurement scheme based on the pulse counting principle, such as the error or even mistake in frequency measurement caused by unstable waveform, improper time interval selection and electromagnetic interference. Meanwhile, the invention also avoids the problems of high hardware resource requirements and complex algorithm for analyzing signal frequency in the existing frequency measurement method based on spectrum analysis. The invention makes improvements on the frequency measurement based on the pulse counting principle. During the whole free vibration period of the vibrating string after the excitation signal stops, the whole response of the vibrating string after being excited is captured by a single-chip microcomputer with an input capture function, and then the frequency of the vibrating string signal is estimated by analyzing and processing the data of all the responses through a screening algorithm, thereby improving the accuracy of the frequency measurement of the vibrating string instrument. It has been verified that the invention is superior to the equal-precision frequency measurement device based on counting frequency measurement in terms of the accuracy of frequency measurement.
[0031] The anti-electromagnetic interference vibrating string sensor frequency measurement device of the present invention is also an anti-electromagnetic interference vibrating string instrument frequency screening and estimation device based on single-chip microcomputer input capture and frequency measurement. Its vibrating string free vibration signal generation module preferably includes a voltage amplifier circuit, a bandpass filter circuit, a shaping circuit and a photoelectric isolation circuit connected in sequence. The full-process capture module during the existence of the vibrating string free vibration and the vibrating string signal frequency estimation module are mainly the full-process capture + data analysis and processing of the single-chip microcomputer with input capture function. Therefore, the frequency measurement device can be further understood as consisting of a voltage amplifier circuit, a bandpass filter circuit, a shaping circuit, a photoelectric isolation circuit and a single-chip microcomputer with input capture function. The voltage amplifier circuit amplifies the weak electromotive force generated by electromagnetic induction in the pickup coil; the bandpass filter circuit realizes filtering with a bandwidth of 400-6000Hz; the shaping circuit converts the amplified and filtered sinusoidal signal into a square wave signal; the photoelectric isolation circuit realizes the isolation of the single-chip microcomputer digital circuit and the vibrating string instrument analog signal processing circuit, enhances the circuit's anti-electromagnetic interference capability, and converts the square wave signal output by the shaping circuit into a pulse square wave signal that can be directly processed by the single-chip microcomputer; the single-chip microcomputer with input capture function completes the rising edge or falling edge capture of the pulse square wave signal. Furthermore, the whole process capture module during the continuation of the free vibration of the vibrating string includes an STM32 series single-chip microcomputer with input capture function, which initializes the input capture, configures the capture channel, starts the input capture, stops the input capture, and obtains the interrupt processing by calling the HAL function. The STM32 series microcontrollers with input capture function can immediately obtain the value of the current timing counter when capturing the rising edge or falling edge of the signal, so as to calculate the precise time or pulse width; and support a variety of capture modes and input channel configurations, such as capturing single edge (rising edge or falling edge), double edge (rising and falling edges captured simultaneously) and other capture modes to meet different application requirements; the capture function of the STM32 series microcontrollers with input capture function can be designed to use a combination of hardware timer and low power mode to achieve efficient power management. In applications that measure periodic events or time triggers, the capture function can run with minimal power consumption; and its capture function can be configured to use interrupts or DMA (direct memory access) so that it can respond and process in time when a capture event occurs. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 This is a measurement principle diagram of an existing equal-precision frequency measurement method based on the pulse counting principle.
[0033] Figure 2 The present invention is a flow chart of the frequency measurement method of the vibrating-string sensor with electromagnetic interference resistance.
[0034] Figure 3The signal waveform diagram is a signal waveform diagram of the excitation signal of the anti-electromagnetic interference vibrating string sensor frequency measurement method of the present invention after voltage amplification, bandpass filtering and shaping.
[0035] Figure 4 The present invention is a full-process capture and frequency measurement principle diagram of the frequency measurement method of the vibrating-string sensor with electromagnetic interference resistance.
[0036] Figure 5 The present invention is a flowchart of an optimal algorithm for the frequency estimation step of the vibrating-string signal of the frequency measurement method of the vibrating-string sensor with electromagnetic interference resistance.
[0037] Figure 6 It is a structural schematic diagram of the frequency measurement device of the vibrating-wire sensor with electromagnetic interference resistance of the present invention.
[0038] Figure 7 This is a frequency series diagram measured in a normal test environment of the present invention.
[0039] Figure 8 This is a frequency series diagram measured by the present invention in an electromagnetic interference environment. DETAILED DESCRIPTION
[0040] The present invention will be described below in conjunction with the accompanying drawings.
[0041] The present invention relates to a frequency measurement method of a vibrating string sensor with electromagnetic interference resistance, and proposes an improved frequency measurement method of a vibrating string instrument based on a frequency measurement circuit based on the pulse counting principle. Figure 2 As shown, the following steps are included:
[0042] 1. The steps for generating the vibrating string free vibration signal are as follows: applying an excitation signal to both ends of the frequency measuring coil of the vibrating string sensor, the vibrating string vibrates mechanically under the action of the alternating electromagnetic force, and then stopping the excitation signal, the vibrating string starts to vibrate freely, and the induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measuring coil is converted into a square wave signal after processing, and then converted into a pulse square wave signal after photoelectric isolation, and sent to the input capture pin of the microcontroller with input capture function.
[0043] Furthermore, the single chip microcomputer can generate an excitation signal through I / O1, which is sent to the power amplifier circuit for power amplification through photoelectric isolation, and then sent to the excitation coil. The vibrating string begins to vibrate under the action of the alternating electromagnetic force. At this time, the excitation signal is stopped, and the vibrating string begins to vibrate freely. The induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measurement coil is processed and converted into a square wave signal such as Figure 3 The signal waveform shown can be converted into a square wave signal after voltage amplification, bandpass filtering and shaping. The square wave signal is converted into a pulse square wave signal that can be directly processed by the microcontroller after optical isolation and sent to the input capture pin of the microcontroller with input capture function.
[0044] 2. The whole process capture step during the free vibration of the vibrating string is to capture the rising edge (or falling edge) of the pulse square wave signal input during the free vibration of the vibrating string of the vibrating string sensor through a single-chip microcomputer with an input capture function. At each rising edge (or falling edge) of the pulse square wave signal, the current timer count value is automatically stored in the capture register in the single-chip microcomputer to obtain a series of timer count values at all rising / falling edge moments during the whole process capture.
[0045] Specifically, the whole process capture frequency measurement principle of the single chip microcomputer with input capture function is as follows Figure 4 shown. Figure 4 In the figure, the high-speed standard clock f0 is the time base of the capture timer / counter, and the pulse square wave signal fx to be measured is connected to the pin IC1 of the microcontroller with input capture function. The capture function can be described as: when the capture is started, when each rising edge or falling edge event of the pulse square wave signal fx to be measured occurs, the microcontroller core automatically sends the count value Pi of the capture timer / counter to the capture register. For example, when capturing a pulse square wave signal on the rising edge, after the excitation signal stops, the first capture is performed on the rising edge of the first pulse square wave signal, the second capture is performed on the rising edge of the second pulse square wave signal, and the third capture is performed on the rising edge of the third pulse square wave signal... until the Nth capture is performed on the rising edge of the last pulse square wave signal. After the Nth capture, the capture process ends. Furthermore, the value Pi of the capture register can be sent to other registers for temporary storage. Because for each rising edge or falling edge of the pulse signal fx to be tested, the single-chip microcomputer automatically sends the count value of the capture timer / counter into the capture register, and sends the count value to other registers for temporary storage. Therefore, during the existence of the pulse square wave signal to be tested, when N rising edges or falling edges of the pulse square wave signal fx to be tested are obtained, the count value Pi (i=0, 1, 2, ...N-1) of the capture timer / counter constitutes the count value series of the capture timer / counter.
[0046] Furthermore, the whole process capture step during the free vibration of the vibrating string adopts an STM32 series microcontroller with input capture function, such as STM32L476VET6, by calling the HAL function to initialize input capture, configure the capture channel, start input capture, stop input capture and obtain interrupt processing.
[0047] Initialize the timer: Usually use the HAL_TIM_Base_Init() function to initialize the basic settings of the timer, and then use the HAL_TIM_IC_Init() function to initialize the input capture related settings.
[0048] Configure capture channel: Set capture channel parameters, such as capture edge (rising edge, falling edge, or both edges), pre-scaling factor, etc. These parameters are determined according to specific application requirements and input signal characteristics.
[0049] Start the timer: Use HAL_TIM_Base_Start() to start the timer counting, use HAL_TIM_IC_Start_IT() to start the input capture mode, and enable the interrupt.
[0050] Capture interrupt processing: If you need to perform specific operations when a capture event occurs, you can handle it in the interrupt service function. In the HAL library, capture interrupt processing is usually performed through a callback function, such as HAL_TIM_IC_CaptureCallback().
[0051] 3. The step of estimating the frequency of the vibrating string signal is to obtain a signal waveform period of the pulse square wave signal to be measured according to the difference between the count values of two adjacent captured timers, and then calculate the signal waveform period series of each pulse square wave signal during the whole capture process, and then estimate the frequency of the vibrating string signal through the screening algorithm.
[0052] Specifically, in Figure 4 In the figure, the difference between the count values of two adjacent capture timers / counters is the period of one signal waveform of the pulse square wave signal fx to be tested. Similarly, the period of the N signal waveforms of the entire pulse square wave signal to be tested can be obtained. Furthermore, the frequency fx of the pulse square wave signal to be tested can be estimated based on the period series of these N signal waveforms.
[0053] Preferably, the preferred algorithm flow chart of the vibrating string signal frequency estimation step is as follows: Figure 5 As shown, the method for estimating the frequency of the vibrating string signal includes the following steps, that is, analyzing the series of captured timing / counter values of all rising edges (or falling edges) of the pulse square wave signal generated by the vibrating string during the entire free vibration period:
[0054] 3.1. Calculate the frequency of each pulse square wave signal during the whole capture process;
[0055] The N capture timing counter values at the rising edge (or falling edge) within the duration of the square wave signal are recorded as P[i], i=0, 1, 2, ..., N-1; Assuming that the capture timing counter time base frequency is f0, the difference between two adjacent P[i] is the period of each square wave in the square wave series, Pi=P[i+1]-P[i], i=0, 1, 2, ..., N-2. Correspondingly, the frequency of each square wave in the square wave series is f[i]=f0 / Pi, i=0, 1, 2, ..., N-2;
[0056] 3.2. The frequency series f[i] is used as a number of initial data points and sorted in descending order to form an initial data set. The series sorted in descending order is recorded as f 0 [i], where i = 0, 1, 2, ..., N-2; and calculate the mean of the initial data set and standard deviation s 0 ;
[0057] 3.3. Using a screening algorithm, discard X% of the initial data points from the head and tail to form a first data set. Preferably, discard f 0 [i] Int(2.5%*(N-1)) large values and Int(2.5%*(N-1)) small values in the series, get the first
[0058] The data set is a new series f 1 [i], and calculate f 1 The mean of [i] and standard deviation s 1 ,as well as and The first mean deviation Δf 1 ;
[0059] 3.4. The first mean deviation Δf 1 Compared with the preset measurement error (the preset measurement error is specified by national / industry / enterprise standards, such as 0.1Hz), when the first mean deviation Δf 1 When the measurement error is less than or equal to the preset value of 0.1 Hz, the average value of the initial data set is used. and standard deviation s 0 The estimated frequency of the vibrating string signal is
[0060] 3.5. When the first mean deviation Δf 1 When the measurement error is greater than 0.1 Hz, the second data set is formed by discarding 2X% of the initial data points from the head and tail through the screening algorithm. Preferably, the f 0 [i] Int(5%*(N-1)) large values and Int(5%*(N-1)) small values in the series, the second data set is another new series f 2 [i], and calculate f 2 The mean of [i] and standard deviation s 2 ,as well as and The second mean deviation Δf 2 ;
[0061] 3.6. The second mean deviation Δf 2 Compared with the preset measurement error of 0.1Hz, when the second mean deviation Δf2 When it is less than or equal to 0.1Hz, according to the mean value of the first data set and standard deviation s 1 The estimated frequency of the vibrating string signal is
[0062] 3.7. When the second mean deviation Δf 2 When the measurement error is greater than 0.1 Hz, the initial data points of 3X% are discarded from the head and tail by the screening algorithm to form a third data set. Preferably, the initial data points of 3X% are discarded at the same time. 0 [i] Int(7.5%*(N-1)) large values and Int(7.5%*(N-1)) small values in the series, the third data set is another new series f 3 [i], and calculate f 3 The mean of [i] and standard deviation s 3 ,as well as and The third mean deviation Δf 3 ;
[0063] 3.8. The third mean deviation Δf 3 Compared with the preset measurement error of 0.1Hz, when the third mean deviation Δf 3 When it is less than or equal to 0.1Hz, according to the mean value of the second data set and standard deviation s 2 The estimated frequency of the vibrating string signal is
[0064] 3.9. Otherwise, the same procedure is repeated until the nth data set is formed by discarding nX% of the initial data points from the head and tail (the initial data points discarded from the head and tail reach 60%-70%) through the screening algorithm, and the mean and standard deviation of the nth data set, as well as the nth mean deviation between the nth data set and the n-1th data set are calculated, and the nth mean deviation is compared with the preset measurement error. When the nth mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated based on the mean and standard deviation of the n-1th data set. Preferably, until f is discarded at the same time, the frequency of the vibrating string signal is estimated based on the mean and standard deviation of the n-1th data set. 0 [i] Int(30%*(N-1)) large values and Int(30%*(N-1)) small values in the series, the twelfth data set is the last new series f 12 [i], thus, a total of 12 new series f are obtained j [i](j=1, 2, 3, ..., 12; i is calculated based on N-1 minus the number of discarded numbers); where Int() represents rounding the expression in the brackets; the same judgment and comparison processing are performed subsequently to estimate the frequency of the vibrating string signal.
[0065] It should be noted that in the above steps, 60% of the samples are screened out and Int(2.5%*(N-1)) large and small values are screened out each time. This is only a preferred embodiment. 60% of the total number of samples screened out and Int(5%*(N-1)) are not fixed. In the above algorithm, 60% of the samples are screened out and Int(2.5%*(N-1)) large and small values are discarded each time. These are empirical values, which are obtained based on repeated verification of multiple test data. These two parameters can be optimized again through actual test data.
[0066] According to a preferred embodiment, the present invention calculates f j [i](j=0,1,2,……,12) There are 13 series of sample means and standard deviations in total. The sample means and standard deviations of each series are recorded as and 0 、s 1 、s 2 ,……,s 12 ; and calculate the sample mean deviation separately Choose the first one so that Δf k (k=1, 2, 3, ..., 12) k less than or equal to the specified measurement error (the measurement error is specified by the national / industry / enterprise standard, such as 0.1Hz), take the sample mean The estimated value of the frequency of the vibrating string signal determined based on the sample mean is If all Δf calculated in this measurement k (k=1, 2, 3, ..., 12) are all greater than the measurement error of 0.1 Hz, then the measurement fails.
[0067] The present invention also relates to a frequency measurement device of a vibrating-wire sensor resistant to electromagnetic interference, which corresponds to the above-mentioned frequency measurement method of a vibrating-wire sensor resistant to electromagnetic interference, and can be understood as a device for implementing the above-mentioned frequency measurement method of a vibrating-wire sensor resistant to electromagnetic interference, such as Figure 6 As shown, it includes an exciting device and a vibration picking device. The exciting device includes a single-chip microcomputer, a photoelectric isolation circuit (or a first photoelectric isolation circuit) and a power amplifier circuit. The single-chip microcomputer at this time is the exciting part of the single-chip microcomputer; the vibration picking device includes a vibrating string free vibration signal generating module, a vibrating string free vibration period full process capture module and a vibrating string signal frequency estimation module connected in sequence. The vibrating string free vibration signal generating module includes a voltage amplifier circuit, a bandpass filter circuit, a shaping circuit and a photoelectric isolation circuit connected in sequence. The vibrating string free vibration period full process capture module and the vibrating string signal frequency estimation module are both arranged in the single-chip microcomputer. The single-chip microcomputer at this time is the vibration picking part of the single-chip microcomputer; the two ends A and B of the exciting / measuring coil on the vibrating string sensor side are respectively connected to the power amplifier circuit and the voltage amplifier circuit.
[0068] In the excitation device, the excitation signal generated by the single-chip microcomputer is sent to the excitation coil through the input and output port I / O1 after photoelectric isolation and power amplification to generate alternating electromagnetic force to excite the vibrating string. The vibrating string begins to vibrate under forced vibration. After the excitation signal stops, the vibrating string begins to vibrate freely. Due to the vibration and electromagnetic induction of the vibrating string, an induced electromotive force signal with an amplitude of 100uV to 1mV and the same frequency as the free vibration of the vibrating string will be generated in the pickup coil. This induced electromotive force signal changes according to the sinusoidal law. Depending on the sensor material and manufacturing process, it generally lasts from hundreds of ms to several seconds.
[0069] In the vibration pickup device, the vibrating string free vibration signal generation module converts the induced electromotive force signal generated by the free vibrating vibrating string in the frequency measurement coil into a square wave signal after processing, and then converts it into a pulse square wave signal after photoelectric isolation, and sends it to the input capture pin of the single chip microcomputer with input capture function. Figure 6 As shown in the figure, the induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measurement coil is converted into a square wave signal after voltage amplification, bandpass filtering and shaping, and then converted into a pulse square wave signal directly processed by the single-chip microcomputer after photoelectric isolation, and sent to the input capture pin of the single-chip microcomputer with input capture function. The voltage amplifier circuit amplifies the induced electromotive force signal generated in the pickup coil by about 2000 times and sends it to the bandpass filter circuit for filtering; since the frequency range of the vibrating string signal is between 400Hz and 6000Hz, the bandwidth of the bandpass filter is designed to be 400Hz to 6000Hz; the shaping circuit converts the amplified and filtered sinusoidal signal into a square wave signal. After the square wave signal passes through the photoelectric isolation circuit, the isolation between the single-chip microcomputer digital circuit and the vibrating string instrument analog signal processing circuit is realized, and the circuit's anti-electromagnetic interference capability is enhanced. The square wave signal output by the shaping circuit is converted into a pulse square wave signal that can be directly processed by the single-chip microcomputer and connected to the single-chip microcomputer input capture (Input Capture) pin IC1.
[0070] The module for capturing the whole process during the free vibration of the vibrating string uses a single-chip microcomputer with input capture function to capture the rising edge / falling edge of the pulse square wave signal input during the free vibration of the vibrating string sensor. At each rising edge / falling edge of the pulse square wave signal, the single-chip microcomputer automatically stores the current timer count value into the capture register, and obtains the timer count value series of all rising edge / falling edge moments during the whole process capture. The principle of full-process capture frequency measurement using a single-chip microcomputer with input capture function is as follows: Figure 4 shown.
[0071] Preferably, the whole process capture module during the existence of the free vibration of the vibrating string can adopt an STM32 series single-chip microcomputer with an input capture function, and perform input capture initialization, configuration of capture channels, start of input capture, stop of input capture, and acquisition of interrupt processing by calling HAL functions. The STM32 series single-chip microcomputer with an input capture function can immediately obtain the value of the current timing counter when capturing the rising edge or falling edge of the signal, thereby calculating the precise time or pulse width; and supports a variety of capture modes and input channel configurations, such as capturing single edge (rising edge or falling edge), double edge (rising and falling edges are captured simultaneously) and other capture modes to meet different application requirements; the capture function of the STM32 series single-chip microcomputer with an input capture function can be designed to use a combination of a hardware timer and a low power consumption mode to achieve efficient power consumption management, and in applications for periodic event measurement or time triggering, the capture function can run at the lowest power consumption; and its capture function can be configured to use interrupts or DMA (direct memory access) so that it can respond and process in time when a capture event occurs.
[0072] The vibration string signal frequency estimation module uses the single chip microcomputer with input capture function to obtain a signal waveform period of the pulse square wave signal to be measured according to the difference between the count values of the two adjacent captured timers, and then calculates the signal waveform period series of each pulse square wave signal during the whole process of capture, and then estimates the vibration string signal frequency through the screening algorithm for each signal waveform period series. The workflow diagram of this module can be referred to Figure 5 shown.
[0073] Furthermore, in the vibration signal frequency estimation module, after calculating the signal waveform period series of each pulse square wave signal during the whole process capture, the signal waveform period series is first sorted as a number of initial data points to form an initial data set, and the mean and standard deviation of the initial data set are calculated, and then the initial data points of X% are discarded from the head and tail through a screening algorithm to form a first data set, and the mean and standard deviation of the first data set, as well as the first mean deviation between the first data set and the initial data set are calculated, and the first mean deviation is compared with a preset measurement error. When the first mean deviation is less than or equal to the preset measurement error, the vibration signal frequency is estimated according to the mean and standard deviation of the initial data set; when the first mean deviation is greater than the preset measurement error, the initial data points of 2X% are discarded from the head and tail through a screening algorithm to form a second data set, and the mean and standard deviation of the second data set are calculated, and the second mean deviation is calculated. The second mean deviation of the data set and the first data set is compared, and the second mean deviation is compared with the preset measurement error. When the second mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the first data set; when the second mean deviation is greater than the preset measurement error, the initial data points of 3X% are discarded from the head and the tail through the screening algorithm to form a third data set, and the mean and standard deviation of the third data set, as well as the third mean deviation of the third data set and the second data set are calculated, and the third mean deviation is compared with the preset measurement error. When the third mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the second data set. Otherwise, this is repeated until the nth data set is formed by discarding the initial data points of nX% from the head and the tail through the screening algorithm, and the same judgment and comparison processing is performed to estimate the frequency of the vibrating string signal.
[0074] Furthermore, in the vibrating string signal frequency estimation module, a first data set is formed by discarding 5% of the initial data points from both the head and the tail with a percentage of 2.5% through a screening algorithm, a second data set is formed by discarding 10% of the initial data points from both the head and the tail with a percentage of 5% through a screening algorithm, and a third data set is formed by discarding 15% of the initial data points from both the head and the tail with a percentage of 7.5% through a screening algorithm, and so on, until a twelfth data set is formed by discarding 60% of the initial data points from both the head and the tail with a percentage of 30% through a screening algorithm. When the calculated 12 mean deviations are all greater than the preset measurement error, the measurement fails.
[0075] The following is a comparison of the accuracy of the equal-precision frequency measurement method / device and the anti-electromagnetic interference vibrating-string sensor frequency measurement method / device of the present invention under normal test environment and electromagnetic interference environment through specific experimental data.
[0076] The normal test environment refers to the laboratory environment, where there is no obvious electromagnetic interference source near the sensor and the test site; the electromagnetic interference environment refers to artificially generated electromagnetic interference, which is simulated by using a 600W electric drill that is frequently started and stopped near the sensor.
[0077] 1. Frequency measurement method / device with equal accuracy
[0078] Example 1: Normal test environment
[0079] The single chip microcomputer uses STM32L476VET6. The vibrating string frequency signal to be measured is connected to the single chip microcomputer through TIM2_ETR. TIM2 is a 32-bit counter. The TIM2 time base is set to 72MHz (high-frequency time base frequency fs). The frequency of the pulse signal to be measured is calculated by simultaneously counting the number of pulse signals to be measured Nx and the number of known high-frequency time bases Ns. Counter CNT1 counts the signal to be measured, and counter CNT2 counts the high-frequency time base signal. The frequency of the pulse signal to be measured is calculated by the calculation formula fx=fs*Nx / Ns.
[0080] Set the software preset gate to 400ms. After the software preset gate is started, CNT1 and CNT2 start counting at the same time when the first rising edge of the pulse signal to be tested arrives. After the software preset gate is closed, CNT1 and CNT2 stop counting when the first rising edge of the pulse signal to be tested arrives. Because the counting is synchronized with the rising edge of the pulse signal to be tested, the counting value of Nx does not have a counting error of ±1 word.
[0081] Under normal test conditions, the measurement data of five equal-precision frequency measurements are shown in Table 1.
[0082] Table 1 (Unit: Hz)
[0083] Serial number fs Nx N fx=Nx*fs / Ns Mean Deviation 1 72000000 292 28882098 727.92 0.004 2 72000000 292 28882613 727.91 0.016 3 72000000 292 28882158 727.92 0.004 4 72000000 292 28881938 727.93 0.006 5 72000000 292 28881260 727.95 0.026
[0084] From the measurement data in Table 1, it can be seen that under normal test conditions, the data is measured 5 times continuously and the sample mean of the frequency of the signal to be tested is calculated. The deviation between each measured value and the sample mean is calculated to be less than 0.1 (Hz).
[0085] Example 2: Electromagnetic interference environment
[0086] In the electromagnetic interference test environment, the five equal-precision frequency measurement data are shown in Table 2.
[0087] Table 2 (unit: Hz)
[0088] Serial number fs Nx N fx=Nx*fs / Ns 1 72000000 240 28873123 598.48 2 72000000 290 28871716 723.20 3 72000000 318 28857401 793.42 4 72000000 243 28861975 606.20 5 72000000 226 28887388 563.29
[0089] It can be seen from the measurement data in Table 2 that the measured value of Nx no longer complies with the requirement of the equal-precision frequency measurement principle that the count value of Nx does not have a ±1-digit count error, and a relatively large discreteness occurs, resulting in the measured frequency calculated according to the formula being distorted or wrong, indicating that the equal-precision frequency measurement method cannot resist electromagnetic interference at all.
[0090] 2. Method / device for measuring frequency of vibrating-wire sensor with electromagnetic interference resistance according to the present invention
[0091] The single-chip microcomputer uses STM32L476VET6. The frequency signal of the vibrating string to be measured is connected to the single-chip microcomputer through TIM2_ETR. TIM2 is a 32-bit counter. The TIM2 time base is set to 72MHz, and the rising edge is captured. At each rising edge, the single-chip microcomputer automatically stores the value of the timer / counter into the capture register, and obtains N timer / counter value series P[i], i=0,1,2,...,N-1. According to f[i]=72000000 / (P[i+1]-P[i]), i=0,1,2,...,N-2. The frequency of the series of square waves f[i], i=0,1,2,...,N-2 is calculated.
[0092] In order to display the measurement data in a graphical way, f[i], i = 0, 1, 2, ..., N-2, can be sent to the host computer through the serial port, and the frequency measurement data can be processed and displayed using Excel software.
[0093] Example 3: Normal test environment
[0094] The frequency f[i] of the entire square wave series is, Figure 7 As shown in the figure, the microcontroller TIM2_ETR pin captured N = 1402 times at the rising edge of the signal to be tested, and a total of 1401 signal waveforms were captured. Figure 3 and Figure 7 It can be seen that after the vibrating string is excited, it begins to vibrate freely. In the early stage of free vibration, the vibrating string has just started to vibrate and the frequency changes greatly. In the middle stage of free vibration, the vibrating string vibrates stably and the vibration frequency is relatively stable with little change. In the late stage of free vibration, the vibrating string gradually stops vibrating due to damping, and the frequency drops sharply until it reaches zero, indicating that the free vibration of the vibrating string has stopped.
[0095] Sort f[i] from large to small to get the series f 0 [i](i=0,1,2,……,1400); and discard f 0 [i] A series of Int(2.5%*(N-1))=35 large values and Int(2.5%*(N-1))=35 small values gives a series f 1 [i](i=0,1,2,……,1330); and discard f 0 [i] A series of 70 large values and 70 small values gives a series f2 [i](i=0,1,2,……,1260),……, while discarding f 0 [i] A series of 420 large values and 420 small values, resulting in a series f 12 [i](i=0,1,2,...,560); for f 0 [i](i=0, 1, 2,...,1400), f 1 [i](i=0,1,2,...,1330), f 2 [i](i=0,1,2,…,1260),…,f 12 [i](i=0,1,2,……,560), calculate the sample mean and standard deviation of each series, as well as the deviation of adjacent sample means, as shown in Table 3.
[0096] Table 3 (Unit: Hz)
[0097]
[0098] From the third row of Table 3, we can see that the sample mean deviation This indicates that the difference between the mean of the sample discarded this time and the mean of the sample before discarding is less than the specified measurement error. Therefore, the estimated value of the frequency of the vibrating string signal is
[0099] Example 4: Electromagnetic interference environment
[0100] The frequency f[i] of each square wave in the entire series is, Figure 8 As shown, the microcontroller TIM2_ETR pin captured N = 1459 times, and a total of 1458 signal waveforms were captured.
[0101] Sort f[i] from large to small to get the series f 0 [i](i=0,1,2,……,1457); while discarding f 0 [i] A series of Int(2.5%*(N-1))=36 large values and Int(2.5%*(N-1))=36 small values, resulting in a series f 1 [i](i=0,1,2,……,1385); and discard f 0 [i] A series of 72 large values and 72 small values gives a series f 2 [i](i=0,1,2,……,1313),……, while discarding f 0 [i] A series of 432 large values and 432 small values, resulting in a series f 12 [i](i=0,1,2,...,593); for f 0 [i](i=0, 1, 2,...,1457), f 1[i](i=0,1,2,...,1385), f 2 [i](i=0,1,2,…,1313),…,f 12 [i](i=0,1,2,……,593), calculate the sample mean and standard deviation of each series, as well as the deviation of adjacent sample means, as shown in Table 4.
[0102] Table 4 (Unit: Hz)
[0103]
[0104]
[0105] From row 7 of Table 4, we can see that the sample mean deviation This indicates that the difference between the mean of the sample discarded this time and the mean of the sample before discarding is less than the specified measurement error. Therefore, the estimated value of the vibrating string frequency is determined to be
[0106] Comparing the estimated values f of the vibrating string signal frequency in Example 3 and Example 4, the difference between the sample mean 726.1194 of the estimated value of the vibrating string frequency in the electromagnetic interference environment and the sample mean 726.028 of the estimated value of the vibrating string frequency in the normal test environment is 0.0914Hz<0.1Hz, which is less than the specified measurement error, indicating that the method has basically filtered out the influence of electromagnetic interference on the measurement. Therefore, the frequency measurement and estimation scheme proposed in the present invention has good anti-electromagnetic interference capability.
[0107] It should be noted that the above-described specific implementations can enable those skilled in the art to more fully understand the invention, but do not limit the invention in any way. Therefore, although this specification has described the invention in detail with reference to the drawings and embodiments, those skilled in the art should understand that the invention can still be modified or replaced by equivalents. In short, all technical solutions and improvements that do not deviate from the spirit and scope of the invention should be included in the protection scope of the patent for the invention.
Claims
1. A frequency measurement method of a vibrating-wire sensor resistant to electromagnetic interference, characterized in that: The following steps are involved: The vibrating string free vibration signal generation step includes applying an excitation signal to both ends of the frequency measurement coil of the vibrating string sensor, causing the vibrating string to vibrate mechanically under the action of an alternating electromagnetic force, and then stopping the excitation signal, causing the vibrating string to vibrate freely, and converting the induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measurement coil into a square wave signal after processing, and then converting it into a pulse square wave signal after photoelectric isolation, and sending it to an input capture pin of a single-chip microcomputer with an input capture function; The whole process capturing step during the continuation of the free vibration of the vibrating string is to capture the rising edge / falling edge of the pulse square wave signal input during the continuation of the free vibration of the vibrating string sensor through a single-chip microcomputer with an input capturing function. At each rising edge / falling edge of the pulse square wave signal, the current timer count value is automatically stored in the capture register in the single-chip microcomputer, so as to obtain a series of timer count values at all rising edge / falling edge moments during the whole process capturing; The step of estimating the frequency of the vibrating string signal is to obtain a signal waveform period of the pulse square wave signal to be measured according to the difference between the count values of two adjacent captured timers, and then calculate the signal waveform period series of each pulse square wave signal during the whole capture process, and then estimate the frequency of the vibrating string signal through the screening algorithm.
2. The frequency measurement method of a vibrating-wire sensor resistant to electromagnetic interference according to claim 1, characterized in that: In the step of estimating the frequency of the vibrating string signal, after calculating the signal waveform period series of each pulse square wave signal during the whole process capture, the signal waveform period series is first sorted as a number of initial data points to form an initial data set, and the mean and standard deviation of the initial data set are calculated, and then the initial data points of X% are discarded from the head and tail through a screening algorithm to form a first data set, and the mean and standard deviation of the first data set, as well as the first mean deviation of the first data set from the initial data set are calculated, and the first mean deviation is compared with a preset measurement error. When the first mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the initial data set; when the first mean deviation is greater than the preset measurement error, the initial data points of 2X% are discarded from the head and tail through a screening algorithm to form a second data set, and the mean and standard deviation of the second data set, as well as the second data set are calculated. The second mean deviation of the first data set is compared with the preset measurement error. When the second mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the first data set; when the second mean deviation is greater than the preset measurement error, 3X% of the initial data points are discarded from the head and the tail through the screening algorithm to form a third data set, and the mean and standard deviation of the third data set, as well as the third mean deviation of the third data set from the second data set, are calculated, and the third mean deviation is compared with the preset measurement error. When the third mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the second data set. Otherwise, the same process is repeated until the nth data set is formed by discarding nX% of the initial data points from the head and the tail through the screening algorithm, and the same judgment and comparison process is performed to estimate the frequency of the vibrating string signal.
3. The frequency measurement method of a vibrating-wire sensor resistant to electromagnetic interference according to claim 2, characterized in that: In the step of estimating the frequency of the vibrating string signal, when the percentage nX% of initial data points discarded from the head and the tail by the screening algorithm reaches 60%-70% of the initial data points, an nth data set is formed, and the mean and standard deviation of the nth data set, as well as the nth mean deviation between the nth data set and the n-1th data set are calculated, and the nth mean deviation is compared with a preset measurement error. When the nth mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated based on the mean and standard deviation of the n-1th data set; when the nth mean deviation is greater than the preset measurement error, the measurement fails.
4. The frequency measurement method of a vibrating-wire sensor resistant to electromagnetic interference according to any one of claims 1 to 3, characterized in that: In the vibrating string free vibration signal generation step, the induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measurement coil is converted into a square wave signal after voltage amplification, bandpass filtering and shaping, and then converted into a pulse square wave signal directly processed by the single chip microcomputer after photoelectric isolation.
5. The frequency measurement method of a vibrating-wire sensor resistant to electromagnetic interference according to any one of claims 1 to 3, characterized in that: The whole process capture step during the free vibration of the vibrating string adopts an STM32 series single-chip microcomputer with an input capture function, and performs input capture initialization, capture channel configuration, input capture startup, input capture stop, and interrupt processing by calling a HAL function.
6. A frequency measurement device of a vibrating-wire sensor resistant to electromagnetic interference, comprising an excitation device, wherein the excitation device applies an excitation signal to both ends of a frequency measurement coil of the vibrating-wire sensor, and the vibrating wire vibrates mechanically under the action of an alternating electromagnetic force, characterized in that: The invention also includes a vibration pickup device, which includes a vibration string free vibration signal generating module, a vibration string free vibration whole process capture module and a vibration string signal frequency estimation module connected in sequence. The excitation device stops the excitation signal, and the vibration string starts to vibrate freely. The vibration string free vibration signal generating module converts the induced electromotive force signal generated by the freely vibrating vibration string in the frequency measurement coil into a square wave signal after processing, and then converts it into a pulse square wave signal after photoelectric isolation, and sends it to the input capture pin of the single-chip microcomputer with input capture function; the vibration string free vibration whole process capture module detects the free vibration of the vibration string of the vibrating string sensor through the single-chip microcomputer with input capture function The rising edge / falling edge of the pulse square wave signal input during the duration is captured throughout the process. At each rising edge / falling edge of the pulse square wave signal, the current timer count value is automatically stored in the capture register in the single-chip microcomputer, and a timer count value series at all rising edge / falling edge moments during the whole process of capture is obtained; the vibration string signal frequency estimation module, the single-chip microcomputer with input capture function obtains a signal waveform period of the pulse square wave signal to be measured according to the difference between two adjacent captured timer count values, and then calculates the signal waveform period series of each pulse square wave signal during the whole process of capture, and then estimates the vibration string signal frequency through a screening algorithm for each signal waveform period series.
7. The frequency measurement device of a vibrating-wire sensor resistant to electromagnetic interference according to claim 6, characterized in that: In the vibration signal frequency estimation module, after calculating the signal waveform period series of each pulse square wave signal during the whole process capture, the signal waveform period series is first sorted as a number of initial data points to form an initial data set, and the mean and standard deviation of the initial data set are calculated, and then the initial data points of percentage X% are discarded from the head and tail through a screening algorithm to form a first data set, and the mean and standard deviation of the first data set, as well as the first mean deviation of the first data set from the initial data set are calculated, and the first mean deviation is compared with a preset measurement error. When the first mean deviation is less than or equal to the preset measurement error, the vibration signal frequency is estimated according to the mean and standard deviation of the initial data set; when the first mean deviation is greater than the preset measurement error, the initial data points of percentage 2X% are discarded from the head and tail through a screening algorithm to form a second data set, and the mean and standard deviation of the second data set, as well as the second data set are calculated. The second mean deviation of the first data set is compared with the preset measurement error. When the second mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the first data set; when the second mean deviation is greater than the preset measurement error, 3X% of the initial data points are discarded from the head and the tail through the screening algorithm to form a third data set, and the mean and standard deviation of the third data set, as well as the third mean deviation of the third data set from the second data set, are calculated, and the third mean deviation is compared with the preset measurement error. When the third mean deviation is less than or equal to the preset measurement error, the frequency of the vibrating string signal is estimated according to the mean and standard deviation of the second data set. Otherwise, the same process is repeated until the nth data set is formed by discarding nX% of the initial data points from the head and the tail through the screening algorithm, and the same judgment and comparison process is performed to estimate the frequency of the vibrating string signal.
8. The frequency measurement device of a vibrating-wire sensor resistant to electromagnetic interference according to claim 7, characterized in that: In the vibrating string signal frequency estimation module, a first data set is formed by discarding 5% of the initial data points from both the head and the tail with a percentage of 2.5% through a screening algorithm, a second data set is formed by discarding 10% of the initial data points from both the head and the tail with a percentage of 5% through a screening algorithm, and a third data set is formed by discarding 15% of the initial data points from both the head and the tail with a percentage of 7.5% through a screening algorithm, and so on, until a twelfth data set is formed by discarding 60% of the initial data points from both the head and the tail with a percentage of 30% through a screening algorithm. When the calculated 12 mean deviations are all greater than the preset measurement error, the measurement fails.
9. The electromagnetic interference resistant vibrating wire sensor frequency measurement device according to any one of claims 6 to 8, characterized in that: The vibrating string free vibration signal generating module comprises a voltage amplifying circuit, a bandpass filtering circuit, a shaping circuit and a photoelectric isolation circuit connected in sequence. The induced electromotive force signal generated by the freely vibrating vibrating string in the frequency measuring coil is converted into a square wave signal after voltage amplification, bandpass filtering and shaping in sequence, and then converted into a pulse square wave signal directly processed by a single chip microcomputer after photoelectric isolation, and sent to the input capture pin of the single chip microcomputer with input capture function.
10. The electromagnetic interference resistant vibrating wire sensor frequency measurement device according to any one of claims 6 to 8, characterized in that: The whole process capture module during the continuation of the free vibration of the vibrating string includes an STM32 series single-chip microcomputer with an input capture function, and performs input capture initialization, capture channel configuration, input capture startup, input capture stop, and interrupt processing by calling a HAL function.
