Method and system for realizing sensor configuration transfer through structured CSV file
By using structured CSV file templates and automated parsing, the inefficiency and error-prone nature of sensor configuration on gateway devices have been resolved, enabling efficient and accurate sensor configuration and improving the deployment and maintenance efficiency of IoT systems.
Patent Information
- Application Number
- CN202511701123.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-02-10
AI Technical Summary
Existing technologies suffer from inefficient and error-prone configuration of gateway sensors, resulting in low deployment and maintenance efficiency of IoT systems and a lack of efficient, accurate, and universal configuration methods.
By building a structured CSV configuration file template, defining rows and predefined columns, batch configuration and automated parsing of sensor data points can be achieved. It supports the import and export of CSV format files, which contain information such as identifiers, protocol communication, data parsing, business types, and model classifications.
It enables efficient batch operation of sensor configuration, improves configuration accuracy and system reliability, enhances the readability and maintainability of configuration information, supports cross-system migration and version management, and reduces reliance on professional personnel.
Smart Images

Figure CN121509237A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a method and system for importing and exporting sensor configuration information through a structured CSV file, belonging to the technical field of industrial automation and management of Internet of Things devices. BACKGROUND
[0002] In modern industrial automation, intelligent buildings, data centers and other scenarios, various types of sensors (temperature and humidity sensors, access control sensors, water immersion sensors, etc.) and actuators are widely deployed. These devices are usually connected to a gateway machine through Modbus, BACnet and other fieldbus protocols, and the gateway machine undertakes data acquisition, protocol conversion and device control functions. As the hub connecting the underlying devices and the upper management system, the correct configuration of sensor parameters by the gateway machine is the core prerequisite for ensuring communication and data analysis. Currently, the configuration of sensors by the gateway machine mainly relies on the following two methods, but both have significant defects.
[0003] Manual configuration: the operator needs to add and modify the parameters of each sensor one by one through the human-machine interface (HMI) of the gateway machine or configuration software. These parameters are numerous and highly specialized, including but not limited to: 1. Communication parameters: function code, register address, data length; 2. Data analysis parameters: data type, data offset, conversion coefficient, decimal places, bit operation flag and bit position; 3. Business parameters: data point name, alias, four-remote type (remote signaling, remote measurement, remote control, remote adjustment), enumeration value definition, device model classification, etc.
[0004] The manual configuration method has the following significant defects: 1. Extremely low efficiency: for a large system with hundreds or thousands of data points, the initialization configuration or batch modification takes a long time; 2. prone to errors: when manually entering long hexadecimal addresses and complex conversion coefficients, it is easy to make mistakes, leading to communication failure or data analysis errors, and it is difficult to troubleshoot errors; 3. high professional requirements for operators: operators need to have a deep understanding of Modbus and other protocol details, resulting in high training and labor costs.
[0005] Special script or private format import: some gateway machines support batch configuration through specific scripts or vendor proprietary binary / XML format files.
[0006] The special script or private format import mode has the following obvious defects: 1. The mode has poor universality, the file format is not transparent, and is strongly dependent on a specific manufacturer or a specific model of a gateway machine, and cannot be used universally between different platforms; 2. The maintainability and readability are poor, the configuration file cannot be directly viewed and edited by general software (such as Excel, a text editor), and needs to be generated and parsed by a special tool, which brings great inconvenience to on-site debugging, version management and fault diagnosis.
[0007] In summary, the prior art lacks an efficient, accurate, universal and easy-to-operate gateway machine sensor configuration method. The tediousness and high error rate of manual configuration, and the closeness and inflexibility of the private format have become technical bottlenecks restricting the rapid deployment and operation efficiency improvement of the Internet of Things system. Therefore, there is an urgent need in the field for a standardized solution that can simplify the configuration process, support batch operations, facilitate cross-system migration and version management. SUMMARY
[0008] The purpose of the application is to solve the problems of low efficiency, easy to make mistakes, poor universality and the like in the prior art gateway machine sensor configuration, and to provide a method and system for realizing sensor configuration information import and export through a structured CSV file, which aims to: 1. realize batch and rapid sensor configuration, and significantly improve engineering deployment and operation efficiency; 2. reduce the complexity and error rate of configuration operations, and reduce the dependence on professional experience through a standardized file format and an automated parsing process; 3. improve the portability and readability of configuration information, and use a universal and transparent CSV format to facilitate cross-system migration, version management, manual review and editing of configuration information.
[0009] Technical scheme: To achieve the above purpose, the technical scheme adopted by the application is: A method for realizing sensor configuration transfer through a structured CSV file, a structured CSV configuration file template is constructed, rows and a series of predefined columns are defined in the structured CSV configuration file template, each row corresponds to a sensor data point, and each predefined column corresponds to each type of configuration information of the sensor data point; when the gateway machine responds to a configuration export instruction, the configuration information of all sensor data points in the gateway machine is first extracted, and then the configuration information of all sensor data points is written into the structured CSV configuration file template according to the definition of the rows and the predefined columns of the structured CSV configuration file template, to form a CSV format file for archiving or as a configuration template for other similar gateways; when the gateway machine responds to a configuration import instruction, a CSV format file is first read, and then the configuration information of the sensor data points in the gateway machine is converted according to the definition of the rows and the predefined columns of the structured CSV configuration file template and applied to the gateway machine.
[0010] Specifically, the predefined columns in the structured CSV configuration file template include at least: (1) Identifier column: used to define the basic identity of sensor data points, including sensor name, sensor type, sensor data point name, and sensor data point alias; (2) Protocol Communication Section: Used to define the communication rules between the gateway and the sensor, including register address, function code, and data length; (3) Data parsing column: used to define how to convert the raw register value into engineering data with actual physical meaning, including data type, data parsing method, data offset, conversion factor, and decimal places; (4) Business Type Column: Used to define the four remote types of sensor data points, including remote signaling, remote measurement, remote control and remote adjustment; (5) Bit resolution column: used to specify bit-level operations when processing Boolean values or bit states, including Bit / Byte flags and bit positions; (6) Semantic mapping column: used to map the raw data (a numerical value) collected by the gateway to a readable state description (a text message with special meaning), i.e., enumeration value definition; (7) Model Classification Column: Used to classify and manage sensors within the gateway, including defining sensor types and corresponding sensor identifiers.
[0011] Specifically, when the gateway responds to the configuration import command, it first receives a CSV file, then parses the CSV file in terms of syntax and semantics to obtain the configuration information for each sensor data point. Next, it verifies the validity of the parsed configuration information, including register address range verification, function code and data type matching verification, and data length consistency verification. If the validity verification passes, the parsed configuration information is applied to the sensor.
[0012] Specifically, if the parsed configuration information fails the validity verification, an error message is returned, which includes the location of the configuration information in the CSV format file and the reason for the error.
[0013] Specifically, for the configuration information of sensor data points obtained by parsing the CSV format file, if the relevant sensor data points exist in the gateway, the configuration information of the sensor data points is updated; if the relevant sensor data points do not exist in the gateway, the relevant sensor data points are created.
[0014] A system for transferring sensor configurations via structured CSV files includes a sensor configuration management module and a CSV file parsing engine, wherein the CSV file parsing engine includes a structured CSV configuration file template, a import unit, and an export unit. The sensor configuration management module is used to extract the configuration information of sensor data points inside the gateway device; The structured CSV configuration file template defines rows and a series of predefined columns. Each row corresponds to a sensor data point, and each predefined column corresponds to various configuration information of the sensor data point. The export unit writes the configuration information of all data points inside the sensor into the structured CSV configuration file template according to the definition of rows and predefined columns in the structured CSV configuration file template, thus forming a CSV format file; The import unit converts the CSV format file into configuration information of the sensor data points of the gateway device according to the definition of rows and predefined columns in the structured CSV configuration file template, and applies it to the gateway device.
[0015] Specifically, the CSV format file parsing engine also includes a validity verification unit, which verifies the validity of the configuration information of the parsed sensor data points and applies the verified configuration information to the gateway.
[0016] Specifically, the validity verification includes register address range verification (non-numeric characters are not allowed, and values less than 0 or greater than 65535 are not allowed), function code verification and matching item verification (if the sensor data point's four-remote type is remote signaling or telemetry, then determine whether the function code is 0x01, 0x02, 0x03, or 0x04; if the sensor data point's four-remote type is remote control or remote adjustment, then determine whether the function code is 0x05, 0x06, 0x10, or 0x0f), data type matching item verification (if the bit flag is 1, then determine whether the data type is bool), and data length verification (whether it corresponds to the data length requirement of the data parsing method); if the validity verification passes.
[0017] Specifically, the structured CSV configuration file template includes predefined columns such as an identifier column for defining the basic identity of sensor data points, a protocol communication column for defining the communication rules between the gateway and the sensors, a data parsing column for defining how to convert raw register values into engineering data with actual physical meaning, a business type column for defining the four remote sensing types of sensor data points, a bit parsing column for specifying bit-level operations when processing Boolean values or bit states, a semantic mapping column for defining enumerated values, and a model classification column for classifying and managing sensors within the gateway.
[0018] Beneficial Effects: The method and system for sensor configuration transfer via structured CSV files provided by this invention have the following advantages over existing technologies: 1. Extremely high configuration efficiency: Batch "one-click import" via CSV format files reduces manual configuration work that originally required several days to minutes, greatly improving the efficiency of project deployment and subsequent maintenance; 2. Excellent configuration accuracy: The automated parsing and verification process eliminates errors that may be caused by manual input, ensuring the accuracy of key parameters such as register addresses and conversion coefficients, and improving system reliability; 3. Strong versatility and compatibility: In terms of format, CSV is a standard format that can be used with Microsoft Excel, WPS... It can be easily edited and viewed using common software such as Office and text editors, without the need for special tools; in terms of protocol compatibility, by defining columns such as "function code" and "data parsing method", it can adapt to various industrial communication protocols such as Modbus and BACnet, and has good scalability; in terms of device compatibility, through "sensor type" and "sensor identifier", it can systematically manage the sensor device library of different manufacturers and types; 4. Excellent maintainability and manageability: The CSV file is plain text, which can be easily managed using version control systems such as SVN and Git, tracking the configuration change history and facilitating version control; standard configuration templates can be created for different types of sensors, which can be quickly reused in new projects, ensuring uniform configuration specifications and realizing template reuse; when communication or data problems occur, engineers can intuitively review the CSV file to quickly locate problems at the configuration parameter level, facilitating problem diagnosis. Attached Figure Description
[0019] Figure 1 This is a schematic diagram illustrating the implementation process of the method of the present invention; Figure 2 This is a schematic diagram of the gateway system designed based on the method and system of this invention; Figure 3 This is a schematic diagram of the execution flow for the imported unit. Detailed Implementation
[0020] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0021] A system for transferring sensor configurations via structured CSV files includes a sensor configuration management module and a CSV file parsing engine. The CSV file parsing engine includes a structured CSV configuration file template, an import unit, an export unit, and a validity verification unit. The sensor configuration management module extracts configuration information of sensor data points within a gateway device. The structured CSV configuration file template defines rows and a series of predefined columns, with each row corresponding to a sensor data point and each predefined column corresponding to various configuration information of the sensor data point. The export unit writes the configuration information of all data points within the sensor into the structured CSV configuration file template according to the row and predefined column definitions, forming a CSV file. The import unit converts the CSV file into configuration information of the sensor data points for the gateway device according to the row and predefined column definitions. The validity verification unit verifies the validity of the parsed sensor data point configuration information and applies the verified configuration information to the gateway device.
[0022] like Figure 1 As shown, this is a method for importing and exporting sensor data point configuration information based on the system that uses structured CSV files to transfer sensor configuration, as described above. The specific implementation steps are explained below.
[0023] S1: Create a structured CSV configuration file template System administrators or developers can predefine a structured CSV configuration file template containing specific predefined columns based on the sensor types and protocol specifications supported by the gateway. This structured CSV configuration file template should cover all necessary dimensions such as identification, communication, parsing, and business. This structured CSV configuration file template can be used as a project standard and distributed to all engineering implementation personnel.
[0024] In this case, a structured CSV configuration file template defines rows and a series of predefined columns. Each row corresponds to a sensor data point, and each predefined column corresponds to various configuration information for the sensor data point. The predefined columns include at least: (1) Identifier column: used to define the basic identity of sensor data points, including sensor name, sensor type, sensor data point name, and sensor data point alias; (2) Protocol Communication Section: Used to define the communication rules between the gateway and the sensor, including register address, function code, and data length; (3) Data parsing column: used to define how to convert the raw register value into engineering data with actual physical meaning, including data type, data parsing method, data offset, conversion factor, and decimal places; (4) Business Type Column: Used to define the four remote types of sensor data points, including remote signaling, remote measurement, remote control and remote adjustment; (5) Bit resolution column: used to specify bit-level operations when processing Boolean values or bit states, including Bit / Byte flags and bit positions; (6) Semantic mapping column: used to map the raw data collected by the gateway to a readable state description, i.e., the definition of enumeration values; (7) Model Classification Column: Used to classify and manage sensors within the gateway, including defining sensor types and corresponding sensor identifiers.
[0025] S2: Build a CSV format file export process During system operation and maintenance, users can trigger a configuration export command through the gateway's management interface. The gateway will read its current complete configuration from its configuration management module, extract the configuration information of all sensor data points within the gateway, and write the configuration information of all sensor data points into the structured CSV configuration file template according to the row and predefined column definitions. This generates a CSV file that can be downloaded. This CSV file records the current configuration information of all sensor data points and can be used for backup, cloning configurations between different gateways, or as a basis for auditing and diagnosis.
[0026] S3: Building a personalized editing workflow for CSV format files Engineers can open CSV files using general-purpose software (such as Microsoft Excel). They can then fill in or modify specific parameters based on the sensor list for their project. For example, when configuring sensor data points for 10 temperature sensors, they only need to copy the corresponding rows from the CSV file and modify key information such as the "sensor name" and "register address." This operation is far more efficient and accurate than manually adding sensor data points on the gateway interface.
[0027] S4: Constructing the CSV format file import process Engineers can upload the customized CSV file to the gateway device via the web management interface, serial port tool, or SD card provided by the gateway device.
[0028] S5: Build a gateway machine to parse and apply configuration processes The gateway's built-in CSV file parsing engine is triggered, and it begins processing the uploaded CSV file, including the following steps: S41: File Reading and Parsing: The CSV format file parsing engine reads the CSV format file line by line, skipping any possible headers or blank lines, splitting the text data of each line by column, and initially converting it into an internal data structure.
[0029] S42: Syntax and Formatting Check: Checks whether the data format of each column is correct.
[0030] For example: check if the "register address" is a valid hexadecimal or decimal number; if the "data type" is a system-supported bool, short, float, etc.; and if the "enumeration value definition" conforms to the format "value: description;".
[0031] S43: Logic and Consistency Verification: Performs deeper business logic checks.
[0032] For example: check for conflicts or overlaps in register addresses under the same sensor type; verify whether the "function code" matches the "four remote types" (e.g., function code 0x05 is usually used for "remote control" and not for "telemetry"); confirm whether the "data length" is sufficient for the specified "data type" (e.g., a float type of data usually requires 2 registers, i.e., a length of 4 bytes).
[0033] If any row of data fails validation, the import process stops immediately, and a clear error message is returned to the user, indicating the location of the erroneous configuration information in the CSV file and the reason for the error. If all validations pass, proceed to step S44.
[0034] S44: Generate internal configuration: The CSV format file parsing engine converts the validated CSV format file into the configuration information structure required for the internal operation of the gateway machine, and submits it to the configuration management module.
[0035] S54: Configuration Takes Effect: The configuration management module loads the new configuration information into the communication driver module; the gateway then establishes communication with the sensor based on the new configuration information and begins data acquisition or control.
[0036] S6: Building a Gateway System Build as Figure 2 The gateway system 300 shown includes a processor 301, a memory 302, a communication interface 303, a sensor configuration management module 304, a CSV format file parsing engine 305, and a communication driver module 306.
[0037] The processor 301 and memory 302 are used to execute program instructions and store data.
[0038] The communication interface 303 is used to exchange CSV format files with a host computer (such as an engineering laptop computer) and to communicate data with a lower-level sensor network (such as a Modbus bus).
[0039] The sensor configuration management module 304 resides in the memory 302 and is executed by the processor 301. It is used to maintain the internal sensor configuration database 304a.
[0040] The CSV format file parsing engine 305 is connected to the sensor configuration management module 304 and includes an import unit 305a and an export unit 305b.
[0041] The import unit 305a is responsible for receiving external CSV format files and performing operations such as... Figure 3 The analysis and verification process is shown, and the analysis results are written into the internal sensor configuration database 304a.
[0042] The export unit 305b is responsible for reading data from the internal sensor configuration database 304a, generating a CSV format file according to the structured CSV configuration file template, and outputting it through the communication interface 303.
[0043] The communication driver module 306 is connected to the sensor configuration management module 304. Based on the parameters in the internal sensor configuration database 304a, it interacts with the sensor device via the communication interface 303 (such as sending Modbus requests and parsing response data).
[0044] S7, Effect Demonstration Table 1 is a fragment (partial columns) of a CSV file, clearly demonstrating how to accurately describe the "temperature" and "humidity" data points of a "Wired Temperature and Humidity Sensor_7" using different predefined columns. Engineers can intuitively see that the raw humidity data needs to be clearly visualized after being processed by (raw value - 400) × 0.1. Engineers can directly edit and review this data, eliminating ambiguity and errors inherent in manual configuration.
[0045] Table 1. Fragments of CSV format files
[0046] The transparency and structured definition of the structured CSV configuration file template, along with the CSV format files generated based on it, form the foundation for the sensor configuration information transfer solution provided in this case, significantly improving the efficiency and accuracy of configuration information transfer. This solution can import not only Modbus protocols, but also models of other protocols, defined and imported according to the required fields.
[0047] In summary, this solution successfully addresses the long-standing technical challenges of inefficiency, error susceptibility, and poor versatility in gateway sensor configuration by defining a structured CSV configuration file template and providing corresponding parsing, verification, and execution mechanisms. Those skilled in the art can implement this solution on different types of gateways or IoT devices without inventive effort, based on the teachings of this solution.
[0048] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the present invention in any way, and all technical solutions obtained by equivalent substitution or equivalent transformation fall within the protection scope of the present invention.
Claims
1. A method for transferring sensor configuration using a structured CSV file, characterized in that: Construct a structured CSV configuration file template, defining rows and a series of predefined columns in the structured CSV configuration file template. Each row corresponds to a sensor data point, and each predefined column corresponds to various configuration information of the sensor data point. When the gateway responds to the configuration export command, it first extracts the configuration information of all sensor data points inside the gateway, and then writes the configuration information of all sensor data points into the structured CSV configuration file template according to the definition of rows and predefined columns in the structured CSV configuration file template to form a CSV format file. When the gateway responds to the configuration import command, it first reads the CSV format file, and then converts it into the configuration information of the sensor data points inside the gateway according to the definition of rows and predefined columns in the structured CSV configuration file template, and applies it to the gateway.
2. The method for sensor configuration transfer via structured CSV files according to claim 1, characterized in that: The predefined columns in the structured CSV configuration file template include: (1) Identifier column: used to define the basic identity of sensor data points, including sensor name, sensor type, sensor data point name, and sensor data point alias; (2) Protocol Communication Section: Used to define the communication rules between the gateway and the sensor, including register address, function code, and data length; (3) Data parsing column: used to define how to convert the raw register value into engineering data with actual physical meaning, including data type, data parsing method, data offset, conversion factor, and decimal places; (4) Business Type Column: Used to define the four remote types of sensor data points, including remote signaling, remote measurement, remote control and remote adjustment; (5) Bit resolution column: used to specify bit-level operations when processing Boolean values or bit states, including Bit / Byte flags and bit positions; (6) Semantic mapping column: used to map the raw data collected by the gateway to a readable state description, i.e., the definition of enumeration values; (7) Model Classification Column: Used to classify and manage sensors within the gateway, including defining sensor types and corresponding sensor identifiers.
3. The method for sensor configuration transfer via structured CSV files according to claim 1, characterized in that: When the gateway responds to the configuration import command, it first receives a CSV file, then parses the CSV file for syntax and semantics to obtain the configuration information for each sensor data point. Next, it verifies the validity of the parsed configuration information, including register address range verification, function code and data type matching verification, and data length consistency verification. If the validity verification passes, the parsed configuration information is applied to the sensor.
4. The method for sensor configuration transfer via structured CSV files according to claim 3, characterized in that: If the parsed configuration information fails the validity verification, an error message is returned, which includes the location of the configuration information in the CSV file and the reason for the error.
5. The method for sensor configuration transfer via structured CSV files according to claim 1, characterized in that: For the configuration information of sensor data points obtained by parsing the CSV format file, if the relevant sensor data points exist in the gateway, the configuration information of the sensor data points will be updated. If the relevant sensor data points do not exist in the gateway, then create the relevant sensor data points.
6. A system for transferring sensor configurations via a structured CSV file, characterized in that: It includes a sensor configuration management module and a CSV format file parsing engine, wherein the CSV format file parsing engine includes a structured CSV configuration file template, an import unit, and an export unit; The sensor configuration management module is used to extract the configuration information of sensor data points inside the gateway device; The structured CSV configuration file template defines rows and a series of predefined columns. Each row corresponds to a sensor data point, and each predefined column corresponds to various configuration information of the sensor data point. The export unit writes the configuration information of all data points inside the sensor into the structured CSV configuration file template according to the definition of rows and predefined columns in the structured CSV configuration file template, thus forming a CSV format file; The import unit converts the CSV format file into configuration information of the sensor data points of the gateway device according to the definition of rows and predefined columns in the structured CSV configuration file template, and applies it to the gateway device.
7. The system for sensor configuration transfer via structured CSV files according to claim 6, characterized in that: The CSV format file parsing engine also includes a validity verification unit, which verifies the validity of the configuration information of the parsed sensor data points and applies the verified configuration information to the gateway.
8. The system for sensor configuration transfer via structured CSV files according to claim 7, characterized in that: The validity verification includes register address range verification, function code matching item verification, data type matching item verification, and data length verification.
9. The system for sensor configuration transfer via structured CSV files according to claim 6, characterized in that: The structured CSV configuration file template includes predefined columns such as an identifier column for defining the basic identity of sensor data points, a protocol communication column for defining the communication rules between the gateway and the sensors, a data parsing column for defining how to convert raw register values into engineering data with actual physical meaning, a service type column for defining the four remote sensing types of sensor data points, a bit parsing column for specifying bit-level operations when processing Boolean values or bit states, a semantic mapping column for defining enumerated values, and a model classification column for classifying and managing sensors within the gateway.