Method and device for automatically generating process code of space ring mold equipment and electronic equipment

By obtaining the initial process table and variable mapping table, and using semantic inference and string concatenation to generate process code, the problem of large programming workload and easy error in the automatic control of spatial ring mold equipment is solved, realizing convenient automated operation and improving the accuracy of process code.

CN118916018APending Publication Date: 2024-11-08BEIJING INST OF SPACECRAFT ENVIRONMENT ENG
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411018758.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

The programming workload during the automatic control of the space ring mold equipment is large and prone to errors, which affects the reliability and safety of the test.

Method used

By obtaining the initial process table and variable mapping table, and using semantic inference and string concatenation to generate process code, the programming workload is reduced and the accuracy is improved during the automation process.

Benefits of technology

It enables convenient and automated operation of the space ring mold equipment, reduces programming workload, and improves the accuracy of process code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916018A_ABST
    Figure CN118916018A_ABST
Patent Text Reader

Abstract

The invention provides a method and a device for automatically generating a process code of a space ring model device and an electronic device. The method comprises the following steps: acquiring an initial process table and a variable mapping table of the space ring model device; performing semantic speculation on command contents in the initial flow table line by line according to a variable corresponding relation in the variable mapping table, and generating an intermediate flow table represented by variables; and splicing the code character strings corresponding to the table contents in each line in the intermediate process table to generate a process code. According to the scheme provided by the invention, the process code can be automatically generated by utilizing a character string splicing mode through information extraction and semantic speculation of the initial process table and the variable mapping table, so that the control process of the space ring model equipment is more convenient, the programming workload in the automatic control process is effectively reduced, and the efficiency is improved. And the accuracy of the process code is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to a method, device and electronic equipment for automatically generating process codes for space ring model equipment. Background Art

[0002] Space ring model equipment, that is, space environment simulation equipment. Space ring model equipment is mainly used to simulate the vacuum environment, solar radiation environment, cold and dark environment and other environmental conditions in space. Its function is to test the entire spacecraft or subsystems, assemblies, components, components and materials in a simulated space environment on the ground.

[0003] Due to the wide variety of components contained in the space ring model equipment, when conducting tests, operators need to strictly follow the operating manual to control the equipment. The operation process is labor-intensive and prone to misoperation, which affects the reliability and safety of the test. If you want to achieve automatic control of the operation link, PLC programmers need to manually write a lot of code. Programming work also requires a lot of manpower, a large workload, and is prone to errors.

[0004] It is not difficult to find that the current automatic control process of space ring modeling equipment has problems such as large programming workload and easy errors. Summary of the invention

[0005] The present invention provides a method, device and electronic equipment for automatically generating process codes of space ring model equipment, so as to solve the defects of large programming workload and easy errors in the current automatic control process of space ring model equipment.

[0006] On the one hand, the present invention provides a method for automatically generating a process code for a space ring modeling equipment, comprising:

[0007] Obtain the initial process table and variable mapping table of the space ring mold equipment;

[0008] According to the variable correspondence in the variable mapping table, semantic inference is performed on the command content in the initial process table line by line to generate an intermediate process table represented by variables;

[0009] The code strings corresponding to the contents of each row in the intermediate process table are concatenated to generate the process code.

[0010] According to the method for automatically generating process codes for space ring mold equipment provided by the present invention, the command content in the initial process table is semantically inferred line by line according to the variable correspondence in the variable mapping table to generate an intermediate process table represented by variables, including:

[0011] Read the initial process table and the variable mapping table, and create an initialization table;

[0012] Extracting key information from the command content in the initial process table line by line;

[0013] Perform semantic inference on at least part of the key information in each line to determine the command type corresponding to the command content;

[0014] Determine the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table;

[0015] The table content is written into the initialization table to obtain an intermediate process table.

[0016] According to the method for automatically generating process codes for space ring mold equipment provided by the present invention, the command type includes a pop-up window type;

[0017] The determining the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table includes:

[0018] According to the corresponding relationship between the pop-up window type and the variables in the variable mapping table, it is determined that the table content of the type column is a pop-up window.

[0019] According to the method for automatically generating process codes for space ring model equipment provided by the present invention, the command type includes a judgment type;

[0020] The determining the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table includes:

[0021] According to the judgment type, determining the table content of the type column as judgment;

[0022] Extracting the device name code from the command content;

[0023] According to the correspondence between the device name code and the variables in the variable mapping table, extracting the device value corresponding to the device name code in the variable mapping table;

[0024] Extracting numbers from the command content;

[0025] Combining the device value, the number and the judgment symbol in the command content to generate a code snippet;

[0026] The code snippet is used as the table content of the end judgment column.

[0027] According to the method for automatically generating process codes for space ring model equipment provided by the present invention, the command type includes an operation type;

[0028] The determining the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table includes:

[0029] According to the operation type, determining the table content of the type column as an operation;

[0030] Extracting the device name code from the command content;

[0031] Extracting the operation column value and the completion column value corresponding to the column where the operation keyword is located in the variable mapping table according to the device name code, the operation keyword in the command content, and the variable correspondence in the variable mapping table;

[0032] The operation column value is used as the table content of the operation content column, and the completion column value is used as the table content of the end judgment column.

[0033] According to the method for automatically generating process codes for space ring model equipment provided by the present invention, the command type includes a waiting type;

[0034] The determining the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table includes:

[0035] According to the waiting type, determining the table content of the type column is waiting;

[0036] Extracting numbers from the command content;

[0037] The numbers are used as table contents of the operation content column.

[0038] According to the method for automatically generating process codes for space ring mold equipment provided by the present invention, the table contents are written into the initialization table to obtain an intermediate process table, including:

[0039] Writing the table contents into respective columns in the initialization table;

[0040] If it is determined that the last row of named content in the initial process table has been read, the table content in the initialization table is numbered row by row, and the numbers corresponding to each row are used as the table content of the step number column and the judgment not to jump column respectively;

[0041] According to the table contents of the columns that are not judged to pass the jump, the table contents of the columns that are judged to pass the jump are determined to obtain an intermediate flow table.

[0042] According to the method for automatically generating process codes for space ring mold equipment provided by the present invention, after generating the process codes, the method further includes:

[0043] The execution status of each line of to-be-executed command in the process code is controlled by a preset process value assignment rule to execute the process code.

[0044] On the other hand, the present invention also provides a device for automatically generating process codes for space ring model equipment, comprising:

[0045] An acquisition module is used to obtain the initial process table and variable mapping table of the space ring mold equipment;

[0046] An inference module, used to perform semantic inference on the command content in the initial process table line by line according to the variable correspondence in the variable mapping table, and generate an intermediate process table represented by variables;

[0047] The generation module is used to control the execution status of each row of the to-be-executed commands in the intermediate process table through a preset process value assignment rule to generate a process code.

[0048] On the other hand, the present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements any of the above-mentioned methods for automatically generating process codes for spatial ring modeling equipment.

[0049] The method, device and electronic device for automatically generating the process code of the space ring model equipment provided by the present invention obtain the initial process table and the variable mapping table of the space ring model equipment, and perform semantic inference on the command content in the initial process table line by line according to the variable correspondence in the variable mapping table, generate an intermediate process table represented by variables, and finally splice the code strings corresponding to the table contents of each line in the intermediate process table to generate the process code. Since the process code can be automatically generated by string splicing through information extraction and semantic inference of the initial process table and the variable mapping table, the control process of the space ring model equipment is more convenient, the programming workload in the automated control process is effectively reduced, and the accuracy of the process code is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 It is a flowchart of a method for automatically generating process codes for a space ring mold equipment provided by an embodiment of the present invention;

[0052] Figure 2 It is a flowchart of the intermediate process table generation process;

[0053] Figure 3It is a flowchart of the process of generating process code by string concatenation;

[0054] Figure 4 It is a flowchart of the execution process of the process code;

[0055] Figure 5 It is a software interface diagram of the automatic process code generation software;

[0056] Figure 6 It is a structural schematic diagram of a device for automatically generating process codes for space ring mold equipment provided by an embodiment of the present invention;

[0057] Figure 7 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0059] Combine the following Figures 1 to 7 The detailed scheme of the method, device and electronic equipment for automatically generating process code of space ring model equipment provided by the embodiment of the present invention is described.

[0060] Figure 1 It is a flow chart of a method for automatically generating process codes for space ring model equipment provided by an embodiment of the present invention.

[0061] like Figure 1 As shown, the method for automatically generating flow code of a space ring model equipment provided by an embodiment of the present invention can be executed by a computer or server with data receiving and data processing functions. The method mainly includes the following steps:

[0062] Step 110: Obtain the initial process table and variable mapping table of the spatial ring model equipment.

[0063] In this embodiment, the initial process table shows the specific execution steps of the automatic process of the spatial ring mold equipment, as shown in Table 1. The table has only one column, and each row of the column is a description of each step of the automatic process, indicating which operations need to be performed in the automatic process.

[0064] Table 1 Initial process table of space ring mold equipment

[0065]

[0066] The abbreviations in the initial process table represent the equipment name code of the space ring mold equipment, such as "VC1", "VC2", etc., which represent the corresponding valve code, and "PC1", "PC2" represent the corresponding cryogenic pump code. The initial process table is presented in the form of an Excel file. Each initial process table occupies an Excel sheet, and each sheet represents an automatic process, such as "one-button start", "one-button stop", etc. Such an Excel file includes all the automatic process information of the space ring mold equipment.

[0067] The variable mapping table shows the variable names in the SCL code of the PLC corresponding to the device name codes in the initial process table. Table 2 shows the presentation form of the variable mapping table by way of example. The "Name" column is the code for all devices in the system. All device name codes in the initial process table can be found in the variable mapping table.

[0068] Table 2 Variable mapping table of space ring mold equipment

[0069]

[0070]

[0071] Among them, the "Structure Index" and "Prefix" columns are optional columns. Their function is to facilitate the synthesis of the five required columns "Open", "Open Complete", "Close", "Close Complete", and "Value" through the merge string function in the Excel table. The "Structure Index" is used to generate the table content in the "Prefix" column, and the "Prefix" column is the variable name in the PLC program. The "Open" column is the code when the device performs the open operation, and the "Open Complete" column is the flag code when the device is opened. That is, when the value of the code is "True", it means that the device has been opened.

[0072] Similarly, the "Close" column is the code when the device performs the close operation, and the "Close Complete" column is the flag code when the device closes. That is, when the value of the code is "True", it means that the device has closed. The "Value" column is the numerical variable involved in the device. If the device has multiple values ​​that need to be involved in the automatic process, the device will appear in multiple rows in the variable mapping table to index all the values.

[0073] It should be noted that the reason why the five columns of "Open", "Open Completed", "Close", "Close Completed", and "Value" are set in this embodiment is because all operations on the device in the automatic process can be attributed to the five categories of opening and closing the device, determining whether the device is opened or closed, and querying its value.

[0074] Step 120: According to the variable correspondence in the variable mapping table, semantic inference is performed on the command content in the initial process table line by line to generate an intermediate process table represented by variables.

[0075] In this embodiment, the command content of each row in the initial process table can be semantically inferred according to the variable correspondence in the variable mapping table, and then an intermediate process table can be generated, thereby providing an effective data basis for the generation of process codes.

[0076] Step 130: concatenate the code strings corresponding to the contents of each row in the intermediate process table to generate a process code.

[0077] It is understandable that the process of generating process codes based on the intermediate process table is essentially a process of splicing code strings. The splicing link will gradually splice the code strings corresponding to the contents of each row of the intermediate process table according to a certain splicing execution logic, and the process code can be obtained after the splicing is completed. The entire process of process code generation can be automatically implemented without the need for programmers to manually write codes. The process of process code generation is more efficient and convenient, making the process of realizing control automation of spatial ring mold equipment easier to implement.

[0078] In one embodiment, see Figure 2 , according to the variable correspondence in the variable mapping table, the command content in the initial process table is semantically inferred line by line to generate an intermediate process table represented by variables, including:

[0079] The first step is to read the initial process table and variable mapping table and create an initialization table.

[0080] In this embodiment, the initialization table includes seven columns: description, step number, type, operation content, end judgment, jump if judgment passes, and jump if judgment fails.

[0081] The description column is a copy of the content in the initial process table, indicating what command is executed in this step; the step number column is the number of the command in this step, starting from 1; the type column is the type of command content in this line determined by the program after judgment.

[0082] In the space ring modeling equipment, all operations can be divided into four categories: "pop-up window", "judgment", "operation" and "wait". "Pop-up window" means that the command is a prompt box popped up by the program and requires the operator to confirm; "judgment" means that the command is for the program to judge whether a certain reading of the equipment is greater than or less than a certain value; "operation" means that the command is for the program to perform an operation on the equipment, such as turning the equipment on or off; "wait" means that the command is to pause the automatic process for a period of time.

[0083] The operation content in the intermediate process table is listed as the key code snippet of this step of the program; the end judgment is listed as the sign that the command has been executed, in the form of a code snippet; the jump if judgment is passed and the jump if judgment is not passed are both numbers. The jump if judgment is passed is the step number that needs to be jumped if the judgment result is yes when the command in this line is a judgment type; the corresponding jump if judgment is not passed is the step number that needs to be jumped when the judgment result is no.

[0084] The second step is to extract key information from the command content in the initial process table line by line.

[0085] It is understandable that the key information includes some key contents in the command content in the initial process table, such as keywords, equipment name codes, and values.

[0086] The third step is to perform semantic inference on at least part of the key information of each line to determine the command type corresponding to the command content.

[0087] In this embodiment, each row of the initial process table is read cyclically, and keyword detection is performed on the read command content. The command type corresponding to the command content can be determined according to the detected keyword.

[0088] The fourth step is to determine the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table.

[0089] The fifth step is to write the table contents into the initialization table to obtain the intermediate process table.

[0090] In one embodiment, the command type includes a pop-up type; in actual applications, if keywords such as "pop-up", "warning" or "prompt" appear in the command content of the line, the command type of the command content is determined to be a pop-up type.

[0091] Further, according to the command type and the corresponding relationship between the variables in the variable mapping table, the table content to be written is determined, specifically including:

[0092] According to the correspondence between the pop-up window type and the variables in the variable mapping table, determine that the table content of the type column is a pop-up window.

[0093] In actual applications, after writing the command type "pop-up window" into the type column, fill in "none" for the operation content and end judgment columns.

[0094] In one embodiment, the command type includes a judgment type; in actual application, if a symbol for judging size appears in the command content of the line, such as ">", "<", "≤" or "≥", the command type of the command content is defined as a judgment type.

[0095] Further, according to the command type and the corresponding relationship between the variables in the variable mapping table, the table content to be written is determined, specifically including:

[0096] The first step is to determine the table content of the type column as judgment based on the judgment type.

[0097] The second step is to extract the device name code from the command content.

[0098] The third step is to extract the device value corresponding to the device name code in the variable mapping table according to the corresponding relationship between the device name code and the variables in the variable mapping table.

[0099] The fourth step is to extract the numbers in the command content.

[0100] The fifth step is to combine the device values, numbers, and judgment symbols in the command content to generate a code snippet.

[0101] Step 6. Use the code snippet as the table content of the end judgment column.

[0102] In this embodiment, the "judgment" type content is first written into the "Type" column of the initialization table, and then the device name code in the command content is extracted through a regular expression, and the device value in the value column corresponding to the device name code is found in the variable mapping table, and then the number in the command content is extracted, and the device value, judgment symbol and extracted number are combined together to form a code fragment, which is put into the end judgment column of the initialization table. For the operation content column, fill in "None".

[0103] In one embodiment, the command type includes an operation type; in actual application, if one of the keywords "open", "start", "turn on", "close" or "stop" appears in the command content of the line, the command type of the command content is judged to be "operation".

[0104] Further, according to the command type and the corresponding relationship between the variables in the variable mapping table, the table content to be written is determined, specifically including:

[0105] The first step is to determine the table content of the type column as an operation based on the operation type.

[0106] The second step is to extract the device name code from the command content.

[0107] The third step is to extract the operation column value and completion column value corresponding to the column where the operation keyword is located in the variable mapping table according to the device name code, the operation keyword in the command content and the variable correspondence in the variable mapping table.

[0108] The fourth step is to use the value of the operation column as the table content of the operation content column, and use the value of the completion column as the table content of the end judgment column.

[0109] In this embodiment, if the keyword is one of the three "open", "start", and "start", it means that the content of the command is an operation to open the device. The device name code in the command content is extracted, and the operation column value corresponding to the open column and the completion column value corresponding to the open completion column are found in the variable mapping table, and are written into the operation content column and the end judgment column in the initialization table respectively.

[0110] If the keyword is "close" or "stop", extract the device name code in the command content, find the corresponding operation column value of the close column and the completion column value of the close completion column in the variable mapping table, and write them into the operation content column and end judgment column in the initialization table respectively.

[0111] In one embodiment, the command type includes a waiting type; in actual application, if one of the keywords "wait", "delay", "delay", "interval", "timing", and "countdown" appears in the content of the command line, the command content is judged to be "wait".

[0112] Further, according to the command type and the corresponding relationship between the variables in the variable mapping table, the table content to be written is determined, specifically including:

[0113] The first step is to determine the table content of the type column as waiting according to the waiting type.

[0114] The second step is to extract the numbers in the command content.

[0115] The third step is to use numbers as the table content of the operation content column.

[0116] In actual applications, after "wait" is filled in the type column, the number in the command content can be extracted, and the extracted number is written into the operation content column in the initialization table as the number of seconds to wait.

[0117] In some embodiments, if the above-mentioned keyword is not detected in the command content of the line, the command type of the command content is defined as "pop-up window" and written into the type column of the initialization table.

[0118] In one embodiment, the table content is written into the initialization table to obtain the intermediate process table, which specifically includes:

[0119] The first step is to write the table contents into their respective columns in the initialized table.

[0120] In the second step, if it is determined that the last row of named content in the initial process table has been read, the table content in the initialization table is numbered row by row, and the numbers corresponding to each row are used as the step number column and the table content of the judgment not passing the jump column.

[0121] The third step is to determine the table contents that pass the jump column based on the table contents that do not pass the jump column, and obtain the intermediate flow table.

[0122] In this embodiment, if the last row of the initial process table is read, the step number column, the pass jump column and the fail jump column are filled in. Among them, the step number column is assigned values ​​starting from 1 in numerical order, the fail jump column and the step number column have the same content, and the table content of the pass jump column is the value of the fail jump column plus 1, and finally the intermediate process table is output. Table 3 exemplarily shows the presentation form of the intermediate process table.

[0123] Table 3 Intermediate process table

[0124]

[0125]

[0126] In some embodiments, considering that there may be some errors in the automatically generated intermediate process table, such as type judgment errors, operation content and end judgment code errors, etc., these errors will affect the accuracy of subsequent process codes. For this reason, the intermediate process table can also be manually checked and modified.

[0127] In addition, the values ​​of the two columns, "Jump Passed" and "Jump Not Passed", are currently only default values, that is, the semantic inference program assumes that the entire automatic process is carried out in sequence, which is also the most common case of the automatic process. In other cases, the automatic process is not carried out in sequence. For example, when the automatic process determines that a parameter value of a device is lower than or higher than a certain value, the automatic process needs to skip certain steps or change to another execution path. At this time, the programmer needs to manually adjust the values ​​of the two columns, "Jump Passed" and "Jump Not Passed".

[0128] By adding a manual revision step, the accuracy of the content of the intermediate process table can be further improved, thereby ensuring the accuracy and reliability of the subsequent automatically generated process code.

[0129] In this embodiment, the principle of process code generation is essentially string concatenation. Figure 3 The process of string concatenation is shown as an example.

[0130] See also Figure 3 , the operation logic of the string concatenation process is as follows:

[0131] First, read the intermediate process table, and then initialize an empty string variable "Text".

[0132] After that, loop through each row of the intermediate process table, get the value of the step number column in the row, and synthesize the Step name of the row according to the value of the step number column, that is, Step_name (type is string). For example, if the step number column value is 2, then Step_name = 'Step2'.

[0133] Next, get the value of the type column in the row. If the value of the type column is "pop-up window", concatenate the code string corresponding to the pop-up window type. The code is as follows (Python):

[0134] text+='IF'+step_name+'=1THEN / / Allow startup\n'

[0135] text+=step_name+':=2; / / pass to upper level for judgment\n'

[0136] text+='END_IF;\n'

[0137] text+='IF'+step_name+'=3THEN / / The value is 3, indicating that the upper judgment passed\n'

[0138] text+=step_name+':=5; / / Complete this step\n'

[0139] If you have not reached the last row of the intermediate process table, you need to add the "judgment passed jump" code. Get the value of the judgment passed jump column, generate the next step Step_name based on the value, and continue to splice the code, that is:

[0140] text+=Step_name+':=1; / / Next step allows startup\n'

[0141] If the value of the type column is "judgment", the code string corresponding to the judgment type is concatenated. The code is as follows (Python):

[0142] text+='IF'+step_name+'=1THEN / / Allow startup\n'

[0143] text+=step_name+':=4; / / No need for upper level judgment and actual operation, directly set to 4\n'

[0144] text+='END_IF;\n'

[0145] text+='IF'+step_name+'=4THEN / / Begin to judge\n'

[0146] text+='IF'+merge_condition(end_judge)+'THEN / / Start judging\n'

[0147] text+=step_name+':=5; / / Complete this step\n'

[0148] If you have not reached the last row of the intermediate process table, you need to add the "judgment through jump" code, obtain the value of the judgment through jump column, generate the next step Step_name according to the value of the judgment through jump column, and continue to splice the code, that is:

[0149] text+=Step_name+':=1; / / Next step allows startup\n'

[0150] Get the value of the jump failure column in the intermediate process table. If the value is not equal to the value of the step number column, it means that the step fails to jump. Generate the Step_name of the jump step based on the value, and then continue to splice the code, that is:

[0151] text+='ELSE\n'

[0152] text+=get_step_name(db_name,auto_num,n_jump)+':=1;

[0153] / / If the judgment fails, jump to the step that failed\n'

[0154] text+=step_name+':=5; / / Complete this step\n'

[0155] Regardless of the value of the column that does not pass the jump, you need to add a terminator, that is:

[0156] text+='END_IF;\n'

[0157] text+='END_IF;\n'

[0158] If the value of the type column is "operation", concatenate the code string corresponding to the operation type. The code is as follows (Python):

[0159] text+='IF'+step_name+'=1THEN / / Allow startup\n'

[0160] text+=step_name+':=3; / / No need to judge by the upper level, just set it to 3\n'

[0161] text+='END_IF;\n'

[0162] text+='IF'+step_name+'=3THEN / / Start execution\n'

[0163] Get the value of the operation content column in the intermediate process table, split it by the delimiter, and concatenate it in the string Text in sequence, and then continue to concatenate the strings, that is:

[0164] text+=step_name+':=4; / / The operation is completed, and the next step is started to complete the detection\n'

[0165] text+='END_IF;\n'

[0166] text+='IF'+step_name+'=4THEN / / Start to check whether the operation is completed\n'

[0167] If the value of the end judgment column in the intermediate process table is not "none", it means that the operation has an end judgment flag. Read the content of the end judgment column in the intermediate process table, assign it to the variable end_judge, and continue to concatenate the strings, that is:

[0168] text+='IF'+merge_condition(end_judge)+'THEN / / Check whether the operation is completed\n'

[0169] The "merge_condition" function is used to reconstruct the string in end_judge according to the syntax.

[0170] Regardless of whether the value of the end judgment column is "None", you need to continue splicing the code, that is:

[0171] text+=step_name+':=5; / / Mark detection passed, operation completed\n'

[0172] If you have not reached the last row of the intermediate process table, you need to add the "judgment through jump" code, obtain the value of the judgment through jump column, generate the next step Step_name according to the value of the judgment through jump column, and continue to splice the code, that is:

[0173] text+=Step_name+':=1; / / Next step allows startup\n'

[0174] If the value of the end judgment column in the intermediate process table is not "None", you need to add the end character of the IF structure, that is:

[0175] text+='END_IF;\n'

[0176] Continue to splice the code and add the end mark:

[0177] text+='END_IF;\n'

[0178] If the value of the Type column is not any of "Popup", "Judgement" and "Operation", it means that the value of the Type column is "Wait". Start to concatenate the code string corresponding to the wait type, that is:

[0179] text+='IF'+step_name+'=1THEN / / Allow startup\n'

[0180] text+=step_name+':=3; / / No need for upper judgment, directly set to 3\n'

[0181] text+='END_IF;\n'

[0182] text+='IF'+step_name+'=3THEN / / Allow the timing operation to start\n'

[0183] text+=get_timer_name()+':="Global".timer; / / Start timing\n'

[0184] text+=step_name+':=4; / / mark to start the next step\n'

[0185] text+='END_IF;\n'

[0186] text+='IF'+step_name+'=4THEN / / You can start the next step\n'

[0187] delay_number=get_delay(operation)

[0188] text+='IF("Global".timer-'+get_timer_name()+')>'+delay_number+'THEN / / If the time is up\n'

[0189] text+=step_name+':=5; / / Complete timing work\n'

[0190] Among them, get_timer_name() is used to obtain the string name of the timer. The implementation is relatively simple and will not be described in detail here.

[0191] If you have not reached the last row of the intermediate process table, you need to add the "judgment through jump" code, obtain the value of the judgment through jump column, generate the next step Step_name according to the value of the judgment through jump column, and continue to splice the code, that is:

[0192] text+=Step_name+':=1; / / Next step allows startup\n'

[0193] Regardless of whether it is the last row of the intermediate process table, you need to add the end mark of the IF structure, that is:

[0194] text+='END_IF;\n'

[0195] text+='END_IF;\n'

[0196] If it has not reached the last row of the intermediate process table, continue to loop and read the row content of the intermediate process table. Otherwise, it means that all code strings are concatenated, and the string Text is output and copied to the system clipboard. At this time, the program execution ends and the process code can be obtained.

[0197] In one embodiment, after the process code is generated, the method for automatically generating the process code of the space ring mold equipment provided in this embodiment may further include:

[0198] Through the pre-set process value assignment rules, the execution status of each line of commands to be executed in the process code is controlled to execute the process code.

[0199] In a specific implementation, the execution status of each line of to-be-executed command in the process code is controlled through a pre-set process value assignment rule, specifically including:

[0200] First, initialize the process value corresponding to each line of the command to be executed in the process code.

[0201] Then, the process value of the first command to be executed in the process code after initialization is assigned to 1.

[0202] Next, during the execution of each line of commands to be executed, the process value of each line of commands to be executed is read.

[0203] Subsequently, according to the process value of each line of commands to be executed, the command type of the commands to be executed, and the process value assignment rule, the process value of each line of commands to be executed is assigned and adjusted to control the execution status of each line of commands to be executed.

[0204] Finally, if the process value of the last command to be executed in the process code is determined to be 5, it is determined that the execution of the commands to be executed in the process code is completed.

[0205] In this embodiment, after the process code is generated, the programmer pastes the process code into the PLC program code to run the process code. Figure 4 During the execution of the process code, the process code can be executed according to the preset code running logic, as follows:

[0206] The first step is to reset the step value of all pending commands to 0. When the automatic process is started, set the step value of the first pending command to 1.

[0207] It is understandable that each command in the automatic process has a step value, which represents the running status of the command. The upper program, that is, the human-computer interaction interface, can judge the running status of the command according to the step value and provide the user with a status display. Step = 0 means that the command has not been run, step = 1 to 4 means that the command is running, and step = 5 means that the command has been completed.

[0208] The second step is to determine whether the step value of the last command to be executed is 5. If so, it means that the entire automatic process has been executed and the step values ​​of all commands are reset to zero.

[0209] The third step is to read the step value of each command to be executed if the automatic process has not been completed.

[0210] In the fourth step, if the step value of the command to be executed is 1, it means that the command to be executed is just about to start execution. If the command type of the command to be executed is "pop-up window", let step = 2. It should be noted that when the upper program detects that the step value of a command is 2, a pop-up window will be displayed. After the operator confirms the pop-up window, the step value is assigned to 3; if the command type of the command to be executed is "judgment", let the step value be 4; if the command type of the command to be executed is neither "pop-up window" nor "judgment", it means that the command type of the command to be executed must be one of "operation" and "wait", let the step value be 3, and the program returns to the second step.

[0211] In the fifth step, if the step value of the command to be executed is 3 and the command type is "pop-up window", it means that the pop-up window has been confirmed by the operator and the command has been executed. The step value of the command is set to 5. According to the value of the jump column in the intermediate process table, the next command to be executed is found, and the step value of the command is set to 1. The program returns to the second step; if the command type is operation, the code corresponding to the operation content column in the intermediate process table is executed, and the step value is set to 4. The program returns to the second step; if the command type is neither "pop-up window" nor "operation", the command type must be "wait", the timer is started, and the step value is set to 4, and the program returns to the second step.

[0212] Step 6: If the step value of the command is 4 and the command type is "judgment", the value of the end judgment column in the intermediate flow table is used as the end judgment mark. If the value is True, the step value is set to 5, and then the next command to be executed is found according to the value of the jump column in the intermediate flow table, and its step value is set to 1. Otherwise, the next command to be executed is found according to the value of the jump column in the intermediate flow table. If it jumps to itself, the program returns to the second step, otherwise the step value of the next command is set to 1, and the step value of this command is set to 5; if the command type is "operation", its execution path and command type are consistent with the judgment type. If the command type is "wait", it is determined whether the timer has timed out. If it has timed out, its step value is set to 5, and the next command to be executed is found according to the value of the jump column in the intermediate flow table, and its step value is set to 1. Otherwise, the next command to be executed is found according to the value of the jump column in the intermediate flow table, and the program returns to the second step.

[0213] Generally, the judgment of the "wait" command is not based on the command pointed to by the value of the jump column, so the command will remain in the waiting state if the timer has not timed out.

[0214] In practical applications, the execution program corresponding to the automatic generation method of process code for spatial ring mold equipment can be written in Python, and the GUI can be made using PySide6. Figure 5 The software interface of the automatic process code generation software corresponding to the method provided in this embodiment is exemplarily shown.

[0215] See also Figure 5 , the programmer clicks the "Select initial process table" and "Select variable mapping table" buttons to select the table, and clicks the "Generate intermediate process table" button to generate the intermediate process table. After the programmer has modified the intermediate process table, click the "Select intermediate process table" button to select the modified intermediate process table, and then click the "Generate code" button to generate the process code, and display the process code in the "Information output" column. This process code will be automatically copied to the computer clipboard, which is convenient for programmers to paste directly.

[0216] In summary, the method for automatically generating process codes for space ring mold equipment provided in this embodiment has at least the following advantages:

[0217] First, the command types in the initial process table are inferred through keywords, and the commands are classified into four types: "pop-up", "judgment", "operation" and "waiting". Various complex commands can be simplified into a combination of these four types, realizing the classification processing of commands.

[0218] Second, the device name codes and corresponding Chinese operations in the initial process table are converted into codes through the variable mapping table, which can adapt to the different naming methods of variables or attributes of different programmers.

[0219] Third, by generating an intermediate process table and having programmers check for omissions and fill in the gaps, the accuracy of the final generated process code is ensured, making up for the defect that the semantic inference process may infer incorrect results. At the same time, most of the content in the intermediate process table has been automatically generated, greatly reducing the workload of programmers.

[0220] Fourth, by decomposing operations into four types: "pop-up window", "judgment", "operation" and "waiting", these four code templates are fixed to facilitate the automatic generation of process codes and improve code generation efficiency.

[0221] Fifth, during the execution of the process code, the step value is used to control the execution status of each command, and it also serves as the basis for the upper-level software to determine the execution status of the command. By using this control method, parallel operation of instructions is achieved, that is, when the automatic process of the program is running, commands other than the automatic process can be executed at any time, making the execution process of the process code more flexible.

[0222] Based on the same general inventive concept, the present invention also protects a device for automatically generating flow codes for space ring modeling equipment. The device for automatically generating flow codes for space ring modeling equipment provided by the present invention is described below. The device for automatically generating flow codes for space ring modeling equipment described below and the method for automatically generating flow codes for space ring modeling equipment described above can be referred to each other.

[0223] Figure 6 It is a structural schematic diagram of a device for automatically generating process codes for space ring model equipment provided by an embodiment of the present invention.

[0224] like Figure 6 As shown, the space ring model equipment process code automatic generation device provided by the embodiment of the present invention specifically includes:

[0225] The acquisition module 210 is used to obtain the initial process table and variable mapping table of the spatial ring modeling equipment.

[0226] The inference module 220 is used to perform semantic inference on the command content in the initial process table line by line according to the variable correspondence in the variable mapping table, and generate an intermediate process table represented by variables.

[0227] The generation module 230 is used to control the execution status of each row of the to-be-executed commands in the intermediate process table through a preset process value assignment rule to generate a process code.

[0228] Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated again here.

[0229] Figure 7 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.

[0230] like Figure 7 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the method for automatically generating the flow code of the space ring model device provided in the above embodiments.

[0231] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0232] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the method for automatically generating flow code for spatial ring modeling equipment provided in the above-mentioned embodiments.

[0233] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for automatically generating flow code for spatial ring modeling equipment provided in the above-mentioned embodiments.

[0234] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0235] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0236] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for automatically generating process code for space ring mold equipment, characterized in that: include: Obtain the initial process table and variable mapping table of the space ring mold equipment; According to the variable correspondence in the variable mapping table, semantic inference is performed on the command content in the initial process table line by line to generate an intermediate process table represented by variables; The code strings corresponding to the contents of each row in the intermediate process table are concatenated to generate the process code.

2. The method for automatically generating process code for space ring mold equipment according to claim 1, characterized in that: The step of performing semantic inference on the command content in the initial process table line by line according to the variable correspondence in the variable mapping table to generate an intermediate process table represented by variables includes: Read the initial process table and the variable mapping table, and create an initialization table; Extracting key information from the command content in the initial process table line by line; Perform semantic inference on at least part of the key information in each line to determine the command type corresponding to the command content; Determine the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table; The table content is written into the initialization table to obtain an intermediate process table.

3. The method for automatically generating process code of space ring mold equipment according to claim 2 is characterized in that: The command type includes a pop-up window type; The determining the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table includes: According to the corresponding relationship between the pop-up window type and the variables in the variable mapping table, it is determined that the table content of the type column is a pop-up window.

4. The method for automatically generating process code for space ring mold equipment according to claim 2, characterized in that: The command type includes a judgment type; The determining the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table includes: According to the judgment type, determining the table content of the type column as judgment; Extracting the device name code from the command content; According to the correspondence between the device name code and the variables in the variable mapping table, extracting the device value corresponding to the device name code in the variable mapping table; Extracting numbers from the command content; Combining the device value, the number and the judgment symbol in the command content to generate a code snippet; The code snippet is used as the table content of the end judgment column.

5. The method for automatically generating process code for space ring mold equipment according to claim 2 is characterized in that: The command type includes an operation type; The determining the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table includes: According to the operation type, determining the table content of the type column as an operation; Extracting the device name code from the command content; Extracting the operation column value and the completion column value corresponding to the column where the operation keyword is located in the variable mapping table according to the device name code, the operation keyword in the command content, and the variable correspondence in the variable mapping table; The operation column value is used as the table content of the operation content column, and the completion column value is used as the table content of the end judgment column.

6. The method for automatically generating process code for space ring mold equipment according to claim 2, characterized in that: The command type includes a waiting type; The determining the table content to be written according to the command type and the corresponding relationship between the variables in the variable mapping table includes: According to the waiting type, determining the table content of the type column is waiting; Extracting numbers from the command content; The numbers are used as table contents of the operation content column.

7. The method for automatically generating process code for space ring mold equipment according to claim 2, characterized in that: The step of writing the table content into the initialization table to obtain an intermediate process table includes: Writing the table contents into respective columns in the initialization table; If it is determined that the last row of named content in the initial process table has been read, the table content in the initialization table is numbered row by row, and the numbers corresponding to each row are used as the table content of the step number column and the judgment not to jump column respectively; According to the table contents of the columns that are not judged to pass the jump, the table contents of the columns that are judged to pass the jump are determined to obtain an intermediate flow table.

8. The method for automatically generating process code of space ring model equipment according to claim 1, characterized in that: After generating the process code, the method further includes: The execution status of each line of to-be-executed command in the process code is controlled by a preset process value assignment rule to execute the process code.

9. A device for automatically generating process codes for space ring mold equipment, characterized in that: include: An acquisition module is used to obtain the initial process table and variable mapping table of the space ring mold equipment; An inference module, used to perform semantic inference on the command content in the initial process table line by line according to the variable correspondence in the variable mapping table, and generate an intermediate process table represented by variables; The generation module is used to control the execution status of each row of the to-be-executed commands in the intermediate process table through a preset process value assignment rule to generate a process code.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for automatically generating process code for a spatial ring modeling equipment as described in any one of claims 1 to 8 is implemented.