Angle calculation method, device and equipment for intelligent well lid and medium
By combining high-performance mode and low-power mode, and using the filtering algorithm and calibration mechanism of the three-axis accelerometer, the problem of response speed and power consumption of manhole cover angle calculation is solved, and fast response and high-precision angle output are achieved.
Patent Information
- Application Number
- CN202410851629.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-06
AI Technical Summary
Existing manhole cover angle calculation methods have shortcomings in response speed and power consumption. The six-axis gyroscope is high in cost and the three-axis acceleration sensor has a slow response speed in ultra-low power consumption situations and cannot achieve high real-time performance.
Using a combination of high-performance mode and low-power mode, through the filtering algorithm of the three-axis accelerometer data and the sliding average filter plus a stable counter, it achieves fast response and ultra-low power consumption, and performs three-axis accelerometer calibration and manhole cover level calibration. , to ensure the accuracy of angle calculation.
It achieves fast response and ultra-low power consumption of manhole cover angle calculation, reduces the zero drift error of the chip, ensures that the manhole cover can be automatically calibrated after construction, and improves the accuracy and real-time performance of angle calculation.
Smart Images

Figure CN118604385A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent manhole cover angle calculation, and in particular to an angle calculation method, device, equipment and medium for an intelligent manhole cover. Background Art
[0002] The current solutions for calculating the angle of manhole covers on the market mainly use six-axis solutions and three-axis acceleration traditional algorithm solutions; among them, a six-axis gyroscope is used to combine the data of the three-axis gyroscope and the three-axis accelerometer for calculation. The three-axis gyroscope can quickly determine whether it is in motion. If it is stationary, the angle can be calculated using the measured gravity acceleration value; specifically, the MCU is awakened by configuring the angular momentum change interrupt for the six-axis gyroscope, and the MCU then identifies that the smart manhole cover is in a stationary state when the angular momentum remains unchanged. At this time, the three-axis acceleration value is collected and the manhole cover deflection angle is calculated based on the basic principle of calculating the manhole cover deflection angle using the three-axis acceleration level. Although this method has made good progress in response speed and power consumption, the cost of the six-axis gyroscope is higher than that of the three-axis acceleration sensor.
[0003] The traditional algorithm for three-axis acceleration uses three-axis acceleration, uses periodic collection at a longer interval, and uses whether the total acceleration is 1g to determine whether it is stationary. If it is stationary, the angle can be calculated using the measured gravity acceleration value. In actual use, if ultra-low power consumption is to be achieved, the periodic collection time needs to be extended, and the response speed is slow. Specifically, the traditional algorithm for three-axis acceleration can be mainly divided into two schemes. Scheme 1: Wake up the MCU through the maximum value interrupt of the three-axis acceleration configuration. After the MCU wakes up, it starts to collect three-axis acceleration values. Whether the manhole cover is stationary is confirmed by whether the three-axis total acceleration is about 1g. After it is judged to be stationary, the manhole cover deflection angle is calculated based on the basic principle of calculating the manhole cover deflection angle using the three-axis acceleration level. Although Scheme 1 is low-cost, it will wake up frequently when the manhole cover is run over by a vehicle or is hit and vibrated by external forces, and the power consumption is unstable.
[0004] Solution 2, MCU wakes up periodically for data collection. Each time, more data needs to be collected for static judgment and angle calculation, and then the manhole cover deflection angle is calculated based on the basic principle of calculating the manhole cover deflection angle using the three-axis acceleration level. Although Solution 2 is low-cost, its periodic data collection consumes a lot of power and cannot achieve high real-time performance in situations where ultra-low power consumption is required.
[0005] In view of this, this application is filed. Summary of the invention
[0006] The present invention provides an angle calculation method, device, equipment and medium for an intelligent manhole cover, which can at least partially improve the above-mentioned problem.
[0007] To achieve the above object, the present invention adopts the following technical solutions: A method for calculating an angle of an intelligent manhole cover, comprising: When the power-on signal is obtained, the high-performance mode is entered, and the MCU runs at full speed with a high-speed clock. Every time a preset time is reached, the three-axis accelerometer data is obtained, and the three-axis accelerometer data is filtered in the high-performance mode to obtain the accurate angle value of the manhole cover; Determine whether the dormancy condition is met; If the MCU is in a dormant state, it periodically wakes up to collect the three-axis accelerometer data according to a preset period, performs rough calculations and judgment processing on the three-axis accelerometer data, generates a preliminary judgment result, and decides to continue to stay in dormancy or wake up to enter a low power consumption mode or a high power consumption mode according to the preliminary judgment result, and outputs the corresponding accurate angle value of the manhole cover, wherein, when entering the low power consumption mode, the three-axis accelerometer uses a data rate that reaches a preset height value to perform rough calculations and judgment processing; The three-axis accelerometer calibration and the manhole cover horizontal calibration are performed separately to obtain the final accurate angle value of the manhole cover.
[0008] The present invention also provides an angle calculation device for an intelligent manhole cover, which comprises: The high power consumption mode unit is used to enter the high performance mode when receiving the power-on signal. The MCU runs at full speed with a high-speed clock. Every time a preset time is reached, the three-axis accelerometer data is obtained and the three-axis accelerometer data is filtered in the high performance mode to obtain the accurate angle value of the manhole cover. A sleep determination unit, used to determine whether a sleep condition is met; The low-power mode unit is used for MCU in a dormant state, and periodically wakes up to collect three-axis accelerometer data according to a preset period, and performs rough calculation and judgment processing on the three-axis accelerometer data to generate a preliminary judgment result, and decides to continue to stay in sleep or wake up to enter a low-power mode or a high-power mode according to the preliminary judgment result, and outputs the corresponding accurate angle value of the manhole cover, wherein, when entering the low-power mode, the three-axis accelerometer uses a data rate that reaches a preset height value to perform rough calculation and judgment processing; The calibration unit is used to perform three-axis accelerometer calibration and manhole cover horizontal calibration processing respectively to obtain the final accurate angle value of the manhole cover.
[0009] The present invention also provides an angle calculation device for a smart manhole cover, comprising a memory and a processor, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement an angle calculation method for a smart manhole cover as described in any one of the above.
[0010] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program can be executed by a processor of a device where the computer-readable storage medium is located to implement an angle calculation method for an intelligent manhole cover as described in any one of the above items.
[0011] In summary, the angle calculation method for the smart manhole cover adopts the mutual cooperation of high-performance mode and low-power mode to achieve fast response and ultra-low power consumption; at the same time, it also adopts sliding average filter plus stable counter to achieve high-precision calculation output and fast response. Finally, the three-axis accelerometer is calibrated to reduce the zero drift error of the chip; the mechanism of horizontal calibration algorithm is adopted for the manhole cover to ensure that the manhole cover can be automatically calibrated according to the actual road surface after construction. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a flow chart of an angle calculation method for an intelligent manhole cover provided by a first embodiment of the present invention; Figure 2 is an operation mode switching flow chart provided by the first embodiment of the present invention; Figure 3 is a flowchart of angle collection and calculation in high performance mode provided by the first embodiment of the present invention; Figure 4 is a flowchart of angle collection and calculation in a low power consumption mode provided by the first embodiment of the present invention; Figure 5 is a gravitational acceleration direction diagram of the Y axis perpendicular to the ground provided by the first embodiment of the present invention; Figure 6 This is the calibration process of the Y three-axis accelerometer calibration provided by the first embodiment of the present invention; Figure 7 is a flow chart of level calibration provided by the first embodiment of the present invention; Figure 8 is an angle diagram when the XY plane is parallel to the ground provided by the first embodiment of the present invention; Fig. 9 This is an angle diagram when an angle exists between the XY plane and the ground provided by the first embodiment of the present invention; Fig.10 is a schematic diagram of the decomposition of the three-axis acceleration provided by the first embodiment of the present invention; Fig.11 is a schematic diagram of the synthesis of three-axis acceleration provided by the first embodiment of the present invention; Fig.12 It is a module schematic diagram of an angle calculation device for an intelligent manhole cover provided by the second embodiment of the present invention. DETAILED DESCRIPTION
[0013] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0014] refer to Figure 1 As shown, the first embodiment of the present invention discloses an angle calculation method for a smart manhole cover, which can be executed by an angle calculation device for a smart manhole cover (hereinafter referred to as an angle calculation device), and in particular, executed by one or more processors in the angle calculation device to implement the following method: S101, when a power-on signal is obtained, the high-performance mode is entered, and the MCU runs at full speed with a high-speed clock. Every time a preset time is reached, the three-axis accelerometer data is obtained, and the three-axis accelerometer data is filtered in the high-performance mode to obtain an accurate angle value of the manhole cover; Specifically, step S101 includes: the preset time is 10 ms, and the preset period is 10 s.
[0015] Determine whether the preset time has been reached; If not, proceed to the next round of preset time judgment; If yes, obtain the three-axis accelerometer data once, put the three-axis accelerometer data into the latest cache location, and determine whether the data storage exceeds 20 groups; When it is determined that the data storage does not exceed 20 groups, the next round of preset time judgment is entered; When it is determined that more than 20 groups of data are stored, the maximum and minimum values of the 20 groups of data in the latest cache location are screened out, and it is determined whether the maximum and minimum values meet the condition of being less than 200; If not, the earliest historical data is discarded, and the freed space is used to store the latest data, and the next round of preset time judgment is entered; If satisfied, the 20 sets of data are accumulated to obtain the average value, and the three-axis combined acceleration calculation is performed on the average value; When it is determined that the combined acceleration is not between 900 mg and 1100 mg, the continuous stability counter is cleared, the earliest historical data is discarded, and the freed space is used to store the latest data, and the next round of preset time judgment is entered; When it is determined that the combined acceleration is between 900 mg and 1100 mg, the continuous stability counter is incremented by 1, and the size of the continuous stability counter is determined; When it is determined that the continuous stability counter is greater than 500, the plane angle value corresponding to the three-axis accelerometer data is calculated and output; When it is determined that the continuous stable counter is less than or equal to 500, the earliest historical data is eliminated, and the vacated space is used to store the latest data, and then enter the next round of preset time judgment.
[0016] See also Figure 2 In this embodiment, in order to ensure the lowest energy consumption of the entire system, the operation mode is divided into two modes: high-performance mode and low-power mode. When entering the high-performance mode, the MCU runs at full speed with a high-speed clock, obtains the three-axis accelerometer data every 10ms, and performs a series of filtering operations on the data to finally obtain an accurate angle value. In this mode, the three-axis accelerometer uses a lower data rate, has low noise, can provide acquisition accuracy, and ensures accurate angle calculation.
[0017] See also Figure 3 In this embodiment, for the filtering algorithm in high-performance mode, sliding average filtering is used. Sliding average filtering refers to first establishing a data buffer in RAM, storing N sampled data in sequence, and discarding the earliest collected data each time a new data is sampled, and then calculating the arithmetic mean or weighted mean of the N data including the new data. In this way, a new average value can be calculated each time a sample is taken, thereby speeding up the data processing. Specifically, this method is to put the value read from the three-axis acceleration register of the three-axis accelerometer into a two-dimensional three-axis buffer for sliding average filtering. In addition, the value read from the register is an integer, and the integer is handed over to a low-power MCU without a floating-point operation unit for calculation, which consumes few instructions. The filtering algorithm only has addition and division, and the calculation is simple, consumes little time, and has low power consumption.
[0018] Combined with the basic principle of calculating the deflection angle of the manhole cover using the three-axis acceleration level, it can be known that only when the three-axis total gravity acceleration is approximately equal to 1g, can the three-axis data be used as three vectors to calculate the deflection angle. Therefore, a continuous and stable counter is designed here before the angle calculation to determine whether the measured manhole cover has met the angle calculation conditions. The continuous and stable counter can improve the efficiency of the MCU and reduce power consumption, and can also ensure that the angle output is valid. Among them, Figure 3 The "20 groups" is a parameter, which can be adjusted appropriately according to the actual response time and data output stability. The "maximum and minimum difference 200" is a parameter. The value of 200 is about 50mg calculated based on the output sensitivity of the three-axis acceleration range of ±8g. It is used to determine whether the output value is stable. The "continuous stable counter>500" is a parameter, which can be adjusted according to the actual response time.
[0019] Figure 3The parameters rxcom, rycom, and rzcom are: acceleration register values obtained by three-axis acceleration calibration compensation calculation; rxraw, ryraw, and rzraw are: register values directly obtained from the three-axis acceleration chip; rxadj, ryadj, and rzadjj are: three-axis register compensation values obtained by the compensation algorithm; AMCcom is: the manhole cover deflection value obtained by horizontal calibration compensation calculation; AMCraw is: the original value of the manhole cover angle calculation; Aadj is: the manhole cover horizontal calibration compensation value.
[0020] Among them, the basic principles of calculating the manhole cover deflection angle using the three-axis acceleration level include: If the chip is placed horizontally, the gravity components in the X and Y directions are 0g, while the gravity component in the Z axis direction is g. Figure 8 As shown, X=0; Y=0; Z=g. If there are some angles on both sides, then Fig. 9 Based on Fig. 9 The concept of angle in the equation is α=90°-ɑ1, β=90°-β1, γ=90°-γ1. The components of g on each axis are: Ax=g*cosα, Ay=g*cosβ, Az=g*cosγ. So Ax=g*cosα=g*cos(90°-ɑ1)=g*sinɑ1, Ay=g*sinβ1, Az=g*sinγ1.
[0021] like Fig.10 As shown: (where the size of each vertical dotted line is: gg=Ax*Ax+(g*cosα1)*(g*cosα1)), g*cosβ1=squr(gg-Ay*Ay), g*cosγ1=squr(gg-Az*Az).
[0022] According to solid geometry, g is equivalent to the diagonal of the cube, and Ax, Ay, and Az are equivalent to the three sides, as follows Fig.11 As shown, the size of the dotted line is equal to squr(Ay*Ay+Az*Az), so according to the Pythagorean theorem Ax*Ax+Ay*Ay+Az*Az=g*g. Fig.11 It can be known that (taking the X-axis as an example) sinα1=Ax / g, cosα1=squr(gg-Ax*Ax) / g, Tanα1=(Ax / g) / (squr(gg-Ax*Ax) / g) =Ax / squr(gg-Ax*Ax)=Ax / squr(Ay*Ay+Az*Az), Tanβ1=Ay / squr(Ax*Ax+Az*Az), Tanγ1=Az / squr(Ax*Ax+Ay*Ay).
[0023] Finally, the relationship between the acceleration sensor value and the angular velocity value (radian) is obtained: Tanα1=Ax / squr(Ay*Ay+Az*Az), Tanβ1=Ay / squr(Ax*Ax+Az*Az), Tanγ1=Az / squr(Ax*Ax+Ay*Ay). Among them, α1, β1, and γ1 are the radian values of the X, Y, Z axes and the horizontal line respectively, and Ax, Ay, and Az are the acceleration values on the three axes. Then the radian values are: α1=arctan(Ax / squr(Ay*Ay+Az*Az)), β1=arctan(Ay / squr(Ax*Ax+Az*Az)), γ1=arctan(Az / squr(Ay*Ay+Ax*Ax)). Next, we have to use the data format: radian=θπR / 180. In this way, θ=radian 180 / πR, where R is 1. The angle values of each axis are finally obtained: θx=α1180 / π=(arctan(Ax / squr(Ay*Ay+Az*Az)))*180 / π, θy=β1180 / π=(arctan(Ay / squr(Ax*Ax+Az*Az)))*180 / π, θz=γ1180 / π=(arctan(Az / squr(Ax*Ax+Ay*Ay)))*180 / π.
[0024] The C language implementation code is as follows: / ************************************************************ function name:G_Sensor_GetAngle Function declaration: Calculate the angle between the X / Y / Z axis and the vertical plane Suction parameter:f64mg3-axis acceleration input outlet parameters:angle The angle of the three axes corresponding to the vertical plane Return value: 0 angle is valid -1 Angle may be invalid other:Null **************************************************************** / int32s G_Sensor_GetAngle(FP64 *f64mg,FP32 *angle) { #define GET_OTHER_INDEX(n) ((i + n) % 3) FP64 mgtemp[3]; FP64 mgall; int8u i; int32s ret = -1; for(i = 0;i<3;i++) / *Calculate the square of the three-axis acceleration* / { mgtemp[i] = f64mg[i]* f64mg[i]; } mgall = sqrt(mgtemp[0] + mgtemp[1] + mgtemp[2]); / *Calculate the total acceleration of the three axes* / if(mgall<0) { mgall = -mgall; } if((mgall<900.0) || (mgall>1100.0)) / *Judge whether it is about 1 g* / { ret = -1; } else { ret = 0; } for(i = 0;i<3;i++) / *Calculate the angles of the three axes corresponding to the vertical plane* / { angle[i] = (FP32)atan(f64mg[i] / sqrt(mgtemp[GET_OTHER_INDEX(1)] +mgtemp[GET_OTHER_INDEX(2)])); angle[i] *= 57.2958f; / *Convert radians to degrees* / } return ret; } Taking the three-axis acceleration level Y-axis direction perpendicular to the ground after the actual installation of the intelligent manhole cover detector as an example, the angle of the manhole cover (AMC) = θy + 90.
[0025] S102, determining whether a sleep condition is met; S103, if the MCU is in a dormant state, it periodically wakes up to collect the three-axis accelerometer data according to a preset period, performs rough calculation and judgment processing on the three-axis accelerometer data, generates a preliminary judgment result, and decides to continue to stay in dormancy or wake up to enter a low power consumption mode or a high power consumption mode according to the preliminary judgment result, and outputs the corresponding accurate angle value of the manhole cover, wherein, when entering the low power consumption mode, the three-axis accelerometer uses a data rate that reaches a preset height value to perform rough calculation and judgment processing; Specifically, step S103 includes: waking up from low power consumption mode with a 10-second period; Quickly collect triaxial accelerometer data and roughly calculate the angle to determine whether the wake-up conditions are met; When the wake-up condition is met, it enters high power consumption mode; When it is determined that the angle change is less than 3 degrees, the low power mode will continue to wake up in a 10-second cycle.
[0026] When the sleep wake-up starts, clear the three-axis cumulative acceleration register value and the continuous stability calculator, and record the start time; Obtain three-axis acceleration data once to determine whether the combined acceleration is between 900mg and 1100mg; If not, clear the continuous stability counter and reacquire the three-axis acceleration data; If so, the continuous stability counter increments by 1, and the three-axis acceleration register values are accumulated to the preset values; When it is determined that the acquired time exceeds the preset time value, an exception is returned and the sleep continues; When it is determined that the continuous stability counter is less than 5, the three-axis acceleration data is acquired again; When it is determined that the continuous stability counter is greater than or equal to 5, the average value of the accumulated three-axis acceleration register is obtained and the corresponding plane angle value is output.
[0027] In this embodiment, when entering the low power mode, the MCU is in a dormant state, but it wakes up periodically to collect the three-axis accelerometer data, performs rough calculations and judgments on the data, and decides whether to continue to sleep or wake up to enter the low power mode based on the initial judgment results. In this mode, in order to minimize the running time, the three-axis accelerometer uses a higher data rate in this mode, and the collected data has a large error, but only rough calculations and judgments are performed, thereby reducing the running time in this mode and reducing power consumption. Among them, the 10-second periodic wake-up is a parameter that can be adjusted in combination with the actual response speed requirements; the angle change threshold is a parameter that can be adjusted in combination with actual conditions.
[0028] See also Figure 4In this embodiment, when entering the low power mode, the data rate configured by the fast angle acquisition three-axis accelerometer is 800Hz, that is, 1.25ms can output a set of acceleration data for calculation. The processing before the angle calculation is the multiplication and addition of integers, which takes a short time and has low power consumption. The main operation time consumption in the low power operation mode is shown in Table 1: Table 1
[0029] Among them, the ultra-low power MCU operating current is 5mA, and the sleep current is 2uA; the operating current is 240uA when the data rate of the three-axis accelerometer is 800Hz; taking a 1500mAh lithium-ion battery as an example, the service life is: 1500mAh÷0.3491266mAh≈4296.44 days≈11.77 years.
[0030] S104, performing three-axis accelerometer calibration and manhole cover horizontal calibration processing respectively to obtain a final accurate angle value of the manhole cover.
[0031] Specifically, step S104 includes: three-axis accelerometer calibration processing, specifically: When the calibration start signal is obtained, it is determined whether the preset time has been reached; If not, proceed to the next round of preset time judgment; If yes, obtain three-axis acceleration data once, and put the three-axis acceleration data into the preset latest cache location, and determine whether the data storage exceeds 20 groups; When it is determined that the data storage does not exceed 20 groups, the next round of preset time judgment is entered; When it is determined that more than 20 groups of data are stored, the maximum and minimum values of the 20 groups of data in the latest cache location are filtered out, and it is determined whether the maximum and minimum values meet the condition of being less than 200; If not, the earliest historical data is discarded, and the freed space is used to store the latest data, and the next round of preset time judgment is entered; If satisfied, accumulate these 20 sets of data, calculate the average, and get the original value of the three-axis acceleration; When the original value of the acceleration of the y-axis is greater than or equal to 0, calculate the first supplementary value and save it; When the original value of the acceleration of the y-axis is less than 0, the second supplementary value is calculated and saved.
[0032] See also Figure 5In this embodiment, there are two types of calibration for the angle calculation method for the smart manhole cover: three-axis accelerometer calibration and horizontal calibration. Among them, for the three-axis accelerometer calibration, since the MEMS silicon micro three-axis accelerometer chip has zero drift after it is manufactured, and the high temperature in the SMT process stage of equipment production will also cause zero drift. If there is zero drift, the chip is in a static state. The three-axis combined acceleration is not 1g, so the obtained data cannot be used for deflection calculation. Therefore, an acceleration calibration process must be added to the production test process after PCBA patching and whole machine assembly. This process must ensure that the product is placed horizontally and statically, and the three-axis acceleration value is calibrated through the correct horizontal plane.
[0033] Take the Y axis of the chip pointing to the ground as an example, as follows Figure 6 , Y=1g, X=0g, Z=0g, when zero drift occurs, the measured Y≠1g, X≠0g, Z≠0g, assuming that the gravity acceleration value measured from the chip at this time is: Y=gy, X=gx, Z=gz, if the original values of the three axes are gyraw, gxraw, gzraw. Then the calibration value of each axis is: gyadj=1-gyraw, gxadj=0-gxraw, gzadj=0-gzraw. The real value after compensation is: gycomp=gyraw+gyadj, gxcomp=gxraw+gxadj, gzcomp=gzraw+gzadj.
[0034] The calibration process of the three-axis accelerometer calibration is as follows Figure 5 As shown, the calibration in the MCU program only needs to calibrate the original value of the three-axis acceleration register read by the three-axis accelerometer, that is, the register value obtained will be calibrated when the Y-axis is perpendicular to the ground. According to the intelligent manhole cover detection terminal, the manhole cover is actually installed on the ceiling, that is, the flat surface of the terminal is facing upward and the arc surface is facing downward. During production operations, it is generally placed flat on the workbench, so the calibration direction of the Y-axis needs to be considered during calibration. The calibration of the three-axis accelerometer only needs to ensure that the Y-axis is perpendicular to the ground and the X / Z plane is parallel to the ground, so the direction of the Y-axis can be vertically upward or downward. You only need to add a direction judgment in the calibration process. For details, see Figure 5 Regarding the judgment logic of ryraw. Figure 5 In the table, ryraw, rxraw, and rzraw are the register values of the three-axis acceleration; ryadj, rxadj, and rzadj are the compensation values of the register values of the three-axis acceleration; and 1gRegv is the theoretical register value under 1g gravity acceleration. For the application of three-axis accelerometer calibration data, it can be seen that Figure 3 and Figure 4The rxcom=rxraw+rxadj;rycom=ryraw+ryadj;rzcom=rzraw+rzadj part in the.
[0035] Preferably, the horizontal calibration process of the manhole cover is specifically as follows: When the calibration start signal is obtained, the minimum value of the initialized maximum angle is 0 degrees, the maximum value of the minimum angle is 90 degrees, and the calibration time is 0; Obtaining a rough value of the measured angle from the low power operation model, and determining whether the rough value of the measured angle is greater than a minimum value of the maximum angle; If so, update the minimum value of the maximum angle, and determine whether the rough value of the measured angle is less than the maximum value of the minimum angle; If not, determining whether the rough value of the measured angle is less than the maximum value of the minimum angle; When it is determined that the rough value of the measured angle is greater than the maximum value of the minimum angle, the maximum value of the minimum angle is updated, and it is determined whether the difference between the minimum value of the maximum angle and the maximum value of the minimum angle is less than 5; When it is determined that the rough value of the measured angle is less than or equal to the maximum value of the minimum angle, determining whether the difference between the minimum value of the maximum angle and the maximum value of the minimum angle is greater than 5; If so, the calibration timer is reset to zero and it is determined whether the calibration timer exceeds 30 minutes; If not, determine whether the calibration timer exceeds 30 minutes; If it does not exceed, the rough value of the measured angle is obtained again from the low power operation model for judgment; If it exceeds, exit the low power operation mode, enter the high performance operation mode, and obtain the true value of the measured angle from the high performance operation mode; Determine whether the true value of the measured angle is less than 45, and is greater than or equal to the maximum value of the minimum angle, and less than or equal to the minimum value of the maximum angle; If so, the calibration is successful and the calibration data is saved; If not, the calibration has failed.
[0036] In this embodiment, since the manhole cover is laid on the ground, it is generally level with the ground. However, since the ground is not necessarily level, there is a certain angle difference between the manhole cover and the earth's plane. This angle difference does not conform to the cognition of daily life. Therefore, it is very necessary to design a set of horizontal calibration functions. The principle of horizontal calibration mentioned in the angle calculation method for smart manhole covers is relatively simple. The actual measured angle with the earth's plane after installation is: Araw, compensation value: Aadj=0-araw, and the value after compensation is: Acomp=Araw+Aadj.
[0037] The horizontal calibration of the smart manhole cover in this method includes three trigger points: starting the horizontal calibration 2 hours after installation; starting the calibration at 1 a.m. on the first day after installation; and starting the calibration by remote command control. The specific calibration process is as follows Figure 7 Among them, for the horizontal calibration data application, it can be seen that Figure 3 and Figure 4 The AMCcom=AMCraw+Aadj part in.
[0038] In summary, the angle calculation method for the smart manhole cover has two operation modes designed for high acquisition response speed and high acquisition accuracy while ensuring low power consumption; for the two different operation modes, two filtering algorithms under the two operation modes are involved. Finally, the calibration algorithm of the three-axis accelerometer and the horizontal calibration process and algorithm applied to the manhole cover are used for calibration to improve the accuracy of the angle value.
[0039] See also Fig.12 The second embodiment of the present invention discloses an angle calculation device for an intelligent manhole cover, which comprises: The high power consumption mode unit 201 is used to enter the high performance mode when receiving the power-on signal, and the MCU runs at full speed with a high-speed clock. Every time a preset time is reached, the three-axis accelerometer data is obtained, and the three-axis accelerometer data is filtered in the high performance mode to obtain an accurate angle value of the manhole cover; A sleep determination unit 202, used to determine whether a sleep condition is met; The low power mode unit 203 is used for the MCU to be in a dormant state, and to periodically wake up and collect the three-axis accelerometer data according to a preset period, and to perform rough calculations and judgment processing on the three-axis accelerometer data to generate a preliminary judgment result, and to decide whether to continue to stay in dormancy or wake up to enter a low power mode or a high power mode according to the preliminary judgment result, and output the corresponding accurate angle value of the manhole cover, wherein, when entering the low power mode, the three-axis accelerometer uses a data rate that reaches a preset height value to perform rough calculations and judgment processing; The calibration unit 204 is used to perform three-axis accelerometer calibration and manhole cover horizontal calibration processing respectively to obtain a final accurate angle value of the manhole cover.
[0040] The third embodiment of the present invention discloses an angle calculation device for a smart manhole cover, including a memory and a processor, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement an angle calculation method for a smart manhole cover as described in any one of the above.
[0041] The fourth embodiment of the present invention discloses a computer-readable storage medium storing a computer program, wherein the computer program can be executed by a processor of a device where the computer-readable storage medium is located to implement an angle calculation method for a smart manhole cover as described in any one of the above items.
[0042] Exemplarily, the above-mentioned devices and process steps can be implemented by a computer program. The computer program can be divided into one or more units. The one or more units are stored in the memory and executed by the processor to complete the present invention.
[0043] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0044] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the present invention by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0045] Wherein, if the electronic device or printer integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0046] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0047] The above is a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for calculating the angle of an intelligent manhole cover, characterized in that: include: When the power-on signal is obtained, the high-performance mode is entered, and the MCU runs at full speed with a high-speed clock. Every time a preset time is reached, the three-axis accelerometer data is obtained, and the three-axis accelerometer data is filtered in the high-performance mode to obtain the accurate angle value of the manhole cover; Determine whether the dormancy condition is met; If the MCU is in a dormant state, it periodically wakes up to collect the three-axis accelerometer data according to a preset period, performs rough calculations and judgment processing on the three-axis accelerometer data, generates a preliminary judgment result, and decides to continue to stay in dormancy or wake up to enter a low power consumption mode or a high power consumption mode according to the preliminary judgment result, and outputs the corresponding accurate angle value of the manhole cover, wherein, when entering the low power consumption mode, the three-axis accelerometer uses a data rate that reaches a preset height value to perform rough calculations and judgment processing; The three-axis accelerometer calibration and the manhole cover horizontal calibration are performed separately to obtain the final accurate angle value of the manhole cover.
2. The angle calculation method for a smart manhole cover according to claim 1, characterized in that: The preset time is 10 ms, and the preset period is 10 s.
3. The angle calculation method for a smart manhole cover according to claim 1, characterized in that: Every time a preset time is reached, the three-axis accelerometer data is obtained, and the three-axis accelerometer data is subjected to a filtering algorithm in a high-performance mode, specifically: Determine whether the preset time has been reached; If not, proceed to the next round of preset time judgment; If yes, obtain the three-axis accelerometer data once, put the three-axis accelerometer data into the latest cache location, and determine whether the data storage exceeds 20 groups; When it is determined that the data storage does not exceed 20 groups, the next round of preset time judgment is entered; When it is determined that more than 20 groups of data are stored, the maximum and minimum values of the 20 groups of data in the latest cache location are screened out, and it is determined whether the maximum and minimum values meet the condition of being less than 200; If not, the earliest historical data is discarded, and the freed space is used to store the latest data, and the next round of preset time judgment is entered; If satisfied, the 20 sets of data are accumulated to obtain the average value, and the three-axis combined acceleration calculation is performed on the average value; When it is determined that the combined acceleration is not between 900 mg and 1100 mg, the continuous stability counter is cleared, the earliest historical data is discarded, and the freed space is used to store the latest data, and the next round of preset time judgment is entered; When it is determined that the combined acceleration is between 900 mg and 1100 mg, the continuous stability counter is incremented by 1, and the size of the continuous stability counter is determined; When it is determined that the continuous stability counter is greater than 500, the plane angle value corresponding to the three-axis accelerometer data is calculated and output; When it is determined that the continuous stable counter is less than or equal to 500, the earliest historical data is eliminated, and the vacated space is used to store the latest data, and then enter the next round of preset time judgment.
4. The angle calculation method for a smart manhole cover according to claim 1, characterized in that: Periodically wake up to collect three-axis accelerometer data, and perform rough calculations and judgment processing on the three-axis accelerometer data to generate a preliminary judgment result, and decide to continue to stay in sleep or wake up to enter a low power consumption mode or a high power consumption mode according to the preliminary judgment result, specifically: Low power mode wakes up in 10 seconds period; Quickly collect triaxial accelerometer data and roughly calculate the angle to determine whether the wake-up conditions are met; When the wake-up condition is met, it enters high power consumption mode; When it is determined that the angle change is less than 3 degrees, the low power mode will continue to wake up in a 10-second cycle.
5. The angle calculation method for an intelligent manhole cover according to claim 4, characterized in that: In low power mode, the three-axis accelerometer uses the data rate that reaches the preset height value to perform rough calculations and judgment processing, specifically: When the sleep wake-up starts, clear the three-axis cumulative acceleration register value and the continuous stability calculator, and record the start time; Obtain three-axis acceleration data once to determine whether the combined acceleration is between 900mg and 1100mg; If not, clear the continuous stability counter and reacquire the three-axis acceleration data; If so, the continuous stability counter increments by 1, and the three-axis acceleration register value is accumulated to the preset value; When it is determined that the acquired time exceeds the preset time value, an exception is returned and the sleep continues; When it is determined that the continuous stability counter is less than 5, the three-axis acceleration data is acquired again; When it is determined that the continuous stability counter is greater than or equal to 5, the average value of the accumulated three-axis acceleration register is obtained and the corresponding plane angle value is output.
6. The angle calculation method for a smart manhole cover according to claim 1, characterized in that: The three-axis accelerometer calibration process is as follows: When the calibration start signal is obtained, it is determined whether the preset time has been reached; If not, proceed to the next round of preset time judgment; If yes, obtain three-axis acceleration data once, and put the three-axis acceleration data into the preset latest cache location, and determine whether the data storage exceeds 20 groups; When it is determined that the data storage does not exceed 20 groups, the next round of preset time judgment is entered; When it is determined that more than 20 groups of data are stored, the maximum and minimum values of the 20 groups of data in the latest cache location are filtered out, and it is determined whether the maximum and minimum values meet the condition of being less than 200; If not, the earliest historical data is discarded, and the freed space is used to store the latest data, and the next round of preset time judgment is entered; If satisfied, accumulate these 20 sets of data, calculate the average, and get the original value of the three-axis acceleration; When the original value of the acceleration of the y-axis is greater than or equal to 0, calculate the first supplementary value and save it; When the original value of the acceleration of the y-axis is less than 0, the second supplementary value is calculated and saved.
7. The angle calculation method for a smart manhole cover according to claim 1, characterized in that: The horizontal calibration of the manhole cover is as follows: When the calibration start signal is obtained, the minimum value of the initialized maximum angle is 0 degrees, the maximum value of the minimum angle is 90 degrees, and the calibration time is 0; Obtaining a rough value of the measured angle from the low power operation model, and determining whether the rough value of the measured angle is greater than a minimum value of the maximum angle; If so, update the minimum value of the maximum angle, and determine whether the rough value of the measured angle is less than the maximum value of the minimum angle; If not, determining whether the rough value of the measured angle is less than the maximum value of the minimum angle; When it is determined that the rough value of the measured angle is greater than the maximum value of the minimum angle, the maximum value of the minimum angle is updated, and it is determined whether the difference between the minimum value of the maximum angle and the maximum value of the minimum angle is less than 5; When it is determined that the rough value of the measured angle is less than or equal to the maximum value of the minimum angle, determining whether the difference between the minimum value of the maximum angle and the maximum value of the minimum angle is greater than 5; If so, the calibration timer is reset to zero and it is determined whether the calibration timer exceeds 30 minutes; If not, determine whether the calibration timer exceeds 30 minutes; If it does not exceed, the rough value of the measured angle is obtained again from the low power operation model for judgment; If it exceeds, exit the low power operation mode, enter the high performance operation mode, and obtain the true value of the measured angle from the high performance operation mode; Determine whether the true value of the measured angle is less than 45, and is greater than or equal to the maximum value of the minimum angle, and less than or equal to the minimum value of the maximum angle; If so, the calibration is successful and the calibration data is saved; If not, the calibration has failed.
8. An angle calculation device for an intelligent manhole cover, characterized in that: include: The high power consumption mode unit is used to enter the high performance mode when receiving the power-on signal. The MCU runs at full speed with a high-speed clock. Every time a preset time is reached, the three-axis accelerometer data is obtained and the three-axis accelerometer data is filtered in the high performance mode to obtain the accurate angle value of the manhole cover. A sleep determination unit, used to determine whether a sleep condition is met; The low-power mode unit is used for MCU in a dormant state, and periodically wakes up to collect three-axis accelerometer data according to a preset period, and performs rough calculation and judgment processing on the three-axis accelerometer data to generate a preliminary judgment result, and decides to continue to stay in sleep or wake up to enter a low-power mode or a high-power mode according to the preliminary judgment result, and outputs the corresponding accurate angle value of the manhole cover, wherein, when entering the low-power mode, the three-axis accelerometer uses a data rate that reaches a preset height value to perform rough calculation and judgment processing; The calibration unit is used to perform three-axis accelerometer calibration and manhole cover horizontal calibration processing respectively to obtain the final accurate angle value of the manhole cover.
9. An angle calculation device for an intelligent manhole cover, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement an angle calculation method for an intelligent manhole cover as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored, and the computer program can be executed by a processor of the device where the computer-readable storage medium is located to implement an angle calculation method for an intelligent manhole cover as described in any one of claims 1 to 7.
