Real-time data ID generation method, system and medium for distribution automation system

By using tags and expiration time detection mechanisms to generate real-time data IDs in the distribution automation system, ID duplication and information security issues are solved, efficient and secure ID generation is achieved, and parallel service modes and high-frequency ID requirements are supported.

CN112380208BActive Publication Date: 2024-09-24ZHUHAI XUJIZHI ELECTRIFIED WIRE NETING AUTOMATIONCO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011129217.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-21
Publication Date
2024-09-24
Estimated Expiration
2040-10-21

AI Technical Summary

Technical Problem

Existing power distribution automation systems have problems such as ID duplication, insecure information, poor retrieval performance, time rollback problems and the inability to distinguish record types in terms of real-time data ID generation, making it difficult to support the growing amount of data and parallel service models.

Method used

By setting multiple tags in the real-time database, each tag contains the tag number, expiration time and current ID, the availability is detected sequentially and the target ID is calculated, and the expiration time is updated regularly. The generated ID does not have a timestamp, network card MAC address, and length. It is 8 bytes, the highest bit stores the record type information, and supports incrementing.

Benefits of technology

It realizes the generation of non-repetitive, secure, and high-frequency real-time data IDs in a distributed, microservice mode, meeting information security and retrieval performance requirements, without time rollback issues, and supports unlimited ID generation every millisecond.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112380208B
    Figure CN112380208B
Patent Text Reader

Abstract

The present invention discloses a real-time data ID generation method, system and medium of a distribution automation system, the method comprising the following steps: setting multiple tags, the relevant information of each tag including the tag number, expiration time and current ID, and saving the relevant information in a real-time database; starting an ID generation service, reading the corresponding expiration time in the order of the tag number, and detecting the availability of the tag according to the expiration time; the first tag is any one of the multiple tags, if the first tag is detected to be available, reading the current ID of the first tag, and calculating the target ID according to the current ID of the first tag, and writing the target ID back to the real-time database as the current ID of the first tag; the ID generation service regularly updates the expiration time of the first tag. The present invention can meet the demand of the distribution automation system for real-time data ID.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electric power grid, and in particular to a method, system and medium for generating a real-time data ID for a distribution automation system. Background Art

[0002] During the operation of the distribution automation system, a large amount of real-time data is generated. These real-time data include but are not limited to distribution areas, equipment attributes, equipment topology, and remote point configuration (telesignaling, telemetering, remote control, remote adjustment, and set values). Each piece of real-time data needs to be bound to a unique ID.

[0003] The assessment of the amount of ID data is roughly as follows: in the medium-voltage power grid, a city including counties includes: 600,000 feeder segments + 600,000 devices + 600,000 three-remote systems = 1.8 million objects; the total number of objects in 20 cities in a province: 1.8 million*20=36 million objects; in the low-voltage power grid, there are 400,000 TTUs in the province, each TTU monitors a substation, and each substation has 1,000 low-voltage feeder segments and devices + 5,000 measuring points = 6,000 objects; the total number of low-voltage objects in a province: 400,000*6,000=2.4 billion objects.

[0004] The current real-time data management service of the distribution automation system is a single service operation, which has the following shortcomings: a single service is difficult to support the growing amount of real-time data; if it is changed to a distributed or other parallel service, it is difficult to ensure that the generated real-time data ID is completely non-repetitive according to the original real-time data ID generation rules. For example, the UUID algorithm: the ID is a string and needs to occupy 36 characters; the ID contains the MAC address information of the network card, which may cause information insecurity; for retrieval performance considerations, relational databases such as Mysql do not recommend using long strings as record indexes, but the distribution automation system requires ID as a record index; and the record type such as switches and distribution transformers cannot be distinguished based on the ID. Another example is the snowflake algorithm: the ID contains a timestamp, which makes it difficult to solve the time rollback problem; the number of IDs supported per millisecond is only about 4,000; and the record type cannot be distinguished based on the ID. Summary of the invention

[0005] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a method for generating a real-time data ID of a distribution automation system, which can meet the demand of the distribution automation system for a real-time data ID.

[0006] The present invention also provides a real-time data ID generation system for a distribution automation system.

[0007] The present invention also provides a computer-readable storage medium for implementing the above method.

[0008] According to the first aspect of the present invention, a real-time data ID generation method for a distribution automation system includes: setting multiple tags, the relevant information of each tag includes a tag number, an expiration time and a current ID, and saving the relevant information in a real-time database; starting an ID generation service, reading the corresponding expiration time in the order of the tag number, and detecting the availability of the tag according to the expiration time; the first tag is any one of the multiple tags, if the first tag is detected to be available, reading the current ID of the first tag, and calculating the target ID based on the current ID of the first tag, and writing the target ID back to the real-time database as the current ID of the first tag; the ID generation service periodically updates the expiration time of the first tag.

[0009] According to some embodiments of the present invention, the method of detecting the availability of the tag according to the expiration time includes: reading the expiration time and obtaining the current time, and if the expiration time is less than the current time, the tag is available.

[0010] According to some embodiments of the present invention, the method for the ID generation service to periodically update the expiration time of the first tag includes: the ID generation service updates the expiration time of the first tag stored in the real-time database at a first time interval, and adds a second time interval to the expiration time of the first tag; wherein the first time interval is smaller than the second time interval.

[0011] According to some embodiments of the present invention, the current ID is of long type and has a length of 8 bytes; the highest byte of the current ID stores record type information, and the second highest byte stores the corresponding tag number.

[0012] According to some embodiments of the present invention, calculating the target ID according to the current ID of the first tag includes: adding 1 to the current ID of the first tag to obtain the target ID.

[0013] According to some embodiments of the present invention, the current ID includes record type information, a tag number, and increment information.

[0014] According to some embodiments of the present invention, the method further includes: if the first tag is detected to be unavailable, reading the expiration time of the second tag and detecting the availability of the second tag; wherein the tag number of the second tag is equal to the tag number of the first tag plus 1.

[0015] According to the real-time data ID generation system of the distribution automation system of the second aspect of the embodiment of the present invention, the system includes: a tag creation module, which is used to set multiple tags, and the relevant information of each tag includes a tag number, an expiration time and a current ID, and the relevant information is saved in a real-time database; an availability detection module, which is used to read the corresponding expiration time in the order of the tag number, and detect the availability of the tag according to the expiration time; a target ID generation module, which is used to read the current ID of the first tag, and calculate the target ID according to the current ID of the first tag, and write the target ID back to the real-time database as the current ID of the first tag; wherein the first tag is any one of the multiple tags, and the first tag is available; a timed update module, which is used to periodically update the expiration time of the first tag.

[0016] According to some embodiments of the present invention, the system also includes: a current ID setting module, which is used to set the current ID to be of long type with a length of 8 bytes, and configure the highest byte of the current ID to save record type information and the second highest byte to save the corresponding tag number.

[0017] According to a third aspect of an embodiment of the present invention, a computer-readable storage medium stores a computer program, which, when executed by a processor, implements any one of the methods in the first aspect of the present invention.

[0018] The embodiments of the present invention have at least the following beneficial effects: the real-time data ID generated by the method of the embodiments of the present invention can support parallel service modes such as distributed and microservices; it can be without timestamp, without time rollback problem, without network card MAC address information, meet information security requirements, and there is no limit on the number of IDs supported per millisecond.

[0019] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:

[0021] Figure 1 The figure is a flowchart of a method according to an embodiment of the present invention.

[0022] Figure 2 The figure is a schematic diagram of a method flow chart of another embodiment of the present invention.

[0023] Figure 3 The module schematic block diagram of the system according to the embodiment of the present invention. DETAILED DESCRIPTION

[0024] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0025] In the description of the present invention, "several" means one or more, "more" means two or more, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0026] Reference Figure 1 The real-time data ID generation method of the embodiment of the present invention comprises the following steps:

[0027] S1. Set multiple tags, each of which has relevant information including tag number, expiration time and current ID, and save the relevant information in a real-time database;

[0028] S2. Start the ID generation service, read the corresponding expiration time in the order of the tag number, and detect the availability of the tag according to the expiration time;

[0029] S3, the first tag is any one of the multiple tags, if it is detected that the first tag is available, read the current ID of the first tag, calculate the target ID according to the current ID of the first tag, and write the target ID back to the real-time database as the current ID of the first tag;

[0030] S4. The ID generation service periodically updates the expiration time of the first tag.

[0031] In some embodiments, the method of detecting the availability of a tag according to an expiration time includes: reading the expiration time and obtaining the current time, and if the expiration time is less than the current time, the tag is available.

[0032] In some embodiments, the method for the ID generation service to periodically update the expiration time of the first tag includes: the ID generation service updates the expiration time of the first tag stored in the real-time database every first time interval, and adds the expiration time of the first tag to the second time interval; wherein the first time interval is smaller than the second time interval.

[0033] In some embodiments, the current ID is of long type and has a length of 8 bytes; the highest byte of the current ID stores the record type information, and the second highest byte stores the corresponding tag number.

[0034] In some embodiments, the method of calculating the target ID according to the current ID of the first tag includes: adding 1 to the current ID of the first tag to obtain the target ID.

[0035] In some embodiments, the current ID includes record type information, a tag number, and increment information.

[0036] In some embodiments, the ID generation method further includes: if the first tag is detected to be unavailable, reading the expiration time of the second tag and detecting the availability of the second tag; wherein the tag number of the second tag is equal to the tag number of the first tag plus 1.

[0037] Reference Figure 2 , a method according to another embodiment of the present invention includes: starting a real-time data ID generation service, reading relevant information of tag n (n>1) from a Redis real-time database, and detecting whether tag n is available; starting detection from tag n (n=1), if tag n is not available, incrementing n by 1; if tag n is detected to be available, using tag n as a service tag of the present ID generation service, and reading the current ID in tag n; when a request to generate a target ID is received, after generating a target ID according to the current ID, writing the target ID back to the information area of ​​tag n in the Redis database; and updating the expiration time of tag n (current time plus 30 minutes) in the Redis database at regular intervals (every 10 minutes).

[0038] The generated real-time data ID is of long type with a length of 8 bytes. The highest byte of the ID stores the record type information, and the second highest byte stores the relevant information of the current tag. It supports up to 127 parallel ID generation services, and the tag range is 1 to 127; the other bytes of the ID store incremental information, starting from 0.

[0039] Among them, the tag-related information stored in the Redis database is shown in Table 1 below:

[0040]

[0041] Table 1 Marking related information

[0042] The method of this embodiment supports parallel service modes such as distributed and microservices, and the generated real-time data ID has the following advantages: the ID occupies a small space and does not affect the retrieval performance; the ID carries record type information, and the record type can be distinguished according to the ID; it does not carry a timestamp, and there is no time rollback problem; it does not carry network card MAC address information, and complies with information security; there is no limit on the number of IDs supported per millisecond; it meets the requirements of the distribution automation system for IDs.

[0043] Reference Figure 3The system of the embodiment of the present invention includes: a tag creation module, which is used to set multiple tags, and the relevant information of each tag includes a tag number, an expiration time and a current ID, and the relevant information is saved in a real-time database; an availability detection module, which is used to read the corresponding expiration time in the order of the tag number, and detect the availability of the tag according to the expiration time; a target ID generation module, which is used to read the current ID of the first tag, and calculate the target ID according to the current ID of the first tag, and write the target ID back to the real-time database as the current ID of the first tag; wherein the first tag is any one of the multiple tags, and the first tag is available; a timed update module, which is used to periodically update the expiration time of the first tag.

[0044] In some embodiments, the system also includes: a current ID setting module, which is used to set the current ID to long type with a length of 8 bytes, and configure the highest byte of the current ID to save record type information and the second highest byte to save the corresponding tag number.

[0045] Although specific embodiments are described herein, those of ordinary skill in the art will recognize that many other modifications or alternative embodiments are also within the scope of the present disclosure. For example, any of the functions and / or processing capabilities described in conjunction with a particular device or component may be performed by any other device or component. In addition, although various exemplary implementations and architectures have been described according to embodiments of the present disclosure, those of ordinary skill in the art will recognize that many other modifications to the exemplary implementations and architectures described herein are also within the scope of the present disclosure.

[0046] Some aspects of the present disclosure are described above with reference to the block diagram and flow chart of the system, method, system and / or computer program product according to the exemplary embodiments.It should be understood that the combination of one or more blocks in the block diagram and the flow chart and the blocks in the block diagram and the flow chart can be realized by executing computer executable program instructions respectively.Equally, according to some embodiments, some blocks in the block diagram and the flow chart may not need to be executed in the order shown, or may not need to be executed in full.In addition, additional components and / or operations beyond those components and / or operations shown in the blocks in the block diagram and the flow chart may be present in certain embodiments.

[0047] Therefore, the blocks in the block diagrams and flow charts support the combination of devices for performing the specified functions, the combination of elements or steps for performing the specified functions, and the program instruction devices for performing the specified functions. It should also be understood that each block in the block diagrams and flow charts and the combination of blocks in the block diagrams and flow charts can be implemented by a special-purpose hardware computer system or a combination of special-purpose hardware and computer instructions that performs a specific function, element or step.

[0048] The program modules, applications, etc. described herein may include one or more software components, including, for example, software objects, methods, data structures, etc. Each such software component may include computer-executable instructions that, in response to execution, cause at least a portion of the functionality described herein (e.g., one or more operations of the illustrative methods described herein) to be performed.

[0049] Software components can be encoded with any of various programming languages. An exemplary programming language can be a low-level programming language, such as an assembly language associated with a specific hardware architecture and / or an operating system platform. Software components comprising assembly language instructions may need to be converted to executable machine code by an assembler before being executed by hardware architecture and / or platform. Another exemplary programming language can be a higher-level programming language, which can be transplanted across multiple architectures. Software components comprising a higher-level programming language may need to be converted to an intermediate representation by an interpreter or a compiler before execution. Other examples of programming languages ​​include but are not limited to macro languages, shells or command languages, job control languages, scripting languages, database queries or search languages ​​or report writing languages. In one or more exemplary embodiments, a software component comprising the instructions of one of the above-mentioned programming language examples can be directly executed by an operating system or other software components, without first being converted into another form.

[0050] Software components may be stored as files or other data storage structures. Software components of similar type or related functions may be stored together, such as in a specific directory, folder, or library. Software components may be static (e.g., preset or fixed) or dynamic (e.g., created or modified at execution time).

[0051] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the relevant technical field without departing from the purpose of the present invention.

Claims

1. A method for generating real-time data ID of a distribution automation system, characterized in that: include: Set multiple tags, each of which has relevant information including a tag number, an expiration time, and a current ID, and save the relevant information in a real-time database; Start the ID generation service, read the corresponding expiration time in the order of the tag number, and detect the availability of the tag according to the expiration time; Specifically, read the relevant information of tag n from the Redis real-time database to detect whether tag n is available; The first tag is any one of the multiple tags. If the first tag is detected to be available, the current ID of the first tag is read, and the target ID is calculated according to the current ID of the first tag, and the target ID is written back to the real-time database as the current ID of the first tag; The ID generation service periodically updates the expiration time of the first mark, specifically comprising: the ID generation service updates the expiration time of the first mark stored in the real-time database at a first time interval, and adds a second time interval to the expiration time of the first mark; wherein the first time interval is less than the second time interval; Start detecting from tag n (n=1). If tag n is unavailable, increment n by 1. If tag n is available, use tag n as the service tag of this ID generation service and read the current ID in tag n. When a request is received to generate a target ID, generate the target ID according to the current ID and write the target ID back to the information area of ​​tag n in the Redis database. And update the expiration time of tag n in the Redis database regularly.

2. The real-time data ID generation method of the distribution automation system according to claim 1 is characterized in that: The method for detecting the availability of the tag according to the expiration time includes: The expiration time is read and the current time is obtained. If the expiration time is less than the current time, the tag is available.

3. The real-time data ID generation method of the distribution automation system according to claim 1, characterized in that: The current ID is of long type and has a length of 8 bytes; the highest byte of the current ID stores the record type information, and the second highest byte stores the corresponding tag number.

4. The method for generating real-time data ID of a distribution automation system according to claim 1, characterized in that: The step of calculating the target ID according to the current ID of the first tag includes: The current ID of the first tag is incremented by 1 to obtain the target ID.

5. The method for generating real-time data ID of a distribution automation system according to any one of claims 3 or 4, characterized in that: The current ID includes record type information, a tag number, and increment information.

6. The method for generating real-time data ID of a distribution automation system according to claim 1, characterized in that: The method further comprises: If it is detected that the first tag is unavailable, read the expiration time of the second tag and detect the availability of the second tag; wherein the tag number of the second tag is equal to the tag number of the first tag plus 1.

7. A real-time data ID generation system for a distribution automation system, characterized in that: The system comprises: A tag creation module is used to set multiple tags, and the relevant information of each tag includes a tag number, an expiration time and a current ID, and the relevant information is saved in a real-time database; An availability detection module is used to read the corresponding expiration time in the order of the tag number, and detect the availability of the tag according to the expiration time; specifically, read the relevant information of tag n from the Redis real-time database to detect whether tag n is available; a target ID generating module, configured to read the current ID of the first tag, calculate the target ID according to the current ID of the first tag, and write the target ID back to the real-time database as the current ID of the first tag; wherein the first tag is any one of the multiple tags, and the first tag is available; A timing update module is used to regularly update the expiration time of the first tag, specifically including: the ID generation service updates the expiration time of the first tag stored in the real-time database at a first time interval, and adds a second time interval to the expiration time of the first tag; wherein the first time interval is less than the second time interval; detection starts from tag n (n=1), if the tag n is unavailable, n is incremented by 1; if it is detected that tag n is available, the tag n is used as the service tag of this ID generation service, and the current ID in tag n is read; when a request to generate a target ID is received, after generating the target ID according to the current ID, the target ID is written back to the information area of ​​tag n in the Redis database; and the expiration time of tag n is regularly updated in the Redis database.

8. The real-time data ID generation system of the distribution automation system according to claim 7, characterized in that: The system further comprises: The current ID setting module is used to set the current ID to be long type with a length of 8 bytes, and configure the highest byte of the current ID to store record type information and the second highest byte to store the corresponding tag number.

9. A computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method according to any one of claims 1 to 6 when executed by a processor.