Motor control method based on sine and cosine encoder, electronic equipment and storage medium

The lack of initial control angle accuracy when the motor is started is solved by performing self-learning when the motor is first powered on, determining the offset and gain of the sine and cosine encoders, and using these values ​​to correct the CD angle when the motor is powered back on after a power outage. This solves the problem and improves the accuracy of motor restart and ride comfort.

CN119341404APending Publication Date: 2025-01-21SHENZHEN INVT ELECTRIC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411513218.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

The prior art is susceptible to external environmental interference and sampling errors when obtaining the C and D signals output by the sine cosic encoder, resulting in poor accuracy of the initial control angle when the motor starts up, affecting the speed measurement and normal operation of the motor.

Method used

By performing self-learning of the initial control angle when the motor is powered on for the first time, the C signal offset, D signal offset and relative gain of the sine and cosine encoder are determined, and when the motor is powered on again after a power outage, the last run is used directly. The CD angle is corrected with the offset and gain determined to determine the current control angle when the motor is restarted.

Benefits of technology

It improves the accuracy of the control angle when the motor starts, ensures the accurate start of the motor after powering on again, avoids the startup noise when the power is turned off and restarts, and improves the comfort during the elevator ride.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119341404A_ABST
    Figure CN119341404A_ABST
Patent Text Reader

Abstract

The invention discloses a motor control method based on a sine and cosine encoder, electronic equipment and a storage medium, and relates to the field of motor control. When a motor is powered on for the first time, a self-learning process of an initial control angle of the motor is carried out, the motor is controlled to operate to learn out bias and gain of C and D signals online, and under the condition that the motor is powered off and restarted, the self-learning process is carried out; the control angle of the motor is corrected on line directly according to the offset and gain of the C and D signals determined in the previous power-on operation process, so that the influence of the offset of the C and D signals on the speed measurement accuracy of the sine and cosine encoder and the normal operation of the motor is avoided, the accuracy of the finally determined control angle is improved, and when the motor is powered on again, the accuracy of the control angle is improved. According to the method, the CD angle is corrected by directly adopting the offset and gain of the C and D signals determined in the last operation, so that the starting control of the motor can be completed, angle self-learning is not needed, the starting noise during power failure restarting is avoided, and the comfort in the elevator taking process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of motor control, and in particular to a motor control method, electronic equipment and storage medium based on a sine-cosine encoder. Background Art

[0002] In the application process of elevators, in order to make the elevator motor have better dynamic and static response at any speed and operating state, the vector control mode with encoder is often used to control the operation of the motor. Among them, the sine-cosine encoder is widely used in the control process of elevator motors because of its subdivision speed measurement function, which can more accurately reflect the position and speed of the motor than other types of encoders.

[0003] In the process of controlling the motor start-up, how to determine the initial control angle when the motor starts is an important aspect of controlling the normal operation of the motor. In the prior art, in the process of controlling the motor start-up, the C and D signals output by the sine and cosine encoders are obtained to determine the initial control angle when the motor starts. However, when obtaining the C and D signals, they are affected by factors such as external environmental interference and sampling errors, resulting in poor accuracy of the final determined control angle, thereby affecting the speed measurement and the normal operation of the motor. Summary of the invention

[0004] The purpose of the present invention is to provide a motor control method, electronic device and storage medium based on a sine-cosine encoder, which avoids the influence of the deviation of C and D signals on the speed measurement accuracy of the sine-cosine encoder and the normal operation of the motor, improves the accuracy of the control angle finally determined, and directly uses the corrected CD angle to determine the current control angle when the motor is powered on again when it is powered on again when it is powered on again, ensuring the accurate startup of the motor after it is powered on again, and no angle self-learning is required, thereby avoiding the startup noise when the power is off and restarted, and improving the comfort of the elevator during riding.

[0005] In order to solve the above technical problems, the present invention provides a motor control method based on a sine-cosine encoder, comprising:

[0006] When the motor is powered on for the first time, self-learning of the initial control angle of the motor is performed so as to control the motor to start after the first power-on according to the initial control angle, wherein the initial control angle includes an encoder installation angle of a sine-cosine encoder connected to the motor and a CD angle of the sine-cosine encoder;

[0007] During the operation of the motor, the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder is repeated with a preset number of rotations as a repetition period until the motor is powered off;

[0008] When the motor is powered on again, the current CD angle is determined based on the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal;

[0009] The current control angle of the motor is determined based on the current CD angle, so as to control the start-up of the motor after power is restored according to the current control angle.

[0010] Optionally, determining the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder includes:

[0011] Obtaining a first C signal sampling value and a first D signal sampling value output by the sine-cosine encoder when the motor is powered on for the first time, and using the first C signal sampling value as an initial value of the maximum value of the C signal and an initial value of the minimum value of the C signal, and using the first D signal sampling value as an initial value of the maximum value of the D signal and an initial value of the minimum value of the D signal;

[0012] Determine whether the number of rotations of the motor has reached the preset number of rotations;

[0013] If yes, stop recording, and update the minimum value of the C signal, the maximum value of the C signal, the minimum value of the D signal, and the maximum value of the D signal based on the recording results of the C signal and the D signal, the first C signal sampling value, and the first D signal sampling value;

[0014] Determine the average of the minimum value of the C signal and the maximum value of the C signal as the offset of the C signal;

[0015] Determine the average of the minimum value of the D signal and the maximum value of the D signal as the bias of the D signal;

[0016] A first difference between a maximum value of the C signal and a minimum value of the C signal is calculated, a second difference between a maximum value of the D signal and a minimum value of the D signal is calculated, and a ratio of the first difference to the second difference is determined as a relative gain between the C signal and the D signal.

[0017] Optionally, also include:

[0018] Determining whether the bias of the C signal and / or the bias of the D signal exceeds a corresponding preset bias value;

[0019] If yes, the theoretical offset value is determined as the offset of the C signal and / or the offset of the D signal;

[0020] and / or,

[0021] Determining whether the relative gain between the C signal and the D signal exceeds a preset gain value;

[0022] If so, the theoretical gain value is determined as the relative gain between the C signal and the D signal.

[0023] Optionally, the current CD angle is determined based on the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal, including:

[0024] Obtain the second C signal sampling value and the second D signal sampling value output by the sine-cosine encoder when the motor is powered on again, and obtain the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal;

[0025] Calculating a third difference between the second C signal sampling value and the latest C signal offset, and calculating a product between the third difference and the relative gain between the latest C signal and D signal;

[0026] Determine the product as the current C signal;

[0027] Determine the second D signal sampling value and the offset of the latest D signal as the current D signal;

[0028] The ratio of the current D signal to the current C signal is calculated, and the arc tangent result of the ratio of the current D signal to the current C signal is used as the current CD angle.

[0029] Optionally, performing self-learning of the initial control angle of the motor includes:

[0030] The initial control angle of the motor is self-learned by adopting a magnetic pole angle static self-learning method or an initial angle load rotation self-learning method;

[0031] When the initial angle load rotation self-learning method is used to perform self-learning of the initial control angle of the motor, the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder is repeated with a preset number of rotations as a repetition period during the operation of the motor, including:

[0032] During the motor's loaded rotation, the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder is repeated with a preset number of rotations as a repetition period.

[0033] Optionally, after controlling the motor to start according to the corresponding control angle, the method further includes:

[0034] Correcting the real-time control angle of the motor based on the real-time CD angle of the sine-cosine encoder;

[0035] When the motor encounters a Z signal for the first time, determining a Z signal initial angle of the Z signal;

[0036] After the motor encounters the Z signal for the second time, the real-time control angle of the motor is corrected based on the Z signal and the Z signal initial angle.

[0037] Optionally, correcting the real-time control angle of the motor based on the real-time CD angle of the sine-cosine encoder comprises:

[0038] When the motor is powered on, determining the power-on rotation angle of the motor;

[0039] The output signal of the sine-cosine encoder is sampled in real time to determine the real-time CD angle and the real-time rotor position angle of the motor;

[0040] A fourth difference between the real-time rotor position angle and the power-on rotation angle is calculated, and the sum of the fourth difference, the CD angle corresponding to the current power-on startup and the real-time CD angle is determined as the real-time control angle of the motor.

[0041] Optionally, also include:

[0042] If, in the process of determining the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder, the difference between the maximum value of the C signal and the minimum value of the C signal is less than a preset threshold, it is determined that the C signal has a signal disconnection; if the difference between the maximum value of the D signal and the minimum value of the D signal is less than a preset threshold, it is determined that the D signal has a signal disconnection;

[0043] If the C signal and / or the D signal is disconnected, the theoretical offset value is determined as the offset of the C signal and the offset of the D signal, and the theoretical gain value is determined as the relative gain between the C signal and the D signal.

[0044] In order to solve the above technical problems, the present invention further provides an electronic device, comprising:

[0045] Memory for storing computer programs;

[0046] A processor is used to implement the steps of the motor control method based on the sine-cosine encoder as described above.

[0047] In order to solve the above technical problems, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the motor control method based on the sine-cosine encoder are implemented.

[0048] The present invention provides a motor control method based on a sine-cosine encoder. When the motor is powered on for the first time, a self-learning process of the initial control angle of the motor is performed, and the motor operation is controlled to determine the bias of the C signal of the sine-cosine encoder, the bias of the D signal, and the relative gain between the C signal and the D signal, and the bias and gain of the C and D signals are learned online. When the motor is powered off and restarted, the control angle of the motor is directly corrected online according to the bias and gain of the C and D signals determined in the previous power-on operation process, so as to determine the control angle when the motor is restarted. The bias and gain of the self-learned C and D signals are used to perform angle correction, thereby avoiding the influence of the deviation of the C and D signals on the speed measurement accuracy of the sine-cosine encoder and the normal operation of the motor, and improving the accuracy of the control angle finally determined. When the motor is powered on again, the bias and gain of the C and D signals determined in the last operation are directly used to correct the CD angle, so as to use the corrected CD angle to determine the current control angle when the motor is powered on again, ensuring the accurate startup of the motor after the motor is powered on again, no need to perform angle self-learning, avoiding the startup noise when the power is off and restarted, and improving the comfort of the elevator during riding.

[0049] The present invention also provides an electronic device and a computer-readable storage medium, which have the same beneficial effects as the above-mentioned motor control method based on the sine-cosine encoder. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the prior art and the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0051] Figure 1 A schematic flow chart of a motor control method based on a sine-cosine encoder provided by the present invention;

[0052] Figure 2 A schematic diagram of a flow chart of a bias and gain self-learning process provided by the present invention;

[0053] Figure 3 A schematic diagram of a flow chart of a motor control angle correction process provided by the present invention;

[0054] Figure 4 A schematic diagram of a process of using C signal and D signal to correct the motor control angle provided by the present invention;

[0055] Figure 5 A schematic diagram of a process of using a Z signal to correct a motor control angle provided by the present invention;

[0056] Figure 6 The present invention provides a schematic structural diagram of an electronic device. DETAILED DESCRIPTION

[0057] The core of the present invention is to provide a motor control method, electronic device and storage medium based on a sine-cosine encoder, which avoids the influence of the deviation of C and D signals on the speed measurement accuracy of the sine-cosine encoder and the normal operation of the motor, improves the accuracy of the control angle finally determined, and when the motor is powered on again, the corrected CD angle is directly used to determine the current control angle when the motor is powered on again, ensuring the accurate startup of the motor after powering on again, without the need for angle self-learning, avoiding the startup noise when power is lost and restarted, and improving the comfort of the elevator during riding.

[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] Please refer to Figure 1 , Figure 1 A flow chart of a motor control method based on a sine-cosine encoder provided by the present invention; To solve the above technical problems, the present invention provides a motor control method based on a sine-cosine encoder, comprising:

[0060] S11: When the motor is powered on for the first time, self-learning of the initial control angle of the motor is performed so that the motor can be started according to the initial control angle after the first power-on. The initial control angle includes the encoder installation angle of the sine-cosine encoder connected to the motor and the CD angle of the sine-cosine encoder.

[0061] It is understandable that when the motor is powered on for the first time after installation, it will enter the parameter self-learning stage to perform self-learning of the motor parameters. The motor parameters in this self-learning process include at least the electrical parameters of the motor, the initial value of the CD angle of the sine-cosine encoder, and the installation angle of the sine-cosine encoder. The electrical parameters of the motor include resistance, inductance, back electromotive force, etc. The absolute position information of the motor can be determined based on the learned initial value of the CD angle of the sine-cosine encoder and the installation angle of the sine-cosine encoder. The CD angle of the sine-cosine encoder can be used to determine the absolute position of the shaft of the sine-cosine encoder. At the same time, based on the learned installation angle of the sine-cosine encoder, the absolute position angle output by the sine-cosine encoder can be accurately determined, so that the initial control angle for subsequent control of the motor rotation can be determined by the absolute position angle.

[0062] It should be noted that as long as the motor is powered on, the sine-cosine encoder will have signal output. The initial value of the CD angle refers to the CD angle corresponding to the C signal and D signal output by the sine-cosine encoder when the motor is powered on for the first time, which is the value of the CD angle when the motor is powered on for the first time. The initial control angle refers to the angle control value used when the motor is powered on for the first time to control the motor to start running for the first time. The motor parameter self-learning stage can be achieved by using the six-pulse static self-learning method or the load-rotating self-learning method. These two methods can effectively learn the initial value of the CD angle and the installation angle of the encoder.

[0063] S12: During the operation of the motor, the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal are determined based on the output signal of the sine-cosine encoder with a preset number of rotations as a repetition period until the motor is powered off.

[0064] It is not difficult to understand that during the operation of the motor, the motor may be powered off due to abnormal faults or application requirements. After the abnormality is eliminated or the motor is restored to use, it will be powered on again. At this time, if the motor that has been powered on again wants to restart and run, it is also necessary to determine the control angle of the restart process in order to accurately control the process of resuming the operation of the motor. In order to improve the accuracy of the control angle determined during the restart process, after the motor is powered on for the first time, it is necessary to control the motor to run for a period of time, and during the operation of the motor, the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal are self-learned, so that the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal can be used to correct the CD angle later. The bias and gain of the C signal and the D signal are learned by adding a sine-cosine encoder CD signal bias and gain online self-learning module to the motor's self-learning module. The sine-cosine encoder CD signal bias and gain online self-learning module is used to determine the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder. Each time the sine-cosine encoder CD signal bias and gain online self-learning module is called, a bias and gain self-learning process will be performed.

[0065] It is understandable that in order to ensure that the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal obtained when the motor is powered on again are the most accurate results closest to the restart process, during the operation of the motor after it is powered on for the first time, as long as the motor is in operation, the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder will be continuously repeated, that is, the sine-cosine encoder CD signal offset and gain online self-learning module will be called once or multiple times until the motor is powered off. However, if the motor stops rotating before the power is turned off, the CD signal offset and gain self-learning process cannot be performed. Therefore, the CD signal offset and gain self-learning process can only be performed when the motor is powered on and running. Once the motor stops rotating or the motor is powered off, the CD signal offset and gain self-learning process cannot be performed.

[0066] It should be noted that after the motor is powered on for the first time, it may only run one circle, at which time the bias and gain self-learning process will only be performed once, or it may run multiple circles, at which time the bias and gain self-learning process can be performed once when the motor runs each circle. There are many options for the specific value of the preset number of rotations. When the preset number of rotations is 1, the bias and gain self-learning process can be achieved when the motor rotates more than 1 circle. In order to further improve the accuracy of the final bias and gain, the preset number of rotations can be set to a larger value. For example, when the preset number of rotations is 2, each time the motor is started and rotated more than two circles, the sine-cosine encoder CD signal bias and gain online self-learning module will output the current C signal, D signal bias and gain and perform CD signal correction. At this time, the bias and gain are determined using the C signal and D signal of the motor rotating two circles, which is more accurate. Furthermore, the accuracy of the control process can be further improved by averaging multiple biases or gains. If the motor rotates more than 8 times, the latest bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal can be determined by outputting the average of the four calculation results to improve the accuracy of the bias and gain of the C signal and the D signal when the elevator is powered off and restarted. Therefore, the number of calls to the online self-learning module of the sine-cosine encoder CD signal bias and gain is related to the setting of the preset number of rotations, the actual running time of the motor, and the power-off time of the motor, and needs to be adjusted and set according to the different operating conditions of the motor, and this application does not make any special restrictions here.

[0067] S13: When the motor is powered on again, the current CD angle is determined based on the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal.

[0068] It is understandable that when the motor is self-learning the offset and gain of the CD signal, the results of each self-learning can be saved, and the final values ​​of the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal can be continuously updated with the repeated determination process to keep them at the latest values. It is only necessary to ensure that the motor can obtain the latest offset and gain when it is powered on again. When the motor is powered on again, it is necessary to determine the output signal of the sine and cosine encoder corresponding to the current power-on process, and correct the CD angle of the sine and cosine encoder of the current power-on process according to the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal obtained by the previous self-learning, and determine the current CD angle of the motor when it is currently powered on with higher accuracy.

[0069] S14: Determine the current control angle of the motor based on the current CD angle, so as to control the start of the motor after power is restored according to the current control angle.

[0070] Considering that in the prior art, when the Z signal initial angle of the sine-cosine encoder is used as the initial control angle when the motor starts, the C and D signals output by the sine-cosine encoder are not obtained. At this time, the sine-cosine encoder is equivalent to an encoder without an absolute position signal. Therefore, every time the elevator is powered on again and the motor needs to be run, it is necessary to re-perform the angle self-learning process to obtain the absolute position information of the motor, and this process has obvious noise, which affects the riding comfort of the elevator. Therefore, in this application, when the motor is powered on again, the current CD angle can be directly used to control the restart of the motor. The current CD angle is directly obtained by sampling the output signal of the sine-cosine encoder, and after sampling, the latest C signal offset, D signal offset, and the relative gain between the C signal and the D signal are used to correct the sampled CD angle.

[0071] It is not difficult to understand that after the motor is installed, the installation angle of the encoder will remain unchanged. Therefore, after determining the current CD angle when the motor is currently powered on, the current position of the motor can be determined based on the current CD angle. Then, the current control angle of the motor corresponding to the current power-on process of the motor is re-determined based on the initial magnetic pole angle and the current position of the motor. The current CD angle is corrected using the offset and gain of the C and D signals obtained by self-learning, thereby realizing the correction process of the current control angle when the motor is started. The current control angle refers to the angle control value used when the motor is currently powered on to control the motor to start the first operation after the motor is powered on again.

[0072] It should be noted that the motor may be powered off and powered on again more than once in actual applications. Therefore, if the motor is started after being powered on again, the motor starts to rotate and enters the running state, it will jump to step S12 again, and continue the self-learning process of the offset and gain of the CD signal during the running process of the motor being powered on again after the first power failure, until the motor is powered off for the second time. When the motor is powered on again after the second power failure, the latest offset and gain learned after the second power failure will be used to determine the current CD angle corresponding to the power-on process after the second power failure. This process is repeated to realize the determination process of the current control angle of the motor after each power failure and power-on, ensuring that the motor will not be affected by the lack of absolute position information when the motor is powered on for the first time; at the same time, it is ensured that the accuracy of speed measurement through the sine-cosine encoder will not be affected by the deviation of the CD signal during the subsequent motor operation.

[0073] It can be understood that when the motor is powered on again, at the first start after each power-on, the latest C signal and D signal offset and gain will be learned based on the self-learning process of the C signal and D signal offset and gain in step S12, and the inverse tangent results of the C signal and D signal will be calculated by reading the current positions of the C signal and D signal at this power-on, and at the same time, the latest C signal and D signal offset and gain self-learned in the last power-on process will be read to correct the inverse tangent results, thereby obtaining the current CD angle and calculating the current control angle for starting at the current position.

[0074] Furthermore, in order to improve the accuracy and reliability of the motor vector control process, whether the motor is powered on for the first time or powered on again, the first operation after the motor is powered on, that is, the start-up process of controlling the motor, is achieved by determining the corresponding CD angle to determine the control angle of the motor's first operation. However, after the motor is started, when it continues to rotate to the position where it first encounters the Z signal, the initial angle of the Z signal will be recorded. When the motor rotates to the position where it encounters the Z signal for the second time, the bias and gain of the C and D signals at the current moment are self-learned, and the values ​​obtained by self-learning are recorded; at the same time, the initial angle of the Z signal is used to replace the CD angle to perform the angle correction process of the motor's control angle, and the Z signal is used for correction in the subsequent operation of the motor after this power-on. Thus, a hybrid correction scheme based on the sine-cosine encoder is realized by setting up the sine-cosine encoder CD signal bias and gain online self-learning module and the angle correction module. In the "CD signal bias and gain online self-learning module", the current C and D signal bias and gain are learned through online self-learning, and the current control angle is synchronously corrected when the motor is powered on, which improves the stability of the motor and the elevator it is in when starting, and reduces the starting jitter. In the "angle correction module", combined with the more stable characteristic of the Z signal angle, it is selected to use the Z signal initial angle instead of the CD initial angle for correction after the Z signal is encountered for the second time during rotation.

[0075] It is not difficult to understand that the execution of the entire motor control method based on the sine-cosine encoder can be directly implemented by multiplexing the controller of the motor, or it can be implemented by other processors and the like. For example, when the present invention is applied to the application scenario of the elevator, when the permanent magnet synchronous traction machine is implemented on the basis of the drive control of the inverter, the motor is the permanent magnet synchronous traction machine in the elevator, and the motor control method based on the sine-cosine encoder can be directly implemented by the inverter control, helping the inverter to determine a more accurate angle control value for the motor. The present invention is suitable for application scenarios such as the vector control mode of the motor, and the correction of the angle control value of the startup process when the motor is powered on is realized by the sine-cosine encoder. The specific types of motors and sine-cosine encoders and implementation methods are not particularly limited in this application, and can be adjusted according to the actual application scenario.

[0076] It should be noted that, in order to ensure the accuracy of motor control, in the normal operation stage when the motor is not powered off, based on the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal obtained in the process of step S12, the CD angle of the sine-cosine encoder is used to correct the control angle during the first operation after the motor is powered on. When the motor continues to rotate until it encounters the Z signal for the second time, the initial angle of the Z signal is used to replace the CD angle to perform angle correction for each circle, thereby ensuring the accuracy of subsequent angle correction. By correcting the CD angle using the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal during the first operation after power-on, the problem of inaccurate angle correction of the control angle caused by factors such as sampling errors of the C and D signals is avoided. By using the CD angle for angle correction during the first operation after power-on, the noise problem caused by the need for self-learning each time power is on is avoided. The accuracy of the angle correction of the motor control angle and the comfort of the elevator ride are improved.

[0077] The present invention belongs to the field of motor control and permanent magnet synchronous traction machine drive of elevators, and mainly provides a hybrid sine-cosine encoder hybrid correction scheme. In the parameter self-learning stage when the motor is powered on for the first time, the process of learning the bias and gain of C and D signals online is added, and the CD angle and the control angle of the motor are corrected online using the determined bias and gain, thereby improving the accuracy of the motor angle control. In the normal operation stage of the motor, multiple turns and multiple self-learning are performed to further improve the accuracy of the CD angle. In the self-learning stage, disconnection detection can be further added to avoid startup failure caused by disconnection of C signal or D signal. At the same time, the self-learning result is initialized for the disconnection condition, and the error of the self-learning result caused by disconnection is also avoided, which affects the startup comfort. When the power is off and restarted, the C and D signals are used for correction before the Z signal is encountered for the second time, and the Z signal is used for correction after the Z signal is encountered, thereby avoiding the sampling deviation of the C and D signals caused by external interference. The noise caused by self-learning when the motor is powered on again is avoided, which improves the comfort of elevator riding. The correction errors caused by interference of C and D signals of conventional sine and cosine encoders are taken into consideration, ensuring the accuracy of CD angle. The whole solution is simple and clear.

[0078] The present invention provides a motor control method based on a sine-cosine encoder. When the motor is powered on for the first time, a self-learning process of the initial control angle of the motor is performed, and the motor operation is controlled to determine the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal of the sine-cosine encoder. The offset and gain of the C and D signals are learned online. When the motor is powered off and restarted, the control angle of the motor is directly corrected online according to the offset and gain of the C and D signals determined in the previous power-on operation process, so as to determine the initial control angle when the motor is restarted. The angle correction is performed by using the self-learning offset and gain of the C and D signals, thereby avoiding the influence of the deviation of the C and D signals on the speed measurement accuracy of the sine and cosine encoder and the normal operation of the motor, and improving the accuracy of the initial control angle finally determined for controlling the motor start. When the motor is powered on again, the offset and gain of the C and D signals determined during the last operation are directly used to correct the CD angle, so that the corrected CD angle is used to determine the current control angle when the motor is powered on again, ensuring the accurate startup of the motor after powering on again, without the need for angle self-learning, avoiding the startup noise during power-off restart, and improving the comfort of the elevator during riding.

[0079] Based on the above embodiments:

[0080] Please refer to Figure 2 , Figure 2 A schematic flow chart of a self-learning process of bias and gain provided by the present invention; as an optional embodiment, determining the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder includes:

[0081] Obtain a first C signal sampling value and a first D signal sampling value output by the sine-cosine encoder when the motor is powered on for the first time, and use the first C signal sampling value as an initial value of the maximum value of the C signal and an initial value of the minimum value of the C signal, and use the first D signal sampling value as an initial value of the maximum value of the D signal and an initial value of the minimum value of the D signal;

[0082] Determine whether the number of rotations of the motor has reached the preset number of rotations;

[0083] If not, record the C and D signals output by the sine-cosine encoder;

[0084] If yes, stop recording, and update the minimum value of the C signal, the maximum value of the C signal, the minimum value of the D signal, and the maximum value of the D signal based on the recording results of the C signal and the D signal, the first C signal sampling value, and the first D signal sampling value;

[0085] The average of the minimum value of the C signal and the maximum value of the C signal is determined as the offset of the C signal;

[0086] The average of the minimum value of the D signal and the maximum value of the D signal is determined as the bias of the D signal;

[0087] A first difference between a maximum value of the C signal and a minimum value of the C signal is calculated, a second difference between a maximum value of the D signal and a minimum value of the D signal is calculated, and a ratio of the first difference to the second difference is determined as a relative gain between the C signal and the D signal.

[0088] It is not difficult to understand that the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal specifically includes two steps: parameter initialization and parameter calculation. First, some parameters of the self-learning process are initialized before the motor is running. The number of rotations required for the self-learning process of the offset and gain is set as the detection threshold according to the running status of the motor, and the number of Z pulses output by the current sine-cosine encoder is read and its initial value is recorded. If it is the first self-learning after power-on, . Then determine the set theoretical offset value and assign it to the offset of the C signal and the offset of the D signal, assign the theoretical gain value to the relative gain between the C signal and the D signal, and define an initial value for the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal. Then record the current sampling values ​​of the C and D signals, that is, sample the output signal of the sine-cosine encoder at the moment of power-on to obtain the first C signal sampling value and the first D signal sampling value, use the first C signal sampling value as the initial value of the maximum value of the C signal and the initial value of the minimum value of the C signal, and use the first D signal sampling value as the initial value of the maximum value of the D signal and the initial value of the minimum value of the D signal. That is, use the output signal of the sine-cosine encoder at the moment of power-on to initially assign the minimum value of the C signal, the maximum value of the C signal, the minimum value of the D signal, and the maximum value of the D signal.

[0089] After the parameter initialization is completed, the motor can be controlled to start running, and then the parameters are calculated. When the motor is running, the C signal and the D signal are continuously sampled and the sampling results are recorded. The sampled C signal and the D signal are compared with the initial values ​​of the initial assignment. If the sampled C signal is greater than the current value of the maximum value of the C signal, the maximum value of the C signal is updated to the sampled C signal, that is, the maximum value of the C signal is always kept as the maximum value of the initial value and all sampled values, and the minimum value of the C signal is the minimum value of the initial value and all sampled values. Similar operations are performed on the D signal. Finally, the maximum value of the C signal in this self-learning process is obtained. and minimum value and the maximum value of the D signal and minimum value .

[0090] After recording for a period of time, find the maximum value of the C signal and minimum value The two values ​​are both equal to the offset of the C signal , find the maximum value of D signal and minimum value The two values ​​are equal to the offset of the D signal . That is: . Find the maximum value of the C signal and minimum value The difference between the values ​​of and minimum value The difference between the C signal and the D signal is then compared to obtain the relative gain between the C signal and the D signal. , that is: .

[0091] During this period, read the number of Z pulses output by the sine-cosine encoder. You can read and record it once at each moment, or you can receive the Z pulse signal in real time and record the number of Z pulse signals received. and compare it with the initial value When the difference in the number of Z pulse signals is greater than the detection threshold, When the motor rotates for the preset number of times, it means that the motor has completed a self-learning process. At this time, the sampling end flag is output and the motor is controlled to stop. If the difference does not meet the detection threshold, sampling continues and recording is performed. Once the motor stops, the self-learning process ends and the current calculated C signal offset, D signal offset, and relative gain between C and D signals are output.

[0092] Specifically, the offset of the C signal and the D signal and the relative signal gain between the C signal and the D signal can be determined by real-time sampling of the output signal of the sine-cosine encoder, thereby determining the signal error between the C signal and the D signal, so that the CD angle and the control angle of the motor can be corrected subsequently by the calculated offset and gain.

[0093] As an optional embodiment, it also includes:

[0094] Determine whether the offset of the C signal and / or the offset of the D signal exceeds the corresponding preset offset value;

[0095] If yes, the theoretical offset value is determined as the offset of the C signal and / or the offset of the D signal;

[0096] and / or,

[0097] Determine whether the relative gain between the C signal and the D signal exceeds a preset gain value;

[0098] If so, the theoretical gain value is determined as the relative gain between the C signal and the D signal.

[0099] It is understandable that before outputting the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal calculated in the current self-learning process, it is also necessary to limit the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal. The operator will determine the theoretical bias value and the theoretical gain value according to the actual situation of the motor and the sine and cosine encoder. Taking the preset bias value and the preset gain value as 20% of the theoretical value as an example, the calculation result of the bias of the C signal and / or the bias of the D signal is compared with the theoretical bias value. If it exceeds 20% of the theoretical bias value, the output of the bias of the C signal and / or the bias of the D signal will be realized by outputting the theoretical bias value. The calculation result of the relative gain between the C signal and the D signal is compared with the theoretical gain value. If it exceeds 20% of the theoretical gain value, the output of the relative gain between the C signal and the D signal will be realized by outputting the theoretical gain value. The clipping amplitude in the clipping operation can be adjusted according to the actual application situation, and the present application does not make any special limitation here. This embodiment only uses 20% of the theoretical value as a specific embodiment of the clipping amplitude for illustration, and does not constitute a limitation on the value of the clipping amplitude.

[0100] It should be noted that the theoretical offset value may include two offset values ​​corresponding to the C signal and the D signal respectively, or may include only one offset value applicable to both the C signal and the D signal. The specific values ​​and implementation methods of the theoretical offset value and the theoretical gain value are not particularly limited in this application. The specific setting methods of the preset offset value and the preset gain value are not particularly limited in this application.

[0101] Specifically, by further limiting the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal that are finally calculated during the self-learning process, it is ensured that the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal output in each self-learning are all within the normal range of data, avoiding abnormal data with large errors due to excessive sampling errors, and further ensuring the accuracy of subsequent angle correction.

[0102] As an optional embodiment, determining the current CD angle based on the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal includes:

[0103] Obtain the second C signal sampling value and the second D signal sampling value output by the sine-cosine encoder when the motor is powered on again, and obtain the latest C signal offset, D signal offset, and relative gain between the C signal and the D signal;

[0104] Calculating a third difference between the second C signal sampling value and the offset of the latest C signal, and calculating a product between the third difference and the relative gain between the latest C signal and the D signal;

[0105] The product is determined as the current C signal;

[0106] Determine the second D signal sampling value and the offset of the latest D signal as the current D signal;

[0107] The ratio of the current D signal to the current C signal is calculated, and the arc tangent result of the ratio of the current D signal to the current C signal is used as the current CD angle.

[0108] It is not difficult to understand that when determining the current CD angle, it is necessary to use the latest C signal bias, D signal bias, and the relative gain between the C signal and the D signal to correct the CD angle. First, it is necessary to obtain the output signal of the sine and cosine encoder when the power is restarted this time, and determine the second C signal sampling value of the current C signal and the second D signal sampling value of the D signal through signal sampling. Then use the latest C signal bias, D signal bias, and the relative gain between the C signal and the D signal to correct the second C signal sampling value and the second D signal sampling value respectively. The specific relationship for correcting the second C signal sampling value is: ;in, is the corrected value of C signal, is the second C signal sampling value; the specific relationship for correcting the second C signal sampling value is: ;in, is the corrected value of the D signal, is the second D signal sampling value. Finally, the inverse tangent is calculated To get the current CD angle.

[0109] As an optional embodiment, self-learning of the initial control angle of the motor is performed, including:

[0110] The magnetic pole angle static self-learning method is used to self-learn the initial control angle of the motor;

[0111] Before repeating the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder with a preset number of rotations as a repetition period during the operation of the motor, the method further includes:

[0112] The motor is started and runs for a preset time based on the initial control angle.

[0113] It is understandable that the parameter self-learning stage of the motor can be implemented using an initial angle six-pulse static self-learning scheme. The initial angle six-pulse static self-learning scheme can obtain the initial value of the CD angle and the installation angle of the encoder through parameter self-learning during the motor static stage. Since the motor needs to remain in operation when the C signal and D signal bias and gain self-learning modules are used to learn the current bias and gain of the C signal and D signal, after the parameter self-learning stage is over, it is necessary to control the motor to start and run for a preset time based on the initial control angle to facilitate learning the current bias and gain of the C signal and D signal, so that the CD angle can be corrected later. This application does not make any special restrictions on the specific value of the preset time length and the implementation method.

[0114] Specifically, when the motor parameters are self-learned through the magnetic pole angle static self-learning method, in order to ensure that the motor can effectively perform the self-learning process of C signal, D signal bias and gain when it is powered on for the first time, to ensure that the motor can obtain the C signal, D signal bias and gain for angle correction when it is powered on again later.

[0115] As an optional embodiment, self-learning of the initial control angle of the motor is performed, including:

[0116] The initial angle load rotation self-learning method is used to self-learn the initial control angle of the motor;

[0117] During the operation of the motor, the process of repeatedly determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder with a preset number of rotations as a repetition period includes:

[0118] During the motor's loaded rotation, the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder is repeated with a preset number of rotations as a repetition period.

[0119] It is not difficult to understand that the parameter self-learning stage of the motor can also be implemented by the initial angle load rotation self-learning scheme. The initial angle load rotation self-learning method will control the motor to rotate with load when performing parameter self-learning. On this basis, the process of motor load rotation can be directly used to perform the self-learning process of the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal. However, in order to improve the accuracy of the determined bias and gain, when the initial angle load rotation self-learning method is adopted, not only can the process of load rotation be used to self-learn the bias and gain of the CD signal, but also after the load rotation is completed, the motor can continue to be controlled to perform normal rotation operation, and further self-learn the bias and gain of the CD signal during the normal operation of the motor.

[0120] As a specific embodiment, taking the initial angle load rotation self-learning scheme using a controller including a sine-cosine encoder CD signal bias and gain online self-learning module as an example, in the rotation stage of the load self-learning, the bias and gain of the C signal and the D signal can be learned through the sine-cosine encoder CD signal bias and gain online self-learning module, and the initial angle load rotation self-learning scheme can be used to learn the initial value of the CD angle and the initial angle of the Z signal.

[0121] Then, the number of calls to the online self-learning module for the sine-cosine encoder CD signal bias and gain and the parameter thresholds can be selected according to the motor's operating conditions. Considering the versatility of the solution, different Z pulse detection thresholds will be set when the motor is running in different states. At the same time, in order to improve the accuracy of identification, multiple self-learning processes can be performed during the normal motor operation stage to obtain the average value and the final output result. The specific implementation process is as follows:

[0122] In the motor initial angle load rotation self-learning stage, considering the particularity of the rotation self-learning stage, set the detection threshold of the Z pulse , that is, the motor rotates more than 1 circle to achieve the self-learning process. Set the number of self-learning times for bias and gain , that is, the sine-cosine encoder CD signal offset and gain online self-learning module is called only once: when the offset and gain self-learning times reach 1, the self-learning result is directly output. If the disconnection flag is not detected, the identification success flag and the self-learning result are output, and the offset and gain self-learning are no longer performed until the motor stops; if the disconnection flag is detected, the theoretical offset value is output as the offset of the C signal and the D signal, the theoretical gain value is output as the relative gain between the C signal and the D signal, and the disconnection flag is output at the same time.

[0123] During the normal operation of the motor, the motor generally rotates for a long time, and parameter identification has been performed during the load rotation stage. In order to improve the accuracy of the bias and gain self-learning of the C signal and D signal, multiple identifications will be performed during the normal operation stage, and the following identification process will be performed each time the motor is started. Considering the accuracy of the self-learning results, the detection threshold of the Z pulse is set , that is, the motor rotates more than 2 turns to achieve the bias and gain self-learning process. Set the number of bias and gain self-learning times When the number of self-learning reaches 4, the results of the four self-learning are summed and the average is taken to obtain the final offset and gain values. If the disconnection flag is not detected, the identification success flag and the result of self-learning are output, and no offset and gain self-learning is performed until the motor stops; if the disconnection flag is detected, the theoretical offset value is output as the offset of the C signal and the D signal, the theoretical gain value is output as the relative gain between the C signal and the D signal, and the disconnection flag is output at the same time.

[0124] During the normal operation of the motor, the number of rotations of the motor may not reach a sufficient number due to the operation requirements of the motor itself or external instructions, resulting in the number of self-learning not reaching the preset number. At this time, the self-learning process needs to be terminated in advance. For example, when the number of self-learning does not reach 4 times, but exceeds 1 time, the identification result can also be output, and the offset and gain determined in the self-learning process that has been carried out are directly used as the result of self-learning. If the disconnection flag is not detected, the identification success flag and the result of self-learning are output; if the disconnection flag is detected, the theoretical offset value is output as the offset of the C signal and the D signal, the theoretical gain value is output as the relative gain between the C signal and the D signal, and the disconnection flag is output at the same time. When the number of self-learning does not reach 1 time, the identification result of the self-learning stage of load rotation is directly output.

[0125] Through the above process, when the motor is powered on again, the offset and gain of the C signal and the D signal are the most accurate results before the last power failure, which can ensure the accuracy of the offset and gain of the C signal and the D signal when the motor is powered on again as much as possible.

[0126] Specifically, the specific implementation method of the self-learning process of offset and gain needs to be adjusted and set according to the method adopted in the motor parameter self-learning stage and the actual operating status of the motor. In order to improve the accuracy of the final offset and gain, the motor operation can be controlled as much as possible when the motor is powered on, so as to ensure that the latest offset and gain of the C signal and D signal obtained when the motor is powered on again are the most accurate results before the last power failure.

[0127] As an optional embodiment, after controlling the motor to start according to the corresponding control angle, the method further includes:

[0128] Real-time CD angle correction based on sine-cosine encoder to correct the real-time control angle of the motor;

[0129] When the motor encounters the Z signal for the first time, determine the Z signal initial angle of the Z signal;

[0130] After the motor encounters the Z signal for the second time, the real-time control angle of the motor is corrected based on the Z signal and the initial angle of the Z signal.

[0131] The real-time CD angle based on the sine-cosine encoder corrects the real-time control angle of the motor, including:

[0132] When the motor is powered on, the power-on rotation angle of the motor is determined;

[0133] The output signal of the sine-cosine encoder is sampled in real time to determine the real-time CD angle and real-time rotor position angle of the motor;

[0134] A fourth difference between the real-time rotor position angle and the power-on rotation angle is calculated, and the sum of the fourth difference, the CD angle corresponding to the current power-on startup and the real-time CD angle is determined as the real-time control angle of the motor.

[0135] It should be noted that the motor not only requires a control angle when starting after power-on, but also requires a real-time control angle for real-time control during real-time operation. Therefore, after using the initial control angle or the current control angle to control the motor start, the real-time control angle of the motor needs to be determined in real time.

[0136] Furthermore, in order to improve the accuracy and reliability of the motor control process, the CD angle is used only when the motor is powered on to determine the motor control angle. The Z signal is used to determine the motor control angle during the subsequent rotation process. Please refer to Figure 3 , Figure 3 The present invention provides a flow chart of the correction process of the motor control angle; when the motor is powered on, if it is the first time for the motor to be powered on, the CD angle is used to correct the control angle before the Z signal is encountered, and the Z signal is used to correct the control angle after the Z signal is encountered. If the motor is not running for the first time after power-on, the Z signal is directly used to correct the control angle. Please refer to Figure 4 , Figure 4 The present invention provides a schematic diagram of a process of using C signal and D signal to calibrate the motor control angle; if the CD angle is used to calibrate the control angle, the initial value of the CD angle determined when the motor is first powered on and the real-time value of the CD signal determined when the motor is currently running for the first time, that is, the current CD angle, will be used to determine the correction angle of the control angle based on the CD signal, and the control angle after the CD signal correction will be obtained. Please refer to Figure 5 , Figure 5 A schematic diagram of a process for correcting the motor control angle using a Z signal provided by the present invention; if the Z signal is used to correct the control angle, the initial angle of the Z signal learned when the motor rotates and the real-time value of the Z signal of the motor currently running are used to determine the correction angle of the control angle, thereby obtaining the control angle after correction based on the Z signal.

[0137] As a specific embodiment, when calibrating the control angle, it is necessary to first obtain the initial value of the CD angle and the initial angle of the Z signal in the non-power-off state. After the elevator synchronous traction machine is installed, it will be powered on for the first time, and then the motor parameters will be self-learned to learn the motor parameters and the initial value of the CD angle. and encoder installation angle , and record these learned values. According to the learned parameters, run the elevator for the first time after power-on, using the initial value of CD angle Start the motor as an absolute position angle. When the motor encounters the Z signal for the first time, record the angle and align it with the encoder installation angle The initial angle of the Z signal is obtained by summing , the initial value of CD angle and Z signal initial angle All have been obtained.

[0138] When the motor is powered on for the first time, a combination of CD and Z signals is used for correction. When the elevator is powered on for the first time, if the motor continues to rotate but does not encounter a Z signal, the CD signal is used to correct the motor's control angle, that is, the current CD signal sampling value and QEP (Quadrature Encoder Pulse) pulse count value are read. The current CD signal sampling value is inversely tangented to obtain the real-time angle of the CD angle. , use the QEP pulse count value to get the current motor rotation angle The controller samples the output signal of the sine-cosine encoder at a fixed period T to obtain the sampling value of the current CD signal, thereby obtaining the real-time angle of the CD angle. and the real-time rotor position angle of the motor The control angle of the motor is corrected at a fixed period T to obtain the real-time control angle of the motor. : When the motor rotates to the second encounter of the Z signal, the initial angle of the Z signal is used to replace the CD angle for correction: .

[0139] After the motor is powered off and then powered on again, the same CD signal and Z signal combination correction scheme is adopted; after the elevator is powered off and then powered on again, during the first operation, the latest C signal bias, D signal bias, and relative gain between C and D signals learned during the previous operation are used to determine the current CD angle for this restart, and the corrected current CD angle is used as the real-time angle of the CD angle and substituted into To calculate the current control angle, the motor is started and operated using the current control angle. Since the offset and gain of the C and D signals have been fully self-learned, it can be guaranteed The accuracy of the Z signal is improved to reduce the occurrence of jitter when the elevator starts. Then, when the motor rotates to the first encounter of the Z signal, the current Z signal position information is recorded. , record the current Z signal position information and get the initial angle of the Z signal , when the Z signal is encountered for the second time, the Z signal is used to correct the motor angle: .

[0140] Since the present invention performs an online bias and gain self-learning process on the C signal and the D signal when the motor is running, the CD angle of the sine-cosine encoder can be fully corrected, thereby improving the accuracy and reliability of the motor control angle based on the CD angle correction. The entire method can also be applied to sine-cosine encoding as a correction scheme for the CD angle.

[0141] Specifically, when the motor is powered on again, the CD angle is directly corrected using the offset and gain of the C and D signals determined during the last operation, so that the corrected CD angle is used to determine the current control angle when the motor is powered on again, thereby completing the startup control of the motor after it is powered on again; at the same time, when the motor starts to run just after being powered on, the CD angle is directly used to correct the real-time control angle of the motor, and no angle self-learning is required, thereby avoiding the startup noise when power is lost and restarted, and improving the comfort of the elevator ride; in subsequent operations, a more stable and accurate Z signal is used to correct the real-time control angle of the motor, and the position of the Z signal is fixed at once per circle, which will not be affected by the environment, further improving the accuracy and reliability of the motor operation process.

[0142] As an optional embodiment, it also includes:

[0143] If there is a signal disconnection in the C signal and / or the D signal during the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signals of the sine and cosine encoders, the theoretical offset value shall be determined as the offset of the C signal and the offset of the D signal, and the theoretical gain value shall be determined as the relative gain between the C signal and the D signal.

[0144] It is understandable that in order to avoid the occurrence of startup failure or startup flying caused by disconnection, the disconnection detection function of the C signal and D signal of the sine-cosine encoder can also be added at the same time to ensure that the startup failure will not be caused by the disconnection of the C signal and the D signal when the power is off and restarted. When the disconnection is detected during the self-learning process of the bias and gain, the theoretical bias value and the theoretical gain value are restored, and the prompt of the disconnection fault is output. During the next elevator startup, the bias and gain self-learning are performed again to ensure that the accurate bias and gain of the C signal and the D signal are learned. If there is no disconnection in the C signal and the D signal, there is no need to control the setting of the disconnection flag, and directly output the calculated bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal. If the C signal or the D signal is disconnected, the control disconnection flag is set, and the theoretical bias value needs to be output as the bias of the C signal and the bias of the D signal, and the theoretical gain value needs to be output as the relative gain between the C signal and the D signal. The specific implementation method of disconnection detection is not particularly limited in this application.

[0145] The present invention proposes a hybrid correction scheme for a sine-cosine encoder. In the motor parameter self-learning and normal operation stages, the CD signal bias and gain are learned through online self-learning, and online correction is performed, thereby improving the accuracy of angle calculation. The online disconnection detection function of the C signal and the D signal is added to avoid the situation where the startup is running fast due to disconnection. At the same time, when the line is disconnected, the theoretical bias value and the theoretical gain value are output to perform angle correction to avoid excessive startup jitter. After the motor encounters the Z signal for the second time during operation, the Z signal is used instead of the C and D signals for angle correction, thereby avoiding the motor speed fluctuation caused by the sampling deviation of the C and D signals.

[0146] As an optional embodiment, it also includes:

[0147] If, in the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder, the difference between the maximum value of the C signal and the minimum value of the C signal is less than a preset threshold, it is determined that the C signal has a signal disconnection;

[0148] If, in the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signals of the sine and cosine encoders, the difference between the maximum value of the D signal and the minimum value of the D signal is less than a preset threshold, it is determined that there is a signal break in the D signal.

[0149] It is not difficult to understand that the process of signal disconnection detection can be specifically implemented by calculating the difference between the maximum and minimum values ​​of the signal. Calculate the difference between the maximum and minimum values ​​of the C signal. If the difference is too small at this time and is less than the preset threshold, and the difference corresponding to the D signal belongs to the normal range, then the C signal output by the encoder is detected to be disconnected. Calculate the difference between the maximum and minimum values ​​of the D signal. If the difference is too small at this time and is less than the preset threshold, and the difference corresponding to the C signal belongs to the normal range, then the D signal output by the encoder is detected to be disconnected. The specific value of the preset threshold and the implementation method are not particularly limited in this application, and can be set and adjusted according to actual conditions.

[0150] This application performs online self-learning processes of different degrees of bias and gain for different working conditions, and simultaneously corrects the CD angle and the motor control angle, thereby improving the accuracy of the CD angle and the stability of the motor start-up. By adding disconnection detection for the C signal and the D signal, the restart failure after power failure caused by signal disconnection is avoided. During normal operation, the Z signal angle is used instead of the CD angle to correct the control angle, thereby avoiding the sampling deviation of the C signal and the D signal due to interference from the external environment, which affects the riding comfort; after the elevator is powered on again, the current CD angle is used to start, and no angle self-learning is required, thereby avoiding the startup noise during power failure and restart; compared with other angle correction methods, it is simple to implement and has a clear idea; the calculation amount is small, the time is short, and the amount of code is small.

[0151] In order to solve the above technical problems, the present invention also provides a motor control device based on a sine-cosine encoder, comprising:

[0152] A self-learning unit, used for self-learning an initial control angle of the motor when the motor is powered on for the first time, so as to control the motor to start after the first power-on according to the initial control angle, wherein the initial control angle includes an encoder installation angle of a sine-cosine encoder connected to the motor and a CD angle of the sine-cosine encoder;

[0153] a correction value learning unit, used for repeating the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder with a preset number of rotations as a repetition period during the operation of the motor until the motor is powered off;

[0154] a correction unit, for determining a current CD angle based on the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal when the motor is powered on again;

[0155] The motor control unit is used to determine the current control angle of the motor based on the current CD angle, so as to control the starting process of the motor after power is restored according to the current control angle.

[0156] For an introduction to a motor control device based on a sine-cosine encoder provided by the present invention, please refer to the above-mentioned embodiment of a motor control method based on a sine-cosine encoder, and the present invention will not be repeated here.

[0157] Please refer to Figure 6 , Figure 6 The present invention provides a schematic diagram of the structure of an electronic device. To solve the above technical problems, the present invention also provides an electronic device, including:

[0158] A memory 21, used for storing computer programs;

[0159] The processor 22 is used to implement the steps of the motor control method based on the sine-cosine encoder as described above.

[0160] Among them, the processor 22 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 22 can be implemented in at least one hardware form of DSP (Digital Signal Processor), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 22 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit; the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 22 may integrate a GPU (graphics processing unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 22 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0161] The memory 21 may include one or more computer-readable storage media, which may be non-transitory. The memory 21 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 21 is at least used to store the following computer program, wherein, after the computer program is loaded and executed by the processor 22, the relevant steps of the motor control method based on the sine-cosine encoder disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 21 may also include an operating system and data, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system may include Windows, Unix, Linux, etc. The data may include but is not limited to data of the motor control method based on the sine-cosine encoder, etc.

[0162] In some embodiments, the electronic device may further include a display screen, an input and output interface, a communication interface, a power supply, and a communication bus.

[0163] It can be understood by those skilled in the art that Figure 6 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure.

[0164] For an introduction to an electronic device provided by the present invention, please refer to the above-mentioned embodiment of the motor control method based on the sine-cosine encoder, and the present invention will not be repeated here.

[0165] In order to solve the above technical problems, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the aforementioned motor control method based on a sine-cosine encoder are implemented.

[0166] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. Specifically, the computer-readable storage medium may include but is not limited to any type of disk, including a floppy disk, an optical disk, and a mobile hard disk, or any type of medium or device suitable for storing instructions, data, etc., and the present application does not make any special restrictions here.

[0167] For an introduction to a computer-readable storage medium provided by the present invention, please refer to the above-mentioned embodiment of the motor control method based on the sine-cosine encoder, and the present invention will not be repeated here.

[0168] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0169] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0170] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A motor control method based on a sine-cosine encoder, characterized in that: include: When the motor is powered on for the first time, self-learning of the initial control angle of the motor is performed so as to control the motor to start after the first power-on according to the initial control angle, wherein the initial control angle includes an encoder installation angle of a sine-cosine encoder connected to the motor and a CD angle of the sine-cosine encoder; During the operation of the motor, the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder is repeated with a preset number of rotations as a repetition period until the motor is powered off; When the motor is powered on again, the current CD angle is determined based on the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal; The current control angle of the motor is determined based on the current CD angle, so as to control the start-up of the motor after power is restored according to the current control angle.

2. The motor control method based on the sine-cosine encoder as claimed in claim 1, characterized in that: Determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder, comprising: Obtaining a first C signal sampling value and a first D signal sampling value output by the sine-cosine encoder when the motor is powered on for the first time, and using the first C signal sampling value as an initial value of the maximum value of the C signal and an initial value of the minimum value of the C signal, and using the first D signal sampling value as an initial value of the maximum value of the D signal and an initial value of the minimum value of the D signal; Determine whether the number of rotations of the motor has reached the preset number of rotations; If yes, stop recording, and update the minimum value of the C signal, the maximum value of the C signal, the minimum value of the D signal, and the maximum value of the D signal based on the recording results of the C signal and the D signal, the first C signal sampling value, and the first D signal sampling value; Determine the average of the minimum value of the C signal and the maximum value of the C signal as the offset of the C signal; Determine the average of the minimum value of the D signal and the maximum value of the D signal as the bias of the D signal; A first difference between a maximum value of the C signal and a minimum value of the C signal is calculated, a second difference between a maximum value of the D signal and a minimum value of the D signal is calculated, and a ratio of the first difference to the second difference is determined as a relative gain between the C signal and the D signal.

3. The motor control method based on the sine-cosine encoder as claimed in claim 2, characterized in that: Also includes: Determining whether the bias of the C signal and / or the bias of the D signal exceeds a corresponding preset bias value; If yes, the theoretical offset value is determined as the offset of the C signal and / or the offset of the D signal; and / or, Determining whether the relative gain between the C signal and the D signal exceeds a preset gain value; If so, the theoretical gain value is determined as the relative gain between the C signal and the D signal.

4. The motor control method based on the sine-cosine encoder as claimed in claim 1, characterized in that: The current CD angle is determined based on the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal, including: Obtain the second C signal sampling value and the second D signal sampling value output by the sine-cosine encoder when the motor is powered on again, and obtain the latest offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal; Calculating a third difference between the second C signal sampling value and the latest C signal offset, and calculating a product between the third difference and the relative gain between the latest C signal and D signal; Determine the product as the current C signal; Determine the second D signal sampling value and the offset of the latest D signal as the current D signal; The ratio of the current D signal to the current C signal is calculated, and the arc tangent result of the ratio of the current D signal to the current C signal is used as the current CD angle.

5. The motor control method based on the sine-cosine encoder as claimed in claim 1, characterized in that: The self-learning of the initial control angle of the motor is performed, comprising: The initial control angle of the motor is self-learned by adopting a magnetic pole angle static self-learning method or an initial angle load rotation self-learning method; When the initial angle load rotation self-learning method is used to perform self-learning of the initial control angle of the motor, the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder is repeated with a preset number of rotations as a repetition period during the operation of the motor, including: During the motor's loaded rotation, the process of determining the offset of the C signal, the offset of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder is repeated with a preset number of rotations as a repetition period.

6. The motor control method based on the sine-cosine encoder according to claim 1, characterized in that: After controlling the motor to start according to the corresponding control angle, the method further includes: Correcting the real-time control angle of the motor based on the real-time CD angle of the sine-cosine encoder; When the motor encounters a Z signal for the first time, determining a Z signal initial angle of the Z signal; After the motor encounters the Z signal for the second time, the real-time control angle of the motor is corrected based on the Z signal and the Z signal initial angle.

7. The motor control method based on the sine-cosine encoder as claimed in claim 6, characterized in that: Correcting the real-time control angle of the motor based on the real-time CD angle of the sine-cosine encoder comprises: When the motor is powered on, determining the power-on rotation angle of the motor; The output signal of the sine-cosine encoder is sampled in real time to determine the real-time CD angle and the real-time rotor position angle of the motor; A fourth difference between the real-time rotor position angle and the power-on rotation angle is calculated, and the sum of the fourth difference, the CD angle corresponding to the current power-on startup and the real-time CD angle is determined as the real-time control angle of the motor.

8. The motor control method based on the sine-cosine encoder according to any one of claims 1 to 7, characterized in that: Also includes: If, in the process of determining the bias of the C signal, the bias of the D signal, and the relative gain between the C signal and the D signal based on the output signal of the sine-cosine encoder, the difference between the maximum value of the C signal and the minimum value of the C signal is less than a preset threshold, it is determined that the C signal has a signal disconnection; if the difference between the maximum value of the D signal and the minimum value of the D signal is less than a preset threshold, it is determined that the D signal has a signal disconnection; If the C signal and / or the D signal is disconnected, the theoretical offset value is determined as the offset of the C signal and the offset of the D signal, and the theoretical gain value is determined as the relative gain between the C signal and the D signal.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of the motor control method based on the sine-cosine encoder as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the motor control method based on a sine-cosine encoder are implemented as described in any one of claims 1 to 8.