An automatic reordering method for improving reliability of mechanistic kinetic modeling
By correcting the incorrect order of model variables in mechanized dynamics modeling using an automatic reordering method, the problem of unsustainable model calculations was solved, thus improving the reliability and efficiency of modeling.
Patent Information
- Application Number
- CN202210622604.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-01
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-06-01
AI Technical Summary
In existing mechanized dynamics modeling methods, incorrect output order of model variables can cause calculations to fail, reducing the reliability of modeling. Furthermore, manual correction methods are time-consuming, labor-intensive, and lack automated solutions.
An automatic reordering method is adopted, which automatically corrects the order errors of model variables by initializing the variable sequence and expression sequence and using reordering flags to ensure that the calculation order of each variable is correct.
Automatic correction of the order of model variables was achieved, which improved the reliability and computational efficiency of mechanized dynamics modeling and avoided the inefficiency of manual correction.
Smart Images

Figure CN114896810B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of mechanization dynamics modeling, and particularly relates to an automatic reordering method capable of improving the reliability of mechanization dynamics modeling. BACKGROUND
[0002] In the traditional field of mechanical science research, a dynamics model can be used for characteristic simulation analysis and real-time motion control of a mechanical system, and mechanization dynamics modeling is an effective method for establishing a dynamics model of a mechanical system. An application patent with the publication number CN106383973A discloses a mechanization dynamics modeling method for a non-complete constraint system. The main idea of the method is to first give an implication relationship of motion variables by using the principle of forward modeling in a motion analysis process, and then establish a recursive dynamics model of the system by using an inverse sequence output method according to the implication relationship in a dynamics analysis process. It has been proved in practice that the recursive dynamics model established by the patent CN106383973A can effectively reduce the defects such as repeated calculation and redundant calculation commonly existing in dynamics models, and has a high calculation efficiency. However, since human intervention is needed in the motion analysis process, the method may have the problem of incorrect output sequence of model variables, which makes the recursive calculation unable to continue, thereby reducing the reliability of mechanization dynamics modeling. The current solution to the problem is to substitute numerical calculation to locate the error position of the calculation interruption, and then to correct the sequence of the variables with the incorrect sequence one by one through artificial trial and error. Obviously, the solution is time-consuming and laborious, and in the correction process, the method of artificial trial and error is mostly used, and there is a lack of unified and feasible automatic batch processing countermeasures. SUMMARY
[0003] In view of the deficiencies of the prior art, the present application provides an automatic reordering method capable of improving the reliability of mechanization dynamics modeling, which aims to correct the sequence error of output model variables, so as to improve the reliability of the output model of mechanization dynamics modeling.
[0004] Suppose that an existing mechanization modeling method outputs a script file as a system recursive dynamics model, and the calculation sequence of the variables in the model may have errors, the present application automatically reorders the internal variables of the script file based on the script file.
[0005] The present application is implemented by the following technical solutions:
[0006] An automatic reordering method capable of improving the reliability of mechanization dynamics modeling, as shown in Figure 1 The method comprises the following specific steps:
[0007] Step 1, import the script file after inverse sequence output, read the variables and expressions in the internal factor;
[0008] Step 2, initialization: set the valid variable sequence, the valid variable expression sequence, and the reordering flag;
[0009] Step 3, reset the reordering flag to zero;
[0010] Step 4, take the second variable element of the valid variable sequence as the current variable to be checked;
[0011] Step 5, in the valid variable expression sequence, search backward from the first expression to the expression corresponding to the current variable to be checked, and detect whether there is an expression containing the current variable to be checked;
[0012] If there is an expression containing the current variable to be checked, execute Step 6;
[0013] If there is no expression containing the current variable to be checked, execute Step 7;
[0014] Step 6, insert the current variable to be checked and the expression before the expression containing the current variable to be checked, and set the reordering flag to 1;
[0015] Step 7, detect whether the current variable to be checked is the last variable in the valid variable sequence;
[0016] If the current variable to be checked is the last variable, execute Step 8;
[0017] If the current variable to be checked is not the last variable, move the pointer of the variable to be checked backward by one bit, and return to Step 5;
[0018] Step 8, detect whether the reordering flag is 0;
[0019] If the reordering flag is 0, it means that no variable is reordered in this round of search, i.e., the order of variables in the valid variable sequence is correct, and execute Step 9;
[0020] If the reordering flag is not 0, it means that a variable is reordered in this round of search, i.e., the order of variables in the valid variable sequence may still have errors, and return to Step 3;
[0021] Step 9, output the reordered valid variables and expressions in the form of a script file;
[0022] The reordering process is completed, and the program exits.
[0023] At this time, the order of variables in the output script file has been corrected, i.e., a system dynamics model that can be correctly iterated and calculated is obtained.
[0024] In step 2 of the above automatic reordering method capable of improving the reliability of mechanized dynamic modeling, initialization is performed: setting the effective variable sequence, the effective variable expression sequence, and the reordering flag. In this step, the reordering flag set as the judgment standard in subsequent step 8 has two cases: 0, indicating that the sequence of each variable is correct, and outputting the script file; and 1, indicating that there is still a variable with sequence error, and returning to step 3 for zero clearing and continuing comparison and sorting.
[0025] In step 6 of the above automatic reordering method capable of improving the reliability of mechanized dynamic modeling, the current variable to be checked and the expression are inserted before the expression containing the current variable to be checked, and the reordering flag is set to 1. In this step, the current variable to be checked and the expression are moved to the front of the expression containing the current variable to be checked, so that the current variable to be checked is calculated and defined first, and the subsequent expression containing the current variable to be checked can be calculated smoothly. The expression containing the current variable to be checked is the first expression containing the current variable to be checked searched backward in step 5. The reordering flag is set to 1 to record the variable with sequence error in this round of search.
[0026] Compared with the prior art, the present application analyzes the root cause of the problem that the sequence error of the model variable output reduces the reliability of mechanized dynamic modeling, and proposes a method of automatically reordering the model variable, which can accurately locate and correct the sequence error of the output model variable.
[0027] The present application uses an automatic batch processing method to replace manual methods, which can quickly realize automatic reordering of model variables, and the method is simple, efficient and has obvious engineering significance. BRIEF DESCRIPTION OF DRAWINGS
[0028] Figure 1 The algorithm flowchart for reordering the effective variable sequence and expression. DETAILED DESCRIPTION
[0029] To make the purpose, technical scheme and advantages of the present application clearer and easier to understand, Figure 1 The algorithm flowchart for reordering the effective variable sequence and expression is shown in the following specific embodiments, but the present application is not limited to the following embodiments.
[0030] Embodiment:
[0031] This embodiment assumes that the mechanized modeling of a certain system has been completed, and the script file of each variable and its corresponding expression is generated by reverse sequence output.
[0032] The output script file is as follows:
[0033]
[0034] The outputted variables will be imported into the computer hardware system platform calculation in the order from top to bottom. Obviously, when the first step of calculating variable f, there are undefined variables e and d in the corresponding expression, so that the variable f calculation error. Similarly, the remaining individual variables also have this problem. The final result of this scenario is that the model recursive calculation of the script file cannot continue, thereby reducing the reliability of mechanized dynamic modeling.
[0035] To solve the above problem, the outputted variables and the corresponding expressions need to be re-sequenced after processing, and the model calculation can be carried out smoothly.
[0036] According to the method, the computer automatic reordering process is as follows:
[0037] Start:
[0038] Step 1, import the script file output in reverse order, read the variables and the corresponding expressions, as follows:
[0039] Variable f a d e g b c Expression e+d 3 b*c b+c f+c 2*a a+2
[0040] Step 2, initialization: set the effective variable sequence, the effective variable expression sequence, and the reordering flag;
[0041] First round of sorting:
[0042] Step 3, reordering flag reset to zero;
[0043] Step 4, take the second variable element a of the effective variable sequence as the current to-be-checked variable;
[0044] Step 5, in the effective variable expression sequence, start from the first expression and search backward to the current to-be-checked variable corresponding expression, as follows (arrow is the search direction of the expression):
[0045]
[0046] If the current to-be-checked variable a is not detected in the expression, execute step 7;
[0047] Step 7, move the to-be-checked variable pointer backward by one bit, that is, the pointer points to variable element d, as follows (arrow is the search direction of the variable):
[0048]
[0049] And return to step 5;
[0050] Step 5, search the valid variable expression sequence backward from the first expression to the expression corresponding to the current variable to be checked, as follows:
[0051]
[0052] When the expression e+d is searched and it is found to contain the current variable to be checked d, as follows:
[0053]
[0054] Step 6 is executed;
[0055] Step 6, insert the current variable to be checked and the expression in front of the expression containing the current variable to be checked, and set the reordering flag to 1, as follows:
[0056]
[0057] Step 7, move the pointer of the variable to be checked backward by one bit, i.e. the pointer points to the variable element e, and return to step 5;
[0058]
[0059] Step 5, search the valid variable expression sequence backward from the first expression to the expression corresponding to the current variable to be checked, as follows:
[0060]
[0061] When the expression b*c is searched and it is found to contain the current variable to be checked c, as follows:
[0062]
[0063] Step 6 is executed;
[0064] Step 6, insert the current variable to be checked and the expression in front of the expression containing the current variable to be checked, and set the reordering flag to 1, as follows:
[0065]
[0066] Step 7, since it is detected that the pointer of the current variable to be checked has pointed to the last variable of the sequence, step 8 is executed;
[0067] Step 8, it is detected that the reordering flag is 1, which indicates that there is a variable to be reordered in this round of search, i.e. the order between the variables in the valid variable sequence may still be incorrect, and step 3 needs to be returned to;
[0068] Second round of sorting:
[0069] Step 3, reordering flag reset to zero;
[0070] Step 4, take the second variable element c of the valid variable sequence as the current variable to be checked;
[0071] Step 5, in the valid variable expression sequence, search backward from the first expression to the expression corresponding to the current variable to be checked, as follows:
[0072]
[0073] If the expression does not contain the current variable to be checked c, execute step 7;
[0074] Step 7, move the pointer of the variable to be checked backward by one bit, that is, the pointer points to variable element d, as follows:
[0075]
[0076] And return to step 5;
[0077] Step 5, in the valid variable expression sequence, search backward from the first expression to the expression corresponding to the current variable to be checked, as follows:
[0078]
[0079] If the expression does not contain the current variable to be checked d, execute step 7;
[0080] Step 7, move the pointer of the variable to be checked backward by one bit, that is, the pointer points to variable element e, as follows:
[0081]
[0082] And return to step 5;
[0083]
[0084] Step 5, in the valid variable expression sequence, search backward from the first expression to the expression corresponding to the current variable to be checked, as follows:
[0085]
[0086] If the expression does not contain the current variable to be checked g, execute step 7;
[0087] Step 7, since it is detected that the pointer of the current variable to be checked has pointed to the last variable of the sequence, execute step 8;
[0088] Step 8, if the reordering flag is 1, it means that there is a variable reordered in this round, i.e. the order between variables in the valid variable sequence may be wrong, so return to step 3;
[0089] Third round of sorting:
[0090] Step 3, reset the reordering flag to 0;
[0091] Step 4, take the second variable element b in the valid variable sequence as the current variable to be checked;
[0092] Step 5, in the valid variable expression sequence, start from the first expression and search backward to the expression corresponding to the current variable to be checked, as follows:
[0093]
[0094] If the expression does not contain the current variable to be checked b, execute step 7;
[0095] Step 7, move the pointer of the variable to be checked backward by one bit, i.e. the pointer points to variable element c, as follows:
[0096]
[0097] And return to step 5;
[0098]
[0099] Step 5, in the valid variable expression sequence, start from the first expression and search backward to the expression corresponding to the current variable to be checked, as follows:
[0100]
[0101] If the expression does not contain the current variable to be checked g, execute step 7;
[0102] Step 7, since it is detected that the pointer of the current variable to be checked points to the last variable in the sequence, execute step 8;
[0103] Step 8, if the reordering flag is 0, it means that no variable is reordered in this round, i.e. the order between variables in the valid variable sequence is correct, as follows:
[0104] Variable a b c d e f g Expression 3 2*a a+2 b*c b+c e+d f+c
[0105] Execute step 9;
[0106] Step 9, output the reordered valid variables and expressions in the form of a script file, as follows:
[0107]
[0108] Reordering is completed, and the program is exited.
[0109] The output script file is imported into the computer hardware system platform calculation, and the system will calculate each variable in turn from top to bottom. After reordering, when the variable f is calculated in step 6, the variables e and d in the corresponding expression have been defined in the previous calculation, so the variable f can be calculated smoothly. Similarly, the remaining variables can also be calculated smoothly. The final result of the processing is that the recursive calculation can continue, improving the reliability of mechanized dynamic modeling.
[0110] From the complexity of the implementation process, the automatic reordering method can automatically correct the output order of 7 variables through three rounds of comparison and sorting, and the implementation scheme is simple and clear, efficient and suitable.
[0111] As can be clearly seen from the above examples, after the reordered variables and expressions are processed by the reordering algorithm, the output order of each model variable is corrected, so that the subsequent recursive calculation can continue, thereby improving the reliability of mechanized dynamic modeling.
[0112] Compared with the current manual trial and error method, the automatic reordering method provided by the present application has the advantages of high efficiency, accurate positioning, etc., and effectively solves the problem that the recursive calculation cannot continue due to the incorrect output order of the model variables.
[0113] It should be noted that although the above embodiments of the present application are illustrative, this is not a limitation of the present application, therefore the present application is not limited to the above specific embodiments. Any other embodiments obtained by those skilled in the art under the inspiration of the present application without departing from the principles of the present application are considered to be within the protection of the present application.
Claims
1. An automatic reordering method to improve the reliability of mechanized dynamics modeling, comprising the following specific steps: Step 1: Import the script file after reverse output, and read the variables and expressions in the internal factors; the script file serves as the system's recursive dynamic model, and its internal variables are automatically reordered based on the script file; Step 2, Initialization: Set the valid variable sequence, valid variable expression sequence, and reordering flag; Step 3: Reset and clear the reordering flag; Step 4: Take the second variable element of the valid variable sequence as the current variable to be checked; Step 5: In the sequence of valid variable expressions, start from the first expression and search backwards to the expression corresponding to the current variable to be checked, and check whether there is an expression that contains the current variable to be checked; If an expression contains the variable currently being checked, proceed to step 6; If no expression contains the variable currently being checked, proceed to step 7; Step 6: Insert the current variable to be checked and the expression before the expression containing the current variable to be checked, and set the reordering flag to 1; Step 7: Check whether the variable to be checked is the last variable in the valid variable sequence; If the variable to be checked is the last variable, then proceed to step 8; If the variable to be checked is not the last variable, then move the pointer of the variable to be checked one position forward and return to step 5; Step 8: Check if the reordering flag is 0; If the reordering flag is 0, it means that no variables were sorted in this round of search, that is, the order of each variable in the effective variable sequence is correct, and proceed to step 9; If the reordering flag is not 0, it means that variables have been sorted in this round of search, that is, the order of variables in the effective variable sequence may still be incorrect, and we need to return to step 3; Step 9: Output the reordered valid variables and expressions in the form of a script file; Reordering complete, program exit.
2. The automatic reordering method for improving the reliability of mechanized dynamics modeling according to claim 1, characterized in that: In step 2, the reordering flag is set as the judgment criterion for the subsequent step 8. There are two cases: 0 and 1. When it is 0, it means that the order of each variable is correct and the script file is output. When it is 1, it means that there are still variables with incorrect order and it is necessary to return to step 3 to clear the flag and continue to compare and sort.
Citation Information
Patent Citations
Mechanical modeling method for nonholonomic constraint system
CN106383973A
Big data modeling platform and method
CN107103050A
Data processing method of next-generation sequencing (NGS) data analysis platform (IMP)
CN107609350A