Motor control method and device, medium and product
By obtaining stage information and adjusting the PID algorithm parameters, the problems of overshoot and jitter in DC motor drive are solved, achieving better control effects and noise reduction.
Patent Information
- Application Number
- CN202411250594.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2044-09-06
AI Technical Summary
The existing DC motor drive method cannot effectively eliminate overshoot and jitter, and is prone to oscillation and operating noise, and has poor control effect.
By obtaining the current stage information, adjusting parameters according to the PID algorithm, including proportional coefficients, integral coefficients and differential coefficients, especially in the start and end stages, to drive the DC motor operation, use the PWM signal to adjust the driving torque, and gradually increase or adjust the algorithm Parameters to eliminate overshoot and jitter.
It realizes variable speed movement of the DC motor, effectively eliminates overshoot and jitter, reduces oscillation and noise, and improves control effect.
Smart Images

Figure CN119109363A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of motor control technology, and more specifically, to a motor control method, device, medium and product. Background Art
[0002] DC motors are widely used in various mechanical fields, such as mixers, automobiles and other equipment. The action of DC motors drives various devices to move. During the movement of devices, it is often necessary to achieve precise motion point control through DC motors.
[0003] In the prior art, in order to achieve the motion point control, when the driving device moves toward the target point, the DC motor changes the movement direction of the device to drive the device to move toward the target point. This driving method is simple, but there are overshoot and jitter phenomena that cannot be eliminated, and it is also easy to cause oscillation, high operating noise, and poor control effect. Summary of the invention
[0004] The embodiments of the present application provide a motor control method, device, medium and product, which can solve the problem that the existing driving method cannot effectively eliminate overshoot and jitter, and is prone to oscillation, high operating noise and poor control effect. To achieve this purpose, the embodiments of the present application provide the following solutions.
[0005] According to one aspect of an embodiment of the present application, a motor control method is provided, which is used to drive a DC motor to move a target object, including:
[0006] In response to the driving instruction, obtaining current phase information, wherein the phase information includes any one of a startup phase, a normal phase, and a final phase;
[0007] If it is determined that the stage information meets the preset conditions, the parameters of the PID algorithm are adjusted according to the stage information to drive the DC motor to move, and the parameters include at least one of a proportional coefficient, an integral coefficient, and a differential coefficient. The preset conditions include that the stage information is the starting stage or the final stage of the movement of the target object.
[0008] In a possible implementation, the obtaining of current stage information includes:
[0009] Acquire stage determination information, and acquire current stage information according to the stage determination information, wherein the stage determination information includes at least one of the position of the target object, the distance between the position and the target position, the size of the proportional coefficient, the moving time, and the size of the differential value.
[0010] In a possible implementation, driving the DC motor to move includes:
[0011] The duty cycle of the PWM signal is determined according to the PID algorithm, and the driving torque of the DC motor is adjusted using the PWM signal.
[0012] In a possible implementation, the phase information is a startup phase, and adjusting the parameters of the PID algorithm according to the phase information includes:
[0013] If it is determined that the current position of the target object is different from the initial position, the proportional coefficient of the PID algorithm is gradually increased.
[0014] In a possible implementation, the method further includes:
[0015] If it is determined that the current position of the target object is the same as the initial position, the differential coefficient of the PID algorithm is determined to be zero.
[0016] In a possible implementation, the stage information is the final stage, and adjusting the parameters of the PID algorithm according to the stage information includes:
[0017] If it is determined that the differential value of the PID algorithm is zero, the proportional coefficient of the PID algorithm is gradually increased.
[0018] In a possible implementation, the step of gradually increasing the proportional coefficient of the PID algorithm includes:
[0019] The proportionality coefficient is determined by formula (1), which is:
[0020] Kp1=Kp_Adjust*t+Kp(1)
[0021] Among them, Kp1 is the current proportional coefficient, Kp_Adjust is the step value, Kp is the proportional coefficient corresponding to the normal stage, and t is the moving time of the target object.
[0022] According to one aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method described above.
[0023] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described above are implemented.
[0024] According to one aspect of an embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method described above are implemented.
[0025] The beneficial effects of the technical solution provided by the embodiment of the present application are:
[0026] The motor control method provided in the present application responds to the driving instruction and obtains the current stage information; if it is determined that the stage information meets the preset conditions, the parameters of the PID algorithm are adjusted according to the stage information to drive the DC motor to move. The embodiment of the present application controls the DC motor through the PID algorithm, which can realize the variable speed movement of the DC motor with good control effect, and adjusts the parameters of the algorithm at the start-up stage and the end stage of the movement of the target object, which can effectively eliminate overshoot and jitter, and is not prone to oscillation and high operating noise, with good control effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following is a brief introduction to the drawings required for use in describing the embodiments of the present application.
[0028] Figure 1 A flow chart of a motor control method provided in an embodiment of the present application;
[0029] Figure 2 It is a top view of the motor fader potentiometer;
[0030] Figure 3 It is the side view of the motor fader potentiometer;
[0031] Figure 4 A first running trajectory diagram of a target object during parameter debugging provided in an embodiment of the present application;
[0032] Figure 5 A second running trajectory diagram of the target object during the parameter debugging process provided in an embodiment of the present application;
[0033] Figure 6 A third running trajectory diagram of the target object during the parameter debugging process provided in an embodiment of the present application;
[0034] Figure 7 A fourth running trajectory diagram of the target object during the parameter debugging process provided in an embodiment of the present application;
[0035] Figure 8 A fifth running trajectory diagram of the target object during the parameter debugging process provided in an embodiment of the present application;
[0036] Fig. 9 A sixth running trajectory diagram of the target object during the parameter debugging process provided in an embodiment of the present application;
[0037] Fig.10 A seventh running trajectory diagram of the target object during the parameter debugging process provided in an embodiment of the present application;
[0038] Fig.11An eighth running trajectory diagram of the target object in the motor control method provided in an embodiment of the present application;
[0039] Fig.12 This is a structural diagram of the electronic device of this application.
[0040] Description of reference numerals:
[0041] 1. DC motor; 2. Bracket; 3. Belt; 4. Fader. DETAILED DESCRIPTION
[0042] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0043] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation of other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the present technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" indicates that it is implemented as "A", or is implemented as "A", or is implemented as "A and B".
[0044] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0045] The following describes several exemplary embodiments to illustrate the technical solutions of the embodiments of the present application and the technical effects produced by the technical solutions of the present application. It should be noted that the following embodiments can refer to, draw on or combine with each other, and the same terms, similar features and similar implementation steps in different embodiments will not be described repeatedly.
[0046] The motor control method, device, medium and product provided in this application are intended to solve at least one technical problem existing in the prior art.
[0047] A motor control method is provided in an embodiment of the present application, and the motor control method can be executed by a mobile phone, a computer, a cloud, or other terminals that can be used to drive a DC motor.
[0048] Optionally, the motor control method of the present application is used for a motor fader potentiometer, such as Figure 2 , Figure 3 As shown, the motor fader potentiometer includes a DC motor 1, a belt 3, a fader 4 and a bracket 2. The belt 3 is arranged on the top side of the bracket 2, and one end of the belt 3 is sleeved on the output end of the DC motor 1. The fader 4 is arranged on the inner side of the belt 3 and is movably connected to the belt 3. The DC motor 1 drives the fader 4 to move linearly through the belt 3. The movement of the fader 4 changes the resistance value of the motor fader potentiometer. Among them, the power supply end of the DC motor 1 is arranged at the bottom of the DC motor 1, and the pins for connecting the circuit in the motor fader potentiometer are arranged at the bottom of the bracket 2.
[0049] Optionally, the target object may be a fader 4 in a motor fader potentiometer, which may be arranged on a mixing console. The DC motor 1 drives the fader 4 to move automatically.
[0050] Optionally, the object executing the motor fader 4 control method of the present application may be a controller of the DC motor 1, or may be independent of the controller. The object is connected to the controller, and the controller drives the DC motor 1 to move according to the signal transmitted by the object.
[0051] Alternatively, if Figure 1-Figure 11 As shown, the motor control method includes:
[0052] S101: In response to a driving instruction, obtain current stage information.
[0053] Optionally, the driving instruction may be input by a user, or may be generated by the terminal according to received information or a currently executed operation. The user may input the driving instruction by voice input, touch screen click, mouse click, etc.
[0054] Optionally, the driving instruction may include at least one of information indicating the movement of the target object, such as a target position, a moving trajectory, and a moving speed.
[0055] Optionally, obtaining the current stage information includes: obtaining stage determination information, obtaining the current stage information according to the stage determination information, the stage determination information including at least one of the position of the target object, the distance between the position and the target position, the size of the proportional coefficient, the moving time, and the size of the differential value.
[0056] Optionally, the phase information includes any one of a startup phase, a regular phase, and a final phase.
[0057] Optionally, the magnitude of the driving signal of the DC motor 1 can be determined based on a PID algorithm, wherein the driving signal can be a PWM signal. Driving the DC motor 1 to move includes: determining a duty cycle of the PWM signal according to the PID algorithm, and adjusting the driving torque of the DC motor 1 using the PWM signal.
[0058] In one embodiment, the distance between the target object and the target position can be obtained. If the distance is greater than or equal to the first preset value, it is determined that the current stage is in the startup stage. It can also be determined whether the proportional coefficient is less than a preset threshold. If so, it is determined to be in the startup stage. The size of the preset threshold can be determined according to the moving speed limit of the target object or the maximum duty cycle of the PWM signal used to drive the DC motor 1. The time difference between the current time and the initial moving time of the target object can also be obtained. If the time difference is less than the preset time threshold, it is determined to be in the startup stage. When judging whether the current stage is the final stage, the differential value information related to the PID algorithm can be obtained. If it is determined that the differential value has been zero or the current differential value is zero according to the differential value information, it is determined to be in the final stage. It can also be determined that the current stage is in the final stage when the distance between the target object and the target position is less than or equal to the second preset value (the second preset value is less than the first preset value).
[0059] Optionally, different PID algorithms are used in different stages, and a corresponding PID algorithm is selected to drive the DC motor 1 according to the current stage.
[0060] Optionally, the current stage can also be detected based on the critical duty cycle of the PWM signal and the distance between the target object and the target position (if the duty cycle of the PWM signal is less than the critical duty cycle, and the distance is greater than a preset distance, it is determined that the current stage is the startup stage; if the duty cycle of the PWM signal is less than the critical duty cycle, and the distance is less than a preset distance, it is determined that the current stage is the end stage).
[0061] In one embodiment, the target object may be a clipper 4, which can be driven by a PWM signal to drive a DC motor 1 to move. The PWM signal has a critical duty cycle for the motor to move from rest to motion. The duty cycle varies with the driving voltage. When the duty cycle is less than the critical value, the DC motor 1 cannot rotate, and accordingly, the clipper 4 cannot move. Under a specified voltage, the critical value is a fixed value, and the measurement method is as follows:
[0062] ① Determine the accuracy of the PWM signal. Specifically, the accuracy can be 1 / 1000, that is, the value range of PWM is 0 to 1000;
[0063] ② Take the proportional coefficient Kp>0, the integral coefficient Ki=0, and the differential coefficient Kd=0 in the PID algorithm, so that the algorithm only has proportional control. At this time, there will be an irreversible steady-state error;
[0064] ③ Push fader 4 to the position where the AD sampling value is 0 (this position can be the leftmost or rightmost position of the moving track of fader 4, where the absolute position of fader 4 is 0), set the target position to 2000, set the value of Kp (gradually increase Kp each time the test is performed, the basic principle is to make fader 4 move and as close to the target position as possible), run the PID algorithm, control the motor operation, and after fader 4 stops moving, obtain the position of fader 4, which can be represented by the AD value x, that is, calculate the critical duty cycle through formula (2)
[0065] Critical duty cycle = ((2000-x)*Kp) / 1000 (2)
[0066] If x=1426, Kp=0.7, then PWM=((2000-1462)*0.7) / 1000=0.3766, that is, the critical duty cycle is 37.66%
[0067] Optionally, the values of the parameters in the PID algorithm can be determined by successive approximation. Specifically, the debugging method of the three parameters Kp, Ki, and Kd can be configured one by one according to the following steps:
[0068] ①, take Kp>0, Ki=0, Kd=0, gradually increase the value of Kp, and drive the DC motor 1 to work according to the value of Kp. The corresponding running trajectory is as follows Figure 4 , Figure 5 , Figure 6 As shown in the figure, the vertical axis in the running trajectory diagram represents the displacement of the target object (hereinafter represented by the fader 4), and the unit of the displacement can be expressed in v (the conversion standard between v and common length units can be set by yourself), and the horizontal axis represents the movement time of the target object, in ms. It can be seen from the running trajectory images that all three figures are in a steady-state error state, but Figure 6 Overshoot has occurred. When fader 4 moves, overshoot cannot occur. Figure 6 Not meeting the requirements; Figure 4 If the target position is too far away, Figure 5 Determine the value of the proportionality coefficient Kp.
[0069] ②. Keep the Kp value in ①, set Ki>0, Kd=0, and gradually increase Ki. The running trajectory of fader 4 is as follows: Figure 7 , Figure 8 , Fig. 9 As shown in the following figure, the vertical axis also represents the displacement of the target object, and the horizontal axis represents the movement time of the target object. After the PID algorithm adds Ki, the running track of fader 4 produces an obvious step state. This is the integral adjustment stage of the algorithm to eliminate the steady-state error. As Ki increases, the integral adjustment time will gradually shorten, but when it increases too much, it will appear Fig. 9According to the basic principle of short adjustment time and overshoot, based on Figure 8 Determine the value of the integration coefficient ki.
[0070] ③. After determining the values of Kp and Ki, set Kd>0 and gradually increase Kd. The running track of fader 4 is Figure 6 Towards Figure 7 The change is manifested as a shortened adjustment time of the integral. The value of kd can be determined according to the smoothness of the running track in the image (for example, when the smoothness meets the predetermined requirements, the kd value at this time is determined as the final value).
[0071] S102: If it is determined that the stage information meets the preset condition, the parameters of the PID algorithm are adjusted according to the stage information to drive the DC motor to operate.
[0072] Optionally, the parameter includes at least one of a proportional coefficient, an integral coefficient, and a differential coefficient, and the preset condition includes that the stage information is a start-up stage or an end stage of the movement of the target object.
[0073] Optionally, if it is determined that the stage information does not meet the preset conditions, the parameter value obtained in the above step can be determined as the parameter value of the PID algorithm, and the PID algorithm is used to control the operation of the DC motor 1 based on the parameter value.
[0074] Optionally, when the stage information does not meet the preset conditions, it is determined that the current stage is a normal stage, and the PID algorithm can use u(k)=k p e(k)+k i ∑ i=0 e(i)+k d [e(k)-e(k-1)] represents, where Kp is the proportional coefficient, u(k) is the control value obtained by calculation, specifically, u(k) can be expressed as the duty cycle value of the PWM signal corresponding to the DC motor 1, Ki is the integral coefficient, Kd is the differential coefficient, e(k) is the deviation value between the current position and the target position, e(k-1) is the previous deviation value, and e(i) is the integral value of the deviation accumulated to the current point.
[0075] In one embodiment, the deviation value e(k) takes the numerical dimension of AD conversion. Under 12-bit AD conversion accuracy, the numerical range is -4095 to +4095 (note that there are negative values because e(k) is the relative deviation between the actual position and the target position, so there are positive and negative values).
[0076] Optionally, in the normal stage, the execution frequency of the PID algorithm may be once every 1 ms, or may be multiple times every 1 ms. The specific execution frequency may be determined according to the position accuracy requirement of the target object when it moves.
[0077] Optionally, when it is detected that an overshoot occurs (i.e., when the sign of e(k) (or Error) changes), it is determined that the end stage is reached, and the differential value (i.e., [e(k) - e(k - 1)] is 0) and the integral value e(i) in the PID algorithm can be cleared. Mainly, the integral value e(i) needs to be cleared. Because before the overshoot occurs, the integral value e(i) has been accumulated for a long time and the value has become very large. Assuming that e(k) is positive before the overshoot, then e(i) is also positive. When the overshoot is about to occur, [e(k) - e(k - 1)] is very small, and the main form of the algorithm is u(k) = Kp * e(k) + Ki * e(i), and u(k) gets a positive value, which will drive the motor forward.
[0078] However, at the moment when the overshoot occurs, e(k) immediately becomes negative, and the algorithm form becomes u(k) = Ki * e(i) - Kp * |e(k)| (the integral value minus the absolute value of the deviation). If e(i) is not cleared and still remains a very large positive value, since e(k) is too small, the obtained u(k) will still be positive, which will drive the motor to continue moving forward, making the overshoot more and more obvious. This violates the actual logic because when the overshoot occurs, theoretically the motor should move backward to reduce the overshoot, that is, at the moment when the overshoot occurs, u(k) should become negative. To avoid overshoot, the method is to directly set e(i) = 0. Then, next, e(i) will accumulate in the negative direction with e(k), continuously driving the motor in the reverse direction to eliminate the overshoot. Therefore, at the moment when the overshoot occurs, the basic formula of the PID algorithm becomes u(k) = Kp * e(k) + Ki * 0 + Kd * 0 = Kp * e(k).
[0079] Optionally, during the startup stage, since the deviation e(k) is large, the product of Kp and e(k) is also very large, which will directly pull the duty cycle to 100%, resulting in a very large driving torque and severe vibration at the startup moment, and thus generating noise. Therefore, when the stage information is the startup stage, the parameters of the PID algorithm are adjusted according to the stage information, including: if it is determined that the position is different from the initial position, the proportional coefficient of the PID algorithm is gradually increased.
[0080] Optionally, the proportional coefficient can be gradually increased from zero to a predetermined proportional value. As the proportional coefficient gradually increases from 0, the PWM duty cycle will also increase from 0, and the driving torque of the motor will also increase gradually. In this way, the noise can be alleviated.
[0081] In one embodiment, the predetermined proportional value is Kp_Max. When Kp < Kp_Max, Kp will increase at a speed of Kp_Step. In this way, Kp will become a linear function of time t, and this linear function is Kp = Kp_Step * t, where t is the movement time and Kp_Step is the step value during the startup stage.
[0082] During the execution of the PID algorithm, Kp*e(k) as a whole is still a linear function of time t, that is, Kp*e(k)*t=Kp_Step*t*e(k)*t=Kp_Step*t2*e(k).
[0083] In this way, Kp becomes a quadratic function of Kp_Step versus time t (Kp starts from 0 and increases gradually with Kp_Step), and the control formula of the PID algorithm becomes
[0084] u(k)=Kp_Step*e(k)*t2+Ki*e(i)+Kd*[e(k)-e(k-1)]
[0085] Based on this control formula, the target object is controlled to move, and the resulting running trajectory curve is as follows: Fig.10 As shown in the figure, after the duty cycle of the PWM signal exceeds the critical value, the target object will start to move, and the duty cycle increases relatively evenly without sudden changes, so the noise also increases gradually without instantaneous high noise, which can greatly reduce the noise at startup.
[0086] Optionally, if it is determined that the current position of the target object is the same as the initial position, the differential coefficient of the PID algorithm is determined to be zero.
[0087] In one embodiment, when the motor is initially started, time t = 0, e(k-1) is 0, e(k)-e(k-1) = e(k), and e(i) has not yet started to accumulate, so e(i) = 0. At this time, the control formula becomes u(k) = Kp_Step*e(k)*t2+Ki*e(i)+Kd*[e(k)-e(k-1)]
[0088] =Kp_Step*e(k)*02+Ki*0+Kd*[e(k)-0]
[0089] =Kd*e(k)
[0090] If the value of e(k) is large, then u(k) will also be large, and the duty cycle may directly reach 100%. Therefore, at the moment of startup, e(k) cannot be used to calculate the duty cycle. Therefore, the formula at the moment of startup should be u(k)=Kp*e(k)+Ki*e(i), that is, [e(k)-e(k-1)]=0, then the above formula becomes
[0091] u(k)=Kp_Step*e(k)*t2+Ki*e(i)+Kd*[e(k)-e(k-1)]
[0092] =Kp_Step*e(k)*02+Ki*0+Kd*0
[0093] =0
[0094] Then, as time t increases, e(i) also increases cumulatively, u(k) also gradually increases, and the duty cycle gradually increases from 0, achieving a smooth starting process (i.e., soft start of the motor).
[0095] Optionally, by Fig.10 It can be seen that when the trajectory curve approaches the target position, there are multiple steps in the form of stairs, and each step lasts for a long time. After accumulation, the total adjustment time will be several times the movement time, which greatly increases the stabilization time of the target object, and also causes obvious jitter in the motion trajectory, which needs to be optimized to eliminate.
[0096] Optionally, at the end stage, the integral coefficient Ki may be directly increased to increase the product of Ki and e(i) so that the duty cycle of the PWM signal is greater than the critical duty cycle, thereby reducing the adjustment time.
[0097] Optionally, the proportional coefficient of the PID algorithm may also be adjusted. Specifically, when the current stage information is the final stage, the parameters of the PID algorithm are adjusted according to the stage information, including: if the differential value is determined to be zero, then the proportional coefficient of the PID algorithm is gradually increased. If the differential value is determined to be not zero, then the proportional coefficient is determined to be the proportional coefficient corresponding to the normal stage.
[0098] Gradually increasing the proportional coefficient of the PID algorithm includes: determining the proportional coefficient by formula (1), formula (1) is:
[0099] Kp1=Kp_Adjust*t+Kp(1)
[0100] Among them, Kp1 is the current proportional coefficient, Kp_Adjust is the step value, Kp is the previous proportional coefficient, and t is the moving time of the target object.
[0101] In one embodiment, when e(k)-e(k-1)=0, it is determined that the end stage has been reached, and the proportional coefficient is gradually increased, so that the proportional coefficient gradually increases in the form of a linear function. In this way, the product of the proportional coefficient and e(k) also gradually increases. Thereby indirectly increasing the duty cycle of the PWM signal so that its value is greater than the critical duty cycle; when e(k)-e(k-1)!=0, the current proportional coefficient can be restored to the proportional coefficient corresponding to the normal stage to avoid excessive duty cycle causing the slider 4 to continue to rush forward at high speed and form overshoot. Although this cannot reduce the number of steps, it can shorten the duration of each level. And because e(k) is small enough, the proportional coefficient can be adjusted over a wide range. The formula of the PID algorithm obtained by the above adjustment method is:
[0102] u(k)=Kp1*e(k)*t+Ki*e(i)+Kd*[e(k)-e(k-1)]
[0103] =(Kp_Adjust*t+Kp)*e(k)*t+Ki*e(i)+Kd*0
[0104] =Kp_Adjust*e(k)*t2+Kp*e(k)*t+Ki*e(i)
[0105] In this way, Kp also becomes a quadratic function of Kp_Adjust with respect to time t, which will increase faster with the passage of time, thereby accelerating the increase of u(k).
[0106] After adjustment, the running trajectory of the target object is as follows Fig.11 As shown in the figure, at the top of the curve, there is a continuous but not smooth broken line, which is the adjustment process of the integral. From the figure, it can be seen that the duration of each step is greatly shortened, and the overall running time is also greatly shortened.
[0107] The motor control method of the present application adopts the working principle of successive approximation. Compared with the existing reverse braking method of controlling the working of the motor, it can reduce the complexity of the motor control process (no need for back-and-forth forward and reverse control). In terms of hardware, ordinary fader materials can be used without giving too much consideration to the fader damping size. Even if the fader quality is slightly poor, better results can be achieved, thereby reducing equipment costs.
[0108] In an optional embodiment, an electronic device is provided, such as Fig.12 As shown, Fig.12 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0109] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0110] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0111] Memory 4003 can be ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or it can be EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disc, optical disk, digital versatile disc, Blu-ray disc, etc.), magnetic disk storage medium, other magnetic storage devices or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation here.
[0112] The memory 4003 is used to store the computer program for executing the embodiment of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the computer program stored in the memory 4003 to implement the steps shown in the above method embodiment.
[0113] Among them, the electronic device can be any electronic product that can interact with an object, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.
[0114] The electronic device may also include a network device and / or an object device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers for cloud computing.
[0115] The network where the electronic device is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), etc.
[0116] An embodiment of the present application provides a computer-readable storage medium, which includes a computer program. When the computer program is executed by a processor, the steps and corresponding contents of the aforementioned method embodiment can be implemented.
[0117] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps and corresponding contents of the aforementioned method embodiment can be implemented.
[0118] The terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that shown or described in the drawings.
[0119] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios of execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.
[0120] The above is only an optional implementation method for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.
Claims
1. A motor control method, characterized in that: A DC motor used to drive the target object to move, including: In response to the driving instruction, obtaining current phase information, wherein the phase information includes any one of a startup phase, a normal phase, and a final phase; If it is determined that the stage information meets the preset conditions, the parameters of the PID algorithm are adjusted according to the stage information to drive the DC motor to move, and the parameters include at least one of a proportional coefficient, an integral coefficient, and a differential coefficient. The preset conditions include that the stage information is the starting stage or the final stage of the movement of the target object.
2. The motor control method according to claim 1, characterized in that: The obtaining of the current stage information includes: Acquire stage determination information, and acquire current stage information according to the stage determination information, wherein the stage determination information includes at least one of the position of the target object, the distance between the position and the target position, the size of the proportional coefficient, the moving time, and the size of the differential value.
3. The motor control method according to claim 1, characterized in that: Driving the DC motor to move, comprising: The duty cycle of the PWM signal is determined according to the PID algorithm, and the driving torque of the DC motor is adjusted using the PWM signal.
4. The motor control method according to claim 1, characterized in that: The stage information is a startup stage, and the step of adjusting the parameters of the PID algorithm according to the stage information includes: If it is determined that the current position of the target object is different from the initial position, the proportional coefficient of the PID algorithm is gradually increased.
5. The motor control method according to claim 4, characterized in that: The method further comprises: If it is determined that the current position of the target object is the same as the initial position, the differential coefficient of the PID algorithm is determined to be zero.
6. The motor control method according to claim 1, characterized in that: The stage information is the final stage, and the adjusting the parameters of the PID algorithm according to the stage information includes: If it is determined that the differential value of the PID algorithm is zero, the proportional coefficient of the PID algorithm is gradually increased.
7. The motor control method according to claim 6, characterized in that: The step of gradually increasing the proportional coefficient of the PID algorithm comprises: The proportionality coefficient is determined by formula (1), which is: Kp1 = Kp_Adjust*t +Kp (1) Among them, Kp1 is the current proportional coefficient, Kp_Adjust is the step value, Kp is the proportional coefficient corresponding to the normal stage, and t is the moving time of the target object.
8. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Surgical system with amplitude and pulse width modulation adjustment
CN120265216A
Apparatus and method for control of an active front steering (AFS) system
US20090269043A1
Cited By
Motor control method and related equipment
CN121441183A
