Real-time synchronization method and device for digital twins of transformer substation
1. A real-time synchronization method for a transformer substation digital twin is characterized by comprising the following steps:
step 1, a twin background of a transformer substation receives real-time detection data of measuring points of at least one transformer substation;
step 2, the transformer substation twin background sends the measuring point real-time detection data to a transformer substation web front end, so that the transformer substation web front end displays the measuring point real-time detection data in real time;
the transformer substation twin background is connected with the transformer substation web front end in a Websocket mode.
2. The method of claim 1,
the step 1 specifically comprises the following steps: the transformer substation twin background receives real-time detection data of measuring points of at least one transformer substation; cleaning the real-time detection data of the measuring points;
the step 2 specifically comprises the following steps: and the transformer substation twinning background sends the cleaned measuring point real-time detection data to the transformer substation web front end.
3. The method of claim 1, comprising:
the step 1 specifically comprises the following steps: the twin background of the transformer substation receives measuring point real-time detection data of at least one transformer substation and judges whether the measuring point real-time detection data is larger than a preset threshold value; if so, generating alarm information;
the step 2 specifically comprises the following steps: and the transformer substation twin background sends the warning information to a transformer substation web front end.
4. The method of claim 1, comprising:
the step 1 specifically comprises the following steps: the transformer substation twinning background receives measuring point real-time detection data of at least one transformer substation, processes the measuring point real-time detection data and generates real-time index detection data, and the real-time index detection data is used for generating real-time index detection data for comprehensive quantity characteristics of a power grid;
the step 2 specifically comprises the following steps: and the transformer substation twinning background sends the warning information and the real-time index detection data to a transformer substation web front end.
5. The method according to claim 1, wherein step 2 is specifically:
the transformer substation twin background is connected with a transformer substation Web front end through a webSocket, and real-time detection data of the measuring points are sent to the transformer substation Web front end in real time;
when the transmission is successful, the transmission result is put into a message queue;
and after the failure, starting a retry mechanism, and sending the real-time detection data of the measuring point to the Web front end of the transformer substation again.
6. The method of claim 1,
the websocket stores session connection of the websocket in a Redis mode, a clustering mode is achieved, and a thread pool is used for opening multiple threads to process simultaneously.
7. The method of claim 1, further comprising:
and the web front end of the transformer substation sends a request to the twin background of the transformer substation once at intervals, so that the WebSocket connection is prevented from being automatically disconnected due to no data transmission.
8. The method according to claim 1, characterized in that said step 2 is in particular:
the transformer substation twinning background sends the real-time detection data of the measuring points to a transformer substation web front end in a preset message format;
the predetermined message body format comprises a combination of one or more of:
the system comprises an api application program interface to be called and a web front end, wherein the api application program interface is used for indicating that a connection is established to acquire an api link address of data after the web front end of the transformer substation receives a message;
parameter params for indicating key of parameter required by message, value key value and value form;
a receiver sendTarget for indicating an address identification of a substation web front end,
a sending source sendSource for indicating a source of the message, the source of the message including: the method comprises the steps that an ip address of a sending end, a site id of a transformer substation, a device id of the transformer substation and real-time index detection data id of the transformer substation are sent;
the message content is used for indicating the message content, and the message content is a character string, a number or a json string.
A message type messageType for indicating a message type, the message type including: alarm messages, monitoring point real-time detection data, or real-time index detection data.
A creation time, which indicates a message creation time, a timestamp format.
9. The method of claim 8, further comprising:
the indication transformer substation web front end establishes connection with the api according to the api link address in the message to acquire data;
and the web front end of the instruction transformer substation displays the data obtained from the api link address.
10. A real-time synchronizer of transformer substation's digital twin, its characterized in that includes:
the connecting unit is used for connecting the twin background of the transformer substation with the web front end of the transformer substation in a Websocket mode;
the transformer substation twin background receives real-time detection data of measuring points of at least one transformer substation;
and the transformer substation twin background sends the measuring point real-time detection data to the transformer substation web front end, so that the transformer substation web front end displays the measuring point real-time detection data in real time.
Background
At present, the real-time synchronization of the digital twin Web application data of the transformer substation is realized by polling and pushing of other servers, and the polling and long polling technologies are most commonly used.
(1) With polling, the browser periodically sends HTTP requests and then accepts responses, which is the earliest Web real-time push scheme. The client sends requests to the server at certain time intervals, and the synchronization of the client and the server is maintained in a frequent request mode. The biggest problem of this synchronization scheme is that when the client makes a request to the server at a fixed frequency, the data at the server may not be updated, which results in many unnecessary network transmissions, so that it is a very inefficient real-time scheme.
(2) A long poll is when the browser sends a request to the server that the server is open for a period of time. The server, in the open state, sends a response to the client if it receives a request. Long polling creates a very large number of requests, and the effect of constant requests is that the data sequence cannot be guaranteed.
Disclosure of Invention
The embodiment of the invention provides a real-time synchronization method and a real-time synchronization device for a transformer substation digital twin, which can avoid meaningless network connection.
A real-time synchronization method for a transformer substation digital twin comprises the following steps:
step 1, a twin background of a transformer substation receives real-time detection data of measuring points of at least one transformer substation;
step 2, the transformer substation twin background sends the measuring point real-time detection data to a transformer substation web front end, so that the transformer substation web front end displays the measuring point real-time detection data in real time;
the transformer substation twin background is connected with the transformer substation web front end in a Websocket mode.
A real-time synchronization device of a substation digital twin, comprising:
the connecting unit is used for connecting the twin background of the transformer substation with the web front end of the transformer substation in a Websocket mode;
the transformer substation twin background receives real-time detection data of measuring points of at least one transformer substation;
and the transformer substation twin background sends the measuring point real-time detection data to the transformer substation web front end, so that the transformer substation web front end displays the measuring point real-time detection data in real time.
According to the technical scheme provided by the embodiment of the invention, the real-time message synchronization of the transformer substation is realized by adopting the Websocket, the millisecond-level data message synchronization is realized, and meaningless network connection is avoided.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
Fig. 1 is a schematic flow chart of a real-time synchronization method of a substation digital twin in an embodiment of the present invention;
FIG. 2 is a flow chart of a real-time message synchronization of a substation according to an embodiment of the present invention;
fig. 3 is a comparison between the network load in the WebSocket mode in the conventional polling and the embodiment of the present invention:
fig. 4 is a schematic architecture diagram of a real-time synchronization method for a digital twin of a substation according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a message body according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
For the convenience of understanding the embodiments of the present invention, the following description will be further explained by taking several specific embodiments as examples in conjunction with the drawings, and the embodiments are not to be construed as limiting the embodiments of the present invention.
As shown in fig. 1, the method for real-time synchronization of a digital twin of a substation according to the present invention includes:
step 1, a twin background of a transformer substation receives real-time detection data of measuring points of at least one transformer substation;
step 2, the transformer substation twin background sends the measuring point real-time detection data to a transformer substation web front end, so that the transformer substation web front end displays the measuring point real-time detection data in real time;
the transformer substation twin background is connected with the transformer substation web front end in a Websocket (full duplex communication protocol based on TCP).
Optionally, the method further includes:
and 3, sending a request to the twin background of the transformer substation once by the web front end of the transformer substation at intervals, so as to avoid the automatic disconnection of the Websocket connection due to no data transmission.
Optionally, step 1 specifically includes: the transformer substation twin background receives real-time detection data of measuring points of at least one transformer substation; cleaning the real-time detection data of the measuring points;
the step 2 specifically comprises the following steps: and the transformer substation twinning background sends the cleaned measuring point real-time detection data to the transformer substation web front end.
Optionally, step 1 specifically includes: the twin background of the transformer substation receives measuring point real-time detection data of at least one transformer substation and judges whether the measuring point real-time detection data is larger than a preset threshold value; if so, generating alarm information;
correspondingly, the step 2 specifically comprises the following steps: and the transformer substation twin background sends the warning information to a transformer substation web front end.
Optionally, step 1 specifically includes: the transformer substation twinning background receives measuring point real-time detection data of at least one transformer substation, processes the measuring point real-time detection data and generates real-time index detection data, wherein the real-time index detection data are comprehensive quantity characteristic data of a power grid; the processing comprises the following steps: and cleaning, format conversion, index calculation, alarm calculation and the like are carried out on the real-time detection data.
Correspondingly, the step 2 specifically comprises the following steps: and the transformer substation twinning background sends the warning information and the real-time index detection data to a transformer substation web front end.
Optionally, the step 2 specifically includes:
the transformer substation twin background is connected with a transformer substation Web front end through a webSocket, and real-time detection data of the measuring points are sent to the transformer substation Web front end in real time;
when the transmission is successful, the transmission result is put into a message queue;
and after the failure, starting a retry mechanism, and sending the real-time detection data of the measuring point to the Web front end of the transformer substation again.
Optionally, the websocket stores session connection of session (session control) of the websocket in a manner of Redis (remote dictionary service, an open source written in ANSI C language, supporting network, and being based on a log type or Key-Value database that can be used for memory or persistence), so as to implement a clustering manner, and open multiple threads for simultaneous processing by using a thread pool;
the step 2 specifically comprises the following steps:
the transformer substation twinning background sends the real-time detection data of the measuring points to a transformer substation web front end in a preset message format;
the predetermined message body format comprises a combination of one or more of:
the api to be called is used for indicating the web front end of the transformer substation to establish connection after receiving the message so as to acquire an api link address of the data;
parameter params for indicating key of parameter required by message, value key value and value form;
a receiver sendTarget for indicating an address identification of a substation web front end,
a sending source sendSource for indicating a source of the message, the source of the message including: the method comprises the steps that an ip address of a sending end, a site id of a transformer substation, a device id of the transformer substation and real-time index detection data id of the transformer substation are sent;
the message content is used for indicating the message content, and the message content is a character string, a number or a json string.
A message type messageType for indicating a message type, the message type including: alarm messages, monitoring point real-time detection data, or real-time index detection data.
A creation time, which indicates a message creation time, a timestamp format.
Optionally, the method further includes:
step 4, the web front end of the indicating transformer substation establishes connection with the api according to the api link address in the message to acquire data; the data includes: measuring point data, index data, or alarm data in real time.
And the web front end of the instruction transformer substation displays the data obtained from the api link address.
The following describes an application scenario of the present invention.
A real-time synchronization method for realizing transformer substation digital twins based on WebSocket can be used in the fields of transformer substation data real-time synchronization, informatization, digitization and intelligent operation and maintenance of power stations.
The method overcomes the defects of a real-time synchronous polling mode and a long polling mode of the transformer substation digital twin system information, and adopts the Websocket based on the native socket of the browser, so that the client browser has the real-time communication capability of a desktop system under a C/S framework, bidirectional communication between the browser and a server is supported, and the problem of real-time synchronization of detection data such as alarm, index, temperature and humidity of the transformer substation digital twin system is effectively solved.
Fig. 2 is a flow chart of real-time message synchronization of a substation in the embodiment of the present invention, and fig. 3 is a comparison between a conventional polling and a network load using a WebSocket method in the embodiment of the present invention: FIG. 4 is an architectural diagram of an embodiment of the present invention; fig. 5 is a schematic diagram of a message body according to an embodiment of the present invention. Described below in conjunction with the figures.
The method comprises the steps of firstly building a system environment, building a service environment based on webSocket, and deploying intelligent transformer substation digital twin service. Then, analyzing by an alarm system and an acquisition system to obtain alarm information or index detection information; then, the Web socket established by the message system and the Web is connected, and the warning message or the index detection information is sent; and then, the web end obtains the data information in real time through the webSocket connection and displays the data information on a page. The invention provides a webSocket-based real-time synchronization solution for power station data, and the alarm, index and detection unit data of a transformer substation can be synchronously displayed in real time.
The method comprises the following steps:
step 1, receiving a message by a twin background of a transformer substation; the method specifically comprises the following steps: and receiving the indexes of the transformer substation and the temperature and humidity measuring point data, and putting the data into a message queue. And preprocessing the message, cleaning the received message, and performing persistent storage.
Step 2, the twin background of the transformer substation sends a message to the web front end, and the message specifically comprises the following steps: the method comprises the steps that alarm index information is sent to a Web front end in real time through the connection established between a webSocket and the Web front end, and when the alarm index information is successful, a result is lost into a message queue; when the failure occurs, a retry mechanism is started, and the message is transmitted to the Web front end again.
The websocket realizes a cluster mode by storing session connection of the websocket in a Redis mode, simultaneously uses a thread pool to start a plurality of threads to process simultaneously, sets the configuration of a database to be local, such as 127.0.0.1, greatly shortens the time spent on processing one request, and shortens the previous tens of seconds to hundreds of milliseconds. Meanwhile, a heartbeat mechanism is added to maintain connection, and a self-defined request is sent to the server at intervals to avoid the WebSocket connection from being automatically disconnected due to no data transmission.
The invention has the following beneficial effects:
the invention realizes real-time message synchronization of the transformer substation by adopting WebSocket, perfectly realizes millisecond-level data message synchronization, and avoids meaningless network connection, redundant data transmission and a large amount of server overhead. The data transmission is low in consumption and high in energy efficiency.
The invention also provides a real-time synchronization device for the digital twin of the transformer substation, which comprises the following components:
the connecting unit is used for connecting the twin background of the transformer substation with the web front end of the transformer substation in a Websocket (full duplex communication protocol based on TCP);
the transformer substation twin background receives real-time detection data of measuring points of at least one transformer substation;
and the transformer substation twin background sends the measuring point real-time detection data to the transformer substation web front end, so that the transformer substation web front end displays the measuring point real-time detection data in real time.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.