Development and Optimization for a New Planar Spring Using Finite Element Method, Deep Feedforward Neural Networks, and Water Cycle Algorithm

Faculty of Mechanical Engineering, Ho Chi Minh University City of Technology and Education, Ho Chi Minh City, Vietnam Faculty of Mechanical Engineering, Industrial University of Ho Chi Minh City, Ho Chi Minh City, Vietnam Division of Computational Mechatronics, Institute for Computational Science, Ton Duc %ang University, Ho Chi Minh City, Vietnam Faculty of Electrical & Electronics Engineering, Ton Duc %ang University, Ho Chi Minh City, Vietnam


Introduction
A device is balanced when it can maintain equilibrium in any configuration or position without the need for external forces or actuators [1]. Generally, when a device achieves a gravity balance, it can move like in a gravity-less environment [2,3]. For a device to reach equilibrium, scientists have researched balancers to compensate for the gravity of machines. Gravity balances can be classified in the following ways: active balance and passive balance, and gravity balancer mechanisms can adjust loads or cannot adjust loads [4]. Besides, some other mechanisms employ counterweights, springs, or coupling of counterweights and springs [2]. Among them, a gravity balance mechanism with springs is of great interest for research by scientists because of its suitability in applications and simple adjustment [5,6]. ese types of mechanisms are capable of adjusting loads via using traditional springs [7,8].
Previously, a gravity balance mechanism with adjusted loads was designed by the combination of a compliant spring and a torsion spring [9]. Besides, a compliant rotary joint for the gravity balance mechanism was designed by creating a torque that balances the torque of the load [10]. e spring and the joint were built based on advantages of compliant mechanisms; however, the stiffness of the spring is not high [11].
Although scientists have had great success in studying many of the different types of mechanisms, a large amount of energy is still required during the adjustment process. erefore, the present study proposes a new gravity balance mechanism according to the principle of compliant mechanisms. Compliant mechanism is selected to create the planar spring (PS) because it is a monolithic mechanism, which offers less lubricant, no friction, and minimal cost of manufacturing [12]. e gravity balance mechanism is a combination of a torsion spring and a planar spring. is combination allows the spring to easily adjust its stiffness when adjusting the load. In the proposed balancing mechanism, the PS is a very important detail. e PS is deformed during the working process, and it creates a strain energy and elastic force to compensate for the gravity generated by the mass. In order to work well, the strain energy of the PS should offer as large as possible and the stiffness of the PS should be ensured to create an elastic force that balances with the gravity due to the mass. In addition, the stress concentration must be less than the permissible stress.
In order to serve for a practical application, the PS should concern a full set of performances, including deformation, strain energy, and stress. However, these desirable properties have mutual contradictions, and these properties are very sensitive to PS geometrical dimensions. erefore, optimization of the PS is necessary to balance its properties. In this study, an optimization process is performed to maximize or minimize one or more properties of the PS. It is noted that the proposed PS is designed based on the principle of compliant mechanisms. It is therefore difficult to build precisely mathematical models that show the relationship between deformation, stress, and strain energy with its geometrical factors. erefore, in this study, a hybrid method of finite element method (FEM), deep feedforward neural network (DFNN), and water cycle algorithm (WCA) is aimed to build surrogate models and optimize the geometry of the PS.
Nowadays, the FEM is a widely used method to solve complex arithmetic problems [13,14]. is method is capable of accurately predicting the phenomena and behavior of complex problems with little cost and time. Until now, the FEM has been used effectively to simulate the behavior of compliant mechanism [15,16], healthy human intervertebral discs [17], and double-row tapered roller bearing [18]. erefore, this study adopts the FEM to predict the behaviors of the PS. e DFNN is extended to model the performances [19]. e DFNN has the ability to approximate the relationships between the independent input variables to the output responses of highly nonlinearly complex models. However, the accuracy of the approximate model depends greatly on the structure of the DFNN [20]. erefore, before building the approximate models, the structure optimization of the DFNN needs to be performed. is process is to find the training function, the number of hidden layers, the number of nodes in each hidden layer, and the data division rate that best matches the dataset. e proposed PS is desired to achieve the maximum strain energy but must ensure the required stiffness and durability when working. is is an optimization problem with many constraints. e WCA is capable of solving the optimization with multiple constraints [21,22]. erefore, the WCA is used to optimize the geometry of the PS. Although there have been studies on many different gravity balance mechanisms, a full consideration of the performances of the spring has not been considered yet.
In summary, the present paper is aimed to optimize the geometry factors of a planar spring, which is used for the gravity compensation mechanism. To perform the optimization process, the FEM method is used to simulate and collect data. Next, regression models are built by the DFNN. Before using the DFNN, the structure of the DFNN is selected by optimizing the controllable parameters of the DFNN by using the Taguchi method. Finally, the WCA is applied to optimize the geometry of the planar spring. Figure 1 shows a design of a gravity balance mechanism. It consists of a bar that carries an object. e bar is connected to the planar spring (k 2 ) through the pulley and cable. e planar spring is combined with the pulley and cable to create a zero-free-length spring. At the hinge joint, a torsion spring with stiffness k 1 is considered as a rotation spring. During the working process, when the bar rotates clockwise by angle φ, the torsion spring is also deformed by an angle φ, and the planar spring is stretched by an amount equal to l. en, the moment balance equation of the mechanical system is expressed as follows:

Design of Gravity Balancing Mechanism.
where m 1 is the mass of the bar, m 2 is the mass of the object, L is the length of the bar, k 1 is the stiffness of torsion spring, k 2 is the stiffness of a spring of zero free length, and l is deformation of a spring of zero free length.
where a is the distance from the rotating center to the connection point of a spring of zero free length. In the proposed design, the bar is made of aluminum alloy with m 1 � 0.5 kg, the mass m 2 of the object allows to be adjusted in the range from 0.5 kg to 3 kg. e distance a is 65 mm and the length L of the bar is 400 mm. To ensure working requirements, the stiffness of the torsion spring is selected as 200 N/mm and the stiffness of the planar spring is adjustable in the range from 0.325 N/mm to 1.468 N/mm. Based on the required stiffness, a planar spring is designed in Section 2.2.

Design Planar Spring.
To ensure an adjustable stiffness in the range of 0.325 N/mm to 1.468 N/mm, deformation of the spring is required from 0 to 30 degrees, and the planar spring is designed with 31 component springs that are connected in series, as shown in Figure 2. e component springs are formed by arranging the leaf springs in parallel and series styles, as shown in Figure 3. e geometrical parameters of the PS include the thickness t, length L, width w, radius r, height H, and width a.

Formulation of Optimization Problem
In order to offer an efficient work for the gravity balance mechanism, the performances of the PS should be enhanced because the efficiency of the overall mechanism is highly dependent on the properties of the PS. Meanwhile, the performances of the PS are very sensitive to the geometrical dimensions of the leaf springs, as given in Figures 2 and 3. e main design parameters include the length L, width w, thickness t, and radius r of the leaf spring. erefore, if there is an expectation to improve the characteristics of the spring, the geometry of the leaf springs should be optimized. In this gravity balance mechanism, the spring should be met the following requirements: (i) e generated deformation has to be large enough so that the bar rotates at an angle from 0 to 30 degrees, and creates a moment for balancing. (ii) e generated stress must be less than the yield strength of the material. In this study, a maximum load of 3 kg and a stiffness of planar spring of 1.436 N/mm are utilized. (iii) e strain energy is as large as possible so that the PS can do highly efficient work. (iv) e fatigue should also be considered. It is remarked that the performances of the PS often contradict each other. erefore, the question arises as to how to balance these properties. So, the WCA optimization algorithm is applied to solve the optimization with multiple constraints.

Design Variables.
Based on the proposed design in Figures 2 and 3, the deformation, stress, and strain energy of the PS depend on the leaf springs' properties. e leaf spring's properties are very sensitive to length L, width w, thickness t, and radius r. erefore, these dimensions are chosen as the design variables. e limited dimensions of the design variables are selected based on the machining technology capabilities, the desired size of the system, and the designer's experience. ese are represented as follows: 3.2. Objective Function. As stated in the formulation of optimization problem above, the PS should posses a large strain energy to store and release a good elastic deformation. erefore, the strain energy f 1 (X) is chosen as the objective function of the optimization process.

Constraint Functions.
In order to ensure the gravity balance mechanism safely, the PS must create a large enough deformation so that the mechanism can work in the range of 0-30 degrees. In addition, the deformation of the PS should be sufficient to create a moment that is equal to the moment generated by the mass. In addition, the stress of the PS should be less than the yield strength when the mechanism is operating at maximum load to ensure that the spring works safely. Hence, the deformation g 1 (X) and stress g 2 (X) are selected as the constraints of the optimization process. e optimization problem for the PS is briefly stated as follows: Find: Subject to constraints, g 1 (X) � 33.646 mm,

Proposed Hybrid Optimization Approach
As discussed in Section 3, in order to ensure the efficient working of the gravity balancing mechanism, the PS must have three properties (deformation, stress, and strain energy). However, these properties have mutual contradiction. Hence, a hybridization of experiment design, FEM, DFNN, and WCA is developed. First, the experimental design is built by full factor experiment for collecting data. en, the DFNN was used to establish the approximate models. Before establishing an approximate model, the structure of the DFNN needs to be optimized to get the best structure of the DFNN. Finally, the WCA is employed to optimize the geometrical sizes of the spring. is method is carried out through 4 stages, as shown in Figure 4.

Stage 1: Mechanical
Design. e mechanical design process is performed by the following steps: Step 1: identify the problem When the working load is changed, the balance condition will be broken. Besides, when the load is adjusted, the gravity balance mechanism needs to be changed to maintain the equilibrium condition. One of the popular methods for adjusting the gravity balance mechanism is an adjustment of the stiffness of the spring. In this study, the proposed planar spring is designed to adjust easily the number of active leaf springs. So, the stiffness of PS can be adjusted without extra energy. To meet work requirements of the gravity balance mechanism, the design and optimization of the PS is essential.
Step 2: original design Based on the requirements of the problem, the original gravity balance mechanism is designed, as shown in Figure 1. e principle of this mechanism is presented in Section 2.1. is study proposes the structure of PS as shown in Figure 2.
Step 3: define design variables, objective functions, and constraints e PS is designed to meet technical requirements. A deformation must be large enough, the stress must be less than the yield strength, and the strain energy is large. e objective function, constraint, and design variable are presented in Section 3.

Stage 2: General Numerical Data.
e purpose of this stage is to create datasets to build the approximate models, and the datasets were generated by the numerical simulation in ANSYS 18.2 software. e sequence of steps is as follows: Step 4: experiment design Experimental design is the statistical technique that is widely used in product development. To accurately evaluate the effect of each design variable on the performance of a product, the full factor experiment is used.
Step 5: simulate and collect data Simulation is a technique of predicting the behavior of the structure. It is applied in engineering to reduce the costs of experimentation. A 3D model is built, and the boundary conditions and load are set up. e simulation process is performed to collect data.
Step 6: normalize data e properties of a planar spring have different units; to avoid the effect of the different units on the optimal result, the output response should be normalized. is normalization only changes the value of the response, but does not change the nature of the data. Moreover, this process can evaluate fairly. In this study, the properties of PS need to be standardized to unify the units. e standardization process is performed by the following formula: where z i is the normalized value and y i is the real value.

Stage 3: Optimize the Structure of the DFNN.
To approximate the relationship between the geometry sizes and the output characteristics of the PS, the DFNN is applied to create regression models. e working diagram of the DFNN is shown in Figure 5. Net input (z i j ) of node j th of layer i th is calculated according to the following formula: where w j i is the weighted input of the node j th of the hidden layer i th , b i j is a constant value called bias, and a j i−1 output of node j th of layer (i − 1) th . e net input of node j th of layer i th is then passed through an activation function to produce the output of node j th of layer i th , which is then transmitted to other neurons.
where g is the active function. e approximate models are greatly dependent on the structure of the DFNN and the actual data. To get the exact approximate models, the structure of the DFNN is optimized in this study. e optimization process for the structure of the DFNN is performed as follows: Step 7: define the objective function of the DFNN structure.
e accuracy of the approximate model is usually assessed through coefficient of determination (R 2 ) and mean squared error (MSE). In practice, if the value of MSE is smaller, the value of R 2 will be larger and the predicted model is more accurate. erefore, in this study, MSE is selected as the objective function to optimize the structure of the DFNN. 4 Mathematical Problems in Engineering   Mathematical Problems in Engineering e MSE and R 2 are calculated by using the following formula: where y i is the ith observed value y i is the ith predicted value and n is the experiment number.
Step 8: select the input parameters of the DFNN structure A basic structure of the DFNN includes the number of hidden layers, the number of nodes in each hidden layer, training function, activation function, bias coefficient, ratio of division of data for training, validation, and testing. However, in this study, the number of hidden layers, the number of nodes in each hidden layer, the transfer function and the ratio of division of data are chosen as controllable variables. Normally, researchers usually use training functions: trainlm, trainbr, and trainscg. However, trainbr only uses 2 datasets: training and validating while the other transfer functions use 3 datasets: training, validating, and testing. erefore, to evaluate equity, this study proposes to choose 3 training functions: trainlb, traincgs, and trainscg. e number of nodes in hidden layers can be selected differently based on the position of the hidden layer and the number of nodes of the input layer. According to Chen [23], the number of nodes in the hidden layer can be calculated as follows: number node of hidden layer 1 � 2x + 1, number node of hidden layer i + 1 � n(2x + 1), where x is the number of input variables, and n is the number of output variables. In this study, x � 4 and n � 1, so the number of nodes in each hidden layer is selected around 9. According to Seo et al. [20], the accuracy of the approximate models can be improved as the number of hidden layers increases. However, the complexity of the algorithm also increases. e authors also indicate that when the number of hidden layers is equal or larger than 4, the accuracy increased slightly. For the data that have a small signal to noise, the approximate model has a good accuracy as well when using 2 or 3 hidden layers. erefore, in this study, the number of hidden layers is selected as 2, 3, and 4. e ratio of division of data for training, validating, and testing is chosen with the ratios of 60 : 20 : 20, 70 :15 :15, and 80 :10 :10.
Step 9: collect data and optimize the structure of the DFNN Taguchi is often used to improve a product's quality [24]. Nowadays, the Taguchi method is widely used to solve technical problems, especially for the single-objective problem with discrete variables [25,26]. Hence, it is chosen to optimize the structure of the DFNN. e Taguchi method uses two major tools, including signalto-noise ratio (S/N) and orthogonal array. ere are three quality characteristics: "nominal is best," "smaller is better," and "larger is better." eir mathematical formula can be presented as follows: Nominal is the best: e smaller is better: e bigger is better: where y i is responses, and N is repetition of i th experiment. e Taguchi method used orthogonal arrays to reduce the number of experiments required but ensured that design variables are evaluated independently. e purpose of this step is to find the structure of the DFNN that best matches the existing dataset by minimizing MSE by using equation (12).
Step 10: evaluate the value of MSE After optimizing the structure of the DFNN, the value of MSE has to be evaluated to find the most suitable structure for the dataset. If the value of MSE is not satisfied, it means that the most suitable structure has not been found, then go back to step 8. If the value of MSE is satisfied, then go to the next step.

Stage 4: Optimization Using the WCA.
e WCA is an optimal algorithm inspired by the water cycle. It was developed by Eskandar [21] and widely used to solve technical problems [27][28][29]. However, this algorithm has not been applied to solve the problem of optimizing strain energy of the PS. e flowchart of the WCA is presented, as shown in Figure 6.
Step 11: choose the initial parameters of the WCA Initial rain drops (N pop -initial population), number of rivers and sea (N sr ), maximum distance between streams and rivers, between rivers and sea d max , and the maximum iteration must be preselected. N sr and N raindrop are calculated as follows: N sr � number of rivers + sea, where N sr is the number of sea and rivers, N pop is the number of the initial population, and N raindrop is the number of streams. 6 Mathematical Problems in Engineering Step 12: generate random initial population Initial population is generated by random variables as follows: where x i j is the value of the variable i th of the raindrop j th , i is the number of variables, j is the number of the initial population, and N var is the number of variables.
Step 13: calculate the value of the initial raindrop In order to select raindrops representing the sea and rivers, the value of the initial raindrop needs to be calculated and they are calculated according to the following formula: where P i is the initial raindrop value. i is raindrop.
Step 14: determine the intensity of flow for rivers and sea e raindrops flow to the rivers or sea depending on the intensity of the flow. e intensity of flow for rivers and sea are calculated by the following formula: where NS n is the number of streams flowing directly into the rivers or sea, P n is the value of sea or rivers n th Step 15: the streams flow to the rivers During the streams' flow to rivers, the positions of streams are continuously updated. e new position for the stream is determined as follows: where rand is a random number that is chosen between 0 and 1, X i stream is the location of the stream i th , X i river is the location of the river i th , and C is a value between 1 and 2.
Step 16: the rivers flow to the sea Similar to a stream, when rivers flow to the sea, the position of the river is always updated, and the new position of the river is determined as follows: where rand is a random number that is chosen between 0 and 1, X i river is the location of the stream i th , X i sea is the location of the river i th , and C is a value between 1 and 2.
Step 17: exchange positions of the river with a stream To offer the best solution, the new cost of a stream is updated. If the solution given by a stream is better than its connecting river, the positions of the river and stream are exchanged Step 18: exchange positions of the sea with a river Similar to streams, if the solution of the river is better than the sea, the positions of the sea and the river will be swapped Step 19: check the evaporation condition Evaporation is one factor that prevents the algorithm from being optimized locally. As seen in nature, water from ponds, lakes, rivers, streams, seas, and the ground evaporates into clouds. Clouds fly up high then condense in the cold air to form water particles. Water particles fall down and form rain. Raindrops will form Mathematical Problems in Engineering new streams that flow into rivers and the sea. In the WCA, the condition evaporation is determined as follows: where d max is small number (close to zero), When the distance from the river to sea is less than d max , it means the river has flowed into the sea. en, the evaporation process is applied. After the evaporation is completed, rain will begin to create a new cycle.
Step 20: reduce the value of d max In the WCA, the value of d max controls the search intensity near the sea. If the value of d max is large, then the search density will reduce while a small value for d max will increase the search density near the sea. erefore, the value for d max has to adaptively decrease as: Step 21: check the convergence criteria Like other optimization algorithms, the stop condition of the WCA algorithm can be based on the maximum number of iterations, the CPU time, or the error between the last two results less than a certain tolerance value. If the stopping condition is satisfied, the optimization will be finished, otherwise return to step 5.

Collecting and Processing Data.
To perform simulation and collect data, firstly, the experimental design was constructed by a full experimental design. e four design variables of PS include r, L, t, and w, which are divided into three levels, as shown in Table 1. A matrix of experimental designs is formed, as seen in Table 2. en, 3D models of the PS are drawn by Inventor software as shown in Figure 2. Next, the simulation for data collection is performed through ANSYS 18.2.
In this study, a nonlinear FEM is applied for the simulation process. e simulation process is set up as follows: the boundary condition and loads are given as shown in Figure 7.
e PS is fixed with two holes, and a force of 10.935 N is applied to the top surface of the PS. Al T63-7075 is selected for the PS. e mechanical properties of the material are given in Table 2. e mesh is divided by using the sizing method. e element size greatly affects the behavior of the PS. So, before the simulation, an exploratory meshing was performed to ensure the good results at the lowest computational cost. e results show that the smaller the mesh size, the larger the processing time and memory used for the simulation. However, if the mesh size is 1 mm, the deformation, stress, and strain energy change very little. Hence, a mesh size of 1 mm is chosen for this study. e result meshes have 101190 elements and 632792 nodes. e quality of the mesh greatly affects the simulation results.
Especially, the PS has large deformation. erefore, in this study, two mesh quality assessment standards are used at the same time. Skewness standard and Orthogonal Quality standard are utilized as two criteria to evaluate the quality of meshing. e quality of the mesh is assessed according to Skewness criteria. e results indicate that the average value of the meshing metric is about 0.21141, and the standard deviation of the meshing metric is approximately 0.194, as shown in Figure 8. According to the Skewness criteria, this value proved that the accuracy of meshing models is excellent.
e quality of the mesh is assessed according to Orthogonal Quality criteria.
e results indicate that the average value of the meshing metric is about 0.93498, and the standard deviation of the meshing metric is approximately 0.0751, as given in Figure 8. According to the Orthogonal Quality criteria, this value proved that the accuracy of meshing models is very good.
In this study, strain energy is considered an objective function; therefore, strain energy is a factor that needs data collection. In addition, deformation and stress are considered constraints so they also need to be collected as data. e results of data collection are shown in Table 3.
e properties of the PS have different units. erefore, in this study, datasets are normalized to eliminate the units of measurement for data.
is normalization makes the evaluation process fair. Data are normalized using (6). Normalization results are presented in Table 4.

Optimization of the DFNN Structure.
As presented in Section 4, the DFNN is used to approximate the relationship between the design variable and the output characteristics. e accuracy of the approximated model depends on the structure of the DFNN. In this study, four factors of the DFNN structure are selected: training function, number of hidden layers, number of nodes in each hidden layer, and the division ratio of the dataset to create the most accurate approximated model possible. e factors are divided with 3 levels as illustrated in Table 5 and the orthogonal array L 9 is used to establish the experimental plan as shown in Table 6.
As shown in Section 4, normally, the approximation model's accuracy is measured through two indices MSE and R 2 . However, when the MSE is small, the R 2 is large and the approximation model has high accuracy. erefore, in this study, MSE is selected as the objective function for the structural optimization of the DFNN. e approximate results depend on a weighted input that selects random as equation (7). So, in order to optimize the structure of the DFNN, each experiment is performed 10 times to collect data for MSE. MSE data collection results for deformation, stress, and strain energy are presented in Tables 7-9.
Based on MSE results obtained for deformation, stress, and strain energy, the S/N calculation and analysis for each experiment are performed, then ranking process for each input parameter of the DFNN structure are performed. e S/N analysis results for deformations ( Figure 9) show that, the training function "Trainlm" has the smallest error and the function "Trainscg" gives the largest error. e structure of the DFNN consists of 2 hidden layers for the smallest MSE value and 4 hidden layers with the largest error. e results found that when the number of nodes is 7 nodes, the error of the DFNN model is the smallest. Meanwhile, the when the number of nodes is 9 nodes, the error of the DFNN model is the largest. Besides, when the data are divided into the ratio of 60:20:20, the error of the DFNN model is the smallest; while the data ratio is 80:10:10, the error of the DFNN model is the largest. e analysis results also show that the training function in the DFNN structure has the greatest impact on the accuracy of the approximate model and the number of nodes in each hidden layer has the least effect on the accuracy of the equivalent model as shown in Table 10.
For the stress dataset, Figure 10 shows that the training function "Trainlm" gives the largest S/N value and the training function "Trainscg" the minimum S/N value. us, the accuracy of the approximate model is best achieved using the training function "Trainlm." At the same time, the number of hidden layers is 2, the number of nodes in a hidden layer is 7, and the data division ratio 70 : 15 : 15 gives the largest S/N. is means that the approximate model has the highest accuracy when the structure has 2 hidden layers, the number of nodes in each hidden layer is 7, and the data division ratio is 70 : 15 : 15. Table 11 also shows that, with data for stress, the number of layers hidden in the DFNN structure has the most influence on the accuracy of the approximate model. Figure 11 depicts the calculation and analysis S/N results for the strain energy dataset. e results show the DFNN structure with the training function of "Trainlm," the number of hidden layers of 2, the number of nodes in each hidden layer of 7, and the data division ratio of 60 : 20 : 20 give the best accurate approximate model. Table 12 shows that the number of hidden layers is ranked the highest. is means that among the four factors of the DFNN structure, the number of hidden layers has the highest influence on the accuracy of the approximate model. Table 13 shows that for the deformation dataset, the optimal structure of the DFNN is: e training function is "trainlm," the number of hidden layers is 2, the number of nodes in hidden layers is 7, and the data division ratio is 60 : 20 : 20. For the stress dataset, the optimal structure of the DFNN is: e training function is "trainlm," the number of hidden layers is 2, the number of nodes in hidden layers is 11, and the data division ratio is 70 : 15 : 15. For the strain energy dataset, the optimal structure of the DFNN is: e training function is "trainlm," the number of hidden layers is 2, the number of nodes in hidden layers is 9, and the data division ratio is 60 : 20 : 20.
To evaluate the effectiveness of the structure of the DFNN, the appropriateness of the approximate model built by the DFNN and the linear model is compared with each other.       Figure 12 compares the suitability of the proposed model with a linear model. Figure 12(a) shows that the predicted points of the proposed model are more suitable with the experimental point than the linear model for the deformation dataset. e predicted points of the proposed model are distributed around the good fitness line. Similarly, the proposed model has better fitness between the predicted points and the experimental points than the linear model for stress and strain energy datasets, as shown in Figures 12(b) and 12(c).

Mathematical Problems in Engineering
In addition, to evaluate the accuracy of the proposed model, the value R 2 and MSE of the proposed model are also compared with the value of the linear model. Table 14 compares the R 2 value of the proposed model with the linear model for the 4 datasets: model, training, testing, and validation. e results indicate that the proposed model has much better R 2 than the linear model. Table 15 also shows that the MSE of the proposed model is smaller than the error of the linear model for all three sets of deformation, stress, and strain energy data.
As illustrated in Figure 13(a), the MSE values of the training dataset of the deformation continuously decreased at the 9th epoch, but the MSE values of the testing and validating dataset still remained stable. As depicted in Figure  13(b), the MSE values of the training datasets of the stress still decreased, but the MSE values of the testing and validating datasets remained stable at 9th epoch. As depicted in Figure 13(c), the MSE values of the training datasets of the strain energy still decreased, but the MSE values of the testing and validating datasets remained stable at 8th epoch. Figure 14 demonstrates that the errors of the three training, evaluation, and test datasets of all three sets of deformation, stress, and strain energy datasets are almost zero. Figure 15 also demonstrates that the appropriateness of the approximate models is constructed by the DFNN through the value of R 2 for the datasets.

Optimal Results.
After optimizing the structure of the DFNN, an alternative model using the DNFF was established. en, the WCA algorithm was carried out using Matlab R2018a to optimize the parameters of the planar spring. e parameters of the WCA were initialized as initial rain drops of 50, number of rivers and sea of 4, maximum distance between streams and rivers, between river and sea of 10 −5 , and the maximum iteration of 2000.
e optimal results were generated as Table 16. e evaporation-rate-based water cycle algorithm (ER-WCA) was developed based on the WCA to speed up convergence [29]. However, with the proposed PS, the WCA has higher convergence rate and stability than the ER-WCA. e results in Table 16 show that the optimal mean strain energy is 0.01123 when optimized by the WCA. It is higher than the ER-WCA optimal value. e standard deviation of energy when optimized by the WCA is also smaller than when optimized by the ER-WCA. e average search time also shows that the WCA has a shorter search time than the ER-WCA. e standard deviation of the search time of the WCA is also smaller than the ER-WCA. e optimal results show that the optimal parameters of the planar spring t, L, w, and r is 1.029 mm, 45 mm, 9 mm, 0.3 mm, respectively.

Verifications
Optimized results are used to build the 3D model. e model was then used for finite element analysis. Finite element analysis results are presented in Table 17 and Figure 16. FEM results show with optimal parameters. Characteristics of planar spring with strain energy, stress, deformation, and life are 0.01102 mJ, 34.236 mm, 81.475 MPa, and 299 million cycles, respectively. Comparison between the prediction results with the FEM results shows that the strain energy error is 1.87%, the strain error is 1.69%, and the stress error is 3.06%. With                          small error values, it shows that the proposed optimal method has high reliability.

Conclusions
is paper proposes a method for the development and optimization of a planar spring used for a gravity balance mechanism. e proposed method is a combination of finite FEM, DFNN, and WCA. First, the FEM was used to collect data. Next, the approximated model was constructed using the DFNN, and finally, the geometry of the planar spring was optimized by the WCA. e effectiveness of the proposed method was tested by comparison with the optimal results of the ER-WCA. e comparison results show that the convergence speed and search stability of the proposed algorithm are better than the ER-WCA. e optimal parameters of PS are used to build 3D models. is model is used to be FEM. Comparing the FEM results with the optimal prediction results shows that the errors of energy strain, deformation, and stress are 1.87%, 1.69%, and 3.06%, respectively. is error shows that the proposed solution is highly robust. In addition, the life of the PS was also predicted with 299 million cycles. For future research, prototypes will be manufactured and measured to verify the numerical results. e optimization method will be utilized for other compliant mechanisms.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this article.