Conversion method of configurable non-standard protocol conversion gateway

By developing a configurable non-standard protocol conversion gateway, using VBA programming and industrial-grade microcontrollers, the problem of non-standard protocol equipment in the oil field's Internet of Things system cannot be accessed, real-time analysis and conversion of non-standard data is realized, and the oil field's Internet of Things system is successfully connected.

CN119906761APending Publication Date: 2025-04-29PETROCHINA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311407531.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-27
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

In the oilfield Internet of Things system, non-standard protocol equipment cannot be accessed, resulting in data silos and real-time data acquisition and remote transmission cannot be achieved.

Method used

Develop a configurable non-standard protocol conversion gateway, define the non-standard protocol analysis format in the EXCEL table through VBA programming software, download the data to the gateway, use an industrial-grade microcontroller to perform data checksum conversion, and convert non-standard protocol data into a standard MODBUS protocol.

Benefits of technology

Real-time data analysis, reading and conversion of non-standard protocol devices is realized, and the non-standard protocol data is successfully converted into standard A11 MODBUS protocol, realizing the Internet of Things access to non-standard data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119906761A_ABST
    Figure CN119906761A_ABST
Patent Text Reader

Abstract

A conversion method of a configurable non-standard protocol conversion gateway belongs to the technical field of Internet of Things data access, and comprises the following steps: S1, using VBA programming software to develop non-standard protocol predefined analysis software, and defining a non-standard protocol analysis format in an EXCEL table; s2, downloading data defining a non-standard protocol analysis format in an EXCEL table to a non-standard protocol conversion gateway; s3, the RS485 interface on the non-standard side of the non-standard protocol conversion gateway transfers useful data into the MODBUS register after verification according to the defined analysis format; and S4, the standard side RS485 interface of the non-standard protocol conversion gateway provides standard MODBUS-RTU data to the outside to realize conversion of the non-standard protocol data into the standard protocol data. According to the configuration interface of the gateway disclosed by the invention, non-standard co-definition data of an old equipment manufacturer can be analyzed, read and converted in real time through simple conversion co-definition configuration, and non-standard protocol data is converted into a standard A11MODBUS protocol, so that the Internet of Things access of the non-standard data is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of data access of Internet of Things, and in particular relates to a conversion method of a configurable non-standard protocol conversion gateway. Background Art

[0002] The oil and gas production Internet of Things (A11) is one of the key projects of the digital construction of China National Petroleum Corporation. Its main purpose is to realize the real-time collection, remote transmission and video monitoring of production data (pressure, temperature, flow, liquid level, load, electrical parameters, etc.) through the construction of industrial control Internet of Things. In the construction of oilfield Internet of Things, the access of reused instrument data is one of the important links. Old instruments with standard communication protocols (such as MODBUS) or standard 4-20ma signals can be successfully connected to the A11 Internet of Things platform. However, some important intelligent production equipment in some oil production plants are non-standard protocol equipment (without standard protocol output), such as oil measuring systems, smart meters, liquid level meters, flow meters, reused heating furnace PLCs, etc., which cannot be connected to the A11 system, forming data islands. The production Internet of Things requires that non-standard protocol equipment be connected to the data network, which creates a gap between the goals of the Internet of Things and the actual situation on site. Summary of the invention

[0003] In order to solve the problem that non-standard protocol data cannot be accessed to the oilfield Internet of Things, the present invention proposes: a conversion method that can configure a non-standard protocol conversion gateway, comprising the following steps:

[0004] S1: Use VBA programming software to develop non-standard protocol predefined parsing software to define the non-standard protocol parsing format in the EXCEL table;

[0005] S2: Download the non-standard protocol parsing format data defined in the EXCEL table to the non-standard protocol conversion gateway;

[0006] S3: The RS485 interface on the non-standard side of the non-standard protocol conversion gateway transfers the useful data to the MODBUS register after verification according to the defined parsing format;

[0007] S4: The standard side RS485 interface of the non-standard protocol conversion gateway provides standard MODBUS-RTU data to the outside, realizing the conversion of non-standard protocol data into standard protocol data.

[0008] In the step S1, VBA programming language is used for development, an EXCEL spreadsheet is used as a configuration interface, and VBA serial port macros are used to perform command interaction with the configuration interface of the non-standard protocol conversion gateway.

[0009] In the step S1, the configuration software interface consists of 256 cells of EXCEL, the cell number starts from 1, each cell represents 1 non-standard protocol data bit, and the 256 cells of EXCEL are divided into 5 cell types: byte number cell, starting character cell, key bit check cell, valid data and MODBUS register mapping cell, and data string verification method cell. Each EXCEL cell represents 1 byte storage space, and a non-standard data byte is represented by 2 to 3 EXCEL cells; the byte number cell type number is defined in the programming software as 1, occupying 2 EXCEL cells, the starting character cell type number is 2, occupying 2 EXCEL cells, the key bit check cell type is 3, occupying 3 EXCEL cells, the valid data and MODBUS register mapping cell type is 4, occupying 3 EXCEL cells, and the data string verification method cell type is 5, occupying 2 EXCEL cells, wherein the key bit check cell type is not unique and is repeated multiple times in a non-standard data stream parsing definition.

[0010] In step S1, the configuration software automatically reads the configuration information in the EXCEL cells and converts the configuration information into a hexadecimal data stream according to the cell sequence.

[0011] In step S2, the serial port macro of the configuration software application VBA sends a hexadecimal data stream to the non-standard protocol conversion gateway, and the non-standard protocol conversion gateway verifies the hexadecimal data stream, and stores it in the EPPROM of the non-standard protocol conversion gateway after the verification is correct.

[0012] In step S3, the non-standard protocol conversion gateway uses an industrial-grade PIC18F45K80 single-chip microcomputer, and a 512-byte communication buffer space is opened in the single-chip microcomputer.

[0013] In step S3, the non-standard side RS485 interface receives non-standard protocol data in the form of interruption and stores it in the communication buffer space. The single-chip microcomputer verifies the received data according to the configuration information of the EPPROM. After the verification is correct, the valid data is transferred to the MODBUS register according to the configuration information in the mapping cell between the valid data and the MODBUS register. The non-standard side RS485 interface adopts a magnetic isolation circuit, and the power supply part adopts a filtering circuit.

[0014] In the step S4, the non-standard side RS485 interface adopts a magnetic isolation circuit to improve system stability, and the standard side RS485 interface adopts a listening mode. When there is a MODBUS request signal, after passing the CRC16 check, the single-chip microcomputer extracts the relevant data of the MODBUS register according to the requested command, the requested data starting address, and the requested data quantity, and then composes a MODBUS protocol packet and returns it to the data requester through the standard side RS485 interface.

[0015] The beneficial effects of the present invention are as follows: the configuration interface of the gateway of the present invention can parse, read and convert the non-standard protocol data of the reused equipment manufacturer in real time through a simple conversion protocol configuration, and convert the non-standard protocol data into the standard A11MODBUS protocol, thereby realizing the Internet of Things access of non-standard data. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a schematic diagram of the overall structure of the patent of this invention;

[0017] Figure 2 It is the principle diagram of the device of the present invention;

[0018] Figure 3 This is a circuit board diagram of the device of the present invention;

[0019] Figure 4 is a functional block diagram of the present invention;

[0020] Figure 5 Configurable non-standard protocol conversion gateway data flow diagram;

[0021] Figure 6 This is a message parsing diagram of the device of the present invention.

[0022] 1. Guide rail slot, 2. Programming interface (RJ45), 3. Non-standard protocol side wiring terminals, 4. Operation indicator light, 5. Equipment housing, 6. Standard protocol side wiring terminals, 7. Power supply. DETAILED DESCRIPTION

[0023] Example 1

[0024] In order to make the technical means and objectives of the present invention easy to understand, the present invention is further described below in conjunction with specific implementation methods. A conversion method for a configurable non-standard protocol conversion gateway includes the following steps:

[0025] S1: Use VBA programming software to develop non-standard protocol predefined parsing software, and define non-standard protocol parsing format in EXCEL table

[0026] S2: Download the non-standard protocol parsing format data defined in the EXCEL table to the non-standard protocol conversion gateway

[0027] S3: The RS485 interface on the non-standard side of the non-standard protocol conversion gateway transfers the useful data to the MODBUS register after verification according to the defined parsing format.

[0028] S4: The standard side RS485 interface of the non-standard protocol conversion gateway provides standard MODBUS-RTU data to the outside, realizing the purpose of converting non-standard protocol data into standard protocol data.

[0029] Prioritize, use VBA programming software to develop non-standard protocol predefined parsing software, and define non-standard protocol parsing format in EXCEL table. Specifically: develop with VBA programming language, use EXCEL spreadsheet as configuration interface, and apply VBA serial port macro and non-standard protocol conversion gateway configuration interface to perform command interaction. The configuration software interface consists of 256 cells of EXCEL, the cell number starts from 1, and each cell represents 1 non-standard protocol data bit. The 256 cells of EXCEL are divided into 5 types of cells: byte number cell, start character cell, key bit check cell, mapping cell of valid data and MODBUS register, and data string check method cell. Each EXCEL cell represents 1 byte of storage space, and one non-standard data byte is represented by 2 to 3 EXCEL cells. The cell type number of the byte number defined in the programming software is 1, which occupies 2 EXCEL cells, the cell type number of the starting character is 2, which occupies 2 EXCEL cells, the cell type of the key bit check is 3, which occupies 3 EXCEL cells, the cell type of the mapping of valid data and MODBUS register is 4, which occupies 3 EXCEL cells, and the cell type of the data string check method is 5, which occupies 2 EXCEL cells. The key bit check cell type is not unique and can be repeated multiple times in a non-standard data stream parsing definition. The configuration software automatically reads the configuration information in the EXCEL cell and converts the configuration information into a hexadecimal data stream according to the cell order.

[0030] Prioritize downloading the non-standard protocol parsing format data defined in the EXCEL table to the non-standard protocol conversion gateway. Specifically: the configuration software applies the VBA serial port macro to send a hexadecimal data stream to the non-standard protocol conversion gateway, and the non-standard protocol conversion gateway verifies the hexadecimal data stream, and stores it in the EPPROM of the non-standard protocol conversion gateway after the verification is correct.

[0031] Prior to this, the RS485 interface on the non-standard side of the non-standard protocol conversion gateway transfers the useful data to the MODBUS register after verification according to the defined parsing format. Specifically: the non-standard protocol conversion gateway uses the industrial-grade PIC18F45K80 microcontroller, and opens up a 512-byte communication buffer space on the microcontroller. The RS485 interface on the non-standard side receives non-standard protocol data in the form of interrupts and stores it in the communication buffer space. The microcontroller verifies the received data according to the configuration information of the EPPROM. After the verification is correct, it transfers the valid data to the MODBUS register according to the configuration information in the mapping cell between the valid data and the MODBUS register. The RS485 interface on the non-standard side adopts the design of magnetic isolation circuit and the filter circuit design of the power supply part to meet the operating standards of industrial environments.

[0032] Prioritize, the standard side RS485 interface of the non-standard protocol conversion gateway provides standard MODBUS-RTU data to the outside, realizing the purpose of converting non-standard protocol data into standard protocol data. Specifically: the non-standard side RS485 interface adopts the design of magnetic isolation circuit to improve system stability. The standard side RS485 interface adopts the listening mode. When there is a MODBUS request signal, after the CRC16 check is passed, according to the requested command, the requested data starting address, and the requested data quantity, the single chip extracts the relevant data of the MODBUS register, and then forms a MODBUS protocol packet and returns it to the data requester through the standard side RS485 interface.

[0033] We developed and manufactured a "configurable non-standard protocol conversion gateway". Using the configuration interface of the gateway, through simple conversion protocol configuration, we can parse, read and convert the non-standard protocol data of the reused equipment manufacturer in real time, convert the non-standard protocol data into the standard A11 MODBUS protocol, and realize the Internet of Things access of non-standard data. The comparison with existing gateway products is as follows:

[0034] Flexibility in using functions:

[0035] The configurable non-standard protocol conversion gateway provides a configuration interface, through which the user can define, parse and verify the data stream on the non-standard side. For example, through the configuration interface, specify that the 8th and 9th byte data on the non-standard side be stored in the 5th register of the modbus holding register. The standard protocol side only needs to read the data in the 5th register of the holding register according to the MODBUS protocol to achieve convenient and efficient protocol conversion. On-site engineers only need to perform simple configuration operations to complete the definition and conversion of non-standard protocols.

[0036] Similar protocol conversion products on the market: The conversion between protocols is fixed before sale. For example, DL645 protocol to MODBUS protocol, PPI protocol to MODBUS protocol. Users can only purchase the corresponding protocol conversion product according to their needs.

[0037] Functional versatility:

[0038] The configurable non-standard protocol conversion gateway defines, parses and verifies the data stream on the non-standard side through the configuration interface, and can complete protocol conversion for various private custom protocols. The protocol conversion function is highly versatile and meets the non-standard protocol conversion needs of oil fields and other industries.

[0039] Similar protocol conversion products on the market: Private custom protocols need to send the protocol format description to the protocol conversion product manufacturer, who will then carry out personalized development. After development, the product will be packaged into a product and sold to users. The cost of personalized protocol conversion is generally around 2,000 yuan.

[0040] Protocol conversion without communication port:

[0041] Some PLCs have only one RS485 communication port, which has been occupied by the touch screen. The non-standard side RS485 port of the "configurable non-standard protocol conversion gateway" is connected to this RS485 communication port for passive data monitoring, and then the monitored data is converted to MODBUS protocol.

[0042] There is no similar product on the market

[0043] Example 2

[0044] A configurable non-standard protocol conversion gateway, the hardware structure is as follows Figure 1-Figure 4 As shown, the conversion process includes the following steps:

[0045] Step 1: Use VBA programming software to develop non-standard protocol predefined parsing software, and define the non-standard protocol parsing format in the EXCEL table. Specifically: develop with VBA programming language, use EXCEL spreadsheet as the configuration interface, and use VBA serial port macros to interact with the configuration interface of the non-standard protocol conversion gateway. The configuration software interface consists of 256 cells of EXCEL. The cell number starts from 1, and each cell represents 1 non-standard protocol data bit. The 256 cells of EXCEL are divided into 5 types of cells: byte number cells, start character cells, key bit check cells, mapping cells of valid data and MODBUS registers, and data string check method cells. Each EXCEL cell represents 1 byte of storage space, and a non-standard data byte is represented by 2 to 3 EXCEL cells. The cell type number of the byte number defined in the programming software is 1, which occupies 2 EXCEL cells. The cell type number of the start character is 2, which occupies 2 EXCEL cells. The cell type of the key bit check is 3, which occupies 3 EXCEL cells. The cell type of the mapping of valid data and MODBUS register is 4, which occupies 3 EXCEL cells. The cell type of the data string check method is 5, which occupies 2 EXCEL cells. The key bit check cell type is not unique and can be repeated multiple times in a non-standard data stream parsing definition. The configuration software automatically reads the configuration information in the EXCEL cell and converts the configuration information into a hexadecimal data stream according to the cell order. See Figure 5 Configurable non-standard protocol conversion gateway data flow block diagram.

[0046] For example, enter the following in the EXCEL table: Figure 6 The value of:

[0047] The number 1 of sequence number 1 indicates that the value of sequence number 2 is byte number 24, the number 2 of sequence number 3 indicates that the value of sequence number 4 is the starting byte 81, the number 3 of sequence number 5 indicates that the 4th data check digit of the non-standard data stream of sequence number 6 is 2, the number 4 of sequence number 8 indicates the mapping of non-standard and standard data, and the value 12 of sequence number 9 indicates that the 12th data on the non-standard side is transferred to the No. 1 register of MODBUS specified by sequence number 10. The values ​​of sequence numbers 9 and 10 indicate data string check.

[0048] Step 2: Download the non-standard protocol parsing format data defined in the EXCEL table to the non-standard protocol conversion gateway. Use the serial port macro command of the VBA programming software to initialize the computer serial port parameters and download the configuration information to the EEPROM of the non-standard protocol conversion gateway. Taking the EXCEL table in step 1 as an example, the non-standard protocol predefined parsing software extracts the values ​​in the EXCEL table:

[0049] 24 2 81 3 4 2 4 12 1 4 16 2 4 20 3X X

[0050] Compose a hexadecimal data stream: 0x10x180x20x510x30x40x20x40xc0x10x40x100x20x40x140x3, and download the data stream to the EEPROM of the non-standard protocol conversion gateway.

[0051] Step 3: The non-standard protocol conversion gateway uses the defined parsing format and after verification, the RS485 interface on the non-standard side transfers the useful data to the MODBUS register. Specifically: The non-standard protocol conversion gateway uses the industrial-grade PIC18F45K80 microcontroller, and opens up a 512-byte communication buffer space on the microcontroller. The non-standard side RS485 interface receives non-standard protocol data in the form of interrupts and stores it in the communication buffer space. The microcontroller verifies the received data according to the configuration information of the EPPROM. After the verification is correct, it transfers the valid data to the MODBUS register according to the configuration information in the mapping cell between the valid data and the MODBUS register. The non-standard side RS485 interface adopts the design of magnetic isolation circuit and the filter circuit design of the power supply part to meet the operating standards of industrial environments. See Figure 2 Device Schematic

[0052] Step 4: The RS485 interface on the standard side of the non-standard protocol conversion gateway provides standard MODBUS-RTU data to the outside world, realizing the purpose of converting non-standard protocol data into standard protocol data. Specifically: the RS485 interface on the non-standard side adopts the design of magnetic isolation circuit to improve system stability. The RS485 interface on the standard side adopts the listening mode. When there is a MODBUS request signal, after the CRC16 check is passed, the microcontroller extracts the relevant data of the MODBUS register according to the requested command, the requested data starting address, and the requested data quantity, and then composes a MODBUS protocol packet and returns it to the data requester through the RS485 interface on the standard side. See Figure 2 Device schematic diagram.

[0053] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solutions and concepts of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A conversion method for a configurable non-standard protocol conversion gateway, characterized in that: The steps include: S1: Use VBA programming software to develop non-standard protocol predefined parsing software to define the non-standard protocol parsing format in the EXCEL table; S2: Download the non-standard protocol parsing format data defined in the EXCEL table to the non-standard protocol conversion gateway; S3: The RS485 interface on the non-standard side of the non-standard protocol conversion gateway transfers the useful data to the MODBUS register after verification according to the defined parsing format; S4: The standard side RS485 interface of the non-standard protocol conversion gateway provides standard MODBUS-RTU data to the outside, realizing the conversion of non-standard protocol data into standard protocol data.

2. The configurable non-standard protocol conversion gateway according to claim 1, characterized in that: In the step S1, VBA programming language is used for development, an EXCEL spreadsheet is used as a configuration interface, and VBA serial port macros are used to perform command interaction with the configuration interface of the non-standard protocol conversion gateway.

3. The configurable non-standard protocol conversion gateway according to claim 2, characterized in that: In the step S1, the configuration software interface consists of 256 cells of EXCEL, the cell number starts from 1, each cell represents 1 non-standard protocol data bit, and the 256 cells of EXCEL are divided into 5 cell types: byte number cell, starting character cell, key bit check cell, valid data and MODBUS register mapping cell, and data string verification method cell. Each EXCEL cell represents 1 byte storage space, and a non-standard data byte is represented by 2 to 3 EXCEL cells; the byte number cell type number is defined in the programming software as 1, occupying 2 EXCEL cells, the starting character cell type number is 2, occupying 2 EXCEL cells, the key bit check cell type is 3, occupying 3 EXCEL cells, the valid data and MODBUS register mapping cell type is 4, occupying 3 EXCEL cells, and the data string verification method cell type is 5, occupying 2 EXCEL cells, wherein the key bit check cell type is not unique and is repeated multiple times in a non-standard data stream parsing definition.

4. The configurable non-standard protocol conversion gateway according to claim 3, characterized in that: In step S1, the configuration software automatically reads the configuration information in the EXCEL cells and converts the configuration information into a hexadecimal data stream according to the cell sequence.

5. The configurable non-standard protocol conversion gateway according to claim 4, characterized in that: In step S2, the serial port macro of the configuration software application VBA sends a hexadecimal data stream to the non-standard protocol conversion gateway, and the non-standard protocol conversion gateway verifies the hexadecimal data stream, and stores it in the EPPROM of the non-standard protocol conversion gateway after the verification is correct.

6. The configurable non-standard protocol conversion gateway according to claim 5, characterized in that: In step S3, the non-standard protocol conversion gateway uses an industrial-grade PIC18F45K80 single-chip microcomputer, and a 512-byte communication buffer space is opened in the single-chip microcomputer.

7. The configurable non-standard protocol conversion gateway according to claim 6, characterized in that: In step S3, the non-standard side RS485 interface receives non-standard protocol data in the form of interruption and stores it in the communication buffer space. The single-chip microcomputer verifies the received data according to the configuration information of the EPPROM. After the verification is correct, the valid data is transferred to the MODBUS register according to the configuration information in the mapping cell between the valid data and the MODBUS register. The non-standard side RS485 interface adopts a magnetic isolation circuit, and the power supply part adopts a filtering circuit.

8. The configurable non-standard protocol conversion gateway according to claim 7, characterized in that: In the step S4, the non-standard side RS485 interface adopts a magnetic isolation circuit to improve system stability, and the standard side RS485 interface adopts a listening mode. When there is a MODBUS request signal, after passing the CRC16 check, the single-chip microcomputer extracts the relevant data of the MODBUS register according to the requested command, the requested data starting address, and the requested data quantity, and then composes a MODBUS protocol packet and returns it to the data requester through the standard side RS485 interface.