Magnetic suspension control method based on BP neural network
By using the BP neural network PID control method in the magnetic levitation motor and dynamically adjusting the control parameters, the problems of traditional manual debugging are solved, and higher control accuracy and stability are achieved.
Patent Information
- Application Number
- CN202510103948.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-02-28
AI Technical Summary
The parameter debugging of existing magnetic levitation motor controllers relies on manual debugging, which is inefficient and uncertain, making it difficult to ensure optimal control performance.
Using a magnetic levitation control method based on BP neural network, the PID controller of the BP neural network is established, and the forward network calculation and error back propagation are used to dynamically adjust the parameters of the PID controller.
It significantly improves the suspension stability of the magnetic levitation motor rotor, reduces manual commissioning time, reduces labor costs and operation complexity, and improves the system's response speed and control accuracy.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of magnetic suspension control methods, and more specifically, to a magnetic suspension control method based on a BP neural network. Background Art
[0002] The magnetic levitation motor uses magnetic force to stably suspend the rotor or shaft in the magnetic field of the stator. Because there is no mechanical contact between the rotor and the stator, it has the advantages of high speed, oil-free, energy saving, and low noise. It is gradually being widely used in high-end fields such as turbine machinery, vacuum cleaning, and flywheel energy storage. This unique feature of the magnetic levitation motor makes it show great application value in the industrial field, especially in scenarios requiring high precision, high efficiency, and low pollution, and it plays an irreplaceable role.
[0003] However, in the prior art, the controller parameters of the magnetic levitation motor often rely on manual debugging by engineers. Traditional debugging methods require engineers to conduct repeated experiments, which consumes a lot of manpower and time costs. At the same time, the quality of the debugging results is highly dependent on the professional experience and technical level of the engineers, resulting in a large uncertainty in the debugging effect of the controller parameters, and it is difficult to ensure that the best control performance is achieved every time. This method is not only inefficient, but may also affect the operating stability and response speed of the magnetic levitation motor due to poor parameters, thereby limiting its application in complex dynamic systems. Therefore, in response to the above technical problems, it is necessary to provide a magnetic levitation control method based on a BP neural network. Summary of the invention
[0004] The purpose of the present invention is to provide a magnetic suspension control method based on BP neural network to solve the above problems.
[0005] In order to achieve the above purpose, the technical solution provided by an embodiment of the present invention is as follows: A magnetic suspension control method based on BP neural network comprises the following steps: S1: Establish a BP neural network PID controller, where the BP neural network consists of an input layer, a hidden layer and an output layer; S2: According to the real-time data of the magnetic levitation motor operation, the target position signal, the actual position signal and the error signal are input into the BP neural network; S3: The output signal is obtained through forward network calculation. If there is a deviation between the output signal and the expected signal, the error is back-propagated and the weights of the neural network are corrected using the gradient descent method. S4: Adjust the proportional coefficient, integral coefficient and differential coefficient of the PID controller in real time to optimize the control parameters so that the rotor of the magnetic levitation motor can achieve stable suspension.
[0006] As a further improvement of the present invention, the BP neural network PID controller consists of two parts: a PID controller with adjustable parameters and a BP neural network, wherein: Input layer: Input signals include target position signal, actual position signal and error signal; The output of the jth node is: , in, The input layer The input signal received by each node; Hidden layer: The input and output of the i-th neuron are: ; ; Output layer: The input and output of the lth neuron are: ; ; in, The neurons in the input layer With hidden layer neurons The connection weight of The neurons in the hidden layer The connection weight with the input layer neuron l.
[0008] As a further improvement of the present invention, the activation function of the hidden layer neurons is a hyperbolic tangent function: .
[0009] As a further improvement of the present invention, the activation function of the output layer neuron is: , and according to the functions of different neurons in the output layer, they are multiplied by different weight coefficients, and according to the functions of different neurons in the output layer, they are multiplied by different weight coefficients.
[0010] As a further improvement of the present invention, the method adopts a position digital PID control algorithm, and the calculation formula of the control amount is: , in, is the sampling period, and are the errors at the current and previous moments respectively, is the output control quantity.
[0011] As a further improvement of the present invention, the number of neurons in the hidden layer of the BP neural network is determined by the following empirical formula: , in, is the number of neurons in the input layer, is the number of neurons in the output layer.
[0012] As a further improvement of the present invention, the connection weights of the input layer, hidden layer and output layer of the BP neural network are corrected by the gradient descent method, and the correction formula is: The connection weight between the input layer neuron j and the hidden layer neuron i The correction formula is: .
[0013] As a further improvement of the present invention, the connection weights of the hidden layer neuron i and the output layer neuron l are The correction formula is:
[0014] As a further improvement of the present invention, the initial weights of the BP neural network are random numbers, and the range is set according to actual needs.
[0015] As a further improvement of the present invention, the method implements the BP neural network PID control algorithm through the MATLAB / S-Function module, and writes the algorithm flow through the C language, which specifically includes the following steps: Initialize the weights, learning rate and inertia coefficient of the BP neural network; Calculate the forward propagation output of the neural network based on the system input signal; According to the output error, perform error back propagation and update the network weights; The parameters of the PID controller are adjusted to optimize the response speed and stability of the magnetic levitation system.
[0016] Compared with the prior art, the advantages of the present invention are: This scheme innovatively adopts the BP neural network PID control method, combines the BP neural network with the PID controller, and realizes the self-tuning of the control parameters through the real-time learning and adaptation of the dynamic characteristics of the magnetic levitation motor by the neural network. Specifically, the system can dynamically adjust the parameters of the input layer and hidden layer neurons according to the actual operation data of the magnetic levitation motor in different operating states and stages, and correct the control parameters of the output layer in real time. Through this optimization method, the suspension stability of the magnetic levitation motor rotor has been significantly improved. Compared with the traditional method, this scheme effectively reduces the time of manual debugging of controller parameters, greatly reduces the labor cost and operation complexity. At the same time, through the real-time optimization of the control parameters by the BP neural network, it can output better controller parameters, the debugging effect is more stable, and the response speed and control accuracy of the magnetic levitation system are significantly improved. On the whole, this scheme not only improves the adaptability and reliability of the magnetic levitation control system, but also enhances its operating performance under complex working conditions, providing important technical guarantees for the application promotion and performance optimization of magnetic levitation motors. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 This is a flow chart of the magnetic suspension control method of the present invention; Figure 2 This is a diagram of the BP neural network PID control system in the present invention; Figure 3 The figure is a flow chart of the BP neural network PID control algorithm of the magnetic suspension system in the present invention. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention; it is obvious that the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments, and all other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making creative work are within the scope of protection of the present invention.
[0019] Example: See also Figure 1-3 , a magnetic suspension control method based on BP neural network, comprising the following steps: S1: Establish a BP neural network PID controller, where the BP neural network consists of an input layer, a hidden layer and an output layer; S2: According to the real-time data of the magnetic levitation motor operation, the target position signal, the actual position signal and the error signal are input into the BP neural network; S3: The output signal is obtained through forward network calculation. If there is a deviation between the output signal and the expected signal, the error is back-propagated and the weights of the neural network are corrected using the gradient descent method. S4: Adjust the proportional coefficient, integral coefficient and differential coefficient of the PID controller in real time to optimize the control parameters so that the rotor of the magnetic levitation motor can achieve stable suspension.
[0020] Among them, the BP neural network PID control method is innovatively adopted, and the BP neural network is combined with the PID controller. The dynamic characteristics of the magnetic levitation motor are learned and adapted in real time through the neural network to realize the self-tuning of the control parameters. Specifically, the system can dynamically adjust the parameters of the input layer and hidden layer neurons according to the actual operation data of the magnetic levitation motor in different operating states and stages, and correct the control parameters of the output layer in real time. Through this optimization method, the suspension stability of the magnetic levitation motor rotor has been significantly improved. Compared with the traditional method, this scheme effectively reduces the time of manual debugging of controller parameters, greatly reduces the labor cost and operation complexity. At the same time, through the real-time optimization of the control parameters by the BP neural network, it can output better controller parameters, the debugging effect is more stable, and the response speed and control accuracy of the magnetic levitation system are significantly improved. On the whole, this scheme not only improves the adaptability and reliability of the magnetic levitation control system, but also enhances its operating performance under complex working conditions, providing important technical guarantees for the application promotion and performance optimization of magnetic levitation motors.
[0021] The BP neural network PID controller consists of two parts: a PID controller with adjustable parameters and a BP neural network, where: Input layer: Input signals include target position signal, actual position signal and error signal; The output of the jth node is: , in, The input layer The input signal received by each node; Hidden layer: The input and output of the i-th neuron are: ; ; Output layer: The input and output of the lth neuron are: ; ; in, The neurons in the input layer With hidden layer neurons The connection weight of The neurons in the hidden layer The connection weight with the input layer neuron l.
[0022] The input layer of the BP neural network receives external input signals, mainly including the target position signal, the actual position signal and the error signal, which respectively represent the target position expected by the system, the current actual position and the deviation between the two. Each node of the input layer transmits the input signal to the next layer, where The input layer This process is equivalent to inputting the key operating state parameters of the system into the BP neural network in a quantified form, which is convenient for subsequent calculation and processing.
[0023] As the middle layer of the BP neural network, the hidden layer performs nonlinear mapping on the input signal to extract the deep features of the input signal. Each neuron in the hidden layer receives a weighted signal from the input layer, where is the connection weight between the input layer and the hidden layer, is the output of the input layer, It is the activation function of the hidden layer. The activation function usually adopts the hyperbolic tangent function, which has good nonlinear mapping ability, enabling the network to learn complex input and output relationships.
[0024] The output layer generates the proportional coefficient of the PID controller based on the output of the hidden layer. , integral coefficient and the differential coefficient , thereby realizing dynamic adjustment of control parameters, where is the connection weight between the hidden layer and the output layer, is the output of the hidden layer, is the activation function of the output layer, and different weight coefficients are multiplied according to the function of each neuron to ensure the output Meet control needs.
[0025] Different from the traditional PID control algorithm, the BP neural network PID controller can dynamically adjust the PID control parameters according to the real-time operating data of the magnetic suspension system (such as position deviation, speed, etc.) through forward propagation and error back propagation mechanism. , effectively solving the problem that traditional PID algorithm cannot cope with changes in system parameters.
[0026] BP neural network relies on the nonlinear mapping ability of its hidden layer to effectively deal with the nonlinear, strong coupling and dynamic characteristics problems existing in the magnetic levitation system. Through the nonlinear transformation of the activation function, the network can learn complex input-output relationships, thereby achieving more precise control.
[0027] Traditional PID control parameters need to be repeatedly debugged manually, while the BP neural network PID controller can automatically train and adjust parameters, greatly reducing the time and labor cost of manual debugging, while improving the stability and accuracy of the control system.
[0028] The BP neural network continuously updates the connection weights and optimizes the output of the controller, so that the magnetic levitation motor rotor can quickly achieve stable suspension. The network has a short training time and fast convergence speed, which significantly improves the system's response speed and control accuracy.
[0029] The activation function of the hidden layer neurons is the hyperbolic tangent function: .
[0030] The activation function of the output layer neurons is: , and according to the functions of different neurons in the output layer, they are multiplied by different weight coefficients, and according to the functions of different neurons in the output layer, they are multiplied by different weight coefficients.
[0031] Among them, the activation function used in the hidden layer is the hyperbolic tangent function (tanh), and its mathematical expression is: ;
[0032] The hyperbolic tangent function is a commonly used nonlinear activation function with an output range of (-1, 1) and central symmetry. Compared with the Sigmoid function (output range is (0, 1)), the tanh function has a wider output value range and can better enhance the nonlinear expression ability of the network.
[0033] In the hidden layer, the use of the tanh function can map the input signal to a nonlinear output, allowing the neural network to learn more complex relationships between input and output. Especially in the magnetic levitation system, the nonlinear characteristics are significant, and the application of the tanh function can effectively deal with the nonlinear problems of the system.
[0034] The output layer uses the Sigmoid function as the activation function, and its mathematical expression is: ;
[0035] The output range of the Sigmoid function is (0,1), which is suitable for processing normalized data, and the output value is continuous and smooth. In the output layer, the use of the Sigmoid function can map the output of the hidden layer to a value suitable for the control parameter range (such as the proportional, integral and differential coefficients of the PID controller). This normalization processing method can avoid the output value being too large or too small and enhance the stability of the control system.
[0036] In the neural network results of the output layer, the output values are multiplied by different weight coefficients according to the functional requirements of different neurons. Specifically: each output neuron represents (proportional coefficient), (integral coefficient) and (differential coefficient); by introducing the weight coefficient, the output results are further functionally differentiated and corrected, so that the PID control parameters can be more accurately adapted to the control requirements of the magnetic levitation system.
[0037] The nonlinear characteristics of the hyperbolic tangent function enable the hidden layer to effectively extract deep features from the input signal, thereby enhancing the ability of the neural network to handle complex problems. Compared with the Sigmoid function, the output range of tanh is (-1,1), and its output mean is close to 0, which alleviates the gradient vanishing problem and speeds up the convergence of network training. In the magnetic levitation system, due to the existence of complex characteristics such as nonlinearity and strong coupling, the use of tanh activation function in the hidden layer can better adapt to these characteristics and improve control accuracy.
[0038] The output range of the Sigmoid function is (0,1), which can normalize the output of the hidden layer to ensure that the control parameters fluctuate within an appropriate range and prevent excessive PID parameter adjustments. At the same time, the smoothness of the Sigmoid function makes the output value change more gentle, which helps to improve the stability of the control system and avoid system oscillation due to excessive output values.
[0039] The introduction of weight coefficients enables the output layer neurons to adjust the output values according to functional requirements, ensuring that each parameter The dynamic adjustment is more accurate, and different weight coefficients can be adjusted according to specific control objectives, thereby enhancing the flexibility and adaptability of the control method.
[0040] The method adopts the position digital PID control algorithm, and the calculation formula of the control quantity is:
[0041] in, is the sampling period, are the errors at the current and previous moments respectively, is the output control quantity.
[0042] Proportional Control : It is proportional to the error at the current moment. By directly amplifying the error signal at each sampling moment, it can quickly respond to the deviation of the system. (Proportional coefficient) determines the system's response speed to errors, The larger the value, the faster the response, but may introduce overshoot or oscillation.
[0043] Integral Control Term : It is the cumulative sum of the error signal, which can eliminate the steady-state error of the system and ensure that the output value can approach the target value. The integral coefficient Control the strength of the integral effect. If it is too large, the controller will overshoot; if it is too small, the steady-state error cannot be effectively eliminated.
[0044] Derivative Control Term : reflects the rate of change of the error and plays a predictive role. By suppressing the trend of error change, it can effectively reduce the overshoot and oscillation of the system. The differential coefficient It determines the strength of the differential effect. If it is too large, noise will be introduced; if it is too small, oscillation cannot be effectively suppressed.
[0045] in the formula The control quantity at the current moment is calculated relative to the position value of a fixed reference point, so it is called a "position-type" PID control algorithm. Each calculation directly superimposes the proportional, integral and differential control quantities without relying on the control quantity at the previous moment.
[0046] The position PID control algorithm can comprehensively consider the current error (proportional control), historical error accumulation (integral control) and error change trend (differential control), thereby achieving precise control of the magnetic levitation system. Especially in the magnetic levitation system, since the suspension of the rotor needs to maintain a stable balance, the PID control algorithm can adjust the output in real time to ensure that the system responds quickly and has no steady-state deviation.
[0047] Dynamically adjust the proportional, integral and differential coefficients of PID through BP neural network , which can further improve the adaptability of the controller, enabling it to cope with complex working conditions such as system parameter changes and external disturbances. The proportional control term can respond to errors quickly, the differential control term can suppress overshoot, and the integral control term can eliminate steady-state errors. The combination of the three can significantly improve the dynamic response speed of the system.
[0048] The differential action of the PID controller suppresses the oscillation trend of the system, while the integral action eliminates the steady-state error. Combined with the learning ability of the BP neural network, the stability of the system can be further improved. The position PID control algorithm has a simple structure and a unified formula form, which is convenient for engineering implementation and parameter setting. At the same time, the adaptive adjustment of the BP neural network reduces the workload of manual debugging.
[0049] The position digital PID control algorithm can achieve high-precision dynamic control of the magnetic suspension system by combining the three control functions of proportion, integration and differentiation. Combined with the real-time optimization adjustment of PID parameters by BP neural network, this method significantly enhances the response speed, control accuracy and stability of the system, and can effectively cope with complex working conditions such as nonlinearity and strong coupling in the magnetic suspension system, which has important engineering value and application prospects.
[0050] The number of neurons in the hidden layer of the BP neural network is determined by the following empirical formula:
[0051] in, is the number of neurons in the input layer, is the number of neurons in the output layer.
[0052] Among them, this formula is based on the empirical design rules of the BP neural network, combining the number of neurons in the input layer and output layer with the complexity of the actual problem, to make a reasonable estimate of the number of neurons in the hidden layer.
[0053] In practical applications, the choice of the number of neurons in the hidden layer needs to strike a balance between learning ability (network complexity) and overfitting risk (model generalization ability).
[0054] It represents the product of the number of neurons in the input layer n and the number of neurons in the output layer m. It is related to the input and output dimensions of the network and reflects the hidden layer's requirement for nonlinear mapping capabilities between input and output features.
[0055] Represents the square of the number of neurons in the output layer, which is mainly used to enhance the network's ability to fit complex relationships in the output layer.
[0056] Represents the linear ratio of the number of neurons in the input layer, reflecting the hidden layer's demand for input feature extraction.
[0057] Represents the linear ratio of the number of neurons in the output layer, further adjusting the support of the hidden layer to the output layer.
[0058] The number of neurons in the hidden layer directly determines the nonlinear fitting ability of the BP neural network. By calculating the number of neurons in the hidden layer through an empirical formula, a balance can be achieved between model complexity and computational overhead, avoiding underfitting problems caused by too few neurons in the hidden layer and overfitting problems caused by too many neurons.
[0059] The magnetic levitation system is a typical nonlinear, strongly coupled system with a complex input-output relationship. The formula combines the influence of the number of neurons in the input layer and the output layer. The number of neurons in the hidden layer can dynamically adapt to the nonlinearity of the system and improve the control accuracy of the network.
[0060] In traditional neural network design, the number of neurons in the hidden layer often needs to be determined through repeated experiments and parameter adjustment. The use of empirical formulas can quickly estimate the number of neurons that meet control requirements, reducing the debugging workload and improving design efficiency.
[0061] The empirical formula provides a scientific basis for the design of the number of neurons in the hidden layer of the BP neural network by comprehensively considering the number of neurons in the input layer, the number of neurons in the output layer and their nonlinear relationship. This method not only effectively improves the nonlinear fitting and generalization capabilities of the network, but also reduces the design and debugging costs in actual engineering. For complex nonlinear systems such as magnetic levitation systems, this design method can significantly optimize the control performance and provide an important guarantee for achieving high-precision dynamic control.
[0062] The connection weights of the input layer, hidden layer and output layer of the BP neural network are corrected by the gradient descent method, and the correction formula is: The connection weight between input layer neuron j and hidden layer neuron i The correction formula is: .
[0063] The connection weight between hidden layer neuron i and output layer neuron l The correction formula is: .
[0064] : The connection weight between input layer neuron j and hidden layer neuron i The correction amount in the kth iteration; : Learning rate, controlling the step size of weight correction; : Error signal of hidden layer neuron i; : The output value of neuron j in the input layer.
[0065] in, The connection weight between hidden layer neuron i and output layer neuron l The correction amount in the kth iteration; : Error signal of neuron l in the output layer; : The output value of neuron i in the hidden layer.
[0066] Gradient descent is a commonly used optimization algorithm used to minimize loss functions (such as mean square error). In BP neural networks, each iteration continuously adjusts the connection weights of the network to gradually reduce the error, thereby improving the prediction accuracy of the network. According to the partial derivative of the loss function with respect to the weight, the weight is updated in the opposite direction of the gradient until the loss function converges to a minimum value.
[0067] The gradient descent method combined with the error back propagation mechanism enables the BP neural network to automatically adjust the connection weights of the input layer, hidden layer and output layer, thereby continuously optimizing the network performance. This self-learning ability enables the network to adapt to complex nonlinear systems, such as magnetic levitation control systems.
[0068] In each iteration, the correction of weights makes the loss function value gradually approach the minimum, thereby reducing the error between the network output value and the target value, and significantly improving the accuracy and stability of the control system.
[0069] The weight correction formula of the input layer and the hidden layer ensures that the network can fully extract the input features and perform nonlinear mapping. The weight correction formula of the hidden layer and the output layer ensures that the network can map the features to the appropriate output, thereby optimizing the PID parameters such as To adapt to different control requirements.
[0070] By correcting the connection weights between the input layer, hidden layer and output layer through the gradient descent method, the BP neural network achieves a gradual reduction in error and an improvement in control accuracy. This weight correction mechanism enables the network to have strong self-learning and adaptive capabilities, can efficiently handle complex nonlinear problems in magnetic levitation control systems, and optimize the parameter adjustment process of the PID controller, thereby significantly improving the system's response speed, stability and control accuracy, and has important engineering application value.
[0071] The initial weights of the BP neural network are random numbers, and the range is set according to actual needs.
[0072] Among them, the initial weights are the initial values of the weight matrix connecting the input layer, hidden layer and output layer at the beginning of the BP neural network training. During the iterative process of network training, these weights are continuously corrected through the gradient descent algorithm to reduce the output error and optimize the network performance.
[0073] The initial weights are usually set to small random numbers (for example, random values that follow a uniform distribution or a normal distribution) to break the symmetry between neurons and ensure that each neuron can learn different features during training. The randomized initial weights can avoid the phenomenon of completely synchronized parameter updates during training when all initial weights are equal, thereby improving the network's learning ability.
[0074] The range of initial weights is usually set according to actual needs, usually to smaller values (such as [-0.1, 0.1] or [-1, 1]) to prevent the initial weights from being too large, causing the network activation function to enter the saturation region, thereby causing the gradient vanishing problem.
[0075] If the activation function of the hidden layer or output layer is Sigmoid or tanh function, the initial weight range should be smaller (such as [-0.5, 0.5]) to ensure that the input value of the activation function is in the non-saturated area and enhance the convergence efficiency of the network.
[0076] The initial weights of the BP neural network lay a good foundation for network training through randomization and range restriction. Randomized initial weights can break the symmetry of neurons and improve training efficiency. Reasonable range setting avoids the problem of gradient disappearance or explosion and enhances the stability and generalization ability of the network. In the magnetic levitation system, this initial weight setting method can help the network quickly adapt to the characteristics of complex nonlinear systems, providing an important guarantee for achieving high-precision dynamic control.
[0077] Methods The BP neural network PID control algorithm was implemented through the MATLAB / S-Function module, and the algorithm flow was written in C language, which specifically included the following steps: Initialize the weights, learning rate and inertia coefficient of the BP neural network; Calculate the forward propagation output of the neural network based on the system input signal; According to the output error, perform error back propagation and update the network weights; The parameters of the PID controller are adjusted to optimize the response speed and stability of the magnetic levitation system.
[0078] Among them, the weights, learning rate and inertia coefficient of initializing the BP neural network are specifically: According to the random number initialization method, the connection weights of each layer of the BP neural network are assigned values, and the range is usually set to a smaller value (such as [-0.5, 0.5]) to break the symmetry of the network and enhance the learning ability; The learning rate controls the step size of weight updates and is set between 0.01 and 0.1 to balance convergence speed and stability; The inertia coefficient is used to introduce historical weight update information in the gradient descent algorithm to avoid falling into the local optimal solution. The typical value is 0.8 to 0.9.
[0079] Normalize the input signals (such as target position, current position, and error signal) to facilitate network training. Perform forward propagation in the following steps: from input layer to hidden layer, from hidden layer to output layer, The forward pass maps the input signal to the network output and estimates the proportional, integral, and derivative coefficients of the PID controller. , providing real-time control parameters for the system.
[0080] According to the output error, error back propagation is performed, the network weights are updated, and according to the target output value (system expectation) and the actual output value of the neural network, the output error, output layer error back propagation, hidden layer error back propagation and weight update are calculated, and the parameters of the PID controller are adjusted to optimize the response speed and stability of the magnetic levitation system. By adjusting the PID parameters in real time, it is ensured that the magnetic levitation rotor can respond quickly to external disturbances in a stable suspension state.
[0081] MATLAB's S-Function module supports users to customize control algorithms through C language or MATLAB code, write S-Function files, define input, output and update function interfaces, write C language code to implement BP neural network initialization, forward propagation, back propagation and PID parameter adjustment logic, embed the code into the S-Function module, insert the S-Function module into the Simulink model, connect the input signal (such as target position, current position) and the output control quantity, and complete the simulation and verification of the control system.
[0082] The BP neural network PID control algorithm is implemented through the MATLAB / S-Function module, combined with the gradient descent method and the algorithm flow written in C language, which can effectively and dynamically optimize the control performance of the magnetic levitation system. This method has the advantages of fast response, high precision and high stability in both simulation and practical applications, and provides a reliable solution for the control of complex nonlinear systems.
[0083] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
[0084] In addition, it should be understood that although the present specification is described according to embodiments, not every embodiment contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation methods that those skilled in the art can understand.
Claims
1. A magnetic suspension control method based on BP neural network, characterized in that: The following steps are involved: S1: Establish a BP neural network PID controller, where the BP neural network consists of an input layer, a hidden layer and an output layer; S2: According to the real-time data of the magnetic levitation motor operation, the target position signal, the actual position signal and the error signal are input into the BP neural network; S3: The output signal is obtained through forward network calculation. If there is a deviation between the output signal and the expected signal, the error is back-propagated and the weights of the neural network are corrected using the gradient descent method. S4: Adjust the proportional coefficient, integral coefficient and differential coefficient of the PID controller in real time to optimize the control parameters so that the rotor of the magnetic levitation motor can achieve stable suspension.
2. A magnetic suspension control method based on BP neural network according to claim 1, characterized in that: The BP neural network PID controller consists of two parts: a PID controller with adjustable parameters and a BP neural network, wherein: Input layer: Input signals include target position signal, actual position signal and error signal; The output of the jth node is: , in, The input layer The input signal received by each node; Hidden layer: The input and output of the i-th neuron are: ; ; Output layer: The input and output of the lth neuron are: ; ; in, The neurons in the input layer With hidden layer neurons The connection weight of The neurons in the hidden layer The connection weight with the input layer neuron l.
3. A magnetic suspension control method based on BP neural network according to claim 2, characterized in that: The activation function of the hidden layer neurons is the hyperbolic tangent function: 。 4. The magnetic suspension control method based on BP neural network according to claim 2 is characterized in that: The activation function of the output layer neurons is: , and according to the functions of different neurons in the output layer, they are multiplied by different weight coefficients, and according to the functions of different neurons in the output layer, they are multiplied by different weight coefficients.
5. The magnetic suspension control method based on BP neural network according to claim 1 is characterized in that: The method adopts a position digital PID control algorithm, and the calculation formula of the control quantity is: The method adopts a position digital PID control algorithm, and the calculation formula of the control quantity is: , in, is the sampling period, and are the errors at the current and previous moments respectively, is the output control quantity.
6. The magnetic suspension control method based on BP neural network according to claim 1 is characterized in that: The number of neurons in the hidden layer of the BP neural network is determined by the following empirical formula: , in, is the number of neurons in the input layer, is the number of neurons in the output layer.
7. The magnetic suspension control method based on BP neural network according to claim 1 is characterized in that: The connection weights of the input layer, hidden layer and output layer of the BP neural network are corrected by the gradient descent method, and the correction formula is: The connection weight between the input layer neuron j and the hidden layer neuron i The correction formula is: 。 8. The magnetic suspension control method based on BP neural network according to claim 1 is characterized in that: The connection weight between the hidden layer neuron i and the output layer neuron l The correction formula is:
9. The magnetic suspension control method based on BP neural network according to claim 1, characterized in that: The initial weight of the BP neural network is a random number, and the range is set according to actual needs.
10. The magnetic suspension control method based on BP neural network according to claim 1, characterized in that: The method implements the BP neural network PID control algorithm through the MATLAB / S-Function module, and writes the algorithm flow through the C language, which specifically includes the following steps: Initialize the weights, learning rate and inertia coefficient of the BP neural network; Calculate the forward propagation output of the neural network based on the system input signal; According to the output error, perform error back propagation and update the network weights; The parameters of the PID controller are adjusted to optimize the response speed and stability of the magnetic levitation system.
Citation Information
Patent Citations
FPGA implementation method for PID closed-loop control of neural network
CN113780543A
Bearing-free magnetic flux switching motor rotor suspension control method based on neural network
CN115001335A
Cited By
PID-BP neural network target trace point prediction method, equipment and medium
CN121348709A