MQTT protocol data transmission method and system

By building a custom data model and configuring forwarding tables in the Internet of Things, JSON data format is generated, which solves the problems of low development efficiency and low versatility caused by code implementation of JSON format data, and achieves flexible data construction and efficient development process. .

CN118740864APending Publication Date: 2024-10-01XUCHANG XJ SOFTWARE TECHNOLOGIES LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310321990.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In the field of Internet of Things, when using the MQTT protocol and JSON format to exchange data, the organization of data attributes relies on code implementation, resulting in low development efficiency and low versatility of code modules, making it difficult to adapt to changing needs in different scenarios.

Method used

Build a custom data model by selecting a model template from the template element library, select the data points to be forwarded in the configuration database, use the configuration forwarding table to determine the data attribute values, generate and send the JSON data format, avoiding the need to code one by one or one by one. The class implements JSON format data and uses configuration configuration to flexibly construct data.

Benefits of technology

It improves the efficiency of development work and the versatility of code modules, simplifies operations, avoids repeated coding, adapts to the needs of various application scenarios, and realizes the flexible construction of JSON format data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740864A_ABST
    Figure CN118740864A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of Internet of Things data transmission, and particularly relates to an MQTT protocol data transmission method and system, and the method comprises the steps: selecting a model template from a template element library, so as to construct a user-defined data model; the template element library comprises model templates of various data types corresponding to the data points, and the model templates comprise various data attributes of the data types; selecting data points to be forwarded from the configuration database to form a forwarding table, and setting a quoted custom data model for each data point; configuring a database including information of each access device and data points of each data type of the access device, and determining each data attribute value of the to-be-forwarded data according to the data points; and analyzing each data attribute included in the user-defined data model referenced by the data points in the forwarding table, determining a data attribute value corresponding to each data attribute according to the data points, obtaining data in a Json data format, and sending the data. Therefore, the problems of low development work efficiency and low code module universality are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of Internet of Things data transmission, and in particular relates to an MQTT protocol data transmission method and system. Background Art

[0002] MQTT (Message Queue Telemetry Transport) is a client-server based message publishing / subscription transport protocol under the ISO standard (ISO / IEC PRF 20922). It works on the TCP / IP protocol family and is simple, stable, open and easy to implement. It has multiple language versions and can be used on almost any platform, connecting almost all networked objects to the outside world. These features make MQTT particularly suitable as a communication protocol for the Internet of Things.

[0003] Json is a lightweight data exchange format that uses a text format that is completely independent of programming languages ​​to store and represent data. The simplicity and clear hierarchical structure make JSON an ideal data exchange language that is not only easy to read and write, but also easy to parse and generate by machines, and can effectively improve network transmission efficiency.

[0004] In the power Internet of Things, the edge IoT agent device is the intermediate core device for data and command interaction between various collection terminals and cloud IoT platforms. The MQTT protocol is the main communication protocol used by the edge IoT agent device and the cloud IoT platform, and the protocol data transmission adopts the Json format.

[0005] In many application fields of the Internet of Things, although the MQTT protocol is standardized and the messages transmitted by the protocol also follow the JSON format. However, for different scenarios, the cloud system or the main station has different requirements for the attribute content of the data. In the prior art, the organization of JSON format data attributes relies on implementation in the code, that is, the JSON data model and the MQTT message topic are implemented through code. If the requirements for the data model change in a different application scenario or in the same application scenario, it may lead to the need to modify the code again, resulting in low versatility of the code module and low development efficiency.

[0006] In short, in the field of Internet of Things, when using JSON format based on MQTT protocol to exchange data, the specific Json format data relies on code to be implemented one by one or category by category, the code module has low universality and low development efficiency. Summary of the invention

[0007] The purpose of the present invention is to provide an MQTT protocol data transmission method and system to solve the problem that the Internet of Things communication service in the prior art uses code to organize data in JSON format, resulting in low development efficiency and low versatility of code modules.

[0008] In order to solve the above technical problems, the technical solutions provided by the present invention and the corresponding beneficial effects of the technical solutions are as follows:

[0009] A MQTT protocol data transmission method of the present invention comprises the following steps:

[0010] 1) When transmitting MQTT protocol data, select a model template from the template element library to build a custom data model;

[0011] The template element library includes model templates of various data types corresponding to the data points, and the model templates include various data attributes corresponding to the data types;

[0012] 2) According to business needs, select the data points to be forwarded from the configuration database to form a forwarding table, assign the data points to the corresponding forwarding table according to the corresponding data type, and set a referenced custom data model for each data point;

[0013] The configuration database contains information about each access device and data points of each data type corresponding to the access device, and determines each data attribute value of the data to be forwarded according to the data points;

[0014] 3) Parse each data attribute contained in the custom data model referenced by the data point in the forwarding table, determine the data attribute value corresponding to each data attribute according to the data point to form data in the Json data format, and send the data in the Json data format.

[0015] The beneficial effects of the above technical solution are as follows: the present invention includes model templates of various data types and data points of various access devices, and multiple custom data models are constructed according to requirements. Then, by configuring the forwarding table, the custom data model referenced by the data point is specified. Finally, the data attributes in the custom data model referenced by the data point are parsed, and the data attribute values ​​corresponding to each data attribute are determined according to the data point to form data in the Json data format, and the data in the Json data format is sent. The present invention flexibly constructs JSON format data only through configuration-based configuration, abandons the method of organizing JSON format data by coding in the code, avoids repeated coding, is simple to operate, has high work efficiency, and is highly versatile, thereby solving the problem of low development efficiency and low code module versatility in the prior art of using code to organize JSON format data in the Internet of Things communication service.

[0016] Furthermore, in order to improve flexibility, each data attribute in the model template supports selection configuration.

[0017] Further, in order to improve work efficiency, the step 1) of using a visual data model configuration interface to construct a custom data model includes the following steps:

[0018] Load each model template file in the template element library; visually select the model template, select the data attributes required by the business in the model template, and generate a custom data model file.

[0019] Furthermore, each data point corresponds to a unique identification ID, which includes the data type, IED address, device address, sector address and information body address of the data point; and each data attribute value of the data to be forwarded is determined by the unique identification ID.

[0020] Furthermore, in order to improve versatility, the type of model template included in the template element library is determined according to the data type of the data point in the configuration database.

[0021] Furthermore, in order to enrich the model templates and improve the versatility, the data type of the data point in step 1) includes at least one of telesignaling, telemetering, telepulse, remote control, remote adjustment and fixed value; the template element library includes at least one of telesignaling model template, telemetering model template, telepulse model template, remote control model template, remote adjustment model template, fixed value model template, device model template, IED model template and common attribute model template.

[0022] Furthermore, the model template and the custom data model are both stored in XML format.

[0023] Furthermore, in order to improve universality, data in the Json data format includes a subject and data content, wherein the subject name is determined based on custom data model information, data point information and data point unique identification ID, and the data content includes various data attributes and corresponding data attribute values.

[0024] Furthermore, the custom data model includes: first-level node data and at least one second-level node data; the first-level node data includes a model name, and also includes at least one of a model identification number and a model description; wherein the model identification number is used to number the custom data model in a set order, the model name is used to indicate the referenced model template name, and the model description is used to describe the custom data model; the second-level node data includes the name of the referenced attribute and the referenced attribute type, and also includes: at least one of an attribute ID, a referenced attribute description, an internal index of the referenced attribute, and a user-defined value.

[0025] In order to solve the above problems, the present invention further provides an MQTT protocol data transmission system, characterized in that: the system includes a processor, and the processor is used to execute computer instructions to implement an MQTT protocol data transmission method as the present invention to achieve the same beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1It is a flow chart of a MQTT protocol data transmission method of the present invention;

[0027] Figure 2 It is a schematic diagram of constructing a configuration-based custom data model based on the MQTT protocol in the method embodiment of the present invention;

[0028] Figure 3 It is a configuration-based custom data model and a data memory mapping diagram based on the MQTT protocol in the method embodiment of the present invention;

[0029] Figure 4 It is a schematic diagram of constructing a custom data model interface in a data model configuration interface in a method embodiment of the present invention;

[0030] Figure 5 It is a schematic diagram of a forwarding table configuration interface in a method embodiment of the present invention;

[0031] Figure 6 It is a structural block diagram of an MQTT protocol data transmission system of the present invention. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.

[0033] Method Example:

[0034] The present invention provides an embodiment of a MQTT protocol data transmission method, and the method of the present invention is used to generate data in Json format according to a custom data model, so as to solve the problem that the JSON format data is implemented by code in the Internet of Things communication service in the prior art, resulting in low development efficiency and low versatility of code modules. In the method, first, it is necessary to build a configuration database, which contains each data point that each access device needs to send, and each data point corresponds to a unique identification ID. The attribute value of each attribute can be obtained based on the unique identification ID; second, it is necessary to build a template element library, which contains model templates of various data types, and the model template contains all attributes of the data type and supports the expansion of data attributes; third, build a custom data model, select a model template, and select the required attributes (data attributes) for the model template. Fourth, configure the forwarding table. According to business needs, select the data points that need to be forwarded from the database configured in the first step, and select the custom data model built in the third step for the data points. Fifth, determine the data in JSON format based on the data points in the forwarding table, the unique identification ID corresponding to the data points, and the attributes in the custom data model. Specifically, obtain the attribute values ​​corresponding to the attributes of each model element in the referenced data model based on the unique identification ID of the data point, where the attribute name and the attribute value constitute a key-value pair, and then obtain the data in Json format. The data in Json format is, for example: Topic name: {YXNAME: YXNAME attribute value, YXDESC: YXDESC attribute value, YXTYPE: YXTYPE attribute value}.

[0035] like Figure 1 As shown, the following describes an MQTT protocol data transmission method of the present invention in combination with the steps:

[0036] Step 1: Build a configuration database for selecting data points to upload.

[0037] The configuration database includes the type, description, device serial number and device address information of all access devices, as well as the point table information contained in each access device. The point table information includes information of multiple data types such as telesignaling, telemetering, telepulse, remote control, teleadjustment and set value. Each data point has a unique identification ID in the configuration database. Based on the unique identification ID, the information that the data point can represent can be determined. For example, 0008YC0002014001 indicates that the point is of YC (telemetering) type, coming from a device with an IED address of 0008 and a device address of 0002. Its sector address is 01 and the information body address is 4001. The configuration database stores all types of data corresponding to each access device. Each data type includes multiple data points, and each point corresponds to a unique identifier.

[0038] Step 2: Build a template element library.

[0039] The template element library includes model templates of various data types. The model templates contain the specific attributes of the data type corresponding to the model template. For example, the remote signaling model template includes YXDATAREFER (data tag). The template element library can also be expanded to include public model templates and device-level model templates. The attributes in the extended model templates can be used for various data types. Specifically, the template element library includes: remote signaling model templates, telemetering model templates, remote pulse model templates, remote control model templates, remote adjustment model templates, and fixed value model templates. As an extension, device model templates, IED model templates, and public attribute model templates are added and saved in XML file format respectively, that is, each model template file is obtained.

[0040] The model templates for each data type include the following attributes. The attribute values ​​corresponding to each attribute can be determined based on the unique ID corresponding to the data point in the configuration database. When uploading data, the JSON data contains these attributes and their corresponding attribute values:

[0041] Remote signal model template: YXNAME (remote signal name), YXDESC (remote signal description), YXTYPE (remote signal type), YXDATAREFER (remote signal reference), YXINDEX (remote signal data index), YXDPI (remote signal current value), YXQDS (remote signal quality), etc.

[0042] Telemetry model template: YCNAME (telemetry name), YCDESC (telemetry description), YCTYPE (telemetry type), YCDATAREFER (telemetry reference), YCINDEX (telemetry data index), YCOFFSET (telemetry offset), YCRATEVAL (telemetry range), YCVAL (telemetry current value), YCQDS (telemetry quality), etc.

[0043] Remote control model template: YKNAME, YKDESC, YKTYPE, YKDATAREFER, YKINDEX, YKRESET (reset), etc.

[0044] Remote pulse model template: YMNAME, YMDESC, YMTYPE, YMDATAREFER, YMINDEX, YMVAL, YMQDS, etc.;

[0045] Remote adjustment model template: YTNAME, YTDESC, YTTYPE, YTDATAREFER, YTINDEX, YTUNIT (unit), YTSTEP (step length), YTMINVAL (minimum value), YTMAXVAL (maximum value), YTCOEFF (coefficient), etc.

[0046] Fixed value model template: DZNAME, DZDESC, DZTYPE, DZDATAREFER, DZINDEX, DZUNIT, DZSTEP, DZMINVAL, DZMAXVAL, DZCOEFF, etc.;

[0047] Device type template: DEVNAME, DEVDESC, DEVID, DEVTYPE, DEVIPA (device A network IP address), DEVIPB (device B network IP address), etc.

[0048] IED type template: IEDNAME, IEDDESC, IEDID, IEDTYPE, etc.;

[0049] Common attribute type templates: DATE (date), TIME (time), etc.

[0050] In specific applications, the attributes in the above model template can be selected for use. For example, if telesignaling data points need to be uploaded, the attributes to be uploaded can be YXNAME (telesignaling name), YXDESC (telesignaling description), and YXTYPE (telesignaling type) according to the needs.

[0051] The following describes the management and maintenance of model templates in the template element library:

[0052] According to the data type and type attribute of the data point in the configuration database, the remote signaling model, remote measurement model, remote pulse model, remote control model, remote adjustment model, fixed value model, device model, IED model, and common attribute model are managed respectively. That is, according to the data type contained in the configuration database, the model of the corresponding data type is added or deleted.

[0053] By maintaining and managing the template element library, we can match the requirements of various MQTT subscription data attributes as much as possible, and achieve the purpose of adapting to various application scenarios through flexible configuration.

[0054] Step 3: Select a model template to build a custom data model, and configure the data model list.

[0055] like Figure 2 As shown, a custom data model is constructed by dynamically selecting a model template in a template element library, and the constructed multiple custom data models are uniformly put into a data model list file.

[0056] Among them, the constructed JSON format data model (custom data model) includes the attribute field names in the data, and the attribute values ​​corresponding to the attribute names can be obtained through static query of the database, real-time memory acquisition, calling operation command returns, etc.

[0057] The data model list constructed in this embodiment is stored in the form of a data model list file, which can be modified based on the provided data model list template, or can be directly added and generated without using a template.

[0058] When constructing a data model list, it can be completed by configuration on the data model configuration interface of the data model construction tool provided by the present invention. Figure 4 As shown, the configuration interface loads the model template files and data model list files in the template element library. You can add model templates to custom data models by right-clicking, or delete existing model templates in custom data models. In the data model configuration interface, you can also right-click to add or delete attributes in the model template, and display existing attributes by category. The data model list file modulelist.xml can contain one or more custom data models. The constructed custom data models are uniformly placed in the data model list, and the data model list can be expanded and viewed in a tree format on the data model configuration interface. The data model list is saved in XML format.

[0059] The following is an introduction to custom data models. Each custom data model is described in the following way:

[0060] ModuleID; (Model identification number, a number assigned to the custom data model in the set order)

[0061] ModuleName; (model name, referenced model template name, such as remote signal model template)

[0062] ModuleDesc; (model description, a brief description of the custom data model)

[0063] Each custom data model contains multiple ITEMs, each ITEM represents a description of a data attribute in the model template, and corresponds to the attribute in the model template. This embodiment uses the following method to describe the data attribute:

[0064] JsonID; (attribute ID, number assigned to the attribute in the set order)

[0065] JsonName; (reference attribute name, such as YXNAME)

[0066] JsonDesc; (reference attribute description, used to explain JsonName)

[0067] JsonType; (reference attribute type, attribute type, such as dynamic attribute, static attribute)

[0068] JsonDbIndex; (references the internal index of a property)

[0069] JsonUserValue; (user-defined value)

[0070] The following uses the remote signal model template as an example to explain the custom data model. This example contains three items:

[0071] ModuleID = 1;

[0072] ModuleName = remote signal model template;

[0073] ModuleDesc = remote signal model template;

[0074] JsonID = 0;

[0075] JsonName = YXNAME;

[0076] JsonDesc = remote signal name;

[0077] JsonType = static property;

[0078] JsonID = 1;

[0079] JsonName = YXDESC;

[0080] JsonDesc = remote signal description;

[0081] JsonType = static property;

[0082] JsonID = 2;

[0083] JsonName = DATE;

[0084] JsonDesc = time;

[0085] JsonType = dynamic property.

[0086] Step 4: Configure the MQTT protocol forwarding table.

[0087] like Figure 5 As shown, when configuring MQTT to forward data, in addition to configuring the data attribute information inherent in the forwarding data type, a custom data model in the referenced data model list is specified for each forwarded data.

[0088] The function of the forwarding table is to selectively determine which types of information points of which devices need to be forwarded through the MQTT protocol in the table of all device information points in the configuration database, and send these information point data to the MQTT server. The forwarding table is configured according to the data type, and the same data type of different access devices is added to the same forwarding table of the corresponding data type. For each type of data in the forwarding table, select the referenced data model name ModuleName (such as custom data model 1).

[0089] Step 5: If Figure 3 As shown, by loading the configuration database in the first step, the data model list in the third step, and the forwarding table file in the fourth step into the memory, a mapping relationship between the forwarded data point, the custom data model, and the data model attribute content is established in the memory.

[0090] The configuration database of the first step contains multiple data points that need to be forwarded. Select the required data points according to the needs, and then select the referenced custom data model (ModuleName) for the data point according to the business needs. The custom data model includes the names of various attributes. The attribute value of each attribute can be determined based on the unique identification ID of the data point. For example, there are 10 collection terminals, each with 5 data points, for a total of 50 data points. These 50 data points are stored in the configuration database. Select the data points to be sent up according to the business needs. For example, select 20 of them. The forwarding table includes these 20 data points and the custom data model name (ModuleName) referenced by each data point.

[0091] Step 6: Based on the unique identification ID of the forwarded data and the name of the referenced data model, combined with the mapping relationship established in the above memory, dynamically query and obtain the attribute values ​​in the data model in real time, and organize the data message in the key-value pair structure in JSON format.

[0092] When determining the attribute value of each attribute: for example, a remote signal type switch data is sent, the data point in the configuration database has a unique identification ID, the forwarding table specifies which model the forwarding point references, and determines which attributes the data in the referenced model has, and confirms the attribute value corresponding to each attribute based on the unique identification ID of the data point to form a key-value pair. For example: {YXNAME: attribute value 1, YXDESC: attribute value 2, YXTYPE: attribute value 3, YXDATAREFER: attribute value 4, YXINDEX: attribute value 5, YXDPI: attribute value 6, YXQDS: attribute value 7}.

[0093] By forwarding the unique ID of each information point in the data, the interface function provided by the system can be used in combination with the mapping relationship established in the memory in the fifth step to dynamically query or obtain the value of each attribute in the data model in real time, and organize the data message in the key-value pair structure in JSON format.

[0094] The first to sixth steps above determine the data content portion of the JSON format data. The following describes a method for determining the subject name.

[0095] Step 7: Create an MQTT message topic and publish MQTT messages in the "topic + content" mode.

[0096] The topic name is determined based on the custom data model information, data point information and data point unique identification ID. For example, the topic name is model name + Chinese description of remote signal point + unique identification ID of remote signal point, ModuleName + ModuleDesc + unique identification ID.

[0097] The final JSON format data is: Topic name: {YXNAME: attribute value 1, YXDESC: attribute value 2, YXTYPE: attribute value 3, YXDATAREFER: attribute value 4, YXINDEX: attribute value 5, YXDPI: attribute value 6, YXQDS: attribute value 7}.

[0098] The model templates used to construct the data model in the present invention are of rich types and can be expanded at will. The model templates can be managed and maintained to meet the needs of most Internet of Things application scenarios.

[0099] The present invention provides an MQTT protocol data transmission method, which can flexibly construct JSON format data through configuration-based configuration, abandons the method of implementing JSON format data by encoding in the code, avoids repeated encoding, and can be implemented only through simple configuration, with strong versatility.

[0100] An MQTT protocol data transmission method provided by the present invention can be extended to the construction of MQTT message topics, based on which the customization of MQTT message topics can be realized. Through the flexible construction of message topics and message contents, the configurability and flexibility of MQTT applications are realized, and the versatility of code modules is improved.

[0101] System Example 1:

[0102] The present invention also provides an MQTT protocol data transmission system, on which a software module and system using an MQTT protocol data transmission method of the present invention are running. The device includes: an MQTT client module, a configuration-based data model building tool, and a public interface library module. The following is an introduction to each module:

[0103] 1.MQTT client module.

[0104] Responsible for communicating with the MQTT server, including forwarding data and processing control and setting commands from the master. Specifically includes:

[0105] Instantiate the custom data model referenced by the forwarded data in memory, including:

[0106] Read all configuration information in the configuration library, including point tables of various data types (YC / YX / YM / YK / DZ / YT);

[0107] Read a data model list file, where the data model list file is generated by a data model building tool;

[0108] Read the MQTT client forwarding data file, including the forwarding channel parameters and the forwarding table of each data type, and determine the data content to be forwarded by the module through the forwarding data file;

[0109] By calling the interface function of the public interface library module, the above-mentioned read information is associated and mapped in the memory, and the data attribute value in the custom data model is determined by forwarding the unique identification ID of the data and the referenced custom data model. Build a JSON format message, publish the message content, and subscribe to and process the message of the MQTT server.

[0110] 2.Configurational data model building tool.

[0111] Responsible for providing database configuration, transfer table configuration, module communication parameter configuration, and configuration-based data model construction. The data model construction mainly includes:

[0112] Load the data model list file and display the existing data models and the attribute name, type, description and other information contained in each data model in a tree structure.

[0113] Load template element library information and display it by category.

[0114] Implement the custom data model editing function by selecting data attributes in the template element library, dynamically adding to the custom data model or dynamically deleting data attributes from the custom data model, and save the generated data model list file.

[0115] It provides a data model building interface, where you can right-click to add or delete data models, display existing data by categories, and display the results of building the data model in a tree format, providing the effect of configuring the data model building.

[0116] 3. Public interface library module.

[0117] Responsible for providing MQTT client modules, configuration-based data model building tools, and other interface functions that are not listed in the list and can be implemented in the public part. It reflects the layered idea of ​​program implementation and improves the reusability of the program.

[0118] System Example 2:

[0119] In another system embodiment of the present invention, a system for an MQTT protocol data transmission method is provided, such as Figure 6 As shown. In the field of power Internet of Things applications, the most typical application is the edge Internet of Things agent device. The device includes:

[0120] 1) Access protocol module. It is used to connect terminal devices using different protocols to the edge IoT proxy device. Its main function is to realize data access of terminal devices. It includes commonly used IEC104, IEC61850, IEC103, Modbus and other protocol access.

[0121] 2) MQTT export module. It is used to export the business data of the terminal device connected to the edge IoT proxy device to the cloud system or the main station in real time. At the same time, it accepts the control command or setting value command issued by the cloud system or the main station to control and set the connected terminal device. The main functions include mapping data and data model, organizing message content according to the data model, publishing / subscribing to MQTT messages, sending data, command control, etc.

[0122] 3) Data model building tool. Used to configure and generate data models (data models are also called custom data models) according to application requirements. The main functions include database editing, module communication parameter configuration, forwarding table configuration, data model editing, generation, and display, etc.

[0123] 4) Public library module: Provides a series of encapsulated interfaces for other modules to call.

[0124] 5) Other modules. Including process management module and public service module. The process management module is responsible for managing and scheduling the operation of each module in the device, and the public service module provides data support and message support for the operation of other modules.

[0125] System Example 3:

[0126] Another embodiment of the MQTT protocol data transmission system of the present invention includes a memory, a processor and an internal bus, and the processor and the memory communicate and exchange data with each other through the internal bus. The memory includes at least one software function module stored in the memory, and the processor executes various functional applications and data processing by running the software program and module stored in the memory, thereby implementing an MQTT protocol data transmission method introduced in the method embodiment of the present invention.

[0127] The processor may be a processing device such as a microprocessor MCU, a programmable logic device FPGA, etc. The memory may be any memory that uses electrical energy to store information, such as RAM, ROM, etc.

Claims

1. A MQTT protocol data transmission method, characterized in that: The following steps are involved: 1) When transmitting MQTT protocol data, select a model template from the template element library to build a custom data model; The template element library includes model templates of various data types corresponding to the data points, and the model templates include various data attributes corresponding to the data types; 2) According to business needs, select the data points to be forwarded from the configuration database to form a forwarding table, assign the data points to the corresponding forwarding table according to the corresponding data type, and set a referenced custom data model for each data point; The configuration database contains information about each access device and data points of each data type corresponding to the access device, and determines each data attribute value of the data to be forwarded according to the data points; 3) Parse each data attribute contained in the custom data model referenced by the data point in the forwarding table, determine the data attribute value corresponding to each data attribute according to the data point to form data in the Json data format, and send the data in the Json data format.

2. The MQTT protocol data transmission method according to claim 1, characterized in that: Each data attribute in the model template supports selection configuration.

3. The MQTT protocol data transmission method according to claim 2, characterized in that: In step 1), using the visual data model configuration interface to build a custom data model includes the following steps: Load each model template file in the template element library; visually select the model template, select the data attributes required by the business in the model template, and generate a custom data model file.

4. The MQTT protocol data transmission method according to claim 1, characterized in that: Each data point corresponds to a unique identification ID, which includes the data type, IED address, device address, sector address and information body address of the data point; the data attribute values ​​of the data to be forwarded are determined by the unique identification ID.

5. The MQTT protocol data transmission method according to claim 1, characterized in that: The model template type included in the template element library is determined according to the data type of the data point in the configuration database.

6. The MQTT protocol data transmission method according to claim 5, characterized in that: The data type of the data point in step 1) includes at least one of telesignaling, telemetering, telepulse, remote control, remote adjustment and fixed value; the template element library includes at least one of telesignaling model template, telemetering model template, telepulse model template, remote control model template, remote adjustment model template, fixed value model template, device model template, IED model template and common attribute model template.

7. The MQTT protocol data transmission method according to claim 1, characterized in that: The model template and the custom data model are both stored in XML format.

8. The MQTT protocol data transmission method according to claim 1, characterized in that: Data in the Json data format includes a subject and data content, wherein the subject name is determined based on the custom data model information, the data point information and the data point unique identification ID, and the data content includes each data attribute and the corresponding data attribute value.

9. The MQTT protocol data transmission method according to any one of claims 1 to 8, characterized in that: The custom data model includes: first-level node data and at least one second-level node data; the first-level node data includes the model name, and also includes at least one of a model identification number and a model description; wherein the model identification number is used to number the custom data model according to a set order, the model name is used to indicate the referenced model template name, and the model description is used to describe the custom data model; the second-level node data includes the name of the referenced attribute and the referenced attribute type, and also includes: at least one of an attribute ID, a referenced attribute description, an internal index of the referenced attribute, and a user-defined value.

10. An MQTT protocol data transmission system, characterized in that: The system includes a processor, and the processor is used to execute computer instructions to implement the MQTT protocol data transmission method as described in any one of claims 1 to 9.

Citation Information

Cited By

  • Message forwarding method and device, telecontrol machine and readable storage medium

    CN121396972A