Uniform speed rotation control method and control system for ultrasonic endoscope motor under different loads

Through the incremental PID algorithm and PWM compensation algorithm, the problem of the ultrasonic endoscopic motor rotating at a constant speed under different loads is solved, high-quality image imaging is achieved, and the adaptability is strong, and the production process of the ultrasonic probe is simplified.

CN114050756BActive Publication Date: 2024-11-05INNERMEDICAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111326350.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-10
Publication Date
2024-11-05
Estimated Expiration
2041-11-10

AI Technical Summary

Technical Problem

Ultrasonic endoscopic motors are difficult to achieve uniform rotation under different load conditions, resulting in a decrease in image imaging quality. The existing PID algorithm parameters are insufficient to match, and it is impossible to effectively adapt to different load forces and uneven friction forces.

Method used

The incremental PID algorithm and PWM duty cycle parameter compensation algorithm are used to match the PID parameters through experiments, identify the load force interval, perform incremental PID adjustment, and adjust the PID parameters and compensate the PWM duty cycle under the velocity oscillation to Achieve constant speed rotation of the motor.

Benefits of technology

The ultrasonic endoscopic motor is realized at a uniform speed under different loads and uneven frictional forces, reducing speed oscillation, improving image imaging quality, reducing noise, strong adaptability, and simplifying the production process of ultrasonic probes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114050756B_ABST
    Figure CN114050756B_ABST
Patent Text Reader

Abstract

The present invention provides a uniform rotation control method and control system for an ultrasonic endoscope motor under different loads, the control method comprising: matching corresponding PID parameters according to different load force intervals in advance; adjusting the PID algorithm of the speed according to the matched PID parameters, fine-tuning the PID parameters according to the speed oscillation during the speed adjustment process, and performing a PWM duty cycle parameter compensation algorithm in advance when the speed oscillation amplitude caused by the uneven friction of the ultrasonic probe during the rotation process exceeds the set ratio. The technical solution of the present invention can realize that when the ultrasonic endoscope motor driver matches ultrasonic probes with different resistances and encounters uneven friction, the motor driver can still drive the ultrasonic probe to rotate at a uniform speed, can respond quickly and stabilize the speed, and will not have large-scale motor speed oscillations; the motor can drive the ultrasonic probe to rotate at a uniform speed, which can effectively reduce the noise when the machine operates the motor and increases the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of ultrasonic endoscopes, and in particular relates to a uniform speed rotation control method and a control system for an ultrasonic endoscope motor under different loads. Background Art

[0002] The ultrasonic endoscope image is driven by the ultrasonic probe to rotate at a constant speed through the motor driver to form a 360-degree image. The imaging effect and fineness of the image are often directly related to whether the motor driver rotates at a constant speed. In the ordinary control of the motor driver to rotate at a constant speed, the PID algorithm is generally used to control and adjust the PWM duty cycle to control and adjust the motor driver speed to achieve the effect of uniform rotation. However, when the motor driver is matched with ultrasonic probes of different resistances, the originally set PID algorithm parameter control often causes the different load forces of the probes to cause the parameters to be mismatched, resulting in the motor driver being unable to rotate at a constant speed or the oscillation amplitude being large, and finally resulting in poor image quality, partial overlap and deviation. How to achieve uniform rotation of the ultrasonic endoscope motor driver when matching ultrasonic probes with different load forces, so that the ultrasonic image imaging effect can maintain high quality, is a difficult problem that ultrasonic endoscopes need to face and solve at present. Summary of the invention

[0003] In response to the above technical problems, the present invention discloses a uniform speed rotation control method and control system for an ultrasonic endoscope motor under different loads, which can automatically adjust and match different loads to achieve uniform speed control of motor rotation.

[0004] To this end, the technical solution adopted by the present invention is:

[0005] A method for controlling uniform rotation of an ultrasonic endoscope motor under different loads, comprising:

[0006] Step S1, conducting experiments in advance, matching corresponding PID parameters according to different load force intervals; performing load force identification calculation on the inserted ultrasonic probe, and assigning the load force to the corresponding load force interval according to the load force, and matching the corresponding PID parameters;

[0007] Step S2, adjusting the speed using an incremental PID algorithm according to the matched PID parameters;

[0008] Step S3, adjusting PID parameters according to speed oscillation during speed regulation;

[0009] Step S4, when the speed oscillation amplitude caused by the uneven friction force of the ultrasonic probe during rotation exceeds a set ratio, the PWM duty cycle parameter compensation algorithm is performed in advance to control and adjust the rotation of the motor. Further, the exceeding the set ratio means that the amplitude of the change is greater than 5%.

[0010] This technical solution is used to perform incremental PID algorithm speed regulation without the need for accumulation. The determination of the control quantity increment is only related to the most recent deviation values, and the impact of the calculated deviation is small. Because the control quantity increment is obtained in step S2, the impact on the system is relatively small, making the control of the motor driver more delicate and stable.

[0011] As a further improvement of the present invention, the set time interval is 5 ms. Using this time interval for sampling and output control has a better experimental effect on the uniform speed control of the motor.

[0012] As a further improvement of the present invention, in step S1, the load force identification calculation is calculated using the following formula (2):

[0013] LOAD = Ki * ((Kp*(PWM / AD)) / SPEED) (2)

[0014] Among them, LOAD is the current load value, Ki is the relationship constant between load, speed and current, Kp is the relationship constant between PWM duty cycle and current value, PWM represents PWM wave duty cycle, AD is the current value, SPEED is the encoder feedback speed value; among them, Ki constant and Kp constant are obtained from the experiment of matching corresponding PID parameters according to different load force intervals in step S1, and change with the influence of different structural layers and different properties of the drive motor.

[0015] As a further improvement of the present invention, the method for setting the load force interval is: after the driving motor is stabilized, the load force is continuously calculated and accumulated multiple times at set time intervals, and then different load force intervals are set after statistical calculation.

[0016] Furthermore, the statistical calculation method is a weighted average calculation method, that is, after the drive motor is stable, the accumulated load forces are continuously calculated at set time intervals, the maximum and minimum values ​​are removed and the average value is calculated, and then the obtained load force average value is distributed to the corresponding interval.

[0017] Furthermore, after the driving motor is stabilized, continuous calculation is performed at a time interval of 5 ms for a total of 100 times, and the maximum and minimum values ​​in the 100 data are removed to find the average value, and then the obtained load force average value is used to set different load force ranges.

[0018] Furthermore, 10 load intervals are set, and the torque ranges of the 10 load intervals cover the upper and lower limits of the torque magnitudes of all ultrasonic probes in this project.

[0019] As a further improvement of the present invention, in step S2, the incremental PID algorithm adjustment includes:

[0020] The encoder data is sampled at a set time interval and converted into an actual speed value. The actual speed value is compared with the target speed to obtain the speed difference E. The PWM wave duty cycle parameter is calculated according to the matching PID parameter according to the following formula (1). The obtained PWM duty cycle parameter is output to the motor driver chip to adjust the motor rotation speed, thereby achieving closed-loop incremental PID control.

[0021] PWM=(PID_Kp* E(k))-(PID_Ki * E(k-1))+(PID_Kd * E(k-2)) (1)

[0022] Among them, PWM is the PWM wave duty cycle parameter, PID_Kp is the P coefficient in the PID algorithm, PID_Ki is the I coefficient in the PID algorithm, PID_Kd is the D coefficient in the PID algorithm, E(k) is the current speed difference, E(k-1) is the previous speed difference, and E(k-2) is the previous speed difference.

[0023] As a further improvement of the present invention, in step S3, the speed values ​​of multiple cycles are continuously collected, and then data analysis is performed to determine whether the coefficients of the three items P, I, and D matched in step S1 can control the uniform rotation of the ultrasonic motor in step S2. If it cannot be well controlled, the coefficients of the three items P, I, and D matched in step S1 are fine-tuned. After each round of debugging, multiple data are collected again for analysis to determine whether the fine-tuning coefficient needs to be improved. Further, based on the overall oscillation of the speed and the maximum value of the deviation value of the speed after regulation, it is determined whether the coefficients of the three items P, I, and D matched in step S1 can control the uniform rotation of the ultrasonic motor in step S2. Further, the unit of each fine-tuning is 0.05 to 0.1.

[0024] Furthermore, it is determined based on the overall oscillation of the speed and the maximum value of the deviation of the regulated speed whether the coefficients of the three items P, I, and D matched in step S1 can cause the motor to rotate according to step S2.

[0025] As a further improvement of the present invention, the PWM duty cycle parameter compensation algorithm includes: regularly sampling the current speed and the current PWM duty cycle at a set time interval, calculating the relationship Q between the speed and the PWM duty cycle, when the motor rotates at a uniform speed, the change of the relationship Q in one rotation of the motor driver should be roughly unchanged or the change amplitude is small, when it is encountered that there is uneven friction at a certain position during the rotation of the ultrasonic probe, it will cause a large change in the relationship Q. If it is found that the relationship Q changes greatly or there is a sudden change, that is, it is found that the change of the relationship Q exceeds the Q change set value, then the current position n and the current relationship Q are recorded, and after multiple rounds of detection and calibration, it is determined whether there is uneven friction at position n. Before the motor rotates to the same position next time, the output PWM duty cycle is compensated in advance by the algorithm based on the relationship of the relationship Q, that is, the PWM duty cycle parameter is compensated. The PWM duty cycle directly affects the speed, thereby achieving a smooth transition in speed.

[0026] Furthermore, the Q change setting value is 5% of the relationship quantity Q, that is, a change exceeding 5% is considered to be a large change and a mutation exists.

[0027] Furthermore, calibration is performed after 10 rounds of testing. As a further improvement of the present invention, the set time interval for adjusting the incremental PID algorithm is 5 ms.

[0028] As a further improvement of the present invention, in step S4, the setting time interval of the PWM duty cycle parameter compensation algorithm is 1 ms.

[0029] As a further improvement of the present invention, in the PWM duty cycle parameter compensation algorithm, the following formula (3) is used to calculate the current PWM duty cycle;

[0030] PWM(n) = Ki * ((Q(n)-Q(n-1))* PWM(PID)) (3)

[0031] Where PWM(n) is the PWM duty cycle to be output when it reaches position n, Ki is a constant, Q(n) is the value of the relational quantity Q at position n, Q(n-1) is the value of the relational quantity Q at position n-1, and PWM(PID) is the PWM duty cycle output by the PID algorithm at position n.

[0032] The present invention also discloses a uniform speed rotation control system of an ultrasonic endoscope motor under different loads, which comprises:

[0033] A load force identification and PID parameter matching module, which is provided with corresponding PID parameters for matching different load force intervals; the load force identification calculation is performed on the inserted ultrasonic probe, and the load force is allocated to the corresponding load force interval according to the load force size, and the corresponding PID parameters are matched;

[0034] Incremental PID algorithm adjustment module, which adjusts the speed using the incremental PID algorithm according to the matching PID parameters;

[0035] PID parameter adjustment module, which adjusts PID parameters according to speed oscillation during speed regulation;

[0036] The PWM duty cycle parameter compensation module performs the PWM duty cycle parameter compensation algorithm in advance to control and adjust the motor rotation when the ultrasonic probe has a large speed change or a large speed oscillation amplitude due to uneven friction during rotation.

[0037] As a further improvement of the present invention, the set time interval is 5 ms. Using this time interval for sampling and output control has a better experimental effect on the uniform speed control of the motor.

[0038] As a further improvement of the present invention, the load force identification and PID parameter matching module uses the following formula (2) to calculate the load force:

[0039] LOAD = Ki * ((Kp*(PWM / AD)) / SPEED) (2)

[0040] Among them, LOAD is the load value of this time, Ki is the constant for the relationship between load, speed and current, Kp is the constant for the relationship between PWM duty cycle and current value, PWM represents the PWM wave duty cycle, AD is the current value, and SPEED is the encoder feedback speed value; among them, the Ki constant and the Kp constant are obtained by matching the corresponding PID parameters according to different load force intervals in advance, and change with the different structural layers and drive motor properties.

[0041] As a further improvement of the present invention, the load force size interval is obtained by continuously calculating the load force accumulated multiple times at a set time interval after the driving motor is stable, and then setting different load force intervals after statistical calculation. Further, the statistical calculation method is a weighted average calculation method. That is to say, after the driving motor is stable, the load force is accumulated multiple times by continuously calculating at a set time interval, and the average value is calculated after removing the maximum and minimum values, and then the obtained load force average value is allocated to the corresponding interval. Further, the load force is accumulated for at least 100 times, and the average value is calculated after removing the maximum and minimum values, and then the obtained load force average value is allocated to the corresponding interval.

[0042] As a further improvement of the present invention, 10 load intervals are set, and the torque ranges of the 10 load intervals cover the upper and lower limits of the torque magnitudes of all ultrasonic probes in this project.

[0043] As a further improvement of the present invention, the incremental PID algorithm adjustment module adopts the following steps for adjustment:

[0044] The encoder data is sampled at a set time interval and converted into an actual speed value. The actual speed value is compared with the target speed to obtain the speed difference E. The PWM wave duty cycle parameter is calculated according to the matching PID parameter according to the following formula (1). The obtained PWM duty cycle parameter is output to the motor driver chip to adjust the motor rotation speed, thereby achieving closed-loop incremental PID control.

[0045] PWM=(PID_Kp* E(k))-(PID_Ki * E(k-1))+(PID_Kd * E(k-2)) (1)

[0046] Among them, PWM is the PWM wave duty cycle parameter, PID_Kp is the P coefficient in the PID algorithm, PID_Ki is the I coefficient in the PID algorithm, PID_Kd is the D coefficient in the PID algorithm, E(k) is the current speed difference, E(k-1) is the previous speed difference, and E(k-2) is the previous speed difference.

[0047] As a further improvement of the present invention, the PID parameter adjustment module uses the following steps to adjust the PID parameters:

[0048] Continuously collect speed values ​​for multiple cycles, and then perform data analysis to determine whether the coefficients of the three items P, I, and D matched in step S1 can enable the incremental PID algorithm adjustment module to control the ultrasonic motor to rotate at a uniform speed. If not, fine-tune the coefficients of the three items P, I, and D matched in step S1, with each fine-tuning unit being 0.05 to 0.1. After each round of debugging, re-collect multiple data for analysis to determine whether the fine-tuning coefficient needs to be improved. Further, based on the overall oscillation of the speed and the maximum value of the deviation value of the speed after regulation, determine whether the coefficients of the three items P, I, and D matched in step S1 can enable the incremental PID algorithm adjustment module to control the ultrasonic motor to rotate at a uniform speed.

[0049] As a further improvement of the present invention, the PWM duty cycle parameter compensation module performs speed compensation by using the following steps:

[0050] The current speed and the current PWM duty cycle are sampled regularly at the set time interval, and the relationship quantity Q between the speed and the PWM duty cycle is calculated. When the motor rotates at a constant speed, the change of the relationship quantity Q during one rotation of the motor driver should be roughly unchanged or change slightly. When the friction force is uneven at a certain position during one rotation of the ultrasonic probe, the relationship quantity Q will change significantly. If the change of the relationship quantity Q exceeds the set value of Q change, the current position n and the current relationship quantity Q are recorded. After multiple rounds of detection and calibration, it can be determined whether there is uneven friction at position n. Before the motor rotates to the same position next time, the algorithm compensation for the PWM duty cycle to be output is made in advance based on the relationship of the relationship quantity Q, that is, the PWM duty cycle parameters are compensated in advance, because the PWM duty cycle directly affects the speed, so as to achieve a smooth transition in speed.

[0051] The current PWM duty cycle is calculated using the following formula (3):

[0052] PWM(n) = Ki * ((Q(n)-Q(n-1))* PWM(PID)) (3)

[0053] Where PWM(n) is the PWM duty cycle to be output when it reaches position n, Ki is a constant, Q(n) is the value of the relational quantity Q at position n, Q(n-1) is the value of the relational quantity Q at position n-1, and PWM(PID) is the PWM duty cycle output by the PID algorithm at position n.

[0054] Furthermore, the Q change setting value is 5% of the relationship quantity Q, that is, a change exceeding 5% is considered to be a large change and a mutation exists.

[0055] Furthermore, calibration was performed after 10 rounds of testing.

[0056] As a further improvement of the present invention, the set time interval for adjustment of the incremental PID algorithm is 5 ms.

[0057] As a further improvement of the present invention, in step S4, the setting time interval of the PWM duty cycle parameter compensation algorithm is 1 ms.

[0058] The present invention also discloses a device, which includes a motor and a motor control module, wherein the motor control module includes a connected processor and a memory, and the processor is used to execute a computer program stored in the memory to execute the uniform speed rotation control method of the ultrasonic endoscope motor under different loads as described in any of the above items.

[0059] The present invention also discloses a computer-readable storage medium, which includes a computer program. When the computer program is run on a computer, it is used to execute the uniform speed rotation control method under different loads of the ultrasonic endoscope motor as described in any one of the above items.

[0060] Compared with the prior art, the present invention has the following beneficial effects:

[0061] By adopting the technical solution of the present invention, the motor driver of the ultrasonic endoscope can match the ultrasonic probes with different resistances and uneven friction, and the motor driver can still drive the ultrasonic probe to rotate at a uniform speed; the regular sampling and control cycle adopted by the incremental PID algorithm can respond quickly and stabilize the speed, and there will be no large-scale motor speed oscillation; the motor can drive the ultrasonic probe to rotate at a uniform speed, which can effectively reduce the noise when the machine operates the motor and increase the user experience; the ultrasonic probe that can automatically adjust and adapt to different load differences has a much looser requirement on the ultrasonic probe structure layer, making the ultrasonic probe manufacturing process more convenient. Furthermore, since the ultrasonic probe is driven by the motor driver to rotate to form a 360-degree image, the uniform rotation can make the ultrasonic imaging effect more delicate. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 It is a flow chart of a method for controlling uniform speed rotation of an ultrasonic endoscope motor under different loads according to an embodiment of the present invention.

[0063] Figure 2 This is a diagram showing the speed regulation effect of an embodiment of the present invention at a sampling frequency of 1200 revolutions per second with an interval of 5 milliseconds.

[0064] Figure 3 It is a structural block diagram of an ultrasonic endoscope according to an embodiment of the present invention. DETAILED DESCRIPTION

[0065] The preferred embodiments of the present invention are described in further detail below.

[0066] Example 1

[0067] like Figure 1 As shown, a method for controlling uniform rotation of an ultrasonic endoscope motor under different loads includes:

[0068] In the first stage, the probe load force is identified, calculated and allocated to different intervals to match different PID parameters;

[0069] In the second stage, the PID algorithm of the speed is adjusted according to the matching PID parameters;

[0070] In the third stage, the PID parameters are fine-tuned according to the speed oscillation during the speed regulation process;

[0071] In the fourth stage, a PWM duty cycle parameter compensation algorithm is performed in advance when the ultrasonic probe has a large speed change or a large speed oscillation amplitude (the change amplitude is greater than 5%) due to uneven friction during rotation.

[0072] Specifically, in the first stage, experiments are conducted in advance to match different PID parameters according to different load force intervals, that is, the load force of the inserted ultrasonic probe is first read and calculated, and the calculation results are distributed to the different load force intervals that have been originally set, and each interval is matched with different P, I, and D coefficients. These P, I, and D coefficients of each different load force interval are originally carried out under a specific load, and analyzed under MATLAB. The motor motion speed waveform reaches the specific coefficient required by this experiment. The specific P, I, and D coefficients of each interval will be automatically modified, fine-tuned, and recorded according to the rotation situation during the experiment.

[0073] For the inserted ultrasonic probe load (i.e., torque), the following formula (1) is used to calculate the load according to the relationship between the output PWM duty cycle, the actual measured current, and the actual speed:

[0074] LOAD = Ki * ((Kp*(PWM / AD)) / SPEED) (1)

[0075] In the formula, LOAD is the load value of this time, Ki is the constant for the relationship between load, speed and current, Kp is the constant for the relationship between PWM duty cycle and current value, PWM represents the PWM wave duty cycle, AD is the current value, and SPEED is the encoder feedback speed value; the Ki constant and the Kp constant are obtained from the above experiment of matching different PID parameters according to different load force intervals, and change with the influence of different structural layers and different properties of the drive motor.

[0076] The load force of the inserted rotating probe is calculated by the above formula. This scheme calculates continuously for 100 times at a time interval of 5ms after the driving motor is stable, removes the maximum and minimum values ​​of the 100 data, and then calculates the average and distributes it to the corresponding interval. This scheme sets a total of 10 load intervals, and the torque ranges of the 10 load intervals cover the upper and lower limits of the torque of all ultrasonic probes in this project.

[0077] After allocating the ultrasonic probe load range, the second stage begins, which is to use the incremental PID algorithm to sample the encoder data at 5ms intervals and convert it into an actual speed value. The actual speed value is compared with the target speed to obtain the speed difference E, and then the incremental PID algorithm speed adjustment is performed. The adjustment formula is:

[0078] PWM=(PID_Kp* E(k))-(PID_Ki * E(k-1))+(PID_Kd * E(k-2)) (2)

[0079] Where, PWM and PWM wave duty cycle parameters, PID_Kp is the P coefficient in the PID algorithm, PID_Ki is the i coefficient in the PID algorithm, PID_Kd is the d coefficient in the PID algorithm, E(k) is the current error, E(k-1) is the previous error, and E(k-2) is the previous error;

[0080] The PWM duty cycle parameter calculated by the above formula is output to the motor driver chip for motor rotation speed regulation, thereby achieving closed-loop incremental PID control.

[0081] After achieving closed-loop incremental PID control, the speed value will be collected continuously for 300 cycles, and then the data will be analyzed to determine whether the coefficients of P, I, and D matched in the first stage can perfectly control the motor to run at a uniform speed in the second stage. The key points of the analysis are based on the overall oscillation of the speed and the maximum value of the deviation value of the speed after regulation to determine whether to enter the third stage. If entering the third stage, the coefficients of P, I, and D matched in the first stage will be fine-tuned. The unit of each fine-tuning is 0.05, and the fine-tuning value of each coefficient does not exceed 0.1. After each round of debugging, data will be collected again for 300 times for analysis to determine whether the fine-tuning coefficient has been improved, etc. Otherwise, fine-tuning will be performed in the opposite direction. A maximum of 9 fine-tunings will be performed in the third stage to confirm the data.

[0082] After the third stage, the fourth stage begins. In this stage, the PWM duty cycle parameter compensation algorithm is performed in advance to solve the problem that the friction force is uneven when the ultrasonic probe rotates one circle, resulting in a large speed change at a certain position. Because the PID algorithm speed adjustment is performed after the speed changes, and the main purpose of this solution is to rotate the motor at a constant speed, any large speed changes should be avoided, so there is a fourth round of PWM duty cycle parameter compensation algorithm. Specifically, the current speed and the current PWM duty cycle are sampled at 1ms time intervals, and the relationship Q between the speed and the PWM duty cycle is calculated. When the motor rotates at a constant speed, the change in the relationship Q during one rotation of the motor driver should be roughly unchanged or have a small change amplitude. When there is uneven friction at a certain position during one rotation of the ultrasonic probe, the relationship Q will change significantly. If it is found that the relationship Q changes significantly or suddenly (the change amplitude is greater than 5%), the current position n and the current relationship Q are recorded. After multiple rounds of detection and calibration, it can be determined whether there is uneven friction at position n. Before the motor rotates to the same position next time, the output PWM duty cycle is compensated in advance based on the relationship of the relationship Q, thereby achieving a smooth transition in speed.

[0083] The PWM duty cycle is calculated using the following formula (3):

[0084] PWM(n) = Ki * ((Q(n)-Q(n-1))* PWM(PID)) (3)

[0085] Where PWM(n) is the PWM duty cycle to be output when it reaches position n, Ki is a constant, Q(n) is the value of the relational quantity Q at position n, Q(n-1) is the value of the relational quantity Q at position n-1, and PWM(PID) is the PWM duty cycle output by the PID algorithm at position n.

[0086] The above control method uses an incremental PID algorithm to obtain the increment of the control quantity, which has a relatively small impact on the system.

[0087] Using the above control method, in this embodiment, the second stage incremental PID algorithm is regulated with a sampling frequency of 5 milliseconds. The speed regulation effect diagram of the motor at 1200 revolutions per second is as follows: Figure 2 As shown, it can be seen that by adopting the control method of this embodiment, when encountering uneven friction, the motor driver can drive the ultrasonic probe to rotate at a uniform speed, can respond quickly and stabilize the speed, and will not have large-scale motor speed oscillations, thereby improving the user experience.

[0088] Moreover, the above control method can realize the matching of different resistances of ultrasonic endoscope motor driver. The incremental PID algorithm does not need to be accumulated. The determination of the control quantity increment is only related to the deviation values ​​of the last few times. The influence of the calculation deviation is small, and the impact on the system is relatively small. In addition, Figure 2 As shown, the incremental PID algorithm uses a 5ms sampling and control cycle, which can respond quickly and stabilize the speed without large motor speed oscillations.

[0089] Example 2

[0090] On the basis of Example 1, this embodiment further discloses a uniform speed rotation control system of an ultrasonic endoscope motor under different loads, which includes:

[0091] A load force identification and PID parameter matching module, which is provided with corresponding PID parameters for matching different load force intervals; the load force identification calculation is performed on the inserted ultrasonic probe, and the load force is allocated to the corresponding load force interval according to the load force size, and the corresponding PID parameters are matched;

[0092] Incremental PID algorithm adjustment module, which adjusts the speed using the incremental PID algorithm according to the matching PID parameters;

[0093] PID parameter adjustment module, which adjusts PID parameters according to speed oscillation during speed regulation;

[0094] The PWM duty cycle parameter compensation module performs the PWM duty cycle parameter compensation algorithm in advance to control and adjust the motor rotation when the ultrasonic probe has a large speed change or a large speed oscillation amplitude due to uneven friction during rotation.

[0095] Specifically, the load force identification and PID parameter matching modules are performed as follows:

[0096] The inserted ultrasonic probe is first read and calculated for load force, and the calculation results are distributed to different load force intervals that have been originally set, and each interval matches different P, I, and D coefficients. The P, I, and D coefficients of each different load force interval are originally carried out under a specific load, and analyzed under MATLAB. The motor motion speed waveform reaches the specific coefficient required by this experiment. The specific P, I, and D coefficients of each interval will be automatically modified and fine-tuned and recorded according to the rotation situation during the experiment.

[0097] For the inserted ultrasonic probe load (i.e., torque), the following formula (1) is used to calculate the load according to the relationship between the output PWM duty cycle, the actual measured current, and the actual speed:

[0098] LOAD = Ki * ((Kp*(PWM / AD)) / SPEED) (1)

[0099] In the formula, LOAD is the load value of this time, Ki is the constant for the relationship between load, speed and current, Kp is the constant for the relationship between PWM duty cycle and current value, PWM represents the PWM wave duty cycle, AD is the current value, and SPEED is the encoder feedback speed value; the Ki constant and Kp constant are obtained from the above-mentioned PID parameter setting experiment, and change with the influence of different structural layers and different drive motor properties.

[0100] The load force of the inserted rotating probe is calculated by the above formula. This scheme calculates continuously for 100 times at a time interval of 5ms after the driving motor is stable, removes the maximum and minimum values ​​of the 100 data, and then calculates the average and distributes it to the corresponding interval. This scheme sets a total of 10 load intervals, and the torque ranges of the 10 load intervals cover the upper and lower limits of the torque of all ultrasonic probes in this project.

[0101] The incremental PID algorithm adjustment module adopts the following steps:

[0102] The encoder data is sampled at 5ms intervals and converted into actual speed values. The actual speed value is compared with the target speed to obtain the speed difference E. The incremental PID algorithm speed adjustment is then performed. The adjustment formula is:

[0103] PWM=(PID_Kp* E(k))-(PID_Ki * E(k-1))+(PID_Kd * E(k-2)) (2)

[0104] Where, PWM and PWM wave duty cycle parameters, PID_Kp is the P coefficient in the PID algorithm, PID_Ki is the i coefficient in the PID algorithm, PID_Kd is the d coefficient in the PID algorithm, E(k) is the current error, E(k-1) is the previous error, and E(k-2) is the previous error;

[0105] The PWM duty cycle parameter calculated by the above formula is output to the motor driver chip for motor rotation speed regulation, thereby achieving closed-loop incremental PID control.

[0106] After achieving closed-loop incremental PID control, the speed value will be continuously collected for 300 cycles, and then the data will be analyzed to determine whether the coefficients of the three items P, I, and D that were originally matched can operate perfectly. The key points of the analysis are based on the overall oscillation of the speed and the maximum value of the deviation value of the speed after regulation to determine whether to proceed to the next step.

[0107] The PID parameter adjustment module adopts the following steps:

[0108] The coefficients of P, I, and D matched in the first stage will be fine-tuned. The unit of each fine-tuning is 0.05, and the fine-tuning value of each coefficient shall not exceed 0.1. After each round of debugging, 300 data will be collected again for analysis to determine whether the fine-tuning coefficient has been improved. Otherwise, fine-tuning will be performed in the opposite direction. In the third stage, the data will be confirmed after a maximum of 9 fine-tunings.

[0109] The PWM duty cycle parameter compensation module adopts the following steps:

[0110] The current speed and the current PWM duty cycle are sampled at 1ms intervals, and the relationship Q between the speed and the PWM duty cycle is calculated. When the motor rotates at a constant speed, the change in the relationship Q during one rotation of the motor driver should be roughly unchanged or have a small change amplitude. When there is uneven friction at a certain position during one rotation of the ultrasonic probe, the relationship Q will change significantly. If it is found that the relationship Q changes significantly or suddenly (the change amplitude is greater than 5%), the current position n and the current relationship Q are recorded. After multiple rounds of detection and calibration, it can be determined whether there is uneven friction at position n. When the motor rotates to the next circle and is about to reach the same position, the output PWM duty cycle is compensated in advance based on the relationship of the relationship Q, thereby achieving a smooth transition in speed.

[0111] The PWM duty cycle is calculated using the following formula (3):

[0112] PWM(n) = Ki * ((Q(n)-Q(n-1))* PWM(PID)) (3)

[0113] Where PWM(n) is the PWM duty cycle to be output when it reaches position n, Ki is a constant, Q(n) is the value of the relational quantity Q at position n, Q(n-1) is the value of the relational quantity Q at position n-1, and PWM(PID) is the PWM duty cycle output by the PID algorithm at position n.

[0114] Example 3

[0115] like Figure 3 As shown, an ultrasonic endoscope includes a motor and a motor control module, wherein the motor control module includes an IC control board, a motor drive chip, an encoder, an ADC sampling module, and a motor driver, wherein the motor driver is used to connect to an ultrasonic probe to drive the probe to move. The IC control board is electrically connected to the IC control board, the motor drive chip, and the encoder, the ADC sampling module is electrically connected to the motor drive chip, and the encoder and the motor drive chip are electrically connected to the motor driver. The IC control board includes a connected processor and a memory, wherein the processor is used to execute a computer program stored in the memory to execute the uniform speed rotation control method under different loads of the ultrasonic endoscope motor as described in Example 1 above. The IC control board communicates with the control unit of the ultrasonic endoscope and feeds back relevant information.

[0116] When in use, after the IC control board is powered on, it is initialized and configured, including the timer encoder interface of STM32, the timer with a 5ms time interval, PWM, ADC module, and probe identification switch. The physical structure layer of the encoder is connected to the motor. As the motor rotates, the encoder will generate three-phase pulses A, B, and Z. When the motor rotates one circle, the A and B phases will each generate 512 complete pulse waveforms, and the Z phase will generate 1 pulse waveform. By reading the number of encoder A, B, and Z three-phase pulses at the same interval, the speed and rotation direction of the motor can be determined (due to actual needs, this solution uses a 5ms time interval cycle for encoder data sampling). The ADC sampling module takes the current value output by the motor driver chip in real time and feeds it back to the IC control board. The IC control board records the magnitude and change of each current value.

[0117] After the initialization configuration of each module is completed, the IC control board controls the uniform speed rotation control method of the ultrasonic endoscope motor under different loads described in Example 1.

[0118] Furthermore, the communication data between the IC control board and the encoder is read using the timer encoder interface of the STM32, and the data is read stably and accurately. The IC control board drives the motor using a high-frequency PWM wave complementary form, making the control of the motor driver more delicate and stable. The encoder uses a model with a precision of 512 pulse outputs per circle, that is, it is subdivided into 512 physical intervals. The accuracy requirement meets the requirements of this solution. If the accuracy is reduced, it will affect the uniform speed control of the motor. Finally, since the ultrasonic probe is driven by the motor driver to rotate to form a 360-degree image, the uniform rotation can make the ultrasonic imaging effect more delicate.

[0119] The present invention also discloses a computer-readable storage medium, which includes a computer program. When the computer program runs on a computer, it executes the uniform speed rotation control method under different loads of the ultrasonic endoscope motor as described in Example 1.

[0120] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A method for controlling uniform rotation of an ultrasonic endoscope motor under different loads, characterized in that: It includes: Step S1, conducting experiments in advance to match corresponding PID parameters according to different load force intervals; The inserted ultrasonic probe is subjected to load force identification and calculation, and is assigned to a corresponding load force interval according to the load force, and the corresponding PID parameters are matched; Step S2, adjusting the speed using an incremental PID algorithm according to the matched PID parameters; Step S3, adjusting PID parameters according to speed oscillation during speed regulation; Step S4, when the speed oscillation amplitude caused by uneven friction during the rotation of the ultrasonic probe exceeds a set ratio, a PWM duty cycle parameter compensation algorithm is performed in advance to control and adjust the rotation of the motor; In step S3, the speed values ​​of multiple cycles are continuously collected, and then data analysis is performed to determine whether the coefficients of the three items P, I, and D matched in step S1 can control the uniform rotation of the ultrasonic motor in step S2. If not, the coefficients of the three items P, I, and D matched in step S1 are fine-tuned. After each round of debugging, multiple data are collected again for analysis to determine whether the fine-tuning coefficients need to be improved.

2. The method for controlling the uniform rotation of an ultrasonic endoscope motor under different loads according to claim 1, characterized in that: In step S1, the load force identification calculation is calculated using the following formula (2): LOAD = Ki * ((Kp*(PWM / AD)) / SPEED) (2) Among them, LOAD is the current load value, Ki is the constant of the relationship between load, speed and current, Kp is the constant of the relationship between PWM duty cycle and current value, PWM represents the PWM wave duty cycle, AD is the current value, and SPEED is the encoder feedback speed value; wherein the Ki constant and the Kp constant are obtained from the experiment of matching the corresponding PID parameters according to different load force intervals in step S1; The method for setting the load force interval is: after the driving motor is stable, the load force is continuously calculated and accumulated for multiple times at a set time interval, and then different load force intervals are set after statistical calculation; In step S2, the incremental PID algorithm adjustment includes: sampling encoder data at a set time interval and converting it into an actual speed value, comparing the actual speed value with the target speed to obtain a speed difference E, calculating a PWM wave duty cycle parameter according to the following formula (1) based on the matched PID parameter, and outputting the obtained PWM duty cycle parameter to the motor drive chip to adjust the motor rotation speed; PWM=(PID_Kp* E(k))-(PID_Ki * E(k-1))+(PID_Kd * E(k-2)) (1) Among them, PWM is the PWM wave duty cycle parameter, PID_Kp is the P coefficient in the PID algorithm, PID_Ki is the I coefficient in the PID algorithm, PID_Kd is the D coefficient in the PID algorithm, E(k) is the current speed difference, E(k-1) is the previous speed difference, and E(k-2) is the previous speed difference.

3. The method for controlling uniform rotation of an ultrasonic endoscope motor under different loads according to claim 1, characterized in that: In step S4, the PWM duty cycle parameter compensation algorithm includes: The current speed and the current PWM duty cycle are sampled regularly at the set time interval, and the relationship Q between the speed and the PWM duty cycle is calculated. If the change of the relationship Q exceeds the set value of Q change, the current position n and the current relationship Q are recorded. After multiple rounds of detection and calibration, it is determined whether there is uneven friction at position n. Before the motor rotates to the same position next time, the algorithm compensation for the PWM duty cycle parameter to be output is made in advance based on the relationship of the relationship Q. In the PWM duty cycle parameter compensation algorithm, the following formula (3) is used to calculate the current PWM duty cycle; PWM(n) = Ki * ((Q(n)-Q(n-1))* PWM(PID)) (3) Where PWM(n) is the PWM duty cycle to be output when it reaches position n, Ki is a constant, Q(n) is the value of the relational quantity Q at position n, Q(n-1) is the value of the relational quantity Q at position n-1, and PWM(PID) is the PWM duty cycle output by the PID algorithm at position n.

4. A uniform speed rotation control system for an ultrasonic endoscope motor under different loads, characterized in that: It includes: A load force identification and PID parameter matching module, which is provided with different PID parameters matched according to different load force intervals; the load force identification calculation is performed on the inserted ultrasonic probe, and the load force is allocated to the corresponding load force interval according to the load force size, and the corresponding PID parameters are matched; The incremental PID algorithm adjustment module adjusts the speed according to the matching PID parameters; the PID parameter adjustment module adjusts the PID parameters according to the speed oscillation during the speed adjustment process; The PWM duty cycle parameter compensation module performs the PWM duty cycle parameter compensation algorithm in advance when the speed oscillation amplitude exceeds the set ratio due to uneven friction during the rotation of the ultrasonic probe, and controls and adjusts the motor rotation; The PID parameter adjustment module uses the following steps to adjust the PID parameters: Continuously collect speed values ​​for multiple cycles, and then perform data analysis to determine whether the matching coefficients of P, I, and D can enable the incremental PID algorithm adjustment module to control the uniform rotation of the ultrasonic motor. If not, fine-tune the matching coefficients of P, I, and D. After each round of debugging, re-collect data for multiple times for analysis to determine whether the fine-tuning coefficients need to be improved.

5. The uniform speed rotation control system of the ultrasonic endoscope motor under different loads according to claim 4, characterized in that: The load force identification and PID parameter matching module uses the following formula (2) to calculate the load force: LOAD = Ki * ((Kp*(PWM / AD)) / SPEED) (2) Among them, LOAD is the load value of this time, Ki is the constant of the relationship between load, speed and current, Kp is the constant of the relationship between PWM duty cycle and current value, PWM represents the PWM wave duty cycle, AD is the current value, and SPEED is the encoder feedback speed value; among them, Ki constant and Kp constant are obtained by matching the corresponding PID parameters according to different load force intervals in advance; The method for setting the load force interval is: after the driving motor is stable, the load force is continuously calculated and accumulated for multiple times at a set time interval, and then different load force intervals are set after statistical calculation; The incremental PID algorithm adjustment module adopts the following steps to adjust, sampling encoder data at a set time interval and converting it into an actual speed value, comparing the actual speed value with the target speed to obtain a speed difference E, and calculating the PWM wave duty cycle parameter according to the matching PID parameter according to the following formula (1), and the obtained PWM duty cycle parameter is output to the motor drive chip to adjust the motor rotation speed; PWM=(PID_Kp* E(k))-(PID_Ki * E(k-1))+(PID_Kd * E(k-2)) (1) Among them, PWM is the PWM wave duty cycle parameter, PID_Kp is the P coefficient in the PID algorithm, PID_Ki is the I coefficient in the PID algorithm, PID_Kd is the D coefficient in the PID algorithm, E(k) is the current speed difference, E(k-1) is the previous speed difference, and E(k-2) is the previous speed difference.

6. The uniform speed rotation control system of the ultrasonic endoscope motor under different loads according to claim 5, characterized in that: The PWM duty cycle parameter compensation module performs speed compensation using the following steps: The current speed and the current PWM duty cycle are sampled regularly at the set time interval, and the relationship Q between the speed and the PWM duty cycle is calculated. If the change of the relationship Q exceeds the set value of Q change, the current position n and the current relationship Q are recorded. After multiple rounds of detection and calibration, it is determined whether there is uneven friction at position n. Before the motor rotates to the same position next time, the algorithm compensation for the PWM duty cycle to be output is performed in advance based on the relationship of the relationship Q. The current PWM duty cycle is calculated using the following formula (3): PWM(n) = Ki * ((Q(n)-Q(n-1))* PWM(PID)) (3) Where PWM(n) is the PWM duty cycle to be output when it reaches position n, Ki is a constant, Q(n) is the value of the relational quantity Q at position n, Q(n-1) is the value of the relational quantity Q at position n-1, and PWM(PID) is the PWM duty cycle output by the PID algorithm at position n.

7. An ultrasonic endoscope, comprising a motor and a motor control module, wherein the motor control module comprises a connected processor and a memory, characterized in that: The processor is used to execute the computer program stored in the memory to execute the uniform speed rotation control method under different loads of the ultrasonic endoscope motor according to any one of claims 1 to 3.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a computer program, and when the computer program is run on a computer, it is used to execute the uniform speed rotation control method under different loads of the ultrasonic endoscope motor according to any one of claims 1 to 3.