Model data standardized transmission method and computer readable storage medium
By importing predefined metadata types and models in the data transmission of the simulator simulation platform and compressing the data into a data cache package, the problem of inefficiency of existing XML and JSON data transmission solutions is solved, and standardized data transmission and efficient transmission are realized.
Patent Information
- Application Number
- CN202411575237.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-03-21
AI Technical Summary
The existing XML and JSON data transmission solutions lead to inefficient transmission in the simulator simulation platform and cannot meet the requirements of millisecond-level high-rate data transmission.
By importing predefined metadata types and metadata models before establishing communication between the data sender and the receiver, the data is compressed into a data cache packet based on these metadata types and models after receiving the data request and sent to the receiver. The receiver parses the data cache packets based on the same metadata type and model to obtain the data.
It realizes the standardized transmission and efficient transmission of data inside and outside the simulator simulation platform, improves the efficiency of data transmission, and is suitable for large-scale data transmission and high-speed data transmission scenarios in simulators.
Smart Images

Figure CN119670695A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a model data standardized transmission method and a computer-readable storage medium. Background Art
[0002] The simulator simulation platform software is a complex system software (hereinafter referred to as the platform), which is generally composed of a computing engine, a general graphical modeling system, a model library and other simulation function software. The platform can be used for large-scale scientific computing, dynamic characteristic modeling research, simulation system development, optimization design and verification of various process industrial systems, and provides integrated, full-process development, debugging and operation support functions. The simulator simulation platform requires a unified and standardized data transmission method to support the free transmission of computing data and display data between the inside and outside of the platform.
[0003] Currently, the more mainstream programming-free data transmission solutions include XML (eXtensible Markup Language) data transmission solution and JSON (JavaScript Object Notation) data transmission solution, but there are the following problems: XML files and JSON files are large in size and complex in format, resulting in low parsing efficiency during the data transmission process, affecting transmission efficiency. They are not suitable for large-scale data transmission scenarios in simulators, and are not suitable for millisecond-level high-speed data transmission scenarios required in simulators. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a model data standardized transmission method in view of at least one defect of the related technology mentioned in the above background technology: the XML data transmission scheme and the JSON data transmission scheme affect the transmission efficiency.
[0005] The technical solution adopted by the present invention to solve the technical problem is: to provide a model data standardized transmission method, comprising the following steps:
[0006] Before establishing communication with the data recipient, import the predefined metadata type and the predefined metadata model;
[0007] After establishing communication with the data recipient, receiving a request from the data recipient, acquiring data, and compressing the data into a data cache package according to the metadata type and the metadata model;
[0008] The data cache package is sent to the data receiver, where the data cache package is used by the data receiver to parse the data cache package according to the predefined metadata type and the predefined metadata model to obtain data.
[0009] In some embodiments, the metadata types include: basic metadata types and user-defined metadata types;
[0010] The metadata model includes: the metadata type and the metadata name.
[0011] In some embodiments, the user-defined metadata type includes a combination of at least two of the basic metadata types.
[0012] In some embodiments, after establishing communication with the data recipient, receiving a request from the data recipient, acquiring data, and compressing the data into a data cache package according to the metadata type and the metadata model include:
[0013] S1: after establishing communication with the data receiving party, receiving the data request list of the data receiving party, parsing the data request list, obtaining the i-th variable in the data request list, where 1 is a variable, and N is the number of all variables in the data request list;
[0014] S2: query the metadata list corresponding to the i-th variable in the data request list, obtain the data in the metadata list, compress the data into the data cache package according to the metadata type and the metadata model, and set i=i+1;
[0015] S3: Determine whether i is equal to N. If so, complete the data compression; if not, return to execute step S1.
[0016] In some embodiments, step S1 includes:
[0017] After establishing communication with the data receiving party, a data request list of the data receiving party is received, the data request list is parsed, the i-th variable in the data request list is obtained, and it is determined whether the data cache package exists. If the data cache package exists, the location where the i-th variable in the data request list is stored is located according to the data cache package offset table, and step S2 is executed.
[0018] In some embodiments, step S1 includes:
[0019] After establishing communication with the data receiving party, receiving the data request list of the data receiving party, parsing the data request list, obtaining the i-th variable in the data request list, determining whether the data cache package exists, and if the data cache package does not exist, establishing the data cache package and the data cache package offset table, and executing step S2.
[0020] In some embodiments, before establishing communication with a data recipient, importing a predefined metadata type and a predefined metadata model further includes: establishing a metadata offset table for all of the metadata types according to the metadata model;
[0021] After step S1, the method further includes: recording the offset of the variable in the data cache package according to the metadata offset table, and putting the offset into the data cache package offset table.
[0022] In some embodiments, step S2 includes:
[0023] S21: querying a metadata list corresponding to the i-th variable in the data request list, and parsing the metadata list;
[0024] S22: Acquire data of a variable of the jth basic metadata type in the metadata list, compress the data of the variable of the jth basic metadata type in the metadata list into the data cache package according to the metadata type and the metadata model, and set j=j+1, where 1+1, and M is the number of variables of all basic metadata types in the metadata list;
[0025] S23: Determine whether j is equal to M. If so, set i=i+1 and execute step S3; if not, return to step S21.
[0026] In some embodiments, the method further comprises:
[0027] When the predefined metadata type and / or the predefined metadata model is updated, the updated metadata type and the updated metadata model are re-imported.
[0028] The present invention also constructs a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for standardized transmission of model data as described in any one of the above items is implemented.
[0029] By implementing the present invention, the following beneficial effects are achieved:
[0030] The model data standardized transmission method disclosed in the present invention is applied to the data sender. Before establishing communication with the data receiver, a predefined metadata type and a predefined metadata model are imported. After establishing communication with the data receiver, the data receiver's request is received to obtain data. The data is compressed into a data cache package according to the metadata type and the metadata model, and then the data cache package is sent to the data receiver. The data cache package is used by the data receiver to parse the data cache package according to the predefined metadata type and the predefined metadata model to obtain data, thereby solving the problem of standardized data transmission of internal and external data of a simulator simulation platform and realizing efficient transmission of internal and external data. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0032] Figure 1 A flow chart showing an embodiment of a method for standardized transmission of model data according to the present invention is shown;
[0033] Figure 2 A flowchart showing the process of establishing communication with a data receiver, receiving a request from the data receiver, acquiring data, and compressing the data into a data cache package according to the metadata type and metadata model in an embodiment of the model data standardized transmission method of the present invention is shown;
[0034] Figure 3 A flow chart of step S2 in an embodiment of the model data standardized transmission method of the present invention is shown. DETAILED DESCRIPTION
[0035] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.
[0036] It should be noted that the flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor do they have to be executed in the order described. For example, some operations / steps can be decomposed, while some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0037] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0038] like Figure 1As shown, some embodiments of the present invention disclose a method for standardized transmission of model data, which is applied to a data sender and includes the following steps:
[0039] Before establishing communication with the data recipient, import the predefined metadata type and the predefined metadata model;
[0040] After establishing communication with the data receiver, receiving the data receiver's request, obtaining the data, and compressing the data into a data cache package according to the metadata type and metadata model;
[0041] The data cache package is sent to the data receiver, and the data cache package is used by the data receiver to parse the data cache package according to a predefined metadata type and a predefined metadata model to obtain data.
[0042] In some embodiments, the metadata type includes: a basic metadata type and a user-defined metadata type. The metadata model includes: a metadata type and a metadata name.
[0043] Among them, the data sender is, for example, a simulator simulation platform, and the data receiver is, for example, a DCS system (Distributed Control System). The DCS system receives data from the simulator simulation platform and executes corresponding control logic based on these data. The simulator simulation platform and DCS system here are only examples and are not intended to limit the present application.
[0044] The data inside the simulator platform is mainly numerical data. The predefined metadata types include basic metadata types and user-defined metadata types, as shown in Table 1. The size and composition of the basic metadata type are fixed. The user-defined metadata type is a non-basic metadata type, and its size and composition need to be calculated based on the sum of the sizes of the basic metadata types contained therein.
[0045]
[0046] Table 1 Basic metadata type definition The definition of the metadata model includes metadata type and metadata name, see Table 2.
[0047]
[0048] Table 2 Metadata model definition example
[0049] The data of the simulator simulation platform is managed through pre-defined metadata types and pre-defined metadata models, and corresponding memory models and mechanisms are built according to pre-defined metadata types and pre-defined metadata models at runtime to manage simulation effects, scenes, etc., thereby achieving effective interaction with the simulation software and providing underground support for the simulation software.
[0050] In some embodiments, the user-defined metadata type includes a combination of at least two basic metadata types.
[0051] The user-defined metadata type can be defined by the user. This embodiment defines a user-defined metadata graphical device, allowing the user to complete the definition by combining and nesting basic metadata types. The final user-defined metadata type always requires a list that can be parsed into basic metadata types and its size calculated. The definition example of the user-defined metadata type AModel is as follows:
[0052] As shown in Table 3.
[0053]
[0054]
[0055] Table 3 Definition of user-defined metadata types
[0056] Before establishing communication, the data receiver and the data sender import the basic metadata types, user-defined metadata types, and metadata models described by the simulation designer in text format.
[0057] like Figure 2 As shown, in some embodiments, after establishing communication with a data recipient, receiving a request from the data recipient, obtaining data, and compressing the data into a data cache package according to the metadata type and the metadata model include:
[0058] S1: After establishing communication with the data receiver, receive the data request list of the data receiver, parse the data request list, and obtain the i-th variable in the data request list, where 1≤i≤N, and N is the number of all variables in the data request list;
[0059] S2: query the metadata list corresponding to the i-th variable in the data request list, obtain the data in the metadata list, compress the data into a data cache package according to the metadata type and metadata model, and set i=i+1;
[0060] S3: Determine whether i is equal to N. If so, complete the data compression; if not, return to execute step S1.
[0061] Specifically, after the data sender establishes communication with the data receiver, the data receiver sends a request to the data sender, which includes a data request list VARLIST. After receiving the request sent by the data receiver, the data sender starts to parse the request, parses the data request list VARLIST (including N variables), sets variable i as the current variable subscript (1≤i≤N), and obtains the i-th variable V in the data request list. i ; Query V i Metadata list of L i , traverse the metadata list L i , the metadata list L i The information in is packaged into data cache package B, and the compressed data cache package B will be sent to the data receiver in binary form; determine whether i is equal to N, if so, return the data of data cache package B, if not, return to execute step S1.
[0062] After receiving the data cache package B, the data receiver parses the data cache package B according to the metadata type and metadata model imported before establishing the communication, and places the parsing result in the cache for other purposes.
[0063] In some embodiments, step S1 includes:
[0064] After establishing communication with the data receiver, the data request list of the data receiver is received, the data request list is parsed, the i-th variable in the data request list is obtained, and it is determined whether the data cache package exists. If the data cache package exists, the location where the i-th variable in the data request list is stored is located according to the data cache package offset table, and step S2 is executed to update the data cache package B.
[0065] In some embodiments, step S1 includes:
[0066] After establishing communication with the data receiver, the data request list of the data receiver is received, the data request list is parsed, the i-th variable in the data request list is obtained, and it is determined whether the data cache package exists. If the data cache package does not exist, a data cache package and a data cache package offset table are established, and step S2 is executed.
[0067] In some embodiments, before establishing communication with a data recipient, importing a predefined metadata type and a predefined metadata model also includes: establishing a metadata offset table for all metadata types according to the metadata model.
[0068] The step S1 also includes: recording the offset of the variable in the data cache package according to the metadata offset table, and putting the offset into the data cache package offset table.
[0069] Specifically, before establishing communication, the data receiver and the data sender establish a metadata type offset table O for all metadata types based on the metadata model, which includes the offsets of different parameters in the metadata type. The metadata type offset table O only needs to be established once. The offset table definition of the user-defined metadata type is shown in Table 4. The offsets of all metadata parameters are calculated in the user-defined metadata type.
[0070]
[0071] Table 4 Definition of offset table for user-defined metadata type
[0072] According to the information of metadata type offset table O, data cache package offset table and variable information in data request list VARLIST, the data content in data cache package B is updated cyclically.
[0073] By combining the data standardization encapsulation method with the metadata type offset table and the data cache package offset table, the efficiency problem of data transmission is solved, especially when the data needs to be transmitted multiple times over a long period of time.
[0074] like Figure 3 As shown, in some embodiments, step S2 includes:
[0075] S21: querying the metadata list corresponding to the i-th variable in the data request list, and parsing the metadata list;
[0076] S22: Obtain data of a variable of the jth basic metadata type in the metadata list, compress the data of the variable of the jth basic metadata type in the metadata list into a data cache package according to the metadata type and the metadata model, and set j=j+1, where 1≤j≤M, and M is the number of variables of all basic metadata types in the metadata list;
[0077] S23: Determine whether j is equal to M. If so, set i=i+1 and execute step S3; if not, return to step S21.
[0078] Specifically, parse the metadata list L i (including M variables), set variable j to the current variable index (1≤j≤M), and obtain the metadata list L i The basic metadata type variable U in k , set the variable U of the basic metadata type k Since both the data sender and the data receiver know the structure of the metadata type, the packaged content only needs to include the variables U of the basic metadata type. kThe content of the data value part in, and let j=j+1; determine whether j is equal to M, if so, return the packaged data, let i=i+1, and execute step S3, if not, return to step S21.
[0079] In some embodiments, the method further comprises:
[0080] When the predefined metadata type and / or the predefined metadata model is updated, the updated metadata type and the updated metadata model are re-imported.
[0081] After the metadata type and / or metadata model is updated, it is necessary to synchronize all data senders and data receivers, update all metadata models, metadata type offset table O and data cache package B, and then restart the data transfer process.
[0082] Some embodiments of the present invention disclose a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for standardized transmission of model data as described above is implemented, which will not be described in detail herein.
[0083] By implementing the present invention, the following beneficial effects are achieved:
[0084] The model data standardized transmission method disclosed in the present invention is applied to the data sender. Before establishing communication with the data receiver, a predefined metadata type and a predefined metadata model are imported. After establishing communication with the data receiver, the data receiver's request is received to obtain data. The data is compressed into a data cache package according to the metadata type and the metadata model, and then the data cache package is sent to the data receiver. The data cache package is used by the data receiver to parse the data cache package according to the predefined metadata type and the predefined metadata model to obtain data, thereby solving the problem of standardized data transmission of internal and external data of a simulator simulation platform and realizing efficient transmission of internal and external data.
[0085] It is understandable that the above embodiments only express some implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that for ordinary technicians in this field, without departing from the concept of the present invention, the above embodiments or technical features can be freely combined, and several deformations and improvements can be made, which all belong to the protection scope of the present invention, that is, the embodiments described in "some embodiments" can be freely combined with any of the above and below embodiments. Therefore, all equivalent changes and modifications made to the scope of the claims of the present invention should belong to the scope of the claims of the present invention.
Claims
1. A method for standardized transmission of model data, characterized in that: The method is applied to the data sender and comprises the following steps: Before establishing communication with the data recipient, import the predefined metadata type and the predefined metadata model; After establishing communication with the data recipient, receiving a request from the data recipient, acquiring data, and compressing the data into a data cache package according to the metadata type and the metadata model; The data cache package is sent to the data receiver, where the data cache package is used by the data receiver to parse the data cache package according to the predefined metadata type and the predefined metadata model to obtain data.
2. The method for standardized transmission of model data according to claim 1, characterized in that: The metadata types include: basic metadata types and user-defined metadata types; The metadata model includes: the metadata type and the metadata name.
3. The method for standardized transmission of model data according to claim 2, characterized in that: The user-defined metadata type includes a combination of at least two of the basic metadata types.
4. The method for standardized transmission of model data according to claim 1, characterized in that: After establishing communication with the data recipient, receiving a request from the data recipient, acquiring data, and compressing the data into a data cache package according to the metadata type and the metadata model, including: S1: after establishing communication with the data receiving party, receiving a data request list from the data receiving party, parsing the data request list, and obtaining the i-th variable in the data request list, where 1≤i≤N, and N is the number of all variables in the data request list; S2: query the metadata list corresponding to the i-th variable in the data request list, obtain the data in the metadata list, compress the data into the data cache package according to the metadata type and the metadata model, and set i=i+1; S3: Determine whether i is equal to N. If so, complete the data compression; if not, return to execute step S1.
5. The method for standardized transmission of model data according to claim 4, characterized in that: Step S1 includes: After establishing communication with the data receiving party, a data request list of the data receiving party is received, the data request list is parsed, the i-th variable in the data request list is obtained, and it is determined whether the data cache package exists. If the data cache package exists, the location where the i-th variable in the data request list is stored is located according to the data cache package offset table, and step S2 is executed.
6. The method for standardized transmission of model data according to claim 4, characterized in that: Step S1 includes: After establishing communication with the data receiving party, receiving the data request list of the data receiving party, parsing the data request list, obtaining the i-th variable in the data request list, determining whether the data cache package exists, and if the data cache package does not exist, establishing the data cache package and the data cache package offset table, and executing step S2.
7. The method for standardized transmission of model data according to claim 5 or 6, characterized in that: Before establishing communication with the data recipient, importing a predefined metadata type and a predefined metadata model, further comprising: establishing a metadata offset table of all metadata types according to the metadata model; After step S1, the method further includes: recording the offset of the variable in the data cache package according to the metadata offset table, and putting the offset into the data cache package offset table.
8. The method for standardized transmission of model data according to claim 4, characterized in that: Step S2 includes: S21: querying a metadata list corresponding to the i-th variable in the data request list, and parsing the metadata list; S22: Acquire data of a variable of the jth basic metadata type in the metadata list, compress the data of the variable of the jth basic metadata type in the metadata list into the data cache package according to the metadata type and the metadata model, and set j=j+1, where 1≤j≤M, and M is the number of variables of all basic metadata types in the metadata list; S23: Determine whether j is equal to M. If so, set i=i+1 and execute step S3; if not, return to step S21.
9. The method for standardized transmission of model data according to claim 1, characterized in that: The method further comprises: When the predefined metadata type and / or the predefined metadata model is updated, the updated metadata type and the updated metadata model are re-imported.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for standardized transmission of model data as described in any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Simulation system data transmission method and system based on metadata
CN116668534A