Simulation design method of rectangular waveguide based on gradient descent method

By applying a neural network model based on gradient descent method in the design of rectangular waveguides, the problem of excessive electromagnetic simulation time in the existing technology is solved, and a fast and simplified design process is realized, which can quickly obtain the power limit of rectangular waveguides and Equivalent refractive index.

CN114756998BActive Publication Date: 2025-02-11XIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210563171.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-19
Publication Date
2025-02-11
Estimated Expiration
2042-05-19

AI Technical Summary

Technical Problem

In the electromagnetic simulation process of simulating rectangular waveguides, the electromagnetic simulation time is too long, resulting in slow and complex design process.

Method used

Using the simulation design method of rectangular waveguide based on gradient descent method, the rectangular waveguide model is established using COMSOL software, a database is generated, and the BP neural network model is built through python software to conduct data training and prediction to achieve rapid power limiting and equivalent acquisition Refractive index result.

Benefits of technology

Through this method, visual prediction of the results can be quickly obtained with simple parameter input, which significantly speeds up the design process of rectangular waveguides and simplifies the design steps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114756998B_ABST
    Figure CN114756998B_ABST
Patent Text Reader

Abstract

The rectangular waveguide simulation design method based on the gradient descent method disclosed by the present invention is specifically as follows: step 1: modeling the rectangular waveguide using COMSOL software; step 2: preprocessing the database, 80% of which is test set data and 20% is training set data; step 3: using python software to build a BP neural network model; step 4: normalizing the test set data and the training set data; step 5: constructing a class to define the neural network model; step 6: using the neural network defined by the class written before instantiation; step 7: training the data; step 8: after each training is completed, using the previously allocated test set; step 9: after the neural network model is trained, inputting the structural parameters of the rectangular waveguide in the python software, and performing a visual output prediction. The method speeds up the design process of the rectangular waveguide and simplifies the design steps.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of simulation design, and relates to a rectangular waveguide simulation design method based on a gradient descent method. Background Art

[0002] The so-called rectangular waveguide is a rectangular metal tube with a rectangular cross-section. Under certain conditions, the rectangular space surrounded by its outer conductor can realize the transmission of electromagnetic energy. It is easy to process, has low loss and dual polarization characteristics, and is widely used in various resonant cavities, wavelength meters, etc. At present, COMSOL software is often used to design the waveguide model in the 3D interface, and then different transmission TE and TM modes are analyzed, and then the results are visualized using Matlab.

[0003] The structure of a rectangular waveguide contains four parameters: the inner cross-sectional dimensions c, d and the outer cross-sectional dimensions a, b. For this structure, we generally consider its power limit and equivalent refractive index. The previous method is to build a model in COMSOL and then simulate and see the output results. However, this method takes too long to simulate electromagnetics.

[0004] Based on this question, we wondered whether we could accurately and quickly get the output results of power limit and equivalent refractive index by inputting simple parameters. In the known proposal, Python software with the idea of ​​simplicity was combined with neural network to train the rectangular waveguide model, so that in the design process of rectangular waveguide, only simple parameter input was needed to quickly get the visual prediction of the results. Summary of the invention

[0005] The purpose of the present invention is to provide a rectangular waveguide simulation design method based on the gradient descent method, which only requires simple parameter input to quickly obtain a visual prediction of the result, speeds up the design process of the rectangular waveguide, and simplifies the design steps.

[0006] The technical solution adopted by the present invention is a rectangular waveguide simulation design method based on the gradient descent method, which is specifically implemented according to the following steps:

[0007] Step 1: Use COMSOL software to model the rectangular waveguide and establish a database;

[0008] Step 2: Preprocess the database, 80% of which is test set data and 20% is training set data;

[0009] Step 3: Use python software to build a BP neural network model;

[0010] Step 4: Normalize the test set data and the training set data, call the sklearn library, and convert the training set data into Tensor type;

[0011] Step 5: Construct a class to define the neural network model. In the internal initialization, use the linear layer method Linear in the torch library to define the hidden layer network and the output layer network; then write the forward propagation function in the class, and use the Sigmoid function for both the hidden layer activation function and the output layer activation function to perform nonlinear transformation, that is, y = f(w*x+b), where y is the network output data, x is the input data, f is the activation function Sigmoid, w is the weight, and b is the bias;

[0012] Step 6: Use the neural network defined by the class written before instantiation, directly use the Adam optimizer in the Torch library, perform gradient descent during training, and continuously update the weight w and bias b; define the loss function and calculate it in the reverse error propagation;

[0013] Step 7: Perform data training, set the number of training epochs to a specific value. In each training, first perform forward propagation, and perform nonlinear processing on the output result obtained by forward propagation, that is, use the Sigmoid function to calculate, and use this as the predicted value, compare it with the true value, and bring it into the MSE function to obtain the calculation result of the loss function, that is, the error, and then start back propagation, and use the obtained error value to update w and b in the previous layers. After the update, forward propagate again to calculate the error, and repeat this cycle until the error is less than the expected value, otherwise, continue to iterate;

[0014] Step 8: After each training is completed, use the previously assigned test set to test. The specific method is the same as the forward propagation method in step 7 to get the predicted value and see if it is the same as the true value;

[0015] Step 9: After the neural network model is trained, input the structural parameters of the rectangular waveguide into the python software to make a visual output prediction of the output equivalent refractive index and power limit.

[0016] The present invention is also characterized in that

[0017] Step 1 is implemented according to the following steps:

[0018] First, the structural parameters of the rectangular waveguide input are given, including the outer section length a, width b and the inner section length c, width d; then, boundary conditions are added, port excitation is set, scanning frequency is set, solution frequency is set, and mode transmission analysis is performed; here, since the main mode of the rectangular waveguide is TE 10, so the electric field E in the z direction is set z =0, magnetic field H z ≠0; After analysis and solution, the specific results of the equivalent refractive index and power limit of a certain rectangular waveguide are directly calculated in the COMSOL software, that is, a set of data preparation is completed. After that, different rectangular waveguide structures are repeatedly modeled and analyzed to obtain a database with input as parameters a, b, c, d and output as equivalent refractive index and power limit.

[0019] In step 3: first, set the hyperparameters: the learning rate is set to 0.02, the number of input parameters is 4, corresponding to the four structural parameters a, b, c, d of the rectangular waveguide, and the constructed BP neural network model framework includes input layer, hidden layer and output layer. The number of hidden layers is set to 7, and the number of neurons contained in these seven layers is [10 15 20 1510 5 1] respectively; the number of output parameters is 2, which corresponds to the equivalent refractive index and power limit.

[0020] In step 6, the learning rate set inside the Adam optimizer is 0.02; the method for updating parameters inside the Adam optimizer is shown in formulas (3) and (4):

[0021]

[0022]

[0023] In formulas (3) and (4), α is the learning rate, w ij is the weight between the i-th neuron and the j-th neuron, b i is the bias of the ith neuron; MSE is the mean error function.

[0024] In step 6, the average error function Where m represents the number of data, y n represents the output of the neural network. When n is different, it represents the predicted output results of the equivalent refractive index and power limit, respectively. represents the real data, and when n is different, they represent the real output results of the equivalent refractive index and power limit respectively.

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

[0026] The method of the present invention uses simple Python software to build a neural network gradient descent method model, and trains the accumulated rectangular waveguide parameter data to obtain a prediction model. Through the prediction model, in the design process of the waveguide, only simple parameter input is required to quickly obtain a visual prediction of the result, which speeds up the design process of the rectangular waveguide and simplifies the design steps. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a parameter diagram of the rectangular waveguide in the present invention;

[0028] Figure 2 It is a hierarchical structure diagram of the neural network model of the present invention. DETAILED DESCRIPTION

[0029] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0030] The present invention provides a rectangular waveguide simulation design method based on the gradient descent method, such as Figure 1-2 As shown, the specific implementation steps are as follows:

[0031] Step 1: Use COMSOL software to model the rectangular waveguide and establish a database; first, given the structural parameters of the rectangular waveguide input, such as Figure 1 , including the outer section length a, width b and the inner section length c, width d, design the structure of the rectangular waveguide; then, add boundary conditions, set port excitation, set scanning frequency, set solution frequency, and analyze the mode transmission; here, since the main mode of the rectangular waveguide is TE 10 , so the electric field E in the z direction is set z =0, magnetic field H z ≠0; After analysis and solution, the specific results of the equivalent refractive index and power limit of a certain rectangular waveguide are directly calculated in the COMSOL software, that is, a set of data preparation is completed. After that, different rectangular waveguide structures are repeatedly modeled and analyzed to obtain a database with input as parameters a, b, c, d and output as equivalent refractive index and power limit.

[0032] Step 2: Preprocess the database, 80% of which is the training set data for training and 20% is the test set data for testing;

[0033] Step 3: Use Python software to build a neural network model. First, set the hyperparameters: the learning rate is set to 0.02, the number of input parameters is 4, and the corresponding four structural parameters of the rectangular waveguide are a, b, c, and d. The built BP neural network model framework includes input layer, hidden layer, and output layer. The number of hidden layers is set to 7. The number of neurons in these seven layers is [10 15 20 15 10 5 1], and there is a weight w between every two neurons. Each neuron has its own bias b; the number of output parameters is 2, which corresponds to the equivalent refractive index and power limit.

[0034] In step 3: the activation function used by the neural network model is the Sigmoid function, that is, formula (1) to complete the nonlinear change, where x represents the input, and the error function is the mean error function MSE, that is, formula (2) to complete the error calculation, where m represents the number of data, and y n represents the output of the neural network. When n is different, it represents the predicted output results of the equivalent refractive index and power limit, respectively. represents the real data, and when n is different, it represents the real output results of the equivalent refractive index and power limit respectively;

[0035]

[0036]

[0037] Step 4: Normalize the test set data and the training set data, call the sklearn library, and convert the training set data into Tensor type to facilitate subsequent training;

[0038] Step 5: Construct a class to define the neural network model. Use the linear layer method Linear in the torch library to define the hidden layer network and the output layer network in the internal initialization. Then write the forward propagation function in the class, and use the Sigmoid function for both the hidden layer activation function and the output layer activation function to perform nonlinear transformations, which is convenient for calculating and analyzing errors later. In other words, forward propagation is a weighted summation of the input data, followed by a nonlinear change. Specifically, in terms of the formula, y=f(w*x+b), where y is the network output data, x is the input data, f is the activation function Sigmoid, w is the weight, and b is the bias.

[0039] Step 6: Use the neural network defined by the class written before instantiation, directly use the Adam optimizer in the Torch library, perform gradient descent during training, and continuously update the weight w and bias b; define the loss function, here the mean error function MSE is used for calculation in reverse error propagation;

[0040] In step 6, the learning rate set inside the Adam optimizer is 0.02; the method for updating parameters inside the Adam optimizer is shown in formulas (3) and (4):

[0041]

[0042]

[0043] In formulas (3) and (4), α is the learning rate, w ij is the weight between the i-th neuron and the j-th neuron, bi is the bias of the ith neuron; MSE is the mean error function.

[0044] Step 7: Perform data training, set the number of training epochs to a specific value. In each training, first perform forward propagation, and perform nonlinear processing on the output result obtained by forward propagation, that is, use the Sigmoid function to calculate, and use this as the predicted value, compare it with the true value, and bring it into the MSE function to obtain the calculation result of the loss function, that is, the error, and then start back propagation, and use the obtained error value to update w and b in the previous layers. After the update, forward propagate again to calculate the error, and repeat this cycle until the error is less than the expected value, otherwise, continue to iterate;

[0045] Step 8: After each training is completed, use the previously assigned test set to test. The specific method is the same as the forward propagation method in step 7 to get the predicted value to see if it is the same as the true value; here there is no need to consider the change of gradient;

[0046] Step 9: After the neural network model is trained, input the structural parameters of the rectangular waveguide into the python software to make a visual output prediction of the output equivalent refractive index and power limit.

Claims

1. A rectangular waveguide simulation design method based on a gradient descent method, characterized in that: Follow the steps below to implement it: Step 1: Use COMSOL software to model the rectangular waveguide and establish a database; Step 2: Preprocess the database, 80% of which is test set data and 20% is training set data; Step 3: Use python software to build a BP neural network model; Step 4: Normalize the test set data and the training set data, call the sklearn library, and convert the training set data into Tensor type; Step 5: Construct a class to define the neural network model. In the internal initialization, use the linear layer method Linear in the torch library to define the hidden layer network and the output layer network; then write the forward propagation function in the class, and use the Sigmoid function for both the hidden layer activation function and the output layer activation function to perform nonlinear transformation, that is, y = f(w*x+b), where y is the network output data, x is the input data, f is the activation function Sigmoid, w is the weight, and b is the bias; Step 6: Use the neural network defined by the class written before instantiation, directly use the Adam optimizer in the Torch library, perform gradient descent during training, and continuously update the weight w and bias b; define the loss function and calculate it in the reverse error propagation; Step 7: Perform data training, set the number of training epochs to a specific value. In each training, first perform forward propagation, and perform nonlinear processing on the output result obtained by forward propagation, that is, use the Sigmoid function to calculate, and use this as the predicted value, compare it with the true value, and bring it into the MSE function to obtain the calculation result of the loss function, that is, the error, and then start back propagation, and use the obtained error value to update w and b in the previous layers. After the update, forward propagate again to calculate the error, and repeat this cycle until the error is less than the expected value, otherwise, continue to iterate; Step 8: After each training is completed, use the previously assigned test set to test. The specific method is the same as the forward propagation method in step 7 to get the predicted value and see if it is the same as the true value; Step 9: After the neural network model is trained, input the structural parameters of the rectangular waveguide into the python software to make a visual output prediction of the output equivalent refractive index and power limit.

2. The rectangular waveguide simulation design method based on the gradient descent method according to claim 1 is characterized in that: Step 1 is implemented according to the following steps: First, the structural parameters of the rectangular waveguide input are given, including the outer section length a, width b and the inner section length c, width d; then, boundary conditions are added, port excitation is set, scanning frequency is set, solution frequency is set, and mode transmission analysis is performed; here, since the main mode of the rectangular waveguide is TE 10 , so the electric field E in the z direction is set z =0, magnetic field H z ≠0; After analysis and solution, the specific results of the equivalent refractive index and power limit of a certain rectangular waveguide are directly calculated in the COMSOL software, that is, a set of data preparation is completed. After that, different rectangular waveguide structures are repeatedly modeled and analyzed to obtain a database with input as parameters a, b, c, d and output as equivalent refractive index and power limit.

3. The rectangular waveguide simulation design method based on the gradient descent method according to claim 2 is characterized in that: In step 3: first, set the hyperparameters: the learning rate is set to 0.02, the number of input parameters is 4, corresponding to the four structural parameters a, b, c, d of the rectangular waveguide, and the constructed BP neural network model framework includes input layer, hidden layer and output layer. The number of hidden layers is set to 7, and the number of neurons contained in these seven layers is [10 15 20 15 10 5 1] respectively; the number of output parameters is 2, corresponding to the equivalent refractive index and power limit.

4. The rectangular waveguide simulation design method based on the gradient descent method according to claim 3 is characterized in that: In step 6, the learning rate set inside the Adam optimizer is 0.02; the method for updating parameters inside the Adam optimizer is shown in formulas (3) and (4): In formulas (3) and (4), α is the learning rate, w ij is the weight between the i-th neuron and the j-th neuron, b i is the bias of the ith neuron; MSE is the mean error function.

5. The rectangular waveguide simulation design method based on the gradient descent method according to claim 4 is characterized in that: In step 6, the average error function Where m represents the number of data, y n represents the output of the neural network. When n is different, it represents the predicted output results of the equivalent refractive index and power limit, respectively. represents the real data, and when n is different, they represent the real output results of the equivalent refractive index and power limit respectively.