A modeling and simulation method of a servo motor
By using a neural network approach, control signals are generated based on the upper frequency limit and sampling frequency of the servo motor. A sample dataset is constructed and the model is trained, which solves the complexity problem of servo motor modeling and simulation, and achieves fast and accurate simulation results and cross-platform applications.
Patent Information
- Application Number
- CN202211592969.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-13
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2042-12-13
AI Technical Summary
Existing servo motor modeling and simulation processes are complex and cannot accurately reproduce the characteristics of servo motors.
By employing a neural network approach, control signals are generated and feedback signals are collected by determining the upper frequency limit and sampling frequency of the servo motor. After preprocessing, a sample dataset is constructed, and a neural network model is trained as the simulation model of the servo motor. The simulation signal is then input to obtain the simulation results.
It reduces the time required to build servo motor models, improves the speed and accuracy of modeling, can cover the effective operating frequency of servo motors, reflects their nonlinear characteristics, and supports cross-platform and cross-code embedding.
Smart Images

Figure CN116009418B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of hardware-in-the-loop simulation technology, and in particular to a modeling and simulation method for servo motors. Background Technology
[0002] In hardware-in-the-loop simulation of aircraft, servo motors, as crucial actuators, typically require parameter control to establish a complete control loop. Servo motor parameter control can be achieved through physical testing or model testing. Physical testing offers the advantage of maximizing the representation of the servo motor's mechanical and electrical characteristics. However, it also has limitations, being constrained by environmental conditions and equipment status. Especially in rapid, short-term control system verification, ensuring the availability of the servo motor and its associated equipment can impact the test schedule. Therefore, utilizing a servo motor model instead of a physical servo motor is a better solution.
[0003] For example, a servo motor is an angular position servo system. The servo motor signal includes the control signal that drives the servo motor control surface to deflect and the feedback signal that represents the controlled deflection angle of the control surface. The main task of servo motor modeling is to find the relationship between the servo motor control signal a and the servo motor feedback signal b, b = F(a). Usually, F(a) is largely nonlinear.
[0004] There are many methods for modeling and simulation, with principle-based modeling and data-driven modeling being among the most commonly used. Principle-based modeling, based on the components of a servo motor, abstracts electrical, mechanical, and control circuits to establish the servo motor's transfer function using Laplace transform, thus completing the complex frequency domain modeling of the servo motor. This method requires a thorough understanding of the servo motor system's composition and operating principles to create a more reasonable and accurate model. However, it also has the following problems: when the model contains nonlinear elements or elements beyond our understanding, such as dead-zone nonlinearities introduced by tooth backlash, the system is difficult to represent in conventional analytical form, and the resulting model cannot accurately reproduce the characteristics of the servo motor.
[0005] Data-driven modeling can effectively address the above situations. It treats the servo motor model as a black box, using control data (input) and measurement data (output) to abstract and approximate the model through regression, fitting, or likelihood estimation. While data-driven modeling avoids the challenge of providing a complete model, it still requires defining the correct process flow. The main role of data-driven modeling is to identify the model parameters for each process flow.
[0006] Existing servo motor modeling and simulation processes are complex and cannot accurately reproduce the characteristics of servo motors. Summary of the Invention
[0007] Based on the above analysis, the embodiments of the present invention aim to provide a modeling and simulation method for servo motors, in order to solve the problems that the existing servo motor modeling and simulation process is complex and cannot accurately reproduce the characteristics of servo motors.
[0008] On one hand, embodiments of the present invention provide a modeling and simulation method for a servo motor, comprising the following steps:
[0009] Determine the upper frequency limit and sampling frequency of the servo motor; generate a control signal based on the upper frequency limit and sampling frequency, and collect the feedback signal output by the servo motor according to the control signal;
[0010] The control signal and the corresponding feedback signal are preprocessed to obtain a sample dataset;
[0011] Construct a neural network model, train the neural network model based on the sample dataset, and use the trained neural network model as the simulation model of the servo motor;
[0012] The signal to be simulated is input into the simulation model of the servo motor to obtain the signal simulation result of the servo motor.
[0013] Based on further improvements to the above technical solution, the neural network model is a BP neural network model, and the loss of the neural network model is calculated using the following formula:
[0014] Among them, y' ij y represents the value of the j-th element in the model output corresponding to the i-th sample. ij Let represent the value of the j-th element of the label corresponding to the i-th sample, and p represent the maximum system latency.
[0015] Furthermore, the control signals include control signals of different frequencies;
[0016] The control signal and the corresponding feedback signal are preprocessed to obtain a sample dataset, including:
[0017] Noise reduction is performed on the control signal and corresponding feedback signal for each frequency.
[0018] The control signals of different frequencies and their corresponding feedback signals are recombined.
[0019] The recombined control signal and the corresponding feedback signal are expanded in dimension based on the maximum signal delay to construct a sample dataset.
[0020] Furthermore, the control signals of different frequencies and their corresponding feedback signals are recombined, including:
[0021] S221. Sort the control signals according to their frequency to generate the original control signal sequence; assume that the recombined control signal sequence is empty and the recombined feedback signal sequence is empty.
[0022] S222, Generate 1-f up A random number s between f; up Indicates the upper limit of frequency;
[0023] S223. If there is a control signal with frequency s in the original control signal sequence, extract the signal subsequence of the first period of the control signal with frequency s and add it to the reconstructed control signal sequence; delete the signal subsequence of the first period of the control signal with frequency s in the original control signal sequence; add the feedback signal corresponding to the signal subsequence to the reconstructed feedback signal sequence.
[0024] S224. If the original control signal sequence is empty, the recombination ends, and the recombined control signal sequence and the recombined control signal sequence are obtained.
[0025] S225. Otherwise, return to step S222.
[0026] Furthermore, based on the maximum signal delay, the dimensions of the recombined control signal and the corresponding feedback signal are expanded to construct a sample dataset, including:
[0027] The recombined control signal and corresponding feedback signal are divided into multiple signal segments according to their frequencies; for each signal segment:
[0028] S231, Let k = 1;
[0029] S232. Extract the k-th to k+p-1-th data from the control signal of the i-th signal segment as input data for a sample data, and extract the k-th to k+p-1-th data from the feedback signal of the i-th signal segment as label data for the sample data, to obtain a complete sample data;
[0030] S233, If k = l' i -p+1, then the sample data corresponding to the i-th signal segment is constructed; where, l' i Let p represent the length of the i-th signal segment and p represent the maximum signal delay.
[0031] S234. Otherwise, k = k + 1, return to step S232.
[0032] Furthermore, noise reduction is performed on the control signal and the corresponding feedback signal for each frequency, including:
[0033] Wavelet denoising is used to denoise the control signal and the corresponding feedback signal at each frequency.
[0034] Furthermore, the wavelet basis for wavelet denoising is either the Bior 3.3 or Bior 5.5 wavelet basis.
[0035] Furthermore, the maximum system delay p is determined according to the formula... The calculation yields, where t s Indicates the sampling period, t d This represents the maximum delay time between the feedback signal and the corresponding input signal, and floor(·) represents rounding down.
[0036] Furthermore, the upper frequency limit and sampling frequency of the servo motor are determined using the following method:
[0037] S101, Use the initial frequency as the current test frequency;
[0038] S102. Input the signal corresponding to the current test frequency into the servo motor and collect the feedback signal of the servo motor.
[0039] S103. If the phase difference between the input signal and the feedback signal is greater than the first threshold, or the ratio of the maximum amplitude of the feedback signal to the maximum amplitude of the input signal is less than the second threshold, then stop the test and set f... up =f c -f b1 As the upper limit of the frequency of the servo motor; where, f c f represents the current frequency. up f represents the upper limit of frequency. b1 Indicates the length of the first step;
[0040] S104. Otherwise, add the current frequency to the result obtained in the first step and use it as the current frequency, then return to step S102.
[0041] The sampling frequency is a frequency value that is more than twice the upper limit of the frequency.
[0042] Further, generating a control signal based on the upper frequency limit and the sampling frequency includes:
[0043] S111, Use the initial frequency as the current frequency;
[0044] S112. Generate a sinusoidal signal with an integer cycle corresponding to the current frequency based on the current frequency and the sampling frequency, which serves as the control signal corresponding to the current frequency, wherein the number of cycles is greater than the third threshold.
[0045] S113. If the current frequency equals the upper frequency limit, then the generation ends;
[0046] S114. Otherwise, add the second step size to the current frequency and use the result as the current frequency, then return to step S112.
[0047] Compared with existing technologies, this invention, employing a neural network method, significantly reduces the time required for in-depth servo motor modeling, avoids the difficulties of building detailed servo motor models, and increases the speed and accuracy of servo motor modeling. By generating control signals based on the upper frequency limit and operating frequency of the servo motor, and generating sample data based on the control signals and corresponding feedback signals, the servo motor model is established and verified using measured data. This method can cover the effective operating frequency of the servo motor and effectively reflect its nonlinear characteristics, enabling rapid and accurate simulation results. Furthermore, the parametric artificial neural network can be easily embedded across platforms and codebases, making it highly suitable for engineering applications.
[0048] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description
[0049] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.
[0050] Figure 1 This is a flowchart of a modeling and simulation method based on a servo motor, as described in an embodiment of the present invention. Detailed Implementation
[0051] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.
[0052] In hardware-in-the-loop simulation of aircraft, servo motors, as crucial actuators, typically require parameter control to establish a complete control loop. Servo motor parameter control can be achieved through physical testing or model testing. Physical testing offers the advantage of maximizing the representation of the servo motor's mechanical and electrical characteristics. However, it also has limitations, being constrained by environmental conditions and equipment status. Especially in rapid, short-term control system verification, ensuring the availability of the servo motor and its associated equipment can impact the test schedule. Therefore, utilizing a servo motor model instead of a physical servo motor is a better solution.
[0053] For example, a servo motor is an angular position servo system. The servo motor signal includes the control signal that drives the servo motor control surface to deflect and the feedback signal that represents the controlled deflection angle of the control surface. The main task of servo motor modeling is to find the relationship between the servo motor control signal a and the servo motor feedback signal b, b = F(a). Usually, F(a) is largely nonlinear.
[0054] There are many methods for simulation modeling, with principle-based modeling and data-driven modeling being among the most commonly used. Principle-based modeling, based on the components of a servo motor, abstracts electrical, mechanical, and control circuits to establish the servo motor's transfer function using Laplace transform, thus completing the complex frequency domain modeling of the servo motor. This method requires a thorough understanding of the servo motor system's composition and operating principles to create a more reasonable and accurate model. However, it also has the following problems: when the model contains nonlinear elements or elements beyond our understanding, such as dead-zone nonlinearities introduced by tooth backlash, the system is difficult to represent in conventional analytical form, and the resulting model cannot accurately reproduce the characteristics of the servo motor.
[0055] Data-driven modeling can effectively address the above situations. It treats the servo motor model as a black box, using control data (input) and measurement data (output) to abstract and approximate the servo motor model through regression, fitting, or likelihood estimation. While data-driven modeling avoids the difficulty of providing a complete model, it still requires specifying the correct component patterns during the modeling process. The main role of data-driven modeling is to identify the model parameters for each component.
[0056] Existing servo motor modeling and simulation processes are complex and cannot accurately reproduce the characteristics of servo motors.
[0057] A specific embodiment of the present invention discloses a modeling and simulation method based on a servo motor, such as... Figure 1 As shown, it includes the following steps:
[0058] S1. Determine the upper frequency limit and sampling frequency of the servo motor; generate a control signal based on the upper frequency limit and sampling frequency, and collect the feedback signal output by the servo motor according to the control signal;
[0059] S2. Preprocess the control signal and the corresponding feedback signal to obtain a sample dataset;
[0060] S3. Construct a neural network model, train the neural network model based on the sample dataset, and use the trained neural network model as the simulation model of the servo motor;
[0061] S4. Input the signal to be simulated into the simulation model of the servo motor to obtain the signal simulation result of the servo motor.
[0062] Employing neural network methods significantly reduces the time required for in-depth servo motor modeling, avoids the challenges of building detailed servo motor models, and increases the speed and accuracy of servo motor modeling. By generating control signals based on the upper frequency limit and operating frequency of the servo motor, and generating sample data based on the control signals and corresponding feedback signals, the servo motor model was established and verified using measured data. This method can cover the effective operating frequency of the servo motor and effectively reflect its nonlinear characteristics, enabling rapid and accurate simulation results. Furthermore, the parametric representation of artificial neural networks allows for easy cross-platform and cross-code embedding, making it highly suitable for engineering applications.
[0063] It should be noted that the upper frequency limit of the servo motor is the upper limit of the servo frequency or the upper limit of the working frequency. The feedback signal output by the servo motor according to the control signal is the feedback signal output by the servo motor according to the control signal.
[0064] Specifically, in step S1, the upper limit of the servo motor frequency and the sampling frequency are determined using the following method:
[0065] S101, Use the initial frequency as the current test frequency;
[0066] S102. Input the signal corresponding to the current test frequency into the servo motor and collect the feedback signal of the servo motor.
[0067] S103. If the phase difference between the input signal and the feedback signal is greater than the first threshold, or the ratio of the maximum amplitude of the feedback signal to the maximum amplitude of the input signal is less than the second threshold, then stop the test and set f... up =f c -f b1 As the upper limit of the frequency of the servo motor; where, f c f represents the current frequency. up f represents the upper limit of frequency. b1 Indicates the length of the first step;
[0068] S104. Otherwise, add the current frequency to the result obtained in the first step and use it as the current frequency, then return to step S102.
[0069] The sampling frequency is a frequency value that is more than twice the upper limit of the frequency.
[0070] It should be noted that steps S101 to S104 involve performing a frequency sweep test on the actual servo motor under its rated load conditions. For example, the initial frequency is 1Hz, and 1Hz is used as the first step length (i.e., f). b1=1), input signals of different frequencies into the servo motor and collect the feedback signals from the servo motor. Gradually increase the frequency of the input signal until the ratio of the maximum amplitude of the feedback signal to the maximum amplitude of the input signal is less than the second threshold, or the phase difference between the phase of the input signal and the phase of the feedback signal is greater than the first threshold. Stop the frequency sweep and record the current frequency f. c and at frequency f up =f c -f b1 The upper limit of the frequency of the servo motor model, that is, the effective operating frequency of the servo motor is 1 to f. up Hz.
[0071] According to control theory, signal tracking requires an amplitude of at least √2 / 2 and a phase of no more than 90 degrees. Therefore, the first threshold is set to 90°, and the second threshold is set to 0.707. That is, if the phase lag of the feedback acquisition signal behind the control output signal is greater than 90°, or the ratio of the maximum amplitude of the feedback signal to the maximum amplitude of the input signal is less than 0.707, then frequency sweeping is stopped and the current frequency f is recorded. c .
[0072] According to the Nyquist sampling theorem, the sampling frequency should satisfy f s >2f up That is, if the sampling frequency is greater than twice the upper limit of the frequency, then the sampling period is...
[0073] A control signal can be generated based on the upper frequency limit and sampling frequency of the servo motor. To obtain a more accurate simulation model, the control signal should cover as much of the servo motor's effective operating frequency as possible. Specifically, step S1, generating the control signal based on the upper frequency limit and sampling frequency, includes:
[0074] S111, Use the initial frequency as the current frequency;
[0075] S112. Generate a sinusoidal signal with an integer cycle corresponding to the current frequency based on the current frequency and the sampling frequency, which serves as the control signal corresponding to the current frequency, wherein the number of cycles is greater than the third threshold.
[0076] S113. If the current frequency equals the upper frequency limit, then the generation ends;
[0077] S114. Otherwise, add the second step size to the current frequency and use the result as the current frequency, then return to step S112.
[0078] For example, if the initial frequency is 1Hz, a full-cycle sine wave signal with a frequency of 1Hz is first generated. To fully reflect the characteristics of the current frequency and ensure sufficient data for subsequent processing, the number of cycles should be greater than or equal to 10, i.e., n1≥10, representing the number of cycles of the signal corresponding to the first frequency. In practice, the number of cycles for each frequency may be different.
[0079] The initial frequency plus the second step size is used as the second frequency to generate a sinusoidal signal with an entire cycle corresponding to the second frequency. Similarly, n2≥10.
[0080] This process continues until the upper limit of the generation frequency f is reached. up The corresponding full-cycle sine wave signal.
[0081] During implementation, the second step length should be less than or equal to the first step length to cover as many different operating frequencies of the servo motor as possible.
[0082] The control signal corresponding to each frequency is a sub-control signal.
[0083] In implementation, to facilitate the differentiation of feedback signals corresponding to input signals of different frequencies, control signals of different frequencies (i.e., each sub-control signal) are spliced together after adding a certain interval signal between them to obtain a complete control signal. The interval can be a 0 signal, that is, a state without signal.
[0084] After generating the complete control signal, the control signal is input into the servo motor system, and simultaneously sampled at a frequency f. s The feedback signal from the servo motor is collected to obtain a feedback signal that corresponds one-to-one with the control signal.
[0085] The feedback signal is divided according to the interval signal to obtain the feedback signal corresponding to the control signal of different frequencies. The feedback signal corresponding to each frequency is a sub-feedback signal.
[0086] After obtaining the control signal and the feedback signal, the control signal and the corresponding feedback signal are preprocessed to obtain the sample dataset. Specifically, step S2 includes:
[0087] S21. Noise reduction is performed on the control signal and the corresponding feedback signal for each frequency;
[0088] Wavelet denoising preserves signal characteristics while removing noise, making it suitable for both control and feedback signals.
[0089] Specifically, noise reduction is performed on the control signal and corresponding feedback signal for each frequency, including:
[0090] Wavelet denoising is used to denoise the control signal and the corresponding feedback signal at each frequency.
[0091] In implementation, firstly, wavelet functions are used to perform k-level wavelet decomposition on the control signal and the corresponding feedback signal, obtaining wavelet coefficients for each level. Each wavelet coefficient is then judged based on a pre-set threshold; if the amplitude of a wavelet coefficient is lower than the threshold, it is considered to be caused by noise and discarded; otherwise, the wavelet coefficient is retained. Based on the low-frequency coefficients of the k-th level of wavelet decomposition and the high-frequency coefficients of levels 1 to k after threshold filtering, wavelet reconstruction of the signal is performed, thus obtaining the denoised control signal and the corresponding feedback signal. In implementation, the threshold can be estimated using the Stein unbiased likelihood estimation method. The specific wavelet denoising process is existing technology and will not be elaborated here.
[0092] It should be noted that wavelet decomposition requires the signal length to be a power of 2. Therefore, before decomposition, signals that do not meet the length requirement need to be extended to make them powers of 2. For example, then according to the formula... Extract signal 1 to c i Each signal is appended to the original signal, making its length a power of 2, and then subjected to wavelet decomposition. Here, ceil(·) represents rounding up, l i This represents the length of the control signal at the i-th frequency.
[0093] It should be noted that the length of the denoised signal is the same as the length of the original signal.
[0094] The Bior wavelet basis is a biorthogonal wavelet. Since the control signal is a sinusoidal signal, using the Bior wavelet basis for noise reduction results in minimal damage to the signal.
[0095] In practice, the wavelet basis for wavelet denoising is either the Bior 3.3 or Bior 5.5 wavelet basis, thereby significantly reducing the contribution of high-frequency signals to the overall signal, minimizing the interference of noise carried by ineffective information on future training, and preventing training from failing to converge.
[0096] It should be noted that noise reduction is performed separately for the control signal and the corresponding feedback signal. For example, for a frequency f... i The sub-control signal and the corresponding sub-feedback signal are subjected to wavelet denoising to obtain the denoised sub-control signal and sub-feedback signal.
[0097] S22. Recombine control signals of different frequencies and their corresponding feedback signals;
[0098] During implementation, control signals and corresponding feedback signals of different frequencies can be recombined in different sequences to make the signals of different frequencies randomly distributed, thereby preventing the neural network from being affected by artificial patterns of frequency composition during training.
[0099] For example, the original signal frequency arrangement is 123456789. Sub-control signals of different frequencies are recombined, for example, recombined into 651294378. The corresponding sub-feedback frequencies are also recombined in the same order.
[0100] To further eliminate the influence of the model input order on training, step S22 can be performed in the following way:
[0101] S221. Sort the control signals according to their frequency to generate the original control signal sequence; assume that the recombined control signal sequence is empty and the recombined feedback signal sequence is empty.
[0102] S222, Generate 1-f up A random number s between f; up Indicates the upper limit of frequency;
[0103] S223. If there is a control signal with frequency s in the original control signal sequence, extract the signal subsequence of the first period of the control signal with frequency s and add it to the reconstructed control signal sequence; delete the signal subsequence of the first period of the control signal with frequency s in the original control signal sequence; add the feedback signal corresponding to the signal subsequence to the reconstructed feedback signal sequence.
[0104] S224. If the original control signal sequence is empty, the recombination ends, and the recombined control signal sequence and the recombined control signal sequence are obtained.
[0105] S225. Otherwise, return to step S222.
[0106] For example, the original control signal sequence is 111122223334445555. The control signal with a frequency of 1Hz has 4 cycles, the control signal with a frequency of 2Hz has 4 cycles, the control signal with a frequency of 3Hz has 3 cycles, the control signal with a frequency of 4Hz has 3 cycles, and the control signal with a frequency of 5Hz has 4 cycles.
[0107] If the random number s is 2, then the first period of the control signal subsequence with a frequency of 2Hz is extracted and added to the reconstructed control signal sequence, resulting in a reconstructed control signal sequence of 2. The first period of the control signal subsequence with a frequency of 2Hz is then deleted from the original control signal sequence, resulting in the original control signal sequence being 11112223334445555. Simultaneously, the feedback signal corresponding to the first period of the control signal subsequence with a frequency of 2Hz is added to the reconstructed feedback signal sequence.
[0108] Since the original control signal sequence is not empty, random numbers s are generated continuously until the original control signal sequence is empty. That is, all signals in the original control signal sequence are moved to the reconstructed control signal sequence, and the reconstruction ends.
[0109] S23. Expand the dimensions of the recombined control signal and the corresponding feedback signal according to the maximum signal delay to construct a sample dataset.
[0110] To enhance the sensitivity of artificial networks to inertial and integral characteristics, the signal dimensions are expanded based on the maximum signal delay. Specifically, the dimensions of the reconstructed control signal and the corresponding feedback signal are expanded based on the maximum signal delay to construct a sample dataset, including:
[0111] The recombined control signal and the corresponding feedback signal are divided into multiple signal segments according to the frequency of the signal;
[0112] During implementation, the signal is divided into multiple signal segments according to its frequency. Each signal segment has the same frequency. For example, if the frequency distribution of the recombined signal is 122646331457, then the signal segments it is divided into are {1,22,6,4,6,33,1,4,5,7}.
[0113] For each signal segment:
[0114] S231, Let k = 1;
[0115] S232. Extract the k-th to k+p-1-th data from the control signal of the i-th signal segment as input data for a sample data, and extract the k-th to k+p-1-th data from the feedback signal of the i-th signal segment as label data for the sample data, to obtain a complete sample data;
[0116] S233, If k = l' i -p+1, then the sample data corresponding to the i-th signal segment is constructed; where, l' i Let p represent the length of the i-th signal segment and p represent the maximum signal delay.
[0117] S234. Otherwise, k = k + 1, return to step S232.
[0118] For example, the control signal for the i-th signal segment is The corresponding feedback signal is Among them, l' i This represents the length of the control signal corresponding to the i-th signal segment.
[0119] Based on the maximum signal delay p, the control signal dimension is expanded using steps S231 to S234, resulting in the following control signal:
[0120] Similarly, the corresponding feedback signal is:
[0121] Using the corresponding row of data in the above matrix as the input data and label data of a sample, respectively, we obtain the sample dataset.
[0122] Wherein, the maximum signal delay p is according to the formula The calculation yields, where t s Indicates the sampling period, t d This represents the maximum delay time between the feedback signal and the corresponding input signal, and floor(·) represents rounding down.
[0123] That is, calculate the maximum delay time between the control signal input to the servo motor and the corresponding feedback signal acquired at each frequency, and take the maximum value as the maximum delay time between the feedback signal and the corresponding input signal.
[0124] In implementation, the neural network model can be a backpropagation (BP) neural network model, which includes a layered hidden layer structure, with the first hidden layer having p nodes. 2 The first layer has 2p hidden layers, the second layer has 2p hidden layers, the activation function for the hidden layers is hyperbolic sine (Tanh), the number of epochs is set to 1000, and the learning rate is set to 0.01. When the model converges, the weight factors and bias factors of the neural network model are determined, thus obtaining the simulation model of the servo motor.
[0125] During implementation, the model loss is calculated using the following formula, and backpropagation is performed to update the model parameters:
[0126] Among them, y' ij y represents the value of the j-th element in the model output corresponding to the i-th sample. ij Let represent the value of the j-th element of the label corresponding to the i-th sample, and p represent the maximum system latency. The loss is the loss for the i-th sample.
[0127] During the training of the network model, each Epoch can reorganize the control signals and corresponding feedback signals of different frequencies in accordance with step S22, thereby avoiding the influence of artificial patterns of frequency composition on the neural network during the training process.
[0128] When the model's loss reaches the required level or the required number of iterations is met, the model training ends, and the trained neural network model is used as the simulation model for the servo motor. The signal to be simulated is input into the servo motor's simulation model, and the servo motor's output is the signal simulation result. It should be noted that the number of input signals should be p each time.
[0129] The simulation modeling method for servo motors based on neural networks of the present invention uses measured data to establish and verify the servo motor model. The simulation results of the constructed model are more accurate and can cover the effective operating frequency of the servo motor. It also well reflects the nonlinear characteristics of the servo motor. At the same time, the artificial neural network represented in the form of parameters can be easily embedded across platforms and code, which is very suitable for engineering applications.
[0130] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0131] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A modeling and simulation method for a servo motor, characterized in that, Includes the following steps: A frequency sweep test is performed on the actual servo motor to determine the upper limit of the servo motor's frequency and the sampling frequency; a control signal is generated based on the upper limit of the frequency and the sampling frequency, and the feedback signal output by the servo motor according to the control signal is collected; The control signal and the corresponding feedback signal are preprocessed to obtain a sample dataset; Construct a neural network model, train the neural network model based on the sample dataset, and use the trained neural network model as the simulation model of the servo motor; The signal to be simulated is input into the simulation model of the servo motor to obtain the signal simulation result of the servo motor; The control signals include control signals of different frequencies; The control signal and the corresponding feedback signal are preprocessed to obtain a sample dataset, including: Noise reduction is performed on the control signal and corresponding feedback signal for each frequency. The control signals of different frequencies and their corresponding feedback signals are recombined. Based on the maximum signal delay, the dimensions of the recombined control signal and the corresponding feedback signal are expanded to construct a sample dataset. Recombining control signals of different frequencies and their corresponding feedback signals, including: S221. Sort the control signals according to their frequency to generate the original control signal sequence; assume that the recombined control signal sequence is empty and the recombined feedback signal sequence is empty. S222, Generate 1- A random number s between; Indicates the upper limit of frequency; S223. If there is a control signal with frequency s in the original control signal sequence, extract the signal subsequence of the first period of the control signal with frequency s and add it to the reconstructed control signal sequence; delete the signal subsequence of the first period of the control signal with frequency s in the original control signal sequence; add the feedback signal corresponding to the signal subsequence to the reconstructed feedback signal sequence. S224. If the original control signal sequence is empty, the recombination ends, and the recombined control signal sequence and the recombined control signal sequence are obtained. S225. Otherwise, return to step S222.
2. The servo motor modeling and simulation method according to claim 1, characterized in that, The neural network model is a backpropagation (BP) neural network model, and the loss of the neural network model is calculated using the following formula: ,in, This represents the value of the j-th element in the model output corresponding to the i-th sample. Let j represent the value of the j-th element of the label corresponding to the i-th sample. This indicates the system's maximum latency.
3. The servo motor modeling and simulation method according to claim 1, characterized in that, The recombined control signal and corresponding feedback signal are augmented based on the maximum signal delay to construct a sample dataset, including: The recombined control signal and corresponding feedback signal are divided into multiple signal segments according to their frequencies; for each signal segment: S231, Order ; S232, Extract the first The control signal of the first signal segment arrive The data is used as input data for a sample, and the data is extracted from the first data. The feedback signal of the first signal segment arrive Each data point is used as the label data for the sample data to obtain a complete sample data; S233, if Then the first The sample data corresponding to each signal segment has been constructed; among them... Indicates the first The length of each signal segment Indicates the maximum signal delay; S234. Otherwise, Return to step S232.
4. The servo motor modeling and simulation method according to claim 1, characterized in that, Noise reduction is performed on the control signal and corresponding feedback signal for each frequency, including: Wavelet denoising is used to denoise the control signal and the corresponding feedback signal at each frequency.
5. The servo motor modeling and simulation method according to claim 4, characterized in that, The wavelet basis for wavelet denoising is either the Bior 3.3 or Bior 5.5 wavelet basis.
6. The servo motor modeling and simulation method according to claim 2, characterized in that, The system's maximum delay According to the formula The calculation yielded that, Indicates the sampling period. This indicates the maximum delay time between the feedback signal and the corresponding input signal. This indicates rounding down to the nearest integer.
7. The servo motor modeling and simulation method according to claim 1, characterized in that, The upper frequency limit and sampling frequency of the servo motor are determined using the following method: S101, Use the initial frequency as the current test frequency; S102. Input the signal corresponding to the current test frequency into the servo motor and collect the feedback signal of the servo motor. S103. If the phase difference between the input signal and the feedback signal is greater than the first threshold, or the ratio of the maximum amplitude of the feedback signal to the maximum amplitude of the input signal is less than the second threshold, then stop the test. This serves as the upper limit of the servo motor's frequency; among which... Indicates the current frequency. Indicates the upper limit of frequency. Indicates the length of the first step; S104. Otherwise, add the current frequency to the result obtained in the first step and use it as the current frequency, then return to step S102. The sampling frequency is a frequency value that is more than twice the upper limit of the frequency.
8. The servo motor modeling and simulation method according to claim 1, characterized in that, Generate a control signal based on the upper frequency limit and the sampling frequency, including: S111, Use the initial frequency as the current frequency; S112. Generate a sinusoidal signal with an integer cycle corresponding to the current frequency based on the current frequency and the sampling frequency, which serves as the control signal corresponding to the current frequency, wherein the number of cycles is greater than the third threshold. S113. If the current frequency equals the upper frequency limit, then the generation ends; S114. Otherwise, add the second step size to the current frequency and use the result as the current frequency, then return to step S112.
Citation Information
Patent Citations
Servo motor fault diagnosis method
CN108931724A
Radio frequency filter modeling method
CN112231985A