Abstract

The gravity balance mechanism plays a vital role in maintaining the equilibrium for robots and assistive devices. The purpose of this paper was to optimize the geometry of a planar spring, which is an essential element of the gravity balance mechanism. To implement the optimization process, a hybrid method is proposed by combining the finite element method, the deep feedforward neural network, and the water cycle algorithm. Firstly, datasets are collected using the finite element method with a full experiment design. Secondly, the output datasets are normalized to eliminate the effects of the difference of units. Thirdly, the deep feedforward neural network is then employed to build the approximate models for the strain energy, deformation, and stress of the planar spring. Finally, the water cycle algorithm is used to optimize the dimensions of the planar spring. The results found that the optimal geometries of the spring include the length of 45 mm, the thickness of 1.029 mm, the width of 9 mm, and the radius of 0.3 mm. Besides, the predicted results determined that the strain energy, the deformation, and the stress are 0.01123 mJ, 33.666 mm, and 79.050 MPa, respectively. The errors between the predicted result and the verifying results for the strain energy, the deformation, and the stress are about 1.87%, 1.69%, and 3.06%, respectively.

1. 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]. These 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]. The 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. Therefore, 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]. The gravity balance mechanism is a combination of a torsion spring and a planar spring. This 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. The 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. Therefore, 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. Therefore, 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]. This 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]. Therefore, this study adopts the FEM to predict the behaviors of the PS. The DFNN is extended to model the performances [19]. The 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]. Therefore, before building the approximate models, the structure optimization of the DFNN needs to be performed. This 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. The proposed PS is desired to achieve the maximum strain energy but must ensure the required stiffness and durability when working. This is an optimization problem with many constraints. The WCA is capable of solving the optimization with multiple constraints [21, 22]. Therefore, 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.

2. Mechanical Design

2.1. Design of Gravity Balancing Mechanism

Figure 1 shows a design of a gravity balance mechanism. It consists of a bar that carries an object. The bar is connected to the planar spring (k2) through the pulley and cable. The 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 k1 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.

Then, the moment balance equation of the mechanical system is expressed as follows:where m1 is the mass of the bar, m2 is the mass of the object, L is the length of the bar, k1 is the stiffness of torsion spring, k2 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 m1 = 0.5 kg, the mass m2 of the object allows to be adjusted in the range from 0.5 kg to 3 kg. The 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.

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. The component springs are formed by arranging the leaf springs in parallel and series styles, as shown in Figure 3. The geometrical parameters of the PS include the thickness t, length L, width , radius r, height H, and width a.

3. 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. The main design parameters include the length L, width , thickness t, and radius r of the leaf spring. Therefore, 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)The 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)The 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)The strain energy is as large as possible so that the PS can do highly efficient work.(iv)The fatigue should also be considered. It is remarked that the performances of the PS often contradict each other. Therefore, the question arises as to how to balance these properties. So, the WCA optimization algorithm is applied to solve the optimization with multiple constraints.

3.1. 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. The leaf spring’s properties are very sensitive to length L, width , thickness t, and radius r. Therefore, these dimensions are chosen as the design variables. The 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. These 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. Therefore, the strain energy f1(X) is chosen as the objective function of the optimization process.

3.3. 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 and stress are selected as the constraints of the optimization process.

The optimization problem for the PS is briefly stated as follows:

Find: X = [r, l, t, ]

Subject to constraints,

4. 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. Then, 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. This method is carried out through 4 stages, as shown in Figure 4.

4.1. Stage 1: Mechanical Design

The mechanical design process is performed by the following steps:Step 1: identify the problemWhen 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 designBased on the requirements of the problem, the original gravity balance mechanism is designed, as shown in Figure 1. The principle of this mechanism is presented in Section 2.1. This study proposes the structure of PS as shown in Figure 2.Step 3: define design variables, objective functions, and constraintsThe 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. The objective function, constraint, and design variable are presented in Section 3.

4.2. Stage 2: General Numerical Data

The 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. The sequence of steps is as follows:Step 4: experiment designExperimental 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 dataSimulation 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. The simulation process is performed to collect data.Step 6: normalize dataThe 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. This 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. The standardization process is performed by the following formula:where zi is the normalized value and yi is the real value.

4.3. 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. The working diagram of the DFNN is shown in Figure 5. Net input (zij) of node jth of layer ith is calculated according to the following formula:where is the weighted input of the node jth of the hidden layer ith, bij is a constant value called bias, and output of node jth of layer (i − 1)th.

The net input of node jth of layer ith is then passed through an activation function to produce the output of node jth of layer ith, which is then transmitted to other neurons.where is the active function.

The 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. The optimization process for the structure of the DFNN is performed as follows:Step 7: define the objective function of the DFNN structure.The accuracy of the approximate model is usually assessed through coefficient of determination (R2) and mean squared error (MSE). In practice, if the value of MSE is smaller, the value of R2 will be larger and the predicted model is more accurate. Therefore, in this study, MSE is selected as the objective function to optimize the structure of the DFNN.The MSE and R2 are calculated by using the following formula:where yi is the ith observed value is the ith predicted value and n is the experiment number.Step 8: select the input parameters of the DFNN structureA 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. Therefore, to evaluate equity, this study proposes to choose 3 training functions: trainlb, traincgs, and trainscg.The 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: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. The 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. Therefore, in this study, the number of hidden layers is selected as 2, 3, and 4. The 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 DFNNTaguchi 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. The Taguchi method uses two major tools, including signal-to-noise ratio (S/N) and orthogonal array. There are three quality characteristics: “nominal is best,” “smaller is better,” and “larger is better.” Their mathematical formula can be presented as follows:Nominal is the best:The smaller is better:The bigger is better:where yi is responses, and N is repetition of ith experiment.The Taguchi method used orthogonal arrays to reduce the number of experiments required but ensured that design variables are evaluated independently. The 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 MSEAfter 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.

4.4. Stage 4: Optimization Using the WCA

The WCA is an optimal algorithm inspired by the water cycle. It was developed by Eskandar [21] and widely used to solve technical problems [2729]. However, this algorithm has not been applied to solve the problem of optimizing strain energy of the PS. The flowchart of the WCA is presented, as shown in Figure 6.Step 11: choose the initial parameters of the WCAInitial rain drops (Npop—initial population), number of rivers and sea (Nsr), maximum distance between streams and rivers, between rivers and sea dmax, and the maximum iteration must be preselected. Nsr and Nraindrop are calculated as follows:where Nsr is the number of sea and rivers, Npop is the number of the initial population, and Nraindrop is the number of streams.Step 12: generate random initial populationInitial population is generated by random variables as follows:where xij is the value of the variable ith of the raindrop jth, i is the number of variables, j is the number of the initial population, and Nvar is the number of variables.Step 13: calculate the value of the initial raindropIn 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 Pi is the initial raindrop value. i is raindrop.Step 14: determine the intensity of flow for rivers and seaThe raindrops flow to the rivers or sea depending on the intensity of the flow. The intensity of flow for rivers and sea are calculated by the following formula:where NSn is the number of streams flowing directly into the rivers or sea, Pn is the value of sea or rivers nthStep 15: the streams flow to the riversDuring the streams’ flow to rivers, the positions of streams are continuously updated. The new position for the stream is determined as follows:where rand is a random number that is chosen between 0 and 1, is the location of the stream ith, is the location of the river ith, and C is a value between 1 and 2.Step 16: the rivers flow to the seaSimilar 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, is the location of the stream ith, is the location of the river ith, and C is a value between 1 and 2.Step 17: exchange positions of the river with a streamTo 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 exchangedStep 18: exchange positions of the sea with a riverSimilar to streams, if the solution of the river is better than the sea, the positions of the sea and the river will be swappedStep 19: check the evaporation conditionEvaporation 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 new streams that flow into rivers and the sea. In the WCA, the condition evaporation is determined as follows:where dmax is small number (close to zero),When the distance from the river to sea is less than dmax, it means the river has flowed into the sea. Then, the evaporation process is applied. After the evaporation is completed, rain will begin to create a new cycle.Step 20: reduce the value of dmaxIn the WCA, the value of dmax controls the search intensity near the sea. If the value of dmax is large, then the search density will reduce while a small value for dmax will increase the search density near the sea. Therefore, the value for dmax has to adaptively decrease as:Step 21: check the convergence criteriaLike 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.

5. Results and Discussion

5.1. Collecting and Processing Data

To perform simulation and collect data, firstly, the experimental design was constructed by a full experimental design. The four design variables of PS include r, L, t, and , which are divided into three levels, as shown in Table 1. A matrix of experimental designs is formed, as seen in Table 2. Then, 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. The simulation process is set up as follows: the boundary condition and loads are given as shown in Figure 7. The 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. The mechanical properties of the material are given in Table 2. The mesh is divided by using the sizing method. The 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. The 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. The result meshes have 101190 elements and 632792 nodes. The quality of the mesh greatly affects the simulation results. Especially, the PS has large deformation. Therefore, 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. The quality of the mesh is assessed according to Skewness criteria. The 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. The quality of the mesh is assessed according to Orthogonal Quality criteria. The 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. The results of data collection are shown in Table 3.

The properties of the PS have different units. Therefore, in this study, datasets are normalized to eliminate the units of measurement for data. This normalization makes the evaluation process fair. Data are normalized using (6). Normalization results are presented in Table 4.

5.2. 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. The 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. The factors are divided with 3 levels as illustrated in Table 5 and the orthogonal array L9 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 R2. However, when the MSE is small, the R2 is large and the approximation model has high accuracy. Therefore, in this study, MSE is selected as the objective function for the structural optimization of the DFNN. The 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 79.

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.

The 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. The structure of the DFNN consists of 2 hidden layers for the smallest MSE value and 4 hidden layers with the largest error. The 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. The 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. Thus, 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. This 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. The 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. This 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: The 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: The 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: The 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. The 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).

In addition, to evaluate the accuracy of the proposed model, the value R2 and MSE of the proposed model are also compared with the value of the linear model. Table 14 compares the R2 value of the proposed model with the linear model for the 4 datasets: model, training, testing, and validation. The results indicate that the proposed model has much better R2 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 R2 for the datasets.

5.3. Optimal Results

After optimizing the structure of the DFNN, an alternative model using the DNFF was established. Then, the WCA algorithm was carried out using Matlab R2018a to optimize the parameters of the planar spring. The 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.

The optimal results were generated as Table 16. The 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. The 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. The standard deviation of energy when optimized by the WCA is also smaller than when optimized by the ER-WCA. The average search time also shows that the WCA has a shorter search time than the ER-WCA. The standard deviation of the search time of the WCA is also smaller than the ER-WCA. The 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.

6. Verifications

Optimized results are used to build the 3D model. The 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.

7. Conclusions

This paper proposes a method for the development and optimization of a planar spring used for a gravity balance mechanism. The 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. The effectiveness of the proposed method was tested by comparison with the optimal results of the ER-WCA. The comparison results show that the convergence speed and search stability of the proposed algorithm are better than the ER-WCA. The optimal parameters of PS are used to build 3D models. This 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. This 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. The optimization method will be utilized for other compliant mechanisms.

Data Availability

The data used to support the findings of this study are included within the article.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this article.

Acknowledgments

The authors are thankful for the financial support from the HCMC University of Technology and Education, Vietnam, under Grant No. T2021-01NCS.