# CAD-Assisted 3D Assembly of Automobile Electrical Switch considering PSO-BP Neural Network Algorithm

Authors: Hanting Zhang
Journal: Journal of Electrical and Computer Engineering
 (2022)

---

## Abstract

The installation of automotive electrical switches is a complex three-dimensional space assembly project which has high requirements for installation accuracy. In order to improve the installation effect of automotive electrical switches, this paper applies the PSO-BP neural network algorithm to automotive electrical switches and integrates PSO and ELM algorithms. The training speed of the ELM model is fast, the model generalizes the data well, and the noise data have little effect on the model. Moreover, this article combines simulation research to evaluate the effect of this algorithm. After confirming the performance of the effect, this paper uses a case study to study the effect of the application of the PSO-BP neural network algorithm to the automotive electrical switch. The research results show that the CAD-assisted 3D assembly system of automobile electrical switch considering PSO-BP neural network algorithm has a good effect.


---

## Body

## 1. Introduction

As an outstanding engineering technology, CAD technology has been widely used in aerospace, automobiles, ships, machinery, electronics, chemicals, construction, and other industries because of its huge economic benefits. [1] Mechanical automotive products are ever-changing, and users will have the characteristics of their own enterprises when they are applied. Therefore, after users introduce commercial CAD software, they need to carry out different degrees of secondary development on the selected CAD software platform for specific objects. They need to design a CAD system for special car products with a friendly interface and easy to use so that the CAD software can play a full role in the enterprise [2]. In the computer field, with the rapid development of computer hardware performance and interactive graphics technology, people have shifted the focus from program efficiency to user efficiency, and the user interface is a key factor affecting user efficiency. In the development process of the application system, the design of the user interface often reflects the whole idea of the realization of the system function and is the basis for establishing the entire programming framework. Therefore, the user interface design and development work occupies a large proportion of the entire system development process [3].In the design stage of automotive products, digital assembly modeling is very necessary, and it is an important part of automotive product design. The typical automotive product modeling process in the current commercial 3D CAD design software is as follows: first, the designer interactively specifies the geometric constraint relationship information of the assembly between the parts; then, the 3D software system automatically calculates the position and pose of the parts. The transformation matrix is used to determine its specific position information in the assembly; finally, the coordinate transformation matrix is used to realize the positioning of the part to the assembly position. In the research process of digital assembly technology, the intelligence and knowledge of the assembly system is an urgent problem for researchers to solve [3]. An important way to realize automatic assembly is to use 3D software as a platform to realize auto assembly automation through running programs and reduce the proportion of manual assembly operations when designing auto products. In the process of realizing automatic assembly, how to effectively express and transmit assembly information so that designers can perform automatic assembly accurately, intuitively, and quickly has always been the research content of domestic and foreign scholars. Foreign research scholars have done a lot of work in assembling navigation. The highlight of the PSO-BP neural network model is the setting of the parameter and weight solution module. The traditional algorithm uses the gradient descent method. Here, a more accurate and fast particle swarm algorithm is used cleverly to enhance the learning ability between individuals and the information between systems. Sharing ability makes the search faster and then obtains the global optimal solution.This paper combines the PSO-BP neural network algorithm to construct the CAD-assisted three-dimensional assembly system of automotive electrical switches to improve the effectiveness of subsequent automotive electrical switch installation.


## 2. Related Work

Foreign research on 3D assembly technology began in the 1990s. The United States was the first to research related technologies and made great breakthroughs and cooperated with many research institutions and well-known domestic universities to conduct research on virtual assembly technology. Literature [4] developed a three-dimensional auxiliary assembly system that can assemble products during product design. The system can share data with parametric CAD software. Three-dimensional models and structure trees can be automatically transferred from CAD, product assembly information can be obtained, and assembly sequence and path planning can be carried out according to the obtained data. Literature [5] studies the application of virtual technology in assembly and develops a system that simulates the actual assembly operation through the operation of the workers in the virtual environment on the three-dimensional model of the product. It is used to analyze and establish the assembly sequence of the product and calculate the cost and time of assembly. Literature [6] combined virtual technology with artificial intelligence technology and developed a virtual assembly system called CODY. The biggest feature of this system is the man-machine interactive operation mode. Literature [7] constructed a prototype system called VPW (Virtual Process Week). The main feature of this system is to use virtual technology to test the assembly process of automobiles.Literature [8] uses virtual technology to establish a three-dimensional assembly planning prototype system called VDVAS. Literature [9] builds a system called VASS (Virtual Assembly Support System) that can implement digital preassembly through a three-dimensional digital model of the product in the product design stage. It is very intuitive to verify the geometric feasibility of the product. Literature [10] developed a web-based collaborative assembly process planning system Web CAPS to realize 3D assembly process design and planning in a network environment. Literature [11] used the browser plug-in Cortona to build a VRML (virtual reality modeling language) three-dimensional virtual assembly prototype system. Literature [12] developed a 3D digital assembly process planning system. Literature [13] developed a 3D assembly process design system for internal combustion engine assembly based on the SolidWorks platform. Literature [14] developed a 3D CAD-based visual assembly CAPP system, which can perform 3D assembly process design for gearboxes. The gearbox implements three-dimensional assembly process design. Literature [15] developed a three-dimensional assembly system based on UG (Unigraphics NX) as a development platform by studying the technical difficulties of the three-dimensional assembly process system.The system constructed in [16] can analyze the assembly information of complex assemblies, focus on the geometry and data structure of the assembly, describe the degree of freedom of the parts, and classify the assembly methods in detail to simplify the complexity of assembly analysis. The virtual constructor CODY in [18] is a knowledge-based interactive assembly workbench on which assembly or disassembly is performed directly using a mouse or similar input device. The user selects an object and moves to another object nearby, and the knowledge-based system will complete the assembly. In addition, users can use natural language to manipulate the system. The research object is standardized reusable parts to construct complex assemblies. The Archimedes system proposed in [18] is a software tool for plan generation and visualization. It can realize the functions of generating, optimizing, verifying, and checking the mechanical assembly sequence of the three-dimensional model. Archimedes was originally used as a vertically integrated system to generate programs from CAD models. Literature [19] studied the data exchange between virtual assembly system and computer-aided design system. The small plane model is evenly cut into three vertical directions, and a contour-based surface model is created. Then, the boundary points are determined from the contour model. The network boundary curve is further derived from the previously determined boundary points from the original VR model of the vertices of the adjacent polygons. The entire surface object of the boundary curve is divided into a single surface area and the topological form of the object. The type is further identified by a single surface.


## 3. Algorithm Improvement Based on the PSO-BP Neural Network

The scale of the hidden layer unit of the neural network determines the model's ability to map data. The learning ability of the model increases with the increase in the size of the hidden layer unit. When the number of neurons in the hidden layer of the network is fixed, as the number of hidden layers of the network increases, the learning ability of the network model becomes stronger. When the hidden layer of the network is too large, it will cause the model to overlearn the training samples. When the scale of the hidden layer of the network is too small, it will lead to insufficient learning of the training samples by the model. Moreover, the empirical formula for selecting the number of neurons in the hidden layer of the model n1 is(1)n1=m+n+a.Here,m and n are the number of nodes in the input layer and output layer of the network model, and a is a random number between 1 and 10. The neural network has a limited capacity to load information, and the BP neural network tends to forget the old samples when training new samples. By increasing the scale of the hidden layer of the network, the information-carrying capacity of the model can be increased. The size of the network will reduce the generalization of the model.The improvement strategies of the BP algorithm are discussed in the following.


### 3.1. Additional Momentum

The additional momentum method realizes that when the network parameters are corrected, a correction value proportional to the last parameter is added. The correction process of the neural network parameters is as follows:(2)Δwijt+1=1−mcηδjui+mcΔwijt,Δθjt+1=1−mcηδj+mcΔθjt.Here,t represents the training times of the model and mc is the momentum factor of parameter correction, δ represents the error signal of the model, and w and Δθ, respectively, represent the correction amount of the neural network weight and threshold.The gradient descent of additional momentum does not change the original algorithm mode of gradient descent. The adjustment of network parameters is still in the direction of the gradient of the error function. When the model parameters are adjusted to the flat area of the error function slope and the value of the error signal, the neuron weight and threshold are corrected toΔwijt+1=mcΔwijt and Δθjt+1=mcΔθjt, respectively. The additional momentum method effectively avoids the risk of parameter optimization falling into local extreme values. However, the gradient descent of the additional momentum is also sensitive to the selection of the initial parameters of the network. When the direction of the model parameter adjustment is consistent with the direction of the global minimum movement, the gradient descent of the additional momentum can work better.When the artificial neural network model is trained, although the gradient descent method and the gradient descent method with additional momentum are highly adaptable to the model, the convergence speed of the parameters to be optimized is slow, and the training time of the neural network model is longer.


### 3.2. Adaptive Learning Rate

The selection of the learning raten value affects the training results of the BP algorithm model. A learning rate that is too small will increase the training time of the model, and a learning rate that is too large will oscillate the convergence of the error function. The adaptive learning rate method can improve this phenomenon. Moreover, the calculation formula of the adaptive learning rate o is as follows:(3)ηt+1=ηtEtEt+1.Here,η is the learning rate, t is the number of iterations, and E is the training error of the model.When thet+1th iteration error E+1 is greater than the tth iteration error E, the learning rate ηt+1 value of the t+1th iteration decreases. The t+1th iteration error Et+1 is less than the tth iteration error. At the iteration error Et, the learning rate value of the t+1th iteration increases, and the value of the learning rate ηt+1 is dynamically adjusted according to the model training error.


### 3.3. Deformation of the Error Function

The error function during model training can be expressed as(4)E=12∑y=1P∑k=1Mdkp−ykp2.Here,dk is the actual value of the training sample, and yk is the predicted value of the model. Baum, Wileze, and others proposed a new model training error function. The conventional error function training is easy to stagnate. The improved model training error function is as follows:(5)E=∑121+yklog1+yk1+dk+121−yklog1−yk1−dk.When the predicted value of the training model is equal to the actual valued of the training sample, the error of model training is 0. When the predicted value 9 of the model is +1 or −1, the function diverges. This overcomes the phenomenon of stagnant model training.When using the hyperbolic tangent function tanh as the model activation function, that is, f(t) = tanh(t), the error signal during model training changes fromδ=ftyk−dk to δ=yk−dk. At this time, the correction of model weight and threshold are, respectively, Δwjk=ηδyk and Δθj=ηδ. Since the adjustment of model parameters lacks the control of f(t), the adjustment process of the parameters is prone to oscillation.During the foraging process, the ant colony releases “pheromone” to carry out the information interaction between ant individuals, and the individual ants make route selection according to the pheromone concentration of the route to be selected. The pheromone concentration of the path to be selected is inversely proportional to the distance of the ant's foraging path. The ant colony “double-bridge” experiment is shown in Figure1.Figure 1
The ant colony “double-bridge” experiment.Among them, point B is the colony of ants, point A is the target food, and B-C-D-A or B-E-D-A is an alternative path for foraging. In the early stage of foraging, the pheromone concentrations of the two paths are the same, and the ants have the same path selection probability. In the later stage of foraging, the shorter path B-C-D-A will leave more pheromones. Because the ants make path selection based on the path pheromone concentration, the probability of the ants choosing the shorter path B-C-D-A is greater; that is, the shortest path B-C-D-A is found.Taking Figure1 as an example, we set b(t) to represent the number of ants on node i at time t, τij to represent the pheromone concentration of path i to i, and n to be the cutoff of the problem to be solved. The total amount of ants in the ant colony m is expressed as m=∑i=1nbit. The taboo table Tabuk represents all the paths that ant k has traversed, Tabuk changes dynamically with the path traversed by ant k, and pijkt represents the path transition probability of ant k from i to j at time t.(6)pijkt=τijtαηijtβ∑sτijtαηijtβ.Here,s represents the candidate path of ant k, and n (t) is the heuristic function of ant state transition, which represents the expected degree of the ant's transition from path i to j. The heuristic function of state transition can be expressed, where d represents the distance from path i to j. a is the information heuristic factor, which indicates the importance of the pheromone concentration to the path selection of ants, and ants tend to choose the path with high pheromone concentration. ß is the expected heuristic factor, which indicates how important the heuristic information is to the ant's path selection. Since the value of the heuristic function is inversely proportional to the distance of the path to be selected, ants are more inclined to choose a shorter path.Ant colony path optimization is a process based on the positive feedback of path residual pheromone concentration. Excessively high concentration of path pheromone will obscure the role of the heuristic function. The introduction of a pheromone volatilization mechanism can improve the above situation and update the path residual pheromone, and the formula is as follows:(7)τijt+n=1−ρτijt+Δτijt,Δτijt=∑k=1mΔτijk.Here,ρ is the pheromone volatilization factor, 1−ρ is the residual factor of the path pheromone, and Δτij is the increase in the path pheromone.The feedforward neural network model is shown in Figure2. It is composed of an input layer, an output layer, and a hidden layer. The input layer of the model has n neurons, which represent the n input parameters of the model. The output layer of the model has m neurons, which represent the m output parameters of the model. The hidden layer of the model has l neurons, and the model realizes the mapping from input to output through this layer.Figure 2
Feedforward neural network model.wij is the connection weight of the ith neuron in the input layer and the jth neuron in the hidden layer, and the weight matrix ω is(8)ω=ω11ω12⋯ω1nω21ω21⋯ω21⋮⋮⋱⋮ωl1ωl2⋯ωlnl×n.βjk is the connection weight between the jth neuron in the hidden layer of the model and the kth neuron in the output layer, the weight matrix from the hidden layer to the output layer is β, and b is the threshold value of the lth neuron in the hidden layer of the model.(9)β=β11β12⋯β1nβ21β21⋯β21⋮⋮⋱⋮βl1βl2⋯βlnl×nb=b1b2⋮bll×1.We set the number of training samples of the model toQ, and the activation function of the hidden layer unit to g(z), then the output matrix H of the model is(10)Hω1,ω2...ωl;b1,b2...bl;x1,x2...xl=gω1x1+b1gω2x1+b2⋯gωlx1+blgω1x2+b1gω2x2+b2⋯gωlx2+bl⋮⋮⋮⋮gω1xQ+b1gω2xQ+b2⋯gωlxQ+blQ×l.The target matrixT of the model is(11)T=t1t2⋯tQm×Q.Here, there are(12)tj=t1jt2j⋮tmj=∑i=1tβi1gωixj+bi∑i=1tβi2gωixj+bi⋮∑i=1tβimgωixj+bi,j=1,2,...,Q,ωi=ωi1ωi2⋯ωin;xj=x1jx2j⋯xnjT.In summary, the target matrixT of the single hidden layer feedforward neural network model can be expressed as T' = Hβ, where T is the transpose of T.The characteristics of a single hidden layer feedforward neural network are as follows:(1)
When the feedforward neural network has N training samplesxi,ti, where i = 1, 2, …, N, when the number of hidden layer units of the model is N and the activation function g(z) is infinitely differentiable in the solution interval, and when the hidden layer connection weight w and threshold value are randomly assigned, the output matrix H of the hidden layer is invertible and Hβ−T=0. Among them, ß is the output weight matrix of the hidden layer, and T is the target matrix output by the model.(2)
When the feedforward neural network model has N training samplesxi,ti, where i = 1, 2, …, N, when the number of hidden layer units of the model is K (K ≤ N) and the activation function g(z) is infinitely differentiable in the solution interval, and when the connection weight w and the threshold b of the hidden layer are randomly assigned, we give an arbitrary small error ε and ε>0, and there is Hβ−T<ε.It can be seen from the above conclusion that the feedforward neural network model has N training samples (xj, tj), where j = 1, 2, 3, …, N. The number of neurons in the hidden layer of the model is L, the actual output of the training model is oj, and the minimum error of the model is ∑j=1NOj−tj=0 This needs to calculate the input weight surface of the model, the hidden layer threshold b, and the hidden layer-output weight ß and make it satisfy Hω^i,b^i,β^i−T=minω,b,βHωi,bi,βi−T. This is equivalent to minimizing the loss function E=∑j=1N∑i=1Lβigωi,xj+bi−tj.Once the connection weightωi and hidden layer threshold bi from the input layer of the extreme learning machine to the hidden layer are determined, the output matrix H of the hidden layer of the model will also be uniquely determined.The training of the single hidden layer feedforward neural network is transformed into the solution of Hβ = T, and the output weight ß of the hidden layer of the model is determined from this, that is, β^i=H+T, where H+ is the Moore–Penrose generalized inverse matrix of the output matrix H.The training steps of the extreme learning machine model are as follows:(1)
The algorithm determines the model structure: determine the network structure of the input layer, output layer, and hidden layer of the model.(2)
The algorithm assigns the parameters including the connection weightω from the model input layer to the hidden layer and the hidden layer threshold b randomly assigned values.(3)
The algorithm sets the activation function. The hidden layer of the model sets an activation function g(z) with an infinite differentiable solution interval.(4)
The algorithm calculates the parameterβ^. According to the equation minβHβ−T′, the connection weight β^i=H+T′ from the hidden layer of the model to the output layer is obtained.The flow chart of the ELM algorithm is shown in Figure3.Figure 3
ELM algorithm flow chart.The extreme learning machine model and the BP neural network model are set to the same network structure. The extreme learning machine model has 5 input parameters, 1 output parameter, and 10 hidden layer neurons, and the activation function g(z) of the hidden layer neurons is set to tanh.


## 3.1. Additional Momentum

The additional momentum method realizes that when the network parameters are corrected, a correction value proportional to the last parameter is added. The correction process of the neural network parameters is as follows:(2)Δwijt+1=1−mcηδjui+mcΔwijt,Δθjt+1=1−mcηδj+mcΔθjt.Here,t represents the training times of the model and mc is the momentum factor of parameter correction, δ represents the error signal of the model, and w and Δθ, respectively, represent the correction amount of the neural network weight and threshold.The gradient descent of additional momentum does not change the original algorithm mode of gradient descent. The adjustment of network parameters is still in the direction of the gradient of the error function. When the model parameters are adjusted to the flat area of the error function slope and the value of the error signal, the neuron weight and threshold are corrected toΔwijt+1=mcΔwijt and Δθjt+1=mcΔθjt, respectively. The additional momentum method effectively avoids the risk of parameter optimization falling into local extreme values. However, the gradient descent of the additional momentum is also sensitive to the selection of the initial parameters of the network. When the direction of the model parameter adjustment is consistent with the direction of the global minimum movement, the gradient descent of the additional momentum can work better.When the artificial neural network model is trained, although the gradient descent method and the gradient descent method with additional momentum are highly adaptable to the model, the convergence speed of the parameters to be optimized is slow, and the training time of the neural network model is longer.


## 3.2. Adaptive Learning Rate

The selection of the learning raten value affects the training results of the BP algorithm model. A learning rate that is too small will increase the training time of the model, and a learning rate that is too large will oscillate the convergence of the error function. The adaptive learning rate method can improve this phenomenon. Moreover, the calculation formula of the adaptive learning rate o is as follows:(3)ηt+1=ηtEtEt+1.Here,η is the learning rate, t is the number of iterations, and E is the training error of the model.When thet+1th iteration error E+1 is greater than the tth iteration error E, the learning rate ηt+1 value of the t+1th iteration decreases. The t+1th iteration error Et+1 is less than the tth iteration error. At the iteration error Et, the learning rate value of the t+1th iteration increases, and the value of the learning rate ηt+1 is dynamically adjusted according to the model training error.


## 3.3. Deformation of the Error Function

The error function during model training can be expressed as(4)E=12∑y=1P∑k=1Mdkp−ykp2.Here,dk is the actual value of the training sample, and yk is the predicted value of the model. Baum, Wileze, and others proposed a new model training error function. The conventional error function training is easy to stagnate. The improved model training error function is as follows:(5)E=∑121+yklog1+yk1+dk+121−yklog1−yk1−dk.When the predicted value of the training model is equal to the actual valued of the training sample, the error of model training is 0. When the predicted value 9 of the model is +1 or −1, the function diverges. This overcomes the phenomenon of stagnant model training.When using the hyperbolic tangent function tanh as the model activation function, that is, f(t) = tanh(t), the error signal during model training changes fromδ=ftyk−dk to δ=yk−dk. At this time, the correction of model weight and threshold are, respectively, Δwjk=ηδyk and Δθj=ηδ. Since the adjustment of model parameters lacks the control of f(t), the adjustment process of the parameters is prone to oscillation.During the foraging process, the ant colony releases “pheromone” to carry out the information interaction between ant individuals, and the individual ants make route selection according to the pheromone concentration of the route to be selected. The pheromone concentration of the path to be selected is inversely proportional to the distance of the ant's foraging path. The ant colony “double-bridge” experiment is shown in Figure1.Figure 1
The ant colony “double-bridge” experiment.Among them, point B is the colony of ants, point A is the target food, and B-C-D-A or B-E-D-A is an alternative path for foraging. In the early stage of foraging, the pheromone concentrations of the two paths are the same, and the ants have the same path selection probability. In the later stage of foraging, the shorter path B-C-D-A will leave more pheromones. Because the ants make path selection based on the path pheromone concentration, the probability of the ants choosing the shorter path B-C-D-A is greater; that is, the shortest path B-C-D-A is found.Taking Figure1 as an example, we set b(t) to represent the number of ants on node i at time t, τij to represent the pheromone concentration of path i to i, and n to be the cutoff of the problem to be solved. The total amount of ants in the ant colony m is expressed as m=∑i=1nbit. The taboo table Tabuk represents all the paths that ant k has traversed, Tabuk changes dynamically with the path traversed by ant k, and pijkt represents the path transition probability of ant k from i to j at time t.(6)pijkt=τijtαηijtβ∑sτijtαηijtβ.Here,s represents the candidate path of ant k, and n (t) is the heuristic function of ant state transition, which represents the expected degree of the ant's transition from path i to j. The heuristic function of state transition can be expressed, where d represents the distance from path i to j. a is the information heuristic factor, which indicates the importance of the pheromone concentration to the path selection of ants, and ants tend to choose the path with high pheromone concentration. ß is the expected heuristic factor, which indicates how important the heuristic information is to the ant's path selection. Since the value of the heuristic function is inversely proportional to the distance of the path to be selected, ants are more inclined to choose a shorter path.Ant colony path optimization is a process based on the positive feedback of path residual pheromone concentration. Excessively high concentration of path pheromone will obscure the role of the heuristic function. The introduction of a pheromone volatilization mechanism can improve the above situation and update the path residual pheromone, and the formula is as follows:(7)τijt+n=1−ρτijt+Δτijt,Δτijt=∑k=1mΔτijk.Here,ρ is the pheromone volatilization factor, 1−ρ is the residual factor of the path pheromone, and Δτij is the increase in the path pheromone.The feedforward neural network model is shown in Figure2. It is composed of an input layer, an output layer, and a hidden layer. The input layer of the model has n neurons, which represent the n input parameters of the model. The output layer of the model has m neurons, which represent the m output parameters of the model. The hidden layer of the model has l neurons, and the model realizes the mapping from input to output through this layer.Figure 2
Feedforward neural network model.wij is the connection weight of the ith neuron in the input layer and the jth neuron in the hidden layer, and the weight matrix ω is(8)ω=ω11ω12⋯ω1nω21ω21⋯ω21⋮⋮⋱⋮ωl1ωl2⋯ωlnl×n.βjk is the connection weight between the jth neuron in the hidden layer of the model and the kth neuron in the output layer, the weight matrix from the hidden layer to the output layer is β, and b is the threshold value of the lth neuron in the hidden layer of the model.(9)β=β11β12⋯β1nβ21β21⋯β21⋮⋮⋱⋮βl1βl2⋯βlnl×nb=b1b2⋮bll×1.We set the number of training samples of the model toQ, and the activation function of the hidden layer unit to g(z), then the output matrix H of the model is(10)Hω1,ω2...ωl;b1,b2...bl;x1,x2...xl=gω1x1+b1gω2x1+b2⋯gωlx1+blgω1x2+b1gω2x2+b2⋯gωlx2+bl⋮⋮⋮⋮gω1xQ+b1gω2xQ+b2⋯gωlxQ+blQ×l.The target matrixT of the model is(11)T=t1t2⋯tQm×Q.Here, there are(12)tj=t1jt2j⋮tmj=∑i=1tβi1gωixj+bi∑i=1tβi2gωixj+bi⋮∑i=1tβimgωixj+bi,j=1,2,...,Q,ωi=ωi1ωi2⋯ωin;xj=x1jx2j⋯xnjT.In summary, the target matrixT of the single hidden layer feedforward neural network model can be expressed as T' = Hβ, where T is the transpose of T.The characteristics of a single hidden layer feedforward neural network are as follows:(1)
When the feedforward neural network has N training samplesxi,ti, where i = 1, 2, …, N, when the number of hidden layer units of the model is N and the activation function g(z) is infinitely differentiable in the solution interval, and when the hidden layer connection weight w and threshold value are randomly assigned, the output matrix H of the hidden layer is invertible and Hβ−T=0. Among them, ß is the output weight matrix of the hidden layer, and T is the target matrix output by the model.(2)
When the feedforward neural network model has N training samplesxi,ti, where i = 1, 2, …, N, when the number of hidden layer units of the model is K (K ≤ N) and the activation function g(z) is infinitely differentiable in the solution interval, and when the connection weight w and the threshold b of the hidden layer are randomly assigned, we give an arbitrary small error ε and ε>0, and there is Hβ−T<ε.It can be seen from the above conclusion that the feedforward neural network model has N training samples (xj, tj), where j = 1, 2, 3, …, N. The number of neurons in the hidden layer of the model is L, the actual output of the training model is oj, and the minimum error of the model is ∑j=1NOj−tj=0 This needs to calculate the input weight surface of the model, the hidden layer threshold b, and the hidden layer-output weight ß and make it satisfy Hω^i,b^i,β^i−T=minω,b,βHωi,bi,βi−T. This is equivalent to minimizing the loss function E=∑j=1N∑i=1Lβigωi,xj+bi−tj.Once the connection weightωi and hidden layer threshold bi from the input layer of the extreme learning machine to the hidden layer are determined, the output matrix H of the hidden layer of the model will also be uniquely determined.The training of the single hidden layer feedforward neural network is transformed into the solution of Hβ = T, and the output weight ß of the hidden layer of the model is determined from this, that is, β^i=H+T, where H+ is the Moore–Penrose generalized inverse matrix of the output matrix H.The training steps of the extreme learning machine model are as follows:(1)
The algorithm determines the model structure: determine the network structure of the input layer, output layer, and hidden layer of the model.(2)
The algorithm assigns the parameters including the connection weightω from the model input layer to the hidden layer and the hidden layer threshold b randomly assigned values.(3)
The algorithm sets the activation function. The hidden layer of the model sets an activation function g(z) with an infinite differentiable solution interval.(4)
The algorithm calculates the parameterβ^. According to the equation minβHβ−T′, the connection weight β^i=H+T′ from the hidden layer of the model to the output layer is obtained.The flow chart of the ELM algorithm is shown in Figure3.Figure 3
ELM algorithm flow chart.The extreme learning machine model and the BP neural network model are set to the same network structure. The extreme learning machine model has 5 input parameters, 1 output parameter, and 10 hidden layer neurons, and the activation function g(z) of the hidden layer neurons is set to tanh.


## 4. Algorithm Performance Test

The two prediction results of the extreme learning machine model are shown in Figure4, and the mean square error MSE and the goodness of fit R of the prediction results are shown in Table 1.Figure 4
The output result table of the ELM algorithm. (a) The mean square error (MSE) of the prediction result and (b) goodness of fit (R2).
(a)(b)Table 1
The output error of the ELM algorithm.
aBMSE0.00053800.000834100R20.97338000.9549600The training of the extreme learning machine model does not require repeated iterations. The training speed of the extreme learning machine is fast. By comparing the prediction results of the BP, ACO-BP, and ELM algorithm models, it can be seen that the prediction accuracy of the ELM algorithm model is higher than that of the BP and ACO-BP algorithm models. The ELM algorithm improves the long iteration period of the BP algorithm, and the parameter optimization is easy to fall into the local minimuml. As shown in Figures 4(a) and 4(b), although the training and test data used by the model are the same, the prediction results of the model are not completely consistent.The algorithm changes the fitness of the particles in the solution space by updating the spatial position and velocity of the particles. If the dimension of the problem to be solved isn, Xi=xi1,xi2,...,xin is the position vector of particle i, Vi=vi1,vi2,...,vin is the velocity vector of particle i, and the update formula of the particle's velocity V and spatial position X is as follows:(13)Vik+1=ωVik+c1r1Pbsetik−Xik+c2r2Pbsetk−Xik,Xik+1=Xik+Vik+1.Here,k is the number of iterations of the particle swarm algorithm, w is the inertia weight of the particle velocity update, and X is the position vector of the particle i. Pbset is the optimal position vector of the particle i, Gbset is the optimal position vector of the particle swarm, c1 and c2 are the acceleration factors of the particles, and r1 and r2 are random numbers between 0 and 1.In order to prevent particles from arbitrarily searching in the solution space, the particle velocityV and particle position X need to be set in a reasonable interval.The flow of the algorithm is shown in Figure5.Figure 5
Flow chart of particle swarm algorithm.Although the training rate and generalization ability of the extreme learning machine model can be better than that of the BP algorithm, the extreme learning machine also has the problem of uncertain hidden layer scale settings. If the number of hidden layer units is set too large, it will cause the model to learn overfitting, and if the number of hidden layer units is set too small, it will cause the model to learn underfitting.The arbitrariness of the initial parameter setting of the ELM algorithm model leads to the instability of model learning. Because the PSO algorithm has a better global search ability, in view of this defect of the extreme learning machine, the algorithm fusion of PSO and ELM is carried out. This paper uses the PSO algorithm to optimize the ELM model parameters usnxt and be, finds the generation results according to the algorithm, and then trains the ELM torture, as shown in Figure6.Figure 6
PSO-ELM algorithm flow chart.The inertia weightw is an important parameter of the particle swarm algorithm. The size of the inertia weight value affects the space search ability of particles. A larger inertia weight is conducive to the global search of particles, and a smaller inertia weight is conducive to the local search of particles. Particles need a larger inertia weight in the early stage of the search and a smaller inertia weight in the later stage of the search. The inertia weight of the algorithm is updated in a linearly decreasing manner, and the update formula of the inertia weight is as follows:(14)ω=ωmax−ωmax−ωminkmax,k.Here,ωmax and ωmin are the maximum and minimum values of the inertia weight, kmax is the maximum number of iterations of the algorithm, and k is the current number of iterations of the algorithm. The value range of the model parameters of the particle swarm algorithm is Xmin,Xmax, the acceleration factors are c1 and c2, and the maximum velocity of the particles is Vmax. The parameter settings of the particle swarm algorithm are shown in Table 2.Table 2
Parameter settings of particle swarm algorithm.
Number of particlesMaximum number of iterationskmaxValue range of inertia weightAcceleration factorsc1 and c2Parameter division rangeMaximum particle velocityVmax1050[0.4, 0.9]2[−1, 1]0.3The prediction results of the PSO-ELM algorithm are shown in Figure7.Figure 7
The prediction results of the PSO-ELM algorithm. (a) Test results of PSO-ELM algorithm and (b) iteration error.
(a)(b)Figure7(a) is the prediction output of the PSO-ELM algorithm, the mean error of the model prediction is 0.0000112, and the goodness of fit of the model output is 0.99848. Figure 7(b) shows the iterative error of the algorithm, which stabilizes after 40 iterations.The main indicator of the particle swarm algorithm is the number of particles, which determines the efficiency of the particle search in space. Different particle numbers are set for the PSO algorithm to explore the impact of the particle number on the PSO-ELM model.The parameter settings of the modified particle swarm algorithm are shown in Table3.Table 3
The parameter settings of the modified particle swarm algorithm.
Number of particlesMaximum number of iterationskmaxValue range of inertia weightAcceleration factorsc1 and c2Parameter division rangeMaximum particle velocityVmax5050[0.4, 0.9]2[−1, 1]0.3250[0.4, 0.9]2[−1, 1]0.3Figures8 and 9 show the iterative results of the PSO-ELM model when the number of particles is 50 and 2, respectively. Compared with the model iteration when the number of particles is 10, it can be seen that increasing the number of particles in the algorithm can effectively improve the prediction accuracy of the model. When the number of particles increases to 50, the prediction accuracy of the model still has a large room for improvement. When the number of particles decreases to 2, the model quickly converges to a larger value.Figure 8
Iterative results of the PSO-ELM algorithm model (par-50).Figure 9
Iterative results of the PSO-ELM algorithm model (par-2).Table4 shows the time required for the PSO-ELM algorithm model to complete 50 iterations. Compared with the ACO-ELM algorithm model, the iteration cycle (time) of the algorithm model is significantly shorter, and the iteration cycle has an approximately linear relationship with the number of particles.Table 4
Iteration cycle statistics of PSO-ELM algorithm.
Number of particlesModel training cycle (s)502325.21011.19The particle swarm algorithm is a simple heuristic algorithm. Both the particle swarm algorithm and the genetic algorithm belong to the bionic optimization algorithm. The parameter setting of the particle swarm algorithm is easier than that of the genetic algorithm, and the iteration efficiency of the particle swarm algorithm is higher than that of the genetic algorithm. The particle swarm optimization BP neural network (PSO-BP model) realizes the detection of the health state of the electric switch of the automobile. The experimental data of the article are selected from NASA's public data set, and the relative error of the model prediction is about 0.025. In this paper, only the average temperature and voltage are used as the input of the model, and other parameters of the automobile electrical switch are not analyzed. By constructing a prediction model for auxiliary installation of automotive electrical switches based on SVR and GPR algorithms, the prediction accuracy MSE of the model in the test set is 0.0014 and 0.00015, respectively, which are lower than the prediction accuracy of the fusion algorithm model used in this paper. Table5 shows the performance comparison between different algorithm models of the auxiliary installation prediction of automobile electrical switches.Table 5
Performance comparison between prediction models for auxiliary installation of automotive electrical switches.
Algorithm modelMean square error (MSE)Model training time (s)SVR1.480 × 10−38.90GPR1.530 × 10−410.40BP7.060 × 10−213.20ACO-BP9.970 × 10−4120.50ELM5.390 × 10−43.60GA-ELM3.160 × 10−525.70PSO-ELM1.130 × 10−523.10


## 5. CAD-Assisted 3D Assembly of Automobile Electrical Switch considering PSO-BP Neural Network Algorithm

This article takes the structure shown in Figure10 as the research object and explores the effect of CAD-assisted 3D assembly of automobile electrical switches taking into account the PSO-BP neural network algorithm. Through the algorithm of this paper, the simulation is carried out, the design effect of the process and the installation effect are counted, and the results are shown in Tables 6 and 7.Figure 10
Automotive electrical switch.Table 6
Process design effect.
No.Process designNo.Process designNo.Process design194.761394.962595.99294.711496.942691.94394.481593.912795.80495.171693.062895.30591.451794.112994.57695.051891.323094.92795.101992.553195.15891.912095.163291.02991.412195.023396.351093.472291.583494.521193.312395.363591.351292.072491.203692.19Table 7
Auxiliary installation effect.
No.Auxiliary installationNo.Auxiliary installationNo.Auxiliary installation191.771393.872590.36288.931489.072693.65391.161593.132790.42488.391692.312892.84590.471789.832992.45688.881890.413088.50791.811990.373188.85892.192090.383293.26989.412193.993393.041093.502293.583489.591189.102393.443590.551290.612492.623692.75From the above results, it can be seen that the CAD-assisted 3D assembly system of automobile electrical switches taking into account the PSO-BP neural network algorithm has good effects.


## 6. Conclusion

Automobile electrical switches are used in large quantities and have many varieties, which require sensitive and reliable work, and can adapt to harsh working environments such as large temperature differences and large vibrations. As long as the relationship between the components is defined as insertion or merging, the simulated three-dimensional assembly can be completed, and it can be used for interference checking of related components and analysis and calculation of mass and inertia. The application of computer-aided design can give full play to the graphics processing functions of the computer. By calling the prebuilt electrical switch parts library, the three-dimensional simulation assembly of automobile electrical switches can be realized so that the assembly process and realistic effects of the product can be seen in the design stage, which reduce the need for repeated trial production of the product and greatly improve the design quality and efficiency of automotive electrical switches. This paper combines the PSO-BP neural network algorithm to construct the CAD-assisted 3D assembly system of automotive electrical switches to improve the effectiveness of subsequent automotive electrical switch installation. [20].



---

*Source: 6454942-2022-05-05.xml*