Disclosure of Invention
The application provides a method, a device, equipment and a readable storage medium for obtaining a working angle of a motor, aiming at improving smoothness of switching of the working angle of the motor, and the method comprises the following steps:
a method for obtaining the working angle of a motor comprises the following steps:
an ith iteration process, including:
acquiring a starting angle i and an estimated angle i, wherein the starting angle i is determined according to a preset angle of a motor in a low-speed running state, and the estimated angle i is the preset angle of the motor in a high-speed running state;
calculating a difference value between the starting angle i and the estimated angle i to serve as a difference value i;
judging whether the difference value i exceeds a preset difference value range, wherein the preset difference value range is a range of the difference value of the operation angle degrees before and after switching under the condition that the working angle of the motor is smoothly switched;
if a preset condition is met, taking the starting angle i as a working angle i, wherein the preset condition comprises the following steps: the difference value i does not exceed the preset difference value range.
Optionally, the preset conditions further include:
the first time length reaches a preset time length threshold value;
the first time length is the timing time length of a preset timer, the timer starts timing from 0 under the condition that a difference value j does not exceed the preset difference value range and the timing is zero, the difference value j is the difference value between a starting angle j and an estimation angle j determined in the jth iteration process, and the jth iteration process is executed before the ith iteration process.
Optionally, the ith iteration flow further includes:
and if the preset condition is not met, taking the estimated angle i as a working angle i.
Optionally, the ith iteration flow further includes:
and if the difference value i exceeds the preset difference value range, clearing the timing duration of the timer and stopping timing.
Optionally, the ith iteration flow further includes:
and if the difference value i does not exceed the preset difference value range, the first time length does not reach a preset time length threshold value, and the first time length is zero, starting the timer to start timing from 0.
Optionally, the trigger condition of the ith iteration flow includes:
and the switching identifier i-1 is equal to a preset first numerical value, and the switching identifier i-1 is generated after the estimated angle i-1 is taken as the working angle i-1 in the (i-1) th iteration process.
Optionally, the ith iteration flow further includes:
setting a switching identifier i equal to the first numerical value after the estimated angle i is taken as the working angle i;
or the like, or, alternatively,
and setting a switching identifier i equal to a preset second numerical value after the starting angle i is taken as the working angle i.
Optionally, obtaining the starting angle i includes:
acquiring a first angle as a starting angle i, wherein the first angle is equal to the sum of a preset angle and a preset numerical value of the motor in a low-speed running state;
or acquiring a second angle as a starting angle i, wherein the second angle is equal to a preset angle of the motor in a low-speed running state;
the trigger condition for acquiring the first angle as the starting angle i is as follows: the difference value i-1 exceeds the preset difference value range, and the difference value i-1 is the difference value between the starting angle i-1 and the estimation angle i-1 determined in the i-1 th iteration process; the trigger condition for acquiring the second angle as the starting angle i is as follows: the difference value i-1 does not exceed the preset difference value range.
An apparatus for obtaining an operating angle of a motor, comprising:
an ith iteration process, including:
the angle acquisition module is used for acquiring a starting angle i and an estimated angle i, wherein the starting angle i is determined according to a preset angle of the motor in a low-speed running state, and the estimated angle i is the preset angle of the motor in a high-speed running state;
a difference value calculating module, configured to calculate a difference value between the starting angle i and the estimated angle i as a difference value i;
the judging module is used for judging whether the difference value i exceeds a preset difference value range, and the preset difference value range is a range of the difference value of the operation angle degrees before and after switching under the condition that the working angle of the motor is smoothly switched;
and the result determining module is used for taking the starting angle i as a working angle i if preset conditions are met, wherein the preset conditions comprise: the difference value i does not exceed the preset difference value range.
An acquisition apparatus of an operating angle of a motor, comprising: a memory and a processor;
the memory is used for storing programs;
the processor is configured to execute the program to implement the steps of the method for acquiring the working angle of the motor.
A readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for obtaining an operating angle of an electric motor as described above.
According to the technical scheme, the method, the device, the equipment and the readable storage medium for obtaining the working angle of the motor provided by the embodiment of the application comprise an ith iteration process, wherein the ith iteration process comprises the following steps: obtaining a starting angle i and an estimated angle i, calculating a difference value between the starting angle i and the estimated angle i, using the difference value as a difference value i, judging whether the difference value i exceeds a preset difference value range, wherein the preset difference value range is a range of a difference value of operation angles before and after switching under the condition that the working angle of the motor is smoothly switched, and using the starting angle i as the working angle i if a preset condition is met, wherein the preset condition comprises the following steps: the difference i does not exceed the preset difference range. Since the preset difference range is the range of the difference of the operation angles before and after switching under the condition that the working angle of the motor is smoothly switched, it can be seen that when the difference i exceeds the preset difference range, if the estimated angle i is switched to the starting angle i, the switching of the working angle of the motor is not smooth, the working angle is determined to be the starting angle i after the difference i does not exceed the preset difference range, and it can be understood that the process of converting the estimated angle i into the starting angle i is smooth under the condition that the difference i does not exceed the preset difference range, and thus the smoothness of the switching of the operation angles of the motor can be improved.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The method for obtaining the working angle of the motor is applied to but not limited to a controller of a permanent magnet synchronous motor, the controller is used for obtaining an estimated angle and a starting angle in real time, outputting the working angle of the permanent magnet synchronous motor according to the estimated angle and the starting angle, and controlling the permanent magnet synchronous motor to run at the working angle, and the specific control process refers to the prior art. It should be noted that the method is specifically applied to a permanent magnet synchronous motor position sensorless algorithm module, when the permanent magnet synchronous motor is switched from a high-speed operation to a low-speed starting process (i.e., low-speed operation), the working angle of the permanent magnet synchronous motor is switched from an estimated angle to a starting angle, and the method acquires and outputs the working angle in the acceleration process by detecting the consistency of the starting angle and the estimated angle, so as to improve the smoothness of the switching process of the working angle of the motor.
Fig. 1 is a schematic flow chart of a specific implementation of a method for obtaining an operating angle of a motor according to an embodiment of the present application, and as shown in fig. 1, the method may specifically include the following steps S101 to S110.
S101, obtaining a starting angle i, an estimation angle i and a switching identifier i-1.
In this embodiment, the starting angle i is determined according to a preset angle of the motor in a low-speed starting state, and the estimated angle i is the preset angle of the motor in a high-speed running state.
It should be noted that the method for obtaining the starting angle i includes at least two optional methods:
1. the first angle is obtained as the starting angle i, and the first angle is equal to the sum of a preset angle of the motor in the low-speed running state and a preset value, wherein the preset value can be configured according to a preset difference range, for example, the preset value is equal to 0.5 times of the maximum value in the preset difference range.
In this embodiment, the trigger condition that the first angle is used as the starting angle i is as follows: in the (i-1) th iteration process, the difference value (difference value i-1) between the starting angle i-1 and the estimated angle i-1 exceeds a preset difference value range.
2. And acquiring a second angle as a starting angle i, wherein the second angle is equal to a preset angle of the motor in a low-speed running state.
The triggering condition for taking the second angle as the starting angle i is as follows: in the (i-1) th iteration process, the difference value (difference value i-1) between the starting angle i-1 and the estimation angle i-1 does not exceed the preset difference value range.
It should be noted that, in the i-1 st iteration process, the method for obtaining and determining the difference value i-1 may specifically refer to S103 to S104.
It should be further noted that the estimated angle i is obtained from a first calculating module, and a preset angle (that is, a second angle) of the motor in a low-speed running state is obtained from a second calculating module, where the first calculating module is configured to obtain the estimated angle i through estimation of a current of the motor (obtained by a current sensor) and a preset sliding mode algorithm, and the second calculating module is configured to calculate the starting angle i through a preset VF starting algorithm, and it should be noted that the first calculating module and the second calculating module are both calculating modules in a permanent magnet synchronous motor position-sensorless algorithm module, which may specifically refer to the prior art.
The switching identifier i-1 is configured to be a preset first numerical value or a preset second numerical value after the working angle is determined by the i-1 st iteration, and it should be noted that when the switching identifier i-1 is equal to the first numerical value, the i-1 st iteration is instructed to determine that the working angle is the estimated angle i-1, and when the switching identifier i-1 is equal to the second numerical value, the i-1 st iteration is instructed to determine that the working angle is the starting angle i-1. That is, the first flag indicates that the switching from the estimated angle i to the starting angle i is not completed, and the second flag indicates that the switching from the estimated angle i to the starting angle i is completed.
S102, judging whether the switching identification i-1 is equal to a first numerical value or not, if the switching identification i-1 is equal to the first numerical value, executing S103, and if the switching identification i-1 is equal to a second numerical value, ending the iteration process.
It should be noted that, in the first iteration flow, the acquired handover flag is a first numerical value.
And S103, calculating a difference value between the starting angle i and the estimated angle i to serve as the difference value i.
And S104, judging whether the difference value i exceeds a preset difference value range, if so, executing S105-S106, and if not, executing S107.
In this embodiment, the preset difference range is a range of a difference between the operation angles before and after the switching when the working angle of the motor is smoothly switched, and the preset difference range includes a preset maximum difference and a preset minimum difference. It should be noted that the preset difference range is determined according to the engineering precision of the practical application, optionally, the preset difference range is [ -1 °, 1 ° ], or the angle may also be digitized, and a higher precision may be set.
And S105, taking the estimated angle i as a working angle i.
And S106, clearing the timing duration of the timer, stopping timing, and executing the (i + 1) th iteration flow.
In this embodiment, the timer is configured in advance, and it should be noted that, if the timer is in the stop timing state, the stop timing state is only required to be maintained, and it can be understood that, in the stop timing state, the timing duration of the timer, that is, the first duration, is 0.
S107, acquiring the first time length, judging whether the first time length is 0, if so, executing S108-S109, and if not, executing S110.
And S108, taking the estimated angle i as a working angle i.
And S109, starting a timer to count time from 0, and executing the (i + 1) th iteration flow.
S110, judging whether the first time length reaches a preset time length threshold value, if so, executing S111-S112, and if not, executing S113.
And S111, taking the starting angle i as a working angle i.
And S112, setting the switching identifier i to be equal to a second numerical value.
And S113, taking the estimated angle i as a working angle, and executing an i +1 th iteration process.
In the method for obtaining the working angle of the motor provided by this embodiment, each iteration process may refer to the process shown in fig. 1.
It can be seen from the above technical solutions that, in the method for obtaining the working angle of the motor according to this embodiment, the working angle of the motor in the deceleration process is obtained by circularly iterating the flow shown in fig. 1 until the working angle of the motor is determined to be the starting angle. In the specific implementation manner of each iteration process (taking the ith iteration process as an example), it can be seen that the method at least comprises the following beneficial effects:
firstly, when the preset difference range is the range of the difference value of the operation angles before and after switching under the condition that the working angle of the motor is smoothly switched, it can be seen that when the difference value i exceeds the preset difference range, the difference value indicates that unsmooth switching of the working angle of the motor can be caused if the estimated angle i is switched to the starting angle i, so that the working angle is determined to be the starting angle i after the difference value i does not exceed the preset difference range, and it can be understood that the process of switching from the estimated angle i to the starting angle i is smooth under the condition that the difference value i does not exceed the preset difference range, and therefore, the smoothness of switching of the operation angles of the motor can be improved.
And secondly, if the difference value i does not exceed the preset difference value range, further judging whether the first time length reaches a preset time length threshold value, and determining that the working angle is the starting angle i when the first time length reaches the preset time length threshold value, wherein the first time length is the timing time length of a preset timer, and the timer starts timing from 0 when the difference value j is determined not to exceed the preset difference value range and the timing is zero in the executing process before the ith iteration process. Therefore, judgment errors caused by possible calculation errors are avoided under the condition that the first time length does not reach the preset time length threshold.
Thirdly, the triggering condition of each iteration process is that the switching identifier is the first numerical value, and the triggering condition for configuring the switching identifier i-1 as the first numerical value is that: in the last iteration process, the estimated angle is used as the working angle, so when the switching mark is the first numerical value, the switching from the estimated angle to the starting angle is not completed, therefore, the working angle error caused by continuing the iteration process after the starting angle is used as the working angle is avoided, and the stability of the method execution can be improved, for example, the program jitter caused by repeatedly executing the acquisition method of the working angle of the motor is avoided.
Fourthly, when the difference value i-1 in the (i-1) th iteration process exceeds the preset difference value range, taking the second angle (namely the sum of the preset angle and the preset value of the motor in the low-speed running state) as the starting angle i, and being beneficial to ensuring that the estimated angular speed of the motor is consistent with the starting angular speed.
The process shown in fig. 1 may be applied to an algorithm model, where the algorithm model is connected to a first calculation module and is used to obtain an estimated angle (e.g., estimated angle i) of each iteration process, and the algorithm model is connected to a second calculation module and is used to obtain a starting angle (e.g., starting angle i) of each iteration process, where it is to be noted that the input of the algorithm model includes the estimated angle i, the starting angle i, and a switching identifier output by the previous iteration process.
As shown in fig. 2, in this embodiment, the input data of the algorithm model is: VF _ Theta, SMO _ Theta, and Sw _ to _ VF _ fly, the output data is Theta. Wherein the value of the gama is configured to be the first value (0) or the second value (1) in each iteration flow according to the minimum value of ERR _ theta determined by the engineering precision of the practical application.
The specific work flow of the algorithm model comprises the following steps:
1. it is determined whether Sw _ to _ smo _ fly is equal to 1.
2. If Sw _ to _ smo _ fly is 1, let Theta be VF _ Theta.
3. If Sw _ to _ SMO _ fly ≠ 1, ERR _ theta is calculated as VF _ theta-SMO _ theta.
4. Judging whether ERR _ theta is not greater than gama.
5. If ERR _ theta > gama, let Switch _ t _ cnt equal to 0 and VF _ theta + (gama < 1), i.e. update VF _ theta to 0.5 times VF _ theta plus gama.
6. If ERR _ theta | ≦ gama, let Switch _ t _ cnt equal to 1+ Switch _ t _ cnt.
7. It is determined whether Switch _ t _ cnt is not less than time _ const.
8. If Switch _ t _ cnt is greater than or equal to time _ const, then let Sw _ to _ VF _ fly be 1 and Theta be VF _ Theta.
9. If Switch _ t _ cnt < time _ const, let Sw _ to _ VF _ fly be 0, and Theta be SMO _ Theta.
10. The algorithm model outputs Sw _ to _ VF _ fly and Theta.
The algorithm model shown in fig. 2 exemplifies an optional specific algorithm model work flow, in practical application, the flow shown in fig. 2 is an iterative loop process, and it should be noted that the method for obtaining the working angle of the motor provided in this embodiment may also be applied to other algorithm models, and is used to output the current working angle by taking the estimated angle, the start angle, and the switching identifier as inputs.
It should be noted that the method shown in fig. 1 is an optional specific implementation of the method for obtaining the working angle of the motor provided in the embodiment of the present application, and the present application further includes other optional specific implementations, for example, S102 is an optional step, and for example, the method for determining whether the difference i exceeds the preset difference range may include other methods.
Therefore, in this embodiment, the probability of the method for acquiring the working angle of the motor is summarized as the flow shown in fig. 3, and as shown in fig. 3, the method specifically includes:
s301, acquiring a starting angle i and an estimated angle i.
In this embodiment, the starting angle i is determined according to a preset angle of the motor in a low-speed operation state, and the estimated angle i is the preset angle of the motor in a high-speed operation state.
It should be noted that the estimated angle i is an angle estimated by a closed-loop algorithm (e.g., a preset sliding mode algorithm) according to the current actual operating state (e.g., current parameter, position parameter) of the motor, and the estimated angle i is an actual operating angle of the motor before angle switching during deceleration. A specific method for determining the starting angle i according to the preset angle in the state where the motor is operating at the low speed may be referred to as S101 in the above embodiment.
The specific starting angle i and the estimated angle i are obtained according to the prior art.
And S302, calculating a difference value between the starting angle i and the estimation angle i to serve as the difference value i.
And S303, judging whether the difference value i exceeds a preset difference value range.
In this embodiment, the difference between the starting angle i and the estimated angle i indicates the proximity degree of the starting angle i and the estimated angle i, and it can be understood that the closer the starting angle i and the estimated angle i are, the smoother the switching from the estimated angle i to the starting angle i is, so that the preset difference range is the range of the difference between the operation angles before and after the switching under the condition that the working angle of the motor is smoothly switched, and it should be noted that the preset difference range may be preset according to an experimental result or may be preset according to historical data.
In this embodiment, the method for determining whether the difference i exceeds the preset difference range includes various optional methods, for example, the preset difference range includes a minimum difference and a maximum difference, and if the absolute value of the difference i is greater than the maximum difference, it is determined that the difference i exceeds the preset difference range, or, if the difference i is greater than the maximum difference, or the difference i is less than the minimum difference, it is determined that the difference i exceeds the preset difference range.
And S304, if the preset condition is met, taking the starting angle i as a working angle i.
In this embodiment, the preset condition is a condition determined according to actual application, and the preset condition at least includes: the difference i does not exceed the preset difference range.
Specifically, if the difference i does not exceed the preset difference range, the starting angle i is used as the working angle i.
According to the technical scheme, the method for acquiring the working angle of the motor comprises an ith iteration process, wherein the ith iteration process comprises the following steps: obtaining a starting angle i and an estimated angle i, calculating a difference value between the starting angle i and the estimated angle i, using the difference value as a difference value i, judging whether the difference value i exceeds a preset difference value range, wherein the preset difference value range is a range of a difference value of operation angles before and after switching under the condition that the working angle of the motor is smoothly switched, and using the starting angle i as the working angle i if a preset condition is met, wherein the preset condition comprises the following steps: the difference i does not exceed the preset difference range. Since the preset difference range is the range of the difference of the operation angles before and after switching under the condition that the working angle of the motor is smoothly switched, it can be seen that when the difference i exceeds the preset difference range, the difference indicates that unsmooth switching of the working angle of the motor can be caused if the estimated angle i is switched to the starting angle i, the working angle is determined to be the starting angle i after the difference i does not exceed the preset difference range, and it can be understood that the process of converting the estimated angle i into the starting angle i is smooth under the condition that the difference i does not exceed the preset difference range, and it can be seen that the smoothness of switching of the operation angles of the motor can be improved.
Fig. 4 shows a schematic structural diagram of an apparatus for obtaining an operating angle of a motor according to an embodiment of the present application, and as shown in fig. 4, the apparatus may include:
an angle obtaining module 401, configured to obtain, in an ith iteration process, a starting angle i and an estimated angle i, where the starting angle i is determined according to a preset angle of a motor in a low-speed operation state, and the estimated angle i is a preset angle of the motor in a high-speed operation state;
a difference value calculating module 402, configured to calculate a difference value between the starting angle i and the estimated angle i as a difference value i;
a judging module 403, configured to judge whether the difference i exceeds a preset difference range, where the preset difference range is a range of a difference between operation angles before and after switching when the working angle of the motor is smoothly switched;
a result determining module 404, configured to take the starting angle i as a working angle i if a preset condition is met, where the preset condition includes: the difference value i does not exceed the preset difference value range.
Optionally, the preset conditions further include:
the first time length reaches a preset time length threshold value;
the first time length is the timing time length of a preset timer, the timer starts timing from 0 under the condition that a difference value j does not exceed the preset difference value range and the timing is zero, the difference value j is the difference value between a starting angle j and an estimation angle j determined in the jth iteration process, and the jth iteration process is executed before the ith iteration process.
Optionally, the result determining module is further configured to, if the preset condition is not met, take the estimated angle i as a working angle i.
Optionally, the system further comprises a timing module, configured to clear the timing duration of the timer and stop timing if the difference i exceeds the preset difference range.
Optionally, the timing module is further configured to: and if the difference value i does not exceed the preset difference value range, the first time length does not reach a preset time length threshold value, and the first time length is zero, starting the timer to start timing from 0.
Optionally, the trigger condition of the ith iteration flow includes:
and the switching identifier i-1 is equal to a preset first numerical value, and the switching identifier i-1 is generated after the estimated angle i-1 is taken as the working angle i-1 in the (i-1) th iteration process.
Optionally, the system further comprises an identifier setting module, configured to set the switching identifier i equal to the first numerical value after the estimated angle i is taken as the working angle i; or setting a switching identifier i equal to a preset second numerical value after the starting angle i is taken as the working angle i.
Optionally, the angle obtaining module is configured to, in the ith iteration procedure, obtain the starting angle i, where the obtaining includes:
the angle acquisition module is specifically used for acquiring a first angle as a starting angle i, wherein the first angle is equal to the sum of a preset angle and a preset numerical value of the motor in a low-speed running state; or acquiring a second angle as a starting angle i, wherein the second angle is equal to a preset angle of the motor in a low-speed running state; the trigger condition for acquiring the first angle as the starting angle i is as follows: the difference value i-1 exceeds the preset difference value range, and the difference value i-1 is the difference value between the starting angle i-1 and the estimation angle i-1 determined in the i-1 th iteration process; the trigger condition for acquiring the second angle as the starting angle i is as follows: the difference value i-1 does not exceed the preset difference value range.
Fig. 5 shows a schematic structural diagram of an acquisition device of an operating angle of the motor, which may include: at least one processor 501, at least one communication interface 502, at least one memory 503, and at least one communication bus 504;
in the embodiment of the present application, the number of the processor 501, the communication interface 502, the memory 503 and the communication bus 504 is at least one, and the processor 501, the communication interface 502 and the memory 503 complete the communication with each other through the communication bus 504;
the processor 501 may be a central processing unit CPU, or an application Specific Integrated circuit asic, or one or more Integrated circuits configured to implement embodiments of the present invention, etc.;
the memory 503 may include a high-speed RAM memory, and may further include a non-volatile memory (non-volatile memory) or the like, such as at least one disk memory;
the processor can execute the program stored in the memory, and implement the steps of the method for obtaining the working angle of the motor provided by the embodiment of the application, as follows:
a method for obtaining the working angle of a motor comprises the following steps:
an ith iteration process, including:
acquiring a starting angle i and an estimated angle i, wherein the starting angle i is determined according to a preset angle of a motor in a low-speed running state, and the estimated angle i is the preset angle of the motor in a high-speed running state;
calculating a difference value between the starting angle i and the estimated angle i to serve as a difference value i;
judging whether the difference value i exceeds a preset difference value range, wherein the preset difference value range is a range of the difference value of the operation angle degrees before and after switching under the condition that the working angle of the motor is smoothly switched;
if a preset condition is met, taking the starting angle i as a working angle i, wherein the preset condition comprises the following steps: the difference value i does not exceed the preset difference value range.
Optionally, the preset conditions further include:
the first time length reaches a preset time length threshold value;
the first time length is the timing time length of a preset timer, the timer starts timing from 0 under the condition that a difference value j does not exceed the preset difference value range and the timing is zero, the difference value j is the difference value between a starting angle j and an estimation angle j determined in the jth iteration process, and the jth iteration process is executed before the ith iteration process.
Optionally, the ith iteration flow further includes:
and if the preset condition is not met, taking the estimated angle i as a working angle i.
Optionally, the ith iteration flow further includes:
and if the difference value i exceeds the preset difference value range, clearing the timing duration of the timer and stopping timing.
Optionally, the ith iteration flow further includes:
and if the difference value i does not exceed the preset difference value range, the first time length does not reach a preset time length threshold value, and the first time length is zero, starting the timer to start timing from 0.
Optionally, the trigger condition of the ith iteration flow includes:
and the switching identifier i-1 is equal to a preset first numerical value, and the switching identifier i-1 is generated after the estimated angle i-1 is taken as the working angle i-1 in the (i-1) th iteration process.
Optionally, the ith iteration flow further includes:
setting a switching identifier i equal to the first numerical value after the estimated angle i is taken as the working angle i;
or the like, or, alternatively,
and setting a switching identifier i equal to a preset second numerical value after the starting angle i is taken as the working angle i.
Optionally, obtaining the starting angle i includes:
acquiring a first angle as a starting angle i, wherein the first angle is equal to the sum of a preset angle and a preset numerical value of the motor in a low-speed running state;
or acquiring a second angle as a starting angle i, wherein the second angle is equal to a preset angle of the motor in a low-speed running state;
the trigger condition for acquiring the first angle as the starting angle i is as follows: the difference value i-1 exceeds the preset difference value range, and the difference value i-1 is the difference value between the starting angle i-1 and the estimation angle i-1 determined in the i-1 th iteration process; the trigger condition for acquiring the second angle as the starting angle i is as follows: the difference value i-1 does not exceed the preset difference value range.
The embodiment of the present application further provides a readable storage medium, where the readable storage medium may store a computer program suitable for being executed by a processor, and when the computer program is executed by the processor, the steps of the method for obtaining the working angle of the motor provided by the embodiment of the present application are implemented as follows:
a method for obtaining the working angle of a motor comprises the following steps:
an ith iteration process, including:
acquiring a starting angle i and an estimated angle i, wherein the starting angle i is determined according to a preset angle of a motor in a low-speed running state, and the estimated angle i is the preset angle of the motor in a high-speed running state;
calculating a difference value between the starting angle i and the estimated angle i to serve as a difference value i;
judging whether the difference value i exceeds a preset difference value range, wherein the preset difference value range is a range of the difference value of the operation angle degrees before and after switching under the condition that the working angle of the motor is smoothly switched;
if a preset condition is met, taking the starting angle i as a working angle i, wherein the preset condition comprises the following steps: the difference value i does not exceed the preset difference value range.
Optionally, the preset conditions further include:
the first time length reaches a preset time length threshold value;
the first time length is the timing time length of a preset timer, the timer starts timing from 0 under the condition that a difference value j does not exceed the preset difference value range and the timing is zero, the difference value j is the difference value between a starting angle j and an estimation angle j determined in the jth iteration process, and the jth iteration process is executed before the ith iteration process.
Optionally, the ith iteration flow further includes:
and if the preset condition is not met, taking the estimated angle i as a working angle i.
Optionally, the ith iteration flow further includes:
and if the difference value i exceeds the preset difference value range, clearing the timing duration of the timer and stopping timing.
Optionally, the ith iteration flow further includes:
and if the difference value i does not exceed the preset difference value range, the first time length does not reach a preset time length threshold value, and the first time length is zero, starting the timer to start timing from 0.
Optionally, the trigger condition of the ith iteration flow includes:
and the switching identifier i-1 is equal to a preset first numerical value, and the switching identifier i-1 is generated after the estimated angle i-1 is taken as the working angle i-1 in the (i-1) th iteration process.
Optionally, the ith iteration flow further includes:
setting a switching identifier i equal to the first numerical value after the estimated angle i is taken as the working angle i;
or the like, or, alternatively,
and setting a switching identifier i equal to a preset second numerical value after the starting angle i is taken as the working angle i.
Optionally, obtaining the starting angle i includes:
acquiring a first angle as a starting angle i, wherein the first angle is equal to the sum of a preset angle and a preset numerical value of the motor in a low-speed running state;
or acquiring a second angle as a starting angle i, wherein the second angle is equal to a preset angle of the motor in a low-speed running state;
the trigger condition for acquiring the first angle as the starting angle i is as follows: the difference value i-1 exceeds the preset difference value range, and the difference value i-1 is the difference value between the starting angle i-1 and the estimation angle i-1 determined in the i-1 th iteration process; the trigger condition for acquiring the second angle as the starting angle i is as follows: the difference value i-1 does not exceed the preset difference value range.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.