Data access method and system, electronic equipment and computer program product
By using index mapping relationships in the power system to obtain and convert data from the real-time library, the problem of non-universal interfaces and mismatch formats when applications access real-time data is solved, and the unified and efficiency of the data access interface is improved.
Patent Information
- Application Number
- CN202411751110.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-14
AI Technical Summary
In power systems, when an application accesses real-time data, the data access interface is not universal and the data access result format does not match, resulting in low data access efficiency and inconsistent interfaces.
By determining the target access object and the corresponding index identifier, the data that conforms to the second data structure format is obtained from the real-time library using the index mapping relationship, and converting it into data that conforms to the first data structure format, and outputting it to the application.
It realizes the matching of data access result formats and the unification of data access interfaces, solves the problem of non-universal interfaces when accessing real-time data, and improves data access efficiency.
Smart Images

Figure CN119621725A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of power system information technology, and in particular, relates to a data access method, system, electronic equipment and computer program product. Background Art
[0002] In the power system, IEC61850, as a comprehensive international standard for substation communication networks and systems, stipulates the use of specific data structures to describe the data models of secondary devices such as measuring instruments and relays, such as the use of Substation Configuration Description (SCD) files to describe the data models of secondary devices. However, the complexity of SCD files has brought challenges to data storage to a certain extent. In order to enable real-time data to be stored in the real-time library, the SCD data structure of real-time data needs to be properly converted.
[0003] The converted data structure does not completely correspond to the data structure format of the SCD data structure. When accessing data, the application needs to use a specific data access interface to access the real-time data whose data structures have been converted from the real-time library. Moreover, the data structure format of the accessed real-time data does not conform to the SCD data structure format, that is, the data access interface is not universal and the data access result format does not match. Summary of the invention
[0004] The embodiments of the present application provide a data access method, system, electronic device and computer program product to solve the problems in the prior art of non-universal data access interfaces and mismatched data access result formats when applications access real-time data.
[0005] A first aspect of an embodiment of the present application provides a data access method, including:
[0006] Based on the received data access request, determine a target access object and a first index identifier corresponding to the target access object; the first index identifier is an index identifier under a first data structure;
[0007] In the case where the target access object is real-time data, determining at least one second index identifier having an index mapping relationship with the first index identifier; the second index identifier is an index identifier of the target data attribute corresponding to the target access object in the second data structure;
[0008] Acquire the first data conforming to the second data structure format corresponding to each of the second index identifiers from the real-time library; the real-time library is used to store real-time data;
[0009] According to the first data structure format corresponding to the first index identifier, the first data is converted from the second data structure format to the first data structure format to obtain the second data and output it to the application.
[0010] A second aspect of an embodiment of the present application provides a data access system, including:
[0011] A first determination module, configured to determine a target access object and a first index identifier corresponding to the target access object based on a received data access request; the first index identifier is an index identifier under a first data structure;
[0012] A second determination module is used to determine, when the target access object belongs to real-time data, at least one second index identifier having an index mapping relationship with the first index identifier; the second index identifier is an index identifier of the target data attribute corresponding to the target access object under the second data structure;
[0013] An acquisition module, used for acquiring first data conforming to a second data structure format corresponding to each second index identifier from a real-time library; the real-time library is used for storing real-time data;
[0014] The conversion output module is used to convert the first data from the second data structure format to the first data structure format according to the first data structure format corresponding to the first index identifier, obtain the second data and output it to the application.
[0015] A third aspect of an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the computer program.
[0016] A fourth aspect of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the steps of the method described in the first aspect.
[0017] A fifth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0018] As can be seen from the above, when the target access object is real-time data, the present application utilizes the index mapping relationship between the first data structure and the second data structure to accurately obtain the first data that conforms to the second data structure format from the real-time library. Subsequently, through the index mapping relationship, the first data that conforms to the second data structure format is converted into the second data that conforms to the first data structure format and output to the application. In this way, all real-time data received by the application conforms to the first data structure format, and the matching of the data access result format is achieved. At the same time, since all data can be output in the first data structure format, the unification of the data access interface is achieved, thereby solving the problem that the data access interface is not universal when accessing real-time data. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 This is a process of a data access method provided by an embodiment of the present application Figure 1 ;
[0021] Figure 2 It is a schematic diagram of the hierarchical structure of an SCD file provided in an embodiment of the present application;
[0022] Figure 3 is a schematic diagram of a converted hierarchical structure provided in an embodiment of the present application;
[0023] Figure 4 It is a program interaction schematic diagram provided in an embodiment of the present application;
[0024] Figure 5 This is a process of a data access method provided by an embodiment of the present application Figure 2 ;
[0025] Figure 6 is a structural diagram of a data access system provided in an embodiment of the present application;
[0026] Figure 7 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0028] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0029] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0030] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0031] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0032] In a specific implementation, the terminal described in the embodiments of the present application includes, but is not limited to, other portable devices such as mobile phones, laptop computers, or tablet computers with touch-sensitive surfaces (e.g., touch screen displays and / or touch pads). It should also be understood that in some embodiments, the device is not a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., touch screen displays and / or touch pads).
[0033] In the following discussion, a terminal including a display and a touch-sensitive surface is described. However, it should be understood that the terminal may include one or more other physical user interface devices such as a physical keyboard, mouse and / or joystick.
[0034] It should be understood that the size of the serial numbers of the steps in this embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
[0035] In the power system, IEC61850 requires the data model of secondary devices to be described in a specific data structure, such as using SCD files to describe the data model of secondary devices. SCD files use an object-oriented modeling approach and define a variety of configurable data models, including intelligent electronic devices (IED), logical devices (LD) and data objects (DO).
[0036] When these data models are instantiated, they can be combined and configured differently according to specific needs to generate different SCD files. That is, although they all belong to the SCD data structure, different SCD files may have their own unique data structures. For example, different DOs contain different data attributes (DA). For example, the DO corresponding to the protection action information may contain a DA describing the phase information, while the DO corresponding to the ordinary switch quantity information does not contain a DA describing the phase information. For another example, a DO contains multiple DAs, such as the DO corresponding to the protection current of the protection device contains both the current amplitude and the current angle DA.
[0037] When storing data in SCD files into the real-time library, since these files may have unique data structure representations, it is necessary to design a flexible storage architecture and parsing mechanism to adapt to these differences, which undoubtedly increases the complexity of unified storage management.
[0038] Therefore, in order to store the real-time data into the real-time library, the data structure of the real-time data contained in the SCD file will be converted. For example, the data object corresponding to the current in the protection current data structure will be split into two independent telemetry entries of amplitude and angle. The given data structure, i.e., the second data structure, is used to describe each real-time data and stored in the real-time library.
[0039] The data structure of the converted real-time data does not completely correspond to the data structure format of the SCD data structure. When an application accesses the real-time data in the real-time library, it needs to use a specific data access interface to access the real-time data whose structures have been converted from the real-time library, and the data structure format of the accessed real-time data does not conform to the SCD data structure format. Among them, the application includes the monitoring background, remote motor, and security substation.
[0040] In order to solve the problem that the data access interface is not universal and the data access result format does not match when the application service program accesses real-time data in the power system, the present application provides a data access method, system, electronic device and computer program product. The data access method in the present application is applied to a data access system, and the data access system includes a data service program and a communication program. Among them, the data service program can communicate with a real-time library, a message queue, a communication program and an application program, and the communication program can communicate with a real-time library, a message queue, a data service program and a secondary device.
[0041] In this application, applications, data service programs and communication programs can be deployed on different servers, and data interaction can be carried out through the network to achieve data interaction across devices.
[0042] In order to illustrate the technical solution described in this application, a specific embodiment is provided below for illustration.
[0043] See also Figure 1 , Figure 1 This is a process of a data access method provided by an embodiment of the present application Figure 1 .like Figure 1 As shown, a method for accessing a number includes the following steps:
[0044] Step 101: determine a target access object and a first index identifier corresponding to the target access object based on a received data access request; the first index identifier is an index identifier under a first data structure.
[0045] In some embodiments, the data access request is a request initiated by an application in real time.
[0046] In some embodiments, there is a communication interface between the data service program and the application program, and the data service program is equipped with a Transmission Control Protocol (TCP) service, and monitors data access requests of the application program based on the TCP service.
[0047] In addition, a subscription request can be sent based on the TCP service monitoring application. The subscription request subscribes to real-time data. The subscription request contains subscription parameters given by the application, that is, under what circumstances which type of real-time data is transmitted, that is, under what circumstances the target access object is transmitted.
[0048] Applications can access both real-time and non-real-time data.
[0049] Real-time data is data actively transmitted by secondary devices and stored in the real-time library.
[0050] Non-real-time data is data that is not actively transmitted by the secondary device and needs to be actively obtained from the secondary device through the communication program. Non-real-time data includes fixed values, parameters, files and other data.
[0051] The data access requests of applications include the following types:
[0052] (1) Request real-time data of a data set (GetDataSetValues-Request);
[0053] (2) Request real-time data of a DO / DA (GetDataValue-Request);
[0054] (3) Request for set value (GetSGValue-Request);
[0055] (4) Request parameters (GetParameters-Request);
[0056] (5) Request file (GetFile-Request).
[0057] The data service program analyzes the data access request or subscription request to obtain the target access object to be accessed and the first index identifier corresponding to the target access object. Based on the first index identifier, data query and data conversion are easily realized.
[0058] The first data structure is the SCD data structure, and the index identifiers under the data structure are collectively referred to as third index identifiers, namely SCD index identifiers. The first index identifier is the target index identifier for this access, and belongs to the index identifier under the SCD data structure.
[0059] In some embodiments, reference is used to specifically refer to the third index identifier, and reference is a unique identifier of the data in the SCD file.
[0060] In the SCD file, data is represented hierarchically, using the IED level, LD level, logical node (LogicalNode, LN) level, DO level and DA level to describe the third index identifier to form a reference.
[0061] In some embodiments, an application requests access to a data set, and the corresponding sample code of the data access request is:
[0062] send:{"service":"GetDataSetValues-Request",
[0063] "datasetReference":"PL1101LD0 / LLN0$dsAin",
[0064] }.
[0065] The data access object is a data set, and "PL1101LD0 / LLN0$dsAin" is the reference of the data set, that is, the first index identifier.
[0066] In some embodiments, before determining the target access object and the first index identifier corresponding to the target access object based on the received data access request, it also includes: parsing the SCD file to obtain the FCDA contained in the SCD file; each of the FCDA corresponds to one or more data attributes, and each of the data attributes corresponds to third data that conforms to the first data structure format; based on the set index format, configuring a fourth index identifier for each of the data attributes; converting each of the third data into fourth data that conforms to the second data structure format; storing the fourth data and the fourth index identifier corresponding to the fourth data in the real-time library.
[0067] During the communication process, the secondary device will actively transmit data to the communication program, and the actively transmitted data is real-time data. Therefore, the communication program parses the SCD file actively transmitted by the secondary device to describe the data model of the secondary device, and can obtain the relevant real-time data of the secondary device.
[0068] like Figure 2 As shown, Figure 2 It is a schematic diagram of the hierarchical structure of an SCD file provided in an embodiment of the present application. SCLDATA indicates that the file is described using Structured Control Language (SCL). In the SCD file, instances and templates are separated and divided into an IED level and a data type template (DataTypeTemplates) level, where the level is also referred to as a node. The IED level contains a data set (Dataset), and the data set contains a functionally constrained data attribute (FunctionallyConstrained Data Attribute, FCDA) level. The FCDA level contains a DO / DA level, and the data information corresponding to DO / DA - object type (DOType) / data attribute type (DAType) is located under the DataTypeTemplates level. Figure 2 The hierarchical structure of the SCD file is clearly shown.
[0069] After the communication program receives the SCD file, it uses the parsing tool to parse it and obtain all FCDAs contained in all data sets in the SCD file, that is, to obtain relevant information of all data attributes, including data type, data reference, quality, time scale, etc.
[0070] The third data conforming to the first data structure format corresponding to each data attribute under the FCDA level is converted into fourth data conforming to the second data structure format. The second data structure is a predefined data structure used to uniformly describe all real-time data in the SCD file.
[0071] According to the set index format, a fourth index identifier is configured for each data attribute, that is, a fourth index identifier is configured for each data attribute corresponding to the data. Afterwards, the fourth data obtained through data structure format conversion and the fourth index identifier corresponding to the fourth data can be stored together in the real-time library.
[0072] In particular, more important real-time data, such as the fourth data corresponding to the protection action event and the protection alarm time, will also be stored in the message queue at the same time.
[0073] The fourth index identifier is used as index information to facilitate data search. The third index identifier and the fourth index identifier are both represented by fields.
[0074] In some embodiments, the set index format is device and number / signal type and group number / data number. For example, the fourth index identifier obtained is Ied2 / Grp5 / Item10, indicating that the data is the 10th data of the 5th group of telemetry signals of the device numbered 2. The signal type includes telemetry signals and telesignaling signals. Using this set index format, all real-time data in the real-time library can be identified.
[0075] In some embodiments, datakey is used to refer to the fourth index identifier.
[0076] In some embodiments, after parsing the SCD file and obtaining the FCDA contained in the SCD file, it also includes: hierarchically reconstructing the FCDA according to the second data structure to obtain a first hierarchical configuration file; the first hierarchical configuration file includes a data set hierarchy, a FCDA hierarchy and a data attribute hierarchy, and the data set and the FCDA correspond to the third index identifier under the first data structure; the third index identifier of each data set, the third index identifier of each FCDA and the fourth index identifier of each data attribute corresponding to each FCDA are written into the first hierarchical configuration file to obtain a second hierarchical configuration file containing the index mapping relationship; the second hierarchical configuration file is used to implement index query and data conversion.
[0077] That is, according to the data level representation form corresponding to the second data structure and the FCDA obtained by parsing, level reconstruction is performed to obtain the first level configuration file.
[0078] The first-level configuration file includes the data set level, FCDA level and data attribute level, and these levels all correspond to the third index identifier, namely reference. In addition, the first-level configuration file also includes the IED level.
[0079] The third index identifier corresponding to each level and the fourth index identifier configured for the data attribute are written into the first level configuration file to obtain the second level configuration file. In this way, an index mapping relationship between the third index identifier and the fourth index identifier is formed in the second level configuration file, and index query and data conversion can be implemented based on the second level configuration file.
[0080] In some embodiments, the second-level configuration file may be expressed using an eXtensible Markup Language (XML) format.
[0081] The second-level configuration files are used by data service programs.
[0082] In some embodiments, example code of the second-level configuration file is described as follows.
[0083] <scldata>
[0084] <IED name="PL1101">
[0085] <DATASET ref="PL1101LD0 / LLN0$dsAin"ctrlblk="PL1101LD0 / LLN0$urcbAin"ap="S1">
[0086] <FCDA ref="PL1101LD0 / STMP1$MXTmp">
[0087] <DA name="mag"type="Struct">
[0088] <DA name="f"type="FLOAT32"rtdbskey="Data / Ied1 / Grp1 / Item1:val" / >
[0089]
[0090] <DA name="q"type="Quality"rtdbskey="Data / / Ied1 / Grp1 / Item1:flag" / >
[0091] <DA name="t"type="Timestamp"rtdbskey="Data / / Ied1 / Grp1 / Item1:time" / >
[0092]
[0093] <FCDA ref="PL1101LD0 / SPVT1$MX$Vol">
[0094] <DA name="mag"type="Struct">
[0095] <DA name="f"type="FLOAT32"rtdbskey="Data / / Ied1 / Grp1 / Item2:val" / >
[0096]
[0097] <DA name="q"type="Quality"rtdbskey="Data / / Ied1 / Grp1 / Item2:flag" / >
[0098] <DA name="t"type="Timestamp"rtdbskey="Data / / Ied1 / Grp1 / Item2:time" / >
[0099]
[0100]
[0101]
[0102] < / scldata> .
[0103] The configuration file is written in SCL language, and the hierarchical structure of the file contains SCLDATA, IED, DATASET, FCDA and DA from high to low.
[0104] Each level has different meanings and corresponds to different attribute information. As shown in Table 1, Table 1 is a schematic table of a second-level configuration file provided in an embodiment of the present application. Table 1 only shows part of the content of the second-level configuration file and explains part of the sample code of the second-level configuration file.
[0105] Table 1 Schematic diagram of the second-level configuration file
[0106]
[0107] Table 1 shows the various levels and the attribute information of each level, where the member names include the value val, the quality flag and the time stamp time.
[0108] The table contains two types of indexes: reference and datakey. Data query can be achieved through the index mapping relationship in the second-level configuration file, and secondary conversion of data structure format can be achieved through the data type and index mapping relationship.
[0109] In the hierarchical structure of SCD files, instances and templates are separated, which is inconvenient to use. When reconstructing the hierarchical structure, this application cancels the DataTypeTemplates hierarchy in the SCD file and puts the content of the template in the instance, that is, the information contained in the DataTypeTemplates hierarchy is placed in the FCDA. There is no need to go to DataTypeTemplates to find out what information the data contains, forming a hierarchical structure that is similar to the SCD hierarchical structure but different. Figure 3 As shown, Figure 3 It is a schematic diagram of a converted hierarchical structure provided in an embodiment of the present application.
[0110] Figure 3 The hierarchical relationship diagram of the second-level configuration file is shown. SCLDATA indicates that the file is described in SCL language. The IED level contains the Dataset level, and the Dataset level contains the FCDA level. An FCDA can correspond to a group of DAs in a DO, or to a specific DA, that is, the FCDA level contains the DO / DA level. For structure DA, the DA level can be nested. The datakey is associated with the DA.
[0111] As can be seen from the chart, DA information aggregation is achieved through hierarchical reconstruction, which eliminates the disadvantage of the SCD hierarchical structure that is inconvenient to find information, retains the advantage of the SCD hierarchical structure with clear hierarchies, and is more convenient to use.
[0112] Step 102, when the target access object belongs to real-time data, determine at least one second index identifier that has an index mapping relationship with the first index identifier; the second index identifier is the index identifier of the target data attribute corresponding to the target access object under the second data structure.
[0113] Check whether the target access object indicated by the first index identifier exists in the second-level configuration file. If it exists, it means that the target access object belongs to real-time data and needs to be obtained from the real-time library. Otherwise, it means that the target access object belongs to non-real-time data and is directly obtained from the corresponding device. The corresponding implementation steps can refer to steps 502-503.
[0114] The real-time data stored in the real-time database is fourth data conforming to the second data structure format, and the fourth data is associated with a fourth index identifier. When acquiring data, it is necessary to acquire the required data from the real-time database according to the fourth index identifier.
[0115] In some embodiments, a query is performed based on the second-level configuration file to determine the one or more target data attributes actually contained in the target access object corresponding to the first index identifier, and a second index identifier of each target data attribute under the second data structure is obtained. The index format of the second index identifier is a set index format. The at least one second index identifier determined is one or more index identifiers among the plurality of fourth index identifiers.
[0116] In some embodiments, when the target access object belongs to real-time data, determining at least one second index identifier that has an index mapping relationship with the first index identifier includes: when the target access object belongs to real-time data, if the target access object is a target data set, querying at least one target FCDA corresponding to the target data set based on the first index identifier; determining the second index identifier corresponding to at least one of the target data attributes corresponding to the target FCDA.
[0117] According to the second-level configuration file, the data set level includes the FCDA level, and the FCDA level includes the data attribute level.
[0118] If the target access object is real-time data and is a data set, then according to the first index identifier, the second-level configuration file is queried to see how many FCDAs the target data set contains, at least one target FCDA is obtained, and the index identifier corresponding to at least one target data attribute contained in the target FCDA is obtained, that is, the second index identifier is obtained.
[0119] In some embodiments, the data access request is:
[0120] send:{"service":"GetDataSetValues-Request",
[0121] "datasetReference":"PL1101LD0 / LLN0$dsAin",
[0122] }.
[0123] According to the first index identifier "PL1101LD0 / LLN0$dsAin", the target data set contains several FCDAs, and two target FCDAs are obtained. The first index identifiers of the two target FCDAs are "PL1101LD0 / STMP1$MX$Tmp" (device temperature) and "PL1101LD0 / SPVT1$MX$Vol" (device voltage), and the second index identifier of the target data attribute contained in each target FCDA is obtained. For example, the FCDA corresponding to PL1101LD0 / STMP1$MX$Tmp contains three target data attributes: mag.f attribute, mag.q attribute, and mag.t attribute. The corresponding second index identifiers are all Data / Ied1 / Grp1 / Item1, and the members are respectively the value val, the quality flag, and the time stamp time.
[0124] In some embodiments, when the target access object belongs to real-time data, determining at least one second index identifier that has an index mapping relationship with the first index identifier includes: when the target access object belongs to real-time data, if the target access object is a target FCDA, then based on the first index identifier, querying at least one of the target data attributes corresponding to the target FCDA to obtain the second index identifier corresponding to at least one of the target data attributes.
[0125] If the target access object is real-time data and is FCDA, the target FCDA is queried in the second-level configuration file according to the first index identifier, and the index identifier corresponding to at least one target data attribute contained in the target FCDA is obtained to obtain the second index identifier.
[0126] The second-level configuration file clarifies the hierarchical relationship, which facilitates data access based on data sets and single data access. It can access one or more data at a time, improving data access efficiency.
[0127] Step 103, obtaining first data conforming to a second data structure format corresponding to each second index identifier from a real-time library; the real-time library is used to store real-time data.
[0128] The real-time library stores fourth data associated with a fourth index identifier, and the fourth data in the real-time library all conform to the second data structure format.
[0129] After determining the second index identifier of the target data attribute to be accessed, the target data corresponding to the target data attribute can be searched from the real-time library according to the second index identifier.
[0130] That is, based on the second index identifier, a query is performed in the real-time database to obtain the fourth data associated with the second index identifier, that is, the first data that conforms to the second data structure format is obtained.
[0131] Step 104: According to the first data structure format corresponding to the first index identifier, convert the first data from the second data structure format to the first data structure format, obtain second data and output it to an application.
[0132] In some embodiments, the data service program may convert the data structure format of the obtained first data according to the first data structure format corresponding to the first index identifier in the second-level configuration file, obtain second data that conforms to the first data structure format, and send it to the application.
[0133] In some embodiments, in response to the above data access request example code, second data is sent to the application program in the first data structure format. The example code for sending data is as follows:
[0134] response:{"service":"GetDataSetValues-Response",
[0135] "datasetReference":"PL1101LD0 / LLN0$dsAin",
[0136] "data":[{"reference":"PL1101LD0 / STMP1$MX$Tmp",
[0137] "value":{"mag":{"f":1.00},"q":0,"t":"2024-07-04 15:31:23.0"}},
[0138] {"reference":"PL1101LD0 / SPVT1$MX$Vol",
[0139] "value":{"mag":{"f":1.00},"q":0,"t":"2024-07-04 15:31:23.0"}},
[0140] ],
[0141] }.
[0142] Among them, "f", "q" and "t" are target data attributes, and the data after the colon is the target data corresponding to the target data attributes.
[0143] In some embodiments, if it is detected that the subscription data subscribed by the application is updated, the subscription data is obtained from the real-time library; the subscription data is converted from the second data structure format to the first data structure format and output to the application.
[0144] The application sends a subscription request, indicating the subscribed data object and the index identifier of the data object, and indicating the subscription update data. The data service program parses the subscription request and determines the subscription data through the second-level configuration file.
[0145] For example, subscribe to the device status data of IED, when the device status generates an alarm, that is, the subscribed data is updated, the communication program will store the device status data in the second data structure format into the real-time library, and at the same time store the change data, that is, the alarm information, into the message queue.
[0146] The message queue will send the change data to the data service program. The change data is used to inform the data service program that the subscription data is updated. At this time, the data service program obtains the subscription data from the real-time library, and the subscription data is the updated data. After the data structure format is converted, the subscription data that conforms to the first data structure format is sent to the application.
[0147] In some embodiments, if the subscription request specifies that the subscription data should be sent to the application at a set subscription time, then when the set subscription time is reached, the data service program obtains the subscription data in the second data structure format from the real-time library, converts the data structure format, and then sends the subscription data in the first data structure format to the application.
[0148] In the process of accessing real-time data, communication programs, real-time libraries, message queues, data service programs, and applications are applied. Figure 4 As shown, Figure 4 This is a program interaction diagram provided by an embodiment of the present application. The communication program can write the changed data into the message queue, and the message queue uploads the changed data to the data service program. The communication program can also write real-time data that conforms to the second data structure format in the real-time library. The data service program can obtain real-time data from the real-time library and convert it based on the TCP service monitoring application's data access request and subscription request, and transmit it to the application. The programs work together to achieve efficient operation.
[0149] In this application, the real-time data output to the application program conforms to the first data structure format. In this way, the data format is unified, and real-time data access can be achieved through the data access structure corresponding to the first data structure, i.e., the SCD data structure, which not only solves the problem of inconsistent data access interfaces when accessing real-time data, but also meets the format matching requirements.
[0150] It can be seen from steps 501 to 503 that the non-real-time data is also output to the application program in the first data structure format.
[0151] This application introduces a data service program to achieve hierarchical reconstruction and data conversion. When accessing data, it achieves the purpose of unifying the data structure format and data access interface, so that the dependency between the application and the communication program is minimized. The application only needs to know how to access data that conforms to the first data structure format, namely the SCD data structure format, without having to worry about how the data is collected, transmitted or processed. This decoupling makes it easier for the application to be integrated with different communication programs without requiring a lot of modifications to the application itself, thereby improving the scalability and maintainability of the application. In addition, the application can more easily adapt to different data sources and communication protocols, reducing the difficulty of application reuse and transplantation and improving the versatility of the application.
[0152] In an embodiment of the present application, when the target access object is real-time data, the index mapping relationship between the first data structure and the second data structure is used to accurately obtain the first data that conforms to the second data structure format from the real-time library. Subsequently, through the index mapping relationship, the first data that conforms to the second data structure format is converted into the second data that conforms to the first data structure format and output to the application. In this way, all real-time data received by the application conforms to the first data structure format, and the matching of the data access result format is achieved. At the same time, since all data can be output in the first data structure format, the unification of the data access interface is achieved, thereby solving the problem that the data access interface is not universal when accessing real-time data.
[0153] See also Figure 5 , Figure 5 This is a process of a data access method provided by an embodiment of the present application Figure 2 .like Figure 5 As shown, a data access method comprises the following steps:
[0154] Step 501: Determine a target access object and a first index identifier corresponding to the target access object based on a received data access request; the first index identifier is an index identifier under a first data structure.
[0155] The implementation process of this step is the same as the implementation process of step 101 in the aforementioned embodiment, and will not be repeated here.
[0156] Step 502: When the target access object is non-real-time data, a data acquisition request including the first index identifier is sent to a target device.
[0157] If the data service program finds that the target access object is non-real-time data, the first index identifier is sent to the communication program. The communication program sends a data acquisition request to the data source indicated by the first index identifier, that is, the target device. The target device is a secondary device.
[0158] The data acquisition request includes a first index identifier so that the target device can find corresponding data based on the first index identifier.
[0159] Step 503: Receive fifth data conforming to the first data structure format fed back by the target device, and output the fifth data to the application.
[0160] The target device transmits the data indicated by the first index identifier, namely the fifth data, to the communication program in response to the data acquisition request. The fifth data is non-real-time data and does not need to be stored in the real-time library, so the data structure format of the fifth data is the first data structure format.
[0161] The communication program transmits the fifth data to the data service program, and the data service program directly transmits the fifth data to the application program without conversion.
[0162] The data structure format of non-real-time data is the first data structure format, and the data format of real-time data transmitted to the application is limited to the first data structure format, thereby achieving a high degree of uniformity in data formats and a high degree of uniformity in data access interfaces.
[0163] In an embodiment of the present application, when it is determined that the target access object belongs to non-real-time data, a data access function can also be provided, that is, a data acquisition request containing a first index identifier is sent to the target device to receive the fifth data that conforms to the first data structure format fed back by the target device, and output it to the application, thereby satisfying the application's data access requirements for non-real-time data.
[0164] See also Figure 6 , Figure 6 This is a structural diagram of a data access system provided in an embodiment of the present application. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0165] The data access system 600 includes: a first determination module 601 , a second determination module 602 , an acquisition module 603 , and a conversion and output module 604 .
[0166] The first determination module 601 is used to determine a target access object and a first index identifier corresponding to the target access object based on a received data access request; the first index identifier is an index identifier under a first data structure.
[0167] The second determination module 602 is used to determine at least one second index identifier that has an index mapping relationship with the first index identifier when the target access object belongs to real-time data; the second index identifier is the index identifier of the target data attribute corresponding to the target access object under the second data structure.
[0168] The acquisition module 603 is used to acquire the first data conforming to the second data structure format corresponding to each second index identifier from the real-time library; the real-time library is used to store real-time data.
[0169] The conversion and output module 604 is used to convert the first data from the second data structure format to the first data structure format according to the first data structure format corresponding to the first index identifier, obtain the second data and output it to the application.
[0170] In some embodiments, the system further comprises a parsing and storing module, configured to:
[0171] Parsing the SCD file to obtain the FCDAs contained in the SCD file; each of the FCDAs corresponds to one or more data attributes, and each of the data attributes corresponds to third data that conforms to the first data structure format;
[0172] Based on the set index format, configuring a fourth index identifier for each of the data attributes;
[0173] Convert each of the third data into fourth data conforming to the second data structure format;
[0174] The fourth data and the fourth index identifier corresponding to the fourth data are stored in the real-time library.
[0175] In some embodiments, the system further comprises a file configuration module for:
[0176] According to the second data structure, the FCDA is hierarchically reconstructed to obtain a first hierarchical configuration file; the first hierarchical configuration file includes a data set level, an FCDA level, and a data attribute level, and the data set and the FCDA correspond to a third index identifier under the first data structure;
[0177] The third index identifier of each of the data sets, the third index identifier of each of the FCDAs, and the fourth index identifier of each of the data attributes corresponding to each of the FCDAs are written into the first-level configuration file to obtain a second-level configuration file containing the index mapping relationship; the second-level configuration file is used to implement index query and data conversion.
[0178] In some embodiments, the system further comprises an acquisition output module, configured to:
[0179] In the case where the target access object is non-real-time data, sending a data acquisition request including the first index identifier to the target device;
[0180] The fifth data conforming to the first data structure format fed back by the target device is received, and the fifth data is output to the application.
[0181] In some embodiments, the second determining module is specifically configured to:
[0182] In the case where the target access object belongs to real-time data, if the target access object is a target data set, querying at least one target FCDA corresponding to the target data set based on the first index identifier;
[0183] Determine the second index identifier corresponding to at least one of the target data attributes corresponding to the target FCDA.
[0184] In some embodiments, the second determining module is specifically configured to:
[0185] In the case where the target access object belongs to real-time data, if the target access object is a target FCDA, at least one of the target data attributes corresponding to the target FCDA is queried based on the first index identifier to obtain the second index identifier corresponding to at least one of the target data attributes.
[0186] In some embodiments, the conversion output module is further used for:
[0187] If it is detected that the subscription data subscribed by the application is updated, the subscription data is obtained from the real-time library;
[0188] The subscription data is converted from the second data structure format into the first data structure format and output to the application.
[0189] The data access system provided in the embodiment of the present application can implement each process of the embodiment of the above-mentioned data access method and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0190] Figure 7 is a structural diagram of an electronic device provided in an embodiment of the present application. As shown in the figure, the electronic device 7 of the embodiment includes: at least one processor 70 ( Figure 7 Only one is shown in the figure), a memory 71, and a computer program 72 stored in the memory 71 and executable on the at least one processor 70, wherein the processor 70 implements the steps of any of the above-mentioned method embodiments when executing the computer program 72.
[0191] The electronic device 7 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device 7 may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will appreciate that Figure 7 It is only an example of the electronic device 7 and does not constitute a limitation of the electronic device 7. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0192] The processor 70 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0193] The memory 71 may be an internal storage unit of the electronic device 7, such as a hard disk or memory of the electronic device 7. The memory 71 may also be an external storage device of the electronic device 7, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the electronic device 7. The memory 71 is used to store the computer program and other programs and data required by the electronic device. The memory 71 may also be used to temporarily store data that has been output or is to be output.
[0194] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0195] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0196] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0197] In the embodiments provided in the present application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0198] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0199] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0200] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0201] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be implemented through a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0202] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data access method, characterized in that: include: Determine, based on the received data access request, a target access object and a first index identifier corresponding to the target access object; The first index identifier is an index identifier under the first data structure; In the case where the target access object is real-time data, determining at least one second index identifier having an index mapping relationship with the first index identifier; The second index identifier is an index identifier of the target data attribute corresponding to the target access object in the second data structure; Acquire the first data conforming to the second data structure format corresponding to each of the second index identifiers from the real-time library; The real-time library is used to store real-time data; According to the first data structure format corresponding to the first index identifier, the first data is converted from the second data structure format to the first data structure format to obtain the second data and output it to the application.
2. The method according to claim 1, characterized in that: Before determining the target access object and the first index identifier corresponding to the target access object based on the received data access request, the method further includes: Parsing the SCD file to obtain FCDAs contained in the SCD file; each of the FCDAs corresponds to one or more data attributes, and each of the data attributes corresponds to third data that conforms to the first data structure format; Based on the set index format, configuring a fourth index identifier for each of the data attributes; Convert each of the third data into fourth data conforming to the second data structure format; The fourth data and the fourth index identifier corresponding to the fourth data are stored in the real-time library.
3. The method according to claim 2, characterized in that After parsing the SCD file and obtaining the FCDA contained in the SCD file, the method further includes: According to the second data structure, the FCDA is hierarchically reconstructed to obtain a first hierarchical configuration file; the first hierarchical configuration file includes a data set level, an FCDA level, and a data attribute level, and the data set and the FCDA correspond to a third index identifier under the first data structure; The third index identifier of each of the data sets, the third index identifier of each of the FCDAs, and the fourth index identifier of each of the data attributes corresponding to each of the FCDAs are written into the first-level configuration file to obtain a second-level configuration file containing the index mapping relationship; the second-level configuration file is used to implement index query and data conversion.
4. The method according to claim 1, characterized in that: After determining the target access object and the first index identifier corresponding to the target access object based on the received data access request, the method further includes: In the case where the target access object is non-real-time data, sending a data acquisition request including the first index identifier to the target device; The fifth data conforming to the first data structure format fed back by the target device is received, and the fifth data is output to the application.
5. The method according to claim 1, characterized in that When the target access object is real-time data, determining at least one second index identifier having an index mapping relationship with the first index identifier includes: In the case where the target access object belongs to real-time data, if the target access object is a target data set, querying at least one target FCDA corresponding to the target data set based on the first index identifier; Determine the second index identifier corresponding to at least one of the target data attributes corresponding to the target FCDA.
6. The method according to claim 1, characterized in that When the target access object is real-time data, determining at least one second index identifier having an index mapping relationship with the first index identifier includes: In the case where the target access object belongs to real-time data, if the target access object is a target FCDA, at least one of the target data attributes corresponding to the target FCDA is queried based on the first index identifier to obtain the second index identifier corresponding to at least one of the target data attributes.
7. The method according to claim 1, characterized in that The method further comprises: If it is detected that the subscription data subscribed by the application is updated, the subscription data is obtained from the real-time library; The subscription data is converted from the second data structure format into the first data structure format and output to the application.
8. A data access system, characterized in that: include: A first determining module, configured to determine a target access object and a first index identifier corresponding to the target access object based on a received data access request; The first index identifier is an index identifier under the first data structure; A second determination module, configured to determine, when the target access object is real-time data, at least one second index identifier having an index mapping relationship with the first index identifier; The second index identifier is an index identifier of the target data attribute corresponding to the target access object in the second data structure; An acquisition module, used for acquiring, from the real-time library, first data conforming to a second data structure format and corresponding to each of the second index identifiers; The real-time library is used to store real-time data; The conversion output module is used to convert the first data from the second data structure format to the first data structure format according to the first data structure format corresponding to the first index identifier, obtain the second data and output it to the application.
9. An electronic device, characterized in that: The electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method as claimed in any one of claims 1 to 7.
10. A computer program product, characterized in that The invention comprises a computer program which, when executed, causes the method according to any one of claims 1 to 7 to be performed.