Real-time angle position determination system, method and storage medium for motor
By acquiring the PWM signal of the motor to identify the duty cycle and correct the angle value, and combining it with the mechanical zero point position, the accuracy and cost issues caused by Hall sensors are solved, and high-precision motor angle position determination is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-25
- Publication Date
- 2026-03-13
AI Technical Summary
When existing hub motors determine real-time angular position by using encoders and Hall sensors, the accuracy is easily affected by the manufacturing process, and the cost is high, requiring many pins, and the slotting results in uneven magnetic fields.
By acquiring the PWM signal of the motor, identifying the PWM duty cycle and the current correction angle value, and combining this with the mechanical zero point position, the absolute and real-time angular position of the motor can be determined, avoiding the use of Hall sensors.
It improves the accuracy of real-time angular position recognition of the motor, saves on the cost of Hall sensors and slotting, and enhances the performance of the encoder.
Smart Images

Figure CN115528972B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to motor control technology, and more particularly to a system, method, and storage medium for determining the real-time angle and position of a motor. Background Technology
[0002] Currently, most existing hub motors use a combination of encoders and Hall sensors to determine the motor's real-time angular position. However, Hall sensors require slots to be cut into the motor stator to acquire phase angles. Slotting the stator can lead to uneven magnetic fields, and the accuracy of the slotting directly affects the accuracy of identifying the motor's real-time angular position. Therefore, the accuracy of identifying the motor's real-time angular position using a combination of encoders and Hall sensors is easily affected by the machining accuracy, resulting in low accuracy. Furthermore, it requires many encoder pins and incurs high slotting costs. Summary of the Invention
[0003] This invention provides a system, method, and storage medium for determining the real-time angle position of a motor. This invention enables the output of the actual angle position of the motor under test without the need for a Hall sensor, simply by acquiring the PWM signal of the motor under test. This improves the accuracy of the real-time angle position recognition of the motor and saves on slotting costs.
[0004] A real-time angle position determination system for a motor includes a memory, a processor connected to the motor under test, and computer-readable instructions stored in the memory and executable on the processor. When the processor executes the computer-readable instructions, it performs the following steps:
[0005] Receive the PWM signal of the motor under test, and identify the PWM duty cycle of the PWM signal and the current correction angle value of the motor under test;
[0006] Based on the mechanical zero point position of the motor under test, the absolute angular position of the motor under test is determined according to the PWM duty cycle;
[0007] Based on the current correction angle value and the absolute angle position, the real-time angle position of the motor under test within the period corresponding to the PWM duty cycle is determined.
[0008] A method for determining the real-time angular position of a motor, comprising:
[0009] Receive the PWM signal of the motor under test, and identify the PWM duty cycle of the PWM signal and the current correction angle value of the motor under test;
[0010] Based on the mechanical zero point position of the motor under test, the absolute angular position of the motor under test is determined according to the PWM duty cycle;
[0011] Based on the current correction angle value and the absolute angle position, the real-time angle position of the motor under test within the period corresponding to the PWM duty cycle is determined.
[0012] A computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the above-described method for determining the real-time angle position of a motor.
[0013] This invention provides a system, method, and storage medium for determining the real-time angle position of a motor. The method involves receiving a PWM signal from a motor under test (MAT), identifying the PWM duty cycle and the current corrected angle value of the MAT; determining the absolute angle position of the MAT based on its mechanical zero-point position and the PWM duty cycle; and determining the real-time angle position of the MAT within a period corresponding to the PWM duty cycle based on the current corrected angle value and the absolute angle position. Therefore, this invention achieves the identification of the PWM duty cycle and the current corrected angle value solely by acquiring the MAT's PWM signal, without the need for a Hall sensor, and outputting the actual angle position of the MAT based on its mechanical zero-point position. This improves the accuracy of real-time angle position identification and eliminates the need for a Hall sensor, saving on Hall sensor costs and slotting costs, and improving encoder performance. Attached Figure Description
[0014] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 This is a schematic diagram of the connection structure of a motor real-time angle position determination system in one embodiment of the present invention;
[0016] Figure 2 This is a schematic diagram of the connection structure of the motor real-time angle position determination system in another embodiment of the present invention;
[0017] Figure 3 This is a flowchart of a method for determining the real-time angle position of a motor in one embodiment of the present invention.
[0018] The reference numerals in the accompanying drawings are as follows:
[0019] 111. Circular drive board; 112. Encoding chip; 21. Cylindrical mounting slot; 22. Motor shaft; 23. Stator assembly. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] In one embodiment, a real-time motor angle position determination system 1 is provided, and the internal structure diagram of the real-time motor angle position determination system 1 can be shown as follows: Figure 1 As shown. The real-time angle position determination system 1 for the motor includes a memory 12, a processor 11 connected to the motor under test 2, and computer-readable instructions stored in the memory 12 and executable on the processor 11. The processor 11 of the real-time angle position determination system 1 provides computing and control capabilities and measures the PWM duty cycle of the PWM signal output by the motor under test 2 connected to it. The processor 11 can be an MCU, a microcontroller, an integrated circuit chip, etc. Figure 2 As shown, the motor under test 2 includes a stator assembly 23 and a rotor (not shown) sleeved outside the stator assembly 23. When the rotor of the motor under test 2 rotates relative to the stator assembly 23, it outputs a periodic or frequency PWM signal, and the corresponding position or angle of the relative rotation between the stator assembly 23 and the rotor can be located through the PWM signal. The memory 1213 of the motor real-time angle position determination system 1 includes a readable storage medium. When the computer-readable instructions are executed by the processor 11, a method for determining the real-time angle position of a motor is implemented.
[0022] In one embodiment, a real-time angular position determination system for a motor is provided, such as... Figure 1 and 3 As shown, when the processor executes the computer-readable instructions, it performs the following steps:
[0023] S10, receive the PWM signal of the motor under test, and identify the PWM duty cycle of the PWM signal and the current correction angle value of the motor under test.
[0024] Understandably, the PWM signal, also known as a pulse width modulation signal, refers to a square wave signal with a pulse width. The PWM signal has a fixed period and duty cycle. When it is necessary to obtain the real-time angular position of the motor under test, or when the motor under test is powered on or needs correction, the PWM signal of the motor under test is received. The PWM duty cycle of the PWM signal is identified. By setting the external interrupt trigger mode of the interface receiving the PWM signal, the triggering time points of different trigger modes and the switching time points of different trigger modes are collected. The PWM duty cycle of the PWM signal is determined by the collected time points through a preset pulse width ratio model. The phase information of the motor under test before and after the encoder executes the pulse width ratio model is received through the encoder. The current correction angle value of the motor under test is identified. The current correction angle value is the angle value that needs to be compensated to determine the real-time angular position of the motor under test. That is, the current correction angle value represents the angular offset of the stator assembly 23 of the motor under test relative to the rotor rotation during the current execution of the pulse width ratio model output PWM duty cycle, so as to accurately determine the real-time angular position of the motor under test later.
[0025] In one embodiment, the real-time angle position determination system for the motor under test further includes an encoder with an input interface, the processor is connected to the encoder, and the encoder is connected to the motor under test through the input interface.
[0026] Understandably, the encoder is a device that receives relevant information from the motor under test, converts it, and feeds it back to the processor. The encoder is connected to the processor and includes the input interface, which is used to receive the PWM signal from the motor under test.
[0027] In step S10, namely identifying the PWM duty cycle of the PWM signal, the following is included:
[0028] Set the external interrupt trigger mode of the encoder's input interface to the first trigger mode corresponding to the motor under test.
[0029] Understandably, the input interface is an input / output interface of the encoder that does not have register functionality. The input interface has external interrupt functionality, meaning it can receive interrupt events triggered by different external interrupt methods and execute the corresponding interrupt event program. These external interrupt trigger methods include rising edge triggering, falling edge triggering, high-level triggering, and low-level triggering. The external interrupt triggering method of the input interface can be set to rising edge triggering, falling edge triggering, high-level triggering, or low-level triggering. The first triggering method is based on the characteristics of the PWM signal output by the motor under test. The external interrupt triggering method is determined, and different motors correspond to different first triggering methods. For example, the proportion of high level in the PWM signal output by the motor under test reflects the PWM duty cycle or position information of the motor under test, and the first triggering method is the rising edge triggering method (i.e., triggered when the received PWM signal has a rising edge). Or, the proportion of low level in the PWM signal output by the motor under test reflects the PWM duty cycle or position information of the motor under test, and the first triggering method is the falling edge triggering method, etc. The motor under test can reflect the current relevant position or phase information through the PWM signal.
[0030] The number of times the input interface is triggered by the first triggering method is detected in real time.
[0031] Understandably, the first trigger count is detected in real time, where the first trigger count is the number of times the first trigger method is triggered.
[0032] When the first trigger count is a preset number, the external interrupt triggering mode is switched to a second triggering mode that is opposite to the triggering mechanism of the first triggering mode, and the time points when the first triggering mode is triggered twice are read from the encoder.
[0033] Understandably, the encoder is also used to record the time point when all interfaces are triggered. That is, the encoder includes a shared clock module, which can record the time point when each interface is triggered, or provide the current time point to each interface. When the first triggering method is triggered for the first time, the triggered time point is read from the encoder. When the first triggering method is triggered for the second time, the triggered time point is read from the encoder. After the first triggering method is triggered for the second time, the external interrupt triggering method of the input interface is switched to the second triggering method. The second triggering method is different from the first triggering method. The second triggering method can be the opposite of the triggering mechanism of the first triggering method.
[0034] The preset number of times is a preset number of times. Furthermore, the preset number of times can be set according to needs. For example, the preset number of times is twice. The encoder realizes the sharing of timer resources, eliminating the need to allocate separate timer resources for each PWM signal to the input interface, thus saving timer resources and improving the utilization rate of timer resources.
[0035] After the input interface is triggered by the second triggering method, the time point of the triggering by the second triggering method is read from the encoder, and the external interrupt triggering method of the input interface is turned off.
[0036] Understandably, when the input interface is triggered after being set to the second trigger mode, the trigger time point is read from the encoder, and the external interrupt trigger mode of the input interface is stopped, that is, it will not be processed by external interrupt events.
[0037] Based on the time point when the signal is triggered by the second triggering method and the time points when it is triggered twice by the first triggering method, the PWM duty cycle of the PWM signal is determined using a preset pulse width ratio model.
[0038] Understandably, the preset pulse width ratio model is a model preset in the processor for calculating the PWM duty cycle of the received PWM signal based on the time points of two consecutive triggering events of the first triggering mode read from the encoder and the time point of the subsequent triggering event of the second triggering mode. The PWM duty cycle output by the preset pulse width ratio model is fed back to the host computer through the preset interface. The PWM duty cycle reflects the proportion of high or low potentials within the period of the PWM signal. In this way, high-precision PWM duty cycle measurement can be performed through one input interface in the encoder and the external interrupt triggering mode of the input interface, thereby enabling accurate determination of the rotation position or phase information of the motor under test.
[0039] Based on the time point when the second triggering method is triggered and the time point when the PWM duty cycle is determined, the current correction angle value of the motor under test is determined.
[0040] This invention implements a method to set the external interrupt triggering mode of the encoder's input interface to a first triggering mode corresponding to the motor under test; to detect in real time the first number of times the input interface is triggered by the first triggering mode; when the first triggering number is a preset number, to switch the external interrupt triggering mode to a second triggering mode with the opposite triggering mechanism to the first triggering mode, and to read the time points of the two triggering events by the first triggering mode from the encoder; after the input interface is triggered by the second triggering mode, to read the time points of the second triggering mode from the encoder and to disable the external interrupt triggering mode of the input interface; based on the time points of the second triggering mode and the two triggering events by the first triggering mode, to determine the PWM duty cycle of the PWM signal using a preset pulse width ratio model; and based on the time points of the second triggering mode and the time points of determining the PWM duty cycle, to determine the current correction angle value of the motor under test. Thus, through an input interface without timing resources and its external interrupt triggering mode, high-precision real-time motor angle position determination can be achieved, improving the utilization rate of the encoder interface and its timer resources, thereby accurately determining the motor's rotation position or phase information.
[0041] In one embodiment, the pulse width ratio model is:
[0042] D = (T2 - T1) % (T1 - T0)
[0043] in,
[0044] D represents the PWM duty cycle;
[0045] T0 is the time point at which the first triggering method is first read from the encoder;
[0046] T1 is the time point read from the encoder when the device is triggered for the second time using the first triggering method;
[0047] T2 is the time point at which the device was triggered by the second triggering method, as read from the encoder.
[0048] Understandably, T1-T0 is the period of the PWM signal, and T2-T1 is the time interval between the second triggering time and the first triggering time. The reason for taking the remainder of T2-T1 from T1-T0 is that when the PWM duty cycle of the PWM signal is very small, after the input interface is triggered for the second time by the first triggering method, there will be a time delay when the external interrupt triggering method switches to the second triggering method. If a real triggering event of the second triggering method occurs within this time delay, the time of the triggering event will not be recorded because no corresponding response will be made before the second triggering method is switched. Therefore, it is necessary to wait for one period before the triggering time is recorded and the triggering time of the second triggering method is read from the encoder. Therefore, it is necessary to remove one period, and the remainder result is the true PWM duty cycle, which improves the accuracy and precision of PWM duty cycle recognition.
[0049] In one embodiment, such as Figure 2 As shown, the encoder includes a circular drive board 111 and an encoding chip 112 mounted on the circular drive board 111. One end of the motor shaft 22 of the motor under test is recessed to form a cylindrical mounting groove 21 that is adapted to the drive board, and the motor shaft 22 and the cylindrical mounting groove 21 are coaxially arranged. The circular drive board 111 is coaxially mounted in the cylindrical mounting groove 21.
[0050] Understandably, the circular drive board 111 is a circuit board used to drive the encoder. The encoding chip 112 is mounted on the circular drive board 111 and is used to execute the encoder's program to realize the encoder's function. One end of the motor shaft 22 of the motor under test is recessed to form a cylindrical mounting groove 21 that fits the drive board, and the motor shaft 22 and the cylindrical mounting groove 21 are coaxially arranged. The cylindrical mounting groove 21 is used to install the circular drive board 111, and uniformly fixes the circular drive board 111 on the motor shaft 22 of the motor under test, ensuring... To ensure consistent installation, the motor shaft 22 is coaxially arranged with the cylindrical mounting slot 21, and the circular drive plate 111 is coaxially installed in the cylindrical mounting slot 21. This eliminates the need for slotting in the stator assembly 23 of the motor under test, and also eliminates the need for high-precision slotting to ensure accurate signal acquisition by the Hall sensor. This reduces the abnormal phenomenon of magnetic field inhomogeneity caused by slotting in the stator assembly 23. Simply installing the circular drive plate 111 in the cylindrical mounting slot 21 is sufficient to determine the real-time angular position of the rotor rotation of the motor under test, saving costs and improving the accuracy of determining the real-time angular position.
[0051] In one embodiment, the diameter of the circular drive plate 111 is less than or equal to the diameter of the cylindrical mounting groove 21, and the circular drive plate 111 and the cylindrical mounting groove 21 are connected by screws.
[0052] In one embodiment, the diameter of the circular drive plate 111 is larger than the diameter of the cylindrical mounting groove 21. The circular drive plate 111 is interference-fitted into the cylindrical mounting groove 21. In this case, the outer sidewall of the circular drive plate 111 is in contact with the inner sidewall of the cylindrical mounting groove 21.
[0053] In one embodiment, step S10, determining the current correction angle value of the motor under test based on the triggering time of the second triggering method and the time of determining the PWM duty cycle, includes:
[0054] The first phase information corresponding to the time point when the second triggering method is triggered is received through the signal interface in the encoding chip 112.
[0055] Understandably, after the input interface is triggered by the second triggering method, the phase information from the motor under test is received through the signal interface in the encoding chip 112. The phase information received at the time when the input interface is triggered by the second triggering method is determined as the first phase information. The signal interface is used to receive the phase-related signal emitted by the motor under test, for example, the signal interface receives the A-phase signal or the B-phase signal in the motor under test.
[0056] The second phase information corresponding to the time point at which the PWM duty cycle is determined is received through the signal interface.
[0057] Understandably, at the moment when the preset pulse width ratio model outputs the PWM duty cycle, the phase information from the motor under test at this moment is received through the signal interface and recorded as the second phase information.
[0058] The current correction angle value is determined based on the first phase information and the second phase information.
[0059] Understandably, the second phase information is subtracted from the first phase information to obtain a correction value. Then, the angle corresponding to the correction value is found through the preset correction value-angle lookup table in the encoding chip 112, and the found angle is determined as the current correction angle value.
[0060] This embodiment realizes that the first phase information corresponding to the time point when the second triggering mode is triggered is received through the signal interface in the encoding chip 112; the second phase information corresponding to the time point when the PWM duty cycle is determined is received through the signal interface; and the current correction angle value is determined based on the first phase information and the second phase information. In this way, the angle of slight rotation of the rotor of the motor under test before and after the execution of the preset pulse width ratio model can be determined. Subsequent corrections are made using the current correction angle value, which can improve the accuracy and reliability of the real-time angle position output.
[0061] S20, Based on the mechanical zero point position of the motor under test, determine the absolute angular position of the motor under test according to the PWM duty cycle.
[0062] Understandably, the motor under test includes a U-phase, a V-phase, and a W-phase, i.e., the motor under test is a three-phase motor. Under the influence of electromagnetic force, the rotor of the motor under test stops rotating and is locked at an electrical angle position. This position is recorded as the mechanical zero point position, also known as the electrical angle zero point position. A preset duty cycle-angle lookup table is retrieved from the memory. The preset duty cycle-angle lookup table is a table showing the relationship between duty cycle and angle determined based on different mechanical zero point positions. The angle position corresponding to the mechanical zero point position and the PWM duty cycle of the motor under test is looked up in the preset duty cycle-angle lookup table, and the retrieved angle position is recorded as the absolute angle position of the motor under test. The absolute angle position reflects the rotation angle corresponding to the PWM duty cycle.
[0063] In one embodiment, before step S20, that is, before determining the absolute angular position of the motor under test based on the mechanical zero-point position of the motor under test and the PWM duty cycle, the processor further performs the following steps when executing the computer-readable instructions:
[0064] A first current flowing from phase W to phase U and a second current flowing from phase V to phase U are synchronously supplied to the motor under test, and it is detected whether the motor under test has stopped rotating; the first current is equal to the second current.
[0065] Understandably, the first current and the second current are current values obtained from historical statistical analysis of mechanical zero-point positions. When the first current is applied to the W phase to the U phase and the second current is applied to the V phase to the U phase, the rotor will rotate back and forth in both directions due to the influence of electromagnetic force, eventually locking into a position and stopping rotation. After a preset time period of historical statistics, it is detected whether the motor under test has stopped rotating.
[0066] When the motor under test is detected to have stopped rotating, the current position information of the motor under test is received through the SPI interface in the encoder, and the current position information is determined as the mechanical zero point position of the motor under test.
[0067] Understandably, the encoder also includes an SPI interface, also known as a serial peripheral interface, which receives the current rotor stop rotating and locked position information and determines it as the mechanical zero point position of the motor under test.
[0068] This embodiment achieves the synchronous supply of a first current from phase W to phase U and a second current from phase V to phase U to the motor under test, and detects whether the motor under test has stopped rotating; the first current is equal to the second current; when the motor under test is detected to have stopped rotating, the current position information of the motor under test is received through the SPI interface in the encoder, and the current position information is determined as the mechanical zero point position of the motor under test. In this way, by applying a certain current to the three phases of the motor under test through the electromagnetic characteristics of the motor, the magnetic field formed by the stator assembly 23 and the rotor magnetic field interact to lock the stator assembly 23 of the motor at a fixed electrical angular position. The mechanical zero point position is recorded through the SPI interface, which improves the accuracy and reliability of mechanical zero point position identification.
[0069] In one embodiment, step S20, namely determining the absolute angular position of the motor under test based on the mechanical zero-point position of the motor under test and the PWM duty cycle, includes:
[0070] Retrieve the preset duty cycle-angle reference table from memory.
[0071] In the preset duty cycle-angle lookup table, look up the angle position corresponding to the mechanical zero point position and the PWM duty cycle of the motor under test, and record the queried angle position as the absolute angle position of the motor under test.
[0072] Understandably, in the preset duty cycle-angle lookup table, the duty cycle-angle table corresponding to the mechanical zero point position of the motor under test is first searched, and then the angle position corresponding to the PWM duty cycle is queried from the duty cycle-angle table, so that the queried angle position is recorded as the absolute angle position of the motor under test.
[0073] This embodiment implements the retrieval of a preset duty cycle-angle lookup table from its own memory; in the preset duty cycle-angle lookup table, the angle position corresponding to the mechanical zero point position and the PWM duty cycle of the motor under test is looked up, and the retrieval angle position is recorded as the absolute angle position of the motor under test. In this way, the absolute angle position of the motor under test can be automatically determined by the mechanical zero point position and the PWM duty cycle, without the need for identification by Hall sensor, and the corresponding absolute angle position can be directly determined by comparing it with the PWM signal.
[0074] S30, based on the current correction angle value and the absolute angle position, determine the real-time angle position of the motor under test rotating within the period corresponding to the PWM duty cycle.
[0075] Understandably, by summing the current correction angle value and the absolute angle position, i.e., by correcting the absolute angle position with the current correction angle value, the real-time angular position of the object under test within the period corresponding to the PWM duty cycle (i.e., the period of the PWM signal) is obtained. In this way, the absolute angle position can be determined based on the identified PWM signal duty cycle, and the absolute angle position can be corrected with the current correction angle value to accurately output the actual angle of rotation of the motor under test. This improves the accuracy of the real-time angular position identification of the motor and enhances the precision of subsequent control of the motor under test.
[0076] This embodiment achieves the following: by receiving the PWM signal of the motor under test, it identifies the PWM duty cycle of the PWM signal and the current correction angle value of the motor under test; based on the mechanical zero point position of the motor under test, it determines the absolute angular position of the motor under test according to the PWM duty cycle; based on the current correction angle value and the absolute angular position, it determines the real-time angular position of the motor under test within the period corresponding to the PWM duty cycle. Therefore, this embodiment achieves the identification of the PWM duty cycle and the current correction angle value by simply collecting the PWM signal of the motor under test without the need for a Hall sensor, and outputs the actual angular position of the motor under test based on the mechanical zero point position. This improves the accuracy of the real-time angular position identification of the motor, and saves the cost of Hall sensors and slotting costs by eliminating the need for a Hall sensor, thus improving the performance of the encoder.
[0077] In one embodiment, a method for determining the real-time angular position of a motor is provided. This method corresponds one-to-one with the real-time angular position determination system for motors described in the above embodiments, and is applied in the real-time angular position determination system. The method includes the following steps:
[0078] S10, receive the PWM signal of the motor under test, and identify the PWM duty cycle of the PWM signal and the current correction angle value of the motor under test.
[0079] Understandably, the PWM signal, also known as a pulse width modulation signal, refers to a square wave signal with a pulse width. The PWM signal has a fixed period and duty cycle. When it is necessary to obtain the real-time angular position of the motor under test, or when the motor under test is powered on or needs correction, the PWM signal of the motor under test is received. The PWM duty cycle of the PWM signal is identified. By setting the external interrupt trigger mode of the interface receiving the PWM signal, the triggering time points of different trigger modes and the switching time points of different trigger modes are collected. The PWM duty cycle of the PWM signal is determined by the collected time points through a preset pulse width ratio model. The phase information of the motor under test before and after the encoder executes the pulse width ratio model is received through the encoder. The current correction angle value of the motor under test is identified. The current correction angle value is the angle value that needs to be compensated to determine the real-time angular position of the motor under test. That is, the current correction angle value represents the angular offset of the rotor rotation of the motor under test during the current execution of the pulse width ratio model output PWM duty cycle, so as to accurately determine the real-time angular position of the motor under test later.
[0080] In one embodiment, the real-time angle position determination system for the motor under test further includes an encoder with an input interface, the processor is connected to the encoder, and the encoder is connected to the motor under test through the input interface.
[0081] Understandably, the encoder is a device that receives relevant information from the motor under test, converts it, and feeds it back to the processor. The encoder is connected to the processor and includes the input interface, which is used to receive the PWM signal from the motor under test.
[0082] In step S10, namely identifying the PWM duty cycle of the PWM signal, the following is included:
[0083] Set the external interrupt trigger mode of the encoder's input interface to the first trigger mode corresponding to the motor under test.
[0084] Understandably, the input interface is an input / output interface of the encoder that does not have register functionality. The input interface has external interrupt functionality, meaning it can receive interrupt events triggered by different external interrupt methods and execute the corresponding interrupt event program. These external interrupt trigger methods include rising edge triggering, falling edge triggering, high-level triggering, and low-level triggering. The external interrupt triggering method of the input interface can be set to rising edge triggering, falling edge triggering, high-level triggering, or low-level triggering. The first triggering method is based on the characteristics of the PWM signal output by the motor under test. The external interrupt triggering method is determined, and different motors correspond to different first triggering methods. For example, the proportion of high level in the PWM signal output by the motor under test reflects the PWM duty cycle or position information of the motor under test, and the first triggering method is the rising edge triggering method (i.e., triggered when the received PWM signal has a rising edge). Or, the proportion of low level in the PWM signal output by the motor under test reflects the PWM duty cycle or position information of the motor under test, and the first triggering method is the falling edge triggering method, etc. The motor under test can reflect the current relevant position or phase information through the PWM signal.
[0085] The number of times the input interface is triggered by the first triggering method is detected in real time.
[0086] Understandably, the first trigger count is detected in real time, where the first trigger count is the number of times the first trigger method is triggered.
[0087] When the first trigger count is a preset number, the external interrupt triggering mode is switched to a second triggering mode that is opposite to the triggering mechanism of the first triggering mode, and the time points when the first triggering mode is triggered twice are read from the encoder.
[0088] Understandably, the encoder is also used to record the time point when all interfaces are triggered. That is, the encoder includes a shared clock module, which can record the time point when each interface is triggered, or provide the current time point to each interface. When the first triggering method is triggered for the first time, the triggered time point is read from the encoder. When the first triggering method is triggered for the second time, the triggered time point is read from the encoder. After the first triggering method is triggered for the second time, the external interrupt triggering method of the input interface is switched to the second triggering method. The second triggering method is different from the first triggering method. The second triggering method can be the opposite of the triggering mechanism of the first triggering method.
[0089] The encoder enables the sharing of timer resources, eliminating the need to allocate dedicated timer resources for each PWM signal to the input interface, thus saving timer resources and improving their utilization.
[0090] After the input interface is triggered by the second triggering method, the time point of the triggering by the second triggering method is read from the encoder, and the external interrupt triggering method of the input interface is turned off.
[0091] Understandably, when the input interface is triggered after being set to the second trigger mode, the trigger time point is read from the encoder, and the external interrupt trigger mode of the input interface is stopped, that is, it will not be processed by external interrupt events.
[0092] Based on the time point when the signal is triggered by the second triggering method and the time points when it is triggered twice by the first triggering method, the PWM duty cycle of the PWM signal is determined using a preset pulse width ratio model.
[0093] Understandably, the preset pulse width ratio model is a model preset in the processor for calculating the PWM duty cycle of the received PWM signal based on the time points of two consecutive triggering events of the first triggering mode read from the encoder and the time point of the subsequent triggering event of the second triggering mode. The PWM duty cycle output by the preset pulse width ratio model is fed back to the host computer through the preset interface. The PWM duty cycle reflects the proportion of high or low potentials within the period of the PWM signal. In this way, high-precision PWM duty cycle measurement can be performed through one input interface in the encoder and the external interrupt triggering mode of the input interface, thereby enabling accurate determination of the rotation position or phase information of the motor under test.
[0094] Based on the time point when the second triggering method is triggered and the time point when the PWM duty cycle is determined, the current correction angle value of the motor under test is determined.
[0095] This embodiment sets the external interrupt triggering mode of the encoder's input interface to a first triggering mode corresponding to the motor under test; it detects in real time the first number of times the input interface is triggered by the first triggering mode; when the first triggering number is a preset number, it switches the external interrupt triggering mode to a second triggering mode with the opposite triggering mechanism to the first triggering mode, and reads the time points of the two triggering events by the first triggering mode from the encoder; after the input interface is triggered by the second triggering mode, it reads the time points of the second triggering mode from the encoder and disables the external interrupt triggering mode of the input interface; based on the time points of the second triggering mode and the two triggering events by the first triggering mode, it uses a preset pulse width ratio model to determine the PWM duty cycle of the PWM signal; based on the time points of the second triggering mode and the time points of determining the PWM duty cycle, it determines the current correction angle value of the motor under test. In this way, through an input interface without timing resources and the external interrupt triggering mode of that input interface, high-precision real-time motor angle position determination can be achieved, improving the utilization rate of the encoder interface and its timer resources, thereby accurately determining the rotation position or phase information of the motor.
[0096] In one embodiment, the pulse width ratio model is:
[0097] D = (T2 - T1) % (T1 - T0)
[0098] in,
[0099] D represents the PWM duty cycle;
[0100] T0 is the time point at which the first triggering method is first read from the encoder;
[0101] T1 is the time point read from the encoder when the device is triggered for the second time using the first triggering method;
[0102] T2 is the time point at which the device was triggered by the second triggering method, as read from the encoder.
[0103] Understandably, T1-T0 is the period of the PWM signal, and T2-T1 is the time interval between the second triggering time and the first triggering time. The reason for taking the remainder of T2-T1 from T1-T0 is that when the PWM duty cycle of the PWM signal is very small, after the input interface is triggered for the second time by the first triggering method, there will be a time delay when the external interrupt triggering method switches to the second triggering method. If a real triggering event of the second triggering method occurs within this time delay, the time of the triggering event will not be recorded because no corresponding response will be made before the second triggering method is switched. Therefore, it is necessary to wait for one period before the triggering time is recorded and the triggering time of the second triggering method is read from the encoder. Therefore, it is necessary to remove one period, and the remainder result is the true PWM duty cycle, which improves the accuracy and precision of PWM duty cycle recognition.
[0104] In one embodiment, the encoder includes a circular drive board 111 and an encoding chip 112 mounted on the circular drive board 111. One end of the motor shaft 22 of the motor under test is recessed to form a cylindrical mounting groove 21 that is adapted to the drive board, and the motor shaft 22 and the cylindrical mounting groove 21 are coaxially arranged. The circular drive board 111 is coaxially mounted in the cylindrical mounting groove 21.
[0105] Understandably, the circular drive board 111 is a circuit board used to drive the encoder. The encoding chip 112 is mounted on the circular drive board 111 and is used to execute the encoder's program to realize the encoder's function. One end of the motor shaft 22 of the motor under test is recessed to form a cylindrical mounting groove 21 that fits the drive board, and the motor shaft 22 and the cylindrical mounting groove 21 are coaxially arranged. The cylindrical mounting groove 21 is used to install the circular drive board 111, and uniformly fixes the circular drive board 111 on the motor shaft 22 of the motor under test, ensuring... To ensure consistent installation, the motor shaft 22 is coaxially arranged with the cylindrical mounting slot 21, and the circular drive plate 111 is coaxially installed in the cylindrical mounting slot 21. This eliminates the need for slotting in the stator assembly 23 of the motor under test, and also eliminates the need for high-precision slotting to ensure accurate signal acquisition by the Hall sensor. This reduces the abnormal phenomenon of magnetic field inhomogeneity caused by slotting in the stator assembly 23. Simply installing the circular drive plate 111 in the cylindrical mounting slot 21 is sufficient to determine the real-time angular position of the rotor rotation of the motor under test, saving costs and improving the accuracy of determining the real-time angular position.
[0106] In one embodiment, the diameter of the circular drive plate 111 is less than or equal to the diameter of the cylindrical mounting groove 21. The circular drive plate 111 and the cylindrical mounting groove 21 are connected by screws. Specifically, the circular drive plate 111 is provided with a first mounting hole, and the bottom of the cylindrical mounting groove 21 is provided with a second mounting hole. The circular drive plate 111 is fixed to the motor shaft 22 by screws passing through the first mounting hole and the second mounting hole, thereby making the connection stable.
[0107] In one embodiment, the diameter of the circular drive plate 111 is larger than the diameter of the cylindrical mounting groove 21. The circular drive plate 111 is interference-fitted into the cylindrical mounting groove 21. In this case, the outer sidewall of the circular drive plate 111 is in contact with the inner sidewall of the cylindrical mounting groove 21.
[0108] In one embodiment, step S10, determining the current correction angle value of the motor under test based on the triggering time of the second triggering method and the time of determining the PWM duty cycle, includes:
[0109] The first phase information corresponding to the time point when the second triggering method is triggered is received through the signal interface in the encoding chip 112.
[0110] Understandably, after the input interface is triggered by the second triggering method, the phase information from the motor under test is received through the signal interface in the encoding chip 112. The phase information received at the time when the input interface is triggered by the second triggering method is determined as the first phase information. The signal interface is used to receive the phase-related signal emitted by the motor under test, for example, the signal interface receives the A-phase signal or the B-phase signal in the motor under test.
[0111] The second phase information corresponding to the time point at which the PWM duty cycle is determined is received through the signal interface.
[0112] Understandably, at the moment when the preset pulse width ratio model outputs the PWM duty cycle, the phase information from the motor under test at this moment is received through the signal interface and recorded as the second phase information.
[0113] The current correction angle value is determined based on the first phase information and the second phase information.
[0114] Understandably, the second phase information is subtracted from the first phase information to obtain a correction value. Then, the angle corresponding to the correction value is found through the preset correction value-angle lookup table in the encoding chip 112, and the found angle is determined as the current correction angle value.
[0115] This embodiment realizes that the first phase information corresponding to the time point when the second triggering mode is triggered is received through the signal interface in the encoding chip 112; the second phase information corresponding to the time point when the PWM duty cycle is determined is received through the signal interface; and the current correction angle value is determined based on the first phase information and the second phase information. In this way, the angle of slight rotation of the rotor of the motor under test before and after the execution of the preset pulse width ratio model can be determined. Subsequent corrections are made using the current correction angle value, which can improve the accuracy and reliability of the real-time angle position output.
[0116] S20, Based on the mechanical zero point position of the motor under test, determine the absolute angular position of the motor under test according to the PWM duty cycle.
[0117] Understandably, the motor under test includes a U-phase, a V-phase, and a W-phase, i.e., the motor under test is a three-phase motor. Under the influence of electromagnetic force, the rotor of the motor under test stops rotating and is locked at an electrical angle position. This position is recorded as the mechanical zero point position, also known as the electrical angle zero point position. A preset duty cycle-angle lookup table is retrieved from the memory. The preset duty cycle-angle lookup table is a table showing the relationship between duty cycle and angle determined based on different mechanical zero point positions. The angle position corresponding to the mechanical zero point position and the PWM duty cycle of the motor under test is looked up in the preset duty cycle-angle lookup table, and the retrieved angle position is recorded as the absolute angle position of the motor under test. The absolute angle position reflects the rotation angle corresponding to the PWM duty cycle.
[0118] In one embodiment, before step S20, that is, before determining the absolute angular position of the motor under test based on the mechanical zero-point position of the motor under test and the PWM duty cycle, the following steps are included:
[0119] A first current flowing from phase W to phase U and a second current flowing from phase V to phase U are synchronously supplied to the motor under test, and it is detected whether the motor under test has stopped rotating; the first current is equal to the second current.
[0120] Understandably, the first current and the second current are current values obtained from historical statistical analysis of mechanical zero-point positions. When the first current is applied to the W phase to the U phase and the second current is applied to the V phase to the U phase, the rotor will rotate back and forth in both directions due to the influence of electromagnetic force, eventually locking into a position and stopping rotation. After a preset time period of historical statistics, it is detected whether the motor under test has stopped rotating.
[0121] When the motor under test is detected to have stopped rotating, the current position information of the motor under test is received through the SPI interface in the encoder, and the current position information is determined as the mechanical zero point position of the motor under test.
[0122] Understandably, the encoder also includes an SPI interface, also known as a serial peripheral interface, which receives the current rotor stop rotating and locked position information and determines it as the mechanical zero point position of the motor under test.
[0123] This embodiment achieves the synchronous supply of a first current from phase W to phase U and a second current from phase V to phase U to the motor under test, and detects whether the motor under test has stopped rotating; the first current is equal to the second current; when the motor under test is detected to have stopped rotating, the current position information of the motor under test is received through the SPI interface in the encoder, and the current position information is determined as the mechanical zero point position of the motor under test. In this way, by applying a certain current to the three phases of the motor under test through the electromagnetic characteristics of the motor, the magnetic field formed by the stator assembly 23 and the rotor magnetic field interact to lock the stator assembly 23 of the motor at a fixed electrical angular position. The mechanical zero point position is recorded through the SPI interface, which improves the accuracy and reliability of mechanical zero point position identification.
[0124] In one embodiment, step S20, namely determining the absolute angular position of the motor under test based on the mechanical zero-point position of the motor under test and the PWM duty cycle, includes:
[0125] Retrieve the preset duty cycle-angle reference table from memory.
[0126] In the preset duty cycle-angle lookup table, look up the angle position corresponding to the mechanical zero point position and the PWM duty cycle of the motor under test, and record the queried angle position as the absolute angle position of the motor under test.
[0127] Understandably, in the preset duty cycle-angle lookup table, the duty cycle-angle table corresponding to the mechanical zero point position of the motor under test is first searched, and then the angle position corresponding to the PWM duty cycle is queried from the duty cycle-angle table, so that the queried angle position is recorded as the absolute angle position of the motor under test.
[0128] This embodiment implements the retrieval of a preset duty cycle-angle lookup table from its own memory; in the preset duty cycle-angle lookup table, the angle position corresponding to the mechanical zero point position and the PWM duty cycle of the motor under test is looked up, and the retrieval angle position is recorded as the absolute angle position of the motor under test. In this way, the absolute angle position of the motor under test can be automatically determined by the mechanical zero point position and the PWM duty cycle, without the need for identification by Hall sensor, and the corresponding absolute angle position can be directly determined by comparing it with the PWM signal.
[0129] S30, based on the current correction angle value and the absolute angle position, determine the real-time angle position of the motor under test rotating within the period corresponding to the PWM duty cycle.
[0130] Understandably, by summing the current correction angle value and the absolute angle position, i.e., by correcting the absolute angle position with the current correction angle value, the real-time angular position of the object under test within the period corresponding to the PWM duty cycle (i.e., the period of the PWM signal) is obtained. In this way, the absolute angle position can be determined based on the identified PWM signal duty cycle, and the absolute angle position can be corrected with the current correction angle value to accurately output the actual angle of rotation of the motor under test. This improves the accuracy of the real-time angular position identification of the motor and enhances the precision of subsequent control of the motor under test.
[0131] This embodiment achieves the following: by receiving the PWM signal of the motor under test, it identifies the PWM duty cycle of the PWM signal and the current correction angle value of the motor under test; based on the mechanical zero point position of the motor under test, it determines the absolute angular position of the motor under test according to the PWM duty cycle; based on the current correction angle value and the absolute angular position, it determines the real-time angular position of the motor under test within the period corresponding to the PWM duty cycle. Therefore, this embodiment achieves the identification of the PWM duty cycle and the current correction angle value by simply collecting the PWM signal of the motor under test without the need for a Hall sensor, and outputs the actual angular position of the motor under test based on the mechanical zero point position. This improves the accuracy of the real-time angular position identification of the motor, and saves the cost of Hall sensors and slotting costs by eliminating the need for a Hall sensor, thus improving the performance of the encoder.
[0132] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0133] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the method for determining the real-time angle position of a motor as described above.
[0134] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0135] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0136] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A real-time angle position determination system for an electric machine, characterized by The system comprises a memory, a processor connected to a motor to be tested, and computer readable instructions stored in the memory and executable on the processor, and the processor executes the computer readable instructions to implement the following steps: receiving a PWM signal of the motor to be tested, and identifying a PWM duty cycle of the PWM signal and a current correction angle value of the motor to be tested; determining an absolute angle position of the motor to be tested according to the PWM duty cycle based on a mechanical zero position of the motor to be tested; determining a real-time angle position of the motor to be tested in a period corresponding to the PWM duty cycle according to the current correction angle value and the absolute angle position; The real-time angle position determination system of the motor to be tested further comprises an encoder having an input interface, and the processor is connected to the encoder, and the encoder is connected to the motor to be tested through the input interface. The identification of the PWM duty cycle of the PWM signal and the current correction angle value of the motor to be tested comprises: setting an external interrupt trigger mode of the input interface of the encoder to a first trigger mode corresponding to the motor to be tested; real-time detecting a first trigger frequency of the input interface triggered by the first trigger mode; when the first trigger frequency is a preset frequency, switching the external interrupt trigger mode to a second trigger mode opposite to the trigger mechanism of the first trigger mode, and reading twice from the encoder the time points triggered by the first trigger mode; after the input interface is triggered by the second trigger mode, reading from the encoder the time point triggered by the second trigger mode, and closing the external interrupt trigger mode of the input interface; determining the PWM duty cycle of the PWM signal according to the time point triggered by the second trigger mode and the time points triggered twice by the first trigger mode by using a preset pulse width ratio model; determining the current correction angle value of the motor to be tested according to the time point triggered by the second trigger mode and the time point of determining the PWM duty cycle; The determination of the absolute angle position of the motor to be tested according to the PWM duty cycle based on the mechanical zero position of the motor to be tested comprises: calling a preset duty cycle-angle correspondence table from the memory; in the preset duty cycle-angle correspondence table, querying an angle position corresponding to the mechanical zero position of the motor to be tested and the PWM duty cycle, and recording the queried angle position as the absolute angle position of the motor to be tested.
2. The motor real-time angle position determination system of claim 1, wherein, The encoder comprises a circular driving plate and an encoding chip mounted on the circular driving plate, one end of a motor shaft of the motor to be tested is recessed to form a cylindrical mounting groove matched with the driving plate, and the motor shaft is coaxially arranged with the cylindrical mounting groove, and the circular driving plate is coaxially mounted in the cylindrical mounting groove.
3. The motor real-time angle position determination system of claim 1, wherein, The pulse width ratio model is: wherein, D is the PWM duty cycle; T0 is the first time point triggered by the first trigger mode read from the encoder; T1 is the second time point triggered by the first trigger mode read from the encoder; T2 is a time point triggered by the second trigger mode and read from the encoder.
4. The motor real-time angle position determination system of claim 1, wherein, Before determining the absolute angle position of the motor to be tested according to the PWM duty cycle based on the mechanical zero position of the motor to be tested, the processor executes the computer readable instructions to further implement the following steps: Synchronously providing a first current of W-phase flow to U-phase and a second current of V-phase flow to U-phase to the motor to be tested, and detecting whether the motor to be tested stops rotating; The first current is equal to the second current; When detecting that the motor to be tested stops rotating, receiving the current position information of the motor to be tested through the SPI interface in the encoder, and determining the current position information as the mechanical zero position of the motor to be tested.
5. The motor real-time angle position determination system of claim 1, wherein, The current correction angle value of the motor to be tested is determined according to the time point triggered by the second trigger mode and the time point of determining the PWM duty cycle, including: Receiving first phase information corresponding to the time point triggered by the second trigger mode through a signal interface in the encoding chip of the encoder; Receiving second phase information corresponding to the time point of determining the PWM duty cycle through the signal interface; Determining the current correction angle value according to the first phase information and the second phase information.
6. A method of real-time angle position determination of an electrical machine, characterized in that Including: Receiving the PWM signal of the motor to be tested, identifying the PWM duty cycle of the PWM signal and the current correction angle value of the motor to be tested; Determining the absolute angle position of the motor to be tested according to the PWM duty cycle based on the mechanical zero position of the motor to be tested; According to the current correction angle value and the absolute angle position, the real-time angle position of the motor to be tested rotating in the period corresponding to the PWM duty cycle is determined; The identification of the PWM duty cycle of the PWM signal and the current correction angle value of the motor to be tested includes: Setting the external interrupt trigger mode of the input interface of the encoder to the first trigger mode corresponding to the motor to be tested; Real-time detecting the first trigger frequency of the input interface triggered by the first trigger mode; When the first trigger frequency is a preset frequency, switching the external interrupt trigger mode to the second trigger mode opposite to the trigger mechanism of the first trigger mode, and reading twice the time point triggered by the first trigger mode from the encoder; After the input interface is triggered by the second trigger mode, reading the time point triggered by the second trigger mode from the encoder, and closing the external interrupt trigger mode of the input interface; According to the time point triggered by the second trigger mode and the time point triggered by the first trigger mode twice, a preset pulse width duty cycle model is used to determine the PWM duty cycle of the PWM signal; According to the time point triggered by the second trigger mode and the time point of determining the PWM duty cycle, the current correction angle value of the motor to be tested is determined. The determination of the absolute angle position of the motor to be tested according to the PWM duty cycle based on the mechanical zero position of the motor to be tested includes: Fetching a preset duty cycle-angle correspondence table from the memory; In the preset duty ratio-angle correspondence table, an angle position corresponding to the mechanical zero position of the motor to be tested and the PWM duty ratio is queried, and the queried angle position is recorded as an absolute angle position of the motor to be tested.
7. The method of real-time angle position determination of an electric machine of claim 6, wherein, The pulse width duty ratio model is: wherein, D is a PWM duty ratio; T0 is a time point at which the first trigger mode is triggered for the first time by reading the encoder; T1 is a time point at which the first trigger mode is triggered for the second time by reading the encoder; T2 is a time point at which the second trigger mode is triggered by reading the encoder.
8. The method of real-time angle position determination of an electric machine of claim 7, wherein, The current correction angle value of the motor to be tested is identified, and the method comprises: receiving first phase information corresponding to the time point at which the second trigger mode is triggered through a signal interface in an encoding chip of the encoder; receiving second phase information corresponding to a time point at which the PWM duty ratio is determined through the signal interface; determining the current correction angle value according to the first phase information and the second phase information.
9. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 8. The computer program is executed by a processor to implement the motor real-time angle position determination method according to any one of claims 6 to 8.
Citation Information
Patent Citations
Control method for correcting phase of brushless DC motor without position sensor
CN101355334A
Method and device for measuring terminal voltage of motor
CN108777557A