Communication method, device, equipment and storage medium
By periodically sending communication messages in the bus-type communication mode, the communication efficiency reduction caused by slave station failure is solved, and the overall efficiency of the communication link is improved.
Patent Information
- Application Number
- CN202410185146.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-19
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-02-19
AI Technical Summary
In bus communication mode, when a slave fails, the master station will repeatedly send communication requests, resulting in a reduction in communication efficiency of the entire communication link.
By obtaining the data items to be collected and their corresponding target IO device types, the communication message is encapsulated using the corresponding communication protocol, and periodically sent within the preset time interval until the communication feedback from the target IO device is received within the preset period. Data reduces the communication frequency with the failed target IO device and increases the communication frequency of the normal target IO device.
It effectively improves the communication efficiency of the communication link, avoids the reduction in communication efficiency caused by failure, and ensures the communication frequency of the normal target IO device.
Smart Images

Figure CN117938721B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a communication method, apparatus, device and storage medium. Background Art
[0002] In some bus communication modes, the communication structure is a master-slave structure, that is, one master station and multiple slave stations, such as Modbus communication. During the communication process, the master station will communicate with the slave stations one by one, and only one slave station will respond to the communication request of the master station at a time.
[0003] However, when a slave fails, the master will repeatedly send communication requests to the slave until the slave responds to the communication request, thereby reducing the communication efficiency of the entire communication link. Summary of the invention
[0004] The main purpose of the present application is to provide a communication method, apparatus, device and storage medium, which aims to solve the technical problem that when a slave station fails, the communication efficiency of the entire communication link is reduced.
[0005] To achieve the above object, the present application provides a communication method, comprising:
[0006] Obtain the data item to be collected and the device type of the target IO device corresponding to the data item to be collected;
[0007] Using a communication protocol corresponding to the target IO device, encapsulating the data item to be collected and the device type to obtain a communication message;
[0008] Sending the communication message to the target IO device, so that the target IO device feeds back communication data based on the received communication message;
[0009] Determining whether the communication data is received within a preset period;
[0010] If the communication data is not received within the preset period, the communication message is sent to the target IO device at a preset time interval until the communication data fed back by the target IO device is received within the preset period.
[0011] Optionally, if the communication data is not received within a preset period, sending the communication message to the target IO device at a preset time interval until the communication data fed back by the target IO device is received within a preset period, includes:
[0012] If the communication data is not received within the preset period, determining whether it is the first time that the communication data is not received;
[0013] If the communication data is not received for the first time, the communication message is sent to the target IO device according to a first preset interval time.
[0014] Optionally, the first preset interval time is 10 seconds.
[0015] Optionally, if the communication data is not received within a preset period, after determining whether it is the first time that the communication data is not received, the method further includes:
[0016] If it is not the first time that the communication data is not received, after sending the communication message to the target IO device according to the first preset interval time, determine the second time interval according to the preset interval time, the number of times the communication message is repeatedly sent to the target IO device and the length of the first preset interval time, and send the communication message to the target IO device based on the second time interval.
[0017] Optionally, the preset interval duration is 5 seconds.
[0018] Optionally, if the communication data is not received for the first time, a second time interval is determined according to a preset interval duration, the number of times the communication message is repeatedly sent to the target IO device, and the duration of the first preset interval, and after the communication message is sent to the target IO device based on the second time interval, the method further includes:
[0019] Determining whether the total duration of the second time interval is equal to the total preset duration;
[0020] If the total duration is equal to the preset total duration, the communication message is stopped from being sent to the target IO device, and the warning message is output.
[0021] Optionally, the sending of the communication message to the target IO device at a preset time interval until communication data fed back by the target IO device is received within a preset period, the method further includes:
[0022] Acquire a new data item to be collected and a new device type of a new target IO device corresponding to the new data item to be collected;
[0023] Encapsulating the new data item to be collected and the new device type using a communication protocol corresponding to the new target IO device to obtain a new communication message;
[0024] The new communication message is sent to the new target IO device, so that the new target IO device feeds back new communication data based on the new communication message.
[0025] In a second aspect, the present application provides a communication device, the communication device comprising:
[0026] An acquisition module, used to acquire the data item to be collected and the device type of the target IO device corresponding to the data item to be collected;
[0027] An encapsulation module, used to encapsulate the data items to be collected and the device type using a communication protocol corresponding to the target IO device to obtain a communication message;
[0028] A first sending module, used for sending the communication message to the target IO device, so that the target IO device feeds back communication data based on the received communication message;
[0029] A judging module, used to judge whether the communication data is received within a preset period;
[0030] The second sending module is used to send the communication message to the target IO device at a preset time interval if the communication data is not received within a preset period, until the communication data fed back by the target IO device is received within a preset period.
[0031] In a third aspect, the present application provides a communication device, comprising: a processor, a memory, and a communication program stored in the memory, wherein the communication program implements the steps of any of the above communication methods when executed by the processor.
[0032] In a fourth aspect, the present application provides a computer-readable storage medium having a communication program stored thereon, wherein the communication program, when executed by a processor, implements the communication method as described in any one of the above items.
[0033] A communication method proposed in an embodiment of the present application includes: obtaining a data item to be collected and a device type of a target IO device corresponding to the data item to be collected; encapsulating the data item to be collected and the device type using a communication protocol corresponding to the target IO device to obtain a communication message; sending the communication message to the target IO device so that the target IO device feeds back communication data based on the received communication message; judging whether the communication data is received within a preset period; if the communication data is not received within the preset period, sending the communication message to the target IO device at a preset time interval until the communication data fed back by the target IO device is received within the preset period.
[0034] Compared with the related art, when a slave station fails, the master station will repeatedly send communication requests to the slave device until the slave station responds to the communication request. The embodiment of the present application periodically sends messages to the target IO device at a preset time interval, and increases the communication frequency of the normal target IO device by reducing the communication frequency with the failed target IO device, thereby solving the problem of reduced communication efficiency of the entire communication link. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 This is a schematic diagram of the structure of the communication device of this application;
[0036] Figure 2 This is a flow chart of the first embodiment of the communication method of the present application;
[0037] Figure 3 This is a schematic diagram of the functional modules of the first embodiment of the communication device of the present application.
[0038] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0039] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] In some bus communication modes, the communication structure is a master-slave structure, that is, one master station and multiple slave stations, such as Modbus communication. During the communication process, the master station will communicate with the slave stations one by one, and only one slave station will respond to the communication request of the master station at a time.
[0041] However, when a slave fails, the master will repeatedly send communication requests to the slave until the slave responds to the communication request, thereby reducing the communication efficiency of the entire communication link.
[0042] The present application provides a solution, which includes obtaining a data item to be collected and a device type of a target IO device corresponding to the data item to be collected; encapsulating the data item to be collected and the device type using a communication protocol corresponding to the target IO device to obtain a communication message; sending the communication message to the target IO device so that the target IO device feeds back communication data based on the received communication message; judging whether the communication data is received within a preset period; if the communication data is not received within the preset period, sending the communication message to the target IO device at a preset time interval until the communication data fed back by the target IO device is received within the preset period.
[0043] Compared with the related art, when a slave station fails, the master station will repeatedly send communication requests to the slave device until the slave station responds to the communication request. The embodiment of the present application periodically sends messages to the target IO device at a preset time interval, and increases the communication frequency of the normal target IO device by reducing the communication frequency with the failed target IO device, thereby solving the problem of reduced communication efficiency of the entire communication link.
[0044] Reference Figure 1 , Figure 1 A schematic diagram of the structure of a communication device in the hardware operating environment involved in the embodiment of the present application.
[0045] like Figure 1 As shown, the communication device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0046] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the communication device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0047] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module and a communication program.
[0048] exist Figure 1In the communication device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the communication device of the present application can be set in the communication device, and the communication device calls the communication program stored in the memory 1005 through the processor 1001, and executes the communication method provided in the embodiment of the present application.
[0049] Based on the hardware structure of the above communication device but not limited to the above hardware structure, the present application provides a first embodiment of a communication method. Figure 2 , Figure 2 A flow chart of the first embodiment of the communication method of the present application is shown.
[0050] It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown here.
[0051] In this embodiment, the communication method includes:
[0052] Step S10: Acquire the data item to be collected and the device type of the target IO device corresponding to the data item to be collected.
[0053] It should be noted that the executor of the communication method is a communication device, and a communication program is stored on the communication device. When the communication device executes the communication program, the communication method of the embodiment of the present application is implemented.
[0054] In this embodiment, the data items to be collected can be the data types to be collected configured by the user based on actual needs, such as temperature, humidity, pressure, etc. The device model of the target IO device can be the device model that communicates with the communication device, such as the sensor model, actuator model, etc.
[0055] Specifically, multiple data items and device types corresponding to the data items can be pre-set locally or in the cloud in the communication device. When executing step S10, the data items to be collected and the device types of the target IO devices corresponding to the data items to be collected can be directly called locally or in the cloud.
[0056] Alternatively, the user may input the data item to be collected and the device type of the target IO device corresponding to the data item to be collected by interacting with the virtual buttons and / or virtual keyboard of the communication device.
[0057] Step S20: Encapsulate the data items to be collected and the device type using a communication protocol corresponding to the target IO device to obtain a communication message.
[0058] Step S30: Send the communication message to the target IO device, so that the target IO device feeds back communication data based on the received communication message.
[0059] Specifically, after obtaining the data items to be collected and the device type of the target IO device corresponding to the data items to be collected, the communication protocol corresponding to the target IO device can be determined based on factors such as device documentation, manufacturer recommendations, device interfaces and connection methods, industry standards, and docking software or platforms. According to the specifications of the communication protocol, the data items to be collected and the device type are encapsulated into a specific format to obtain a communication message, and finally the communication message is sent to the corresponding target IO device.
[0060] Furthermore, after receiving the communication message, the target IO device parses the communication message according to the corresponding communication protocol to obtain the data items to be collected, and feeds back the corresponding communication data to the communication device according to the data items to be collected.
[0061] Step S40: Determine whether the communication data is received within a preset period.
[0062] Step S50: If the communication data is not received within the preset period, the communication message is sent to the target IO device at a preset time interval until the communication data fed back by the target IO device is received within the preset period.
[0063] In this embodiment, the communication data can be said to be that after the target IO device receives the communication message, it parses the communication message, obtains the data items to be collected, and then collects real-time data based on the data items to be collected. For example, when the target IO device is a temperature sensor, the communication data fed back can be the collected temperature and the time when the temperature is collected.
[0064] It is understandable that after the communication device sends a communication message to the target IO device, the target IO device should normally send communication data to the communication device within 3 seconds. If the communication device does not receive the communication data sent by the target IO device within 3 seconds, there may be communication line interference, target IO device failure, etc., that is, the communication data fed back by the target IO device is not received within the preset period. When there is communication line interference, target IO device failure, etc., in order not to reduce the communication efficiency of the normal target IO device, further, as an optional implementation, before step S50, it also includes:
[0065] Step S46: Acquire a new data item to be collected and a new device type of a new target IO device corresponding to the new data item to be collected.
[0066] Step S47: Encapsulate the new data items to be collected and the new device type using a communication protocol corresponding to the new target IO device to obtain a new communication message.
[0067] Step S48: Determine a target IO device corresponding to the new communication message from multiple target IO devices.
[0068] Step S49: Send the new communication message to the target IO device, so that the target IO device feeds back communication data based on the new communication message.
[0069] Specifically, when the communication data fed back by the target IO device is not received within the preset period, based on the above-mentioned operation, new data items to be collected and a new device type of the new target IO device corresponding to the new data items to be collected can be obtained, and the communication protocol corresponding to the new target IO device can be used to encapsulate the data items to be collected and the device type into a specific format to obtain a new communication message, and the new communication message is sent to the new target IO device, so that the new target IO device can feed back the new communication data according to the new communication message.
[0070] In this embodiment, when the communication data fed back by the target IO device is not received within the preset period, the new data to be collected and the device type of the new target IO device corresponding to the new data to be collected are obtained, and the data items to be collected and the device type are encapsulated into a specific format using the communication protocol corresponding to the new target IO device to obtain a new communication message, and finally the new communication message is sent to the new target IO device, so that the new target IO device feeds back the communication data according to the new communication message. If the current target IO device is in the situation of communication line interference, target IO device failure, etc., the target IO device without the above failure can perform communication work, thereby ensuring the communication efficiency of the target IO device without failure, and thus avoiding the situation where the communication efficiency of the entire communication link is reduced.
[0071] It is understandable that when the communication data fed back by the target IO device is not received within the preset period, the corresponding fault may be a temporary fault such as interference in the communication line or restart of the target IO device, or it may be a target IO device failure. For the former temporary failure, communication can be restored by resending the communication message, while for the latter target IO device failure, communication can only be restored by replacing or repairing the target IO device. Therefore, in order to determine the reason why the target IO device did not feed back the communication data within the preset period, and to restore the communication of the target IO device as soon as possible, further, as an optional implementation, step S50 specifically includes:
[0072] Step S501: If the communication data is not received within a preset period, determine whether it is the first time that the communication data is not received.
[0073] Step S502: If the communication data is not received for the first time, sending the communication message to the target IO device according to a first preset interval time.
[0074] Specifically, when the communication data fed back by the target IO device is not received within the preset period, it is determined that it is the first time that the communication data fed back by the target IO device is not received within the preset period. When it is the first time that the communication data fed back by the target IO device is not received within the preset period, it is determined that the target IO device has failed for the first time. At this time, a communication message is sent to the target IO device according to the first preset interval time, and it is determined whether the communication data fed back by the target IO device is received within the preset period. When the communication data fed back by the target IO device is still not received, in order to ensure the communication efficiency of the target IO device that has not failed, the communication frequency of the normal target IO device can be increased by reducing the communication frequency of the target IO device. Therefore, further, in order to avoid reducing the communication efficiency of the target IO device that has not failed, after step S501, it also includes:
[0075] Step S503: If it is not the first time that the communication data is not received, after sending the communication message to the target IO device according to the first preset interval time, determine the second time interval according to the preset interval time, the number of times the communication message is repeatedly sent to the target IO device, and the length of the first preset interval time, and send the communication message to the target IO device based on the second time interval.
[0076] In this embodiment, when the communication data fed back by the target IO device is not received within the preset period and the above situation occurs for the first time, the number of times the communication message is sent to the target IO device again is the number of times the communication message is repeatedly sent to the target IO device.
[0077] Specifically, when it is not the first time that the communication data fed back by the target IO device is not received within the preset period, or after sending a communication message to the target IO device according to the first preset interval time, the communication data fed back by the target IO device is still not received within the preset period, the second time interval is determined according to the preset interval time, the number of times the communication message is repeatedly sent to the target IO device, and the length of the first preset interval time.
[0078] For example, assuming that the first preset interval is 10 seconds and the preset interval is 5 seconds, and after sending the communication message to the target IO device according to the first preset interval, it is determined that the number of times the communication message is repeatedly sent to the target IO device is 1 time. At this time, based on the preset interval, the number of times the communication message is repeatedly sent to the target IO device and the duration of the first preset interval, the second time interval is determined to be 15 seconds, that is, based on the number of times the communication message is repeatedly sent to the target IO device and the preset interval, the incremental duration is determined to be 5 seconds. Finally, based on the incremental duration and the duration of the first preset interval, the second time interval is determined to be 15 seconds, that is, after sending the communication message to the target IO device according to the first preset interval, the communication message is sent to the target IO device again after an interval of fifteen seconds. Among them, the first preset interval and the preset interval can be adjusted according to actual needs, and this embodiment does not limit this.
[0079] Correspondingly, after sending the communication message to the target IO device according to the second time interval, if the communication data fed back by the target IO device is still not received, it is determined that the number of times the communication message is repeatedly sent to the target IO device is 2 times. At this time, based on the number of times the communication message is repeatedly sent to the target IO device and the preset interval time, the new incremental time length is determined to be 10 seconds, and based on the new incremental time length and the first preset interval time, the new second time interval is determined to be 20 seconds, that is, after the last time the communication message was sent to the target IO device, the communication message is sent to the target IO device again after an interval of twenty seconds, and so on.
[0080] It should be noted that when the target IO device is temporarily faulty due to interference in the communication line or restart of the target IO device, communication can be restored by repeatedly sending communication messages. However, when the target IO device fails, communication can only be restored by replacing or repairing the target IO device, and communication cannot be restored by repeatedly sending communication messages. Therefore, in order to avoid the situation where communication is still restored by repeatedly sending communication messages when the target IO device fails, thereby causing a waste of network resources, further, as an optional implementation method, after step S503, it also includes:
[0081] Step S504: determine whether the total duration of the second time interval is equal to the total preset duration.
[0082] Step S505: If the total duration is equal to the preset total duration, stop sending the communication message to the target IO device and output the warning information.
[0083] Specifically, based on the foregoing, after the first repeated sending of communication information to the target IO device fails, an incremental duration will be determined based on the number of times the communication message is repeatedly sent to the target IO device and the preset time duration, and the second time interval will be determined based on the incremental duration and the duration of the first preset interval time. When the total duration of the second time interval is equal to the total preset duration, the sending of communication messages to the target IO device is stopped at this time, and a warning message is output to remind the staff that the target IO device is faulty and needs to be replaced or repaired to restore communication.
[0084] In this embodiment, when a temporary fault such as communication line interference or device restart occurs in the target IO device, by repeatedly sending communication messages to the target IO device, the target IO device can be normally connected to the data item collection sequence to be collected when it returns to normal, and in the process of repeatedly sending communication messages to the target IO device, by gradually increasing the interval time of sending communication messages, the communication frequency of the normal target IO device can be increased by reducing the communication frequency of the target IO device, thereby improving the communication efficiency of the entire communication link. In addition, when the total duration of the incremental interval time of sending communication messages is equal to the total preset duration, the operation of repeatedly sending communication messages to the target IO device is stopped, and a warning message is output to avoid wasting network resources due to sending communication messages to the target IO device for a long time.
[0085] In this embodiment, the data items to be collected and the device type of the target IO device corresponding to the data items to be collected are obtained; the data items to be collected and the device type are encapsulated using the communication protocol corresponding to the target IO device to obtain a communication message; the communication message is sent to the target IO device so that the target IO device feeds back communication data based on the received communication message; it is determined whether the communication data is received within a preset period; if the communication data is not received within the preset period, the communication message is sent to the target IO device at a preset time interval until the communication data fed back by the target IO device is received within the preset period.
[0086] Compared with the related art, when a slave station fails, the master station will repeatedly send communication requests to the slave device until the slave station responds to the communication request. The embodiment of the present application periodically sends messages to the target IO device at a preset time interval, and increases the communication frequency of the normal target IO device by reducing the communication frequency with the failed target IO device, thereby solving the problem of reduced communication efficiency of the entire communication link.
[0087] Based on the same application concept, the communication device of this application is proposed, referring to Figure 3 , Figure 3 This is a schematic diagram of the functional modules of the communication device of this application.
[0088] The communication device comprises:
[0089] An acquisition module, used to acquire the data item to be collected and the device type of the target IO device corresponding to the data item to be collected;
[0090] An encapsulation module, used to encapsulate the data items to be collected and the device type using a communication protocol corresponding to the target IO device to obtain a communication message;
[0091] A first sending module, used for sending the communication message to the target IO device, so that the target IO device feeds back communication data based on the received communication message;
[0092] A judging module, used to judge whether the communication data is received within a preset period;
[0093] The second sending module is used to send the communication message to the target IO device at a preset time interval if the communication data is not received within a preset period, until the communication data fed back by the target IO device is received within a preset period.
[0094] It should be noted that the communication device may be provided with more modules. The various embodiments of the communication device in this embodiment and the technical effects achieved therein may refer to the various implementation modes of the communication method in the aforementioned embodiments, and will not be described in detail here.
[0095] In addition, the embodiment of the present application also proposes a computer storage medium, on which a communication program is stored, and when the communication program is executed by the processor, the steps of the communication method as described above are implemented. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in the present application, please refer to the description of the method embodiment of the present application. Determined as an example, the program instructions can be deployed to be executed on one computing device, or on multiple computing devices located at one location, or, on multiple computing devices distributed at multiple locations and interconnected by a communication network.
[0096] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0097] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0098] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the method of each embodiment of the present application.
[0099] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A communication method, characterized in that: The method comprises: Obtain the data item to be collected and the device type of the target IO device corresponding to the data item to be collected; Using a communication protocol corresponding to the target IO device, encapsulating the data item to be collected and the device type to obtain a communication message; Sending the communication message to the target IO device, so that the target IO device feeds back communication data based on the received communication message; Determining whether the communication data is received within a preset period; If the communication data is not received within the preset period, sending the communication message to the target IO device at a preset time interval until the communication data fed back by the target IO device is received within the preset period; If the communication data is not received within the preset period, sending the communication message to the target IO device at a preset time interval until the communication data fed back by the target IO device is received within the preset period, including: If the communication data is not received within the preset period, determining whether it is the first time that the communication data is not received; If it is not the first time that the communication data is not received, after sending the communication message to the target IO device according to the first preset time interval, determine the second time interval according to the preset interval duration, the number of times the communication message is repeatedly sent to the target IO device, and the duration of the first preset time interval, and send the communication message to the target IO device based on the second time interval; The method further comprises: sending the communication message to the target IO device at a preset time interval until receiving the communication data fed back by the target IO device within a preset period. Acquire a new data item to be collected and a new device type of a new target IO device corresponding to the new data item to be collected; Encapsulating the new data item to be collected and the new device type using a communication protocol corresponding to the new target IO device to obtain a new communication message; The new communication message is sent to the new target IO device, so that the new target IO device feeds back new communication data based on the new communication message.
2. The communication method according to claim 1, characterized in that: If the communication data is not received within the preset period, sending the communication message to the target IO device at a preset time interval until the communication data fed back by the target IO device is received within the preset period, including: If the communication data is not received for the first time, the communication message is sent to the target IO device according to a first preset time interval.
3. The communication method according to claim 2, characterized in that: The first preset time interval is 10 seconds.
4. The communication method according to claim 1, characterized in that: The preset interval duration is 5 seconds.
5. The communication method according to claim 1, characterized in that: If the communication data is not received for the first time, then according to the preset interval length, the number of times the communication message is repeatedly sent to the target IO device, and the first preset time interval, a second time interval is determined, and after the communication message is sent to the target IO device based on the second time interval, the method further includes: Determining whether the total duration of the second time interval is equal to the total preset duration; If the total duration of the second time interval is equal to the total preset duration, the communication message is stopped from being sent to the target IO device, and a warning message is output.
6. A communication device, characterized in that: The communication device comprises: An acquisition module, used to acquire the data item to be collected and the device type of the target IO device corresponding to the data item to be collected; An encapsulation module, used to encapsulate the data items to be collected and the device type using a communication protocol corresponding to the target IO device to obtain a communication message; A first sending module, used for sending the communication message to the target IO device, so that the target IO device feeds back communication data based on the received communication message; A judging module, used to judge whether the communication data is received within a preset period; A second sending module is used to send the communication message to the target IO device at a preset time interval if the communication data is not received within a preset period, until the communication data fed back by the target IO device is received within a preset period; The second sending module is further used to determine whether it is the first time that the communication data is not received if the communication data is not received within a preset period; if it is not the first time that the communication data is not received, after sending the communication message to the target IO device according to the first preset time interval, determine the second time interval according to the preset interval duration, the number of times the communication message is repeatedly sent to the target IO device and the duration of the first preset time interval, and send the communication message to the target IO device based on the second time interval; sending the communication message to the target IO device according to the preset time interval until the communication data fed back by the target IO device is received within the preset period, also includes: acquiring new data items to be collected and a new device type of a new target IO device corresponding to the new data items to be collected; encapsulating the new data items to be collected and the new device type using a communication protocol corresponding to the new target IO device to obtain a new communication message; sending the new communication message to the new target IO device so that the new target IO device feeds back new communication data based on the new communication message.
7. A communication device, characterized in that: include: A processor, a memory and a communication program stored in the memory, wherein the communication program implements the communication method according to any one of claims 1 to 5 when executed by the processor.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a communication program, and when the communication program is executed by a processor, the communication method according to any one of claims 1 to 5 is implemented.
