Half-duplex two-way communication control method, device and medium based on application layer scheduling
By introducing role division, priority scheduling, and information following mechanisms into the RS485 half-duplex communication system, the data collision problem between the master and slave ends is solved, achieving highly reliable, low-latency bidirectional communication, which is suitable for fields such as hydrological monitoring and power systems.
Patent Information
- Application Number
- CN202511648057.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-12
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2045-11-12
AI Technical Summary
In existing RS485 half-duplex communication systems, random sending operations initiated by the application layer software at both the master and slave ends can easily lead to data collisions, resulting in extremely low communication reliability. This is especially true in automatic hydrological data delivery systems, where communication interruptions are frequent.
By defining roles, prioritizing scheduling, periodically scheduling, and "following" transmission mechanisms, we ensure orderly and reliable bidirectional transmission between the two communicating parties under the same physical channel. We adopt message queues and information following mechanisms to avoid high-priority information from occupying the channel for a long time, and introduce a heartbeat mechanism and multi-level status indicators.
It effectively avoids channel conflicts, improves communication success rate, ensures information integrity and real-time performance, enhances system observability, improves the reliability of key commands, and is suitable for upgrading existing RS485 systems.
Smart Images

Figure CN121098466B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, in particular to a half-duplex bidirectional communication control method and device based on application layer scheduling and a medium. BACKGROUND
[0002] Half-duplex communication refers to that communication parties can send data to each other at different times, but only one-way transmission is allowed at the same time. RS485 is a widely used industrial serial communication standard, which has the advantages of long transmission distance, strong anti-interference ability, support for multi-point communication, etc., and is commonly used in hydrological monitoring, power systems, automation control and other fields.
[0003] However, in actual application, RS485 half-duplex communication has significant defects: when the application layer software of the master and slave ends randomly initiates a sending operation, data collision on the physical channel is likely to occur, resulting in incorrect reception of data by both parties or even communication interruption. Especially in the automatic release system of hydrological elements, the release device needs to upload measurement data frequently, and the upper computer needs to issue control instructions (such as release, termination, etc.) at any time. Without a coordination mechanism, the communication reliability is extremely low.
[0004] The prior art usually relies on hardware handshake signals (such as RTS / CTS) or strict time synchronization protocols to avoid collision, but these methods either increase hardware complexity or require too high precision of the system clock, making it difficult to implement in resource-constrained embedded systems. Therefore, there is an urgent need for a solution that does not rely on additional hardware and can achieve efficient and stable bidirectional communication through application layer software logic only. SUMMARY
[0005] The purpose of the present application is to provide a half-duplex bidirectional communication control method and device based on application layer scheduling and a medium, which combines role division, priority scheduling, periodic scheduling and "follow" sending mechanism to ensure that both parties of communication realize orderly, reliable and bidirectional transmission of information on the premise of sharing the same physical channel.
[0006] To achieve the above purpose, the present application provides the following solutions:
[0007] In a first aspect, the present application provides a half-duplex bidirectional communication control method based on application layer scheduling, comprising:
[0008] determining a master information sending end and a slave information sending end among the two parties of communication, and defining information or response information periodically sent by the master information sending end as master information, and defining response or instruction type information of the slave information sending end as slave information;
[0009] According to the importance, timeliness and system function requirement of information content, priority is set for the main information and the slave information respectively;
[0010] A message queue to be sent is constructed based on the priority, wherein the messages to be sent in the message queue are sorted by priority from high to low, and each message is deleted from the queue immediately after being sent;
[0011] The sending period of the main information is set so that the main information and other low-priority main information are sent alternately, avoiding the long-term occupation of the channel by high-priority information, which leads to the blocking of low-priority information.
[0012] In the slave information sending end, the slave information to be sent is temporarily stored in the message queue, and only after receiving the correct information frame sent by the main information sending end, the slave information with the highest priority is taken out from the message queue for sending, realizing the information following sending mechanism.
[0013] In the communication process, the main information sending end periodically sends the heartbeat information indicating the system state, and the slave information sending end judges the communication link state and device running state according to whether the heartbeat information or main information content is received on time, and prompts the state in the human-computer interface with different color indicator lights.
[0014] For critical slave information instructions, if no response is received within a preset time after sending, retransmission is performed, and if the retransmission is not successful after reaching a threshold, the system exception is reported.
[0015] Optionally, the main information includes hydrological element profile measurement data, main control board self-check response information, probe self-check response information and heartbeat information; and the slave information includes main control board self-check instruction, probe self-check instruction, probe launching instruction and measurement termination instruction.
[0016] Optionally, the priority order of the main information is: hydrological element profile measurement data > main control board self-check response information > probe self-check response information > heartbeat information; and the priority order of the slave information is: main control board self-check instruction > probe self-check instruction > measurement termination instruction > probe launching instruction.
[0017] Optionally, the main information sending period is 40 ms, wherein the hydrological element profile measurement data is generated once every 80 ms, and by alternately sending with other main information, it is ensured that all main information can be transmitted in time.
[0018] Optionally, the interactive information frame structure of the master information sending end and the slave information sending end comprises: a frame header, a frame length, a frame type, information content, a check code and a frame tail; the frame header is used to find the starting position of the information frame in the serial port receiving data buffer; the frame length is used to determine the number of bytes that need to be read from the buffer starting from the frame header position; the check code is used to confirm whether the sent information frame and the received information frame are consistent, that is, whether the information frame is abnormal in the transmission process; and the frame tail is used to determine whether the read information frame is correctly ended.
[0019] Optionally, in the communication process, the master information sending end periodically sends heartbeat information indicating the system state, and the slave information sending end judges the communication link state and the device running state according to whether the heartbeat information or the master information content is received on time, and prompts the state in the human-computer interface with different color indicator lights, and the state prompting specifically comprises the following steps:
[0020] If no master information is received for 3 seconds continuously, it is determined that the communication link is interrupted or the master information sending end is abnormal, and a red indicator light is displayed in the human-computer interface;
[0021] If the master information is received but the master control panel self-checking response of the master information sending end is abnormal or the probe self-checking is abnormal, a yellow indicator light is displayed;
[0022] If the communication is normal and the self-checking is passed, a green indicator light is displayed.
[0023] Optionally, the key slave information instruction retransmission number threshold is 3 times, and after exceeding, the system health state module reports an exception.
[0024] Optionally, the half-duplex bidirectional communication adopts an RS485 interface, the baud rate is 115200 bps, the maximum length of each frame is 15 bytes, and the single frame transmission time is not more than 1.44 ms.
[0025] In a second aspect, the present application provides a computer device, comprising: a memory, a processor to store a computer program on the memory and run the computer program on the processor, and the processor executes the computer program to realize the steps of the application layer scheduling based half-duplex bidirectional communication control method in any one of the above.
[0026] In a third aspect, the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the steps of the application layer scheduling based half-duplex bidirectional communication control method in any one of the above.
[0027] According to the specific embodiments provided by the present application, the present application has the following technical effects:
[0028] The application provides a half-duplex bidirectional communication control method and device based on application layer scheduling and a medium, which has the following advantages.
[0029] Avoid channel conflict: Through the mechanism of "master periodic transmission + slave following response", the data collision problem caused by simultaneous transmission of both ends is fundamentally eliminated, and the communication success rate is significantly improved.
[0030] No need for hardware modification: The control logic is completely implemented at the application layer, and does not depend on additional control lines or complex protocols, which is suitable for direct upgrade of existing half-duplex systems such as RS485.
[0031] Guarantee information integrity and real-time performance: Through the priority message queue, high-priority information (such as measurement data) is ensured to be transmitted first, while low-priority information (such as heartbeat) will not be permanently blocked.
[0032] Enhance system observability: Introduce heartbeat mechanism and multi-level state indication (red / yellow / green light), which is convenient for operation and maintenance personnel to quickly judge the device state and communication link health.
[0033] Improve the reliability of critical instructions: Implement a "send-acknowledge-retransmit" closed-loop mechanism for important control instructions to ensure reliable execution and improve system control accuracy and safety. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0035] Figure 1 The system working principle schematic diagram of an embodiment of the present application;
[0036] Figure 2 The system information processing schematic diagram provided by an embodiment of the present application;
[0037] Figure 3 The master information periodic transmission schematic diagram provided by an embodiment of the present application;
[0038] Figure 4 The information "follow" mechanism schematic diagram provided by an embodiment of the present application;
[0039] Figure 5 The information "follow" mechanism application layer software control flowchart provided by an embodiment of the present application;
[0040] Figure 6A structural schematic diagram of a computer device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0041] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0042] The above purposes, features and advantages of the present application will be more obvious and understandable. The present application will be described in further detail below with reference to the drawings and specific embodiments.
[0043] The present application takes the half-duplex communication in an automatic probe launching system for hydrological element measurement as an example to illustrate the principle and method of realizing stable bidirectional communication through application layer software control. The system mainly includes an automatic probe launching device (hereinafter referred to as launching device) for hydrological element measurement and measurement information acquisition and processing software. The two communicate with each other through serial port RS485 half-duplex. The working process diagram is shown in Figure 1 and the information processing flow of the system is shown in Figure 2 The present method is also applicable to other half-duplex communication systems to realize stable bidirectional communication through application layer control.
[0044] In an exemplary embodiment, as shown in Figure 3 a half-duplex bidirectional communication control method based on application layer scheduling is provided. The method is executed by a computer device, which can be a terminal or a server, or both a terminal and a server. In the embodiments of the present application, the method includes the following steps. Wherein:
[0045] Step 101: Determine the master information sending end and the slave information sending end among the two communication parties, and define the information periodically sent by the master information sending end or the response information as master information, and define the instruction type information of the slave information sending end as slave information.
[0046] In this embodiment, the main function of the launching device is to send heartbeat information, hydrological element profile measurement data information, main control board self-check response information, probe response information state response information, receive main control board self-check instruction information, probe self-check instruction information, probe launching instruction information, measurement termination instruction information, etc. The main function of the measurement information collection and processing software is to receive the heartbeat information, hydrological element profile measurement data information, main control board self-check response information, probe self-check response information sent by the launching device, and send main control board self-check instruction information, probe self-check instruction information, probe launching instruction information, measurement termination instruction information, etc. The hydrological element profile measurement data information is the core information of the entire system operation, and has the highest priority. The development of the system communication strategy is based on the complete and accurate transmission of this information as the most fundamental principle. Therefore, the information sent by the launching device is determined as the main information, and the information sent by the data collection and control software is determined as the slave information.
[0047] Step 102: According to the importance, timeliness and system function requirements of the information content, the priority of the main information and the slave information is set respectively.
[0048] According to the system function, the content of the interactive information, the importance of the information, the timeliness of the information transmission and other points, the priority of the information is determined. The core task of the system is to obtain the hydrological element profile measurement data information of the measured sea area, which needs to be transmitted to the measurement information collection and processing software in real time. The main control board self-check response information and the probe self-check response information are important means for users to obtain the state information of the main control board and the probe in the launching device at the measurement information collection and processing software end, and are important indication information for system health state monitoring. The function of the heartbeat information is to detect whether the launching device is online and whether the communication between the launching device and the measurement information collection and processing software is normal. The measurement data information, the main control board self-check response information and the probe self-check response information can also be used as indication information for monitoring whether the launching device is online and whether the communication between the systems is normal when the system is working, and have the function of heartbeat information. In summary, the priority of the main information is determined as follows: hydrological element measurement information > main control board self-check response information > probe self-check response information > heartbeat information; the priority of the slave information is: main control board instruction information > probe self-check instruction information > termination measurement instruction > probe launching instruction information. Among them, the main control board is the control core of the launching device.
[0049] Step 103: Based on the priority, a message queue to be sent is constructed; wherein the to-be-sent messages in the message queue are sorted by priority from high to low, and each message is deleted from the queue immediately after being sent.
[0050] After each message to be sent is generated, its priority is determined, and it is inserted into the corresponding position in the message queue according to the priority. After each message is sent, it is immediately deleted from the message queue. The message queue is created in the form of a linked list, and each node in the linked list contains the message priority, message content, and next node pointer. The node pointed to by the head pointer stores the message with the highest priority, and the priority of the subsequent message nodes decreases in turn. When the node pointed to by the head pointer is empty, it indicates that there is no information to be sent.
[0051] Step 104: Set the transmission period of the main information so that the main information is alternately transmitted with other low-priority main information, avoiding long-term occupation of the channel by high-priority information, which leads to blocking of low-priority information.
[0052] The RS485 half-duplex communication is used between the release device and the measurement information collection and processing software. According to the interface communication protocol between the release device and the measurement information collection and processing software, the main information transmission period is determined.
[0053] First, modular programming is adopted, and a multi-thread mechanism is implemented. The measurement information collection and processing software applies the modular programming idea to divide the software into RS485 data receiving module, measurement information data processing module, RS485 data sending module, etc. An independent thread is opened for each module to realize its function. The RS485 data receiving module copies the received hydrological element measurement information to the data buffer to be processed, and the measurement information processing module processes the data in the buffer, so that the threads are highly cohesive and lowly coupled, improving the timeliness and stability of each functional module.
[0054] Second, the instantaneous maximum information quantity. The serial port RS485 in the communication link is set to 115200bps, and each byte in the communication process uses 1 start bit, 8 data bits, 1 check bit, and 1 stop bit. The maximum frame length between the release device and the data collection and processing software is 15 bytes, and the transmission of this frame of data takes about 1.44ms, which is the longest time for one-way transmission in the communication link between the release device and the measurement information collection and processing software.
[0055] Third, determine the main frequency information period. The hydrological element measurement information period in the system is 80ms, which belongs to high-frequency information in the system. In order to ensure that the release device can send other information (including heartbeat information, main control board self-check response information, probe self-check response information) to the measurement information collection and processing software in time during the hydrological element profile measurement information process, the measurement information and other information are sent at equal intervals. Therefore, the main information transmission period of the release device is set to 40ms, and the information transmission rule is as follows: Figure 3The method can solve the problem of the highest priority measurement information occupying the channel and the low priority information being continuously blocked in the process of obtaining the hydrological element profile measurement information, and solves the problem of the information interaction between the launching device and the measurement information acquisition and processing software.
[0056] Fourth, the heartbeat information update frequency of the main information is 2 seconds / time, which provides data support for the health state monitoring mechanism of the system.
[0057] Step 105: In the slave information sending end, the to-be-sent slave information is temporarily stored in the message queue, and only after receiving the correct information frame sent by the master information sending end, the slave information with the highest priority is taken out from the message queue for sending, realizing the information "following" sending mechanism.
[0058] Step 106: In the communication process, the master information sending end periodically sends the heartbeat information indicating the system state, and the slave information sending end judges the communication link state and device running state according to whether the heartbeat information or the main information content is received on time, and prompts the state in the human-computer interface with different color indicating lights.
[0059] After the system is started, the running state of the launching device can be monitored through the heartbeat information, the RS485 half-duplex communication link on-off condition between the launching device and the measurement information acquisition and processing software and whether the launching device is in place can be monitored. The human-computer interaction interface of the measurement information acquisition and processing software uses red, yellow and green indicating lights to represent the running state of the system. The red indicating light represents that the measurement information acquisition and processing software does not receive any information sent by the launching device within 3 seconds, and the fault reason may be that the launching device works abnormally and does not send messages to the measurement information acquisition and processing software or the communication link is disconnected and cannot realize information interaction; the yellow indicates that the measurement information acquisition and processing software can normally receive the information sent by the launching device, but the main control board of the launching device is abnormal or the probe is abnormal; the green indicates that the launching device works normally.
[0060] Step 107: For the key slave information instruction, if no response is received within the preset time after sending, retransmission is performed, and if the retransmission times reach the threshold value and still fail, the system abnormality is reported.
[0061] After the system is started, the launching device end as the master information sending end periodically sends information to the measurement information acquisition and processing software, and the instructions and other information generated by the measurement information acquisition and processing software need to be sent to the launching device immediately after receiving the correct information sent by the launching device end, so as to realize the bidirectional stable transmission of information, and the principle is as Figure 4 shown.
[0062] The information "following" mechanism application layer software control flow is shown in Figure 5. Including the following steps:
[0063] Confirm the physical connection of the communication link between the release device and the data acquisition processing software, and the normal operation of the system communication link.
[0064] The information sent by the measurement information acquisition processing software is a message triggered by the user at random. This message cannot be immediately sent to the release device through the RS485 serial port, but is stored in the message queue to be sent, waiting for the correct timing to send.
[0065] The frame structure of the interactive information between the release device and the measurement information acquisition processing software is: frame header, frame length, frame type, information content, check, and frame tail. The frame header is used to find the starting position of the information frame in the RS485 serial port data buffer; the frame length is used to determine the number of bytes that need to be read from the buffer starting from the frame header position; the frame tail is used to determine whether the read information frame ends correctly; and the check is used to confirm whether the sent information frame and the received information frame are consistent, that is, whether the information frame has an exception in the transmission process.
[0066] After the important instruction information is sent from the release device or the measurement information acquisition processing software, if no response information is received, it needs to be sent again. If the instruction response information is not received after sending three times, the system health status module is reported, prompting that the system has an exception.
[0067] After the measurement information acquisition processing software receives the correct information frame sent by the release device periodically, it immediately accesses the message queue to be sent, takes the message with the highest priority, and removes the message from the message queue. If there is no information in the message queue, it means that there is no information to be sent, and no information is sent. According to the communication protocol, even if the received and sent measurement information is the maximum information, the time for receiving and sending information is much smaller than the cycle window, which verifies that the cycle time window is sufficient and feasible. Therefore, the information "follow-up" sending mechanism can realize stable and complete bidirectional transmission of interactive information between the release device and the measurement information acquisition processing software.
[0068] Through the above steps, the application has the following advantages:
[0069] First, in a half-duplex communication system, the information randomly sent by the application layer software at both ends of the channel will meet in the channel, causing errors in bidirectional information transmission, and the information cannot be correctly reached. The use of the periodic information "follow-up" strategy realizes stable bidirectional communication of interactive information, effectively solving the problem of "collision" of information in the channel caused by synchronous sending of information at both ends of the channel.
[0070] Second, without changing the system hardware communication mode, the most convenient and efficient way to solve the problem of communication stability and reliability in a half-duplex system.
[0071] Thirdly, the message queue mode is introduced to ensure the integrity and order of all information on both ends of the channel.
[0072] Fourthly, the key information in the system adopts an information arrival confirmation mechanism to form a "handshake" closed loop for the sent key instruction information, so as to realize the state monitoring of the key information and improve the controllability and accuracy of the system function implementation.
[0073] In summary, the application realizes high-reliability, low-delay and anti-collision bidirectional communication by only applying layer software control without changing the RS485 half-duplex hardware architecture, and is particularly suitable for scenarios such as ocean observation which have very high requirements for communication stability.
[0074] In an exemplary embodiment, a computer device, which can be a server or a terminal, is provided, and an internal structure diagram of the computer device can be as shown in Figure 6 The computer device includes a processor, a memory, an input / output interface (I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is configured to store bipolar communication data. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with external terminals through network connection. The computer program is executed by the processor to implement a half-duplex bidirectional communication control method based on application layer scheduling.
[0075] Those skilled in the art can understand that Figure 6 the structure shown in the above-mentioned figure is only a block diagram of part of the structure related to the scheme of the application, and does not constitute a limitation on the computer device to which the scheme of the application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. In an exemplary embodiment, a computer device is provided, including a memory and a processor, and the memory stores a computer program. The processor executes the computer program to implement the steps in the above-mentioned method embodiments.
[0076] In an exemplary embodiment, a computer readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the steps in the above-mentioned method embodiments.
[0077] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant regulations.
[0078] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments of each method. Among them, any reference to memory, database or other medium used in each embodiment provided by the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric memory (Ferroelectric Random Access Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.
[0079] The database involved in each embodiment provided by the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in each embodiment provided by the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0080] Each technical feature of the above embodiments can be combined arbitrarily. In order to make the description simple, not all possible combinations of each technical feature in the above embodiments are described, but as long as the combination of these technical features does not exist contradictory, it should be considered as the scope of the present application.
[0081] The principles and implementations of the present application are described in the specific examples herein, and the above examples are only used to help understand the method of the present application and its core idea; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation and application range will be changed. In summary, the content of the specification should not be understood as a limitation of the present application.
Claims
1. A half-duplex bidirectional communication control method based on application layer scheduling, characterized in that, The application-layer scheduling-based half-duplex bidirectional communication control method includes: Identify the master information sender and the slave information sender in the communication process, and define the information or response information periodically sent by the master information sender as master information, and define the response or instruction information of the slave information sender as slave information; Priorities are assigned to the primary and secondary information based on the importance, timeliness, and system functional requirements of the information content. A message queue to be sent is constructed based on the priority; wherein, the messages to be sent in the message queue are sorted from high to low priority, and each message is deleted from the queue immediately after it is sent; Set the transmission period of the main information so that the main information is sent alternately with other low-priority main information, thus avoiding the blockage of low-priority information caused by high-priority information occupying the channel for a long time. At the message sending end, the message to be sent is temporarily stored in the message queue. Only after receiving the correct message frame sent by the main message sending end, the message with the highest priority is immediately retrieved from the message queue and sent, thus realizing the message following and sending mechanism. During communication, the main information sending end periodically sends heartbeat information indicating the system status. The information sending end judges the communication link status and device operation status based on whether the heartbeat information or the main information content is received on time, and displays the status with different colored indicator lights in the human-machine interface. For critical slave information commands, if no response is received within a preset time after sending, retransmission will be performed. If the number of retransmissions reaches the threshold and still fails, a system anomaly will be reported. The key information commands are the main control board self-test command, the probe self-test command, and the measurement termination command. The retransmission threshold is 3 times. If the threshold is exceeded, the system will report an abnormality. The main information transmission period is 40ms, of which hydrological element profile measurement data is generated once every 80ms. By alternating with other main information transmissions, it is ensured that all main information can be transmitted in a timely manner. The maximum length of each frame in the half-duplex bidirectional communication is 15 bytes, and the transmission time of a single frame does not exceed 1.44ms. The interaction frame structure between the master and slave information senders includes: a frame header, frame length, frame type, information content, checksum, and frame trailer. The frame header is used to locate the starting position of the information frame in the serial port receive data buffer. The frame length determines the number of bytes to be read from the buffer starting from the frame header position. The checksum confirms whether the sent and received information frames are consistent, i.e., whether any abnormalities occurred during transmission. The frame trailer determines whether the read information frame has correctly ended. The priority order of master information is: hydrological element profile measurement data > main control board self-test response information > probe self-test response information > heartbeat information; the priority order of slave information is: main control board self-test command > probe self-test command > measurement termination command > probe deployment command.
2. The half-duplex bidirectional communication control method based on application layer scheduling according to claim 1, characterized in that, The main information includes: hydrological element profile measurement data, main control board self-test response information, probe self-test response information and heartbeat information; the secondary information includes: main control board self-test command, probe self-test command, probe deployment command and measurement termination command.
3. The half-duplex bidirectional communication control method based on application layer scheduling according to claim 1, characterized in that, During communication, the main information sender periodically sends heartbeat information indicating the system status. The secondary information sender determines the communication link status and device operating status based on whether the heartbeat information or the main information content is received on time, and displays the status using different colored indicator lights on the human-machine interface. Specifically, this includes the following steps: If no main information is received for 3 consecutive seconds, it is determined that the communication link is interrupted or the main information sending end is abnormal, and the human-machine interface displays a red indicator light. If the main information is received but the main control board of the main information sending end has an abnormal self-test response or the probe has an abnormal self-test, a yellow indicator light will be displayed. If communication is normal and the self-test passes, a green indicator light will be displayed.
4. The half-duplex bidirectional communication control method based on application layer scheduling according to claim 1, characterized in that, The threshold for the number of times the key information instruction can be retransmitted is 3. If this number is exceeded, the system health status module will report an anomaly.
5. The half-duplex bidirectional communication control method based on application layer scheduling according to claim 1, characterized in that, The half-duplex bidirectional communication uses an RS485 interface with a baud rate of 115200bps, a maximum frame length of 15 bytes, and a single frame transmission time of no more than 1.44ms.
6. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the half-duplex bidirectional communication control method based on application layer scheduling as described in any one of claims 1-5.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the half-duplex bidirectional communication control method based on application layer scheduling as described in any one of claims 1-5.
Citation Information
Patent Citations
Rocket-borne Ethernet communication method and communication system
CN112312355A
Data transmission method and device and coding equipment
CN120201217A
Asynchronous message queue control method and device, equipment and storage medium
CN120540871A