Motor servo system control method based on deep reinforcement learning

The motor servo system control method through deep reinforcement learning uses the dual-delay deep deterministic policy gradient TD3 algorithm and multi-agent architecture to solve the limitations of traditional methods in multi-parameter collaborative optimization and automatic adjustment, achieving efficient and accurate Servo system control reduces labor costs and improves system stability.

CN118589950APending Publication Date: 2024-09-03ZHEJIANG UNIV
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410662558.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-27
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Traditional servo system control methods are difficult to meet the needs of complex and high-precision production environments. In particular, they have limitations in multi-parameter collaborative optimization and automatic adjustment, are inefficient and rely on manual intervention.

Method used

The motor servo system control method based on deep reinforcement learning is adopted, and the double-delay deep deterministic strategy gradient TD3 algorithm is used to realize automatic intelligent adjustment of parameters through multi-agent and multiple reward functions, and the control parameters are optimized to improve control accuracy and response speed.

Benefits of technology

It achieves fast, efficient and accurate tuning of multiple parameters of complex systems, reduces labor costs, and improves the stability and efficiency of the servo system in different production environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118589950A
    Figure CN118589950A
Patent Text Reader

Abstract

The invention discloses a motor servo system control method based on deep reinforcement learning. The method comprises the steps of collecting a motor state of a servo motor in real time; a to-be-set control parameter of a servo system and a specific double-delay depth deterministic strategy gradient TD3 algorithm are fused, then a motor state is input into the algorithm for training, the optimized to-be-set control parameter is synchronized to the servo system through the algorithm and then a servo motor is controlled, the servo motor outputs the motor state to the algorithm in real time to complete circulation, and the servo system is controlled. And outputting the set control parameters and inputting the control parameters into the servo system until the algorithm converges so as to control the servo motor. According to the method, automatic intelligent adjustment of the control parameters of the servo system can be achieved, manual intervention is reduced, efficiency is improved, the control precision and response speed of the servo system can be improved by optimizing the parameters, the adaptability of the servo system is enhanced, and the servo system can operate stably and efficiently under different production environments and working conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a motor servo system control method, and relates to the technical field of high-precision control of servo systems, and specifically to a motor servo system control method based on deep reinforcement learning. Background Art

[0002] As a key technology for precision control in modern manufacturing, the accuracy of parameter adjustment of servo systems directly affects the operating efficiency and stability of mechanical equipment and the processing quality of products. With the continuous development of intelligent manufacturing and efficient automation, higher requirements are placed on servo system control technology, especially in the automation and intelligence of adjusting control parameters. However, traditional parameter adjustment methods, such as manual adjustment based on experience and simple adaptive control strategies, have been difficult to meet the complex and high-precision production environment. Therefore, the development of new intelligent parameter adjustment technology is extremely important for improving production efficiency, ensuring product quality and reducing energy consumption.

[0003] At present, the research on servo system control parameter adjustment at home and abroad is mainly concentrated in several directions: including experience and manual adjustment, adaptive control, fuzzy logic control, classical optimization algorithms such as genetic algorithms, and preliminary machine learning methods. These methods can achieve certain results in specific application scenarios, but there are generally some problems. For example, experience and manual adjustment rely on the operator's knowledge and experience and are inefficient; adaptive control and fuzzy logic control are insufficient when dealing with complex and highly nonlinear systems; classical optimization algorithms and basic machine learning show certain limitations when dealing with multi-parameter collaborative optimization problems, especially in complex scenarios where multiple decision variables need to be adjusted simultaneously to achieve the optimal solution. Summary of the invention

[0004] In order to solve the problems existing in the background technology, the present invention provides a motor servo system control method based on deep reinforcement learning. The first method can realize the automatic intelligent adjustment of control parameters, reduce manual intervention, and improve the adjustment efficiency; the second method can optimize the control parameters through algorithms to improve the control accuracy and response speed of the servo system; the third method can enhance the adaptability of the servo system so that it can maintain stable and efficient operation in different production environments and working conditions.

[0005] The technical solution adopted by the present invention is:

[0006] The motor servo system control method based on deep reinforcement learning of the present invention comprises:

[0007] 1) Real-time acquisition of the motor status of the servo motor during operation.

[0008] 2) Construct a specific Twin Delayed Deep Deterministic policy gradient TD3 (Twin Delayed Deep Deterministic policy gradient) algorithm, fuse the control parameters to be adjusted of the servo system used to control the servo motor and the neural network parameters of the specific Twin Delayed Deep Deterministic Policy Gradient TD3 algorithm, and then input the motor state of the servo motor into the specific Twin Delayed Deep Deterministic Policy Gradient TD3 algorithm for training. The specific Twin Delayed Deep Deterministic Policy Gradient TD3 algorithm synchronizes the optimized control parameters to be adjusted to the servo system in real time to control the servo motor. The servo motor outputs the motor state to the specific Twin Delayed Deep Deterministic Policy Gradient TD3 algorithm in real time to complete the cycle until the specific Twin Delayed Deep Deterministic Policy Gradient TD3 algorithm converges, and finally outputs the adjusted control parameters and inputs them into the servo system. The servo system finally outputs a control signal to the servo motor for control, thereby realizing the control of the servo system.

[0009] In the step 2), the servo system of the servo motor includes a current loop, a speed loop and a position loop, and the reference position instruction θ of the servo motor ref First, the reference position command θ is obtained after the position command passes through the low-pass filtering link of the position loop. ref , the filtered reference position command θ ref The position error is obtained by subtracting the actual position signal θ1 output by the servo motor, and the filtered reference position command θ ref The position error is added to the output speed command ω after passing through the speed feedforward link and proportional control link of the position loop. ref , the speed command ω ref The filtered speed command ω is obtained by sequentially passing through the resonance notch filter and the speed loop speed command low-pass filter. ref The actual position signal θ1 output by the servo motor is successively derived and filtered through the speed feedback low-pass filter link of the speed loop to obtain the filtered actual speed signal ω1. ref The speed error is obtained by subtracting the filtered actual speed signal ω1, and the filtered speed command ω ref The obtained speed error is added through the acceleration feedforward link and proportional integral control link of the speed loop to output the q-axis reference current command I qref , the q-axis current command I qref and preset d-axis reference current command I dref After the current command low-pass filtering link of the current loop, the filtered q-axis reference current command I is obtained. qref and d-axis reference current command I dref , the filtered d-axis reference current command I drefand the actual current command I of the d-axis output by the servo motor d1 After the difference is made, the d-axis current error is obtained, and the filtered q-axis reference current command I qref and the actual current command I of the q-axis output by the servo motor q1 After the difference is made, the q-axis current error is obtained, and the d-axis current error and the q-axis current error are respectively output to the servo motor of the permanent magnet synchronous motor for control after passing through the proportional integral control link of the current loop.

[0010] In the step 2), the specific dual-delay deep deterministic policy gradient TD3 algorithm includes two agents, two reward functions and two experience replay pools, and the capacity of the two experience replay pools is the same; the actual position signal is processed by the first agent, the first reward function and the first experience replay pool, and the motor state includes the actual position and speed signal of the motor, and the actual speed signal is processed by the second agent, the second reward function and the second experience replay pool; the first agent includes a first value network and a first action Actor network connected in sequence, and the second agent includes a second value network and a second action Actor network connected in sequence; the first value network and the second value network are respectively divided into a non-target value network and a target value network, the non-target value network includes a non-target value module or two non-target value modules connected in sequence, and the target value network includes a target value module or two target value modules connected in sequence; the first action Actor network and the second action Actor network are respectively divided into a non-target action Actor network and a target action Actor network.

[0011] The control parameters to be adjusted for the servo system include the speed feedforward K vf , Position control gain K pp , acceleration feedforward K af , speed control gain K vp And speed control integral coefficient K vi , the first action Actor network incorporates the velocity feedforward K vf and position control gain K pp , the second action Actor network incorporates the acceleration feedforward K af , speed control gain K vp And speed control integral coefficient K vi .

[0012] The non-target value module and the target value module have the same structure, both including a state path, an action path and a common path. The state path includes a first feature input layer, a first fully connected layer, a first rectification layer and a second fully connected layer connected in sequence. The action path includes a second feature input layer and a third fully connected layer connected in sequence. The common path includes an addition layer, a second rectification layer and a fourth fully connected layer connected in sequence. The processed outputs of the state path and the action path are input into the common path together and finally output after processing.

[0013] The structure of the first action Actor network is dual-input and single-output with no hidden layer. The non-target action Actor network of the first action Actor network has the same structure as the target action Actor network, both of which include two neurons and an output layer. The reference position signal and the actual position signal of the servo motor are subtracted to obtain the position error. The differentiated reference position signal and the obtained position error are input into the two neurons respectively. The differentiated reference position signal and the speed feedforward K vf Multiply the position error and speed control gain K pp The two multiplication results are then input into the output layer together and added for final output.

[0014] The structure of the second action Actor network is three-input single-output and has no hidden layer. The non-target action Actor network of the second action Actor network has the same structure as the target action Actor network, both of which include three neurons and an output layer. The speed error is obtained by subtracting the reference speed signal and the actual speed signal of the servo motor. The reference speed signal after differentiation, the obtained speed error, and the integrated speed error are input into the three neurons respectively. The reference speed signal after differentiation and the acceleration feedforward K af Multiply the speed error and speed control gain K vp Multiply the integrated speed error and speed control integral coefficient K vi The three multiplication results are then input into the output layer together and added for the final output.

[0015] The first reward function is as follows:

[0016] R p_i =errPen p *e position (t) 2 <0

[0017] Among them, R p_i Represents the first reward value of the first reward Reward function; errPen p Indicates the preset negative position coefficient; e position(t) represents the position error after the difference between the reference position signal and the actual position signal at time t.

[0018] The second reward function is as follows:

[0019] R v_i =errPen v *e speed (t) 2 <0

[0020] Among them, R v_i Represents the second reward value of the second reward function; errPen v Indicates a preset negative speed coefficient; e speed (t) represents the speed error after the reference speed signal and the actual speed signal are subtracted at time t.

[0021] In step 2), for each agent, reward function and experience replay pool in the specific double-delayed deep deterministic policy gradient TD3 algorithm, the training process is as follows:

[0022] 2.1) Initialize the agent’s action Actor network, value network, and experience replay pool.

[0023] 2.2) The motor state S at the current time t t Input the non-target action Actor network, and the non-target action Actor network outputs the action A of the motor at the current time t t , A t =π t (S t β t )+ε,π t () represents the function expression of the non-target action Actor network, β t represents the network parameters of the non-target action Actor network at time t, ε represents the preset noise; the servo motor performs the action A at the current time t t , get the motor state S at time t+1 t+1 .

[0024] 2.3) The motor state S at the current time t t After inputting the reward function, the reward value R at the current time t is output. t .

[0025] 2.4) The motor state S at the current time t t 、Action A t , reward value R t And the motor state S at time t+1 t+1Constructed as the experience unit at the current time t (S t ,A t ,R t ,S t+1 ) and stored in an experience replay pool with a capacity of N, and steps 2.2)-2.4) are repeated at each moment within the preset time period T. If the experience replay pool is full, the earliest stored experience unit is discarded until the end.

[0026] 2.5) Randomly sample M experience units from the experience replay pool and input them into the non-target value network of the agent, M≤N. After processing, the non-target value network outputs the estimated target value y at the current time t t .

[0027] 2.6) The motor state S at time t+1 t+1 Input the target action Actor network, and the target action Actor network outputs the action A of the motor at time t+1 t+1 , the action A of the motor at time t+1 t+1 Input the target value into the Value network, and after processing, the target value network outputs the estimated target value y at time t+1 t+ 1.

[0028] 2.7) According to the reward value R at the current time t t 、Estimated target value y t And the estimated target value y at time t+1 t+1 , calculate the temporal difference error (TD Error), and then use the gradient descent method to delay the update of the network parameters of the non-target value Value network, so that the loss value of the non-target value Value network is reduced; according to the set update frequency of the non-target action Actor network, use the gradient ascent method to delay the update of the network parameters of the non-target action Actor network, so that the target value estimate output by the non-target action Actor network is increased.

[0029] 2.8) According to the update frequency of the target action Actor network and the target value Value network, the smoothing factor is used to update the network parameters of the target action Actor network and the target value Value network.

[0030] 2.9) Input the motor state S at time t+1 t+1 Repeat the same operations of steps 2.2)-2.8) until the network parameters of the non-target value network, non-target action Actor network, target action Actor network and target value network converge, and obtain the specific dual-delay deep deterministic policy gradient TD3 algorithm that has been trained.

[0031] In the step 2.5), when the motor state S at time t+1 t+1 When it is the final state of the motor, the non-target value Value network outputs the target value estimate y at the current time t t =R t ; When the motor state S at time t+1 t+1 If it is not the final state of the motor, the non-target value Value network outputs the target value estimate y at the current time t t as follows:

[0032] y t =R t +γ*min k (Q tk (S t+1 ,clip(π t (S t+1 θ t )+ε);φ tk ))

[0033] Where γ represents the preset discount factor; k represents the number of non-target value modules in the non-target value network, k = 1 or 2; Q tk () represents the function expression of the kth non-target value module at time t; clip() represents the range limit; ε represents random noise; φ tk Represents the network parameters of the kth non-target value module at time t.

[0034] In step 2.7), the loss function of the non-target value network is as follows:

[0035]

[0036] Among them, L k Represents the loss value of the loss function of the kth non-target value module in the non-target value network; Q k () represents the function expression of the kth non-target value module, φ k represents the network parameters of the kth non-target value module.

[0037] In the step 2.8), a smoothing factor is used to update the network parameters of the target action Actor network and the target value Value network.

[0038] The beneficial effects of the present invention are:

[0039] The present invention solves the problem of multi-parameter setting of complex systems. The motor exhibits the characteristics of a dual-inertia complex system when running under load. The method of the present invention can adjust multiple key parameters of the complex system online at the same time. Compared with the existing methods, it is easier to implement, the optimal value can be obtained more quickly, efficiently and accurately, and the actual control accuracy is higher.

[0040] The present invention adopts multiple agents and sets multiple reward functions. The present invention adopts a multi-agent training framework, divides multiple training units according to the characteristics of the required adjustment parameters, and each training unit is equipped with an agent. At the same time, multiple reward functions are set for the actions and control outputs of each agent to provide reasonable feedback. Simultaneous training of multiple agents effectively speeds up the convergence speed, shortens the training time, and improves the efficiency of obtaining the optimal parameters.

[0041] The novel parameter setting and acquisition method of the present invention sets the control parameters as network weights rather than network outputs during control parameter setting, which effectively reduces the number of network layers and neurons, speeds up training and facilitates the arrangement of control algorithms in embedded systems.

[0042] The present invention reduces labor costs, can realize automatic intelligent adjustment of control parameters, greatly improves the efficiency and effect of parameter adjustment, and the parameter adjustment process is completed by the intelligent agent through self-exploration, with less reliance on the experience and ability of engineers, thus reducing labor costs.

[0043] The parameters optimized by the present invention are highly robust, and various factors such as working condition changes and external interference are considered during the training of the intelligent agent. The optimized parameters can enable the servo system to maintain stable and efficient operation under different production environments and working conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a control block diagram of the motor servo system control method based on deep reinforcement learning of the present invention;

[0045] Figure 2 A flow chart of optimizing the control parameters of a motor servo system using the TD3 algorithm in the present invention;

[0046] Figure 3 is a value network structure diagram of the intelligent agent in the present invention;

[0047] Figure 4 The action network structure diagram of the first intelligent agent of the position loop of the present invention;

[0048] Figure 5 The action network structure diagram of the second intelligent agent of the speed loop of the present invention;

[0049] Figure 6 This is a training and testing result diagram of the first agent of the position loop of the present invention;

[0050] Figure 7 This is a diagram showing the training and testing results of the second agent of the speed loop of the present invention. DETAILED DESCRIPTION

[0051] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. The embodiments described below with reference to the accompanying drawings are exemplary and intended to be used to explain the present invention, but should not be understood as limiting the present invention.

[0052] like Figure 1 As shown, the motor servo system control method based on deep reinforcement learning of the present invention is specifically as follows:

[0053] 1) Real-time acquisition of the motor status of the servo motor during operation.

[0054] 2) Construct a specific double-delay deep deterministic policy gradient TD3 algorithm, fuse the control parameters to be adjusted of the servo system used to control the servo motor and the neural network parameters of the specific double-delay deep deterministic policy gradient TD3 algorithm, and then input the motor state of the servo motor into the specific double-delay deep deterministic policy gradient TD3 algorithm for training. The specific double-delay deep deterministic policy gradient TD3 algorithm synchronizes the optimized control parameters to be adjusted to the servo system in real time to control the servo motor. The servo motor outputs the motor state to the specific double-delay deep deterministic policy gradient TD3 algorithm in real time to complete the cycle until the specific double-delay deep deterministic policy gradient TD3 algorithm converges, and finally outputs the adjusted control parameters and inputs them into the servo system. The servo system finally outputs a control signal to the servo motor for control, thereby realizing the control of the servo system.

[0055] In step 2), the specific dual-delay deep deterministic policy gradient TD3 algorithm includes two agents, two reward functions and two experience replay pools, and the capacity of the two experience replay pools is the same; the actual position signal is processed by the first agent, the first reward function and the first experience replay pool, the motor state includes the actual position and speed signal of the motor, and the actual speed signal is processed by the second agent, the second reward function and the second experience replay pool; the first agent includes a first value network and a first action Actor network connected in sequence, and the second agent includes a second value network and a second action Actor network connected in sequence; the first value network and the second value network are respectively divided into a non-target value network and a target value network, the non-target value network includes a non-target value module or two non-target value modules connected in sequence, and the target value network includes a target value module or two target value modules connected in sequence; the first action Actor network and the second action Actor network are respectively divided into a non-target action Actor network and a target action Actor network.

[0056] The control parameters to be adjusted for the servo system include the speed feedforward K vf , Position control gain K pp , acceleration feedforward K af , speed control gain K vp And speed control integral coefficient K vi , the first action Actor network incorporates the velocity feedforward K vf and position control gain K pp , the second action Actor network incorporates the acceleration feedforward K af , speed control gain K vp And speed control integral coefficient K vi .

[0057] like Figure 1 As shown in the figure, it is the overall control block diagram of applying the TD3 algorithm to the parameter adjustment of the servo motor control system. The servo system of the servo motor includes the current loop, speed loop and position loop. The reference position command θ of the servo motor ref First, the reference position command θ is obtained after the position command passes through the low-pass filtering link of the position loop. ref , the filtered reference position command θ ref The position error is obtained by subtracting the actual position signal θ1 output by the servo motor, and the filtered reference position command θ ref The position error is added to the output speed command ω after passing through the speed feedforward link and proportional control link of the position loop. ref , the speed command ωref The filtered speed command ω is obtained by sequentially passing through the resonance notch filter and the speed loop speed command low-pass filter. ref The actual position signal θ1 output by the servo motor is successively derived and filtered through the speed feedback low-pass filter link of the speed loop to obtain the filtered actual speed signal ω1. ref The speed error is obtained by subtracting the filtered actual speed signal ω1, and the filtered speed command ω ref The obtained speed error is added through the acceleration feedforward link and proportional integral control link of the speed loop to output the q-axis reference current command I qref , the q-axis current command I qref and preset d-axis reference current command I dref After the current command low-pass filtering link of the current loop, the filtered q-axis reference current command I is obtained. qref and d-axis reference current command I dref , the filtered d-axis reference current command I dref and the actual current command I of the d-axis output by the servo motor d1 After the difference is made, the d-axis current error is obtained, and the filtered q-axis reference current command I qref and the actual current command I of the q-axis output by the servo motor q1 After the difference is made, the q-axis current error is obtained, and the d-axis current error and the q-axis current error are respectively output to the servo motor of the permanent magnet synchronous motor for control after passing through the proportional integral control link of the current loop. p It represents the time constant of the low-pass filter link of the position command, s represents the complex variable, T v Indicates the time constant of the speed command low-pass filter link, T c Indicates the time constant of the current command low-pass filter link, T vf Represents the time constant of the speed feedback low-pass filter, ω n Indicates the resonance suppression notch filter notch frequency.

[0058] like Figure 2 As shown, the experience replay pool size is the same for each agent, which is 10 6 ; The number of randomly sampled experience units M during updating is the same for each agent, which is 128.

[0059] The non-target value module and the target value module have the same structure, both including a state path, an action path and a common path. The state path includes a first feature input layer, a first fully connected layer, a first rectification layer and a second fully connected layer connected in sequence. The action path includes a second feature input layer and a third fully connected layer connected in sequence. The common path includes an addition layer, a second rectification layer and a fourth fully connected layer connected in sequence. The processed outputs of the state path and the action path are input into the common path together and finally output after processing.

[0060] The structure of the first action Actor network is dual-input and single-output with no hidden layer. The non-target action Actor network of the first action Actor network has the same structure as the target action Actor network, both of which include two neurons and an output layer. The reference position signal and the actual position signal of the servo motor are subtracted to obtain the position error. The differentiated reference position signal and the obtained position error are input into the two neurons respectively. The differentiated reference position signal and the speed feedforward K vf Multiply the position error and speed control gain K pp The two multiplication results are then input into the output layer together and added for final output.

[0061] The structure of the second action Actor network is three-input single-output and has no hidden layer. The non-target action Actor network of the second action Actor network has the same structure as the target action Actor network, both of which include three neurons and an output layer. The speed error is obtained by subtracting the reference speed signal and the actual speed signal of the servo motor. The reference speed signal after differentiation, the obtained speed error, and the integrated speed error are input into the three neurons respectively. The reference speed signal after differentiation and the acceleration feedforward K af Multiply the speed error and speed control gain K vp Multiply the integrated speed error and speed control integral coefficient K vi The three multiplication results are then input into the output layer together and added for the final output.

[0062] like Figure 3As shown in the figure, the structure of the value network is the same for each agent, including a state path, an action path and a common path. The state path includes, from top to bottom, a feature input layer stateInLyr, a fully connected layer fcS1 with a size of 16, a sigmoid rectifier layer and a fully connected layer fcS2 with an output size of 16. The action path includes, from top to bottom, a feature input layer actionInLyr and a fully connected layer fcA1 with an output size of 16. The state path and the action path input observation signals and action signals respectively. The common path connects the outputs of the state path and the action path. The common path includes, from top to bottom, an addition layer add, a sigmoid rectifier layer and a fully connected layer qvalOutLyr.

[0063] The two agents are respectively applied to the speed loop and position loop of the servo system. The first agent of the position loop can adjust the speed feedforward K vf and position control gain K pp Two parameters, the second agent of the velocity loop can adjust the acceleration feedforward K af , speed control gain K vp And speed control integral coefficient K vi Three parameters.

[0064] The sampling frequency of the agent is the same as the sampling frequency of the original PI controller to which it needs to be synchronized. For the first agent, it is the control frequency f of the position loop. position , for the second agent, is the control frequency f of the speed loop speed .

[0065] like Figure 4 As shown in , the action network structure of the first agent is dual-input and single-output, with no hidden layer. The reference position signal is connected to the first neuron after differentiation, and the actual position signal is connected to the second neuron after the difference between the reference position signal and the actual position signal. Figure 5 As shown in the figure, the action network structure of agent 2 is three-input and single-output, without hidden layers. The reference speed signal is connected to the first neuron after differentiation, the speed error is connected to the second neuron, and the speed error integral is connected to the third neuron. The sampling frequency of the agent is the same as the sampling frequency of the original controller to be synchronized with it. For agent 1 in the position loop, it is the position loop control frequency f position =5×10 -4 s, for agent 2 in the speed loop, is the speed loop control frequency f speed =2.5×10 -4 s.

[0066] The first reward function is as follows:

[0067] R p_i =errPen p *eposition (t) 2 <0

[0068] Among them, R p_i Represents the first reward value of the first reward Reward function; errPen p Indicates the preset negative position coefficient; e position (t) represents the position error after the difference between the reference position signal and the actual position signal at time t.

[0069] The second reward function is as follows:

[0070] R v_i =errPen v *e speed (t) 2 <0

[0071] Among them, R v_i Represents the second reward value of the second reward function; errPen v Indicates a preset negative speed coefficient; e speed (t) represents the speed error after the reference speed signal and the actual speed signal are subtracted at time t.

[0072] In step 2), for each agent, reward function, and experience replay pool in a specific double-delayed deep deterministic policy gradient TD3 algorithm, the training process is as follows:

[0073] 2.1) Initialize the agent’s action Actor network, value network, and experience replay pool.

[0074] 2.2) The motor state S at the current time t t Input the non-target action Actor network, and the non-target action Actor network outputs the action A of the motor at the current time t t , A t =π t (S t β t )+ε,π t () represents the function expression of the non-target action Actor network, β t represents the network parameters of the non-target action Actor network at time t, ε represents the preset noise; the servo motor performs the action A at the current time t t , get the motor state S at time t+1 t+1 .

[0075] 2.3) The motor state S at the current time t t After inputting the reward function, the reward value R at the current time t is output. t .

[0076] 2.4) The motor state S at the current time t t 、Action A t , reward value R t And the motor state S at time t+1 t+1 Constructed as the experience unit at the current time t (S t ,A t ,R t ,S t+1 ) and stored in an experience replay pool with a capacity of N, and steps 2.2)-2.4) are repeated at each moment within the preset time period T. If the experience replay pool is full, the earliest stored experience unit is discarded until the end.

[0077] 2.5) Randomly sample M experience units from the experience replay pool and input them into the non-target value network of the agent, M≤N. After processing, the non-target value network outputs the estimated target value y at the current time t t .

[0078] In step 2.5), when the motor state S at time t+1 t+1 When it is the final state of the motor, the non-target value Value network outputs the target value estimate y at the current time t t =R t ; When the motor state S at time t+1 t+1 If it is not the final state of the motor, the non-target value Value network outputs the target value estimate y at the current time t t as follows:

[0079] y t =R t +γ*min k (Q tk (S t+1 ,clip(π t (S t+1 θ t )+ε);φ tk ))

[0080] Where γ represents the preset discount factor; k represents the number of non-target value modules in the non-target value network, k = 1 or 2; Q tk () represents the function expression of the kth non-target value module at time t; clip() represents the range limit; ε represents random noise; φ tk Represents the network parameters of the kth non-target value module at time t.

[0081] 2.6) The motor state S at time t+1 t+1Input the target action Actor network, and the target action Actor network outputs the action A of the motor at time t+1 t+1 , the action A of the motor at time t+1 t+1 Input the target value into the Value network, and after processing, the target value network outputs the estimated target value y at time t+1 t+1 .

[0082] 2.7) According to the reward value R at the current time t t 、Estimated target value y t And the estimated target value y at time t+1 t+1 , calculate the temporal difference error (TD Error), and then use the gradient descent method to delay the update of the network parameters of the non-target value Value network, so that the loss value of the non-target value Value network is reduced; according to the set update frequency of the non-target action Actor network, use the gradient ascent method to delay the update of the network parameters of the non-target action Actor network, so that the target value estimate output by the non-target action Actor network is increased.

[0083] In step 2.7), the loss function of the non-target value network is as follows:

[0084]

[0085] Among them, L k Represents the loss value of the loss function of the kth non-target value module in the non-target value network; Q k () represents the function expression of the kth non-target value module, φ k represents the network parameters of the kth non-target value module.

[0086] 2.8) According to the update frequency of the target action Actor network and the target value Value network, the smoothing factor is used to update the network parameters of the target action Actor network and the target value Value network.

[0087] In step 2.8), the smoothing factor is used to update the network parameters of the target action Actor network and the target value Value network.

[0088] 2.9) Input the motor state S at time t+1 t+1 Repeat the same operations of steps 2.2)-2.8) until the network parameters of the non-target value network, non-target action Actor network, target action Actor network and target value network converge, and obtain the specific dual-delay deep deterministic policy gradient TD3 algorithm that has been trained.

[0089] The present invention conducts training tests on the above method by building a training environment simulating a permanent magnet synchronous motor servo control system, and randomly selects parameters near the parameters directly obtained by the preset empirical tuning formula as the initial parameters when the intelligent agent starts training.

[0090] like Figure 6 and Figure 7 The figure shows the training and testing results of the agents. During the training process, the average reward value that the two agents can obtain gradually increases. After about 400 training rounds, the reward values ​​that the two agents can obtain converge, and the average reward value is stable and close to 0 (the upper limit of the reward value that can be obtained is 0), indicating that a relatively ideal control result has been achieved.

[0091] The present invention is not limited to the above-mentioned embodiments. Any obvious improvement, substitution or deformation that can be made by those skilled in the art without departing from the essential content of the present invention belongs to the protection scope of the present invention.

Claims

1. A motor servo system control method based on deep reinforcement learning, It is characterized in that include: 1) Real-time acquisition of the motor status of the servo motor during operation; 2) Construct a specific double-delay deep deterministic policy gradient TD3 algorithm, fuse the control parameters to be adjusted of the servo system used to control the servo motor with the specific double-delay deep deterministic policy gradient TD3 algorithm, and then input the motor state of the servo motor into the specific double-delay deep deterministic policy gradient TD3 algorithm for training. The specific double-delay deep deterministic policy gradient TD3 algorithm synchronizes the optimized control parameters to be adjusted to the servo system in real time to control the servo motor. The servo motor outputs the motor state to the specific double-delay deep deterministic policy gradient TD3 algorithm in real time to complete the cycle until the specific double-delay deep deterministic policy gradient TD3 algorithm converges, and finally outputs the adjusted control parameters and inputs them into the servo system. The servo system finally outputs the control signal to the servo motor for control, thereby realizing the control of the servo system.

2. The motor servo system control method based on deep reinforcement learning according to claim 1, Features: In the step 2), the servo system of the servo motor includes a current loop, a speed loop and a position loop, and the reference position instruction θ of the servo motor ref First, the reference position command θ is obtained after the position command passes through the low-pass filtering link of the position loop. ref , the filtered reference position command θ ref and the actual position signal θ output by the servo motor 1 The position error is obtained by subtracting the reference position command θ ref The position error is added to the output speed command ω after passing through the speed feedforward link and proportional control link of the position loop. ref , the speed command ω ref The filtered speed command ω is obtained by sequentially passing through the resonance notch filter and the speed loop speed command low-pass filter. ref , the actual position signal θ output by the servo motor 1 The actual speed signal ω after filtering is obtained by derivative and speed feedback low-pass filtering of the speed loop. 1 , the filtered speed command ω ref And the filtered actual speed signal ω 1 After subtraction, the speed error is obtained, and the filtered speed command ω ref The obtained speed error is added through the acceleration feedforward link and proportional integral control link of the speed loop to output the q-axis reference current command I qref , the q-axis current command I qref and preset d-axis reference current command I dref After the current command low-pass filtering link of the current loop, the filtered q-axis reference current command I is obtained. qref and d-axis reference current command I dref , the filtered d-axis reference current command I dref and the actual current command I of the d-axis output by the servo motor d1 After the difference is made, the d-axis current error is obtained, and the filtered q-axis reference current command I qref and the actual current command I of the q-axis output by the servo motor q1 After the difference is made, the q-axis current error is obtained, and the d-axis current error and the q-axis current error are respectively output to the servo motor of the permanent magnet synchronous motor for control after passing through the proportional integral control link of the current loop.

3. The motor servo system control method based on deep reinforcement learning according to claim 1, Features: In the step 2), the specific dual-delay deep deterministic policy gradient TD3 algorithm includes two agents, two reward functions and two experience replay pools, and the two experience replay pools have the same capacity; the actual position signal is processed by the first agent, the first reward function and the first experience replay pool, and the motor state includes the actual position and speed signal of the motor, and the actual speed signal is processed by the second agent, the second reward function and the second experience replay pool; the first agent includes a first value network and a first action Actor network connected in sequence, and the second agent includes a second value network and a second action Actor network connected in sequence; the first value network and the second value network are respectively divided into a non-target value network and a target value network, the non-target value network includes a non-target value module or two non-target value modules connected in sequence, and the target value network includes a target value module or two target value modules connected in sequence; the first action Actor network and the second action Actor network are respectively divided into a non-target action Actor network and a target action Actor network; The control parameters to be adjusted for the servo system include the speed feedforward K vf , Position control gain K pp , acceleration feedforward K af , speed control gain K vp And speed control integral coefficient K vi , the first action Actor network incorporates the velocity feedforward K vf and position control gain K pp , the second action Actor network incorporates the acceleration feedforward K af , speed control gain K vp And speed control integral coefficient K vi .

4. The motor servo system control method based on deep reinforcement learning according to claim 3, Features: The non-target value module and the target value module have the same structure, both including a state path, an action path and a common path, the state path includes a first feature input layer, a first fully connected layer, a first rectification layer and a second fully connected layer connected in sequence, the action path includes a second feature input layer and a third fully connected layer connected in sequence, the common path includes an addition layer, a second rectification layer and a fourth fully connected layer connected in sequence, and the outputs processed by the state path and the action path are input into the common path together and finally output after processing; The non-target action Actor network of the first action Actor network has the same structure as the target action Actor network, both of which include two neurons and an output layer. The reference position signal and the actual position signal of the servo motor are subtracted to obtain the position error. The differentiated reference position signal and the obtained position error are input into the two neurons respectively. The differentiated reference position signal and the speed feedforward K vf Multiply the position error and speed control gain K pp Multiply, and the two multiplication results are input into the output layer together and added for final output; The non-target action Actor network of the second action Actor network has the same structure as the target action Actor network, both of which include three neurons and an output layer. The speed error is obtained by subtracting the reference speed signal and the actual speed signal of the servo motor. The reference speed signal after differentiation, the obtained speed error, and the integrated speed error are input into the three neurons respectively. The reference speed signal after differentiation and the acceleration feedforward K af Multiply the speed error and speed control gain K vp Multiply the integrated speed error and speed control integral coefficient K vi The three multiplication results are then input into the output layer together and added for the final output.

5. The motor servo system control method based on deep reinforcement learning according to claim 3, Features: The first reward function is as follows: R p_i =errPen p *e position (t) 2 <0 Among them, R p_i Represents the first reward value of the first reward Reward function; errPen p Indicates the preset negative position coefficient; e position (t) represents the position error after the difference between the reference position signal and the actual position signal at time t; The second reward function is as follows: R v_i =errPen v *e speed (t) 2 <0 Among them, R v_i Represents the second reward value of the second reward function; errPen v Indicates a preset negative speed coefficient; e speed (t) represents the speed error after the reference speed signal and the actual speed signal are subtracted at time t.

6. The motor servo system control method based on deep reinforcement learning according to claim 3, Features: In step 2), for each agent, reward function and experience replay pool in the specific double-delayed deep deterministic policy gradient TD3 algorithm, the training process is as follows: 2.1) Initialize the agent’s action Actor network, value network, and experience replay pool; 2.2) The motor state S at the current time t t Input the non-target action Actor network, and the non-target action Actor network outputs the action A of the motor at the current time t t , A t =π t (S t β t )+ε,π t () represents the function expression of the non-target action Actor network, β t represents the network parameters of the non-target action Actor network at time t, ε represents the preset noise; the servo motor performs the action A at the current time t t , get the motor state S at time t+1 t+1 ; 2.3) The motor state S at the current time t t After inputting the reward function, the reward value R at the current time t is output. t ; 2.4) The motor state S at the current time t t 、Action A t , reward value R t And the motor state S at time t+1 t+1 Constructed as the experience unit at the current time t (S t ,A t ,R t ,S t+1 ) and stored in the experience replay pool with a capacity of N, and repeating steps 2.2)-2.4) at each moment within the preset time period T. If the experience replay pool is full, the earliest stored experience unit is discarded until the end; 2.5) Randomly sample M experience units from the experience replay pool and input them into the non-target value network of the agent, M≤N. After processing, the non-target value network outputs the estimated target value y at the current time t t ; 2.6) The motor state S at time t+1 t+1 Input the target action Actor network, and the target action Actor network outputs the action A of the motor at time t+1 t+1 , the action A of the motor at time t+1 t+1 Input the target value into the Value network, and after processing, the target value network outputs the estimated target value y at time t+1 t +1; 2.7) According to the reward value R at the current time t t 、Estimated target value y t And the estimated target value y at time t+1 t+1 , calculate the temporal difference error, and then use the gradient descent method to delay the update of the network parameters of the non-target value Value network, so that the loss value of the non-target value Value network is reduced; use the gradient ascent method to delay the update of the network parameters of the non-target action Actor network, so that the target value estimate output by the non-target action Actor network is increased; 2.8) Use the smoothing factor to update the network parameters of the target action Actor network and the target value Value network; 2.9) Input the motor state S at time t+1 t+1 Repeat the same operations of steps 2.2)-2.8) until the network parameters of the non-target value network, non-target action Actor network, target action Actor network and target value network converge, and obtain the specific dual-delay deep deterministic policy gradient TD3 algorithm that has been trained.

7. The motor servo system control method based on deep reinforcement learning according to claim 6, Features: In the step 2.5), when the motor state S at time t+1 t+1 When it is the final state of the motor, the non-target value Value network outputs the target value estimate y at the current time t t =R t ; When the motor state S at time t+1 t+1 If it is not the final state of the motor, the non-target value Value network outputs the target value estimate y at the current time t t as follows: y t =R t +γ*min k (Q tk (S t+1 ,clip(p t (S t+1 ;θ t )+e);φ tk )) Where γ represents the preset discount factor; k represents the number of non-target value modules in the non-target value network, k = 1 or 2; Q tk () represents the kth non-target value module at time t; clip() represents range restriction; ε represents random noise; φ tk Represents the network parameters of the kth non-target value module at time t.

8. The motor servo system control method based on deep reinforcement learning according to claim 6, Features: In step 2.7), the loss function of the non-target value network is as follows: Among them, L k Represents the loss value of the loss function of the kth non-target value module in the non-target value network; Q k () represents the kth non-target value module, φ k represents the network parameters of the kth non-target value module.

9. The motor servo system control method based on deep reinforcement learning according to claim 6, Features: In the step 2.8), a smoothing factor is used to update the network parameters of the target action Actor network and the target value Value network.

Citation Information

Cited By

  • Adaptive single-joint servo PID control method and system based on deep reinforcement learning

    CN118795780A

  • Data setting method and system and computer readable storage medium

    CN120415214A

  • Intelligent optimization adjustment method for starting parameters of direct-drive motor

    CN120956143A

  • Motor driving method and device, computer equipment and storage medium

    CN121193154A