CN115833491A - Angle calculation method and device, storage medium and electronic equipment - Google Patents

Angle calculation method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN115833491A
CN115833491A CN202111660474.5A CN202111660474A CN115833491A CN 115833491 A CN115833491 A CN 115833491A CN 202111660474 A CN202111660474 A CN 202111660474A CN 115833491 A CN115833491 A CN 115833491A
Authority
CN
China
Prior art keywords
tooth
sampling
level time
time
angle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111660474.5A
Other languages
Chinese (zh)
Other versions
CN115833491B (en
Inventor
马荣桐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suteng Innovation Technology Co Ltd
Original Assignee
Suteng Innovation Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suteng Innovation Technology Co Ltd filed Critical Suteng Innovation Technology Co Ltd
Priority to CN202111660474.5A priority Critical patent/CN115833491B/en
Priority to CN202310926500.7A priority patent/CN117040208A/en
Publication of CN115833491A publication Critical patent/CN115833491A/en
Application granted granted Critical
Publication of CN115833491B publication Critical patent/CN115833491B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02KDYNAMO-ELECTRIC MACHINES
    • H02K11/00Structural association of dynamo-electric machines with electric components or with devices for shielding, monitoring or protection
    • H02K11/20Structural association of dynamo-electric machines with electric components or with devices for shielding, monitoring or protection for measuring, monitoring, testing, protecting or switching
    • H02K11/21Devices for sensing speed or position, or actuated thereby
    • H02K11/22Optical devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02KDYNAMO-ELECTRIC MACHINES
    • H02K11/00Structural association of dynamo-electric machines with electric components or with devices for shielding, monitoring or protection
    • H02K11/30Structural association with control circuits or drive circuits
    • H02K11/35Devices for recording or transmitting machine parameters, e.g. memory chips or radio transmitters for diagnosis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Mathematics (AREA)
  • Power Engineering (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Algebra (AREA)
  • Operations Research (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Microelectronics & Electronic Packaging (AREA)
  • Optical Transform (AREA)

Abstract

The application discloses an angle calculation method, an angle calculation device, a storage medium and electronic equipment, wherein the method comprises the following steps: the method comprises the steps of obtaining high level time and low level time generated by each tooth in a code disc passing through a photoelectric switch under different preset temperatures and different preset rotating speeds, calibrating the code disc based on the high level time and the low level time, obtaining an angle from a tooth No. 0 to a tooth No. N in the code disc under the sampling temperature and the sampling rotating speed based on the calibrated code disc, obtaining target high level time and target low level time corresponding to the tooth No. N in the code disc under the sampling temperature and the sampling rotating speed, and determining an actual rotation angle value of the code disc based on the angle from the tooth No. 0 to the tooth No. N-1 in the code disc under the sampling temperature and the sampling rotating speed, the target high level time, the target low level time and the actual sampling time after rising edge jumping of the tooth No. N. This scheme of adoption, through code wheel and photoelectric switch's detection, realize improving the effect that rotational speed detected the accuracy.

Description

Angle calculation method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computers, and in particular, to an angle calculation method, an angle calculation apparatus, a storage medium, and an electronic device.
Background
The application of motors has penetrated into the aspects of daily life, up to the aerospace industry and down to toy parts, and the motors play an important role. In order to ensure the normal operation of the motor, the detection of the motor is an indispensable work.
Disclosure of Invention
The embodiment of the application provides an angle calculation method and device, a storage medium and electronic equipment, and the effect of improving the accuracy of rotating speed detection is achieved through detection of a code disc and a photoelectric switch. The technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an angle calculation method, where the method includes:
acquiring high level time and low level time generated when each tooth in a code disc passes through a photoelectric switch at different preset temperatures and different preset rotating speeds;
calibrating the code disc based on each high level time and each low level time;
based on the calibrated code disc, acquiring an angle corresponding to a tooth from 0 to a tooth from N in the code disc at a sampling temperature and a sampling rotation speed, and acquiring target high level time and target low level time corresponding to the tooth from N in the code disc at the sampling temperature and the sampling rotation speed, wherein N is greater than or equal to 0 and less than or equal to N, and N is the last tooth of the code disc, wherein the tooth from N is the tooth number corresponding to the current sampling time;
and determining the actual rotation angle value of the code disc based on the angle corresponding to the number 0 tooth to the number N tooth in the code disc under the sampling rotation speed of the sampling temperature, the target high level time, the target low level time and the actual sampling time after the rising edge of the number N tooth jumps.
In a second aspect, an embodiment of the present application provides an angle calculating apparatus, where the apparatus includes:
the time acquisition module is used for acquiring high level time and low level time generated by each tooth in the code disc passing through the photoelectric switch under different preset temperatures and preset rotating speeds;
the code disc calibration module is used for calibrating the code disc based on each high level time and each low level time;
the angle acquisition module is used for acquiring an angle from a tooth number 0 to a tooth number N in the code disc at a sampling temperature and a sampling rotating speed based on the calibrated code disc, and acquiring target high level time and target low level time corresponding to the tooth number N in the code disc at the sampling temperature and the sampling rotating speed, wherein N is greater than or equal to 0 and less than or equal to N, and N is the last tooth number of the code disc, wherein the tooth number N is the tooth number corresponding to the current sampling moment;
and the angle determining module is used for determining the actual rotation angle value of the coded disc based on the sampling temperature and the angle corresponding to the tooth from 0 to the tooth from N in the coded disc at the sampling rotating speed, the target high-level time, the target low-level time and the actual sampling time after the rising edge of the tooth from N jumps.
In a third aspect, embodiments of the present application provide a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the above-mentioned method steps.
In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
the code disc is calibrated by acquiring high level time and low level time generated by each tooth in the code disc through the photoelectric switch under different preset temperatures and different preset rotating speeds, and corresponding rotating speed and angle are calculated by acquiring the high level time and the low level time of each tooth under sampling temperatures after the code disc is calibrated, so that the actual rotating angle value of the code disc is obtained, and the effect of improving the rotating speed detection accuracy is realized.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a system architecture diagram of an angle calculation method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of an angle calculation method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating an example of a positional relationship between a code wheel and an electro-optical switch provided in an embodiment of the present application;
fig. 4 is a circuit schematic diagram of a shaping circuit according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram illustrating an example of a waveform processing process provided by an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating an example of information calibration provided by an embodiment of the present application;
FIG. 7 is an exemplary diagram of a method for determining tooth number 0 according to an embodiment of the present application;
fig. 8 is a schematic flowchart of an angle calculation method according to an embodiment of the present application;
fig. 9 is an exemplary schematic diagram of a linear interpolation method provided in an embodiment of the present application;
FIG. 10 is a schematic structural diagram of an angle calculating apparatus according to an embodiment of the present disclosure;
FIG. 11 is a schematic structural diagram of an angle calculating apparatus according to an embodiment of the present disclosure;
FIG. 12 is a schematic structural diagram of a code wheel calibration module according to an embodiment of the present application;
fig. 13 is a schematic structural diagram of an angle determining module according to an embodiment of the present disclosure;
FIG. 14 is a schematic structural diagram of an angle calculating apparatus according to an embodiment of the present disclosure;
fig. 15 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, the following detailed description of the embodiments of the present application will be made with reference to the accompanying drawings.
When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims.
In the description of the present application, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art as appropriate. Further, in the description of the present application, "a plurality" means two or more unless otherwise specified. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The existing schemes for detecting the rotating speed and the angle of the motor mainly comprise three types: photoelectric encoder, resolver and hall sensor. The photoelectric sensor is expensive in cost, needs accurate scales to detect the position, is easy to be influenced by strong vibration and strong corrosion environment if polluted by dirt causes wrong detection results, and is not suitable for severe construction environments; the cost of the rotary transformer is also high, and complicated hardware and software are needed for decoding the position and the rotating speed; the Hall sensor has the problems of easy damage and low precision.
Based on this, the embodiment of the application provides an angle calculation method, a code disc can be installed in a motor, teeth in the code disc are placed in a photoelectric switch, the code disc is calibrated based on high level time and low level time generated by the fact that each tooth in the code disc passes through the photoelectric switch under different preset temperatures and different preset rotating speeds, then target high level time and target low level time corresponding to a number N tooth under a sampling temperature are obtained, corresponding target rotating speed and an angle corresponding to the number 0 tooth to the number N-1 tooth are searched based on the sampling temperature, the target high level time and the target high level time, an angle value corresponding to actual sampling time after rising edge of the number N tooth jumps is obtained through calculation of the target rotating speed, and an actual rotating angle value of the code disc is obtained by combining the angle corresponding to the number 0 tooth to the number N-1 tooth, so that the rotating speed and the position of the motor are detected. Based on this application embodiment, through obtaining that different preset temperatures are different and predetermine high level time and low level time that each tooth in the code wheel produced through photoelectric switch and calibrate the code wheel to again through obtaining the high level time and the low level time of each tooth under the sampling temperature and calculate corresponding rotational speed and angle after the code wheel is calibrated, can improve the rate of accuracy that the angle calculated, through the detection of code wheel and photoelectric switch, realize improving the effect that rotational speed detected the accuracy.
The present application will be described in detail with reference to specific examples.
Please refer to fig. 1, which is a system structure diagram of an angle calculating method according to an embodiment of the present disclosure. The code disc, the photoelectric switch, the acquired data, the rotating speed and the angle are included in the figure 1. The obtained data are high level time and low level time generated by each tooth in the code disc through the photoelectric switch, and the rotating speed and the angle corresponding to the N number of teeth are obtained through calculation by obtaining the high level time, the low level time and the temperature, so that the rotating speed and the angle of the motor are detected.
The method comprises the steps of placing teeth of a coded disc in a photoelectric switch to ensure that each tooth can shield an optical path of the photoelectric switch, obtaining high level time and low level time generated by each tooth in the coded disc passing through the photoelectric switch under different preset temperatures and preset rotating speeds, calibrating the coded disc, obtaining target high level time and target low level time under a sampling temperature by using the calibrated coded disc, searching the high level time and the low level time generated by each tooth in the coded disc passing through the photoelectric switch under the different preset rotating speeds and different preset temperatures, determining the current target rotating speed and the corresponding angle, further obtaining the actual rotating angle value of the coded disc, and further realizing detection of the rotating speed and the position of a motor.
According to the method, the code disc is calibrated by acquiring the high level time and the low level time generated by each tooth in the code disc through the photoelectric switch under different preset temperatures and different preset rotating speeds, and the corresponding rotating speed and angle are calculated by acquiring the high level time and the low level time of each tooth under the sampling temperature after the code disc is calibrated, so that the actual rotating angle value of the code disc is obtained, and the effect of improving the rotating speed detection accuracy is realized.
The method may be executed on an angle calculating device, which may be a mobile terminal, including but not limited to: smart interactive tablets, personal computers, tablet computers, handheld devices, computing devices or other processing devices connected to a wireless modem, and the like. The user terminals may be called different names in different networks, for example: user equipment, access terminal, subscriber unit, subscriber station, mobile station, remote terminal, mobile device, user terminal, wireless communication device, user agent or user equipment, cellular telephone, cordless telephone, personal Digital Assistant (PDA), terminal equipment in a 5G network or future evolution network, and the like.
Please refer to fig. 2, which is a flowchart illustrating an angle calculating method according to an embodiment of the present disclosure. The embodiment of the present application is described by taking a mobile terminal as an example, and the angle calculation method may include the following steps:
s101, acquiring high level time and low level time generated when each tooth in a code disc passes through a photoelectric switch at different preset temperatures and different preset rotating speeds;
in one embodiment, the coded disc is placed in an environment with constant temperature and rotates at a constant speed, and the high level time and the low level time generated when each tooth of the coded disc passes through the photoelectric switch are recorded; after the data of each tooth is recorded, the rotating speed is changed for a plurality of times while the temperature is kept unchanged, wherein it can be understood that the coded disc is controlled to rotate at a constant speed at each rotating speed. Recording high level time and low level time generated when each tooth passes through the photoelectric switch under each rotating speed state; and changing the temperature for many times, keeping the coded disc to rotate at a constant speed according to each rotating speed when data is recorded, and recording high level time and low level time generated when each tooth passes through the photoelectric switch under different preset temperatures and different preset rotating speeds.
When recording data, the gear of the code disc is nested in the photoelectric switch, as shown in fig. 3, the teeth of the code disc can be ensured to shield the optical path of the photoelectric switch, when the teeth shield the optical path of the photoelectric switch, the gear is at a high level, and when the teeth do not shield the optical path of the photoelectric switch, the gear is at a low level.
When each tooth passes through the photoelectric switch, shaping processing is performed through a hardware circuit as shown in fig. 4, so that a signal generated when each tooth passes through the photoelectric switch becomes a square wave signal, that is, the effect shown in fig. 5 is obtained. The voltage waveform of the electrical signal generated by the teeth in the code wheel passing through the photoelectric switch in FIG. 4 is the unprocessed waveform in FIG. 5, and the electrical signal passes through the comparator and U REF By comparison, the processed waveform of fig. 5, i.e., a square wave, is obtained. The processing is done because the square wave gives the microcontroller a more appropriate detection period and the detected period is more accurate.
The rotation speed and the temperature of each change are not limited herein, and may be set according to actual conditions, and one possible method is to set the temperature and the rotation speed according to a certain difference as shown in table 1. It should be noted that, when setting the temperature and the rotation speed, the temperature and the rotation speed are uniformly distributed as much as possible to avoid generating a large error, and meanwhile, the temperature is considered as the influence of the equipment, so that the problem that the performance of the equipment is interfered by an excessively high or excessively low temperature, and the practicability and the accuracy of data are influenced is avoided.
Further, after obtaining the high level time and the low level time corresponding to each tooth in the code wheel at different preset temperatures and different preset rotating speeds in table 1, the high level time and the low level time are summed to obtain the rotating time corresponding to each tooth in the code wheel at different preset temperatures and different preset rotating speeds as shown in table 2.
Further, after the table 2 is obtained, the rotation time corresponding to each tooth in the code wheel at different preset temperatures and different preset rotation speeds in the table 2 is summed, so that the total rotation time of one circle of rotation of the code wheel at different preset temperatures and different preset rotation speeds shown in the table 3 is obtained, and a data basis is provided for subsequent code wheel calibration.
Further, after obtaining the high level time and the low level time corresponding to each tooth in the code wheel at different preset temperatures and different preset rotation speeds and the rotation time and the total rotation time corresponding to each tooth, the angle corresponding to each tooth in the code wheel at different preset temperatures and different preset rotation speeds shown in table 4 can be obtained according to the ratio of the rotation time corresponding to each tooth to the total rotation time. For example, if the time for the code wheel to pass through the tooth number 0 is 5ns, the total rotation time is 150ns, and the angle for one rotation of the code wheel is 360 degrees, the angle corresponding to the tooth number 0 is 12 degrees.
Wherein Th in Table 1 is high level time, tl is low level time, n is total number of teeth of code disc, and T1 is high level time generated by number 0 teeth passing through photoelectric switch when code disc rotates at 300rpm under-30 deg.C.
Wherein t in table 2 is the rotation time, n is the total number of teeth of the code wheel, and t1 is the rotation time of the number 0 teeth when the code wheel rotates at the rotating speed of 300 revolutions per minute at-30 ℃.
Wherein TN in Table 3 is the total rotation time, TN1 is the total rotation time of one revolution of the code wheel when the code wheel rotates at the rotation speed of 300 revolutions per minute at-30 ℃.
Wherein, theta in table 4 is the rotating angle of each tooth, and theta 1 is the rotating angle of the number 0 tooth when the code disc rotates at the rotating speed of 300 revolutions per minute at minus 30 ℃.
TABLE 1
Figure BDA0003446833140000071
TABLE 2
Figure BDA0003446833140000072
Figure BDA0003446833140000081
TABLE 3
Figure BDA0003446833140000082
TABLE 4
Figure BDA0003446833140000083
Figure BDA0003446833140000091
S102, calibrating the code disc based on each high level time and each low level time;
calculating theoretical values of high level time and low level time generated by each tooth in a code disc passing through a photoelectric switch at different temperatures, calibrating the high level time and the low level time of each tooth based on the theoretical values, considering that a calibration result is correct if errors of the recorded high level time and low level time and the corresponding theoretical values are within a preset error range, and considering that a certain link in a recording process has a problem if the high level time and/or the low level time recorded by one tooth under a certain condition and the corresponding theoretical values are larger than the preset error range, and checking the code disc and a hardware circuit to determine whether the fault exists.
The preset error range may be set according to actual conditions, and is not limited herein. One possible method is to set the error range within ± 10%, and if the error is within ± 10%, the calibration result is considered to be correct, and if the error is greater than ± 10%, the code wheel and/or the hardware circuit needs to be checked.
The effect achieved by calibrating the code disc at different temperatures is shown in fig. 6, and at a certain temperature, the rotating speed corresponding to each tooth in the code disc shows a result that the rotating speed is within a certain range through calibration.
S103, acquiring an angle corresponding to a tooth from 0 to a tooth from N in the code disc at a sampling temperature and a sampling rotating speed based on the calibrated code disc, and acquiring target high-level time and target low-level time corresponding to the tooth from N in the code disc at the sampling temperature and the sampling rotating speed, wherein N is greater than or equal to 0 and less than or equal to N, and N is the last tooth of the code disc, wherein the tooth from N is the tooth number corresponding to the current sampling moment;
after the code disc is calibrated, the angle from 0 tooth to N tooth in the code disc under the sampling temperature and the sampling rotating speed can be obtained through table lookup, and then the target high level time and the target low level time corresponding to the N tooth in the code disc under the sampling temperature and the sampling rotating speed are obtained through real-time detection.
As shown in FIG. 7, the number 0 tooth is a tooth with a large hollow in the code wheel, and the widths of other teeth in the code wheel are kept consistent so as to be convenient for distinguishing.
The number N teeth can be teeth passing through the photoelectric switch at the current moment when real-time detection is carried out in the code disc.
The target high-level time and the target low-level time can be high-level time and low-level time generated by N teeth in a code disc passing through a photoelectric switch under the condition of acquiring sampling temperature and sampling rotating speed through real-time detection, and the current condition needs to be detected in real time because the code disc cannot be ensured to always keep operating and rotating.
S104, determining an actual rotation angle value of the code wheel based on the angle from the number 0 tooth to the number N-1 tooth in the code wheel under the sampling temperature and the sampling rotation speed, the target high-level time, the target low-level time and the actual sampling time after the rising edge of the number N tooth jumps;
after obtaining the angle from the number 0 tooth to the number N-1 tooth in the code disc under the sampling temperature and the sampling rotation speed and the target high level time and the target low level time corresponding to the number N tooth, multiplying the rotation time corresponding to the number N tooth obtained by adding the target high level time and the target low level time by the obtained angle of the number N tooth to obtain the target rotation speed corresponding to the number N tooth, multiplying the target rotation speed by the preset sampling period corresponding to the number N tooth to obtain the angle change when the rising edge of the number N tooth jumps, combining the angles respectively corresponding to the number 0 tooth to the number N-1 tooth, adding the angle values corresponding to the actual sampling time after the rising edge of the number N tooth jumps after adding and summing the angles, and obtaining the actual rotation angle value of the code disc.
By adopting the embodiment of the application, the code disc is calibrated by acquiring the high level time and the low level time generated by each tooth of the code disc through the photoelectric switch under different preset temperatures and different preset rotating speeds, and the corresponding rotating speed and angle are calculated by acquiring the high level time and the low level time of each tooth under the sampling temperature after the code disc is calibrated, so that the actual rotating angle value of the code disc is obtained, and the effect of improving the rotating speed detection accuracy is realized.
Please refer to fig. 8, which is a flowchart illustrating an angle calculating method according to an embodiment of the present disclosure. The embodiment of the present application is described by taking a mobile terminal as an example, and the angle calculation method may include the following steps:
s201, acquiring high level time and low level time generated when each tooth in a coded disc passes through a photoelectric switch at different preset temperatures and different preset rotating speeds;
specifically, refer to step S101, which is not described herein.
S202, determining the maximum value of low level time generated when each tooth in the code disc passes through the photoelectric switch under different preset temperatures and preset rotating speeds;
after the coded disc and the hardware circuit can work normally and the generated error is in a receivable range, the maximum value of low level time generated when each tooth in the coded disc passes through the photoelectric switch under different preset temperatures and different preset rotating speeds is determined, and preparation is made for positioning each tooth in the coded disc subsequently.
And S203, determining the tooth corresponding to the maximum value as a No. 0 tooth.
After the maximum value of low level time generated by each tooth in the code disc passing through the photoelectric switch at different preset temperatures and different preset rotating speeds is determined, the tooth corresponding to the maximum value is taken as a No. 0 tooth in the code disc, as shown in FIG. 3, the left side of the hollow part is the No. 0 tooth, and the right side of the hollow part is the No. 1 tooth.
S204, acquiring high-level theoretical time and low-level theoretical time generated when each tooth in the coded disc passes through the photoelectric switch at different preset temperatures and preset rotating speeds;
and calculating high-level theoretical time and low-level theoretical time generated when each tooth in the code disc passes through the photoelectric switch under different preset temperatures and preset rotating speeds.
It should be noted that, due to the fact that the conduction characteristics of the photoelectric switches at different temperatures are changed, the duty ratio of the pulse signal generated by each tooth passing through the photoelectric switch is changed; meanwhile, because the slope of the transition from low level to high level of the original signal of the photoelectric switch at different rotating speeds is different, and the forward and backward duty ratios of the comparator are also different, the calculation is needed for the relevant theoretical data at different temperatures, and the preparation in the aspect of data is made for the subsequent calibration of the code disc.
The duty ratio refers to a ratio of a time occupied by the high level in one period, that is, a ratio of a period time occupied by the high level to the whole period time.
The specific theoretical data can be calculated according to the temperature in the actual experiment, and the temperature setting is not specifically limited herein.
S205, if the high level time generated when each tooth in the code disc passes through the photoelectric switch at different preset temperatures and different preset rotating speeds and the corresponding high level theoretical time are within an error range, and the low level time generated when each tooth in the code disc passes through the photoelectric switch at different preset temperatures and different preset rotating speeds and the corresponding low level theoretical time are within an error range, determining that the code disc is successfully calibrated.
After determining high level time and corresponding high level theoretical time generated when each tooth in the code disc passes through the photoelectric switch at different preset temperatures and different preset rotating speeds and determining low level time and corresponding low level theoretical time generated when each tooth in the code disc passes through the photoelectric switch at different preset temperatures and different preset rotating speeds, comparing the data one by one, and if the difference between the obtained data and the theoretical data is within a preset error range, determining that the code disc is successfully calibrated; if the difference between the acquired data and the theoretical data is larger than the preset error range, the code disc and the hardware circuit need to be checked to determine whether the damage occurs.
The preset error range may be set according to actual conditions, and is not limited herein. One possible method is to set the error range within ± 10%, and if the error is within ± 10%, the calibration result is considered to be correct, and if the error is greater than ± 10%, the code wheel and/or the hardware circuit needs to be checked.
Collecting first high level time and first low level time corresponding to the N-th tooth in the code disc at sampling temperature;
and taking the target tooth to be detected as the N-numbered tooth, and collecting the first high level time and the first low level time corresponding to the N-numbered tooth in the coded disc under the sampling temperature.
Wherein, N is greater than or equal to 0 and less than or equal to N, N is the number of the last tooth of the code disc, for example, if the code disc has 60 teeth in total, N is 59.
S206, acquiring a sampling temperature and a sampling rotating speed and judging whether the sampling temperature and the sampling rotating speed are the same as a preset temperature and a preset rotating speed or not;
the method comprises the steps of obtaining the sampling temperature and the sampling rotating speed of a code disc at the current moment, comparing the obtained sampling temperature and the obtained sampling rotating speed with the preset temperature and the preset rotating speed, and judging whether the sampling temperature and the preset temperature as well as the sampling rotating speed are the same as the preset rotating speed.
The preset temperature and the preset rotation speed may be information of the temperature and the rotation speed existing when the code wheel is calibrated previously, for example, the temperatures of-30 ℃, -10 ℃ and the like and the rotation speeds of 300rpm, 600rpm and the like in table 1. When the sampling temperature is compared with the preset temperature, if the sampling temperature is-30 ℃, a corresponding numerical value can be found in a table comprising the preset temperature, the sampling temperature is the same as the preset temperature, and if the sampling temperature is-19 ℃, the corresponding numerical value cannot be found in the table comprising the preset temperature, the sampling temperature is different from the preset temperature. The comparison method of the sampling rotating speed and the preset rotating speed is the same as the comparison method of the sampling temperature and the preset temperature.
And S207, if the sampling temperature and the sampling rotating speed are different from the preset temperature and the preset rotating speed, acquiring the corresponding angle from the number 0 tooth to the number N tooth of the coded disc under the sampling temperature and the sampling rotating speed by adopting an interpolation method.
Acquiring high level time and low level time generated by a photoelectric switch corresponding to coded disc teeth from 0 to N under the prestored sampling temperature and sampling rotating speed;
acquiring the sum of high level time and low level time from the No. 0 tooth to the No. N tooth, calculating the proportion of the sum of the high level time and the low level time from the No. 0 tooth to the No. N tooth in a detection period, and calculating the corresponding angle of the coded disc from the No. 0 tooth to the No. N tooth under the sampling temperature sampling rotating speed according to the proportional relation; or the like, or, alternatively,
when sampling temperature is different with one of presetting the temperature, the sampling rotational speed is the same with one of presetting the rotational speed, acquires under sampling temperature and sampling rotational speed that code wheel number 0 tooth corresponds to number N tooth, includes:
carrying out linear interpolation on the sampling temperature value to obtain high level time and low level time corresponding to the number 0 tooth to the number N tooth of the coded disc under the sampling rotating speed of the sampling temperature; and calculating the proportion of the sum of the high level time and the low level time from the number 0 tooth to the number N tooth in one detection period, and calculating the corresponding angle from the number 0 tooth to the number N tooth of the coded disc at the sampling rotating speed of the sampling temperature according to the proportional relation.
The main method of performing linear interpolation processing on the data is, as shown in fig. 9, to connect each coordinate in the coordinate system shown in fig. 9 by a curve as smooth as possible, so as to obtain a high level time and a low level time generated by each tooth in the code wheel passing through the photoelectric switch at each temperature and at different rotation speeds, that is, some undetected data are obtained by a linear interpolation processing method, so that accurate data are obtained as much as possible while actual time spent by the experiment is reduced.
The example of fig. 9 is only to show the process of linear interpolation, and does not represent any specific data in the embodiment of the present application.
Or the like, or, alternatively,
when sampling temperature is the same with one of the preset temperature, sampling rotational speed is different with one of the preset rotational speed, obtains under sampling temperature and sampling rotational speed code wheel No. 0 tooth to the angle that No. N tooth corresponds, include:
carrying out linear interpolation on the sampling rotating speed to obtain high level time and low level time corresponding to the number 0 tooth to the number N tooth of the coded disc under the sampling rotating speed of the sampling temperature; calculating the proportion of the sum of high level time and low level time from the number 0 tooth to the number N tooth in one detection period, and calculating the corresponding angle from the number 0 tooth to the number N tooth of the coded disc at the sampling rotating speed of the sampling temperature according to the proportional relation;
or the like, or, alternatively,
when sampling temperature is different with any temperature of predetermineeing, and the rotational speed of sampling is different with any rotational speed of predetermineeing, acquires under sampling temperature and sampling rotational speed that the angle that code wheel number 0 tooth corresponds to number N tooth, include:
carrying out linear interpolation on the sampling temperature to obtain high level time and low level time corresponding to the number 0 tooth to the number N tooth of the coded disc at a preset rotating speed under the sampling temperature;
carrying out linear interpolation on the sampling rotating speed to obtain high level time and low level time corresponding to the number 0 tooth to the number N tooth of the coded disc at the sampling rotating speed;
and calculating the proportion of the sum of the high level time and the low level time from the number 0 tooth to the number N tooth in one detection period, and calculating the corresponding angle from the number 0 tooth to the number N tooth of the coded disc at the sampling rotating speed of the sampling temperature according to the proportional relation.
S208, searching the sampling temperature and the angle from the number 0 tooth to the number N tooth of the sampling rotating speed in the angle corresponding to each tooth of the coded disc at different preset temperatures and different preset rotating speeds;
after the code disc is calibrated, the corresponding angles from the number 0 tooth to the number N tooth at the sampling temperature in the corresponding angles of all the teeth in the code disc at different preset temperatures and different preset rotating speeds are obtained through table lookup, and preparation is made for subsequently calculating the target rotating speed of the number N tooth.
For example, the sampling temperature is-30 ℃, the sampling rotation speed is 300rpm, the angles A1, A5, \8230;, an from No. 0 teeth to No. N at-30 ℃ and the code disc rotation speed is 300rpm can be obtained by looking up a table 4.
S209, obtaining a target rotating speed corresponding to the N tooth based on the target high level time and the target low level time corresponding to the N tooth and the angle corresponding to the N tooth;
and obtaining target high level time and target low level time corresponding to the N-th tooth in the coded disc, adding the target high level time and the target low level time to obtain target rotation time, and calculating the target rotating speed corresponding to the N-th tooth through a formula (1) according to the target rotation time and the target rotation angle by combining the obtained angle corresponding to the N-th tooth.
ω n = θ n ÷ t equation (1)
And theta N is an angle corresponding to the N-numbered teeth, t is target rotation time, and omega N is the target rotation speed of N.
It should be noted that, in the actual rotation, it is not ensured that the code wheel is always in a state of uniform rotation, so the actual rotation speed of the number N tooth needs to be calculated according to the angle of the number N tooth and the target rotation time.
S210, thetak =sigma (theta (0) + theta (1) + \8230, + theta (N-1)) + ∑ omega N × Ts, the thetak is the actual rotation angle value, the theta (0) is the angle corresponding to the tooth with the number 0, the theta (1) is the angle corresponding to the tooth with the number 1, the theta (N-1) is the angle corresponding to the tooth with the number N-1, the omega N is the target rotation speed, the Ts is the preset sampling period, and the sigma omega N × Ts is the angle value corresponding to the actual sampling time after the rising edge of the tooth with the number N jumps.
After the angle corresponding to the tooth from 0 to the tooth from N-1 is obtained through table lookup and the target rotation speed of the tooth from N is obtained through calculation in step S211, an angle value corresponding to the actual sampling time after the rising edge of the tooth from N jumps is obtained through calculation by combining a preset sampling period according to formula (2).
Formula (2) of θ k = ∑ (θ (0) + θ (1) + \8230; + θ (n-1)) + ∑ ω n · Ts
Wherein θ k is the angle of the rising edge jump of the tooth number N, θ (0) to θ (N-1) are the angles corresponding to the tooth number 0 to the tooth number N-1, ω N is the corresponding target rotation speed, and Ts can be a preset period of time. And (3) calculating the sum of the angles corresponding to the tooth 0 to the tooth N-1 and adding the angle value corresponding to the target rotating speed and the actual sampling time after the rising edge of the tooth N jumps to obtain the actual rotating angle value of the code wheel according to the formula (2).
The time for one tooth to completely pass through the photoelectric switch is longer, but the definition of the angle in the embodiment of the application is the angle when the pulse signal corresponding to the tooth rises, and in order to obtain the jumping angle of the rising edge of the N-numbered tooth, ts is set and multiplied by a target rotating speed for summation, so that the angle value corresponding to the actual sampling time after the jumping of the rising edge of the N-numbered tooth can be obtained, and the obtained angle value is added with the sum of the angles from the 0-numbered tooth to the N-1-numbered tooth, and finally the actual rotating angle value of the code disc is obtained.
By adopting the embodiment of the application, the high level time and the low level time generated by each tooth in the code disc passing through the photoelectric switch under different preset temperatures and different preset rotating speeds are obtained, the code disc is calibrated, the adopted temperature and the adopted rotating speed are obtained and compared with the preset temperature and the preset rotating speed, if the adopted temperature and the adopted rotating speed are different, the angle corresponding to the tooth from the tooth 0 to the tooth N in the code disc under different adopted temperatures and different adopted rotating speeds is obtained through an interpolation method, then the target rotating speed corresponding to the tooth N under the sampling temperature is calculated by obtaining the high level time and the low level time of the current tooth N, and finally the angle value corresponding to the actual sampling time after the rising edge of the tooth N jumps and the angle value corresponding to the tooth from the tooth 0 to the tooth N-1 are determined based on the target rotating speed, so that the actual rotating angle value of the code disc is obtained. This scheme of adoption, through code wheel and photoelectric switch's detection, realize improving the effect that rotational speed detected the accuracy.
Please refer to fig. 10, which shows a schematic structural diagram of an angle calculating apparatus according to an exemplary embodiment of the present application. The angle calculating means may be implemented in whole or in part as a terminal by software, hardware, or a combination of both. The device 1 comprises a time acquisition module 11, a code disc calibration module 12, an angle acquisition module 13 and an angle determination module 14.
The time acquisition module 11 is used for acquiring high level time and low level time generated when each tooth in the code disc passes through the photoelectric switch under different preset temperatures and preset rotating speeds;
a code disc calibration module 12, configured to calibrate the code disc based on each high level time and each low level time;
the angle acquisition module 13 is configured to acquire, based on the calibrated code disc, an angle corresponding to tooth number 0 to tooth number N in the code disc at a sampling temperature and a target high level time and a target low level time corresponding to tooth number N in the code disc at the sampling temperature and the sampling speed, where N is greater than or equal to 0 and less than or equal to N, and N is the last tooth of the code disc, where tooth number N is the number of teeth corresponding to the current sampling time;
and an angle determining module 14, configured to determine an actual rotation angle value of the code wheel based on an angle corresponding to a tooth from 0 to a tooth from N in the code wheel at the sampling rotation speed of the sampling temperature, the target high-level time, the target low-level time, and an actual sampling time after a rising edge of the tooth from N jumps.
Optionally, as shown in fig. 11, the angle calculating apparatus 1 further includes:
the sampling data judging module 15 is used for judging whether the sampling temperature and the sampling rotating speed are the same as the preset temperature and the preset rotating speed;
and the interpolation module 16 is used for acquiring the corresponding angle from the number 0 tooth to the number N tooth of the coded disc under the sampling temperature and the sampling rotating speed by adopting an interpolation method if the sampling temperature and the sampling rotating speed are different from the preset temperature and the preset rotating speed.
Optionally, as shown in fig. 12, the code wheel calibration module 12 includes:
a theoretical time obtaining unit 121, configured to obtain a high-level theoretical time and a low-level theoretical time that are generated when each tooth in the code wheel passes through the photoelectric switch at different preset temperatures and different preset rotation speeds;
and the code disc calibration unit 122 is configured to determine that the code disc calibration is successful if high level time generated when each tooth in the code disc passes through the photoelectric switch at different preset temperatures and different preset rotational speeds is within an error range, and low level time generated when each tooth in the code disc passes through the photoelectric switch at different preset temperatures and different preset rotational speeds is within an error range.
Optionally, as shown in fig. 13, the angle determining module 14 includes:
the angle obtaining unit 141 is configured to search the sampling temperature and the angle from the sampling rotation speed 0 to the N tooth from the angles corresponding to the teeth in the code wheel at different preset temperatures and different preset rotation speeds;
a rotating speed obtaining unit 142, configured to obtain a target rotating speed corresponding to the N-th tooth based on the target high level time and the target low level time corresponding to the N-th tooth and the angle corresponding to the N-th tooth;
an angle determining unit 143, configured to determine an actual rotation angle value of the code wheel based on the sampling temperature and the angle corresponding to the tooth from 0 to the tooth from N-1 in the code wheel at the sampling rotation speed, the target rotation speed corresponding to the tooth from N, and the actual sampling time after the rising edge of the tooth from N jumps.
Optionally, the angle determining unit 143 is used for
θ k = (θ (0) + θ (1) + \8230; + θ (n-1)) + Σω n × Ts, said θ k being said actual rotation angle value;
the sampling method comprises the following steps that theta (0) is an angle corresponding to a tooth number 0, theta (1) is an angle corresponding to a tooth number 1, theta (N-1) is an angle corresponding to a tooth number N-1, omega N is a target rotating speed, ts is a preset sampling period, and sigma omega N Ts is an angle value corresponding to actual sampling time after rising edge jumping of the tooth number N.
Optionally, as shown in fig. 14, the apparatus 1 further includes:
the time determining module 15 is used for determining the maximum value of low level time generated when each tooth in the code disc passes through the photoelectric switch under different preset temperatures and preset rotating speeds;
and a tooth number 0 determining module 16, configured to determine the tooth corresponding to the maximum value as a tooth number 0.
By adopting the embodiment of the application, the high level time and the low level time generated by each tooth in the code disc passing through the photoelectric switch under different preset temperatures and different preset rotating speeds are obtained, the code disc is calibrated, the adopted temperature and the adopted rotating speed are obtained and compared with the preset temperature and the preset rotating speed, if the adopted temperature and the adopted rotating speed are different, the angle corresponding to the tooth from the tooth 0 to the tooth N in the code disc under different adopted temperatures and different adopted rotating speeds is obtained through an interpolation method, then the target rotating speed corresponding to the tooth N under the sampling temperature is calculated by obtaining the high level time and the low level time of the current tooth N, and finally the angle value corresponding to the actual sampling time after the rising edge of the tooth N jumps and the angle value corresponding to the tooth from the tooth 0 to the tooth N-1 respectively are determined based on the target rotating speed, so that the actual rotating angle value of the code disc is obtained. This scheme of adoption, through code wheel and photoelectric switch's detection, realize improving the effect that rotational speed detected the accuracy.
It should be noted that, when the angle calculating apparatus provided in the foregoing embodiment executes the angle calculating method, only the division of the functional modules is illustrated, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the angle calculating device and the angle calculating method provided by the above embodiments belong to the same concept, and details of implementation processes thereof are referred to in the method embodiments, which are not described herein.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
An embodiment of the present application further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are suitable for being loaded by a processor and executing the method steps in the embodiments shown in fig. 1 to 9, and a specific execution process may refer to specific descriptions of the embodiments shown in fig. 1 to 9, which are not described herein again.
The present application further provides an electronic device, where the electronic device stores at least one instruction, and the at least one instruction is loaded by the processor and executes the specific description of the embodiment shown in fig. 1 to 9, which is not described herein again.
Fig. 15 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 15, the electronic device 1000 may include: at least one processor 1001, at least one network interface 1004, a user interface 1003, memory 1005, at least one communication bus 1002.
Wherein a communication bus 1002 is used to enable connective communication between these components.
The user interface 1003 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
Processor 1001 may include one or more processing cores, among other things. The processor 1001 interfaces various components throughout the electronic device 1000 using various interfaces and lines to perform various functions of the electronic device 1000 and to process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 1005 and invoking data stored in the memory 1005. Alternatively, the processor 1001 may be implemented in at least one hardware form of Digital Signal Processing (DSP), field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1001 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 1001, but may be implemented by a single chip.
The Memory 1005 may include a Random Access Memory (RAM) or a Read-only Memory (Read-only Memory). Optionally, the memory 1005 includes a non-transitory computer-readable medium. The memory 1005 may be used to store an instruction, a program, code, a set of codes, or a set of instructions. The memory 1005 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, and the like; the storage data area may store data and the like referred to in the above respective method embodiments. The memory 1005 may alternatively be at least one memory device located remotely from the processor 1001. As shown in fig. 15, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and an angle calculation application program.
In the electronic device 1000 shown in fig. 15, the user interface 1003 is mainly used as an interface for providing input for a user, and acquiring data input by the user; and the processor 1001 may be configured to invoke the angle calculation application stored in the memory 1005 and specifically perform the following operations:
acquiring high level time and low level time generated when each tooth in a code disc passes through a photoelectric switch at different preset temperatures and different preset rotating speeds;
calibrating the code disc based on each high level time and each low level time;
based on the calibrated code disc, acquiring an angle from 0 tooth to N tooth in the code disc at a sampling temperature and a sampling rotating speed, and acquiring target high level time and target low level time corresponding to the N tooth in the code disc at the sampling temperature and the sampling rotating speed, wherein N is more than or equal to 0 and less than or equal to N, and N is the last tooth of the code disc, wherein the N tooth is the number of teeth corresponding to the current sampling moment;
and determining the actual rotation angle value of the code disc based on the sampling temperature and the angle corresponding to the number 0 tooth to the number N tooth in the code disc at the sampling rotation speed, the target high-level time, the target low-level time and the actual sampling time after the rising edge of the number N tooth jumps.
In one embodiment, the processor 1001 further performs the following operations before performing the acquisition of the corresponding angles from tooth No. 0 to tooth No. N in the code wheel at the sampling temperature and the sampling rotation speed based on the calibrated code wheel:
judging whether the sampling temperature and the sampling rotating speed are the same as the preset temperature and the preset rotating speed;
and if the sampling temperature and the sampling rotating speed are different from the preset temperature and the preset rotating speed, acquiring the corresponding angle from the number 0 tooth to the number N tooth of the coded disc under the sampling temperature and the sampling rotating speed by adopting an interpolation method.
In one embodiment, when the processor 1001 performs calibration of the code wheel based on each of the high level time and the low level time, the following operations are specifically performed:
acquiring high-level theoretical time and low-level theoretical time generated when each tooth in a code disc passes through a photoelectric switch under different preset temperatures and preset rotating speeds;
and if the high level time generated when each tooth in the coded disc passes through the photoelectric switch at different preset temperatures and different preset rotating speeds and the corresponding high level theoretical time are within an error range, and the low level time generated when each tooth in the coded disc passes through the photoelectric switch at different preset temperatures and different preset rotating speeds and the corresponding low level theoretical time are within the error range, determining that the coded disc is successfully calibrated.
In one embodiment, when the processor 1001 determines the actual rotation angle value of the code wheel based on the angle corresponding to the tooth No. 0 to the tooth No. N in the code wheel at the sampling temperature and the sampling rotation speed, the target high-level time, the target low-level time, and the actual sampling time after the rising edge of the tooth No. N jumps, the following operations are specifically performed:
searching the sampling temperature and the angle from the number 0 tooth to the number N-1 tooth of the sampling rotating speed in the angles corresponding to the teeth in the coded disc at different preset temperatures and different preset rotating speeds;
obtaining a target rotating speed corresponding to the N-th tooth based on the target high level time and the target low level time corresponding to the N-th tooth and the angle corresponding to the N-th tooth;
and determining the actual rotation angle value of the code disc based on the angle from the number 0 tooth to the number N-1 tooth in the code disc under the sampling rotation speed of the sampling temperature, the target rotation speed corresponding to the number N tooth and the actual sampling time after the rising edge of the number N tooth jumps.
In one embodiment, when the processor 1001 determines the actual rotation angle value of the code wheel based on the angle corresponding to the tooth No. 0 to the tooth No. N in the code wheel at the sampling temperature and the sampling rotation speed, the target high-level time, the target low-level time, and the actual sampling time after the rising edge of the tooth No. N jumps, the following operations are specifically performed:
θ k = (θ (0) + θ (1) + \8230; + θ (n-1)) + Σω n × Ts, said θ k being said actual rotation angle value;
the sampling method comprises the following steps that theta (0) is an angle corresponding to a tooth number 0, theta (1) is an angle corresponding to a tooth number 1, theta (N-1) is an angle corresponding to a tooth number N-1, omega N is a target rotating speed, ts is a preset sampling period, and sigma omega N Ts is an angle value corresponding to actual sampling time after rising edge jumping of the tooth number N.
In one embodiment, the processor 1001, when executing the angle calculation application, further performs the following operations:
determining the maximum value of low level time generated by each tooth of a coded disc passing through a photoelectric switch at different preset temperatures and different preset rotating speeds;
and determining the tooth corresponding to the maximum value as a No. 0 tooth.
By adopting the embodiment of the application, the high level time and the low level time generated by each tooth in the code disc passing through the photoelectric switch under different preset temperatures and different preset rotating speeds are obtained, the code disc is calibrated, the adopted temperature and the adopted rotating speed are obtained and compared with the preset temperature and the preset rotating speed, if the adopted temperature and the adopted rotating speed are different, the angle corresponding to the tooth from the tooth 0 to the tooth N in the code disc under different adopted temperatures and different adopted rotating speeds is obtained through an interpolation method, then the target rotating speed corresponding to the tooth N under the sampling temperature is calculated by obtaining the high level time and the low level time of the current tooth N, and finally the actual rotating angle value of the code disc is obtained based on the target rotating speed and the angle value corresponding to the actual sampling time after the rising edge of the tooth N is determined to jump and the angle values corresponding to the tooth from the tooth 0 to the tooth N-1 respectively. This scheme of adoption, through code wheel and photoelectric switch's detection, realize improving the effect that rotational speed detected the accuracy.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by a computer program, which may be stored in a computer readable storage medium and executed by a computer to implement the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory or a random access memory.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (10)

1. An angle calculation method, characterized in that the method comprises:
acquiring high level time and low level time generated when each tooth in a code disc passes through a photoelectric switch at different preset temperatures and different preset rotating speeds;
calibrating the code disc based on each high level time and each low level time;
based on the calibrated code disc, acquiring an angle corresponding to a tooth from 0 to a tooth from N in the code disc at a sampling temperature and a sampling rotating speed, and acquiring target high level time and target low level time corresponding to the tooth from N in the code disc at the sampling temperature and the sampling rotating speed, wherein N is greater than or equal to 0 and less than or equal to N, and N is the last tooth of the code disc, wherein the tooth from N is the number of teeth corresponding to the current sampling time;
and determining the actual rotation angle value of the code disc based on the corresponding angle from the number 0 tooth to the number N-1 tooth in the code disc under the sampling temperature and the sampling rotation speed, the target high level time, the target low level time and the actual sampling time after the rising edge of the number N tooth jumps.
2. The method of claim 1, wherein the calibrated code wheel is obtained before the angle corresponding to tooth number 0 to tooth number N in the code wheel at the sampling temperature and the sampling rotation speed, and the method further comprises:
judging whether the sampling temperature and the sampling rotating speed are the same as the preset temperature and the preset rotating speed or not;
and if the sampling temperature and the sampling rotating speed are different from the preset temperature and the preset rotating speed, acquiring the corresponding angle from the number 0 tooth to the number N tooth of the coded disc under the sampling temperature and the sampling rotating speed by adopting an interpolation method.
3. The method of claim 1, wherein said calibrating said code wheel based on each of said high time and each of said low time comprises:
acquiring high-level theoretical time and low-level theoretical time generated when each tooth in a code disc passes through a photoelectric switch under different preset temperatures and preset rotating speeds;
and if the actual high-level time generated when each tooth in the code disc passes through the photoelectric switch at different preset temperatures and different preset rotating speeds and the corresponding high-level theoretical time are within an error range, and the actual low-level time generated when each tooth in the code disc passes through the photoelectric switch at different preset temperatures and different preset rotating speeds and the corresponding low-level theoretical time are within the error range, determining that the code disc is successfully calibrated.
4. The method of claim 1, wherein said determining an actual rotation angle value of said code wheel based on said corresponding angles of tooth No. 0 to tooth No. N-1 in said code wheel at said sampled temperature and sampled rotational speed, said target high time, said target low time, and said actual sample time after a rising edge jump of tooth No. N comprises:
searching the sampling temperature and the angle from No. 0 tooth to No. N-1 tooth at the sampling rotation speed in the angles corresponding to the teeth in the code disc at different preset temperatures and different preset rotation speeds;
obtaining a target rotating speed corresponding to the N-th tooth based on the target high level time and the target low level time corresponding to the N-th tooth and the angle corresponding to the N-th tooth;
and determining the actual rotation angle value of the code disc based on the sampling temperature and the angle corresponding to the number 0 tooth to the number N-1 tooth in the code disc at the sampling rotation speed, the target rotation speed corresponding to the number N tooth and the actual sampling time after the rising edge of the number N tooth jumps.
5. The method of claim 4, wherein said determining an actual rotational angle value of said code wheel based on said corresponding angle of tooth 0 to tooth N of said code wheel at said sample temperature and sample rotational speed, said target high time, said target low time, and said actual sample time after a rising edge transition of tooth N comprises:
θ k = (θ (0) + θ (1) + \8230; + θ (n-1)) + Σω n × Ts, said θ k being said actual rotation angle value;
the sampling method comprises the following steps that theta (0) is an angle corresponding to a tooth number 0, theta (1) is an angle corresponding to a tooth number 1, theta (N-1) is an angle corresponding to a tooth number N-1, omegan is a target rotating speed, ts is a preset sampling period, and Sigma omegan is an angle value corresponding to actual sampling time after rising edge jumping of the tooth number N.
6. The method of claim 1, further comprising:
determining the maximum value of low level time generated when each tooth in the code disc passes through the photoelectric switch under different preset temperatures and preset rotating speeds;
and determining the tooth corresponding to the maximum value as a No. 0 tooth.
7. An angle calculation apparatus, characterized in that the apparatus comprises:
the time acquisition module is used for acquiring high level time and low level time generated by each tooth of the coded disc passing through the photoelectric switch at different preset temperatures and preset rotating speeds;
the code disc calibration module is used for calibrating the code disc based on each high level time and each low level time;
the angle acquisition module is used for acquiring an angle from a tooth number 0 to a tooth number N in the code disc at a sampling temperature and a sampling rotating speed based on the calibrated code disc, and acquiring target high level time and target low level time corresponding to the tooth number N in the code disc at the sampling temperature and the sampling rotating speed, wherein N is greater than or equal to 0 and less than or equal to N, and N is the last tooth number of the code disc, wherein the tooth number N is the tooth number corresponding to the current sampling time;
and the angle determining module is used for determining the actual rotation angle value of the coded disc based on the sampling temperature and the angle corresponding to the tooth from 0 to the tooth from N in the coded disc at the sampling rotating speed, the target high-level time, the target low-level time and the actual sampling time after the rising edge of the tooth from N jumps.
8. The apparatus of claim 7, further comprising:
the sampling data judgment module is used for judging whether the sampling temperature and the sampling rotating speed are the same as the preset temperature and the preset rotating speed or not;
and the interpolation module is used for acquiring the corresponding angle from the number 0 tooth to the number N tooth of the coded disc under the sampling temperature and the sampling rotating speed by adopting an interpolation method if the sampling temperature and the sampling rotating speed are different from the preset temperature and the preset rotating speed.
9. A computer storage medium characterized by a plurality of instructions adapted to be loaded by a processor and to perform the method steps according to any one of claims 1 to 6.
10. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1 to 6.
CN202111660474.5A 2021-12-30 2021-12-30 Angle calculation method and device, storage medium and electronic equipment Active CN115833491B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202111660474.5A CN115833491B (en) 2021-12-30 2021-12-30 Angle calculation method and device, storage medium and electronic equipment
CN202310926500.7A CN117040208A (en) 2021-12-30 2021-12-30 Angle calculation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111660474.5A CN115833491B (en) 2021-12-30 2021-12-30 Angle calculation method and device, storage medium and electronic equipment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202310926500.7A Division CN117040208A (en) 2021-12-30 2021-12-30 Angle calculation method and device

Publications (2)

Publication Number Publication Date
CN115833491A true CN115833491A (en) 2023-03-21
CN115833491B CN115833491B (en) 2023-08-25

Family

ID=85516134

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202111660474.5A Active CN115833491B (en) 2021-12-30 2021-12-30 Angle calculation method and device, storage medium and electronic equipment
CN202310926500.7A Pending CN117040208A (en) 2021-12-30 2021-12-30 Angle calculation method and device

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202310926500.7A Pending CN117040208A (en) 2021-12-30 2021-12-30 Angle calculation method and device

Country Status (1)

Country Link
CN (2) CN115833491B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201680963U (en) * 2010-03-25 2010-12-22 重庆大学 Coupled intelligent bearing monitor
CN103913591A (en) * 2014-03-03 2014-07-09 深圳市智慧机器技术有限公司 Method and device for measuring rotating speeds of rotating device
CN105675029A (en) * 2016-01-07 2016-06-15 三一重型能源装备有限公司 Wind power generation system, velocity-measuring and positioning device and method
CN205356209U (en) * 2016-01-28 2016-06-29 西安科技大学 Stepping motor control device
CN106921325A (en) * 2017-04-24 2017-07-04 常州寻心电子科技有限公司 A kind of high speed angular position sensing system and method
CN109791058A (en) * 2016-08-23 2019-05-21 弗瑞柏私人有限公司 Calibrate the method and rotary encoder of rotary encoder
CN110987167A (en) * 2019-12-17 2020-04-10 北京昊鹏智能技术有限公司 Fault detection method, device, equipment and storage medium for rotary mechanical equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN201680963U (en) * 2010-03-25 2010-12-22 重庆大学 Coupled intelligent bearing monitor
CN103913591A (en) * 2014-03-03 2014-07-09 深圳市智慧机器技术有限公司 Method and device for measuring rotating speeds of rotating device
CN105675029A (en) * 2016-01-07 2016-06-15 三一重型能源装备有限公司 Wind power generation system, velocity-measuring and positioning device and method
CN205356209U (en) * 2016-01-28 2016-06-29 西安科技大学 Stepping motor control device
CN109791058A (en) * 2016-08-23 2019-05-21 弗瑞柏私人有限公司 Calibrate the method and rotary encoder of rotary encoder
CN106921325A (en) * 2017-04-24 2017-07-04 常州寻心电子科技有限公司 A kind of high speed angular position sensing system and method
CN110987167A (en) * 2019-12-17 2020-04-10 北京昊鹏智能技术有限公司 Fault detection method, device, equipment and storage medium for rotary mechanical equipment

Also Published As

Publication number Publication date
CN115833491B (en) 2023-08-25
CN117040208A (en) 2023-11-10

Similar Documents

Publication Publication Date Title
EP2998848B1 (en) Method, device, and apparatus for controlling screen rotation
CN112781484B (en) Rotor angle calibration method and device of linear Hall sensor and electronic equipment
US10734927B2 (en) Motor drive phase sector buffer, offset and gain error circuitry
CN115302506A (en) Joint module testing method, device, equipment and storage medium
CN112509292A (en) Fault prediction method, device, electronic equipment and computer readable storage medium
CN115833491A (en) Angle calculation method and device, storage medium and electronic equipment
CN113533923A (en) GaN HEMT device testing method and device
CN109600092B (en) Permanent magnet synchronous motor rotor position monitoring and correcting method and system and motor
CN110020264B (en) Method and device for determining invalid hyperlinks
CN110865785A (en) Method and device for acquiring pixel size and electronic equipment
CN113376544A (en) Method and device for detecting circuit abnormality in film material, storage medium and terminal
CN115689061A (en) Wind power ultra-short term power prediction method and related equipment
CN114298098A (en) Data processing method and device for error correction
CN114168890A (en) Fourier coefficient calculation method, device, terminal equipment and medium
CN110388938B (en) Notification method, terminal and computer storage medium
CN112099759A (en) Numerical value processing method, device, processing equipment and computer readable storage medium
CN112325907A (en) Method, device, equipment and medium for testing robot path planning algorithm
CN114726262A (en) Initial angle calibration method, device and system and storage medium
CN114265506B (en) Rotary interaction method, device, terminal equipment and readable storage medium
CN113063447B (en) Gyroscope calibration method and device, readable storage medium and electronic equipment
CN113904607B (en) Predictive current control method for permanent magnet synchronous motor and related equipment
CN116543053B (en) Hall sensor production method and production system
CN110928279B (en) Robot movement control method and device and terminal equipment
CN116360649A (en) Mobile control method, device, equipment and medium
CN116388617A (en) Hall signal-based motor phase searching method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant