Data transmission method and device based on private protocol, and medium
By using a custom private protocol and data sequence number mechanism, the reliability and efficiency issues of data transmission in the new energy centralized control system were resolved, enabling orderly and reliable data transmission under the positive isolation device, and adapting to the cross-security zone data interaction requirements of the new energy centralized control system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-26
- Publication Date
- 2026-04-21
AI Technical Summary
In new energy centralized control systems, existing technologies cannot achieve reliable and real-time data transmission under the unidirectional constraint of forward isolation devices. General protocols are ineffective and file transfer methods are inefficient, lacking adaptability and reliability.
It adopts a custom private protocol, encapsulates data through a forward message format and combines data sequence number and reverse response mechanism to ensure orderly and reliable data transmission in one-way transmission. It uses the comparison of data sequence number with expected sequence number to generate response packet, realizing orderly data reception and selective retransmission.
It breaks through the one-way communication limitation of the forward isolation device, realizes reliable data transmission, improves transmission efficiency, adapts to the cross-safety area data interaction needs of the new energy centralized control system, and takes into account both real-time performance and integrity.
Smart Images

Figure CN121907830A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology, specifically to data transmission methods, devices, and media based on proprietary protocols. Background Technology
[0002] New energy centralized control systems have become a core component of the stable operation of power systems. These systems require secure data transmission between the production control area and the management information area, necessitating physical isolation between the two areas via forward isolation devices. Traditional technologies either rely on the standard TCP / IP protocol for data transmission or employ file transfer methods for cross-area data interaction. However, under the unidirectional constraint of forward isolation devices, the bidirectional transmission and data verification mechanisms of the TCP / IP protocol become completely ineffective, making direct communication impossible. Furthermore, file transfer methods lack real-time and streaming processing capabilities, resulting in extremely low efficiency. Summary of the Invention
[0003] This application provides a data transmission method, device, and medium based on a proprietary protocol to solve the problems of poor adaptability, insufficient reliability, and low efficiency of traditional data transmission schemes.
[0004] Firstly, this application provides a data transmission method based on a proprietary protocol, applied to a new energy centralized control system. The new energy centralized control system includes a transmitter, a receiver, and a forward isolation device. The transmitter and the receiver establish a connection through the forward isolation device. The method includes: Obtain the custom private protocol, target data, and the data sequence number corresponding to the target data; the private protocol includes: forward message format and reverse message format; The sending end encapsulates the target data and the data sequence number according to the forward message format to obtain a data packet, and transmits the data packet to the receiving end through the forward isolation device; The receiving end parses the data packet according to the forward message format to obtain the target data and the data sequence number, compares the data sequence number with the expected sequence number to obtain a comparison result, converts the comparison result according to the reverse message format to obtain a response packet, and transmits the response packet to the sending end; the response packet is either a positive acknowledgment or a negative acknowledgment. The sending end determines whether to resend the data packet to the receiving end based on the response packet.
[0005] The method provided in this embodiment encapsulates and transmits target data and data sequence numbers in a forward message format using a custom private protocol. The receiving end, based on the comparison result between the data sequence number and the expected sequence number, sends a response packet in a reverse message format. The sending end decides whether to retransmit based on the response packet, thus constructing a complete transmission link adapted to unidirectional transmission scenarios. This successfully overcomes the unidirectional communication limitations of forward isolation devices, achieving reliable data transmission. The data sequence number and response mechanism ensure orderly data reception, avoiding loss or corruption. It eliminates the need for full retransmission, handling only abnormal data packets, improving transmission efficiency. It perfectly adapts to the data interaction needs of new energy centralized control systems across security zones, balancing real-time performance and integrity, and ensuring efficient flow of business data.
[0006] In one optional implementation, obtaining the target data and the data sequence number corresponding to the target data includes: Acquire the business data of the new energy centralized control system, and divide the business data into several target data; The initial value 0 is used as the data sequence number corresponding to the first target data. Each target data is numbered sequentially, and the data sequence number corresponding to each target data is increased by 1 based on the previous data sequence number. When the data sequence number is incremented to a preset value, the data sequence number corresponding to the next target data is reset to the initial value 0, until the data sequence numbers corresponding to all target data are obtained.
[0007] The method provided in this embodiment lays the foundation for orderly data transmission through reasonable business data fragmentation and cyclic data sequence number allocation. The business data volume of the new energy centralized control system is large and continuous; direct transmission easily exceeds the message carrying capacity limit. Fragmentation processing can adapt to the transmission unit size. Data sequence numbers start from 0 and increment, resetting cyclically after reaching a preset value. This ensures a unique identifier for each target data and avoids identification confusion caused by data sequence number overflow. Business data fragmentation reduces the transmission pressure of a single packet, improves transmission stability, and adapts to different bandwidth conditions. The cyclic sequence number mechanism reduces storage overhead, does not require a large amount of system resources, and supports long-term continuous transmission. Ordered numbering ensures that the receiving end can reassemble data according to the sequence number, avoiding data corruption and providing accurate identification basis for subsequent data sequence number comparison and selective retransmission. This ensures the orderliness and traceability of massive business data transmission and improves the reliability of the transmission link.
[0008] In one optional implementation, the positive message format sequentially includes: a protocol header and a protocol payload; the protocol header sequentially includes: a start code, a protocol extension field, and a protocol payload length field; the start code is used to identify the byte sequence at the beginning of the data packet; the protocol extension field includes a first byte and a second byte; the first byte is a data type identifier, which is used to distinguish the data type of the target data; the second byte is the data sequence number; the protocol payload length field is used to identify the length of the protocol payload; the protocol payload is set according to the data type of the target data, and the negative message format includes single-byte identifiers corresponding to positive and negative acknowledgments, respectively.
[0009] The method provided in this embodiment addresses the problem of insufficient adaptability of general protocols by clearly defining the specific formats of forward and reverse messages and constructing a dedicated transmission protocol adapted to various scenarios. In the forward message format, the start code clearly defines the data packet boundaries, facilitating parsing and identification by the receiving end. The data type identifier in the protocol extension field distinguishes different target data types, and the data sequence number is associated with the transmission status. The protocol payload length field ensures parsing accuracy, and the protocol payload adapts to data types as needed. The single-byte identifier in the reverse message adapts to the reverse transmission constraints of the forward isolation device. The protocol header fields have clearly defined functions, integrating data framing, type identification, and status association, reducing parsing complexity and error rate. The protocol payload adapts to multiple data types, improving scenario adaptability and compatibility with various business data in new energy centralized control systems. The single-byte reverse response simplifies transmission overhead, ensuring rapid feedback in scenarios with limited reverse transmission. The overall protocol design balances reliability, adaptability, and efficiency, providing stable and dedicated protocol support for transmission across forward isolation devices.
[0010] In one optional implementation, converting the comparison result according to the reverse message format to obtain a response packet includes: When the comparison result shows that the data sequence number and the expected sequence number are the same, a single-byte identifier corresponding to the positive response is generated as the response packet. Alternatively, if the comparison result shows that the data sequence number and the expected sequence number are different, a single-byte identifier corresponding to the negative response is generated as the response packet.
[0011] The method provided in this embodiment achieves accurate and efficient feedback of transmission status by directly mapping the sequence number comparison result to the single-byte response. The core verification requirement of the receiving end is to confirm that the data sequence number matches the expected sequence number. The single-byte identifier (positive response / negative response) adapts to the constraint that the forward isolation device only supports the reverse transmission of specific single-byte data, eliminating the need for complex format conversion and reducing feedback latency. Technical effects: The sequence number comparison result is directly associated with the response type, making the feedback logic simple and clear, reducing the processing time at the receiving end. The small size of the single-byte response and short transmission time improve feedback efficiency, providing timely support for the sending end to quickly decide on retransmissions. The clear response identifier avoids ambiguity in transmission status, reducing false or missed retransmissions. Adapting to the reverse transmission restrictions of the forward isolation device, it ensures feedback accuracy while meeting hardware constraints, providing crucial assurance for the reliability of the entire transmission link.
[0012] In one optional implementation, the sending end determines whether to retransmit the data packet to the receiving end based on the response packet, including: When the sending end transmits the data packet to the receiving end through the forward isolation device, a response packet timer is started. If a response packet transmitted by the receiving end is received within a preset time period and the response packet is an affirmative acknowledgment, it is determined not to resend the data packet to the receiving end. If no response packet is received from the receiving end within the preset time period, or if the received response packet is a negative response, the data packet is retransmitted to the receiving end.
[0013] The method provided in this embodiment uses a retransmission mechanism combining timers and response packets to accurately handle transmission anomalies and ensure reliable data transmission. During forward isolation device transmission, data loss or delay may occur due to network fluctuations. The response packet timer prevents the sender from waiting indefinitely and clearly defines the timeout judgment criteria. Combined with the response packet type (positive acknowledgment / negative acknowledgment), retransmission is triggered only when no response is received after timeout or when a negative acknowledgment is received, avoiding invalid retransmissions. Technical effects: The timer mechanism controls the waiting time, avoiding system resource occupation and improving transmission efficiency. The precise retransmission strategy reduces invalid bandwidth consumption, ensures timely retransmission of abnormal data, reduces the risk of data loss, meets the real-time data requirements of new energy centralized control systems, quickly recovers from abnormal transmissions, and ensures continuous business data flow. The retransmission decision logic is rigorous, balancing reliability and efficiency, and improving the stability of transmission links in complex network environments.
[0014] In an optional implementation, before obtaining the custom private protocol, the target data, and the data sequence number corresponding to the target data, the method further includes: The connection between the transmitting end and the receiving end is established through the positive isolation device; Initialize the data sequence number by setting it to an initial value of 0; Set the response packet timer; Create a data packet queue; the data packet queue is used to store the data packets.
[0015] The method provided in this embodiment standardizes preconditions and ensures orderly transmission by establishing a connection, initializing sequence numbers, setting timers, and creating a data packet queue before transmission. Before transmission, a communication connection must be established through a forward isolation device to ensure reachability between the sender and receiver. Data sequence numbers are initialized to 0 to ensure consistency in sequence number benchmarks between the sender and receiver. A response packet timer provides a clear standard for subsequent timeout judgment. The data packet queue is used to orderly store encapsulated data packets, avoiding transmission chaos. Establishing a connection in advance avoids link interruptions during transmission, improving transmission continuity. A unified initial sequence number value reduces sequence number comparison errors and ensures verification accuracy; response packet timer parameters ensure consistent timeout judgment standards, avoiding decision-making confusion. The data packet queue enables centralized management and orderly scheduling of data packets, preventing out-of-order transmission. This entire preparation process standardizes preconditions for transmission, reduces abnormal trigger points, and lays a solid foundation for the orderly and reliable transmission of subsequent data.
[0016] In one alternative implementation, after determining that the data packet will not be retransmitted to the receiving end, the method further includes: deleting the data packet from the data packet queue, and the sending end using a first-in-first-out (FIFO) strategy to transmit the next data packet of the data packet to the receiving end via the forward isolation device.
[0017] The method provided in this embodiment improves transmission efficiency and resource utilization by optimizing the dynamic management of data packet queues. Data packets that are confirmed not to be retransmitted will occupy storage resources in the queue and will be deleted in a timely manner to free up space. A first-in, first-out (FIFO) strategy is adopted to send the next data packet, which conforms to the transmission logic of increasing data sequence number and ensures that the transmission order is consistent with the encapsulation order. Deleting invalid data packets reduces the queue storage pressure, improves the queue operating efficiency, and is suitable for long-term continuous transmission scenarios. The FIFO strategy ensures that data is transmitted in order, avoids reassembly errors at the receiving end, ensures data integrity, and timely schedules the next data packet, reducing transmission gaps and improving the overall transmission rate. The dynamic queue management takes into account both storage optimization and transmission orderliness, providing support for the efficient transmission of massive amounts of data and further improving the real-time performance and smoothness of data transmission in the new energy centralized control system.
[0018] In one alternative implementation, after obtaining the data packet, the method further includes storing the data packet at the tail of the data packet queue using a first-in-first-out (FIFO) strategy.
[0019] The method provided in this embodiment ensures the orderliness and schedulability of data packet transmission through a first-in-first-out (FIFO) queue storage strategy. The business data of the new energy centralized control system is continuous and needs to be transmitted in the order of its generation. The FIFO strategy ensures that the data packet storage order is consistent with the encapsulation order, and the tail-end storage method avoids disrupting the arrangement of already stored data packets, ensuring scheduling order. Ordered storage ensures that the data packet transmission order is consistent with the encapsulation order, providing a guarantee for the receiving end to reassemble the data according to its sequence number and avoiding data corruption. The queue structure enables centralized management of data packets, facilitating sequential scheduling by the sending end and improving transmission scheduling efficiency. Adding storage at the tail end does not affect the existing data arrangement order, ensuring the stability of queue operation. It adapts to multi-packet continuous transmission scenarios, providing an orderly basis for subsequent deletion and scheduling operations, reducing disorder during transmission, and improving the reliability and smoothness of the overall transmission link.
[0020] Secondly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the data transmission method based on a proprietary protocol as described in the first aspect or any corresponding embodiment.
[0021] Thirdly, this application provides a computer-readable storage medium storing computer instructions for causing a computer to execute the data transmission method based on a proprietary protocol as described in the first aspect or any corresponding embodiment thereof. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this application; Figure 2 This is a flowchart illustrating a data transmission method based on a proprietary protocol according to an embodiment of this application. Figure 3 This is a schematic diagram of the forward message format according to an embodiment of this application; Figure 4 This is a schematic diagram of the protocol payload corresponding to the file type according to the embodiments of this application; Figure 5 This is a schematic diagram of the reverse message format according to an embodiment of this application; Figure 6This is a schematic diagram showing the location of the proprietary protocol in the TCP / IP protocol stack according to an embodiment of this application; Figure 7 This is a schematic diagram illustrating the deployment and interaction of the sending end and receiving end according to an embodiment of this application; Figure 8 This is a schematic diagram illustrating a data packet example according to an embodiment of this application; Figure 9 This is a schematic diagram illustrating an example of a response packet according to an embodiment of this application; Figure 10 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0026] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0027] As one optional application scenario in the embodiments of this application, such as Figure 1 As shown, the new energy centralized control system may include at least one terminal device and at least one server. Figure 1 The system is illustrated in the example, which includes a computer 101, a mobile terminal 102, and a server 103, and the terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.
[0028] The terminal device can be a smartphone, tablet, laptop, PDA, or desktop computer. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranets, local area networks, wide area networks, mobile communication networks, and combinations thereof.
[0029] The power monitoring system is a general monitoring system covering the entire power industry. According to the safety protection regulations for power monitoring systems, it is divided into the production control area (including safety area I and area II) and the management information area.
[0030] The new energy centralized control system is specifically responsible for monitoring the equipment status, collecting data, and transmitting data across regions at new energy power plants. Its data transmission requirements strictly comply with the safety protection specifications of power monitoring systems, and data interaction across positive isolation devices must be achieved between the production control area and the management information area.
[0031] The production control area and the management information area must be physically isolated using a forward isolation device. This device typically only allows unidirectional TCP / IP data flow from the production control area to the management information area, and only a very small amount of data to be transmitted in the reverse direction. The new energy centralized control system needs to transmit a large amount of real-time monitoring data from the production control area to the management information area. Existing forward isolation device communication technology has the following significant drawbacks: (1) Failure of general protocol data transmission mechanism: Under the constraint of only one-way transmission of the forward isolation device, the working mechanism of bidirectional data transmission, data verification, flow control and other functions of the TCP / IP protocol are completely ineffective, which makes it impossible for applications based on the standard TCP / IP protocol stack to directly communicate data.
[0032] (2) Existing data transmission schemes are inefficient: In the context of forward isolated communication networks, the current mainstream method is file transfer, which is a non-real-time one-way file transfer. It lacks streaming processing and real-time performance, and the transmission is unstable when the network fluctuates. In some cases, the entire file needs to be retransmitted after the interruption, resulting in extremely low efficiency.
[0033] (3) Lack of systematic solutions: There is a lack of a complete technical solution that integrates reliability, efficiency and ease of use, specifically designed for cross-regional transmission of massive real-time data in new energy centralized control, from the protocol layer to the application layer.
[0034] According to an embodiment of this application, a data transmission method based on a proprietary protocol is provided to solve the above-mentioned problems. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0035] This embodiment provides a data transmission method based on a proprietary protocol. This method is applied to a new energy centralized control system, which includes a transmitter, a receiver, and a forward isolation device. The transmitter and receiver establish a connection through the forward isolation device. Figure 2 This is a flowchart of a data transmission method based on a proprietary protocol according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps: Step S201: Obtain the custom private protocol, target data, and the data sequence number corresponding to the target data.
[0036] In this application embodiment, the private protocol includes a forward message format and a reverse message format. The private protocol is a custom application layer protocol based on the TCP / IP protocol stack. This application creatively designs a reliable data transmission mechanism for sending and responding on a unidirectional channel by utilizing the mechanism that the forward isolation device can transmit specific single-byte data in reverse, thereby realizing reliable, large-volume, and real-time data transmission across forward isolation devices (from the production control area to the management information area).
[0037] In this embodiment, the sending end is deployed in the production control area, where the massive real-time monitoring data and files of the new energy centralized control system are generated. The receiving end is deployed in the management information area and serves as the data receiving and processing terminal.
[0038] The target data refers to the business data generated by the production control area and transmitted to the receiving end of the management information area from the new energy centralized control system. Specifically, it can include real-time data streams or files based on the IEC104 protocol or the MODBUS protocol. This data consists of massive amounts of real-time monitoring data and related file resources generated during the operation of the new energy centralized control system, and is the core business data transmitted across forward isolation devices. As an example, the target data could be real-time monitoring data such as photovoltaic panel output, wind turbine speed, energy storage battery SOC, and inverter operating parameters uploaded from the production control area to the management information area. As another example, the target data could be an IEC104 protocol binary byte stream (identified by 0x01), conforming to the power industry's real-time data transmission standard format, or a MODBUS protocol UTF-8 encoded byte stream (identified by 0x02), adapted to the communication protocols of some distributed new energy devices. The management information area needs to aggregate non-real-time but critical data such as daily power generation statistics, equipment operation logs, and fault alarm records. At this time, the target data is a file fragment identified by 0x03, such as Excel format power generation reports, TXT format equipment log files, and WPD format operation and maintenance analysis reports transmitted in segments.
[0039] The sequence number is a unique identifier assigned by the sender to each target data item to distinguish between different target data items. Its initial value is 0, and it increments by 1 each time a target data item is encapsulated. As an example, the sequence number is reset to 0 when it reaches 255 and is used cyclically. This sequence number is filled into the second byte of the protocol extension field in the forward message format, serving as a crucial basis for the receiver to verify the data reception order and determine whether data is missing or corrupted.
[0040] In the embodiments of this application, such as Figure 3 As shown, the forward message format includes, in sequence, a protocol header and a protocol payload. The protocol header includes, in sequence, a start code, a protocol extension field, and a protocol payload length field. The protocol header is 6 bytes long.
[0041] The start code is used to identify the byte sequence at the beginning of a data packet. As an example, the start code can occupy 2 bytes, fixed at 0x5A4B, corresponding to the ASCII code "ZK".
[0042] The protocol extension field occupies 2 bytes, including the first and second bytes. The first byte is the data type identifier, used to distinguish the data type of the target data. The second byte is the data sequence number. The data type of the target data includes IEC104 protocol data type, MODBUS protocol data type, and file type. As an example, 0x01 corresponds to IEC104 protocol data type, 0x02 corresponds to MODBUS protocol data type, and 0x03 corresponds to file type. The data sequence number ranges from 0 to 255, starting from 0 and incrementing by 1 with each subsequent data packet. When the maximum value is reached, it is reset to start from 0 again.
[0043] The protocol payload length field is used to identify the length of the protocol payload. The protocol payload length field occupies 2 bytes.
[0044] The protocol payload is set according to the data type of the target data. The protocol payload is filled with the format corresponding to the data type identifier. If it is an IEC104 protocol data type, the protocol payload is a binary byte stream. If it is a MODBUS protocol data type, the protocol payload is a UTF-8 encoded byte stream. If it is a file type, such as... Figure 4 As shown, the protocol payload includes, in sequence, the payload header length, the payload content length, the payload content, and the CRC32 checksum. The payload header includes a version number field, a channel number field, a file fragment sequence number field, and a file relative path field.
[0045] The payload header length occupies 2 bytes and is used to store the length information of the payload header.
[0046] The payload header has a variable length and mainly stores file-related information. Specifically, it includes a 4-byte integer version number field, a 4-byte integer channel number field, a 4-byte integer file segment sequence number field, and a variable-length string-type file relative path field.
[0047] The version number field identifies the version of the proprietary protocol payload header format followed by the file transfer, ensuring that the sender and receiver have consistent rules for parsing the payload header fields. It can be generated using a default value, fixed as a 4-byte integer 1, requiring no additional configuration or calculation; it can be directly filled into the corresponding field of the payload header.
[0048] The channel number field identifies the designated file transfer channel and maps the root directory for file storage or retrieval, enabling categorized management of files of different types or origins. This field can be manually configured by the user on both the sending and receiving ends, and both sides must maintain consistent configurations. After configuration, the channel number is converted to a 4-byte integer and stored in the corresponding field of the payload header as the root directory identifier for file reading and writing.
[0049] The file fragment sequence number field is used to identify the sequential numbering of file fragments. This is used by the receiving end to reassemble the file and, in conjunction with the receiving end's continuity verification, ensures that file fragments are not missing or disordered. A negative acknowledgment is sent when a discontinuous file fragment number is detected. For example, after reading the file, the sending end fragments the file according to the message length limit, assigning a sequence number to each fragment sequentially, starting from 1 or 0 and incrementing. This file fragment sequence number is consistent with the data sequence number in the private protocol's forward message format, and is converted to a 4-byte integer before being filled into the corresponding field in the payload header.
[0050] The file relative path field refers to the path information of a file relative to the root directory mapped to the channel number. This information is used by the receiving end to accurately identify the file's storage location and hierarchical relationship. For example, the user configures this on the sending end, filling in the file's path relative to the channel's root directory, which is then stored as a variable-length string in the corresponding field of the payload header.
[0051] After all payload header fields are determined according to the above rules, they are first converted into strings via JSON, and then further serialized into a UTF-8 encoded byte stream.
[0052] The payload length occupies 2 bytes and is used to store the length information of the payload content. The payload content is mainly used to store file fragments. The CRC32 checksum mainly stores the checksum. The CRC32 algorithm is used to calculate the payload header length, payload header, payload length, and payload content, and the calculation result is filled into the end of the protocol payload.
[0053] In this embodiment of the application, the negative message format includes single-byte identifiers corresponding to positive and negative responses, respectively. As an example, such as... Figure 5 As shown, the single-byte identifier for a positive response can be 0x00. The single-byte identifier for a negative response can be 0xFF.
[0054] The method provided in this embodiment addresses the problem of insufficient adaptability of general protocols by clearly defining the specific formats of forward and reverse messages and constructing a dedicated transmission protocol adapted to various scenarios. In the forward message format, the start code clearly defines the data packet boundaries, facilitating parsing and identification by the receiving end. The data type identifier in the protocol extension field distinguishes different target data types, and the data sequence number is associated with the transmission status. The protocol payload length field ensures parsing accuracy, and the protocol payload adapts to data types as needed. The single-byte identifier in the reverse message adapts to the reverse transmission constraints of the forward isolation device. The protocol header fields have clearly defined functions, integrating data framing, type identification, and status association, reducing parsing complexity and error rate. The protocol payload adapts to multiple data types, improving scenario adaptability and compatibility with various business data in new energy centralized control systems. The single-byte reverse response simplifies transmission overhead, ensuring rapid feedback in scenarios with limited reverse transmission. The overall protocol design balances reliability, adaptability, and efficiency, providing stable and dedicated protocol support for transmission across forward isolation devices.
[0055] Step S202: The sending end encapsulates the target data and data sequence number according to the forward message format to obtain the data packet, and transmits the data packet to the receiving end through the forward isolation device.
[0056] Step S203: The receiving end parses the data packet according to the forward message format to obtain the target data and data sequence number, compares whether the data sequence number and the expected sequence number are the same, obtains the comparison result, converts the comparison result according to the reverse message format to obtain the response packet, and transmits the response packet to the sending end.
[0057] In this embodiment, the response packet is either a positive response or a negative response. The response packet is a single-byte identifier. The comparison result includes whether the data sequence number and the expected sequence number are the same or different. A response packet corresponding to the data sequence number and the expected sequence number being the same is a positive response. A response packet corresponding to the data sequence number and the expected sequence number being different is a negative response.
[0058] In this embodiment of the application, the parsed target data will directly serve the core business needs of the new energy centralized control system. As an example, its subsequent uses may include: It enables real-time monitoring and situational awareness. For example, after the real-time data stream of the IEC104 / MODBUS protocol is parsed at the receiving end, it will be synchronized to the monitoring screen and SCADA (Supervisory Control and Data Acquisition) system in the management information area, allowing maintenance personnel to keep abreast of the operating status of the new energy power plant equipment and promptly detect anomalies (such as power drops or voltage exceedances). It also enables data storage and historical tracing. For instance, real-time data streams are stored in a time-series database, and file fragments are assembled into complete files based on the metadata in the load header and stored on a file server to form a historical database for subsequent power generation calculations, equipment lifespan analysis, and fault tracing. Furthermore, it enables equipment maintenance and fault early warning. By analyzing equipment operating parameters in the target data (such as wind turbine bearing temperature and inverter fault codes), fault early warning (such as predicting component aging) can be achieved, providing maintenance personnel with accurate maintenance basis and reducing downtime losses. In addition, it can also be used for business decision-making and intelligent scheduling, compliance auditing, and data reporting.
[0059] Encapsulation is the process by which the sending end integrates the target data and data sequence number into a standardized data packet according to the forward message format. Parsing is the process by which the receiving end, after receiving the data packet transmitted across the forward isolation device, reverse-engineers the forward message format, deconstructs and verifies it, extracts the target data, and verifies the data validity. The core purpose is to restore the data and ensure the integrity and correctness of the transmission.
[0060] In this application, the forward message format constructed based on this application can be encapsulated and parsed using conventional methods in the art. For example, the specific encapsulation method can be as follows: Determine the data type identifier: Set the first byte of the protocol extension field according to the data type of the target data. Assign a data sequence number: Obtain the current sequence number (0~255, cyclically incrementing) from the data packet sequence number module and fill it into the second byte of the protocol extension field. Construct the protocol header: Combine a 6-byte protocol header, including a fixed start code 0x5A4B (ASCII code for 'ZK'), the aforementioned protocol extension field, and a payload total length field containing the protocol header. Process the payload data: Adapt the data according to the data type (e.g., convert MODBUS protocol data to a UTF-8 encoded byte stream, add structured information such as payload header, payload length, and CRC32 checksum after file data fragmentation). Integrate the data packets: Concatenate the protocol header with the processed payload data to form a complete private protocol data packet, ensuring that it meets the transmission requirements of the TCP / IP transport layer, and finally pass it to the transport layer through the Netty library.
[0061] Step S204: The sending end determines whether to resend the data packet to the receiving end based on the response packet.
[0062] The timing begins when the data packet is transmitted from the sending end to the receiving end via the forward isolation device. If a response packet is received from the receiving end within a preset time period and the response packet is an affirmative acknowledgment, it is determined not to resend the data packet to the receiving end.
[0063] If no response packet is received from the receiver within the preset time period, or if the received response packet is a negative acknowledgment, the data packet will be resent to the receiver.
[0064] In this embodiment, the preset time period can be set and modified according to actual needs. For example, the preset time period can be 3 seconds. For example, a maximum number of retransmissions of a unified data packet can be set. For example, the maximum number of retransmissions can be set to 3. That is, when a data packet is sent to the receiving end for the first time, the retransmission count is set to 0. When the data packet is retransmitted to the receiving end, the retransmission count is updated by 1. After the retransmission count reaches three times, that is, after the fourth data packet is sent to the receiving end, if no response packet is received from the receiving end within the preset time period, or if the received response packet is a negative acknowledgment, the connection between the sending end and the receiving end is disconnected.
[0065] The method provided in this embodiment encapsulates and transmits target data and data sequence numbers in a forward message format using a custom private protocol. The receiving end, based on the comparison result between the data sequence number and the expected sequence number, sends a response packet in a reverse message format. The sending end decides whether to retransmit based on the response packet, thus constructing a complete transmission link adapted to unidirectional transmission scenarios. This successfully overcomes the unidirectional communication limitations of forward isolation devices, achieving reliable data transmission. The data sequence number and response mechanism ensure orderly data reception, avoiding loss or corruption. It eliminates the need for full retransmission, handling only abnormal data packets, improving transmission efficiency. It perfectly adapts to the data interaction needs of new energy centralized control systems across security zones, balancing real-time performance and integrity, and ensuring efficient flow of business data.
[0066] The location of proprietary protocols in the TCP / IP protocol stack is as follows: Figure 6 As shown. The main contents of this private protocol include: a private protocol message format definition description file, a protocol initialization module, a data sequence number module, a response packet timer module, a data packet queue module, a data packet sending module, and a data packet receiving module. The private protocol message format definition description file includes forward message format and reverse message format.
[0067] The sending end establishes a private protocol instance and initializes the runtime environment through the protocol initialization module, stores data packets through the data packet queue module, and transmits the data packets to the receiving end via the forward isolation device through the data packet sending module. The receiving end receives data packets through the data packet receiving module, parses the data packets according to the forward message format to obtain the target data and data sequence number, compares the data sequence number with the expected sequence number through the data sequence number module, obtains the comparison result, converts the comparison result into a response packet according to the reverse message format, and transmits the response packet to the sending end. The sending end monitors the timeliness of the response packet reception through the response packet timer module, and determines whether to retransmit the data packet through the data packet sending module based on the response packet and the timer timeout result. For example, if the same data packet is retransmitted three times without receiving a positive response, the connection between the sending and receiving ends is disconnected.
[0068] In one optional implementation, obtaining the target data and the corresponding data sequence number includes: Acquire business data from the new energy centralized control system and divide the business data into several target data.
[0069] The initial value 0 is used as the data sequence number corresponding to the first target data. Each target data is numbered sequentially, and the data sequence number corresponding to each target data is increased by 1 based on the previous data sequence number.
[0070] When the data sequence number is incremented to the preset value, the data sequence number corresponding to the next target data is reset to the initial value of 0, until the data sequence numbers corresponding to all target data are obtained.
[0071] In this embodiment, as an example, the preset value can be set and modified according to actual needs, and can be 255. In this embodiment, at the sending end, the data sequence number module is used to maintain the data sequence number, with an initial value of 0. When the application encapsulates the target data, it obtains the data sequence number A from the data sequence number module, sets the data sequence number A into the byte in the data packet used to store the data sequence number, and increments it by 1. Then, it is determined whether the incremented data sequence number A+1 is greater than the preset value 255. If it is, the data sequence number A is reset to 0. If it is less than or equal to the preset value 255, the data sequence number A remains unchanged.
[0072] The method provided in this embodiment lays the foundation for orderly data transmission through reasonable business data fragmentation and cyclic data sequence number allocation. The business data volume of the new energy centralized control system is large and continuous; direct transmission easily exceeds the message carrying capacity limit. Fragmentation processing can adapt to the transmission unit size. Data sequence numbers start from 0 and increment, resetting cyclically after reaching a preset value. This ensures a unique identifier for each target data and avoids identification confusion caused by data sequence number overflow. Business data fragmentation reduces the transmission pressure of a single packet, improves transmission stability, and adapts to different bandwidth conditions. The cyclic sequence number mechanism reduces storage overhead, does not require a large amount of system resources, and supports long-term continuous transmission. Ordered numbering ensures that the receiving end can reassemble data according to the sequence number, avoiding data corruption and providing accurate identification basis for subsequent data sequence number comparison and selective retransmission. This ensures the orderliness and traceability of massive business data transmission and improves the reliability of the transmission link.
[0073] In one optional implementation, the comparison result is converted according to the reverse message format to obtain a response packet including: If the comparison result shows that the data sequence number and the expected sequence number are the same, a single-byte identifier corresponding to the positive response is generated as a response packet.
[0074] Alternatively, if the comparison result shows that the data sequence number and the expected sequence number are different, a single-byte identifier corresponding to the negative response is generated as a response packet.
[0075] In this embodiment, the data packet sequence number module at the receiving end maintains the expected sequence number, which is initially set to 0. After the application receives the data packet, it parses it according to the forward message format to obtain the data sequence number in the data packet and compares it with the expected sequence number. If they are the same, it indicates that the data packet reception is normal, and the data packet sending module is notified to send a positive acknowledgment response packet. If they are different, it indicates that the data packet reception is abnormal, and the data packet sending module is notified to send a negative acknowledgment response packet. If the data packet reception is normal, the expected sequence number is incremented by 1. It is then determined whether the expected sequence number is greater than a preset value of 255. If the expected sequence number is greater than the preset value of 255, the expected sequence number is reset to 0. If the expected sequence number is less than or equal to the preset value of 255, the expected sequence number is updated to the value after incrementing by 1.
[0076] The method provided in this embodiment achieves accurate and efficient feedback of transmission status by directly mapping the sequence number comparison result to the single-byte response. The core verification requirement of the receiving end is to confirm that the data sequence number matches the expected sequence number. The single-byte identifier (positive response / negative response) adapts to the constraint that the forward isolation device only supports the reverse transmission of specific single-byte data, eliminating the need for complex format conversion and reducing feedback latency. Technical effects: The sequence number comparison result is directly associated with the response type, making the feedback logic simple and clear, reducing the processing time at the receiving end. The small size of the single-byte response and short transmission time improve feedback efficiency, providing timely support for the sending end to quickly decide on retransmissions. The clear response identifier avoids ambiguity in transmission status, reducing false or missed retransmissions. Adapting to the reverse transmission restrictions of the forward isolation device, it ensures feedback accuracy while meeting hardware constraints, providing crucial assurance for the reliability of the entire transmission link.
[0077] In one optional implementation, the sender determines whether to retransmit the data packet to the receiver based on the response packet, including: When the sending end transmits the data packet to the receiving end through the forward isolation device, a response packet timer is started. If a response packet transmitted by the receiving end is received within a preset time period and the response packet is an affirmative acknowledgment, it is determined not to resend the data packet to the receiving end.
[0078] If no response packet is received from the receiver within the preset time period, or if the received response packet is a negative acknowledgment, the data packet will be resent to the receiver.
[0079] In this embodiment, the response packet timer module at the sending end starts the response packet timer after the data packet sending module sends the data packet. If the data packet receiving module does not receive a response packet within a preset time period of 3 seconds, it notifies the data packet sending module to retransmit the currently unacknowledged data packet. If the data packet receiving module receives a response packet within 3 seconds, it notifies the data packet sending module to delete the data packet from the data packet queue and send the next data packet.
[0080] The packet sending module reads the first packet from the packet queue and calls the Netty library's write method to pass the packet to the transport layer, where the TCP / IP standard transport layer functions complete the data sending.
[0081] The data packet receiving module obtains response packets from the transport layer in real time, parses them according to the reverse message format, and performs the parsing.
[0082] The method provided in this embodiment uses a retransmission mechanism combining timers and response packets to accurately handle transmission anomalies and ensure reliable data transmission. During forward isolation device transmission, data loss or delay may occur due to network fluctuations. The response packet timer prevents the sender from waiting indefinitely and clearly defines the timeout judgment criteria. Combined with the response packet type (positive acknowledgment / negative acknowledgment), retransmission is triggered only when no response is received after timeout or when a negative acknowledgment is received, avoiding invalid retransmissions. Technical effects: The timer mechanism controls the waiting time, avoiding system resource consumption and improving transmission efficiency. The precise retransmission strategy reduces invalid bandwidth consumption, ensures timely retransmission of abnormal data, reduces the risk of data loss, meets the real-time data requirements of new energy centralized control systems, quickly recovers from abnormal transmissions, and ensures continuous business data flow. The retransmission decision logic is rigorous, balancing reliability and efficiency, and improving the stability of transmission links in complex network environments.
[0083] In an optional implementation, before obtaining the custom private protocol, the target data, and the data sequence number corresponding to the target data, the method further includes: A connection between the transmitter and receiver is established using a forward isolation device.
[0084] Initialize the data sequence number by setting it to the initial value of 0.
[0085] Set a response packet timer.
[0086] Create a packet queue. The packet queue is used to store packets.
[0087] In this embodiment, the main function of the protocol initialization module of the sending end is to establish a private protocol instance, prepare the runtime environment, initialize the data sequence number with an initial value of 0, initialize the response packet timer, and create a data packet queue for storing data packets to be sent.
[0088] The method provided in this embodiment standardizes preconditions and ensures orderly transmission by establishing a connection, initializing sequence numbers, setting timers, and creating a data packet queue before transmission. Before transmission, a communication connection must be established through a forward isolation device to ensure reachability between the sender and receiver. Data sequence numbers are initialized to 0 to ensure consistency in sequence number benchmarks between the sender and receiver. A response packet timer provides a clear standard for subsequent timeout judgment. The data packet queue is used to orderly store encapsulated data packets, avoiding transmission chaos. Establishing a connection in advance avoids link interruptions during transmission, improving transmission continuity. A unified initial sequence number value reduces sequence number comparison errors and ensures verification accuracy. Response packet timer parameters ensure consistent timeout judgment standards, avoiding decision-making confusion. The data packet queue enables centralized management and orderly scheduling of data packets, preventing out-of-order transmission. This entire preparation process standardizes preconditions for transmission, reduces abnormal trigger points, and lays a solid foundation for the orderly and reliable transmission of subsequent data.
[0089] In one alternative implementation, after determining that the data packet will not be retransmitted to the receiving end, the method further includes: deleting the data packet from the data packet queue, and the sending end using a first-in-first-out strategy to transmit the next data packet to the receiving end via a forward isolation device.
[0090] The method provided in this embodiment improves transmission efficiency and resource utilization by optimizing the dynamic management of data packet queues. Data packets that are confirmed not to be retransmitted will occupy storage resources in the queue and will be deleted in a timely manner to free up space. A first-in, first-out (FIFO) strategy is adopted to send the next data packet, which conforms to the transmission logic of increasing data sequence number and ensures that the transmission order is consistent with the encapsulation order. Deleting invalid data packets reduces the queue storage pressure, improves the queue operating efficiency, and is suitable for long-term continuous transmission scenarios. The FIFO strategy ensures that data is transmitted in order, avoids reassembly errors at the receiving end, ensures data integrity, and timely schedules the next data packet, reducing transmission gaps and improving the overall transmission rate. The dynamic queue management takes into account both storage optimization and transmission orderliness, providing support for the efficient transmission of massive amounts of data and further improving the real-time performance and smoothness of data transmission in the new energy centralized control system.
[0091] In one alternative implementation, after receiving the data packet, the method further includes storing the data packet at the tail of the data packet queue using a first-in-first-out (FIFO) strategy.
[0092] In this embodiment, the data packet queue module of the sending end maintains a data packet queue, which is a linked list and adopts a first-in-first-out (FIFO) method, and has the functions of adding, deleting, and reading data packets.
[0093] The method provided in this embodiment ensures the orderliness and schedulability of data packet transmission through a first-in, first-out (FIFO) queue storage strategy. The business data of the new energy centralized control system is continuous and needs to be transmitted in the order of its generation. The FIFO strategy ensures that the data packet storage order is consistent with the encapsulation order, and the tail-end storage method avoids disrupting the arrangement of already stored data packets, ensuring scheduling order. Ordered storage ensures that the data packet transmission order is consistent with the encapsulation order, providing a guarantee for the receiving end to reassemble the data according to its sequence number and avoiding data corruption. The queue structure enables centralized management of data packets, facilitating sequential scheduling by the sending end and improving transmission scheduling efficiency. Adding storage at the tail end does not affect the existing data arrangement order, ensuring the stability of queue operation. It adapts to multi-packet continuous transmission scenarios, providing an orderly foundation for subsequent deletion and scheduling operations, reducing order chaos during transmission, and improving the reliability and smoothness of the overall transmission link.
[0094] In this application, the private protocol data transmission mechanism is as follows: the data sending end is deployed in the security control zone, and the receiving end is deployed in the management information zone. The sending end initiates a connection through the Netty framework's connect channel method, and the receiving end accepts the connection on the specified port. The sending end encapsulates the target data using the private protocol's forward message format, generating an application-layer data packet, which is then transmitted to the receiving end via TCP / IP. After receiving the data packet, the receiving end parses it at the application layer according to the private protocol's forward message format, performs checksum verification and data sequence number comparison, and generates a response packet according to the reverse message format based on the data sequence number comparison result, which is then transmitted to the sending end via TCP / IP for response.
[0095] Deployment and interaction methods of sender and receiver based on private protocol, such as... Figure 7 As shown.
[0096] The sending end is deployed in the security control zone, and the receiving end is deployed in the management information zone. Physical isolation between the two is achieved through a forward isolation device, strictly adhering to the constraint that only unidirectional TCP / IP data streams are allowed from the production control zone to the management information zone, and only specific single-byte data can be transmitted in the reverse direction. The sending end's application first encapsulates the data using a proprietary protocol, integrating protocol header fields such as start code, sequence number, data type, and payload length with the corresponding payload data (data stream or file fragment) according to the protocol's defined forward message format. Then, the encapsulated data packet is transmitted to the TCP / IP transport layer via the Netty framework, and then transmitted through the standard protocols of the network layer, data link layer, and physical layer to the forward isolation device. After being allowed by the device, it is sent to the receiving end in the management information zone. Upon receiving the data packet, the receiving end parses it at the application layer according to the proprietary protocol's forward format, performs sequence number verification (file-type data packets also require additional CRC32 verification), and returns a single-byte response packet through the reverse channel based on the sequence number comparison result and the CRC32 verification result. For example, a positive response is returned only if the sequence number comparison result is the same and the CRC32 verification result is successful. The sending end monitors the response status through the acknowledgment packet timer module. If no acknowledgment is received within 3 seconds or a negative acknowledgment is received, the current data packet is retransmitted. If a positive acknowledgment is received, the next data packet is sent, thereby achieving reliable and real-time data interaction across the positive isolation device.
[0097] In this application, the data packet retransmission mechanism is as follows: The sending end completes the transmission of the data packet to the transport layer and starts a response packet timer. If a positive acknowledgment is received from the receiving end within a preset time period, the next data packet is sent. If a negative acknowledgment is received from the receiving end within the preset time period, or if no response packet is received from the receiving end, the current application layer data packet is retransmitted. If the number of retransmissions of the same application layer data packet reaches three, the connection between the sending and receiving ends is disconnected.
[0098] In this application, as an example, the transmission method of data streams, such as data of the IEC104 protocol data type, is as follows: Step Sa1: The sending application instantiates a private protocol object and initializes the private protocol's runtime environment. The initialization mainly includes: initializing the data sequence number by setting it to the initial value of 0, initializing the response packet timer, and creating a data packet queue to store data packets, thus preparing for sending data packets.
[0099] Meanwhile, the sending application initiates a connection to the receiving end through the connect channel method of the Netty library, and the receiving end accepts the connection on the listening port.
[0100] Step Sa2: Encapsulate the data of the IEC104 protocol data type according to the positive report format. The first byte of the extended protocol field is 0x01, and the second byte is the data sequence number, which is obtained from the data sequence number module. Examples of field value settings under the positive message format are shown in Table 1 below. Example data packet: Figure 8 As shown.
[0101] Table 1: Value Settings for Each Field
[0102] Step Sa3: The application adds the encapsulated data packet to the data packet queue to be sent. The data packet sending module obtains the data packet from the data packet queue and calls the Netty library's write method to pass the data packet to the transport layer.
[0103] Step Sa4: After the data packet sending module completes the data packet sending, it immediately starts the response packet timer.
[0104] Step Sa5: After receiving the data packet, the receiving end parses it according to the positive report format. First, it checks the data sequence number, as follows: It retrieves the data sequence number from the data packet and compares it with the expected sequence number in the data sequence number module. If they match, it's normal, and the receiving end sends a positive acknowledgment response packet in reverse message format to the sending end. Otherwise, it sends a negative acknowledgment response packet in reverse message format to the sending end. Example of the response packet: Figure 9 As shown.
[0105] Step Sa6: The sending end determines whether the data packet receiving module has received a response packet within 3 seconds, and proceeds with further processing based on whether a response packet has been received and whether the response packet is a positive or negative acknowledgment. If no response packet is received within 3 seconds after the response packet timer starts, or if a negative acknowledgment response packet is received within 3 seconds, the process proceeds to step Sa3 to retransmit the current data packet. If a positive acknowledgment response packet is received within 3 seconds after the response packet timer starts, the next data packet is transmitted according to step Sa2.
[0106] In this application, the transmission method of file-type data differs from the transmission method of the aforementioned data stream in that: 1) the data types are different; 2) the protocol payload format is different; and 3) the receiver verification is different.
[0107] The data transmission methods for file types are as follows: Step Sb1: The sending application instantiates a private protocol object and initializes the private protocol's runtime environment. Initialization mainly includes: initializing the data sequence number (setting it to an initial value of 0), initializing the response packet timer, and creating a data packet queue to store data packets, preparing for data packet transmission. Simultaneously, the sending application initiates a connection to the receiving end via the Netty library's connect channel method, and the receiving end accepts the connection on its listening port.
[0108] Step Sb2: The sending application reads the file (target data) and segments it to obtain several file fragments. Each file fragment is encapsulated according to the private protocol forward report format. The first byte of the extended protocol field is 0x03, and the second byte is the data sequence number, which is obtained from the data sequence number module. The example of the field value settings under the forward message format corresponding to the file is shown in Table 2.
[0109] Table 2 shows the field value settings for the corresponding file.
[0110] Step Sb3: The application adds the encapsulated data packet to the data packet queue. The data packet sending module obtains the data packet from the data packet queue and calls the Netty library's write method to pass the data packet to the transport layer.
[0111] Step Sb4: After the data packet sending module completes the data packet sending, it immediately starts the response packet timer.
[0112] Step Sb5: After receiving the data packet, the receiving end parses it according to the positive report format. First, it checks the data sequence number by retrieving the sequence number from the data packet and comparing it with the expected sequence number in the data sequence number module. If they match, it's normal; otherwise, it's abnormal. If the data packet data type is file (0x03), it performs CRC32 calculation on the payload header length, payload header, payload content length, and payload content. The calculation result is compared with the CRC32 checksum in the data packet. If they match, it's normal; otherwise, it's abnormal. If both the sequence number and CRC32 comparison results are normal, it sends a positive acknowledgment packet in reverse message format to the sending end. Otherwise, it sends a negative acknowledgment packet in reverse message format to the sending end.
[0113] Step Sb6: The sending end determines whether the data packet receiving module has received a response packet within 3 seconds, and performs subsequent processing based on whether it has been received and the type of response packet (positive acknowledgment or negative acknowledgment). If no response packet is received within 3 seconds after the response packet timer starts, or if a negative acknowledgment response packet is received within 3 seconds, then proceed to step Sb3 to retransmit the current data packet. If a positive acknowledgment response packet is received within 3 seconds after the response packet timer starts, then proceed to step Sb2 to transmit the data packet corresponding to the next file segment, until the entire file transmission is completed.
[0114] Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of this application. See below for details. Figure 10 This diagram illustrates a suitable structural schematic for implementing the electronic device described in the embodiments of this application. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from memory 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the electronic device. The processor 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0115] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although... Figure 10 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0116] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 609, or installed from memory 608, or installed from ROM 602. When the computer program is executed by processor 601, it performs the functions defined in the proprietary protocol-based data transmission method of embodiments of this application.
[0117] Figure 10 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0118] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc. Further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the data transmission method based on a proprietary protocol shown in the above embodiments is implemented.
[0119] A portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0120] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A data transmission method based on a proprietary protocol, characterized in that, The method, applied to a new energy centralized control system, includes a transmitter, a receiver, and a forward isolation device. The transmitter and the receiver are connected through the forward isolation device. Obtain the custom private protocol, target data, and the data sequence number corresponding to the target data; the private protocol includes: forward message format and reverse message format; The sending end encapsulates the target data and the data sequence number according to the forward message format to obtain a data packet, and transmits the data packet to the receiving end through the forward isolation device; The receiving end parses the data packet according to the forward message format to obtain the target data and the data sequence number, compares the data sequence number with the expected sequence number to obtain a comparison result, converts the comparison result according to the reverse message format to obtain a response packet, and transmits the response packet to the sending end; the response packet is either a positive acknowledgment or a negative acknowledgment. The sending end determines whether to resend the data packet to the receiving end based on the response packet.
2. The method according to claim 1, characterized in that, Obtaining the target data and the corresponding data sequence number includes: Acquire the business data of the new energy centralized control system, and divide the business data into several target data; The initial value 0 is used as the data sequence number corresponding to the first target data. Each target data is numbered sequentially, and the data sequence number corresponding to each target data is increased by 1 based on the previous data sequence number. When the data sequence number is incremented to a preset value, the data sequence number corresponding to the next target data is reset to the initial value 0, until the data sequence numbers corresponding to all target data are obtained.
3. The method according to claim 1, characterized in that, The positive message format includes, in sequence, a protocol header and a protocol payload; the protocol header includes, in sequence, a start code, a protocol extension field, and a protocol payload length field; the start code is used to identify the byte sequence at the beginning of the data packet; the protocol extension field includes a first byte and a second byte; the first byte is a data type identifier, which is used to distinguish the data type of the target data; the second byte is the data sequence number; the protocol payload length field is used to identify the length of the protocol payload; the protocol payload is set according to the data type of the target data, and the negative message format includes single-byte identifiers corresponding to positive and negative acknowledgments.
4. The method according to claim 3, characterized in that, The step of converting the comparison result according to the reverse message format to obtain a response packet includes: When the comparison result shows that the data sequence number and the expected sequence number are the same, a single-byte identifier corresponding to the positive response is generated as the response packet. Alternatively, if the comparison result shows that the data sequence number and the expected sequence number are different, a single-byte identifier corresponding to the negative response is generated as the response packet.
5. The method according to claim 1, characterized in that, The sending end determines whether to retransmit the data packet to the receiving end based on the response packet, including: When the sending end transmits the data packet to the receiving end through the forward isolation device, a response packet timer is started. If a response packet transmitted by the receiving end is received within a preset time period and the response packet is an affirmative acknowledgment, it is determined not to resend the data packet to the receiving end. If no response packet is received from the receiving end within the preset time period, or if the received response packet is a negative response, the data packet is retransmitted to the receiving end.
6. The method according to claim 5, characterized in that, Before obtaining the custom private protocol, target data, and the data sequence number corresponding to the target data, the method further includes: The connection between the transmitting end and the receiving end is established through the positive isolation device; Initialize the data sequence number by setting it to an initial value of 0; Set the response packet timer; Create a data packet queue; the data packet queue is used to store the data packets.
7. The method according to claim 6, characterized in that, After determining that the data packet will not be retransmitted to the receiving end, the method further includes: deleting the data packet from the data packet queue, and the sending end using a first-in-first-out strategy to transmit the next data packet of the data packet to the receiving end via the forward isolation device.
8. The method according to claim 6, characterized in that, After obtaining the data packet, the process also includes storing the data packet at the tail of the data packet queue using a first-in-first-out (FIFO) strategy.
9. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the steps of the data transmission method based on a proprietary protocol as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the steps of the data transmission method based on a proprietary protocol as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Data transmission method and device in a unidirectional network
CN109756475A
Data transmission method, data sending equipment and data receiving equipment
CN111147196A
Real-time data one-way transmission method and device
CN114598754A
Multi-source data transmission method and device for drive-by-wire electric automobile, automobile and storage medium
CN115801193A
Time series data cross-gatekeeper two-way transmission method, device and equipment
CN121000410A