Ship communication method and system based on message bus

By introducing a message bus-based communication method and adaptive protocol identification technology in the marine communication system, the problem of inefficient data processing in the prior art is solved, efficient data communication and processing is realized, and the compatibility and flexibility of the system are improved.

CN119814819AActive Publication Date: 2025-04-11THE 711TH RES INST OF CHINA STATE SHIPBUILDING CORP
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411860688.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-11
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

The prior art only fixedly supports one specific communication protocol and processing algorithm, resulting in inefficient data processing.

Method used

The ship communication method based on the message bus is adopted, and the data interaction between the main application and the external system is realized by setting up software drivers independent of the main application, and the data interaction between the main application and various software modules within the ship communication system is realized through the message bus mechanism. At the same time, the external communication protocol is recognized and configured through manual configuration and/or pattern recognition.

Benefits of technology

Improves the efficiency of data communication and data processing, enhances software compatibility and flexibility, enables collaborative work between different components, and reduces maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119814819A_ABST
    Figure CN119814819A_ABST
Patent Text Reader

Abstract

The invention discloses a ship communication method and system based on a message bus, and relates to the technical field of ship communication. The ship communication method based on the message bus comprises the following steps: setting a software driver; data interaction between the main application program and an external system is realized through software driving; based on a message bus mechanism, realizing data interaction between the main application program and each software module in the ship communication system; self-adaptive protocol identification is carried out on an external communication protocol in a manual configuration mode and / or a mode identification mode; and protocol configuration is carried out after the external communication protocol is identified. The data interaction between the main application program and the external system is realized by introducing a software driver concept, the software driver can be added or removed under the condition that the system is not restarted, the applicability of the main application program is not influenced, and thus the efficiency of data communication and data processing can be improved. And adaptive protocol conversion and identification are carried out, so that the data processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of ship communication technology, and in particular to a ship communication method and system based on a message bus. Background Art

[0002] In the field of industrial automation, the front end displays the measurement point data from the back end through controls, displays process data and status information, displays abnormal conditions in a timely manner, and realizes process monitoring. The front end data source is processed based on the back end business logic layer, and the back end needs to communicate with a variety of external devices. These devices choose different communication methods and customize different communication protocols.

[0003] With the development of industrial automation technology, the coexistence of multiple communication methods and protocols has become the norm. How to uniformly process the data of these different protocols and display them to users has become a challenge. However, the existing data processing framework usually supports a fixed set of specific communication protocols and data processing algorithms, resulting in low data processing efficiency. Summary of the invention

[0004] Purpose of the invention: An embodiment of the present application provides a ship communication method based on a message bus, aiming to overcome the technical problem that the prior art only fixedly supports one specific communication protocol and processing algorithm, resulting in low data processing efficiency; another purpose of an embodiment of the present application is to provide a ship communication system based on a message bus.

[0005] Technical solution: A message bus-based ship communication method described in an embodiment of the present application is applied to a ship communication system, and the method includes:

[0006] Setting a software driver; wherein the software driver is independent of a main application of the ship communication system;

[0007] Implementing data interaction between the main application and the external system through the software driver;

[0008] Based on the message bus mechanism, data interaction between the main application and various software modules inside the ship communication system is realized;

[0009] Performing adaptive protocol recognition on external communication protocols by manual configuration and / or pattern recognition;

[0010] And perform protocol configuration after identifying the external communication protocol.

[0011] In some embodiments, implementing data interaction between the main application and the external system through the software driver includes:

[0012] Define the communication protocol library;

[0013] Data interaction is performed with the external system via the communication protocol library.

[0014] In some embodiments, the data interaction with the external system through the communication protocol library includes:

[0015] Define communication methods and protocols;

[0016] Design the communication protocol class library Lib;

[0017] An adapter is provided, and the device drivers under different operating systems are converted into a universal interface in the communication protocol class library Lib through the adapter.

[0018] In some embodiments, the design communication protocol class library Lib includes:

[0019] Define communication identifier, communication protocol base class, custom communication protocol, device module base class, device module derived class and communication device;

[0020] Send and receive data packets through the device module base class;

[0021] storing the relevant information of the communication through the communication identifier;

[0022] Serialize and deserialize data packets through the communication protocol base class;

[0023] Through the custom communication protocol, encapsulation and parsing are achieved according to the specific serialization and deserialization rules of the custom protocol;

[0024] The communication device is handled using a device module library through the device module derived class.

[0025] In some embodiments, there is a composition relationship between the communication device and the device module base class;

[0026] There is a combination relationship between the communication device and the communication identifier;

[0027] There is a dependency relationship between the communication identifier and the communication protocol base class;

[0028] There is an inheritance relationship between the custom communication protocol and the communication protocol base class;

[0029] There is an inheritance relationship between the device module derived class and the module base class.

[0030] In some embodiments, the data interaction between the main application and each software module in the ship communication system is realized based on the message bus mechanism, including:

[0031] The main application realizes two-way data interaction with each software module in the ship communication system; each software module is divided according to functional requirements, and exchanges information with the main application by subscribing to and publishing messages of preset topics. In this process, the main application and each software module can act as a producer or consumer in the message bus according to the specific application scenario.

[0032] In some embodiments, the application scenarios of the external communication protocol include field-determined protocols and dynamically changing protocols;

[0033] The method of performing adaptive protocol identification on the external communication protocol by manual configuration and / or pattern recognition includes:

[0034] The manual configuration method is adopted for the protocol determined by the field;

[0035] The pattern recognition method is used for the dynamically changing protocol; wherein, the pattern recognition method includes: defining the protocol data packet format, determining the special fields of the data frame, feature matching the preset protocol library, parsing the data area content, establishing an extended protocol library and updating the preset protocol library.

[0036] In some embodiments, the types of the external communication protocols include at least Ethernet communication protocol, CAN communication protocol and serial communication protocol.

[0037] In some embodiments, when the type of the external communication protocol is an Ethernet communication protocol, the manual configuration method is used for the protocol determined by the field, including: manually configuring the start, length and address data items; the measurement point name, measurement point type, station ID, module ID, point number and database ID data items are automatically generated after the point selection is completed; the start, length and address respectively identify the start bit, bit length and register address in the Modbus TCP / IP protocol;

[0038] The pattern recognition method is used for the dynamically changing protocol, including: identifying the dynamically changing protocol by defining the protocol data packet format; wherein the data packet format includes: a data packet frame header, an information unit frame header, an information unit body and information encoding rules.

[0039] In some embodiments, when the type of the external communication protocol is the CAN communication protocol, the manual configuration method is used for the protocol determined by the field, including: manually selecting the associated measuring point in the protocol; the measuring point name, type, station ID, module ID, point number, and database ID data items are automatically generated after the point selection is completed; manually configuring the address, length, and frame ID content; and respectively identifying the start bit, bit length, and frame ID in the CAN protocol;

[0040] The pattern recognition method is used for the dynamically changing protocol, including: combining the frame ID and the data body, defining the data packet format and the data frame type to identify the dynamically changing protocol.

[0041] In some embodiments, when the type of the external communication protocol is a serial communication protocol, the manual configuration method is used for the protocol determined by the field, including: manually configuring the address and data type; the measuring point type, station ID, module ID, point number and database ID are automatically generated after the point selection is completed; the start bit, length and register address in the Modbus RTU protocol are respectively identified;

[0042] The pattern recognition method is adopted for the dynamically changing protocol, including: identifying the dynamically changing protocol by defining a frame header and a verification rule.

[0043] Accordingly, a ship communication system based on a message bus according to an embodiment of the present application includes:

[0044] A setting module, used for setting a software driver; wherein the software driver is independent of a main application program of the ship communication system;

[0045] A first data interaction module, used to implement data interaction between the main application and an external system through the software driver;

[0046] A second data interaction module, used to realize data interaction between the main application and various software modules inside the ship communication system based on a message bus mechanism;

[0047] A protocol identification module, used for performing adaptive protocol identification of external communication protocols by manual configuration and / or pattern recognition;

[0048] The protocol configuration module is used to perform protocol configuration after identifying the external communication protocol.

[0049] Beneficial effect: Compared with the prior art, the ship communication method and system based on the message bus of the embodiment of the present application, the ship communication method based on the message bus includes: setting a software driver; wherein the software driver is independent of the main application of the ship communication system; realizing data interaction between the main application and the external system through the software driver; realizing data interaction between the main application and each software module inside the ship communication system based on the message bus mechanism; performing adaptive protocol identification of the external communication protocol through manual configuration mode and / or pattern recognition mode; and performing protocol configuration after identifying the external communication protocol. The present application realizes data interaction between the main application and the external system by introducing the concept of software driver, and the software driver can be added or removed without restarting the system, which will not affect the applicability of the main application, thereby improving the efficiency of data communication and data processing. And the data interaction inside the ship communication system is realized through the message bus mechanism, and the collaborative work between different components is realized. And the external communication protocol is adaptively converted and identified through manual configuration mode and / or pattern recognition mode, and converted into a unified format, which enhances the compatibility and flexibility of the software and improves the efficiency of data processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0051] Figure 1 It is a flow chart of a ship communication method based on a message bus provided in an embodiment of the present application;

[0052] Figure 2 It is a UML diagram of a communication protocol class library provided in an embodiment of the present application;

[0053] Figure 3 It is a flow chart of data interaction between a main application and various software modules provided in an embodiment of the present application;

[0054] Figure 4 is another flowchart of data interaction between a main application and various software modules provided in an embodiment of the present application;

[0055] Figure 5 It is a schematic diagram of the pattern recognition process provided in the embodiments of the present application;

[0056] Figure 6 is a pattern recognition timing diagram provided in an embodiment of the present application;

[0057] Figure 7 Schematic diagram of manual configuration of Modbus TCP / IP protocol provided in the embodiment of the present application;

[0058] Figure 8 It is a manual configuration diagram of a CAN communication protocol provided in an embodiment of the present application;

[0059] Fig. 9 It is a manual configuration diagram of the Modbus RTU serial communication protocol provided in the embodiment of the present application;

[0060] Fig.10 It is a principle structural block diagram of a message bus-based ship communication system provided in an embodiment of the present application.

[0061] Reference numerals:

[0062] 10 - setting module; 20 - first data interaction module; 30 - second data interaction module; 40 - protocol identification module; 50 - protocol configuration module; 100 - ship communication system based on message bus. DETAILED DESCRIPTION

[0063] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with 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 of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0064] It should be understood that although the terms first, second, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the concepts of the present application. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.

[0065] Those skilled in the art will appreciate that the drawings are only schematic diagrams of example embodiments and may not be to scale. The modules or processes in the drawings are not necessarily required to implement the present application and therefore cannot be used to limit the scope of protection of the present application.

[0066] Figure 1 This is a flow chart of a ship communication method based on a message bus provided in an embodiment of the present application. The method can be applied to a ship management system to realize the process of efficiently processing data of various communication protocols. The method can be executed by a ship communication system based on a message bus, which can be implemented by software and / or hardware, and the system can be configured in a processor of a ship management platform. Figure 1 , the method comprises the following steps:

[0067] Step 110: Setting a software driver; wherein the software driver is independent of a main application of the ship communication system.

[0068] Among them, the software driver is similar to the hot-swap function of the hardware driver, and the software driver can be added or removed without restarting the system.

[0069] Step 120: Implement data interaction between the main application and the external system through software driver.

[0070] Among them, external systems include databases, third-party services, hardware equipment, etc.

[0071] Specifically, there is interaction between the ship communication system and the external system, and this part of the business logic is abstracted into a "software driver" similar to a hardware driver. Through the "software driver", "data" interaction is carried out with the external system.

[0072] Here, "data" can be a communication data packet or a collected signal stream.

[0073] Due to differences in device components (such as API calls, file formats, device drivers, etc.) between different operating systems or platforms. The customized interface is converted into a unified interface through an adapter function (also defined as a "software driver"). When adding application scenarios or adding third-party devices, there is no need to modify the core code of the main application. Therefore, this application can run on different operating systems and adapt to multiple third-party hardware devices at the same time, which improves the compatibility and portability of the software, and developers do not need to write specific code for each operating system, reducing the workload of development and maintenance.

[0074] "Software drivers" can run independently of the main application, allowing hardware or software to be dynamically added or removed without affecting the main application service. Therefore, the part that interacts with the external system is abstracted and designed to be easy to replace and upgrade. The adapter ensures that these interactive modules are compatible with different environments, which not only enhances the flexibility and scalability of the system, but also simplifies maintenance.

[0075] Step 130: Based on the message bus mechanism, data interaction between the main application and various software modules within the ship communication system is realized.

[0076] Among them, each software module inside the ship communication system may include various business logics.

[0077] Specifically, data interaction is achieved between the main application (MainApp) program and the business logic (logic1Lib, logic2Lib), and between the business logics (logic1Lib, logic2Lib) through the message bus (msgBus).

[0078] Based on different functional requirements, the main application and business logic define topics, and each topic corresponds to a type of message. For example, communication events are defined as communicateTopic, and data collection events are defined as acquireTopic.

[0079] Among them, the message bus serves as a communication hub, and each software module (such as MainApp, logic1Lib, logic2Lib) transmits data by subscribing to and publishing topics and sending / receiving messages, which reduces the absolute dependency between modules and makes the system flexible and easy to maintain.

[0080] Step 140: Perform adaptive protocol identification on the external communication protocol by manual configuration and / or pattern recognition.

[0081] Among them, external communication protocols mainly include Ethernet communication, CAN communication and serial communication. Although the three types are based on different hardware devices, protocol identification can be based on data load (data frame structure and fields).

[0082] Among them, protocol identification includes two methods: manual configuration method and pattern identification method.

[0083] Step 150: After identifying the external communication protocol, perform protocol configuration.

[0084] Specifically, after identifying the external communication protocol, a data serialization method is used to perform protocol configuration.

[0085] Data serialization refers to the process of converting a data structure or object state into a continuous byte stream. The byte stream can be visualized through the configuration tool. For example, taking the CAN communication protocol as an example, the visualized data stream structure of the CAN communication protocol is as follows: field definition, start bit, length (unit: bit), frame ID.

[0086] The technical solution of the embodiment of the present application realizes the communication of the ship through the following aspects, specifically including: First, setting up software drivers, realizing independent driver architecture, designing and realizing a software driver layer independent of the main application, which acts as a middleware and directly interacts with the hardware interface. This architecture allows dynamic loading or unloading of hardware drivers without interfering with the main application, thereby improving the flexibility and stability of the system. Second, data interaction is realized and connected to external systems. Using the above-mentioned software drivers, a stable and efficient communication link from the main application to the external system is established. This includes but is not limited to network connection, serial, CAN communication, etc. Third, the message bus mechanism, publish / subscribe model: the publish / subscribe (Pub / Sub) messaging mode is adopted to allow each software module in the ship communication system to send and receive information to each other through the message bus. This method decouples the direct dependencies between different components and enhances the scalability and maintainability of the system. Asynchronous processing: All data transmitted through the message bus adopts an asynchronous processing mechanism to ensure that even if one module takes a long time to process, it will not block the operation of other modules, thereby improving the overall performance. Fourth, adaptive co-identification, predefined rule base: Build a rule base containing multiple common communication protocol features as the basis for pattern recognition. Whenever a new external protocol is encountered, the system will try to match the entries in this rule base for rapid identification. Machine learning enhancement: For unknown or non-standard protocols, integrate machine learning algorithms to help automatically infer the protocol structure, and continuously update the rule base to adapt to new situations that may arise in the future. Fifth, protocol configuration, automated configuration process: Once the external communication protocol is successfully identified, the system will automatically complete the necessary configuration work according to the preset strategy, such as setting default parameter values, creating mapping tables, etc. User-friendly configuration: Provide an intuitive graphical user interface (GUI) that allows administrators to easily complete the manual configuration of external communication protocols, including the setting of important parameters such as addresses and data types. Configuration file generation: Generate standardized XML format configuration files for easy review, modification and backup in the future. At the same time, it also supports exporting these configurations to other similar environments for use.

[0087] In the technical solution of this embodiment, the working principle of the ship communication method based on the message bus is as follows: Figure 1First, set the software driver; wherein the software driver is independent of the main application of the ship communication system. Then, the data interaction between the main application and the external system is realized through the software driver. Secondly, based on the message bus mechanism, the data interaction between the main application and the various software modules inside the ship communication system is realized. The external communication protocol is adaptively converted and identified by manual configuration and / or pattern recognition. Finally, the protocol configuration is performed after the external communication protocol is identified. It can be seen that the present application realizes the data interaction between the main application and the external system by introducing the concept of software driver, and the software driver can be added or removed without restarting the system, which will not affect the applicability of the main application, thereby improving the efficiency of data communication and data processing. And the data interaction within the ship communication system is realized through the message bus mechanism, and the collaborative work between different components is realized. And the external communication protocol is adaptively converted and identified by manual configuration and / or pattern recognition, and converted into a unified format, which enhances the compatibility and flexibility of the software and improves the efficiency of data processing.

[0088] In some embodiments, data interaction between a main application and an external system is achieved through a software driver, including: defining a communication protocol class library; and performing data interaction with the external system through the communication protocol class library.

[0089] Specifically, the communication protocol class library libProtocolDatastructure (Lib for short) is defined, and the main application interacts with the external system through the library Lib without worrying about the specific implementation of the communication business logic. Therefore, when adding application scenarios or adding third-party devices, there is no need to modify the core code of the main application, which improves the compatibility and portability of the software and reduces the workload of development and maintenance.

[0090] In some embodiments, data interaction with an external system is performed through a communication protocol class library, including: defining communication methods and communication protocols; designing the communication protocol class library Lib; setting an adapter, and converting device drivers under different operating systems into a universal interface in the communication protocol class library Lib through the adapter.

[0091] Specifically, define the communication protocol class library Lib. The main application interacts with the external system through the library Lib, without worrying about the specific implementation of the communication business logic. Communication includes communication methods and communication protocols. Among them, the communication method consists of communication type and communication mode, among which the communication type is related to the operating system and hardware interface. The communication protocol is used to describe the body structure of the data frame. The adapter converts the device drivers under different operating systems into the common interface in the library lib, so that different types of components can work together.

[0092] In some embodiments, a communication protocol class library Lib is designed, including: defining a communication identifier, a communication protocol base class, a custom communication protocol, a device module base class, a device module derived class, and a communication device; sending and receiving data packets through the device module base class; storing communication related information through the communication identifier; serializing and deserializing data packets through the communication protocol base class; implementing encapsulation and parsing through a custom communication protocol and specific serialization and deserialization rules for the custom protocol; and using the device module library through the device module derived class to process the communication device.

[0093] The device module derived class may be a Zhou Ligong CAN module. Exemplarily, the Zhou Ligong CAN module uses the Zhou Ligong CAN library to process CAN communication.

[0094] Among them, the communication identifier is the CommunicationInfo class, the communication protocol base class is the abstract DataPacketStrategy interface, the custom communication protocol is the custom class customDataPacketStrategy, the device module base class is the abstract base class DevModule, the Zhou Ligong CAN module is the derived class ZLGCanModule, and the communication device is the class DevCommunication.

[0095] Figure 2 It is a Unified Modeling Language (UML) diagram of a communication protocol class library libProtocolDatastructure provided in an embodiment of the present application. For example, the CommunicationInfo class, the abstract DataPacketStrategy interface, the custom class customDataPacketStrategy, the abstract base class DevModule, the derived class ZLGCanModule and the class DevCommunication are defined as follows: Figure 2 shown.

[0096] The CommunicationInfo class is defined, and its properties and methods are shown in Table 1. The strategy pattern is adopted, and different CommunicationInfo instances select matching encapsulation and parsing strategies.

[0097] Table 1 CommunicationInfo

[0098]

[0099] Among them, an abstract DataPacketStrategy interface is defined, and corresponding strategy classes are created based on different communication protocols to implement the DataPacketStrategy interface. The parameters of the abstract DataPacketStrategy interface are shown in Table 2.

[0100] Table 2 Abstract DataPacketStrategy interface parameters

[0101]

[0102]

[0103] The custom class customDataPacketStrategy is used to implement specific encapsulation and parsing rules. The parameters of the custom class customDataPacketStrategy are shown in Table 3.

[0104] Table 3 Parameters of custom class customDataPacketStrategy

[0105] Field Name type meaning serialize() QByteArray Encapsulation Protocol serializeQlist() QList <qbytearray> < / qbytearray> Encapsulation Protocol parseQVector(const QByteArray&) QVector <datapoint> < / datapoint> Parsing protocol queryProtocols Bool Protocol Identification

[0106] Among them, the abstract base class DevModule is defined. Based on the device drivers under different operating systems, specific subclasses and derived classes are created. Taking Zhou Ligong CAN device driver as an example, the ZLGCanModule derived class is created, and the adapter function is added to complete the interface conversion between the third-party library and the abstract base class. Among them, the parameters of the abstract base class DevModule are shown in Table 4.

[0107] Table 4 Parameters of the abstract base class DevModule

[0108] Field Name type meaning DevOpen() virtual int Device Open DevClose() virtual int Device shutdown DevInit() virtual int Device initialization DevStart() virtual int Device startup DevReset() virtual int Device Reset DevSend() virtual int Data transmission DevReceive() virtual int Data Reception DevRMClearRecBuf() virtual int Clear the cache DevReadErrInfo() virtual int Get error information

[0109] Among them, the parameters of the derived class ZLGCanModule are shown in Table 5.

[0110] Table 5 Parameters of the derived class ZLGCanModule

[0111]

[0112]

[0113] Among them, the parameters of the DevCommunication class are shown in Table 6.

[0114] Table 6 Parameters of class DevCommunication

[0115] Field Name type meaning module DevModule Communications equipment info CommunicationInfo Communication Information send() void Sending Data Packets receive() void Receiving Packets processSendData() void Encapsulation Data processReceivedData() void Processing Data

[0116] In some embodiments, there is a combination relationship between the communication device and the device module base class; there is a combination relationship between the communication device and the communication identifier; there is a dependency relationship between the communication identifier and the communication protocol base class; there is an inheritance relationship between the custom communication protocol and the communication protocol base class; there is an inheritance relationship between the device module derived class and the module base class.

[0117] Exemplarily, the derived class of the device module is the Zhou Ligong CAN module, and there is an inheritance relationship between the Zhou Ligong CAN module and the device module base class.

[0118] For example, there is a composition relationship between class DevCommunication and abstract base class DevModule; there is a composition relationship between class DevCommunication and class CommunicationInfo; there is a dependency relationship between class CommunicationInfo and abstract DataPacketStrategy interface; there is an inheritance relationship between custom class customDataPacketStrategy and abstract DataPacketStrategy interface; there is an inheritance relationship between derived class ZLGCanModule and abstract base class DevModule.

[0119] The DevCommunication class and the abstract base class DevModule are in a composition relationship. The DevCommunication class contains an abstract base class DevModule instance and uses it to send and receive data packets.

[0120] The DevCommunication class and the CommunicationInfo class are in a composition relationship. The DevCommunication class contains an instance of the CommunicationInfo class, which is used to store communication related information; it also contains a pointer to the abstract DataPacketStrategy interface, which is used to serialize and deserialize data packets.

[0121] Among them, there is a dependency relationship between the CommunicationInfo class and the abstract DataPacketStrategy interface. The CommunicationInfo class uses the abstract DataPacketStrategy interface to send and receive. Among them, DataPacketStrategy is the base class of the communication protocol. According to the content of the communication protocol body, the software module will derive classes. For example, modbusDataPacketStrategy is used to process the modbus communication protocol, receiving and sending data from the master or slave as the two communicating parties. For example, the project defines an industry standard protocol based on the can interface, and derives canHBDataPacketStrategy, which is used to process the HB communication protocol, receive uplink data and send downlink data.

[0122] The custom class CustomDataPacketStrategy inherits from the abstract DataPacketStrategy interface. The custom class CustomDataPacketStrategy provides specific serialization and deserialization rules for custom protocols to achieve encapsulation and parsing.

[0123] Among them, the derived class ZLGCanModule inherits from the abstract base class DevModule. The derived class ZLGCanModule provides a specific CAN module implementation provided by the Window operating system and uses the Zhou Ligong CAN library to process CAN communication.

[0124] In some embodiments, based on the message bus mechanism, data interaction between the main application and each software module in the ship communication system is realized, including: bidirectional data interaction between the main application and each software module in the ship communication system; each software module is divided according to functional requirements, and exchanges information with the main application by subscribing to and publishing messages of preset topics. In this process, the main application and each software module can act as a producer or consumer in the message bus according to the specific application scenario.

[0125] Among them, the preset theme can be a specific theme, which can be set according to actual conditions and is not specifically limited here.

[0126] Among them, two-way data interaction is achieved between the main application and each software module within the ship communication system. Each software module is divided according to functional requirements and exchanges information with the main application by subscribing to and publishing messages on specific topics. In this process, the main application and each software module can act as a producer (publishing messages) or a consumer (subscribing to messages) in the message bus according to specific application scenarios. Messages of different topics determine their respective role conversions, ensuring the effective transmission and processing of information within the system.

[0127] Since the main application and the software module are two-way data / message exchanges, the main application and the software module have different roles in the bus according to the messages of different topics. There are two specific cases.

[0128] First, the main application is the consumer and the software module is the producer. Among them, the producer is each software module, which is responsible for interacting with external devices and publishing messages in the message queue, including data communication and data acquisition. In the embodiment of the present application, data communication is used as an example. Message queue: As a middleware, it buffers asynchronous messages from multiple producers. Receive data based on CAN, Ethernet, and serial communication interfaces, and ensure that these messages can be reliably delivered to consumers. Among them, the consumer is the main application, which is responsible for the front-end application, realizes data display and user interaction, subscribes to messages in the message queue, and updates the interface or responds to user operations based on the received data. Callback function: When a specific event occurs (such as the arrival of new data), the producer will call the pre-registered callback function to notify the consumer that there is new data to be processed.

[0129] Second, the main application is the producer and the software module is the consumer. Among them, the producer is the main application, which is responsible for the front-end application, realizing user interaction, and publishing messages in the message queue. Message queue: As a middleware, it distinguishes different topics, transmits user control instructions or query instructions, and ensures that the message can be delivered to the corresponding consumer. Among them, the consumer is each software module, which is responsible for interacting with external devices, subscribing to messages in the message queue, and transmitting user control instructions or query instructions to external devices based on CAN, Ethernet, and serial communication interfaces. Callback function: When a specific event occurs (such as the completion of the instruction sending), the producer will call the pre-registered callback function to notify the consumer that there is new data to be processed.

[0130] Specifically, the specific workflows for the two situations are as follows:

[0131] Figure 3 is a flow chart of data interaction between a main application and various software modules provided in an embodiment of the present application. When the main application is a consumer and the software module is a producer, please refer to Figure 3, the specific workflow is: a) Initialization, the main application starts, initializes configuration parameters, sets UI components, etc., to complete initialization. Each software module reads the protocol configuration, completes the initialization work, and establishes a connection with the external device. Set up the message queue, define the message topic, and ensure that each message topic can receive messages from different categories of producers. b) Producer work, each producer module continuously monitors the communication status of its corresponding external device: CAN, Ethernet, serial port. After receiving the data and completing the protocol identification, the producer packages the data into a message format and sends it to the message queue. c) Message delivery, after the message enters the queue, it is sorted according to the queue strategy (such as FIFO, priority, exemplary, the embodiment of the present application adopts FIFO). The message queue manager is responsible for distributing messages to subscribed consumers and the main application. d) Consumer processing, the main application, as a consumer, obtains the latest data updates from the message queue. According to the content of the received message, update the corresponding charts, tables or other visual elements on the UI. e) Callback mechanism, when the producer completes the task and expects to know the result, register a callback function. The consumer completes the processing of the message (such as updating the UI), triggering the callback function to inform the producer that the message has been successfully processed or encountered a problem. f) User interaction, the user can view the status information through the interface provided by the main application.

[0132] Figure 4 is another flow chart of data interaction between the main application and each software module provided in the embodiment of the present application. When the main application is a producer and the software module is a consumer, please refer to Figure 4, the specific workflow is: a) Initialization, the main application starts, initializes configuration parameters, sets UI components, etc., to complete initialization. Each software module reads the protocol configuration, completes the initialization work, and establishes a connection with the external device. Set up the message queue, define the message topic, and ensure that each message topic can be sent to different categories of consumers. b) User interaction, the user can send control and query instructions through the interface provided by the main application, and the user's input is converted into a message and put into the queue. c) Producer work, the producer module packages the control and query instructions into a message format and sends it to the message queue. d) Message delivery, after the message enters the queue, it is sorted according to the queue strategy (such as FIFO, priority, exemplary, the embodiment of the present application adopts FIFO). The message queue manager is responsible for distributing messages to subscribed consumers and each software module according to the topic. e) Consumer processing, each software module obtains the latest message from the message queue, determines whether it is a query instruction or a control instruction based on the content of the received message, and transmits it to the external device based on the CAN, Ethernet, and serial communication interface. f) Callback mechanism, when the producer completes the task and expects to know the result, a callback function is registered. The consumer completes processing of the message (such as sending an instruction), triggering the callback function to inform the producer that the message has been successfully processed or encountered a problem.

[0133] Among them, the specific implementation steps of building a message processing thread MessageProcessingThread and realizing message queue and message processing include: adding an enumeration type identifier (type) to the message to distinguish the message category; the message sender encapsulates the message and sends the encapsulated message to the message processing thread; the message processing thread passes the message to the message receiver according to the message type (type) and the receiver (recverId); the message receiver parses the message content. Construct a key-value pair (Key-ValuePair) data structure as the message data (msgData), where key is the system unique identifier, and the value is associated with the key, which is an object and contains attributes such as value, alarm, and limit. Among them, the parameters defining the message Message structure are shown in Table 7.

[0134] Table 7 Parameters of the message structure

[0135] Field Name type meaning type enum Identifies the category or purpose of the message senderId QString Identify the message sender recverId QString Identify the message recipient msgData QVariant The message content

[0136] In some embodiments, the application scenarios of the external communication protocol include field-determined protocols and dynamically changing protocols; adaptive protocol identification is performed on the external communication protocol through manual configuration and / or pattern recognition, including: manual configuration for field-determined protocols; pattern recognition for dynamically changing protocols; wherein the pattern recognition method includes: defining the protocol data packet format, determining special fields of the data frame, feature matching a preset protocol library, parsing the data area content, establishing an extended protocol library, and updating the preset protocol library.

[0137] Among them, the manual configuration method is suitable for scenarios where the data frame fields are clear. The pattern recognition method (or pattern matching method) is suitable for scenarios where the data frame fields will change. When the definition is determined, the protocol is configured through the protocol configuration tool. Usually a protocol will clearly define the protocol data packet format, including the meaning, location, length and verification rules of each field. The pattern recognition method defines fields with specific meanings (such as frame headers, protocol numbers, and terminators) as feature fields, and determines the protocol to which the flow belongs by matching the feature fields with the fields in the data payload.

[0138] For protocols with fixed data frame bodies, manual configuration protocol identification is used. For unknown (clear protocol body, frame header and checksum rules) protocols or protocols with fixed structures, pattern matching protocol identification is used. In most cases, multiple communication protocols coexist. The enumeration ProtocolType is defined to identify the protocol category. The enumeration values ​​are shown in Table 8.

[0139] Table 8 Enumeration value

[0140]

[0141] Figure 5 is a schematic diagram of the pattern recognition process provided in the embodiments of the present application, Figure 6 is a pattern recognition timing diagram provided in the embodiment of the present application. Figure 5 and Figure 6,The specific implementation process of pattern recognition is as follows: First, define the protocol data packet format: The data processing module first defines the data packet frame header, information unit frame header, information unit body and information encoding rules, which is the basis for parsing data. Then, determine the special fields of the data frame: According to the defined protocol data packet format, the module checks whether multiple special fields of the data frame meet the encoding specifications to determine the data exchange protocol followed by the message. Secondly, feature matching preset protocol library: The module extracts features of the data frame according to the protocol features set by the preset protocol library, and determines whether the extracted features match the protocol features set by the preset protocol library. If yes, parse the data area content: If the feature match is successful, the module will parse the data area content according to the matching protocol to complete the data parsing and processing. If not, establish an extended protocol library: If the feature match fails, the module will establish an extended protocol library based on the extracted features, and add it to the preset protocol library to update it to support more types of data exchange protocols. And update the preset protocol library: Add the new extended protocol library to the preset protocol library so that the module can recognize and process more protocol types.

[0142] In some embodiments, the types of external communication protocols include at least Ethernet communication protocol, CAN communication protocol and serial communication protocol.

[0143] It should be noted that the type of the external communication protocol may also be other communication protocols, which are not specifically limited here.

[0144] In some embodiments, when the type of the external communication protocol is an Ethernet communication protocol, a manual configuration method is used for the protocol determined by the field, including: manually configuring the start, length and address data items; the measurement point name, measurement point type, station ID, module ID, point number and database ID data items are automatically generated after the point selection is completed; the start, length and address respectively identify the start bit, bit length and register address in the Modbus protocol; a pattern recognition method is used for the dynamically changing protocol, including: identifying the dynamically changing protocol by defining the protocol data packet format; wherein the data packet format includes: a data packet frame header, an information unit frame header, an information unit body and information encoding rules.

[0145] The protocol determined by the field may be, for example, a standard Modbus protocol.

[0146] Specifically, when the type of external communication protocol is the Ethernet communication protocol, the identification principle of the Ethernet communication protocol is: according to whether the data body field is fixed, the identification method is divided into manual configuration and pattern recognition. Manual configuration is used for the protocol determined by the data body field, and pattern recognition is used for the protocol with dynamically changing data body. Specific process: After the communication is established, first determine whether the data body matches the manually configured protocol. If it matches, it is processed by manual configuration; if it does not match, determine whether it matches the pattern in the protocol library; if it does not match, update the protocol library.

[0147] Figure 7 Schematic diagram of the manual configuration of the Modbus TCP / IP protocol provided in the embodiment of the present application. For example, for a protocol determined by a field, such as the standard Modbus TCP / IP protocol, the manual configuration is as follows: Figure 7 As shown. Among them, the principle of manual configuration of the Ethernet communication protocol is: for the protocol determined by the data body field, such as the standard Modbus TCP / IP protocol, when Ethernet is used as the communication medium, it can be manually configured. The manual configuration process includes: a) Configuration, the configuration tool selects the relevant measuring points, and the measuring point name, measuring point type, station ID, module ID, point number and database ID data items are automatically generated after the point selection is completed; the start, length and address data items need to be manually configured. The start, length and address data items respectively identify the start bit, bit length and register address in the Modbus protocol. b) Initialization, the software module reads the protocol configuration and completes the basic configuration, such as the device IP address, port number, and establishes a network connection. c) Protocol identification, according to the configuration rules, parse the Ethernet data of the external device.

[0148] Among them, the pattern recognition principle of the Ethernet communication protocol is: the specific fields are fixed, and the protocol with dynamically changing data body adopts the pattern recognition method. The specific fields are: data packet frame header, information unit frame header, information unit body and information encoding rules. The pattern recognition process includes: a) protocol library, data packet frame header, information unit frame header, information unit rules and information encoding rules are entered into the protocol library. b) initialization, the software module reads the protocol library and completes the basic configuration, such as the device IP address, port number, and establishes a network connection. c) protocol identification, the module checks whether multiple special fields of the data frame meet the encoding specifications; according to the protocol features set by the preset protocol library, the data frame is feature extracted, and it is determined whether the extracted features match the protocol features set by the preset protocol library. If the feature match is successful, the module will parse the data area content according to the matched protocol to complete the data parsing and processing. If the feature match fails, the module will establish an extended protocol library based on the extracted features and add it to the preset protocol library for update to support more types of data exchange protocols. The new extended protocol library is added to the preset protocol library so that the module can identify and process more protocol types.

[0149] Exemplarily, the specific implementation code of the Ethernet communication protocol to implement protocol identification is as follows:

[0150]

[0151]

[0152] In some embodiments, when the type of the external communication protocol is the CAN communication protocol, a manual configuration method is used for the protocol determined by the field, including: manually selecting associated measurement points in the protocol; the measurement point name, type, station ID, module ID, point number, and database ID data items are automatically generated after the point selection is completed; the address, length, and frame ID content are manually configured; the start bit, bit length, and frame ID in the CAN protocol are respectively identified; the pattern recognition method is used for dynamically changing protocols, including: combining the frame ID and data body, defining the data packet format and data frame type to identify the dynamically changing protocol.

[0153] Specifically, when the type of external communication protocol is CAN communication protocol, the recognition principle of CAN communication protocol is: according to whether the data body field is fixed, the recognition method is divided into manual configuration and pattern recognition. Manual configuration is used for protocols determined by data body fields, and pattern recognition is used for protocols with dynamically changing data body. The specific process is: after communication is established, first determine whether the data body matches the manually configured protocol. If it matches, it is processed by manual configuration; if it does not match, determine whether it matches the pattern in the protocol library; if it does not match, update the protocol library.

[0154] Figure 8FIG. 1 is a schematic diagram of a manual configuration of a CAN communication protocol provided in an embodiment of the present application. For example, for a protocol determined by a field, the manual configuration is as follows: Figure 8 As shown. Among them, the manual configuration principle of the CAN communication protocol is: for the protocol determined by the data body field, such as the CAN protocol in the industry, the data frame ID, the body field and the measurement point mapping relationship are determined. When CAN is used as the communication medium, it can be manually configured. The manual configuration process includes: a) Configuration, the configuration tool selects the relevant measurement points, and the measurement point name, measurement point type, station ID, module ID, point number and database ID data items are automatically generated after the point selection is completed; the start, length and frame ID need to be manually configured. The start, length and address data items identify the start bit, bit length and frame ID in the CAN protocol respectively. b) Initialization, the software module reads the protocol configuration, completes the basic configuration, such as CAN baud rate, and establishes a CAN connection. c) Protocol identification, according to the configuration rules, parse the external device CAN data.

[0155] Among them, the pattern recognition principle of the CAN communication protocol is: the mapping relationship between the text field and the measurement point is uncertain, but the protocol determined by the text encoding rules adopts the pattern recognition method. The specific fields are the frame ID and the encoding rules. The pattern recognition process includes: a) protocol library, the mapping relationship between the frame ID and the encoding rule is entered into the protocol library. b) initialization, the software module reads the protocol library, completes the basic configuration, such as CAN baud rate, and establishes a CAN connection. c) protocol identification, the module checks whether multiple special fields of the data frame meet the encoding specifications; according to the protocol features set by the preset protocol library, the data frame is feature extracted, and it is determined whether the extracted features match the protocol features set by the preset protocol library. If the feature match is successful, the module will parse the data area content according to the matched protocol to complete the data parsing and processing. If the feature match fails, the module will establish an extended protocol library based on the extracted features and add it to the preset protocol library for update to support more types of data exchange protocols. The new extended protocol library is added to the preset protocol library so that the module can identify and process more protocol types.

[0156] For example, the specific implementation code of the CAN communication protocol to implement protocol identification is as follows:

[0157]

[0158] Fig. 9It is a manual configuration diagram of the Modbus RTU serial communication protocol provided in the embodiment of the present application. In some embodiments, when the type of the external communication protocol is a serial communication protocol, a manual configuration method is used for the protocol determined by the field, including: manually configuring the address and data type; the measurement point type, station ID, module ID, point number and database ID are automatically generated after the point selection is completed; the start bit, length and register address in the Modbus RTU protocol are respectively identified; a pattern recognition method is used for the dynamically changing protocol, including: identifying the dynamically changing protocol by defining the frame header and the verification rule.

[0159] Specifically, when the type of external communication protocol is a serial communication protocol, the recognition principle of the serial communication protocol is: according to whether the data body field is fixed, the recognition method is divided into manual configuration and pattern recognition. Manual configuration is used for protocols determined by the data body field, and pattern recognition is used for protocols with dynamically changing data bodies. The specific process is: after the communication is established, first determine whether the data body matches the manually configured protocol. If it matches, it is processed by manual configuration; if it does not match, determine whether it matches the pattern in the protocol library; if neither matches, update the protocol library.

[0160] Among them, when the type of external communication protocol is serial communication protocol, for the protocol determined by the field, such as the standard Modbus RTU protocol, manual configuration is as follows Fig. 9 As shown. Among them, the manual configuration principle of the serial communication protocol is: for the protocol determined by the data body field, such as the standard Modbus RTU protocol, when the serial port is used as the communication medium, it can be manually configured. The manual configuration process of the serial communication protocol includes: a) Configuration, the configuration tool selects the relevant measuring points, and the measuring point name, measuring point type, station ID, module ID, point number and database ID data items are automatically generated after the point selection is completed; the start, length and address data items need to be manually configured. The start, length and address data items respectively identify the start bit, bit length and register address in the Modbus RTU protocol. b) Initialization, the software module reads the protocol configuration and completes the basic configuration, such as serial port baud rate, data bit, stop bit, check bit, and establishes a serial port connection. c) Protocol identification, according to the configuration rules, parse the serial port data of the external device.

[0161] Among them, the pattern recognition principle of the serial communication protocol is: the specific field is fixed, and the protocol with dynamic data body changes adopts the pattern recognition method. The specific fields are: data packet frame header, check rules such as CRC. The pattern recognition process of the serial protocol includes: a) protocol library, data packet frame header, check rules such as CRC, and data body encoding rules are entered into the protocol library. b) Initialization, the software module reads the protocol library and completes the basic configuration, such as serial port baud rate, data bit, stop bit, check bit, and establishes a serial port connection. c) Protocol identification, the module checks whether multiple special fields of the data frame meet the encoding specifications; according to the protocol features set by the preset protocol library, the data frame is feature extracted, and it is determined whether the extracted features match the protocol features set by the preset protocol library. If the feature match is successful, the module will parse the data area content according to the matching protocol to complete the data parsing and processing. If the feature match fails, the module will establish an extended protocol library based on the extracted features and add it to the preset protocol library for update to support more types of data exchange protocols. The new extended protocol library is added to the preset protocol library so that the module can recognize and process more protocol types.

[0162] Finally, after identifying the communication protocol, the protocol is configured. Data encapsulation and parsing are the core tasks of communication. Serialization is a very important mechanism in communication. A good serialization method can directly affect the performance of data transmission, convert structured data into data stream form, and improve the reliability of information transmission.

[0163] Among them, common data serialization methods are JASON, XML and Protobuf. The codes related to the programming framework need to be written by users, which have poor readability and high requirements for developers. The present invention defines a structure and configures and visualizes the above attributes to help users without programming experience to easily handle data serialization and deserialization.

[0164] In summary, compared with the prior art, the present application has the following advantages: First, it supports the rapid inheritance of new protocols, solving problems such as difficulty in protocol upgrades and limited scope of application. Second, the message bus is used as a medium between modules to achieve decoupling between the library and the main application, and between libraries, ensuring the independence of the modules. Adding and uninstalling modules does not affect the integrity of the system, making system engineering more flexible, and can be easily expanded to support more business logic libraries. Third, the most appropriate protocol identification method can be flexibly selected according to the specific application scenario. Combining pattern matching and manual configuration to identify protocols can not only improve the robustness and reliability of the system, but also reduce maintenance costs. Fourth, the data flow is visualized and the serialization process is configurable, which not only improves the reliability of data transmission, but also improves development efficiency. The embodiment of the present application introduces the concept of "software driver" and designs the business logic with the external system so that "uninstalling" or "installing" a new "software driver" will not affect the use of the main application; based on the message bus mechanism, the coupling between the main application and the library is reduced, and the scalability and maintainability of the system are improved; in view of the differences in device drivers of different operating systems, the abstract base class and adaptability function are combined to enhance the compatibility and flexibility of the software; the proposed protocol configuration method not only meets the needs of data stream serialization, but also helps users without programming experience to easily handle data serialization and deserialization, greatly improving development efficiency and reducing the burden on developers. The ship communication system provided by the present application can be widely used in application fields such as the fields of computer network technology, software development technology, and communication protocol technology.

[0165] Fig.10 is a principle structure block diagram of a ship communication system based on a message bus provided in an embodiment of the present application. Correspondingly, a ship communication system based on a message bus is also provided in an embodiment of the present application, please refer to Fig.10 The ship communication system 100 based on the message bus includes: a setting module 10, which is used to set the software driver; wherein the software driver is independent of the main application of the ship communication system; a first data interaction module 20, which is used to realize the data interaction between the main application and the external system through the software driver; a second data interaction module 30, which is used to realize the data interaction between the main application and each software module inside the ship communication system based on the message bus mechanism; a protocol identification module 40, which is used to perform adaptive protocol identification of the external communication protocol through manual configuration and / or pattern recognition; a protocol configuration module 50, which is used to perform protocol configuration after identifying the external communication protocol.

[0166] The technical solution of the embodiment of the present application provides a ship communication system based on a message bus, and the ship communication system based on the message bus includes: a setting module for setting a software driver; wherein the software driver is independent of the main application of the ship communication system; a first data interaction module for realizing data interaction between the main application and the external system through the software driver; a second data interaction module for realizing data interaction between the main application and each software module inside the ship communication system based on the message bus mechanism; a protocol identification module for adaptively identifying the external communication protocol through manual configuration and / or pattern recognition; a protocol configuration module for performing protocol configuration after identifying the external communication protocol. The present application realizes data interaction between the main application and the external system by introducing the concept of software driver, and the software driver can be added or removed without restarting the system, which will not affect the applicability of the main application, thereby improving the efficiency of data communication and data processing. And the data interaction inside the ship communication system is realized through the message bus mechanism, and the collaborative work between different components is realized. And the external communication protocol is adaptively converted and identified through manual configuration and / or pattern recognition, and converted into a unified format, which enhances the compatibility and flexibility of the software and improves the efficiency of data processing.

[0167] In some embodiments, the first data interaction module is further used to: define a communication protocol class library; and perform data interaction with an external system through the communication protocol class library.

[0168] In some embodiments, the first data interaction module is also used to: define communication methods and communication protocols; design a communication protocol library Lib; set up an adapter, and convert device drivers under different operating systems into a common interface in the communication protocol library Lib through the adapter.

[0169] In some embodiments, the design communication protocol class library Lib includes:

[0170] Define communication identifier, communication protocol base class, custom communication protocol, device module base class, device module derived class and communication device;

[0171] Send and receive data packets through the device module base class;

[0172] storing the relevant information of the communication through the communication identifier;

[0173] Serialize and deserialize data packets through the communication protocol base class;

[0174] Through the custom communication protocol, encapsulation and parsing are achieved according to the specific serialization and deserialization rules of the custom protocol;

[0175] The communication device is handled using a device module library through the device module derived class.

[0176] In some embodiments, there is a composition relationship between the communication device and the device module base class;

[0177] There is a combination relationship between the communication device and the communication identifier;

[0178] There is a dependency relationship between the communication identifier and the communication protocol base class;

[0179] There is an inheritance relationship between the custom communication protocol and the device module base class;

[0180] There is an inheritance relationship between the device module derived class and the module base class.

[0181] In some embodiments, the second data interaction module is also used to: realize two-way data interaction between the main application and each software module in the ship communication system; each software module is divided according to functional requirements, and exchanges information with the main application by subscribing to and publishing messages of preset topics. In this process, the main application and each software module can act as a producer or consumer in the message bus according to the specific application scenario.

[0182] In some embodiments, the application scenarios of the external communication protocol include field-determined protocols and dynamically changing protocols; the protocol identification module is used to: use manual configuration for field-determined protocols; use pattern recognition for dynamically changing protocols; wherein the pattern recognition method includes: defining the protocol data packet format, determining special fields of the data frame, feature matching a preset protocol library, parsing data area content, establishing an extended protocol library, and updating the preset protocol library.

[0183] In some embodiments, the types of the external communication protocols include at least Ethernet communication protocol, CAN communication protocol and serial communication protocol.

[0184] In some embodiments, the protocol identification module is also used to: manually configure the address and data type; automatically generate the measurement point type, station ID, module ID, point number and database ID after the point selection is completed; respectively identify the start bit, length and register address in the Modbus TCP / IP protocol;

[0185] The pattern recognition method is used for the dynamically changing protocol, including: identifying the dynamically changing protocol by defining a protocol data packet format; wherein the data packet format includes: a data packet frame header, an information unit frame header, and an information unit body.

[0186] In some embodiments, the protocol conversion and identification module is also used to: manually select the associated measurement point in the protocol; the type, station ID, module ID, point number, and database ID are automatically generated after the point selection is completed; manually configure the address, bit, and data type content; respectively identify the start bit, length, and frame ID in the CAN protocol;

[0187] The pattern recognition method is used for the dynamically changing protocol, including: combining the frame ID, defining the data packet format and the data frame type to identify the dynamically changing protocol.

[0188] In some embodiments, the protocol identification module is also used to: manually configure the address and data type; automatically generate the measurement point type, station ID, module ID, point number and database ID after the point selection is completed; respectively identify the start bit, length and register address in the Modbus RTU protocol;

[0189] The pattern recognition method is adopted for the dynamically changing protocol, including: identifying the dynamically changing protocol by defining a frame header and a verification rule.

[0190] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0191] The above is a detailed introduction to the message bus-based ship communication method and system provided in the embodiments of the present application, and the principles and implementation methods of the present application are explained by using specific examples. The description of the above embodiments is only used to help understand the technical solution and core idea of ​​the present application; ordinary technical personnel in this field should understand that: it is still possible to modify the technical solutions recorded in the aforementioned embodiments, or to replace some of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A ship communication method based on a message bus, characterized in that: Applied to a ship communication system, the method comprises: Setting a software driver; wherein the software driver is independent of a main application of the ship communication system; Implementing data interaction between the main application and the external system through the software driver; Based on the message bus mechanism, data interaction between the main application and various software modules inside the ship communication system is realized; Performing adaptive protocol recognition on external communication protocols by manual configuration and / or pattern recognition; And perform protocol configuration after identifying the external communication protocol.

2. The ship communication method based on message bus according to claim 1, characterized in that: The data interaction between the main application and the external system is realized by the software driver, including: Define the communication protocol library; Data interaction is performed with the external system via the communication protocol library.

3. The ship communication method based on message bus according to claim 2, characterized in that: The data interaction with the external system through the communication protocol library includes: Define communication methods and protocols; Design the communication protocol class library Lib; An adapter is provided, and the device drivers under different operating systems are converted into a universal interface in the communication protocol class library Lib through the adapter.

4. The ship communication method based on message bus according to claim 3, characterized in that: The designed communication protocol class library Lib includes: Define communication identifier, communication protocol base class, custom communication protocol, device module base class, device module derived class and communication device; Send and receive data packets through the device module base class; storing the relevant information of the communication through the communication identifier; Serialize and deserialize data packets through the communication protocol base class; Through the custom communication protocol, encapsulation and parsing are achieved according to the specific serialization and deserialization rules of the custom protocol; The communication device is handled using a device module library through the device module derived class.

5. The ship communication method based on message bus according to claim 4, characterized in that: There is a combination relationship between the communication device and the device module base class; There is a combination relationship between the communication device and the communication identifier; There is a dependency relationship between the communication identifier and the communication protocol base class; There is an inheritance relationship between the custom communication protocol and the communication protocol base class; There is an inheritance relationship between the device module derived class and the module base class.

6. The ship communication method based on message bus according to claim 1, characterized in that: The data interaction between the main application and each software module in the ship communication system is realized based on the message bus mechanism, including: Two-way data interaction is achieved between the main application and each software module within the ship communication system; each software module is divided according to functional requirements, and exchanges information with the main application by subscribing to and publishing messages on preset topics; in this process, the main application and each software module can act as a producer or consumer in the message bus according to the specific application scenario.

7. The ship communication method based on message bus according to claim 1, characterized in that: The application scenarios of the external communication protocol include a field-determined protocol and a dynamically changing protocol; The method of performing adaptive protocol identification on the external communication protocol by manual configuration and / or pattern recognition includes: The manual configuration method is adopted for the protocol determined by the field; The pattern recognition method is used for the dynamically changing protocol; wherein, the pattern recognition method includes: defining the protocol data packet format, determining the special fields of the data frame, feature matching the preset protocol library, parsing the data area content, establishing an extended protocol library and updating the preset protocol library.

8. The ship communication method based on message bus according to claim 7, characterized in that: The types of the external communication protocols include at least Ethernet communication protocol, CAN communication protocol and serial communication protocol.

9. The ship communication method based on message bus according to claim 8, characterized in that: When the type of the external communication protocol is an Ethernet communication protocol, the manual configuration method is adopted for the protocol determined by the field, including: manually configuring the start, length and address data items; the measuring point name, measuring point type, station ID, module ID, point number and database ID data items are automatically generated after the point selection is completed; the start, length and address respectively identify the start bit, bit length and register address in the Modbus TCP / IP protocol; The pattern recognition method is used for the dynamically changing protocol, including: identifying the dynamically changing protocol by defining the protocol data packet format; wherein the data packet format includes: a data packet frame header, an information unit frame header, an information unit body and information encoding rules.

10. The ship communication method based on message bus according to claim 8, characterized in that: When the type of the external communication protocol is the CAN communication protocol, the manual configuration method is adopted for the protocol determined by the field, including: manually selecting the associated measuring point in the protocol; automatically generating the measuring point name, type, station ID, module ID, point number, and database ID data items after the point selection is completed; manually configuring the address, length, and frame ID content; and respectively identifying the start bit, bit length, and frame ID in the CAN protocol; The pattern recognition method is used for the dynamically changing protocol, including: combining the frame ID and the data body, defining the data packet format and the data frame type to identify the dynamically changing protocol.

11. The ship communication method based on message bus according to claim 8, characterized in that: When the type of the external communication protocol is a serial communication protocol, the manual configuration method is used for the protocol determined by the field, including: manually configuring the address and data type; automatically generating the measuring point type, station ID, module ID, point number and database ID after the point selection is completed; and respectively identifying the start bit, length and register address in the Modbus RTU protocol; The pattern recognition method is adopted for the dynamically changing protocol, including: identifying the dynamically changing protocol by defining a frame header and a verification rule.

12. A ship communication system based on a message bus, characterized in that: include: A setting module, used for setting a software driver; wherein the software driver is independent of a main application program of the ship communication system; A first data interaction module, used to implement data interaction between the main application and an external system through the software driver; A second data interaction module, used to realize data interaction between the main application and various software modules inside the ship communication system based on a message bus mechanism; A protocol identification module, used for performing adaptive protocol identification on an external communication protocol by manual configuration and / or pattern recognition; The protocol configuration module is used to perform protocol configuration after identifying the external communication protocol.

Citation Information

Patent Citations

  • Ship remote technical support system based on cloud computing

    CN112101589A

  • Implementation method for bank core system interface to support multiple access modes

    CN118101797A

  • Intelligent gateway system

    CN118612307A

  • Protocol agnostic request response pattern

    US20050055398A1