Method for modeling and defining data elements in a device monitoring protocol
By constructing a data element model for the device monitoring protocol, the problems of low code reusability and high cost of interface protocol changes were solved. This enabled unified modeling and multiple uses of data element information, improving development efficiency and code reusability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 10TH RES INST OF CETC
- Filing Date
- 2023-05-11
- Publication Date
- 2026-06-23
AI Technical Summary
The development of existing equipment monitoring software suffers from problems such as low code reuse rate, high cost of dealing with changes in interface protocols, and the need to encode the same data elements multiple times.
By constructing a data element model, including data element ID, data transmission type, data display format and its attributes, the correspondence between the transmitted value and the displayed value of the data element is defined, achieving unified modeling and multiple uses.
It improves code reusability, reduces development workload and costs, prevents software bugs, and enables data element information to be defined once and used in multiple places.
Smart Images

Figure CN116610309B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of equipment monitoring technology, and is a method for modeling and defining data elements in an equipment monitoring protocol. Background Technology
[0002] In the field of equipment monitoring software, almost every piece of software is custom-developed for a specific device or a specific type of device. This targeted development is necessary because different devices have different device status parameters, control commands, and network transmission formats in their monitoring protocols. Equipment monitoring protocols not only describe what status information and control commands a device possesses, but also how this information and commands are transmitted through network data frames. Data elements are the smallest unit of information transmitted in equipment monitoring protocols, and device status reporting commands and control commands are the carriers used to transmit data elements.
[0003] Currently, the development of monitoring software typically employs the following methods to implement device monitoring protocols: writing a class for each type of device protocol, a class for each command, and a class for each type of data element; or using structures to describe the data frame structure, and then using these classes or structures to complete the conversion between byte sequences and displayed values.
[0004] These methods have the following drawbacks:
[0005] First, the code reuse rate is low. The interface protocol parsing code for each set of device monitoring software is custom-developed, with almost no reusable parts, resulting in a large development workload.
[0006] Secondly, dealing with changes is very costly; any change to the interface protocol requires modifying the code and retesting.
[0007] Furthermore, the same data element information needs to be encoded multiple times in different usage scenarios. For example, in places where data element information is needed, such as device data storage and retrieval functions, the code written during protocol parsing cannot be used and must be encoded again. Summary of the Invention
[0008] To address the aforementioned issues, this invention provides a method for modeling and defining data elements in a device monitoring protocol. By abstracting the common characteristics of data elements to construct a model, it creates a standardized and productized foundation for the development of data frame processing code in monitoring software. It also creates conditions for defining data element information once and using it in multiple places, thus solving the problem of handling various heterogeneous data elements in device monitoring protocols using traditional methods in current monitoring software development.
[0009] This invention provides a method for modeling and defining data elements in a device monitoring protocol, the specific technical solution of which is as follows:
[0010] S1: Construct a data element model, which includes data element ID, data transmission type, data display format, and attributes that correspond to different data display formats;
[0011] The construction of the data element model includes the following steps:
[0012] S101: Constructing data transfer type
[0013] S102: Construct the data display types and their associated attributes;
[0014] S2: Define data elements, and determine the model parameters corresponding to the currently defined data elements based on the data element model; defining data elements includes the following steps:
[0015] S201: Set the data element ID;
[0016] S202: Set the attributes corresponding to the data element;
[0017] S3: Based on the determined model parameters, determine the corresponding conversion relationship between the transmitted value and the displayed value of the data element, and complete the construction of the data element.
[0018] The data element ID is a string used to uniquely identify this data element.
[0019] Data transfer type describes the data type of a data element during its network transmission; a transmission value can be obtained based on the data transfer type.
[0020] The data display format describes how the actual physical value of the data corresponding to a data element is displayed; a display value can be obtained based on the display format.
[0021] Furthermore, the data transmission types include: one-byte signed integer, one-byte unsigned integer, two-byte signed integer, two-byte unsigned integer, four-byte signed integer, four-byte unsigned integer, eight-byte signed integer, eight-byte unsigned integer, single-precision floating-point number, double-precision floating-point number, string, and byte sequence.
[0022] Furthermore, the length of the string and the byte sequence needs to be specified.
[0023] Furthermore, strings are classified into ASCII strings, UTF-8 strings, and ordinary 8-bit strings based on their character encoding type.
[0024] Furthermore, the data display formats include: numeric, string, enumeration, time, exponential, and IP address types.
[0025] Numerical types are categorized by number system into decimal, hexadecimal, binary, and octal.
[0026] Time types are categorized into BCD date, cumulative day, cumulative second, cumulative millisecond, and ASCII time based on the meaning of their numerical values.
[0027] The exponential display value is calculated by multiplying the transmission value by 2 to the power of n, where n is determined by the step value.
[0028] Furthermore, the attributes include: unit, quantization unit and transmission base value, value range, step size, regular expression, input prompt information, and enumeration ID.
[0029] The units, quantization units, transmission base values, value ranges, steps, and input prompts are valid when the data display format is numerical.
[0030] The regular expression is valid when the data display format is string.
[0031] The enumerated ID is valid when the data display format is enumerated.
[0032] Furthermore, when the data display format is exponential, the value of the step attribute is used for exponential calculation.
[0033] Specifically, when the data display format is exponential, the value of the step attribute, step, will be used as an exponent in the conversion between the transmission value s and the display value u.
[0034] Furthermore, when the data display format is numerical, the quantization unit q and the transmission base value b will participate in the conversion between the transmission value s and the display value u, and the conversion formula is u = q * s + b.
[0035] Furthermore, when the data display format is numerical, if the attribute of the input prompt information is empty, then the input value range information will be prompted.
[0036] The beneficial effects of this invention are as follows:
[0037] This invention, based on the common characteristics of data elements, performs unified modeling of data elements. Through detailed classification of transmission types and display formats, it defines the correspondence and conversion relationship between the transmission values and display values of data elements. This enables subsequent business processing to use parameters based on the unified model. When storing, querying, and analyzing this monitoring data, subsequent business processes can directly use the pre-defined model information, achieving one-time definition for multiple uses, reducing code development workload, and preventing software bugs caused by inconsistent understandings of data element definitions in interface protocol documents by different developers. This greatly improves the problem of heterogeneous data elements in monitoring protocols of different devices. It allows the use of the same set of parsing and packaging code for different data elements, eliminating the need for custom development, improving code reusability, significantly reducing the cost of monitoring software development, and shortening development time. Attached Figure Description
[0038] Figure 1 This is a schematic diagram of the overall process of the method of the present invention;
[0039] Figure 2 This is a schematic diagram of the data element definition process of the present invention. Detailed Implementation
[0040] The technical solutions in the embodiments of the present invention are clearly and completely described in the following description. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0041] Example 1
[0042] Embodiment 1 of the present invention discloses a modeling method for data elements in a device monitoring protocol, such as... Figure 1 As shown, the specific steps are as follows:
[0043] S1: Construct a data element model, which includes data element ID, data transmission type, data display format, and attributes that correspond to different data display formats.
[0044] The data element ID is a string used to uniquely identify this data element.
[0045] S101: Constructing data transfer type
[0046] Data transfer type is used to describe the data type of a data element when it is transmitted over a network; a transmission value can be obtained based on the data transfer type.
[0047] Specifically, the data transmission types include: one-byte signed integer, one-byte unsigned integer, two-byte signed integer, two-byte unsigned integer, four-byte signed integer, four-byte unsigned integer, eight-byte signed integer, eight-byte unsigned integer, single-precision floating-point number, double-precision floating-point number, string, and byte sequence;
[0048] The lengths of the string and the byte sequence need to be specified.
[0049] Strings are classified into ASCII strings, UTF-8 strings, and ordinary 8-bit strings based on their character encoding type.
[0050] S102: Construct the data display types and their associated attributes;
[0051] The data display format describes how the actual physical value of the data corresponding to a data element is displayed; a display value can be obtained based on the display format.
[0052] Specifically, the data display formats include: numeric, string, enumeration, time, exponential, and IP address types.
[0053] Numerical types are categorized by number system into decimal, hexadecimal, binary, and octal.
[0054] Time types are categorized into BCD date, cumulative day, cumulative second, cumulative millisecond, and ASCII time based on the meaning of their numerical values.
[0055] In this embodiment, when the display format is exponential, the displayed value is calculated by multiplying the transmitted value by 2 to the power of n, where n is determined by the step value.
[0056] In this embodiment, the attributes include: unit, quantization unit and transmission base value, value range, step size, regular expression, input prompt information, and enumeration ID.
[0057] The unit is a string, such as "V", "meter", "℃", etc.
[0058] In this embodiment, the quantization unit and the basic transmission value are set as follows: the value during transmission is s, the displayed value is u, the quantization unit is q, and the basic transmission value is b. They satisfy the formula: u = q * s + b.
[0059] The value range is used to determine the maximum and minimum values of the displayed value;
[0060] The step is used for adjusting the numerical value on the interface (if it is a decimal, the number of decimal places must be consistent with the quantization unit).
[0061] The regular expression is used to perform regular expression validation on the input value;
[0062] The input prompt information is the information that pops up in the Tip bubble when the parameter control input control is in focus;
[0063] The enumeration ID is valid when the data display format is enumeration type, and is used to specify an enumeration definition for the current data element;
[0064] An enumeration definition is used in conjunction with an enumeration-type display format. It contains an enumeration ID and multiple sets of enumeration values. Each set of enumeration values contains three pieces of information: the transmission value, the display value, and the text. Both the transmission value and the display value must be integers when used as enumeration values.
[0065] The units, quantization units, transmission base values, value ranges, steps, and input prompts are valid when the data display format is numerical.
[0066] Specifically, when the data display format is exponential, the value of the step attribute is used for exponential calculation;
[0067] When the data display format is numeric, if the attribute of the input prompt information is empty, the input value range information will be prompted.
[0068] The regular expression is valid when the data display format is string.
[0069] S2: Define data elements, and determine the model parameters corresponding to the currently defined data elements based on the data element model;
[0070] Defining the data element includes the following steps:
[0071] S201: Set the data element ID;
[0072] S202: Set the attributes corresponding to the data element;
[0073] S3: Based on the determined model parameters, determine the corresponding conversion relationship between the transmitted value and the displayed value of the data element, and complete the construction of the data element.
[0074] Example 2
[0075] Embodiment 2 of the present invention discloses a modeling method for data elements in a device monitoring protocol. Based on the data element modeling method described in Embodiment 1 above, a preferred embodiment is defined by defining a data element for describing the displayed temperature of a thermometer, as described below:
[0076] Combination Figure 1 and Figure 2 As shown, the specific steps are as follows:
[0077] S1: Construct a data element model, which is the data element model described in Embodiment 1 above, and will not be repeated here;
[0078] S2: Define data elements, and determine the model parameters corresponding to the currently defined data elements based on the data element model;
[0079] S201: Set the data element ID;
[0080] First, define the data element ID as "temperature";
[0081] S202: Set the attributes corresponding to the data element;
[0082] Based on the data element model constructed using the above method, the corresponding model attributes of the data element are obtained as follows:
[0083] The unit is ℃, the value range is -50℃ to 40℃, and the accuracy is 0.1℃, i.e., in steps. Unsigned integers are used for network transmission.
[0084] This means that the unit of this data element is ℃ when it is displayed and entered on the interface, the increment of the value is 0.1℃, and the range of the input value is -50℃ to 40℃. If it exceeds this range, it is considered an abnormal value.
[0085] Based on the value range, precision, and network transmission requirements, the data transmission type was determined to be a two-byte unsigned number, and the display type was determined to be a decimal number.
[0086] The attributes associated with this data element are:
[0087] Unit: "℃";
[0088] Unit of quantification: 0.1;
[0089] Base transmission value: -50;
[0090] Value range: -50℃ to 40℃;
[0091] Step: 0.1;
[0092] Regular expression: None;
[0093] Input prompt message: None;
[0094] Enumeration ID: None;
[0095] S3: Based on the determined model parameters, determine the corresponding conversion relationship between the transmitted value and the displayed value of the data element, and complete the construction of the data element.
[0096] The above data element model information is used for packaging and parsing operations:
[0097] Packaging: Converts display values into transmission values
[0098] The minimum display value is -50℃. Using the formula u=q*s+b, the transmission value is calculated to be (-50-(-50)) / 0.1=0;
[0099] The displayed value is -20℃. Using the formula u=q*s+b, the transmission value is calculated to be (-20-(-50)) / 0.1=300;
[0100] The maximum display value is 40℃. Using the formula u=q*s+b, the transmission value is calculated to be (40-(-50)) / 0.1=900;
[0101] Analysis: Convert the transmitted value into the displayed value.
[0102] The minimum transmission value is 0. Based on the formula u=q*s+b, the displayed value is calculated as 0*0.1+(-50)=-50.
[0103] The transmission value is 300. Based on the formula u=q*s+b, the displayed value is calculated to be 300*0.1+(-50)=-20.
[0104] The maximum transmission value is 900. Based on the formula u=q*s+b, the displayed value is calculated to be 900*0.1+(-50)=40.
[0105] Based on the above calculations, it can be seen that by applying the quantization unit and the basic value of transmission, the range of the transmitted value is successfully limited to the range of [0, 900], which is within the representation range of a two-byte unsigned integer, and can be transmitted over the network using a two-byte unsigned integer.
[0106] Example 3
[0107] Embodiment 3 of the present invention discloses a modeling method for data elements in a device monitoring protocol. Based on the data element modeling method described in Embodiment 1 above, a preferred embodiment is defined to define a data element for describing switch states (on / off), and the following description is provided:
[0108] Combination Figure 1 and Figure 2 As shown, the specific steps are as follows:
[0109] S1: Construct a data element model, which is the data element model described in Embodiment 1 above, and will not be repeated here;
[0110] S2: Define data elements, and determine the model parameters corresponding to the currently defined data elements based on the data element model;
[0111] S201: Set the data element ID;
[0112] First, define the data element ID as "switch";
[0113] S202: Set the attributes corresponding to the data element;
[0114] Set the model parameters for this data element as follows:
[0115] A single byte is used for network transmission, where 1 indicates off and 2 indicates on.
[0116] Based on the model parameters set above, the data transmission type is determined to be a one-byte unsigned number. Then, the display type is determined to be an enumeration type. An enumeration definition is edited as follows:
[0117] Enumeration ID: switchEnum;
[0118] List of enumerated values:
[0119] Transmission value = 1, Display value = 0, Text = "Off"
[0120] Transmission value = 2, Display value = 1, Text = "On"
[0121] Finally, set the additional attributes for the data elements:
[0122] Unit: None
[0123] Unit of quantification: None
[0124] Basic transmission values: None
[0125] Value range: None
[0126] Step: None
[0127] Regular expression: None
[0128] Input prompt message: None
[0129] S3: Based on the determined model parameters, determine the corresponding conversion relationship between the transmitted value and the displayed value of the data element, and complete the construction of the data element.
[0130] Based on the data elements defined above, when a transmission value of 1 is received, it will be converted to a display value of 0 according to the enumeration definition, and the text information displayed on the interface will be "Off". When the interface selects "On" (corresponding to a display value of 1), the display value will be converted to a transmission value of 2 according to the enumeration definition for use in network transmission.
[0131] Example 4
[0132] Embodiment 4 of the present invention discloses a modeling method for data elements in a device monitoring protocol. Based on the data element modeling method described in Embodiment 1 above, a data element is defined to describe a UTF-8 encoded string that can only consist of English letters and numbers, and must begin with a letter, with a total length not exceeding 20 characters. Network transmission uses a fixed 20-byte string. As a preferred embodiment, the following description is provided:
[0133] Combination Figure 1 and Figure 2 As shown, the specific steps are as follows:
[0134] S1: Construct a data element model, which is the data element model described in Embodiment 1 above, and will not be repeated here;
[0135] S2: Define data elements, and determine the model parameters corresponding to the currently defined data elements based on the data element model;
[0136] S201: Set the data element ID;
[0137] Define the data element ID as "paramName";
[0138] S202: Set the attributes corresponding to the data element;
[0139] First, determine that the data transmission type is a 20-byte UTF-8 string. Then, determine that the display type is a string. Finally, set the additional attributes of the data element as follows:
[0140] Unit: None;
[0141] Unit of quantification: None;
[0142] Basic transmission values: None;
[0143] Value range: None;
[0144] Step: None;
[0145] Regular expression: "^[a-zA-Z][a-zA-Z0-9]{0,20}$";
[0146] The input prompt message reads: "Please enter a string of no more than 20 characters that starts with a letter and consists only of letters and numbers."
[0147] Enumeration ID: None;
[0148] S3: Based on the determined model parameters, determine the corresponding conversion relationship between the transmitted value and the displayed value of the data element, and complete the construction of the data element.
[0149] Based on the above definition, this data element will only accept strings that match the regular expression when inputting on the interface, and will provide input prompts to the user.
[0150] This invention is not limited to the specific embodiments described above. The invention extends to any new feature or combination disclosed in this specification, as well as any new method or process step or combination disclosed herein.
Claims
1. A method for modeling and defining data elements in a device monitoring protocol, characterized in that, include: S1: Construct a data element model, which includes data element ID, data transmission type, data display format, and attributes that correspond to different data display formats; The construction of the data element model includes the following steps: S101: Construct data transfer type; S102: Construct the data display types and their associated attributes; S2: Define data elements, and determine the model parameters corresponding to the currently defined data elements based on the data element model; Defining the data element includes the following steps: S201: Set the data element ID; S202: Set the attributes corresponding to the data element; S3: Based on the determined model parameters, determine the corresponding conversion relationship between the transmitted value and the displayed value of the data element, and complete the construction of the data element.
2. The modeling method for data elements in the device monitoring protocol according to claim 1, characterized in that, The data transmission types include: one-byte signed integer, one-byte unsigned integer, two-byte signed integer, two-byte unsigned integer, four-byte signed integer, four-byte unsigned integer, eight-byte signed integer, eight-byte unsigned integer, single-precision floating-point number, double-precision floating-point number, string, and byte sequence.
3. The modeling method for data elements in the device monitoring protocol according to claim 2, characterized in that, The string and the byte sequence need to have a specified length.
4. The modeling method for data elements in the device monitoring protocol according to claim 3, characterized in that, Strings are classified into ASCII strings, UTF-8 strings, and ordinary 8-bit strings based on their character encoding type.
5. The modeling method for data elements in the device monitoring protocol according to claim 1, characterized in that, The data display formats include: numeric, string, enumeration, time, exponential, and IP address.
6. The modeling method for data elements in the device monitoring protocol according to claim 1, characterized in that, The attributes include: unit, quantization unit and transmission base value, value range, step size, regular expression, input prompt information, and enumeration ID; The units, quantization units, transmission base values, value ranges, steps, and input prompts are valid when the data display format is numerical. The regular expression is valid when the data display format is string. The enumerated ID is valid when the data display format is enumerated.
7. The modeling method for data elements in the device monitoring protocol according to claim 6, characterized in that, When the data display format is exponential, the value of the step attribute is used for exponential calculation.
8. The modeling method for data elements in the device monitoring protocol according to claim 6, characterized in that, When the data display format is numerical, the quantization unit q and the transmission base value b will participate in the conversion between the transmission value s and the display value u, and the conversion formula is u = q * s + b.
9. The modeling method for data elements in the device monitoring protocol according to claim 6, characterized in that, When the data display format is numerical, if the attribute of the input prompt information is empty, the input value range information will be prompted.