Method and device for controlling rotating speed of motor of compressor

By applying adaptive feedforward control technology in the compressor, torque compensation values ​​are generated and applied in real time, the mechanical problems caused by motor speed fluctuations are solved, and a more stable speed and extended service life are achieved.

CN119448847APending Publication Date: 2025-02-14COPELAND CLIMATE TECN (SUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310975683.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-04
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The fluctuations in compressor motor speed cause mechanical vibration, noise and wear, shortening service life, and the existing technology is difficult to effectively solve this problem.

Method used

Adaptive feedforward control (AFC) technology is used to obtain the difference between the target speed and the actual speed of the motor in real time, generate torque commands, and generate torque compensation values ​​through adaptive feedforward control to make compensation to stabilize the motor Speed.

Benefits of technology

It effectively reduces motor speed fluctuations, reduces mechanical vibration and noise, and extends the service life of the motor.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119448847A_ABST
    Figure CN119448847A_ABST
Patent Text Reader

Abstract

The invention discloses a method and an apparatus for controlling motor speed of a compressor. The method comprises the following steps: acquiring a difference value between a target rotating speed and an actual rotating speed of a motor in real time; generating a torque command based on the difference; a torque compensation value is generated in real time based on the difference value in a self-adaptive feedforward control mode, and the torque compensation value is used for compensating the torque instruction; and generating an electric signal for driving the motor based on the compensated torque instruction, wherein the electric signal can control the rotating speed of the motor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates generally to compressors and, more particularly, to methods and apparatus for controlling the speed of a motor of a compressor. Background Art

[0002] A compressor is a machine that compresses gas and increases its pressure at the same time. It has a wide range of applications and is commonly used in compressed refrigerants (such as refrigerators, air conditioners), compressed air (such as air compressors), compressed gases (such as compressed hydrogen), etc.

[0003] Figure 1 The typical configuration of a compressor is shown schematically. Figure 1 As shown, the alternating current power source AC supplies power to the compressor, and the compressor includes a frequency converter and a motor M. The frequency converter includes a rectifier bridge 110, a filter capacitor 120, a three-phase inverter bridge 130, and a processor 140 for executing control.

[0004] When the compressor is running, the load torque of the motor M will fluctuate periodically. The fluctuation of the load torque will cause the speed of the motor M to fluctuate, that is, the actual speed of the motor M will deviate from the target speed, and this speed fluctuation is more significant when the speed of the motor M is low. Figure 2 The fluctuations at different speeds are schematically shown. Figure 2 As shown, the periodic fluctuation of the load torque causes the motor speed to fluctuate periodically. In addition, the speed fluctuation amplitude is the largest when the motor speed is 1000 rpm, followed by the fluctuation amplitude when the speed is 1500 rpm, and the fluctuation amplitude is the smallest when the speed is 2000 rpm.

[0005] Since the speed fluctuation of the motor usually generates additional mechanical vibration, noise, and mechanical wear, thereby shortening the service life of the motor, there is a need for a technology that can reduce the speed fluctuation of the motor of the compressor. Summary of the invention

[0006] In view of the above problems, the present disclosure provides a solution for controlling the speed of a motor of a compressor. The method utilizes adaptive feedforward control (AFC) technology and can reduce the speed fluctuation of the motor in real time.

[0007] According to one aspect of the present disclosure, a method for controlling the motor speed of a compressor is provided, comprising: obtaining the difference between the target speed and the actual speed of the motor in real time; generating a torque command based on the difference; generating a torque compensation value in real time based on the difference in an adaptive feedforward control manner, and compensating the torque command with the torque compensation value; generating an electrical signal for driving the motor based on the compensated torque command, wherein the electrical signal can control the motor speed.

[0008] According to another aspect of the present disclosure, a device for controlling the motor speed of a compressor is provided, comprising: a memory storing a program; and one or more processors, wherein the processors are configured to perform the following operations by executing the program: obtaining the difference between the target speed and the actual speed of the motor in real time; generating a torque command based on the difference; generating a torque compensation value based on the difference in real time in an adaptive feedforward control manner, and compensating the torque command with the torque compensation value; generating an electrical signal for driving the motor based on the compensated torque command, wherein the electrical signal can control the motor speed.

[0009] According to another aspect of the present disclosure, a non-transitory computer-readable medium storing a program is provided, which, when executed by a processor, enables the processor to perform the above-mentioned method for controlling the motor speed of a compressor. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 A typical configuration of a compressor is shown schematically.

[0011] Figure 2 The speed fluctuations at different speeds of the electric machine are schematically shown.

[0012] Figure 3 is a schematic block diagram of a method for controlling the speed of a motor according to the present disclosure.

[0013] Figure 4 is a flow chart of a method for controlling the speed of a motor according to the present disclosure.

[0014] Figure 5A and Figure 5B The rotational speed fluctuations are shown for different rotational speeds without using the method of the present disclosure and with using the method of the present disclosure. DETAILED DESCRIPTION

[0015] Figure 3 is a schematic block diagram of a method for controlling the motor speed according to the present disclosure. Figure 3 As shown, the method mainly includes an adaptive feedforward control part (AFC) and a vector control part (field-oriented control, FOC).

[0016] Specifically, after the motor M is started, the current actual speed ω and target speed ω* of the motor M are obtained in real time. The target speed ω* refers to the target value of the speed that the motor M should maintain, which is set according to the current working conditions of the compressor (such as evaporation and condensation conditions). The actual speed ω refers to the current actual speed of the motor M. The actual speed ω can be obtained by direct measurement, or it can be indirectly calculated based on other electrical signals such as current.

[0017] Then, calculate the difference ω between the target speed ω* and the actual speed ω error , i.e., the speed fluctuation. If the calculated speed fluctuation is greater than a predetermined threshold, such as 10 rpm, compensation is enabled to reduce the fluctuation, and the compensation process will be described in detail below.

[0018] In obtaining the difference ω error Afterwards, based on the difference ω error Implement proportional integral control PI to generate torque command for the motor

[0019] On the other hand, the difference ω error Multiply by the gain -g, and then multiply the result by and θ represents the mechanical angle of the motor, and θ=ωt, t represents time. Indicates the lead angle of the motor.

[0020] and and The multiplication results are passed through an integral processor (or low-pass filter) ∫ to obtain intermediate variables β and γ. Then, β is multiplied by cos(θ), γ is multiplied by sin(θ), and the two products are added to obtain the torque compensation value.

[0021] In the speed fluctuation ω calculated as described above error When the speed is greater than a predetermined threshold (e.g. 10 rpm), the torque command is calculated. And torque compensation value The difference between e In other words, when the speed fluctuation reaches a predetermined level, the torque command generated in the FOC part is compensated by the compensation value generated by the AFC part to obtain the compensated torque command T e On the contrary, when the speed fluctuation does not reach the predetermined level, the torque compensation value is not used. Make compensation.

[0022] Then, based on the compensated torque command T eExecutes maximum torque current ratio control MTPA and field weakening control FW. As a result of MTPA and FW, dq axis current commands are generated

[0023] Next, calculate the dq axis current command The actual current I of the dq axis dq The difference between the two is calculated, and the proportional integral control PI is performed based on the calculated current difference to generate the dq axis voltage command V dq In particular, the actual dq axis current I can be obtained by dq : Measure the three-phase current of the motor, perform Clark transformation and Park transformation on the measured current, and obtain the actual current I of the dq axis dq .

[0024] The generated dq axis voltage command V dq Perform a transformation (dq-abc) from the rotating dq coordinate system to the stationary abc coordinate system to obtain the voltage command V abc .

[0025] For voltage command V abc Pulse width modulation PWM is performed, and the modulated voltage signal is output to the motor M to drive the motor M. As an example, the motor M may be a permanent magnet synchronous motor.

[0026] exist Figure 3 In the method shown, the gain-g and the lead angle Specifically, for a certain target speed of the motor (for example, 1000rpm), the -g and -g values ​​corresponding to the speed can be found from the pre-prepared lookup table. The value of -g and The value of is applied in the AFC part. It should be noted that when the target speed changes (for example, when the working conditions change), the gain-g and lead angle need to be reset.

[0027] In addition, the gain-g and lead angle can be adjusted in real time while the target speed of the motor remains constant. Specifically, as described above, when the motor speed fluctuation ω error When the speed is greater than a predetermined threshold (e.g., 10 rpm), torque compensation is started, and the -g and -g values ​​corresponding to the current target speed (e.g., 1000 rpm) obtained from the lookup table are applied. Through the compensation process, the speed fluctuation can be reduced to below the predetermined threshold (e.g., 10 rpm), for example, to 3 rpm. At this time, the parameter value -g and / or The rotation speed fluctuation is further reduced, for example, to 2 rpm.

[0028] Specifically, the parameter values ​​-g' and -g' corresponding to the target speed (eg, 1100 rpm) adjacent to the current target speed (eg, 1000 rpm) in the lookup table may be used. To replace the current parameter value, and observe the speed fluctuation ω error If the speed fluctuation is further reduced (for example, reduced to a satisfactory value), the new parameter values ​​-g' and If the speed fluctuation does not further decrease, you can try to use other parameter values ​​corresponding to the adjacent target speeds (such as 900 rpm). If the effect of all the parameter values ​​corresponding to the adjacent target speeds is not as good as the original parameter values ​​-g and The original parameter values ​​-g and In this way, the gain-g and lead angle can be adjusted once or multiple times. At least one of them is used until the motor speed fluctuation meets the requirement. It should be noted that when the current target speed of the motor changes, the corresponding parameter values ​​-g and

[0029] In addition, in the present disclosure, a torque compensation value can be adaptively generated for different working conditions of the compressor, so as to keep the speed fluctuation of the motor at a small value. Specifically, when the working condition of the compressor changes, its suction and exhaust pressure difference increases, and the torque fluctuation of the motor load increases, resulting in new fluctuations in the speed of the motor. In response to the new speed fluctuation, Figure 3 The variables β and γ obtained after the integration process in the AFC part of are adjusted accordingly until the speed of the motor is stabilized near the target value again.

[0030] Figure 4 A flow chart showing a method of controlling the motor speed of a compressor according to the present disclosure is shown.

[0031] like Figure 4 As shown, in step S410, the difference ω between the target speed ω* and the actual speed ω of the motor is obtained in real time. error .

[0032] In step S420, based on the difference ω error Generate torque command

[0033] In step S430, based on the difference ω, the adaptive feedforward control is performed. error Generate torque compensation value in real time And using the torque compensation value Torque command Make compensation.

[0034] In step S440, based on the compensated torque command T e To generate an electrical signal for controlling the speed of the motor.

[0035] Figure 5A and Figure 5B The rotational speed fluctuations are shown for different rotational speeds without using the method of the present disclosure and with using the method of the present disclosure. Figure 5A The comparison at the speed of 1000rpm and 1500rpm is shown. Figure 5B The comparison is shown when the speed is 2000 rpm and 2500 rpm. It can be seen from the figure that by using the method of the present disclosure to perform torque compensation to control the motor speed, the speed fluctuation can be effectively reduced.

[0036] The technology of the present disclosure has been described above in conjunction with specific embodiments. Adaptive feedforward control (AFC) has the advantages of simple structure and strong anti-interference ability. The present disclosure utilizes adaptive feedforward control to suppress the speed fluctuation of the motor caused by the periodic fluctuation of the load torque, thereby effectively stabilizing the speed of the motor. In addition, the present disclosure can also adaptively perform torque compensation for different working conditions of the compressor to reduce the speed fluctuation of the motor.

[0037] The method according to the present disclosure may be implemented by software, hardware, or a combination of software and hardware. The programs included in the software may be pre-stored in a storage medium. For example, during execution, these programs may be written to a random access memory and executed by a processor, thereby implementing the various processes described herein. As an example, the method of the present disclosure may be implemented in a single-chip microcomputer including a processor (e.g., a CPU), a read-only memory (ROM), and a random access memory (RAM). The single-chip microcomputer may be, for example, a microcontroller (MCU) or a system on a chip (SoC), and the single-chip microcomputer may be, for example, disposed in a frequency converter of a compressor. For example, the single-chip microcomputer may correspond to Figure 1 The control processor 140 in.

[0038] In addition, herein, when a certain component or element is referred to as being “connected to another component or element” or “coupled to another component or element”, it may be directly connected or coupled to another component or element, or there may be intermediate components or elements. Conversely, when it is referred to as being “directly connected to another component or element” or “directly coupled to another component or element”, there may be no intermediate components or elements.

[0039] The parts or units described herein are only in a logical sense and do not strictly correspond to physical devices or entities. For example, the functions of each part described herein can be implemented by multiple physical entities, or the functions of multiple parts described herein can be implemented by a single physical entity. In addition, the features, components, elements, steps, etc. described in one embodiment are not limited to the embodiment, but can also be applied to other embodiments, such as replacing specific features, components, elements, steps, etc. in other embodiments, or combining them.

[0040] The scope of the present disclosure is not limited to the implementation methods and technical effects described in detail above in conjunction with the accompanying drawings. It should be understood by those skilled in the art that, depending on design requirements and other factors, various modifications or variations may be made to the implementation methods provided herein without departing from the principles and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims and their equivalents.

[0041] In addition, the present disclosure also includes the following embodiments.

[0042] (1) A method for controlling the motor speed of a compressor, comprising:

[0043] Obtain the difference between the target speed and the actual speed of the motor in real time;

[0044] generating a torque command based on the difference;

[0045] In an adaptive feedforward control manner, a torque compensation value is generated in real time based on the difference, and the torque command is compensated by using the torque compensation value;

[0046] An electrical signal for driving the motor is generated based on the compensated torque command, and the electrical signal can control the motor speed.

[0047] (2) The method according to (1), wherein when the difference is greater than a predetermined threshold, the torque command is compensated using the torque compensation value; when the difference is less than or equal to the predetermined threshold, no compensation is performed.

[0048] (3) The method according to (1), wherein the step of compensating the torque command using the torque compensation value comprises: calculating the difference between the torque command and the torque compensation value as the compensated torque command.

[0049] (4) The method according to (1), wherein the step of generating a torque compensation value in real time based on the difference comprises:

[0050] multiplying the difference by a gain to obtain a first value;

[0051] Multiply the first value by To obtain a second value, and multiply the first value by To obtain a third value, wherein θ represents the mechanical angle of the motor, represents the lead angle of the motor;

[0052] integrating the second value and the third value respectively to obtain a fourth value and a fifth value; multiplying the fourth value by cos(θ) to obtain a sixth value, and multiplying the fifth value by sin(θ) to obtain a seventh value;

[0053] The sixth value and the seventh value are added to obtain the torque compensation value.

[0054] (5) The method according to (4), further comprising: setting the gain and the lead angle according to a target rotation speed of the motor.

[0055] (6) The method according to (5), further comprising: determining a gain and a lead angle corresponding to the target speed in a pre-prepared lookup table.

[0056] (7) The method according to (6), further comprising: adjusting at least one of the gain and the lead angle while the target speed remains unchanged.

[0057] (8) A method according to (7), wherein the step of adjusting at least one of the gain and the lead angle comprises: determining a first difference between the target speed of the motor and a first actual speed after compensation using a torque compensation value generated based on the gain and / or the lead angle; determining another gain and / or another lead angle corresponding to another target speed adjacent to the target speed in the lookup table; determining a second difference between the target speed of the motor and a second actual speed after compensation using a torque compensation value generated based on the another gain and / or the another lead angle; and replacing the gain and / or the lead angle with the another gain and / or the another lead angle when the second difference is less than the first difference.

[0058] (9) The method according to (1), wherein the step of generating the electrical signal comprises:

[0059] Based on the compensated torque command, a maximum torque-to-current ratio control (MTPA) and a field weakening control (FW) are performed to generate a dq-axis current command;

[0060] Calculating the difference between the dq axis current command and the dq axis actual current;

[0061] Performing proportional-integral control based on the calculated current difference to generate dq-axis voltage commands;

[0062] Performing a transformation on the dq axis voltage command from a rotating dq coordinate system to a stationary abc coordinate system;

[0063] Pulse width modulation is performed on the converted voltage command to obtain a voltage signal capable of controlling the speed of the motor.

[0064] (10) The method according to (1), wherein the method is implemented in a single chip microcomputer, and the single chip microcomputer is set in the inverter of the compressor.

[0065] (11). A device for controlling the motor speed of a compressor, comprising:

[0066] a memory storing a program; and

[0067] One or more processors, the processors being configured to perform the following operations by executing the program:

[0068] Obtain the difference between the target speed and the actual speed of the motor in real time;

[0069] generating a torque command based on the difference;

[0070] In an adaptive feedforward control manner, a torque compensation value is generated in real time based on the difference, and the torque command is compensated by using the torque compensation value;

[0071] An electrical signal for driving the motor is generated based on the compensated torque command, and the electrical signal can control the motor speed.

[0072] (12) The device according to (11), wherein the processor is further configured to: when the difference is greater than a predetermined threshold, compensate the torque instruction using the torque compensation value; when the difference is less than or equal to the predetermined threshold, not perform the compensation.

[0073] (13) The apparatus according to (11), wherein the processor is further configured to calculate a difference between the torque instruction and the torque compensation value as the compensated torque instruction.

[0074] (14) The apparatus according to (11), wherein the processor is further configured to generate the torque compensation value by performing the following operations:

[0075] multiplying the difference by a gain to obtain a first value;

[0076] Multiply the first value by To obtain a second value, and multiply the first value by To obtain a third value, wherein θ represents the mechanical angle of the motor, represents the lead angle of the motor;

[0077] Integrating the second value and the third value respectively to obtain a fourth value and a fifth value;

[0078] multiplying the fourth value by cos(θ) to obtain a sixth value, and multiplying the fifth value by sin(θ) to obtain a seventh value;

[0079] The sixth value and the seventh value are added to obtain the torque compensation value.

[0080] (15) The apparatus according to (14), wherein the processor is further configured to set the gain and the lead angle according to a target rotation speed of the motor.

[0081] (16) The apparatus according to (15), wherein the processor is further configured to determine a gain and a lead angle corresponding to the target speed in a pre-prepared lookup table.

[0082] (17) The apparatus according to (16), wherein the processor is further configured to adjust at least one of the gain and the lead angle while the target speed remains unchanged.

[0083] (18). An apparatus according to (17), wherein the processor is further configured to adjust at least one of the gain and the lead angle by performing the following operations: determining a first difference between the target speed of the motor and a first actual speed after compensation using a torque compensation value generated based on the gain and / or the lead angle; determining another gain and / or another lead angle corresponding to another target speed adjacent to the target speed in the lookup table; determining a second difference between the target speed of the motor and a second actual speed after compensation using a torque compensation value generated based on the another gain and / or the another lead angle; and replacing the gain and / or the lead angle with the another gain and / or the another lead angle when the second difference is less than the first difference.

[0084] (19) The apparatus according to (11), wherein the processor is further configured to generate the electrical signal by performing the following operations:

[0085] Based on the compensated torque command, a maximum torque-to-current ratio control (MTPA) and a field weakening control (FW) are performed to generate a dq-axis current command;

[0086] Calculating the difference between the dq axis current command and the dq axis actual current;

[0087] Performing proportional-integral control based on the calculated current difference to generate dq-axis voltage commands;

[0088] Performing a transformation on the dq axis voltage command from a rotating dq coordinate system to a stationary abc coordinate system;

[0089] Pulse width modulation is performed on the converted voltage command to obtain a voltage signal capable of controlling the speed of the motor.

[0090] (20) A non-transitory computer-readable medium storing a program, wherein when the program is executed by a processor, the processor executes the method for controlling the motor speed of a compressor according to any one of (1) to (10).

Claims

1. A method for controlling the motor speed of a compressor, comprising: Obtain the difference between the target speed and the actual speed of the motor in real time; generating a torque command based on the difference; In an adaptive feedforward control manner, a torque compensation value is generated in real time based on the difference, and the torque command is compensated by using the torque compensation value; An electrical signal for driving the motor is generated based on the compensated torque command, and the electrical signal can control the motor speed.

2. The method according to claim 1, wherein: When the difference is greater than a predetermined threshold, compensating the torque command using the torque compensation value; When the difference is less than or equal to the predetermined threshold, the compensation is not performed.

3. The method according to claim 1, wherein: The step of compensating the torque command by using the torque compensation value includes: calculating a difference between the torque command and the torque compensation value as the compensated torque command.

4. The method according to claim 1, wherein: The step of generating a torque compensation value in real time based on the difference comprises: multiplying the difference by a gain to obtain a first value; Multiply the first value by To obtain a second value, and multiply the first value by To obtain a third value, wherein θ represents the mechanical angle of the motor, represents the lead angle of the motor; Integrating the second value and the third value respectively to obtain a fourth value and a fifth value; multiplying the fourth value by cos(θ) to obtain a sixth value, and multiplying the fifth value by sin(θ) to obtain a seventh value; The sixth value and the seventh value are added to obtain the torque compensation value.

5. The method according to claim 4, further comprising: The gain and the lead angle are set according to a target rotation speed of the motor.

6. The method according to claim 5, further comprising: The gain and the lead angle corresponding to the target rotation speed are determined in a pre-prepared lookup table.

7. The method according to claim 6, further comprising: When the target rotation speed remains unchanged, at least one of the gain and the lead angle is adjusted.

8. The method according to claim 7, wherein: The step of adjusting at least one of the gain and the lead angle comprises: determining a first difference between a target speed of the motor and a first actual speed after compensation using a torque compensation value generated based on the gain and / or the lead angle; determining in the lookup table another gain and / or another lead angle corresponding to another target speed adjacent to the target speed; determining a second difference between the target speed of the motor and a second actual speed after compensation using the torque compensation value generated based on the another gain and / or the another lead angle; In a case where the second difference is smaller than the first difference, the gain and / or the lead angle is replaced with the other gain and / or the other lead angle.

9. The method according to claim 1, wherein: The step of generating the electrical signal comprises: Based on the compensated torque command, a maximum torque-to-current ratio control (MTPA) and a field weakening control (FW) are performed to generate a dq-axis current command; Calculating the difference between the dq axis current command and the dq axis actual current; Performing proportional-integral control based on the calculated current difference to generate dq-axis voltage commands; Performing a transformation on the dq axis voltage command from a rotating dq coordinate system to a stationary abc coordinate system; Pulse width modulation is performed on the converted voltage command to obtain a voltage signal capable of controlling the speed of the motor.

10. The method according to claim 1, wherein: The method is implemented in a single chip microcomputer, and the single chip microcomputer is arranged in a frequency converter of the compressor.

11. A device for controlling the motor speed of a compressor, comprising: A memory storing a program; as well as One or more processors, the processors being configured to perform the following operations by executing the program: Obtain the difference between the target speed and the actual speed of the motor in real time; generating a torque command based on the difference; In an adaptive feedforward control manner, a torque compensation value is generated in real time based on the difference, and the torque command is compensated by using the torque compensation value; An electrical signal for driving the motor is generated based on the compensated torque command, and the electrical signal can control the motor speed.

12. The device according to claim 11, wherein The processor is further configured to: When the difference is greater than a predetermined threshold, compensating the torque command using the torque compensation value; When the difference is less than or equal to the predetermined threshold, the compensation is not performed.

13. The device according to claim 11, wherein: The processor is further configured to calculate a difference between the torque command and the torque compensation value as the compensated torque command.

14. The device according to claim 11, wherein: The processor is further configured to generate the torque compensation value by performing the following operations: multiplying the difference by a gain to obtain a first value; Multiply the first value by To obtain a second value, and multiply the first value by To obtain a third value, wherein θ represents the mechanical angle of the motor, represents the lead angle of the motor; Integrating the second value and the third value respectively to obtain a fourth value and a fifth value; multiplying the fourth value by cos(θ) to obtain a sixth value, and multiplying the fifth value by sin(θ) to obtain a seventh value; The sixth value and the seventh value are added to obtain the torque compensation value.

15. The device according to claim 14, wherein: The processor is further configured to set the gain and the lead angle according to a target rotation speed of the motor.

16. The device according to claim 15, wherein: The processor is further configured to determine a gain and a lead angle corresponding to the target rotation speed in a pre-prepared lookup table.

17. The device according to claim 16, wherein: The processor is further configured to adjust at least one of the gain and the lead angle when the target rotation speed remains unchanged.

18. The device according to claim 17, wherein: The processor is further configured to adjust at least one of the gain and the lead angle by: determining a first difference between a target speed of the motor and a first actual speed after compensation using a torque compensation value generated based on the gain and / or the lead angle; determining in the lookup table another gain and / or another lead angle corresponding to another target speed adjacent to the target speed; determining a second difference between the target speed of the motor and a second actual speed after compensation using the torque compensation value generated based on the another gain and / or the another lead angle; In a case where the second difference is smaller than the first difference, the gain and / or the lead angle is replaced with the other gain and / or the other lead angle.

19. The device according to claim 11, wherein: The processor is further configured to generate the electrical signal by: Based on the compensated torque command, a maximum torque-to-current ratio control (MTPA) and a field weakening control (FW) are performed to generate a dq-axis current command; Calculating the difference between the dq axis current command and the dq axis actual current; Performing proportional-integral control based on the calculated current difference to generate dq-axis voltage commands; Performing a transformation on the dq axis voltage command from a rotating dq coordinate system to a stationary abc coordinate system; Pulse width modulation is performed on the converted voltage command to obtain a voltage signal capable of controlling the speed of the motor.

20. A non-transitory computer readable medium storing a program, wherein when the program is executed by a processor, the processor executes the method for controlling the speed of a motor of a compressor according to any one of claims 1 to 10.