An example-based method and system for tolerance optimization of locking and unlocking mechanisms

By using an instance-based tolerance optimization method for opening and closing mechanisms, and leveraging the KNN algorithm and objective optimization model, the economic problem of tolerance design and allocation in firearm manufacturing was solved, achieving a balance between assembly accuracy and cost, and improving production efficiency and part quality.

CN120354574BActive Publication Date: 2026-06-02WEAPON EQUIP RES INST OF CHINA NAT WEAPON EQUIP GRP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WEAPON EQUIP RES INST OF CHINA NAT WEAPON EQUIP GRP
Filing Date
2025-02-14
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

How to rationally design and allocate component tolerances while ensuring assembly accuracy in order to reduce production costs and improve production efficiency, especially in firearms manufacturing, where existing technologies struggle to maintain economic efficiency while improving design accuracy.

Method used

An instance-based tolerance optimization method for opening and closing mechanisms is adopted. The similarity between the design requirements and the instance library is calculated by the KNN algorithm to select similar design instances. Based on the objective optimization model of processing cost and quality loss function, the tolerance information is optimized to meet the design requirements. At the same time, process capability index and tolerance accumulation are considered as constraints.

Benefits of technology

While ensuring assembly accuracy, we comprehensively consider processing costs and process capability index to optimize the tolerance design of firearm parts, improve production efficiency, reduce production costs, and improve part quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120354574B_ABST
    Figure CN120354574B_ABST
Patent Text Reader

Abstract

This invention proposes an example-based tolerance optimization method and system for locking and unlocking mechanisms, belonging to the field of intelligent firearms manufacturing. The method optimizes the tolerance design of the locking and unlocking mechanism by comprehensively considering processing costs and process capability indices while ensuring qualified assembly accuracy. Based on a tolerance example library of locking and unlocking mechanisms, the method constructs optimization objectives for product processing costs and quality losses through contribution analysis and calculation. It establishes an objective optimization model with process capability indices and tolerance accumulation as constraints, achieving a balance between processing costs and assembly quality losses. This invention can meet the design accuracy requirements of precision manufacturing, improve production efficiency, enhance part quality, and further reduce production costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent firearms manufacturing, and in particular relates to an example-based method and system for optimizing the tolerance of opening and closing mechanisms. Background Technology

[0002] Assembly accuracy is a crucial quality indicator for evaluating assembly process quality. During actual product use, to ensure components perform their intended functions correctly, it is essential to control the positional accuracy, mating accuracy, and relative motion accuracy between components, while maintaining assemblability. In the manufacturing process, assembly accuracy is primarily controlled through adjustments to the assembly process; while in the design phase, it is mainly ensured through the machining accuracy of the component designs. However, increasing the design accuracy of components raises manufacturing costs and impacts the economics of the manufacturing process. Therefore, the rational design and allocation of tolerances is a vital means of ensuring assembly accuracy. Summary of the Invention

[0003] To address the aforementioned technical problems, this invention proposes an example-based method and system for optimizing the tolerances of opening and closing mechanisms.

[0004] The first aspect of this invention discloses an example-based tolerance optimization method for opening and closing mechanisms, the method comprising:

[0005] Step S1: Based on the new design requirements, traverse the tolerance knowledge instance library, calculate the similarity between the new design requirements and each design instance, sort them according to the similarity, and select K design instances with a similarity threshold as similar design instances; wherein, the tolerance knowledge instance library stores multiple design instances, each design instance includes key measurement dimensions, nominal dimensions of parts, and tolerance information; key measurement dimensions and nominal dimensions of parts belong to design requirements;

[0006] Step S2: Calculate the assembly accuracy based on the tolerance information in each similar design instance, and then determine whether the tolerance information in any similar design instance meets the new design requirements based on the calculated assembly accuracy; wherein,

[0007] If the tolerance information in K similar design instances does not meet the new design requirements, perform the following steps:

[0008] Based on the objective optimization model of processing cost and quality loss function, and with process capability index and tolerance accumulation as constraints, the tolerance information in any similar design instance is optimized to obtain a design scheme that meets the new design requirements.

[0009] Optionally, in step S1, the KNN algorithm is used to calculate the similarity between the new design requirements and the requirements of each design instance.

[0010] Optionally, in step S2, the formula for calculating assembly accuracy is:

[0011]

[0012] Among them, T mi To calculate the assembly accuracy, T i λ represents the i-th tolerance value in the tolerance information, and n represents the number of tolerances in the tolerance information; i is the weighting coefficient for the i-th tolerance.

[0013] Optionally, in step S2, the target optimization model is:

[0014]

[0015] Where min represents minimization; C is the objective function; ω i The weighting coefficients are calculated based on the contribution of component characteristics; T i C represents the i-th tolerance value in the tolerance information, where n is the number of tolerances in the tolerance information; m (T i ) is the processing cost function of the component characteristic tolerances. Where c0, c1, c2, and c3 are known parameters related to the tolerance; L(T i ) represents the characteristic mass loss function of the component. Where A represents the product's limit loss within the tolerance specification, and T represents the design tolerance.

[0016] Optionally, in step S2, the constraints include:

[0017]

[0018] C pk min ≤C pk ≤C pk max

[0019]

[0020] T i ≤T

[0021] Among them, C Pmin C is the lower limit of the process capability index. Pmax C represents the upper limit of the process capability index. Pi Let σ be the process capability index corresponding to the i-th tolerance; σ be the standard deviation of the process in a steady state; C Pkmin C represents the lower limit of the actual process capability index. Pkmax C represents the upper limit of the actual process capability index. Pk This is the actual process capability index. Where USL and LSL are the upper and lower limits of tolerance control requirements, respectively, and are key measurement dimensions in the new design requirements; μ is the mean of the statistical dimension distribution during actual machining; λ i T is the weighting factor for the i-th tolerance. 0i To meet the new design requirements for assembly precision.

[0022] Optionally, the method further includes:

[0023] S3 stores the design solutions for new design requirements as design instances in the tolerance knowledge instance library.

[0024] A second aspect of this invention discloses an example-based tolerance optimization system for opening and closing mechanisms, the system comprising:

[0025] The first processing module is configured to traverse the tolerance knowledge instance library based on the new design requirements, calculate the similarity between the new design requirements and each design instance, sort the requirements according to the similarity, and select K design instances with similarity values ​​higher than the similarity threshold as similar design instances. The tolerance knowledge instance library stores multiple design instances, and each design instance includes key measurement dimensions, nominal dimensions of parts, and tolerance information. Key measurement dimensions and nominal dimensions of parts are part of the design requirements.

[0026] The second processing module is configured to calculate the assembly accuracy based on the tolerance information in each similar design instance, and then determine whether the tolerance information in any similar design instance meets the new design requirements based on the calculated assembly accuracy; wherein...

[0027] If the tolerance information in K similar design instances does not meet the new design requirements, perform the following actions:

[0028] Based on the objective optimization model of processing cost and quality loss function, and with process capability index and tolerance accumulation as constraints, the tolerance information in any similar design instance is optimized to obtain a design scheme that meets the new design requirements.

[0029] In summary, the proposed solution of this invention has the following technical effects: While ensuring qualified assembly accuracy, this method comprehensively considers processing costs and process capability indices to optimize the tolerance design of the locking and unlocking mechanism. Based on a tolerance instance library of locking and unlocking mechanisms, this method constructs optimization objectives for product processing costs and quality losses through contribution and sensitivity analysis and calculation. It establishes an objective optimization model with process capability indices and tolerance accumulation as constraints, achieving a balance between processing costs and assembly quality losses. The aim is to meet the design accuracy requirements of precision manufacturing, improve production efficiency, enhance part quality, and thereby further reduce production costs. Attached Figure Description

[0030] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0031] Figure 1 A flowchart illustrating an example-based tolerance optimization method for an opening and closing mechanism according to an embodiment of the present invention;

[0032] Figure 2 This is a flowchart of the KNN algorithm according to an embodiment of the present invention;

[0033] Figure 3 This is a flowchart of the tolerance design based on the K-nearest neighbor algorithm according to an embodiment of the present invention;

[0034] Figure 4 This is a schematic diagram of the contribution analysis calculation model according to an embodiment of the present invention;

[0035] Figure 5 This is a structural diagram of an example-based tolerance optimization system for an opening and closing mechanism according to an embodiment of the present invention;

[0036] Figure 6 This is a structural diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0037] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0038] According to an embodiment of the present invention, in a first aspect, an example-based tolerance optimization method for locking and unlocking mechanisms is provided; see [link to relevant documentation]. Figure 1 The method includes:

[0039] Step S1: Based on the new design requirements, traverse the tolerance knowledge instance library, calculate the similarity between the new design requirements and each design instance, sort them according to the similarity, and select K design instances with a similarity threshold as similar design instances; wherein, the tolerance knowledge instance library stores multiple design instances, each design instance includes key measurement dimensions, nominal dimensions of parts, and tolerance information; key measurement dimensions and nominal dimensions of parts belong to design requirements;

[0040] Optionally, in step S1, the KNN algorithm is used to calculate the similarity between the new design requirements and the requirements of each design instance. The K-Nearest Neighbors algorithm, also known as the KNN algorithm, works on the principle that if a sample can find K most similar (i.e., nearest neighbor) samples in the feature space, and most of these samples belong to a certain category, then the sample also belongs to that category. In other words, it calculates the distance between the test sample and all samples in the sample set based on a distance function, then finds the K closest samples to the test sample based on the distance, and uses these K samples to determine the category of the test sample. The KNN algorithm flow is as follows: Figure 2 As shown.

[0041] The KNN algorithm is the simplest machine learning algorithm, and its theoretical framework is quite comprehensive. Its advantage is that no training is required; the user only needs to input samples, and the system automatically classifies them. When solving for the test sample, the system automatically performs calculations and provides the K nearest neighbors. Therefore, the KNN algorithm is very convenient to use and suitable for multi-class classification problems. However, this algorithm also has certain limitations. KNN suffers from imbalanced samples and is prone to overfitting. When the sample set contains a large number of samples, the KNN algorithm tends to favor including those samples in its algorithm.

[0042] Considering that in actual product development, a large portion of products are designed by optimizing existing products rather than starting from scratch, this application optimizes the firearm design process using the KNN algorithm. When faced with the design requirements of a new product, it first calculates the similarity between instances selected from the tolerance knowledge instance library and the problem to be solved, sorts the instances according to their similarity, selects the K nearest neighbor similar instances, determines the instance category attribute of the new requirement, and finally outputs a product design scheme for designers' reference, saving the generated new instances to the tolerance knowledge instance library. The process is as follows: Figure 3 As shown.

[0043] This application establishes an intelligent design method for tolerances of typical firearm mechanisms by employing the KNN algorithm. Based on previous knowledge and experience of tolerances for mechanical components, the KNN algorithm is used to classify and filter instances in the instance library, thereby realizing a tolerance allocation scheme for the mechanical components of new firearm products. This effectively improves product development efficiency, greatly shortens the development cycle, and enhances product reliability.

[0044] Step 1a: Instance representation model based on matter-element analysis method

[0045] Representing instances in the tolerance knowledge database is the most fundamental and primary problem to be solved based on the KNN classification algorithm. The quality of the instance representation directly affects the quality of instances selected by the KNN classification algorithm. In the tolerance intelligent design system, the design features, design parameters, and design requirements involved in the tolerance design of various typical mechanical parts are not entirely the same. Therefore, representing the instances in the tolerance knowledge instance database is a primary problem to be solved. To better represent tolerance knowledge instances, this application adopts the matter-element analysis method to represent tolerance instances.

[0046] Matter-element analysis is often used to solve difficult problems that traditional mathematical analysis methods cannot address. The matter-element model typically describes things using ordered triples. Let N be the object under study, C be the characteristics of the object, and X be the characteristics of the object. i The corresponding specific values, and the object of study, object characteristics, and values ​​are called the three elements of matter.

[0047] Assume instance object N m There are n features C = [c1, c2, ..., c n ], and the corresponding quantity is X = [x1, x2, ..., x n The matter-element model of the instance is then represented as:

[0048]

[0049] The instance matter-element model R is also known as the n-dimensional matter-element.

[0050] Step 1b: Instance similarity calculation

[0051] In the KNN algorithm, the concept of similarity is introduced to describe the distance between two instances, typically using Euclidean distance, cosine distance, and city distance, among others. In the KNN algorithm system, traditional nearest neighbor classifiers assign equal weight to each attribute in the sample for similarity calculation. However, in some cases, when features are weakly or unrelated to the classification, this can mislead the classification results and lead to significant biases.

[0052] Therefore, in order to better describe the similarity between instances, this application further calculates the similarity based on the instance representation model of the matter-element method. First, after determining the research object, the functional feature elements of the instance and the target feature elements of the problem to be solved are determined. Then, weights are allocated according to the importance of the feature elements, and finally, the similarity value between the instance and the target problem to be solved is calculated.

[0053] Assuming a set of functional features in a matter-element model contains n features, then the set of instance functional features M in the instance library... f and target requirement functional feature set M g The matter-element model is represented as follows:

[0054] M f =<(C f X f )>

[0055] =<(c f1 c f2 c fn ;x f1 x f2 , ..., x fn )>

[0056] M g =<(C g X g )>

[0057] =<(c g1 c g2 c gn ;x g1 x g2 , ..., x gn )>

[0058] Therefore, this application is based on actual needs and problem M. g Establish a corresponding attribute system for the target problem, and assign a corresponding weight to each feature element in the system according to its importance, thereby better describing the importance of the feature elements. Then, the target problem M... g The weight distribution relationship of each feature element is expressed as follows:

[0059] W = (w1, w2, ..., w n )

[0060] In the formula: 0≤w k ≤1, and The weights can be solved using the analytic hierarchy process (AHP), which will not be described in detail here.

[0061] Let e ​​be the similarity between the k-th functional feature of a given instance and the target feature. k It indicates that, and es k∈[0, 1]. Where es k The value of is directly proportional to the similarity of the features corresponding to the instances. k When the value is 1, it indicates that this instance perfectly matches the features of the target problem; conversely, when the features of the two do not match at all, es k The value is 0; when the feature parts of the two match, es k The value is some value between 0 and 1. Then, the similarity between this instance and the target problem can be expressed as:

[0062]

[0063] In the formula: w k The weight of the k-th attribute. n is the number of features in the current search instance.

[0064] The similarity es of the k-th feature in the instance k It is necessary to determine the value x of the instance's functional feature element. fk The feature element values ​​x of target i gk The distance between them is determined. In the process of representing instances, the values ​​of instance feature elements are mainly divided into two cases: one is a specific numerical value, such as the tolerance accuracy grade, the nominal size of the part, etc.; the other is a range, such as the range of tolerance values. Therefore, the similarity calculation formula between the retrieved instance and the target instance needs to be analyzed and considered for different cases. As shown in Table 1 below, the target feature value x is given in detail. gk With the retrieved instance feature value x fk Different combinations of .

[0065] Table 1: Combinations of Feature Element Value Types

[0066] Serial Number <![CDATA[x gk ]]> <![CDATA[x fk ]]> 1 Determine the value Determine the value 2 Determine the value interval 3 interval Determine the value 4 interval interval

[0067] (1) When x gk With x fk When all features are fixed values, the similarity es between features is... k Represented as:

[0068]

[0069] In the formula: ρ represents x fk With x gk The distance between them; x fk x is the eigenvalue of a feature element k for a given instance; gk The eigenvalues ​​of feature element k in the target problem; and These are the maximum and minimum values ​​of feature element k in the instance library.

[0070] If the attribute of the kth feature element is a qualitative indicator, the qualitative indicator can be converted into a quantitative indicator by manually assigning values. For example, if the qualitative indicators of the part's size are {poor, good, medium, excellent}, then the corresponding quantitative values ​​are {0.25, 0.5, 0.75, 1}.

[0071] (2) When v fk For a given value, v gk When the value is an interval, the instance similarity es k This can be represented using the extended distance calculation method:

[0072]

[0073] In the formula: ρ(x) fk ,x0,X gk X represents the distance between intervals; fk (x f1 x f2 ), X gk (x g1 x g2 ) represent the range values ​​of the instance functional feature elements and the target feature elements, respectively; x0 is the optimal value of the design range; and The maximum and minimum values ​​of the k-th feature element in all instances.

[0074] The optimal value x0 is generally determined by taking the intermediate point, i.e. The above equation can then be transformed into:

[0075]

[0076] If the optimal value v0 is difficult to solve, it can be determined based on expert advice or past design experience, and then the instance similarity es can be calculated. k The value of .

[0077] (3) When x fk x is an interval value gk When the value is fixed, it accounts for a small percentage in actual applications, and the calculation method for instance similarity is the same as in (2).

[0078] (4) When x fk With x gk When all values ​​are interval values, es k The extended distance can be calculated using the following method:

[0079]

[0080] In the formula: ρ(X) fk X gk X represents the distance between intervals;fk (x f1 x f2 ), X gk (x g1 x g2 ) represent the range values ​​of the instance functional feature elements and the target feature elements, respectively. and The maximum and minimum values ​​of the k-th feature element in all instances.

[0081] During instance reasoning, the above formula shows that the similarity between the instance and the target problem is directly proportional to Sim. The larger the Sim value, the more similar the instance is to the target problem and the closer it is to the solution.

[0082] Step 1c: Software implementation of the tolerance intelligent design module

[0083] The intelligent reasoning module for tolerances of typical firearm mechanisms can greatly simplify the product design process and shorten the development cycle. This section takes a locking mechanism as an example, and its development process is shown below:

[0084] (1) Create an Access knowledge base for interlocking mechanisms tolerances

[0085] The tolerance database for locking mechanisms needs to clearly define the knowledge type stored in the database and the database type itself. This application uses an Access database, named ZhiNengGongCha.mdb. Subsequent data tables for typical mechanisms, including locking mechanisms, ejection mechanisms, and firing mechanisms, will be stored in this database. The field names in the tables correspond to the input parameter string names for each mechanism. Through extensive research and study, the tolerance design situation and relevant expert experience in the tolerance analysis process of typical firearm mechanisms were analyzed. Based on firearm design manuals and tolerance design guidelines, the tolerance knowledge example database for design mechanisms contains the following characteristic information:

[0086] (a) Key measurement dimensions for technical requirements. These are mainly used to ensure the feasibility of the mechanism and guarantee the reliability of its design.

[0087] (b) Nominal dimensions of mechanical components. This mainly includes certain dimensions of mechanical components that affect critical measurement dimensions.

[0088] (c) Tolerance information. Information such as the upper and lower deviations of the nominal dimensions of the parts and their accuracy grades.

[0089] Taking the intelligent design of tolerances for locking mechanisms as an example, the locking clearance is a key measurement dimension required by technical specifications. H1, H2, H3, and D1 are some nominal dimensions in the locking mechanism, and H1ES, H2EI, and H1 accuracy grades are the upper and lower deviations of the nominal dimensions and accuracy grade parameters. Following the same method, tolerance information for other nominal dimensions is compiled and stored in this database, providing a retrieval source for subsequent intelligent tolerance design searches.

[0090] (2) Creating the user interface

[0091] The KNN algorithm-based inference interface is editable using .xml files. Users input the instance features of the target design, including key measurement dimensions, nominal dimensions, and input / output information. The corresponding input in the module retrieves the instance's feature requirements. The information required from the designer includes the basic parameters of the design requirements, primarily the upper and lower limits of the locking gap and the corresponding values ​​for each nominal dimension. Output parameters are automatically generated by the module, including the upper and lower deviations of each dimension and the accuracy level.

[0092] (3) Create the KNN algorithm inference component

[0093] Because the retrieval of each mechanism within a firearm is conducted independently, and the databases of each module are relatively small, this application employs the KNN algorithm for tolerance instance retrieval. Furthermore, the software module development process utilized XML, a meta-language used for information storage and transmission on the internet, and saved as a .config file. XML has absolute advantages in describing knowledge and intelligent design information. Firstly, XML's knowledge description format is simple and easy to understand; secondly, it offers greater flexibility and freedom in expressing tolerance knowledge, effectively representing the tolerance knowledge content of complex data; thirdly, XML has high scalability in tolerance knowledge content, making it very convenient to expand and improve the tolerance knowledge instance library; finally, XML has good openness and interoperability in knowledge exchange, strong independence, and can exist independently without relying on software programs, enabling it to be recognized and shared by multiple systems.

[0094] (4) Run the inference component

[0095] After the inference component is created, running the inference component will cause the system to search the database based on the nearest neighbor retrieval algorithm, select three instances that best match the current search characteristics, and pop up a dialog box for designers to select.

[0096] The instances output in the search window are three sets of instances similar to the current problem, obtained by searching the database based on the KNN algorithm. The order of these instances is based on descending order of strength similarity values.

[0097] Instance-based reasoning employs the K-nearest neighbor retrieval method to solve new problems. For features with identical numerical values, it selects the instance with the closest numerical value; for string-type features, it determines similarity by checking if the strings are identical.

[0098] Step S2: Calculate the assembly accuracy based on the tolerance information in each similar design instance, and then determine whether the tolerance information in any similar design instance meets the new design requirements based on the calculated assembly accuracy; wherein,

[0099] If the tolerance information in K similar design instances does not meet the new design requirements, perform the following steps:

[0100] Based on the objective optimization model of processing cost and quality loss function, and with process capability index and tolerance accumulation as constraints, the tolerance information in any similar design instance is optimized to obtain a design scheme that meets the new design requirements.

[0101] In this step, 3D models of each component are created in 3D modeling software. The assembly sequence of the components is created based on the actual assembly process. Relevant tolerance information is defined according to design requirements. Key control dimensions are set as analysis targets, and appropriate simulation parameters are selected for assembly simulation. The dimensional distribution pattern, contribution factor analysis report, and influence factor analysis report obtained from the simulation are used to comprehensively evaluate whether the control targets meet the predetermined assembly accuracy requirements. If the analysis results do not meet the assembly accuracy requirements or there is room for optimization, designers can reallocate tolerances based on the tolerance sensitivity analysis report, while meeting processing cost and quality requirements. This process is repeated until the optimal design scheme for this stage is obtained.

[0102] Optionally, in step S2, the assembly accuracy calculation formula is:

[0103]

[0104] Among them, T mi To calculate the assembly accuracy, T i λ represents the i-th tolerance value in the tolerance information, and n represents the number of tolerances in the tolerance information; i is the weighting coefficient for the i-th tolerance.

[0105] Optionally, in step S2, the target optimization model is:

[0106]

[0107] Where min represents minimization; C is the objective function; ω i The weighting coefficients are calculated based on the contribution of component characteristics; T iC represents the i-th tolerance value in the tolerance information, where n is the number of tolerances in the tolerance information; m (T i ) is the processing cost function of the component characteristic tolerances. Where c0, c1, c2, and c3 are known parameters related to the tolerance; L(T i ) represents the characteristic mass loss function of the component. Where A represents the product's limit loss within the tolerance specification, and T represents the design tolerance.

[0108] Optionally, in step S2, the constraints include:

[0109]

[0110] T i ≤T

[0111] Among them, C Pmin C is the lower limit of the process capability index. Pmax C represents the upper limit of the process capability index. Pi Let σ be the process capability index corresponding to the i-th tolerance; σ be the standard deviation of the process in a steady state; C Pk min C represents the lower limit of the actual process capability index. Pk max C represents the upper limit of the actual process capability index. Pk This is the actual process capability index. Where USL and LSL are the upper and lower limits of tolerance control requirements, respectively, and are key measurement dimensions in the new design requirements; μ is the mean of the statistical dimension distribution during actual machining; λ i T is the weighting factor for the i-th tolerance. 0i To meet the new design requirements for assembly precision.

[0112] The quality loss function is the loss in quality caused by the deviation of product feature values ​​from target values. The quality loss increases with the square of the deviation. It is a loss function used to measure the quality of a model during prediction; it measures the model's accuracy. The quality loss function consists of quality metrics, such as data accuracy, prediction accuracy, and production efficiency. The basic principle of the quality loss function is that the gap between the actual prediction result and the model's expected result should be as small as possible to improve the model's prediction efficiency and accuracy.

[0113] Contribution analysis is a method to quantitatively describe the influence of input variables on output variables in a model. After analyzing the 3D assembly model of the locking mechanism, we can output the analysis results based on HLM contribution analysis, including the contribution of the geometric characteristics of each influencing factor to the locking gap. Since the contribution analysis method is based on linear relationships, we approximate the Taylor formula to a first-order linear relationship expression, thus calculating the HLM contribution. The contribution analysis model quantitatively describes the relationship between input and output as follows: Figure 4 As shown, the output quantity m and the input quantity c are described by a general function expression f. i The relationship is:

[0114] m = f(c i ), i = 1, 2, ..., t

[0115] Substituting the formula into Taylor's formula:

[0116]

[0117] In the formula, combined with the three-dimensional tolerance analysis model, m0 is the basic dimension of the characteristic tolerance; Δc i =c i -c i0 This represents the change in the target dimension tolerance corresponding to a single tolerance variation. Since the HLM contribution analysis method is a linear scale analysis, the Taylor formula can be approximately expanded to a first-order term, resulting in the following linear functional relationship:

[0118]

[0119] Since analyzing the contribution of one influencing factor requires other influencing factors to remain constant, the following two assumptions must be met to ensure the reliability of the contribution analysis results: 1) All influencing factors meet the statistical independence principle, i.e., they have no correlation; 2) To simplify the model and calculation process, it is assumed that the influencing factor C... i The distribution patterns of both follow a normal distribution; under these two assumptions, we can further derive a linear functional relationship between the variance of the target size and the variance of the influence factors:

[0120]

[0121] The formula for calculating HLM contribution is:

[0122]

[0123] When performing the first derivative When calculating the impact factor, the contribution index can be used instead. Based on the statistical simulation data of the target impact factor, C can be derived.i An approximate substitute value is obtained. In the simulation software, the tolerances of other influencing factors are set to 0, and only the influence of the tolerance of one influencing factor on the change in the target size is measured. This process is repeated for each influencing factor, and the corresponding maximum measured value can be obtained from the distribution pattern of the target size. and minimum measurement value C can be obtained through calculation. i The change in the target under individual influence is: The HLM sensitivity index can be expressed as:

[0124]

[0125] This is the sum of the changes under the individual effects of all influencing factors. Therefore, substituting the first-order partial derivative with the HLM contribution index above yields:

[0126]

[0127] Therefore, the formula for the final contribution can be obtained as follows:

[0128]

[0129] Based on the contribution analysis report obtained from the assembly accuracy modeling study of key components, the information in Table 2 can be summarized as follows:

[0130] Table 2: Simulation Analysis Results of HLM Contribution

[0131]

[0132] Considering the practical situation, the list of HLM contribution decomposition results omits influence factors with a contribution of less than one percent. After clarifying the HLM contribution percentage values ​​of each feature plane, a preliminary optimization scheme can be proposed: 1) Based on the contribution analysis results, considering that the contribution of the bolt carrier's base plane and bolt head plane each accounts for 45.97%, which is much larger than the contribution of the barrel body's tail end mating surface and cartridge case base plane (2.87%) and the sleeve body's tail end mating surface (1.84%), the tolerances of the bolt carrier's base plane and bolt head plane, which have a greater influence, can be directly optimized. On the other hand, considering that the effective tolerances of the bolt carrier's base plane and bolt head plane are four to five times larger than the other three feature planes, and combined with the actual machining process, it is relatively easy to optimize the control accuracy. 2) Without considering the difficulty of machining, the weight coefficients can also be calculated based on the relative magnitude of the contribution of each feature plane for target optimization, so as to adjust the tolerance of the target size more scientifically to meet the design and usage requirements. This scheme is more suitable for target optimization where the contribution ratios of each influence factor are not significantly different.

[0133] When designing and optimizing tolerances, the actual processing capabilities of the factory must be fully considered to make tolerance allocation more economical and reasonable. The process capability index should be used as a constraint to achieve product tolerance optimization.

[0134] Process capability index, also known as process strength index, describes the actual processing capacity of a process under continuous and stable production conditions. The magnitude of process capability has a significant impact on the final product quality and reliability, essentially reflecting the yield rate of the process. In actual production, when process capability is stable, the dimensions of the processed parts generally conform to a normal distribution. According to the normal distribution diagram, the pass rate for parts within 6σ can reach 99.73%. Therefore, we use the 6σ value as the basis for reflecting the magnitude of process capability. When designing part tolerances, it is generally required that the width of the dimensional tolerance band (tolerance range within 6σ) of the finished part is less than or equal to the width of the designed tolerance range, which is expressed by the formula:

[0135] PC=6σ≤T

[0136] In the formula: PC (Product Specification) refers to the technical requirements for product tolerance constraints, σ ​​is the standard deviation of the process under stable conditions, and T is the total design tolerance.

[0137] To comprehensively evaluate the level of technological sophistication in production, the process capability index C is used. p To reflect the capacity of the process:

[0138]

[0139] When the mean of the product quality distribution characteristics does not coincide with the center value of the design tolerance, the upper and lower limits of the manufacturing tolerance relative to the design tolerance will be different. In severe cases, this may affect the product yield. Therefore, it is necessary to adjust the process capability value C. p After correction, the actual process capability index is C. pk :

[0140]

[0141] USL and LSL represent the upper and lower limits of tolerance control requirements, respectively, and μ is the mean of the statistical dimensional distribution during actual machining. Table 3 shows the process capability levels, and Table 4 shows the actual process capability levels.

[0142] Table 3: Process Capability Levels

[0143]

[0144] Table 4: Actual Process Capability Level

[0145]

[0146] Through statistical analysis of a large number of actual samples, in order to ensure the pass rate of product processing and the subsequent assembly quality, the process capability must meet the minimum requirement C. p >1. C p A value greater than 1 does not guarantee that defective products will not occur, but it will keep the defect rate within an acceptable range. p The higher the value, the lower the defect rate. Specifically, C... p The adjustment and selection of values ​​are mainly related to economic efficiency and processability.

[0147] Actual process capability index C pk It is considering the process capability index C p Based on this, it is a measure of the deviation between the actual workpiece's dimensional distribution center and the tolerance design standard's distribution center. Ideally, the actual distribution center of the workpiece should coincide with the center value of the design tolerance (the mean center of the tolerance normal distribution). This would better ensure the part's pass rate and reduce processing costs to some extent. Generally, the actual process capability index C... pk It meets the condition that 1.67 > C. pk When the value is ≥1.00, the process capability is considered acceptable; C pk A value greater than 1.67 is considered excessively high actual process capability. Excessively high actual process capability significantly increases manufacturing costs, and it is unnecessary for the production of ordinary parts to reach this level; C pk When the value is ≤1, it is considered that the actual process capability is poor and cannot meet the production process's control over the defect rate.

[0148] Processing cost function model

[0149] The total cost required during the machining of a part is called the machining cost. There is an irreconcilable contradiction between machining cost and manufacturing precision, and manufacturing precision is mainly determined by design precision. Therefore, design precision is the most significant factor affecting machining cost. Selecting strict tolerance grades during design can indeed better ensure the assemblability and functionality of parts, but the resulting cost issues cannot be ignored. Based on a survey and analysis of the machining costs of typical firearm parts, this paper establishes mathematical function relationships for different types of cost-tolerance models applicable to the tolerance design of typical firearm parts. This step proposes to use a composite linear and exponential cost-tolerance model to express the tolerance cost functions of typical parts' planar features, outer circular features, inner hole features, runout tolerances, etc., as shown below:

[0150]

[0151] Where c0, c1, c2, and c3 are known parameters related to tolerance.

[0152] The characteristic tolerance cost function for a typical part includes:

[0153] (1) The tolerance cost function for planar features is:

[0154]

[0155] (2) The tolerance cost function for the outer circle feature is:

[0156]

[0157] (3) The tolerance cost function for the internal hole feature is:

[0158]

[0159] (4) The runout tolerance cost function is:

[0160] C(T)=0.0373e -3.08T

[0161] Step 4b: Quality Loss Cost Function Model

[0162] The cost model is based on a quality loss function. During product processing, influenced by both human and non-human random factors, product quality will always fluctuate slightly around its target value. The amplitude of this fluctuation is mainly determined by the processing precision. Quality loss refers to the loss caused to the user by quality fluctuations. Through analysis of a large amount of sample data, the magnitude of quality loss can be approximately measured by a function.

[0163] Let the quality characteristic value of a product be y, and the expected value be m. When the quality characteristic value exactly satisfies y = m, it indicates that the product quality has no fluctuation and exactly meets the design expectations; however, when y ≠ m, there is a certain gap between the product quality and the expected value. We use |ym| to describe the difference between the two, and the magnitude of the difference reflects the magnitude of the quality loss. Expanding the quality loss function L(y) at the expected value m using a Taylor series, we have:

[0164]

[0165] Based on the description of the quality characteristics, when y = m, the product has no quality loss, corresponding to the quality loss function L(y) = 0; the quality loss reaches its minimum value. According to advanced mathematics, at m, L′(m) = 0. Substituting this into the Taylor series expansion and omitting higher-order terms of the quadratic term, we obtain an approximate value:

[0166] (1) Visual characteristic quality loss function:

[0167] L(y)=k(ym) 2

[0168] Where k is the mass loss coefficient. According to the design tolerance T of the product, it is stipulated that when |y - m| ≤ T, the mass loss of the product is within the tolerance range and the product is qualified; when |y - m| > T, the mass loss of the product exceeds the tolerance range and the product is unqualified. If the limit loss of the product within the tolerance is A, then A = kT 2 Furthermore, the mass loss coefficient can be obtained as k = A / T 2 .

[0169] (2) The quality loss function for the smaller-the-better characteristic is:

[0170] L(y) = ky 2

[0171] It is stipulated that when the quality characteristic value v satisfies 0 < v ≤ T, the product meets the requirements.

[0172] (3) The quality loss function for the larger-the-better characteristic is:

[0173] L(y) = k / y 2

[0174] It is stipulated that when the quality characteristic value v satisfies y ≥ T, the product meets the requirements.

[0175] Regarding tolerance design, if the mass loss amount (y - m) is equal to the tolerance value T, the characteristic quality loss function can be transformed into:

[0176]

[0177] Then the total mass loss cost caused by tolerance factors is:

[0178]

[0179] That is:

[0180]

[0181] Where n is the number of tolerances in the product.

[0182] Previously, in the tolerance optimization stage, the tolerance allocation was generally carried out with the control of processing cost as the optimization goal, ignoring the impact caused by quality loss. This application establishes a hybrid optimization model of processing cost - quality cost loss, and converts the contribution analysis results into weighted coefficients and substitutes them into the optimization model for calculation. Considering the influence of tolerance factors on processing cost and quality loss comprehensively, with the premise of meeting the design tolerance requirements, the cost optimization is carried out with the minimum of processing cost and quality loss as the optimization goal. According to the analysis of the processing cost function model and quality loss cost model above, the total optimization objective function can be obtained as:

[0183]

[0184] Where min represents minimization; C is the objective function; ω i The weighting coefficients are calculated based on the contribution of component characteristics; T i C represents the i-th tolerance value in the tolerance information, where n is the number of tolerances in the tolerance information; m (T i ) is the processing cost function of the component characteristic tolerances. Where c0, c1, c2, and c3 are known parameters related to the tolerance; L(T i ) represents the characteristic mass loss function of the component. Where A represents the product's limit loss within the tolerance specification, and T represents the design tolerance.

[0185] When optimizing tolerances, constraints need to be established. Generally, factors such as process capability index constraints, tolerance accumulation constraints, and the value of standard tolerance grades must be considered. This ensures that both the process capability index and the assembly accuracy between mating parts requiring assembly precision are controlled within a certain range.

[0186] (1) Process capability index constraint conditions

[0187] To comprehensively evaluate the level of technological sophistication in production, the process capability index C is used. p This reflects the capability of a machining process. The difficulty of machining a process affects the required capability index. Generally, considering machining costs, the capability index for difficult-to-machine parts is higher than that for easy-to-machine parts. Therefore, selecting a reasonable C... p When determining the value, both actual processing capacity and cost factors should be considered. Process Capability Index C p And actual process capability index C pk The constraints are:

[0188]

[0189] σ is the standard deviation of the process under steady-state conditions, and T is the total design tolerance.

[0190] C pkmin ≤C pk ≤C pkmax

[0191]

[0192] USL and LSL are the upper and lower limits of tolerance control requirements, respectively, and μ is the mean of the statistical dimensional distribution during the actual machining process.

[0193]

[0194] T0i To meet the assembly accuracy requirements of the design; λ i These are weighting coefficients;

[0195] T i ≤T

[0196] Assembly accuracy requirements are usually considered based on actual processing conditions, when 1 < C p When C < 1.33, normal production of the product can be guaranteed. p When the tolerance is greater than 1.67, excessively high process capability will create significant cost pressure. Therefore, when designing tolerances, a suitable value should be selected between 1 and 1.67 after comprehensively analyzing various factors of the part. pk The range of values ​​for C p The values ​​are the same.

[0197] (2) Tolerance Cumulative Constraints

[0198] During assembly, the fit between parts transmits the machining errors of each part itself, and these errors increase with each transmission, which is the source of tolerance accumulation. The final assembly clearance has the largest cumulative error; therefore, to ensure assembly accuracy, it is necessary to control the cumulative dimensional errors. The constraint relationships are expressed as follows:

[0199]

[0200] In the formula, T 0i To meet the assembly accuracy requirements of the design; λ i These are the weighting coefficients.

[0201] While ensuring the assembly accuracy pass rate, the tolerances of the automatic machine's locking mechanism are optimized by comprehensively considering processing costs and process capability indices. After obtaining the results of the three-dimensional assembly accuracy simulation analysis, the results are compared with the design stage requirements, and it is analyzed whether the key control dimensions meet the various design indicators. For non-conforming dimensions, the contribution analysis results are converted into weighted coefficients ω. i The tolerances are then optimized by substituting the results into the established hybrid model based on processing cost and quality loss. The optimized results are then converted into standard tolerances and re-verified.

[0202] In the ideal scenario of a multi-objective optimization problem, all component objectives would simultaneously reach their optimal solutions. However, for tolerance optimization, due to the complexity of the part's manufacturing process and the functional requirements of the part itself, it is almost impossible for the tolerance to simultaneously reach its optimal value. This paper establishes a hybrid model with two parameters, processing cost and quality loss, as optimization objectives. Combining the contribution analysis results and converting them into weighted coefficients, the bi-objective optimization is uniformly transformed into a single-objective optimization for solution.

[0203] The three-dimensional tolerance model of the locking mechanism has been analyzed in the previous article. Now, taking the locking gap as an example, we will describe the detailed process of tolerance optimization.

[0204] Based on the structural model of the part and the actual machining conditions, the following tolerance cost function can be established:

[0205]

[0206] The weighting coefficients are:

[0207]

[0208] Process capability index C P And actual process capability index C Pk Constraints:

[0209]

[0210] 1≤C pk =Min[USL-μ / 3σ, LSL-μ / 3σ]≤1.67

[0211]

[0212] Single feature tolerance constraint:

[0213]

[0214] Based on the established tolerance optimization model, the optimization results are as follows:

[0215] Table 5: Optimization Analysis Results

[0216]

[0217] Based on the optimization results, the standard tolerance is converted as follows:

[0218] Table 6: Standard Tolerance Conversion Results

[0219]

[0220] Substituting the optimized tolerance values ​​into the assembly accuracy analysis model established in the 3D analysis software, it can be seen that the lower limit of the optimized locking clearance size distribution within ±3σ is 0.005 mm, and the upper limit is 0.129 mm, both within the assembly accuracy requirements and meeting the design requirements for process capability index C. p =1.61, good process capability, C pk =1.33, indicating good actual process capability. The overall design parameters of the locking clearance basically meet the requirements. After optimization during the design phase, the tolerance allocation can be further adjusted during the process phase based on actual conditions.

[0221] This application, using a locking gap example, constructs a multi-objective tolerance optimization model with processing cost and quality loss as optimization objectives and process capability index and tolerance accumulation as constraints. The contribution analysis results of the locking gap are transformed into weight coefficients and incorporated into the final optimization solution, making the optimization model more reasonable and complete. Ultimately, the optimized analysis results of the locking gap size are controlled within the design requirements, successfully completing the optimization of each key control parameter of the locking gap.

[0222] Optionally, the method further includes:

[0223] S3 stores design solutions for new design requirements as design instances in the tolerance knowledge instance library. This approach enriches the instance library and improves production efficiency.

[0224] Please see Figure 5 The second aspect of this invention discloses an example-based tolerance optimization system for opening and closing mechanisms, the system comprising:

[0225] The first processing module 100 is configured to traverse the tolerance knowledge instance library based on the new design requirements, calculate the requirement similarity between the new design requirements and each design instance, sort the requirements according to the requirement similarity, and select K design instances with similarity values ​​higher than the similarity threshold as similar design instances; wherein, the tolerance knowledge instance library stores multiple design instances, each design instance including key measurement dimensions, nominal dimensions of parts, and tolerance information; key measurement dimensions and nominal dimensions of parts belong to design requirements;

[0226] The second processing module 200 is configured to calculate the assembly accuracy based on the tolerance information in each similar design instance, and then determine whether the tolerance information in any similar design instance meets the new design requirements based on the calculated assembly accuracy; wherein...

[0227] If the tolerance information in K similar design instances does not meet the new design requirements, perform the following actions:

[0228] Based on the objective optimization model of processing cost and quality loss function, and with process capability index and tolerance accumulation as constraints, the tolerance information in any similar design instance is optimized to obtain a design scheme that meets the new design requirements.

[0229] Optionally, the objective optimization model is:

[0230]

[0231] Where min represents minimization; C is the objective function; ω i The weighting coefficients are calculated based on the contribution of component characteristics; T iC represents the i-th tolerance value in the tolerance information, where n is the number of tolerances in the tolerance information; m (T i ) is the processing cost function of the component characteristic tolerances. Where c0, c1, c2, and c3 are known parameters related to the tolerance; L(T i ) represents the characteristic mass loss function of the component. Where A represents the product's limit loss within the tolerance specification, and T represents the design tolerance;

[0232] The constraints include:

[0233]

[0234] C pk min ≤C pk ≤C pk max

[0235]

[0236] T i ≤T

[0237] Among them, C Pmin C is the lower limit of the process capability index. Pmax C represents the upper limit of the process capability index. Pi Let σ be the process capability index corresponding to the i-th tolerance; σ be the standard deviation of the process in a steady state; C Pk min C represents the lower limit of the actual process capability index. Pk max C represents the upper limit of the actual process capability index. Pk This is the actual process capability index. Where USL and LSL are the upper and lower limits of tolerance control requirements, respectively, and are key measurement dimensions in the new design requirements; μ is the mean of the statistical dimension distribution during actual machining; λ i T is the weighting factor for the i-th tolerance. 0i To meet the new design requirements for assembly precision.

[0238] A third aspect of this invention discloses an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the example-based tolerance optimization method for opening and closing mechanisms according to any one of the first aspects of this disclosure.

[0239] Figure 6 This is a structural diagram of an electronic device according to an embodiment of the present invention, such as... Figure 6As shown, the electronic device includes a processor, memory, communication interface, display screen, and input device connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, Near Field Communication (NFC), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the device's casing, or an external keyboard, touchpad, or mouse.

[0240] Those skilled in the art will understand that Figure 6 The structure shown is merely a structural diagram of the part related to the technical solution of this disclosure and does not constitute a limitation on the electronic device to which the solution of this application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0241] A fourth aspect of this invention discloses a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the example-based tolerance optimization method for opening and closing mechanisms according to any one of the first aspects of this disclosure.

[0242] In summary, the technical solution proposed in this invention has the following technical effects: This method, while ensuring qualified assembly accuracy, comprehensively considers processing costs and process capability indices to optimize the tolerance design of the opening and closing mechanism. Based on a tolerance instance library of opening and closing mechanisms, this method constructs optimization targets for product processing costs and quality losses through contribution and sensitivity analysis and calculation. It establishes a target optimization model with process capability indices and tolerance accumulation as constraints, achieving a balance between processing costs and assembly quality losses. The aim is to meet the design accuracy requirements under precision manufacturing, improve production efficiency, improve part quality, and thereby further reduce production costs.

[0243] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein, and such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A tolerance optimization method for an example-based opening and closing mechanism, characterized in that, The method includes: Step S1: Based on the new design requirements, traverse the tolerance knowledge instance library, calculate the requirement similarity between the new design requirements and each design instance, sort them according to the requirement similarity, and select K design instances that are higher than the similarity threshold as similar design instances. The tolerance knowledge instance library stores multiple design instances, each of which includes key measurement dimensions, nominal dimensions of components, and tolerance information; the key measurement dimensions and nominal dimensions of components are design requirements. Step S2: Calculate the assembly accuracy based on the tolerance information in each similar design instance, and then determine whether the tolerance information in any similar design instance meets the new design requirements based on the calculated assembly accuracy; wherein: If the tolerance information in K similar design instances does not meet the new design requirements, then perform the following steps: Based on the objective optimization model of processing cost and quality loss function, and with process capability index and tolerance accumulation as constraints, the tolerance information in any similar design instance is optimized to obtain a design scheme that meets the new design requirements. The objective optimization model is as follows: Where min represents minimization; C is the objective function; The weighting coefficients are calculated based on the contribution of component characteristics. Let be the i-th tolerance value in the tolerance information, and n be the number of tolerances in the tolerance information; Let be the processing cost function of the component's characteristic tolerances. ,in, , , , These are known parameters related to tolerances; Let the characteristic mass loss function of the component be . ,in, A T represents the design tolerance, where T is the limit loss of the product within the tolerance specification. The constraints include: in, C Pmin This represents the lower limit of the process capability index. C Pmax This represents the upper limit of the process capability index. C Pi Let σ be the process capability index corresponding to the i-th tolerance; σ is the standard deviation of the process in a steady state. C Pk min This represents the lower limit of the actual process capability index. C Pk max This represents the upper limit of the actual process capability index. C Pk This is the actual process capability index. USL and LSL are the upper and lower limits of tolerance control requirements, respectively, and are key measurement dimensions in the new design requirements. μ This represents the mean of the dimensional distribution statistically analyzed during the actual processing. Let be the weighting coefficient for the i-th tolerance. To meet the new design requirements for assembly precision.

2. The method according to claim 1, characterized in that, In step S1, the KNN algorithm is used to calculate the similarity between the new design requirements and the requirements of each design instance.

3. The method according to claim 2, characterized in that, In step S2, the formula for calculating assembly accuracy is: in, To calculate the assembly accuracy, Let be the i-th tolerance value in the tolerance information, and n be the number of tolerances in the tolerance information; is the weighting coefficient for the i-th tolerance.

4. The method according to claim 1, characterized in that, The method further includes: Step S3: Store the design scheme for the new design requirements as a design instance in the tolerance knowledge instance library.

5. An example-based tolerance optimization system for opening and closing mechanisms, characterized in that, The system includes: The first processing module is configured to traverse the tolerance knowledge instance library based on the new design requirements, calculate the similarity between the new design requirements and each design instance, sort the requirements according to the similarity, and select K design instances with similarity values ​​higher than the similarity threshold as similar design instances. The tolerance knowledge instance library stores multiple design instances, and each design instance includes key measurement dimensions, nominal dimensions of parts, and tolerance information. Key measurement dimensions and nominal dimensions of parts are part of the design requirements. The second processing module is configured to calculate the assembly accuracy based on the tolerance information in each similar design instance, and then determine whether the tolerance information in any similar design instance meets the new design requirements based on the calculated assembly accuracy; wherein... If the tolerance information in K similar design instances does not meet the new design requirements, then the following actions will be performed: Based on the objective optimization model of processing cost and quality loss function, and with process capability index and tolerance accumulation as constraints, the tolerance information in any similar design instance is optimized to obtain a design scheme that meets the new design requirements. The objective optimization model is as follows: Where min represents minimization; C is the objective function; The weighting coefficients are calculated based on the contribution of component characteristics. Let be the i-th tolerance value in the tolerance information, and n be the number of tolerances in the tolerance information; Let be the processing cost function of the component's characteristic tolerances. ,in, , , , These are known parameters related to tolerances; Let the characteristic mass loss function of the component be . ,in, A T represents the design tolerance, where T is the limit loss of the product within the tolerance specification. The constraints include: in, C Pmin This represents the lower limit of the process capability index. C Pmax This represents the upper limit of the process capability index. C Pi Let σ be the process capability index corresponding to the i-th tolerance; σ is the standard deviation of the process in a steady state. C Pk min This represents the lower limit of the actual process capability index. C Pk max This represents the upper limit of the actual process capability index. C Pk This is the actual process capability index. USL and LSL are the upper and lower limits of tolerance control requirements, respectively, and are key measurement dimensions in the new design requirements. μ This represents the mean of the dimensional distribution statistically analyzed during the actual processing. Let be the weighting coefficient for the i-th tolerance. To meet the new design requirements for assembly precision.

6. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, it implements the steps in the example-based tolerance optimization method for opening and closing mechanisms according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the example-based tolerance optimization method for opening and closing mechanisms according to any one of claims 1 to 4.