Method and device for translating generic functions during translation of a scade model into a lustre model
Through the generic function conversion method from SCADE model to Lustre model, the problem of generic function conversion in synchronous data flow language is solved, and formal verification and safety improvement of safety-critical systems are achieved.
Patent Information
- Application Number
- CN202210640449.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-07
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-06-07
AI Technical Summary
Existing technologies cannot effectively transform generic functions in synchronous data flow languages, which makes formal verification of safety-critical system models difficult and affects system safety.
The generic function conversion from the SCADE model to the Lustre model is achieved through the steps of generic operator parsing, size parameter and variable parsing, parameter synthesis, type inference, and generic function assignment equation parsing.
This achieves effective formal verification of safety-critical system models, improves system security, reduces the time complexity of verification tools, and increases the readability of Lustre models.
Smart Images

Figure CN115221465B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of software security, and in particular to a method and device for converting a generic function in the process of converting a SCADE model into a Lustre model. BACKGROUND
[0002] Safety-critical systems such as rail transit, automotive electronics, aerospace, nuclear power, etc. are related to people's life and property safety, and have high requirements for system safety. The scenarios handled by safety-critical systems are often more, and a large number of operation processes are required, which makes the system particularly complex. Therefore, how to ensure the safety of safety-critical systems has become a common problem of the industry.
[0003] Formal methods use model verification, theorem proving, etc. to prove the compliance of system models to safety properties, and then to ensure the safety of the system, which has become a method widely used by the industry to improve system safety. Synchronous data flow languages integrate the features of functional languages and reactive systems, such as SCADE, Lustre, Signal, etc. can describe complex safety-critical systems by constructing different types of multiple operators, and are widely used in formal modeling of safety-critical systems. How to use formal methods to construct formal modeling based on synchronous data flow languages, and to be able to formally verify the model, has become a common problem in the industry.
[0004] Through model transformation and with the help of SAT or SMT solvers, synchronous data flow language models are verified, which is the first choice for all formal verification methods. However, one difficulty in transforming large-scale safety-critical system models is that there are generic functions in synchronous data flow languages. How to realize the transformation of generic functions in synchronous data flow language models, so as to effectively verify the safety-critical system model, and further improve the safety of safety-critical systems, has become a technical problem to be solved. SUMMARY
[0005] The present application relates to the field of software security, and in particular to a method and device for converting a generic function in the process of converting a SCADE model into a Lustre model.
[0006] The object of the present application can be achieved by the following technical solutions:
[0007] According to a first aspect of the present application, a method for converting a generic function in the process of converting a SCADE model into a Lustre model is provided, the method comprising the following steps:
[0008] Step S1, a generic operator parsing process, is used to obtain the generic operator name, instance parameters, call parameters and assignment variables of the generic operator and store them;
[0009] Step S2, a generic function size parameter and variable parsing process, is used to parse the size parameters, input variables, output variables and local variables of the generic function;
[0010] Step S3, a generic parameter synthesis process, is used to replace the size parameters parsed in step S2 by real integer values from variables or constants;
[0011] Step S4, a generic type derivation process, is used to replace the types of the input variables, output variables and local variables parsed in step S2 by real types from generics;
[0012] Step S5, a generic name assembly process, is used to assemble the generic operator name, size parameters and generic types into a new generic name;
[0013] Step S6, a generic function assignment equation parsing process, is used to parse the assignment equation part in the generic function according to the results of step S4 parameter synthesis and step S5 type derivation;
[0014] Step S7, a generic function output process, is used to output the parsed generic function.
[0015] As a preferred technical solution, the step S1, a generic operator parsing process, is specifically:
[0016] Step S101, the name and instance parameters of the generic operator under the current call expression are parsed, and the instance parameters are replaced by global constants and size parameters of the current node or function to obtain the numerical value of the instance parameters;
[0017] Step S102, the names and types of the call parameters and assignment variables of the generic operator under the current call expression are parsed, and the type list is stored.
[0018] As a preferred technical solution, the step S2, a generic function size parameter and variable parsing process, is specifically:
[0019] Step S201, the corresponding generic function file of the generic operator name is obtained;
[0020] Step S202, the size parameters of the generic function are parsed and stored;
[0021] Step S203, the input variables, output variables and local variables of the generic function are parsed and stored.
[0022] As a preferred technical solution, the step S3, the generic parameter synthesis process is specifically:
[0023] Step S301, type matching is performed according to the size parameter parsed in step S2;
[0024] Step S302, when the type is a global constant, a global constant list is traversed, and a value matched with the constant name is taken out for replacement;
[0025] Step S303, when the type is an instance parameter, an instance parameter list matched with the current generic function is traversed, and a value of an instance parameter matched with the size parameter type is taken out for replacement.
[0026] As a preferred technical solution, the step S4, the generic type derivation process is specifically:
[0027] Step S401, type matching is performed according to the parsed variable type;
[0028] Step S402, when the type is an array, the array type and the array dimension are stored separately;
[0029] Step S403, when the parameter of the array dimension is a size parameter, the value of the size parameter corresponding to the generic function is replaced with the array dimension;
[0030] Step S404, when the parameter of the array dimension is a global variable, a global constant list is traversed, and a value matched with the array dimension is taken out for replacement.
[0031] As a preferred technical solution, the step S7, the generic function output process is specifically: the size parameter, the variable and the assignment equation of the generic function are output.
[0032] According to a second aspect of the present application, a device for converting a generic function in a process of converting a SCADE model into a Lustre model is provided, and the method comprises the following steps:
[0033] A generic operator parsing module is configured to obtain a generic operator name, instance parameters, call parameters and assignment variables of a generic operator, and store them;
[0034] A generic function size parameter and variable parsing module is configured to parse size parameters, input variables, output variables and local variables of a generic function;
[0035] A generic parameter synthesis module is configured to replace the size parameters parsed by the generic function size parameter and variable parsing module by variables or constants with real integer values;
[0036] a generic type deduction module, configured to replace the types of the input variables, the output variables and the local variables parsed by the generic function size parameter and variable parsing module with real types by using the generic types;
[0037] a generic name assembly module, configured to assemble the generic operator name, the size parameter and the generic type into a new generic name;
[0038] a generic function assignment equation parsing module, configured to parse the assignment equation part in the generic function according to the results of the parameter synthesis and the type deduction;
[0039] a generic function output module, configured to output the parsed generic function.
[0040] According to a third aspect of the present application, the method for converting the generic function is applied to a train control system regional controller, and the generic function is a function Read2Arr for reading two arrays in the conversion of a SCADE module of the train control system regional controller into a Lustre model.
[0041] The function Read2Arr takes two arrays, index values and two default values as inputs, and outputs the values read from the two arrays.
[0042] The function Read2Arr reads the information of the movement authorization chain from the movement authorization region list and the number of movement authorization regions of the train line map, reads the number of APs on the section and the natural order of the AP array from the section array of the train line map, and reads the minimum branch position and the maximum branch position of the registered train list in the ZC range from the train circuit map.
[0043] According to a fourth aspect of the present application, an electronic device is provided, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the method when executing the program.
[0044] According to a fifth aspect of the present application, a computer readable storage medium is provided, which stores a computer program, and the program is executed by a processor to implement the method.
[0045] Compared with the prior art, the present application has the following advantages:
[0046] 1) The present application realizes the conversion of the generic function of the synchronous data flow language model, thereby effectively verifying the formalization of the safety critical system model, and further improves the safety of the safety critical system.
[0047] 2) The application realizes the transformation of parameter synthesis and type derivation of the SCADE model generic function, and reduces the time complexity of the verification tool caused by parsing the generic function.
[0048] 3) The method can make the expanded bottom layer generic function show more calling relationship, and thus it is easier to analyze the implementation details of the regional controller software model, and the readability of the expanded Lustre model is increased. BRIEF DESCRIPTION OF DRAWINGS
[0049] Figure 1 The Read2Arr function of the application object regional controller;
[0050] Figure 2 The working process diagram of the application;
[0051] Figure 3 The method diagram of whether the file corresponding to the generic function operator is accessed;
[0052] Figure 4 The data structure diagram of the size parameter;
[0053] Figure 5 The parameter synthesis method diagram of the application;
[0054] Figure 6 The data structure diagram of the variable of the application;
[0055] Figure 7 The type derivation method diagram of the application;
[0056] Figure 8 The example diagram of a generic function transformation example of the application. DETAILED DESCRIPTION
[0057] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are part of, but not all of the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative work should belong to the protection scope of the application.
[0058] The application is a method for transforming a generic function in the process of transforming a SCADE model into a Lustre model, and the method comprises the following steps:
[0059] Step S1, a generic operator parsing process, used to obtain and store the generic operator name, instance parameters instanceParameters, calling parameters callParameters and assignment variables of the generic operator;
[0060] Step S2, generic function size parameter and variable parsing process, used for parsing the size parameters sizeParameters, input variables, output variables and local variables of the generic function;
[0061] Step S3, generic parameter synthesis process, used for replacing the size parameters parsed in step S2 by variables or constants with real integer values;
[0062] Step S4, generic type derivation process, used for replacing the types of the input variables, output variables and local variables parsed in step S2 by generics with real types;
[0063] Step S5, generic name assembly process, used for assembling the generic operator name, size parameters and generic types into a new generic name;
[0064] Step S6, generic function assignment equation parsing process, used for parsing the assignment equation part in the generic function according to the results of step S4 parameter synthesis and step S5 type derivation;
[0065] Step S7, generic function output process, used for outputting the parsed generic function.
[0066] One embodiment of the present application is disclosed as follows:
[0067] When parsing the assignment equation corresponding to the generic function operator, one example is as follows:
[0068] _L10,_L11=(Read2Arr<<N_B>>)(_L6,_L7,_L8,false,3);
[0069] The SCADE file code corresponding to the generic function is as follows
[0070]
[0071]
[0072] This embodiment is a function of reading two arrays in the SCADE module of the regional controller of the train control system. Since the regional controller contains a large number of arrays to determine the performance of the software, such as the number of trains registered in a regional controller, the number of sections in a track branch and the corresponding parameters are stored in arrays, it is necessary to process these arrays separately in the model. When calculating the length of the next section in the uplink direction of the current section of a branch, the values stored in the arrays need to be read. The Read2Arr function reads the values from two arrays as input, and outputs the read values from the two arrays. For example Figure 1The Read2Arr function can read information of the moving authorization chain from the moving authorization area list and the number of moving authorization areas of the train line map, can read the number of APs on the section and the natural order of the AP array from the section array of the train line map, and can read the minimum branch position and the maximum branch position of the registered train list within the ZC range from the train circuit map.
[0073] According to an embodiment of the present application, an apparatus for converting a generic function in a SCADE model into a Lustre model is provided, as shown in Figure 2
[0074] The generic operator analysis module 001 is configured to obtain the name of the generic operator, the instance parameters instanceParameters, the call parameters callParameters, and the assignment variable in the SCADE model, and store them. In the embodiment, the name of the generic operator is Read2Arr, the instance parameters are N_B, the call parameters are _L6, _L7, _L8, false, 3, and the assignment variable is _L10, _L11.
[0075] The generic function size parameter and variable analysis module 002 is configured to analyze the size parameters sizeParameters, the input variables, the output variables, and the local variables of the generic function. The size parameters of the generic function correspond to the instance parameters of the generic operator expression in number and value. In the embodiment, the size parameters are N after the generic function, the input variables are arrTA, arrTB, iIndex, INVALID_TA, and INVALID_TB, the output variables are OUTValA and OUTValB, and the local variables are _L1, _L2, _L3, _L4, _L5, _L6, _L7, and _L8.
[0076] The generic parameter synthesis module 003 is configured to replace the size parameters by the real integer values from the variables or constants.
[0077] The generic type derivation module 004 is configured to replace the types of the input, output, and local variables by the real types from the generic.
[0078] The generic name assembly module 005 is configured to assemble the generic operator name, the size parameters, and the generic types into a new generic name, and store the name into the analyzed function.
[0079] The generic function assignment equation analysis module 006 is configured to analyze the assignment equation part in the generic function according to the results of the parameter synthesis and the type derivation. In the embodiment, the assignment equation refers to the part between “let” and “tel;”.
[0080] The generic function output module 007 is configured to output the parsed generic function.
[0081] The Figure 2 The method for determining whether the generic function is accessed in the Figure 3 The method for determining whether the generic function is accessed in the
[0082] (1) The instance parameter list is parsed and stored. According to the embodiment, the parameter list has only one parameter, N_B.
[0083] (2) The value of the instance parameter N_B is obtained from the current function and replaced. The value of the instance parameter N_B is the size parameter of the function in which the generic operator appears or a global variable. The value is obtained and replaced.
[0084] (3) The generic function name is spliced with each instance parameter to obtain a new generic function name. For example, in the embodiment, the value of N_B is 100. The new generic function name after splicing is Read2Arr_100. The identifier is used because the same Read2Arr can be called by multiple functions, and the instance parameter is not 100.
[0085] (4) A parsed function is obtained. It is determined whether the new generic function name Read2Arr_100 is in the parsed function.
[0086] (5) If the Read2Arr_100 is not in the parsed function, the file corresponding to the generic operator Read2Arr is directly parsed, and the Read2Arr_100 is stored in the parsed list. Otherwise, the analysis is continued.
[0087] (6) The calling parameters and assignment variables of the generic operator Read2Arr are parsed.
[0088] (7) The input variable list and the output variable list of the parsed function list are obtained. In the embodiment, the input list and the output list correspond to the input and output variables of the generic function Read2Arr_100. Because the Read2Arr_100 has been parsed according to the above determination, the generic function name is Read_100. That is, the input and output variables are obtained from the parsed function name.
[0089] (8) match the input variable list with the call parameter list, and match the output variable with the assignment variable list; the match here means that the types of arrTA, arrTB, iIndex, INVALID_TA, INVALID_TB in the input variable of Read2Arr_100 and the types of _L6, _L7, _L8, false, 3 in the call parameter of the Read2Arr operator are one-to-one corresponding, and the types of OUTValA, OUTValB in the output variable and the types of _L10, _L11 in the assignment variable are also one-to-one corresponding;
[0090] (9) if the above match is not equal, store the newly spliced generic function name, its call parameter and assignment variable into the accessed node or function list; otherwise, end;
[0091] The storage structure of the size parameter is as shown in Figure 4 For each generic function, a chain table of array type is used to store the size parameter and its value, and the value of the size parameter is the default value during parsing;
[0092] The parameter synthesis method is as shown in Figure 5
[0093] (1) first parse the generic function and obtain the size parameter list of the generic function, which is N in this embodiment;
[0094] (2) traverse the size parameter list, and update the value of the size parameter according to the type of the size parameter;
[0095] (3) if the size parameter is a global constant, traverse the list of global constants, take out the corresponding value and replace it;
[0096] (4) if the size parameter is an instance parameter, traverse the list of instance parameters, take out the instance parameter list of the generic function, take out the value of the instance parameter matched with the comparison size parameter name from the instance parameter list, and replace it, that is, replace it with the corresponding value of N_B;
[0097] (5) if the traversal is not completed, continue the loop process, otherwise, end the parameter synthesis process.
[0098] The storage mode of the variable is as shown in Figure 6 For each generic function, a chain table of array type is used to store the input variable and its type, and the storage mode of the output variable and the local variable is similar to Figure 6 ;
[0099] The implementation of the type inference is as shown in Figure 7
[0100] (1) traversing the list of input variable types parsed;
[0101] (2) if the type of the input variable is an array, the type is split into dimension part and array type part. In this embodiment, the type of the first input variable is ‘TA[N], which is split into dimension part N and array type part ‘TA;
[0102] (3) parsing the array dimension to obtain a list of array dimensions, and traversing the list. The list of array dimensions in this embodiment has only one element, i.e. N;
[0103] (4) if the dimension is a size parameter, the value matched with the dimension is taken from the size parameter and replaced, and the value of N obtained in the parameter synthesis step described in the preamble is used for replacement;
[0104] (5) if the dimension is a global constant, the value matched with the dimension is taken from the global constant and replaced. Some arrays use global constants as array lengths, and then perform cutting or searching on the array, and the value of the global constant should be replaced in this step;
[0105] (6) if the traversal of the array dimension has not ended, the traversal is continued; otherwise, the type of the array is parsed;
[0106] (7) in the embodiment of parsing the type of the array, the type of the calling parameter in the generic function is obtained according to the index of the current array, and then the type is assigned to the type of the input variable. In this embodiment, the type of ‘TA is the type parsed by _L6, and since _L6 has been parsed, the type is determined, and the type is parsed and assigned to ‘TA;
[0107] (8) if the traversal of the input variable has not ended, the type derivation is continued; otherwise, the type derivation process is ended;
[0108] Figure 7 The type derivation process is also applicable to output variables and local variables;
[0109] Figure 8 The result of the Lustre file parsed according to the embodiment is given.
[0110] It can be seen that the parsed generic function has been updated to Read2Arr_100_false_int, and the parsing of _L1=( _L2. [_L3] default_L4); involves the operation of the array mapping operator in this embodiment, and the result after parsing is:
[0111]
[0112] The model Lustre model after conversion of all Read2Arr is as follows:
[0113]
[0114]
[0115]
[0116] The embodiment realizes the parsing of the variable generic type, and since a large number of arrays are involved in the area controller, all read array operations of the SCADE model call the Read2Arr function. For different inputs, the application generates different Lustre Read2Arr nodes according to the generic type of the input variable, so that the converted Lustre model can realize the call of the corresponding read array function through the node name. Since the generic function in the SCADE model is the most frequently called function, these functions are the underlying functions for realizing specific functions.
[0117] The method in the SCADE to Lustre model conversion process of the application can be used in the technical route of model design, formal verification or code generation of a safety critical system based on SCADE, and has great value for the model driven development method.
[0118] The type derivation technology in the conversion of the generic function of the application can also be used in the type derivation or synthesis process of a functional language, and even applied to the construction process of a new functional language or a synchronous language involving the type derivation method.
[0119] The above is the introduction of the method embodiment, and the scheme of the application is further described through the electronic device and storage medium embodiments.
[0120] The electronic device of the application includes a central processing unit (CPU) which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) or loaded from a storage unit into a random access memory (RAM). Various programs and data required for device operation can also be stored in the RAM. The CPU, the ROM and the RAM are connected to each other through a bus. An input / output (I / O) interface is also connected to the bus.
[0121] A number of components in the device are connected to the I / O interface, including: input units, such as a keyboard, a mouse, etc.; output units, such as various types of displays, speakers, etc.; storage units, such as a magnetic disk, an optical disk, etc.; and communication units, such as a network card, a modem, a wireless communication transceiver, etc. The communication units allow the device to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0122] The processing unit performs various methods and processes described above, such as the methods S1-S7. For example, in some embodiments, the methods S1-S7 can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit. In some embodiments, part or all of the computer program can be loaded and / or installed on the device via the ROM and / or the communication unit. When the computer program is loaded into the RAM and executed by the CPU, one or more steps of the methods S1-S7 described above can be performed. Alternatively, in other embodiments, the CPU can be configured to perform the methods S1-S7 by any other suitable means, such as by means of firmware.
[0123] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip systems (SOCs), complex programmable logic devices (CPLDs), etc.
[0124] Program code for carrying out methods of the present application can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program code, when executed by the processor or controller, causes the functions / operations specified in the flow charts and / or block diagrams to be implemented. The program code can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
[0125] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable storage medium can include, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage medium would include one or more lines of electrical wire, portable computer diskette, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
[0126] The above description is only specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for converting generic functions in the process of converting a SCADE model to a Lustre model, characterized in that: The method comprises the following steps: Step S1, a generic operator parsing process, is used to obtain the generic operator name, instance parameters instanceParameters, call parameters callParameters and assignment variables of the generic operator, and store them; Step S2, generic function size parameter and variable parsing process, used to parse the size parameters sizeParameters, input variables, output variables and local variables of the generic function; Step S3, a generic parameter synthesis process, is used to replace the size parameter parsed in step S2 from a variable or constant to a real integer value; Step S4, a generic type derivation process, is used to replace the types of the input variables, output variables, and local variables parsed in step S2 from generic to real types, including obtaining the index of the variable in the generic function and assigning the type of the call parameter corresponding to the index to the type of the corresponding variable; Step S5, a generic name assembly process, is used to assemble the generic operator name, size parameters and generic type into a new generic function name; Step S6, a generic function assignment equation parsing process, which is used to parse the assignment equation portion in the generic function based on the results of the parameter synthesis in step S3 and the type deduction in step S4; Step S7, a generic function output process, for outputting the parsed generic function; The step S3, generic parameter synthesis process is specifically as follows: Step S301, performing type matching based on the size parameters parsed in step S2; Step S302: When the type is a global constant, traverse the global constant list and take out the value that matches the constant name to replace it; Step S303: When the type is an instance parameter, traverse the instance parameter list that matches the current generic function, and take out the value of the instance parameter that matches the comparison size parameter name and replace it.
2. The method for converting a generic function in the process of converting a SCADE model to a Lustre model according to claim 1, characterized in that: The generic operator parsing process in step S1 is specifically as follows: Step S101: Parse the name and instance parameters of the generic operator under the current call expression, replace the instance parameters with global constants or function size parameters, and obtain the value of the instance parameters; Step S102: parsing the names and types of the calling parameters and assigned variables of the generic operator under the current calling expression, and storing the type lists thereof.
3. The method for converting a generic function in the process of converting a SCADE model to a Lustre model according to claim 1, characterized in that: In step S2, the generic function size parameter and variable parsing process is specifically as follows: Step S201, obtaining the corresponding generic function file according to the generic operator name; Step S202, parsing the size parameters of the generic function and storing them; Step S203: parse the input variables, output variables, and local variables of the generic function and store them.
4. The method for converting a generic function in the process of converting a SCADE model to a Lustre model according to claim 1, characterized in that: Said step S4, the generic type derivation process further comprises: Step S401, performing type matching based on the parsed variable type; Step S402: When the type is an array, the array type and array dimension are stored separately; Step S403: When the parameter of the array dimension is a size parameter, the value of the size parameter corresponding to the generic function is replaced with the array dimension; Step S404: When the parameter of the array dimension is a global variable, the global constant list is traversed to extract the value that matches the array dimension and replace it.
5. The method for converting a generic function in the process of converting a SCADE model to a Lustre model according to claim 1, characterized in that: The step S7, the generic function output process specifically includes: outputting the size parameters, variables and assignment equations of the generic function.
6. A device for converting generic functions in the process of converting a SCADE model into a Lustre model, characterized in that: The device includes: Generic operator parsing module, used to obtain the generic operator name, instance parameters instanceParameters, call parameters callParameters and assignment variables of the generic operator, and store them; Generic function size parameter and variable parsing module, used to parse the size parameters sizeParameters, input variables, output variables and local variables of generic functions; Generic parameter synthesis module, used to replace generic function size parameters and size parameters parsed by variable parsing module from variables or constants to real integer values; Generic type inference module, used to replace the types of generic function size parameters and input variables, output variables and local variables parsed by the variable parsing module from generic to real types, including obtaining the index of the variable in the generic function and assigning the type of the call parameter corresponding to the index to the type of the corresponding variable; Generic name assembly module, used to assemble generic operator names, size parameters and generic types into new generic function names; Generic function assignment equation parsing module, which is used to parse the assignment equation part in the generic function based on the results of parameter synthesis and type inference; Generic function output module, used to output the parsed generic function; The working process of the generic parameter synthesis module is as follows: Step S301, performing type matching based on the generic function size parameter and the size parameter parsed by the variable parsing module; Step S302: When the type is a global constant, traverse the global constant list and take out the value that matches the constant name to replace it; Step S303: When the type is an instance parameter, traverse the instance parameter list that matches the current generic function, and take out the value of the instance parameter that matches the comparison size parameter name and replace it.
7. An application of the method for converting a generic function in the process of converting a SCADE model into a Lustre model as claimed in any one of claims 1 to 5, characterized in that: The generic function conversion method is applied to the train control system zone controller, where the generic function is to convert the SCADE model of the train control system zone controller into the Lustre model's function Read2Arr for reading two arrays; The function Read2Arr for reading two arrays takes two arrays, an index value and two default values as input, and outputs the values read from the two arrays; Read the information of the mobile authorization chain from the mobile authorization area list and the number of mobile authorization areas in the train route map through the function Read2Arr; Read the number of APs on the segment and the natural order of the AP array from the segment array of the train route map; read the minimum branch position and maximum branch position of the registered train list within the ZC range from the train route map.
8. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.