CN117614799A - Sensor protocol adaptation method and device based on model hierarchical mapping - Google Patents

Sensor protocol adaptation method and device based on model hierarchical mapping Download PDF

Info

Publication number
CN117614799A
CN117614799A CN202311707826.7A CN202311707826A CN117614799A CN 117614799 A CN117614799 A CN 117614799A CN 202311707826 A CN202311707826 A CN 202311707826A CN 117614799 A CN117614799 A CN 117614799A
Authority
CN
China
Prior art keywords
sensor
protocol
data
model
template
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311707826.7A
Other languages
Chinese (zh)
Inventor
李峰
代飞
张建民
赵李萍
孙剑桥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Systems Engineering of PLA Academy of Military Sciences
Original Assignee
Institute of Systems Engineering of PLA Academy of Military Sciences
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Systems Engineering of PLA Academy of Military Sciences filed Critical Institute of Systems Engineering of PLA Academy of Military Sciences
Priority to CN202311707826.7A priority Critical patent/CN117614799A/en
Publication of CN117614799A publication Critical patent/CN117614799A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/02Standardisation; Integration
    • H04L41/022Multivendor or multi-standard integration
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/145Network analysis or design involving simulating, designing, planning or modelling of a network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/12Protocol engines
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a sensor protocol adaptation method and a device based on model layering mapping, wherein the method comprises the following steps: analyzing the sensor equipment to obtain a protocol document of the sensor equipment; template design is carried out according to the protocol document of the sensor equipment to obtain a sensor equipment protocol template, and the sensor equipment protocol template is uploaded to a system supporting sensor protocol adaptation service; extracting features of the sensor equipment protocol template to obtain sensor feature information; the sensor characteristic information forms a sensor characteristic information base; processing the sensor equipment to be supported by using the protocol adaptation model to obtain a data protocol adaptation result of the sensor equipment; the protocol adaptation model comprises a protocol template evaluation unit, an adaptation engine unit and a result expression unit. The method realizes unified expression of different Internet of things manufacturers and different types of sensor protocols by designing a sensor universal protocol template based on a layered model.

Description

Sensor protocol adaptation method and device based on model hierarchical mapping
Technical Field
The invention relates to the technical field of communication of the Internet of things, in particular to a sensor protocol adaptation method and device based on model hierarchical mapping.
Background
Along with the rapid development of the industry of the Internet of things, the sensor network technology also makes great progress, and various manufacturers sequentially develop a large number of sensors of different types to meet different requirements of various industries. The main function of the sensor is to collect sensing information, and the main problems faced at present are as follows:
1) The communication protocols defined when the sensors are produced by the respective manufacturers are different. Because the hardware interfaces are different, the sensor equipment adopts a plurality of communication protocol, and the problem is that the data acquisition system needs to support a plurality of different communication protocols at the same time, and the data acquisition function needs to be realized by independently coding various protocols.
2) The data format and the meaning of the data of each heterogeneous sensor are different, and various data identification formats exist in the collected data packet.
Currently, to access the sensors of different manufacturers, the user must perform secondary development of the system according to the corresponding protocol content of the sensors of each manufacturer, which not only increases the difficulty and complexity of program development, but also results in repeated work of code development, is easy to make mistakes and has very poor universality.
Disclosure of Invention
The invention aims to solve the technical problem of providing a sensor protocol adaptation method and a device based on model hierarchical mapping, designing a general sensor protocol template to be compatible with the expression of heterogeneous sensor data protocol contents of various vendors in the market, wherein the template is divided into three layers: the protocol model layer, the data model layer and the result model layer can realize mapping and expression work on the content of the sensing data through the cooperation of the three models.
In order to solve the above technical problems, a first aspect of the present invention discloses a sensor protocol adaptation method based on model hierarchical mapping, where the method includes:
s1, analyzing sensor equipment to obtain a protocol document of the sensor equipment;
s2, carrying out template design according to the protocol document of the sensor equipment to obtain a sensor equipment protocol template, and uploading the sensor equipment protocol template to a system supporting sensor protocol adaptation service;
the sensor equipment protocol templates form a template library;
s3, extracting features of the sensor equipment protocol template to obtain sensor feature information;
the sensor characteristic information forms a sensor characteristic information base;
S4, processing the sensor equipment to be supported by using a protocol adaptation model to obtain a data protocol adaptation result of the sensor equipment;
the protocol adaptation model comprises a protocol template evaluation unit, an adaptation engine unit and a result expression unit.
As an optional implementation manner, in the first aspect of the embodiment of the present invention, the sensor device protocol template includes a protocol model layer, a data model layer, and a result model layer;
the protocol model layer is used for extracting a complete data frame of the sensor application data protocol and designating a data model layer associated with the complete data frame;
the data model layer is used for extracting effective load of sensor application data, storing data nodes in logic variables and designating a result model layer of the data nodes;
and the result model layer is used for carrying out logic operation on the data nodes to obtain a logic operation result.
In a first aspect of the embodiment of the present invention, the feature extraction of the sensor device protocol template to obtain sensor feature information includes:
s31, extracting key features of the sensor equipment protocol template to obtain N key feature character strings, wherein N is an integer;
S32, carrying out feature fusion on the N key feature strings to obtain sensor feature information.
In a first aspect of the embodiment of the present invention, the processing, by using a protocol adaptation model, a sensor device to be supported to obtain a data protocol adaptation result of the sensor device includes:
s41, processing the sensor equipment to be supported by using a protocol template evaluation unit to obtain a sensor equipment protocol template adapted to the sensor equipment;
s42, according to the sensor equipment protocol template adapted to the sensor equipment, data processing is carried out on the sensor equipment to be supported, and a sensor equipment data protocol adaptation result is obtained.
As an optional implementation manner, in the first aspect of the embodiment of the present invention, the processing, by using a protocol template evaluation unit, a sensor device to be supported to obtain a sensor device protocol template adapted to the sensor device includes:
s411, processing the sensor equipment to be supported by using a protocol template evaluation unit to obtain sensor equipment data;
s412, analyzing the sensor equipment data to obtain a characteristic character string of the sensor equipment data;
S413, inquiring the sensor characteristic information in a sensor characteristic information base by using a preset sensor characteristic information inquiry model to obtain a sensor equipment protocol template with the sensor equipment data adaptation.
As an optional implementation manner, in a first aspect of the embodiment of the present invention, the processing data of the sensor device to be supported according to the sensor device protocol template adapted to the sensor device to obtain a sensor device data protocol adaptation result includes:
s421, carrying out data preprocessing on the sensor equipment to be supported by utilizing an adaptation engine unit according to a sensor equipment protocol template adapted by the sensor equipment to obtain sensor equipment preprocessing data;
s422, extracting key nodes from the sensor equipment preprocessing data to obtain key node information;
s423, mapping the key node information to a sensor equipment protocol template result model layer by using a result expression unit to obtain a sensor equipment data protocol adaptation result.
As an alternative implementation manner, in the first aspect of the embodiment of the present invention, the sensor device protocol template is designed based on a uci database;
The database table of the sensor equipment protocol template comprises a model structure field, a pnodeX structure field, a len structure field, a name structure field, a type structure field, a show structure field, a dnodeX structure field, a rnodeX structure field, a symbol structure field, an endian structure field, an expr structure field and a unit structure field;
the model structure field is used for designating model layer names of a declaration protocol model layer, a data model layer and a result model layer contained in the current template;
the pnodeX structure field is used for specifying the constituent nodes of the protocol model;
the len structure field is used for defining the byte number of the composition node;
the name structure field is used for defining the names of the constituent nodes;
the type structure field is used for defining the type of the composition node;
the show structure field is used for describing whether the content expressed by the composition nodes needs to be displayed and presented in the result expression;
the dnodeX structure field is used for defining the composition nodes of the data model;
the rnodeX structure field is used for defining the composition nodes of the result model;
the symbol structure field is used for carrying out logic variable expression;
the endian structure field is used for carrying out size end byte order description;
The expr structure field is used for carrying out calculation expression;
the unit structure field is used for defining a result numerical unit.
The second aspect of the embodiment of the invention discloses a sensor protocol adapting device based on model hierarchical mapping, which comprises the following components:
the sensor equipment analysis module is used for analyzing the sensor equipment to obtain a protocol document of the sensor equipment;
the template design module is used for carrying out template design according to the protocol document of the sensor equipment to obtain a sensor equipment protocol template, and uploading the sensor equipment protocol template to a system supporting sensor protocol adaptation service;
the sensor equipment protocol templates form a template library;
the template feature extraction module is used for extracting features of the sensor equipment protocol template to obtain sensor feature information;
the sensor characteristic information forms a sensor characteristic information base;
the sensor equipment protocol adaptation module is used for processing the sensor equipment to be supported by utilizing the protocol adaptation model to obtain a sensor equipment data protocol adaptation result;
the protocol adaptation model comprises a protocol template evaluation unit, an adaptation engine unit and a result expression unit.
As an optional implementation manner, in the first aspect of the embodiment of the present invention, the sensor device protocol template includes a protocol model layer, a data model layer, and a result model layer;
the protocol model layer is used for extracting a complete data frame of the sensor application data protocol and designating a data model layer associated with the complete data frame;
the data model layer is used for extracting effective load of sensor application data, storing data nodes in logic variables and designating a result model layer of the data nodes;
and the result model layer is used for carrying out logic operation on the data nodes to obtain a logic operation result.
In a second aspect of the embodiment of the present invention, the feature extraction of the sensor device protocol template to obtain sensor feature information includes:
s31, extracting key features of the sensor equipment protocol template to obtain N key feature character strings, wherein N is an integer;
s32, carrying out feature fusion on the N key feature strings to obtain sensor feature information.
In a second aspect of the embodiment of the present invention, the processing, by using a protocol adaptation model, the sensor device to be supported to obtain a data protocol adaptation result of the sensor device includes:
S41, processing the sensor equipment to be supported by using a protocol template evaluation unit to obtain a sensor equipment protocol template adapted to the sensor equipment;
s42, according to the sensor equipment protocol template adapted to the sensor equipment, data processing is carried out on the sensor equipment to be supported, and a sensor equipment data protocol adaptation result is obtained.
In a second aspect of the embodiment of the present invention, the processing, by using a protocol template evaluation unit, a sensor device to be supported to obtain a sensor device protocol template adapted to the sensor device includes:
s411, processing the sensor equipment to be supported by using a protocol template evaluation unit to obtain sensor equipment data;
s412, analyzing the sensor equipment data to obtain a characteristic character string of the sensor equipment data;
s413, inquiring the sensor characteristic information in a sensor characteristic information base by using a preset sensor characteristic information inquiry model to obtain a sensor equipment protocol template with the sensor equipment data adaptation.
In a second aspect of the embodiment of the present invention, the processing data of the sensor device to be supported according to the sensor device protocol template adapted to the sensor device to obtain a sensor device data protocol adaptation result includes:
S421, carrying out data preprocessing on the sensor equipment to be supported by utilizing an adaptation engine unit according to a sensor equipment protocol template adapted by the sensor equipment to obtain sensor equipment preprocessing data;
s422, extracting key nodes from the sensor equipment preprocessing data to obtain key node information;
s423, mapping the key node information to a sensor equipment protocol template result model layer by using a result expression unit to obtain a sensor equipment data protocol adaptation result.
As an alternative implementation manner, in the second aspect of the embodiment of the present invention, the sensor device protocol template is designed based on a uci database;
the database table of the sensor equipment protocol template comprises a model structure field, a pnodeX structure field, a len structure field, a name structure field, a type structure field, a show structure field, a dnodeX structure field, a rnodeX structure field, a symbol structure field, an endian structure field, an expr structure field and a unit structure field;
the model structure field is used for designating model layer names of a declaration protocol model layer, a data model layer and a result model layer contained in the current template;
the pnodeX structure field is used for specifying the constituent nodes of the protocol model;
The len structure field is used for defining the byte number of the composition node;
the name structure field is used for defining the names of the constituent nodes;
the type structure field is used for defining the type of the composition node;
the show structure field is used for describing whether the content expressed by the composition nodes needs to be displayed and presented in the result expression;
the dnodeX structure field is used for defining the composition nodes of the data model;
the rnodeX structure field is used for defining the composition nodes of the result model;
the symbol structure field is used for carrying out logic variable expression;
the endian structure field is used for carrying out size end byte order description;
the expr structure field is used for carrying out calculation expression;
the unit structure field is used for defining a result numerical unit.
The third aspect of the invention discloses another sensor protocol adapting device based on model hierarchical mapping, which comprises:
a memory storing executable program code;
a processor coupled to the memory;
the processor invokes the executable program code stored in the memory to perform some or all of the steps in the sensor protocol adaptation method based on model hierarchical mapping disclosed in the first aspect of the embodiment of the present invention.
A fourth aspect of the invention discloses a computer-readable medium storing computer instructions which, when invoked, are adapted to perform part or all of the steps of the model-hierarchical-mapping-based sensor protocol adaptation method disclosed in the first aspect of the embodiments of the invention.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
(1) The sensor protocol adaptation method provided by the invention realizes unified expression of different Internet of things manufacturers and different types of sensor protocols by designing a sensor universal protocol template realized based on a layered model;
(2) Based on the realized sensor universal protocol template, the analysis, verification, operation and expression of the sensor data are completed, and finally the standard content is output, so that the heterogeneous communication data protocol is shielded for the upper layer application;
(3) By designing the protocol template evaluation unit, a great amount of analysis time consumed by the adaptation work when the built-in templates are too many is avoided;
(4) The method of the invention exists in the system in an independent service mode, and adopts a unified internal communication interface, thereby greatly reducing the coupling with different acquisition modules and different service modules.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a sensor protocol adaptation method based on model hierarchical mapping according to an embodiment of the present invention;
FIG. 2 is a flow chart of another sensor protocol adaptation method based on model hierarchical mapping according to an embodiment of the present invention;
FIG. 3 is a diagram of a sensor device protocol template according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a data model map disclosed in an embodiment of the present invention;
FIG. 5 is a diagram of a protocol model layer database disclosed in an embodiment of the present invention;
FIG. 6 is a diagram of a data model and results model layer database disclosed in an embodiment of the present invention;
FIG. 7 is a protocol adaptation flow chart disclosed in an embodiment of the present invention
FIG. 8 is a schematic structural diagram of a sensor protocol adaptation device based on model hierarchical mapping according to an embodiment of the present invention;
Fig. 9 is a schematic structural diagram of another sensor protocol adaptation device based on model hierarchical mapping according to an embodiment of the present invention.
Detailed Description
In order to make the present invention better understood by those skilled in the art, the following description will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms first, second and the like in the description and in the claims and in the above-described figures are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, apparatus, article, or device that comprises a list of steps or elements is not limited to the list of steps or elements but may, in the alternative, include other steps or elements not expressly listed or inherent to such process, method, article, or device.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the invention. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
The invention discloses a sensor protocol adaptation method and a device based on model layering mapping, wherein the method comprises the following steps: analyzing the sensor equipment to obtain a protocol document of the sensor equipment; template design is carried out according to the protocol document of the sensor equipment to obtain a sensor equipment protocol template, and the sensor equipment protocol template is uploaded to a system supporting sensor protocol adaptation service; the sensor equipment protocol templates form a template library; extracting features of the sensor equipment protocol template to obtain sensor feature information; the sensor characteristic information forms a sensor characteristic information base; processing the sensor equipment to be supported by using the protocol adaptation model to obtain a data protocol adaptation result of the sensor equipment; the protocol adaptation model comprises a protocol template evaluation unit, an adaptation engine unit and a result expression unit. The method realizes unified expression of different Internet of things manufacturers and different types of sensor protocols by designing a sensor universal protocol template based on a layered model. The following will describe in detail.
Example 1
Referring to fig. 1, fig. 1 is a schematic flow chart of a sensor protocol adaptation method based on model hierarchical mapping according to an embodiment of the present invention. The sensor protocol adaptation method based on model hierarchical mapping described in fig. 1 is applied to the technical field of internet of things communication, and uses a general sensor protocol template to be compatible with expression of heterogeneous sensor data protocol contents of various vendors in the market. As shown in fig. 1, the sensor protocol adaptation method based on the model hierarchical mapping may include the following operations:
s1, analyzing sensor equipment to obtain a protocol document of the sensor equipment;
s2, carrying out template design according to the protocol document of the sensor equipment to obtain a sensor equipment protocol template, and uploading the sensor equipment protocol template to a system supporting sensor protocol adaptation service;
the sensor equipment protocol templates form a template library;
s3, extracting features of the sensor equipment protocol template to obtain sensor feature information;
the sensor characteristic information forms a sensor characteristic information base;
s4, processing the sensor equipment to be supported by using a protocol adaptation model to obtain a data protocol adaptation result of the sensor equipment;
The protocol adaptation model comprises a protocol template evaluation unit, an adaptation engine unit and a result expression unit.
Optionally, the sensor device protocol template includes a protocol model layer, a data model layer, and a result model layer;
the protocol model layer is used for extracting a complete data frame of the sensor application data protocol and designating a data model layer associated with the complete data frame;
the data model layer is used for extracting effective load of sensor application data, storing data nodes in logic variables and designating a result model layer of the data nodes;
and the result model layer is used for carrying out logic operation on the data nodes to obtain a logic operation result.
Optionally, the extracting features of the sensor device protocol template to obtain sensor feature information includes:
s31, extracting key features of the sensor equipment protocol template to obtain N key feature character strings, wherein N is an integer;
the key features are mainly to select the necessary fields composed of different manufacturer protocols, such as a protocol frame head, a protocol frame tail, a device type, manufacturer information and the like. Obtaining N key character strings with the formats of { "ee00", "13b2f4e6", "cb65", "ff00" }, wherein N is an integer;
S32, carrying out feature fusion on the N key feature strings to obtain sensor feature information.
Because different character strings express different characteristics, a method of quasi-regular expression is needed to be introduced before characteristic fusion to improve matching efficiency and accuracy, for example, the characteristics of a protocol frame head and a protocol frame tail are that only 1 protocol data exists and a clear sequence rule exists, the characteristics of equipment type and manufacturer information are that a plurality of protocol data exist, intervals among different protocol characteristics need to be formulated into interval ranges according to actual conditions, and the characteristic fusion forms are as per 1/g/ee00// { n >1}/13b2f4e6// { |/{ n >1}/cb65//1/g/ff00/, and finally, the sensor characteristic information is obtained.
Optionally, the processing the sensor device to be supported by using the protocol adaptation model to obtain a data protocol adaptation result of the sensor device includes:
s41, processing the sensor equipment to be supported by using a protocol template evaluation unit to obtain a sensor equipment protocol template adapted to the sensor equipment;
s42, according to the sensor equipment protocol template adapted to the sensor equipment, data processing is carried out on the sensor equipment to be supported, and a sensor equipment data protocol adaptation result is obtained.
Optionally, the processing, by using a protocol template evaluation unit, the sensor device to be supported to obtain a sensor device protocol template adapted to the sensor device includes:
s411, processing the sensor equipment to be supported by using a protocol template evaluation unit to obtain sensor equipment data;
s412, analyzing the sensor equipment data to obtain a characteristic character string of the sensor equipment data;
s413, inquiring the sensor characteristic information in a sensor characteristic information base by using a preset sensor characteristic information inquiry model to obtain a sensor equipment protocol template with the sensor equipment data adaptation.
The method comprises the steps of inquiring sensor characteristic information in a sensor characteristic information base by using a preset sensor characteristic information inquiring model, firstly constructing the sensor characteristic information into a finite state pattern matching machine, constructing a pattern matching machine stage algorithm, establishing three core functions, namely a steering function goto (steering relation between characteristic states), a failure function failure (steering relation between states in the case of matching failure), and an output function output (referring to a relation between the states and a pattern string), and secondly, sending a text character string as input into the pattern matching machine for matching. And finally, inquiring the sensor characteristic information in a sensor characteristic information base to obtain a sensor equipment protocol template with the sensor equipment data adaptation.
Optionally, the data processing is performed on the sensor device to be supported according to the sensor device protocol template adapted to the sensor device to obtain a sensor device data protocol adaptation result, including:
s421, carrying out data preprocessing on the sensor equipment to be supported by utilizing an adaptation engine unit according to a sensor equipment protocol template adapted by the sensor equipment to obtain sensor equipment preprocessing data;
the data preprocessing mainly realizes a module of a down-conversion buffer zone, firstly, the module can finish screening any repeated redundant data entering the buffer according to the appointed frequency, secondly, the data which is not analyzed at this time can be stored to prevent the phenomena of sticking, and the like, and finally, the sensor equipment preprocessing data is obtained;
s422, extracting key nodes from the sensor equipment preprocessing data to obtain key node information;
s423, mapping the key node information to a sensor equipment protocol template result model layer by using a result expression unit to obtain a sensor equipment data protocol adaptation result.
Optionally, the sensor device protocol template is designed based on a uci database;
The database table of the sensor equipment protocol template comprises a model structure field, a pnodeX structure field, a len structure field, a name structure field, a type structure field, a show structure field, a dnodeX structure field, a rnodeX structure field, a symbol structure field, an endian structure field, an expr structure field and a unit structure field;
the model structure field is used for designating model layer names of a declaration protocol model layer, a data model layer and a result model layer contained in the current template;
the pnodeX structure field is used for specifying the constituent nodes of the protocol model;
the len structure field is used for defining the byte number of the composition node;
the name structure field is used for defining the names of the constituent nodes;
the type structure field is used for defining the type of the composition node;
the show structure field is used for describing whether the content expressed by the composition nodes needs to be displayed and presented in the result expression;
the dnodeX structure field is used for defining the composition nodes of the data model;
the rnodeX structure field is used for defining the composition nodes of the result model;
the symbol structure field is used for carrying out logic variable expression;
the endian structure field is used for carrying out size end byte order description;
The expr structure field is used for carrying out calculation expression;
the unit structure field is used for defining a result numerical unit.
Example two
Referring to fig. 2, fig. 2 is a flow chart of another sensor protocol adaptation method based on model hierarchical mapping according to an embodiment of the present invention. The sensor protocol adaptation method based on model hierarchical mapping described in fig. 2 is applied to the technical field of internet of things communication, and uses a general sensor protocol template to be compatible with expression of heterogeneous sensor data protocol contents of various vendors in the market. As shown in fig. 2, the sensor protocol adaptation method based on the model hierarchical mapping may include the following operations:
the first objective of the present invention is to design a generic sensor protocol template to be compatible with the expression of heterogeneous sensor data protocol contents of various vendors in the market, wherein the template is divided into three layers: the protocol model layer, the data model layer and the result model layer can realize mapping and expression work on the content of sensing data through the cooperation of the three models, and fig. 3 is a structure diagram of a protocol template of the sensor device disclosed by the embodiment of the invention.
The specific responsible work of each model layer in the sensor protocol universal template is as follows:
Complete data frame extraction of the sensor application data protocol and the assignment of the associated data model layer can be completed through the protocol model layer of the sensor protocol template, extraction of the sensor application data payload can be completed through the data model layer of the sensor protocol template, and after extraction, different data nodes are stored in logic variables and the associated result model layer is assigned. Through the result model layer of the sensor protocol template, logic operation of different data nodes can be completed, and finally expression content and operation results can be output in a self-defined mode.
The technical scheme for realizing the first purpose of the invention is as follows: a sensor protocol template structure based on uci (a small database with lightweight features) definition was designed. The database table structure field includes: model, pnodeX, len, name, type, show, dnodeX, rnodeX, symbol, endian, expr, unit. The specific description is as follows:
model: the name of the model layer contained in the current template is specified, and mainly the names of the declaration protocol, the data and the result model layer are specified.
pnodeX: the constituent nodes of the protocol model, here, the constituent nodes may be pnode1, pnode2 … pnode n.
len: the number of bytes that make up a node, for example, a header node definition may be a 4 byte identification such as 0x 12345678.
name: the names of the constituent nodes, this field is designed for ease of reading.
type: the type of constituent nodes, the type of support includes a fly (length specified, byte length of a particular node container can be specified, number indicates how many bits forward and backward, number indicates the number from head to the node), check (data check information, by check algorithm), data (data node, this type of node must declare an associated data model name), head (header information to segment data content), tail (trailer information to segment data content).
show: whether the content of the constituent node expressions needs to be presented in the result expression.
dnodeX: the constituent nodes of the data model, here, the constituent nodes may be dnode1, dnode2 … dnode n.
rnodeX: the component nodes of the result model, here, the component nodes may be rnode1, rnode2 … rnodeN.
symbol: the expression of a logic variable is mainly expressed to store the expression values of a plurality of data nodes into a certain temporary variable.
endian: the size end byte order can be defined when the length of the component nodes is greater than 1, and defaults to network byte order.
expr: calculating expression, and performing mathematical operation on logic variables stored by different composition nodes.
unit: and (3) a result numerical value unit, wherein a unit definition is given to the operation result.
Through the sensor protocol template which can be dynamically expanded and is designed, unified translation work of various sensor protocol data of different factories can be completed.
The second object of the present invention is to provide a method for adapting a sensor protocol, which completes content translation for data protocol templates of different manufacturers based on a designed general sensor protocol template, and can combine the parsed data results into json form according to a custom configuration and output.
The technical scheme for realizing the second purpose of the invention is as follows: a protocol adaptation model is designed, and comprises a protocol template evaluation unit, an adaptation engine unit and a result expression unit.
The protocol template evaluation unit mainly completes the work: after sensor data enter the model, the general method is to poll all the currently built-in sensor protocol templates and then complete node content extraction according to specific mapping specifications, the unit provides a template evaluation mechanism, namely a multi-mode character string is formed by a plurality of key characteristic fields (at least one key characteristic field exists) of each template as a matching string, whether each protocol template is possibly applicable to the data is presumed by using an AC (Aho-Corasick algorithm) according to the content of the transmitted data, and then polling analysis is carried out after sequencing the protocol templates again, so that the efficiency of sensor protocol adaptation is greatly improved.
The adaptation engine unit mainly performs the following tasks: after the sensor searches a possible applicable template, according to the description of the nodes formed by the protocol model layer and the data model layer which are defined in the template, the content extraction of key nodes is completed for the sensor protocol data, and the effective range of the original data content of the real sensor is not necessarily from the first byte due to factors such as sticky packets, incomplete data transmission content and the like.
The result expression unit mainly performs the following work: the key data nodes disassembled according to the adaptation engine unit can be mapped to a result model layer, the layer mainly completes two parts of work, one part of the layer completes quantitative definition of a result according to different key data node combination operations, and the other part of the layer supports json to complete output in a self-defined key value name expression mode.
The protocol adaptation model exists in the system in a service form, and sensor data protocols acquired by different hardware physical interfaces can transmit sensor original data to the module through an API interface matched with the service according to actual requirements and then directly process and return results.
Based on the technical scheme of the invention, when the sensor protocol adaptation needs to be completed, the following general steps can be adopted:
(1) Referring to a protocol document of the sensor equipment to be supported, designing different protocol templates according to different types of sensors, and uploading the templates to a system supporting sensor protocol adaptation model service;
(2) Forwarding the collected data content to a sensor protocol adaptation service through calling a matched communication interface;
(3) The protocol adaptation service finds a possible applicable template according to the characteristic identification defined in the sensor protocol template, if the applicable template cannot be found, failure information is returned immediately, otherwise, the process is carried out (4);
(4) The protocol adaptation service completes the sensor data preprocessing work based on the selected templates, and then enters (5);
(5) The protocol adaptation service continuously completes extraction of key nodes of the protocol model based on the processed data, and the protocol adaptation service comprises checking information, data model association, result model association and the like, and completes protocol checking at the same time, if the checking is wrong, failure information is returned immediately, otherwise, the next step is carried out;
(6) The protocol adaptation service analyzes the constituent nodes associated with the protocol model and then maps the nodes into logical variables after combining. Then enter (6);
(7) And (3) finishing the quantitative definition of the sensor result by using logic variables derived from the data model through mathematical operation, and finishing the output of the final result in json form expression. FIG. 4 is a schematic diagram of a data model map disclosed in an embodiment of the present invention; FIG. 5 is a diagram of a protocol model layer database disclosed in an embodiment of the present invention; FIG. 6 is a diagram of a data model and results model layer database disclosed in an embodiment of the present invention.
Example III
The sensor protocol adaptation method provided by the embodiment comprises the following steps:
1. issuing a set of protocol templates of temperature and humidity to the operated protocol adaptation service according to the protocol description of the temperature and humidity sensor of a certain manufacturer;
2. when a sensor protocol is received, firstly, all types of nodes with head in each protocol template are completely extracted into variables according to the actual length to form a matching string, and screening is completed based on the original data; if screening is not matched, failure information is returned immediately, data is stored in a fingerprint database for subsequent analysis, and screening is successful, so that the next step is carried out;
3. when the matching template is confirmed, according to a protocol model defined in the template, including a head node (head), an address node (data), a control word (enum), a packet sequence number (enum), a data feature (head), a data expression association (dnode) and a check mode (check), screening out the protocol node based on the definitions, then finishing the check, returning failure information immediately when the check is wrong, extracting the data node when the check is correct, and entering the next step;
4. After the mapping of the protocol model is successful, since the output of the sensor used in the embodiment is temperature and humidity, all 2 data association expressions (dnode 1, dnode 2) are respectively data length (2 bytes), data type (int 16), logical variable name (x_4_1), data length (1 byte), data type (unit 8), logical variable name (x_5_1), the data node extracted in the previous step is translated into a specific numerical value according to the definition, assignment of the logical variables (x_4_1, x_5_1) is completed, and then the next step is entered;
5. after the data model mapping is completed, the model layer definition is combined based on the 2 logic variables obtained in the last step: output name (temperature), unit (deg.c), calculation method (x_4_1/10), output name (humidity), unit (%), calculation method (x_5_1), and then output the result content, the principle of the three-layer model map described above is schematically shown in fig. 3.
6. Sensor protocol adaptation is complete, see in particular the flow chart of fig. 7.
Example IV
Referring to fig. 8, fig. 8 is a schematic structural diagram of another sensor protocol adapting device based on model hierarchical mapping according to an embodiment of the present invention. The sensor protocol adapting device based on model hierarchical mapping described in fig. 8 is applied to the technical field of communication of the internet of things, and uses a general sensor protocol template to be compatible with expression of heterogeneous sensor data protocol contents of various vendors in the market. As shown in fig. 8, the sensor protocol adaptation device based on the model hierarchical mapping may include the following operations:
S301, a sensor device analysis module is used for analyzing the sensor device to obtain a protocol document of the sensor device;
s302, a template design module is used for carrying out template design according to the protocol document of the sensor equipment to obtain a sensor equipment protocol template, and uploading the sensor equipment protocol template to a system supporting sensor protocol adaptation service;
the sensor equipment protocol templates form a template library;
s303, a template feature extraction module is used for extracting features of the sensor equipment protocol template to obtain sensor feature information;
the sensor characteristic information forms a sensor characteristic information base;
s304, a sensor equipment protocol adaptation module is used for processing the sensor equipment to be supported by utilizing a protocol adaptation model to obtain a sensor equipment data protocol adaptation result;
the protocol adaptation model comprises a protocol template evaluation unit, an adaptation engine unit and a result expression unit.
Example five
Referring to fig. 9, fig. 9 is a schematic structural diagram of another sensor protocol adapting device based on model hierarchical mapping according to an embodiment of the present invention. The sensor protocol adapting device based on model hierarchical mapping described in fig. 9 is applied to the technical field of communication of the internet of things, and uses a general sensor protocol template to be compatible with expression of heterogeneous sensor data protocol contents of various vendors in the market. As shown in fig. 9, the sensor protocol adaptation device based on the model hierarchical mapping may include the following operations:
A memory 401 storing executable program codes;
a processor 402 coupled with the memory 401;
the processor 402 invokes executable program code stored in the memory 401 for performing the steps in the sensor protocol adaptation method based on model hierarchical mapping described in embodiment one, embodiment two.
Example six
The embodiment of the invention discloses a computer readable storage medium storing a computer program for electronic data exchange, wherein the computer program enables a computer to perform the steps in the sensor protocol adaptation method based on model hierarchical mapping described in the first and second embodiments.
The apparatus embodiments described above are merely illustrative, in which the models illustrated as separate components may or may not be physically separate, and the components shown as models may or may not be physical models, i.e., may be located in one place, or may be distributed over multiple network models. Some or all of the models can be selected according to actual needs to achieve the purpose of the scheme of the embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above detailed description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course by means of hardware. Based on such understanding, the foregoing technical solutions may be embodied essentially or in part in the form of a software product that may be stored in a computer-readable storage medium including Read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), programmable Read-Only Memory (Programmable Read-Only Memory, PROM), erasable programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), one-time programmable Read-Only Memory (OTPROM), electrically erasable programmable Read-Only Memory (EEPROM), compact disc Read-Only Memory (Compact Disc Read-Only Memory, CD-ROM) or other optical disc Memory, magnetic disc Memory, tape Memory, or any other medium that can be used for computer-readable carrying or storing data.
Finally, it should be noted that: the embodiment of the invention discloses a sensor protocol adaptation method and device based on model hierarchical mapping, which are disclosed by the embodiment of the invention only for illustrating the technical scheme of the invention, but not limiting the technical scheme; although the invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art will understand that; the technical scheme recorded in the various embodiments can be modified or part of technical features in the technical scheme can be replaced equivalently; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (10)

1. A sensor protocol adaptation method based on model hierarchical mapping, the method comprising:
s1, analyzing sensor equipment to obtain a protocol document of the sensor equipment;
s2, carrying out template design according to the protocol document of the sensor equipment to obtain a sensor equipment protocol template, and uploading the sensor equipment protocol template to a system supporting sensor protocol adaptation service;
the sensor equipment protocol templates form a template library;
S3, extracting features of the sensor equipment protocol template to obtain sensor feature information;
the sensor characteristic information forms a sensor characteristic information base;
s4, processing the sensor equipment to be supported by using a protocol adaptation model to obtain a data protocol adaptation result of the sensor equipment;
the protocol adaptation model comprises a protocol template evaluation unit, an adaptation engine unit and a result expression unit.
2. The sensor protocol adaptation method based on model hierarchical mapping according to claim 1, wherein the sensor device protocol templates comprise a protocol model layer, a data model layer and a result model layer;
the protocol model layer is used for extracting a complete data frame of the sensor application data protocol and designating a data model layer associated with the complete data frame;
the data model layer is used for extracting effective load of sensor application data, storing data nodes in logic variables and designating a result model layer of the data nodes;
and the result model layer is used for carrying out logic operation on the data nodes to obtain a logic operation result.
3. The sensor protocol adaptation method based on model hierarchical mapping according to claim 1, wherein the feature extraction is performed on the sensor device protocol template to obtain sensor feature information, and the method comprises:
S31, extracting key features of the sensor equipment protocol template to obtain N key feature character strings, wherein N is an integer;
s32, carrying out feature fusion on the N key feature strings to obtain sensor feature information.
4. The sensor protocol adaptation method based on model hierarchical mapping according to claim 1, wherein the processing the sensor device to be supported by using the protocol adaptation model to obtain a sensor device data protocol adaptation result comprises:
s41, processing the sensor equipment to be supported by using a protocol template evaluation unit to obtain a sensor equipment protocol template adapted to the sensor equipment;
s42, according to the sensor equipment protocol template adapted to the sensor equipment, data processing is carried out on the sensor equipment to be supported, and a sensor equipment data protocol adaptation result is obtained.
5. The sensor protocol adaptation method based on model hierarchical mapping according to claim 4, wherein the processing the sensor device to be supported by using the protocol template evaluation unit to obtain the sensor device protocol template adapted by the sensor device comprises:
S411, processing the sensor equipment to be supported by using a protocol template evaluation unit to obtain sensor equipment data;
s412, analyzing the sensor equipment data to obtain a characteristic character string of the sensor equipment data;
s413, inquiring the sensor characteristic information by using a preset sensor characteristic information inquiry model to obtain a sensor equipment protocol template with the sensor equipment data adaptation.
6. The sensor protocol adaptation method based on model hierarchical mapping according to claim 4, wherein the performing data processing on the sensor device to be supported according to the sensor device protocol template adapted by the sensor device to obtain a sensor device data protocol adaptation result comprises:
s421, carrying out data preprocessing on the sensor equipment to be supported by utilizing an adaptation engine unit according to a sensor equipment protocol template adapted by the sensor equipment to obtain sensor equipment preprocessing data;
s422, extracting key nodes from the sensor equipment preprocessing data to obtain key node information;
s423, mapping the key node information to a sensor equipment protocol template result model layer by using a result expression unit to obtain a sensor equipment data protocol adaptation result.
7. The model hierarchical mapping based sensor protocol adaptation method according to claim 1, wherein the sensor device protocol templates are designed based on uci database;
the database table of the sensor equipment protocol template comprises a model structure field, a pnodeX structure field, a len structure field, a name structure field, a type structure field, a show structure field, a dnodeX structure field, a rnodeX structure field, a symbol structure field, an endian structure field, an expr structure field and a unit structure field;
the model structure field is used for designating model layer names of a declaration protocol model layer, a data model layer and a result model layer contained in the current template;
the pnodeX structure field is used for specifying the constituent nodes of the protocol model;
the len structure field is used for defining the byte number of the composition node;
the name structure field is used for defining the names of the constituent nodes;
the type structure field is used for defining the type of the composition node;
the show structure field is used for describing whether the content expressed by the composition nodes needs to be displayed and presented in the result expression;
the dnodeX structure field is used for defining the composition nodes of the data model;
The rnodeX structure field is used for defining the composition nodes of the result model;
the symbol structure field is used for carrying out logic variable expression;
the endian structure field is used for carrying out size end byte order description;
the expr structure field is used for carrying out calculation expression;
the unit structure field is used for defining a result numerical unit.
8. A sensor protocol adaptation device based on model hierarchical mapping, the device comprising:
the sensor equipment analysis module is used for analyzing the sensor equipment to obtain a protocol document of the sensor equipment;
the template design module is used for carrying out template design according to the protocol document of the sensor equipment to obtain a sensor equipment protocol template, and uploading the sensor equipment protocol template to a system supporting sensor protocol adaptation service;
the sensor equipment protocol templates form a template library;
the template feature extraction module is used for extracting features of the sensor equipment protocol template to obtain sensor feature information;
the sensor characteristic information forms a sensor characteristic information base;
the sensor equipment protocol adaptation module is used for processing the sensor equipment to be supported by utilizing the protocol adaptation model to obtain a sensor equipment data protocol adaptation result;
The protocol adaptation model comprises a protocol template evaluation unit, an adaptation engine unit and a result expression unit.
9. A sensor protocol adaptation device based on model hierarchical mapping, the device comprising:
a memory storing executable program code;
a processor coupled to the memory;
the processor invokes the executable program code stored in the memory to perform the model hierarchical mapping based sensor protocol adaptation method of any one of claims 1-7.
10. A computer-storable medium storing computer instructions that, when invoked, are operable to perform the model hierarchical mapping based sensor protocol adaptation method of any one of claims 1-7.
CN202311707826.7A 2023-12-12 2023-12-12 Sensor protocol adaptation method and device based on model hierarchical mapping Pending CN117614799A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311707826.7A CN117614799A (en) 2023-12-12 2023-12-12 Sensor protocol adaptation method and device based on model hierarchical mapping

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311707826.7A CN117614799A (en) 2023-12-12 2023-12-12 Sensor protocol adaptation method and device based on model hierarchical mapping

Publications (1)

Publication Number Publication Date
CN117614799A true CN117614799A (en) 2024-02-27

Family

ID=89949886

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311707826.7A Pending CN117614799A (en) 2023-12-12 2023-12-12 Sensor protocol adaptation method and device based on model hierarchical mapping

Country Status (1)

Country Link
CN (1) CN117614799A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20080072783A (en) * 2007-02-04 2008-08-07 김기형 Wireless personal area network system supporting transmission between different sensor nodes
EP3531710A1 (en) * 2018-02-22 2019-08-28 Christian Maier GmbH & Co. KG Maschinenfabrik Electronic interface module for connecting a sensor to an io-link system
CN110601876A (en) * 2019-08-20 2019-12-20 西安向南网络信息科技有限公司 Intelligent Internet of things platform
CN111343159A (en) * 2020-02-12 2020-06-26 杭州涂鸦信息技术有限公司 Protocol adaptation method and system, storage medium and computer equipment
WO2020225058A1 (en) * 2019-05-03 2020-11-12 BSH Hausgeräte GmbH System for providing and processing sensor data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20080072783A (en) * 2007-02-04 2008-08-07 김기형 Wireless personal area network system supporting transmission between different sensor nodes
EP3531710A1 (en) * 2018-02-22 2019-08-28 Christian Maier GmbH & Co. KG Maschinenfabrik Electronic interface module for connecting a sensor to an io-link system
WO2020225058A1 (en) * 2019-05-03 2020-11-12 BSH Hausgeräte GmbH System for providing and processing sensor data
CN110601876A (en) * 2019-08-20 2019-12-20 西安向南网络信息科技有限公司 Intelligent Internet of things platform
CN111343159A (en) * 2020-02-12 2020-06-26 杭州涂鸦信息技术有限公司 Protocol adaptation method and system, storage medium and computer equipment

Similar Documents

Publication Publication Date Title
CN110933146B (en) Data conversion method and device and server
CN110188070A (en) For deconstructing and searching for the method and system based on binary vehicle data
CN106598581B (en) ASTERIX message analysis code generation method based on XML
CN107958028A (en) Method, apparatus, storage medium and the terminal of data acquisition
CN109460219B (en) Method for quickly serializing interface control file
CN112882974B (en) JSON data conversion method and device, computer equipment and storage medium
CN109857452B (en) Configuration method and device of rocket test launch control system based on XML
CN109905293A (en) A kind of terminal device recognition methods, system and storage medium
CN111683066A (en) Heterogeneous system integration method and device, computer equipment and storage medium
JP4638250B2 (en) Program code generation support apparatus and method, and program code generation support method program
CN110912782B (en) Data acquisition method, device and storage medium
CN111552665B (en) Method, device, equipment and medium for converting annotation information format
CN113079198A (en) Method and device for converting cloud platform interface protocol
CN114282519A (en) CAN data analysis method and device
CN114025027B (en) Method and device for running data transmission script, storage medium and electronic device
CN117278661B (en) Industrial Internet of things multi-protocol analysis method and system
CN117614799A (en) Sensor protocol adaptation method and device based on model hierarchical mapping
CN111026972B (en) Subscription data pushing method, device, equipment and storage medium in Internet of things
CN114064125B (en) Instruction analysis method and device and electronic equipment
CN115333943A (en) Deterministic network resource configuration system, method, device and storage medium
CN114253973A (en) Data table determination method and device, storage medium and electronic device
JP7371410B2 (en) Information processing device and information processing program
CN111711605A (en) Data protocol active analysis method for Internet of things platform
CN110134086A (en) Realize the data collection and control device of middleware function in a kind of digitlization workshop
CN110708351A (en) Data transmission method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination