Data generation method, computer readable storage medium and electronic equipment

By converting configurable data into source code, the problem that the prior art cannot be compatible with different data files is solved, and compatibility for multiple rail transit projects and adaptability of offline data generation tools is achieved.

CN119415147APending Publication Date: 2025-02-11CASCO SIGNAL LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411456349.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The existing offline data generation methods are not compatible with different data files, which leads to changes in the variable content or sequence defined by online software. The offline data generation tool needs to be updated frequently and cannot adapt to the needs of many different project.

Method used

通过输入安全数据和配置数据,遍历配置数据生成变量关系对照表,解析安全数据的逻辑配置并生成源代码,最终将源代码输出,以实现数据的兼容性。

Benefits of technology

This method makes it necessary to modify the functional configuration in the security data file for different rail transit projects only, without modifying the offline data generation tool, effectively reducing the frequent updates of the tools and enhancing the compatibility of offline data generation tools for multiple rail transit projects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415147A_ABST
    Figure CN119415147A_ABST
Patent Text Reader

Abstract

The invention provides a data generation method for converting configurable data into source codes, a computer readable storage medium and electronic equipment. The data generation method comprises the steps of inputting security data and configuration data; traversing the configuration data to generate a variable relation comparison table; analyzing the logic configuration of the security data; generating a source code of the security data logic; and outputting the generated source code. According to the data generation method for converting the configurable data into the source code, by traversing the configuration data and generating the variable relation comparison table, the logic configuration of the security data is analyzed to generate the source code of the security data logic, and finally the source code is output; therefore, for different rail transit projects, only function configuration in the safety data file needs to be modified, an offline data generation tool does not need to be modified, frequent updating of the tool can be effectively reduced, and compatibility of the offline data generation tool to various rail transit projects is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of rail transit data transmission control, and in particular to a data generation method for converting configurable data into source code, a computer-readable storage medium and an electronic device. Background Art

[0002] In the field of rail transit, the two-way communication between trains and the ground is currently achieved by CBTC (Communication Based Train Control System), and the continuous automatic control of trains is completed accordingly. The normal operation of the CBTC signal system requires the online software system to obtain real-time information such as train location and track section, so as to achieve accurate and safe control of trains.

[0003] In order to ensure the high-performance and high-efficiency computing requirements of online software, the CBTC system needs to migrate the static data configuration required for runtime. The static data is generated by the offline data generation tool. The existing offline data generation steps usually include: inputting static data files; calculating the processing logic of the variables required for the output file according to the data generation rules; and outputting the data in the order and structure required by the output file.

[0004] However, existing offline data generation methods have problems, mainly including: the generated binary file generation method is completely independent and highly dependent on the input data file. Once the content or order of the variables defined by the online software changes, the offline data generation tool needs to be upgraded and cannot adapt to a variety of different project requirements.

[0005] Therefore, a data generation method that is compatible with different data files is needed. Summary of the invention

[0006] The object of the present invention is to provide a data generation method, a computer-readable storage medium and an electronic device, wherein the data generation method has the advantage of strong compatibility.

[0007] To achieve the above object, the present invention provides a data generation method for converting configurable data into source code, which comprises:

[0008] S10, input security data and configuration data;

[0009] S20, traversing the configuration data to generate a variable relationship comparison table;

[0010] S30, parsing the logical configuration of the security data;

[0011] S40, generating source code of security data logic;

[0012] S50: output the generated source code.

[0013] Optionally, the safety data and the configuration data belong to the field of rail transit.

[0014] Optionally, in step S10, the safety data includes customizable safety function parameters; and the configuration data includes a correspondence relationship between variable names used in offline data.

[0015] Optionally, the step S20 of traversing the configuration data to generate a variable relationship comparison table specifically includes:

[0016] All variables are traversed in sequence according to the order in the configuration data, and the labels of the variables and the content configured under the labels are parsed, so that the variable names used in the offline data and the variable names used in the online software form a one-to-one correspondence, and the corresponding relationship is stored in the variable relationship comparison table.

[0017] Optionally, the logical configuration of parsing the security data in step S30 includes:

[0018] S31, according to the path of the tool predefined rule, obtain the label where the functional logic of the variable configuration is located, and use the label as the starting point to parse its logic from the inside out;

[0019] S32, traversing the logic of the current variable layer by layer inwards until finding the innermost logical operator and the operands configured under the logical operator;

[0020] S33, according to the name of the operand, find out the name of the operand used in the online software in the variable relationship comparison table, and construct a code of "variable name in source code == TRUE";

[0021] S34, obtaining the previous logical operator of the current operand, if the logical operator is a single-purpose logical operator, constructing a global logical variable with a unique name, using the code obtained by parsing the operand as the value condition of the global logical variable, and calculating the variable value of the global logical variable when the value condition is met and the variable value when the value condition is not met according to the processing method of the previous logical operator, and storing the global logical variable in the intermediate variable list;

[0022] S35, if the logic operator supports multiple operands, concatenate the code obtained by parsing the operands with the code corresponding to the current logic operator, and continue parsing the next logic operand of the logic operator;

[0023] S36. Until all the operands of the outermost logical operator are parsed, a new output variable is created, and the variable name of the output variable is the variable name defined in the tool predefined rule; the value condition is the concatenated code; and according to the current processing of the logical operator, the variable value of the output variable when the value condition is met and the variable value when the value condition is not met are calculated, and after the calculation is completed, the output variable is stored in the output variable list.

[0024] Optionally, the step S40 of generating source code of the security data logic includes:

[0025] S41, traversing the intermediate variable list, generating a global variable for each data;

[0026] S42, traversing the intermediate variable list and the output variable list, obtaining the value conditions of the variables, and converting them into conditional expressions using conditional control statements; respectively obtaining the variable values ​​when the value conditions are met and when they are not met, and converting the variables into source code for executing the expressions.

[0027] Optionally, in step S50, the generated source code is output to a C language format file recognizable by online software.

[0028] Optionally, in step S41, the name of the global variable is a unique name defined during construction.

[0029] Optionally, in step S42, the conditional control statement includes: if (the value condition of the current variable == TRUE).

[0030] Optionally, in step S42, the variable values ​​when the value-taking condition is met and when it is not met are obtained respectively, and the variable is converted into source code for executing the expression including: if{variable name of the current variable = variable value when the condition is met;}; else{variable name of the current variable = variable value when the condition is not met;}.

[0031] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the data generating method as described above is implemented.

[0032] The present invention also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the data generating method as described above is implemented.

[0033] In summary, compared with the prior art, the data generation method for converting configurable data into source code, the computer-readable storage medium and the electronic device provided by the present invention have the following beneficial effects:

[0034] The data generation method for converting configurable data into source code of the present invention traverses the configuration data and generates a variable relationship comparison table, parses the logical configuration of the safety data to generate the source code of the safety data logic, and finally outputs the source code; therefore, for different rail transit projects, only the function configuration in the safety data file needs to be modified, and there is no need to modify the offline data generation tool, which can effectively reduce the frequent update of the tool and enhance the compatibility of the offline data generation tool for various rail transit projects. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 The figure is a flow chart of the data generating method of the present invention.

[0036] Figure 2 Configure a flow chart for the logic of sequentially parsing security data.

[0037] Figure 3 Schematic diagram of the logic configuration for the variable "Memorisation_reset_condition".

[0038] Figure 4 Schematic diagram of the configuration data of the variable "Memorisation_reset_condition".

[0039] Figure 5 Schematic diagram of the code conversion results for the variable "Memorisation_reset_condition". DETAILED DESCRIPTION

[0040] The following will be combined with the attached embodiment of the present invention Figure 1 ~Attached Figure 5 , the technical solutions, structural features, objectives achieved and effects in the embodiments of the present invention are described in detail.

[0041] It should be noted that the drawings are in a very simplified form and use non-precise proportions. They are only used to conveniently and clearly assist in explaining the embodiments of the present invention, and are not used to limit the conditions for the implementation of the present invention. Therefore, they have no substantive technical significance. Any structural modification, change in proportional relationship or adjustment of size, without affecting the effects and purposes that can be achieved by the present invention, should still fall within the scope of the technical content disclosed by the present invention.

[0042] It should be noted that, in the present invention, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only the elements explicitly listed, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0043] like Figure 1 As shown, the present invention provides a data generation method for converting configurable data into source code. In this embodiment, the safety data and configuration data belong to the field of rail transportation. The data generation method includes the following steps:

[0044] S10, input safety data and configuration data. Safety data includes customizable safety function parameters; configuration data includes the correspondence relationship of variable names used in offline data.

[0045] S20, traverse the configuration data and generate a variable relationship comparison table. In this embodiment, this step specifically includes:

[0046] Traverse all variables in the order in the configuration data, parse the variable labels and the content configured under the labels, so that the variable names used in the offline data and the variable names used by the online software form a one-to-one correspondence, and store the corresponding relationship in the variable relationship comparison table.

[0047] S30, analyzing the logical configuration of security data. In this embodiment, this step specifically includes:

[0048] S31. According to the path of the tool predefined rules, obtain the label where the functional logic of the variable configuration is located, and use the label as the starting point to parse its logic from the inside out;

[0049] S32, traversing the logic of the current variable layer by layer until finding the innermost logical operator and the operands configured under the logical operator;

[0050] S33, according to the name of the operand, find out the name of the operand used in the online software in the variable relationship comparison table, and construct the code of "variable name in source code == TRUE";

[0051] S34, obtaining the previous logical operator of the current operand, if the logical operator is a single-purpose logical operator, constructing a global logical variable with a unique name, using the code obtained by parsing the operand as the value condition of the global logical variable, and calculating the variable value of the global logical variable when the value condition is met and the variable value when the value condition is not met according to the processing method of the previous logical operator, and storing the global logical variable in the intermediate variable list;

[0052] S35. If the logical operator supports multiple operands, concatenate the code obtained by parsing the operands with the code corresponding to the current logical operator, and continue parsing the next logical operand of the logical operator;

[0053] S36. Until all operands of the outermost logical operator are parsed, a new output variable is created. The variable name of the output variable is the variable name defined in the predefined rules of the tool; the value condition is the concatenated code; and according to the processing of the current logical operator, the variable value of the output variable when the value condition is met and the variable value when the value condition is not met are calculated. After the calculation is completed, the output variable is stored in the output variable list.

[0054] S40, generating source code of security data logic. In this embodiment, this step specifically includes:

[0055] S41. Traverse the intermediate variable list and generate a global variable for each data; the name of the global variable is a unique name defined during construction.

[0056] S42, traverse the intermediate variable list and the output variable list, obtain the value conditions of the variables, and use conditional control statements to convert them into conditional expressions; the conditional control statements include: if (the value condition of the current variable == TRUE).

[0057] The variable values ​​when the value-taking condition is met and when it is not met are obtained respectively, and the variable is converted into the source code of the execution expression; specifically including: if{the variable name of the current variable = the variable value when the condition is met;}; else{the variable name of the current variable = the variable value when the condition is not met;}.

[0058] S50, outputting the generated source code. In this embodiment, the generated source code is outputted into a C language format file that can be recognized by the online software.

[0059] This embodiment also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the data generation method as described above is implemented.

[0060] This embodiment also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the data generation method as described above is implemented.

[0061] The data generation method, computer-readable storage medium and data generation method for converting configurable data into source code of the present invention only need to modify the function configuration in the security data file for different rail transit projects, without modifying the offline data generation tool. There is no need to frequently update the tool for different projects, and enhance the compatibility of the offline data generation tool for a variety of rail transit projects. In addition, the interaction between the offline data generation tool and the online software is also enhanced. The online software can configure the real-time data in the form of variable names in the data file and input the offline data generation tool, and the offline data generation tool completes the processing of complex logic. Avoid the online software from spending a lot of computing power and time to parse complex logic, and effectively improve the processing performance of the rail transit data system. And the data generation method of the present invention makes a one-to-one correspondence between the variable names used in the offline data generation tool and the variable names used in the online software, avoiding the problem that the offline data generation tool needs to be upgraded due to changes in the content or order of the variables defined by the online software. Enhance the adaptability of the offline data generation tool.

[0062] like Figure 2 As shown, the following takes the variable "Memorisation_reset_condition" as an example to explain the data generation process in detail:

[0063] First, S10 is started to input safety data and configuration data, where the logical configuration of the variable "Memorisation_reset_condition" is as follows Figure 3 As shown, the configuration data of the variable "Memorisation_reset_condition" is as follows Figure 4 shown.

[0064] S20, traverse the configuration data and generate a variable relationship comparison table. Specifically, it includes: traversing all variables in the order in the configuration data, parsing the variable labels and the content configured under the labels, so that the variable names used in the offline data and the variable names used in the online software form a one-to-one correspondence, and storing the corresponding relationship in the variable relationship comparison table. Figure 4 The variable relationship comparison table generated by the configuration data in is shown in Table 1 below.

[0065] Table 1 Variable relationship comparison table

[0066]

[0067]

[0068] S30, analyzing the logical configuration of security data. In this embodiment, this step specifically includes:

[0069] (1) According to the path of the tool's predefined rules, find the "Memorisation_reset_condition" tag and obtain the outermost logical operator of the variable <or>.

[0070] (2) Logical operators <or>As the starting point, traverse inward layer by layer to obtain the innermost logical operator <data>as well as <data>The operand lL_operation_level configured below.

[0071] (3) According to the name of the operand lL_operation_level, the variable name used by the operand in the online software is found in the "Variable Relationship Comparison Table" to be g_Offlinelnput.lLoperationLevel. The code "g_Offlinelnput.lLoperationLevel == TRUE" of the current operand is constructed.

[0072] (4) Get the logical operator of the previous level of the operand lL_operation_level <and>, this operator is not a single-purpose logical operator. Therefore, you need to splice it after the code <and>Logic, the concatenated code is: ((g_OfflineInput.ILoperationLevel == TRUE

[0073] &&

[0074] (5) Analysis <and>The next operand of the logical operator <not>As the starting point, traverse inward to obtain the innermost logical operator <data>as well as <data>Operands configured under ATC_control_train.

[0075] (6) In the "Variable Relationship Comparison Table", find out the variable name used by the operand in the online software and generate the code "g_Offlinelnput.ATCcontrolTrain==TRUE".

[0076] (7) The logical operator of the previous layer of operand ATC_control_train <not>It is a single-purpose logical operator. Therefore, a variable named LogicNotResult is constructed, and "g_Offlinelnput.ATCcontrolTrain==TRUE" is used as the value condition of the LogicNotResult variable. <not>The inversion logic processing is: when the value condition is met, "LogicNotResult = FALSE"; when the value condition is not met, "LogicNotResult = TRUE". After the calculation is completed, the LogicNotResult variable is stored in the "intermediate variable list".

[0077] (8) The previous logical operator of the LogicNotResult variable is <and>, code splicing is required, the spliced ​​code is: ((g_OfflineInput.ILoperationLevel == TRUE

[0078] &&LogicNotResult==TRUE)

[0079] (9) Logical operators <and>After parsing is complete, continue parsing <or>The next operand of the innermost logical operator <data>as well as <data>The operand Permissive_HlLC_1 is configured below.

[0080] (10) According to the name of the operand Permissive_HlLC_1, obtain the variable name used in the online software in the "Variable Relationship Comparison Table" and construct the code "g_Offlinelnput.PermissiveHlLC1==TRUE".

[0081] (11) Since the previous logical operator of operand Permissive_HlLC_1 <or>, is not a single-purpose logical operator, so code splicing is required. The spliced ​​code is as follows:

[0082] ((g_OfflineInput.ILoperationLevel==TRUE

[0083] &&LogicNotResult==TRUE)

[0084] ||g_OfflineInput.PermissiveHILC_1==TRUE)

[0085] (12) Outermost logical operator <or>After all operands of are parsed, a new output variable is created. The variable name of this output variable is g_OfflineOutput.EmergencyHandleMemorisationReset defined in the tool predefined rules; the value condition is the code spliced ​​after all logic parsing is completed; and according to the logic operator <or>The operation or processing of the calculation variable is TRUE when the condition is met; the variable value is FALSE when the condition is not met. After the calculation is completed, the output variable is stored in the "output variable list".

[0086] S40, generate the source code of the security data logic. First, traverse the intermediate variable list, add the definition of the global variable LogicNotResult in the source code, and then convert the LogicNotResult variable and the g_OfflineOutput.EmergencyHandleMemorisationReset variable into conditional control statements in the source code. After printing all the lists, add the function name, return value, header file and other information, and finally output it to the source code file.

[0087] S50, output the generated source code, the output content is as follows Figure 5 shown.

[0088] Although the content of the present invention has been described in detail through the above preferred embodiments, it should be appreciated that the above description should not be considered as a limitation of the present invention. After reading the above content, it will be apparent to those skilled in the art that various modifications and substitutions of the present invention will occur. Therefore, the protection scope of the present invention should be limited by the appended claims.< / or> < / or> < / or> < / data> < / data> < / or> < / and> < / and> < / not> < / not> < / data> < / data> < / not> < / and> < / and> < / and> < / data> < / data> < / or> < / or>

Claims

1. A data generation method for converting configurable data into source code, characterized in that: The data generation method comprises: S10, input security data and configuration data; S20, traversing the configuration data to generate a variable relationship comparison table; S30, parsing the logical configuration of the security data; S40, generating source code of security data logic; S50: output the generated source code.

2. The data generation method according to claim 1, characterized in that: The safety data and the configuration data belong to the field of rail transportation.

3. The data generation method according to claim 1, characterized in that: In step S10, the safety data includes customizable safety function parameters; the configuration data includes a mapping relationship of variable names used in offline data.

4. The data generation method according to claim 3, characterized in that: The step S20 of traversing the configuration data to generate a variable relationship comparison table specifically includes: All variables are traversed in sequence according to the order in the configuration data, and the labels of the variables and the content configured under the labels are parsed, so that the variable names used in the offline data and the variable names used in the online software form a one-to-one correspondence, and the corresponding relationship is stored in the variable relationship comparison table.

5. The data generation method according to claim 4, characterized in that: The logical configuration of step S30, parsing the security data, includes: S31, according to the path of the tool predefined rule, obtain the label where the functional logic of the variable configuration is located, and use the label as the starting point to parse its logic from the inside out; S32, traversing the logic of the current variable layer by layer inwards until finding the innermost logical operator and the operands configured under the logical operator; S33, according to the name of the operand, find out the name of the operand used in the online software in the variable relationship comparison table, and construct a code of "variable name in source code == TRUE"; S34, obtaining the previous logical operator of the current operand, if the logical operator is a single-purpose logical operator, constructing a global logical variable with a unique name, using the code obtained by parsing the operand as the value condition of the global logical variable, and calculating the variable value of the global logical variable when the value condition is met and the variable value when the value condition is not met according to the processing method of the previous logical operator, and storing the global logical variable in the intermediate variable list; S35, if the logic operator supports multiple operands, concatenate the code obtained by parsing the operands with the code corresponding to the current logic operator, and continue parsing the next logic operand of the logic operator; S36. Until all the operands of the outermost logical operator are parsed, a new output variable is created, and the variable name of the output variable is the variable name defined in the tool predefined rule; the value condition is the concatenated code; and according to the current processing of the logical operator, the variable value of the output variable when the value condition is met and the variable value when the value condition is not met are calculated, and after the calculation is completed, the output variable is stored in the output variable list.

6. The data generation method according to claim 5, characterized in that: The step S40 of generating the source code of the security data logic includes: S41, traversing the intermediate variable list, generating a global variable for each data; S42, traversing the intermediate variable list and the output variable list, obtaining the value conditions of the variables, and converting them into conditional expressions using conditional control statements; respectively obtaining the variable values ​​when the value conditions are met and when they are not met, and converting the variables into source code for executing the expressions.

7. The data generation method according to claim 6, characterized in that: In step S50, the generated source code is output to a C language format file that can be recognized by online software.

8. The data generation method according to claim 6, characterized in that: In step S41, the name of the global variable is a unique name defined during construction.

9. The data generation method according to claim 6, characterized in that: In step S42, the conditional control statement includes: if (the value condition of the current variable == TRUE).

10. The data generation method according to claim 6, characterized in that: In step S42, the variable values ​​when the value-taking condition is met and when it is not met are obtained respectively, and the variable is converted into the source code of the execution expression including: if{variable name of the current variable = variable value when the condition is met;}; else{variable name of the current variable = variable value when the condition is not met;}.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the data generating method according to any one of claims 1 to 10 is implemented.

12. An electronic device, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the data generating method according to any one of claims 1 to 10 is implemented.