Data processing method of Magic Box in response to base station query commands
By using a three-tiered verification system consisting of a magic box, base station, and cloud, multiple verification codes are generated and verified, solving the problem of authenticity and reliability of data transmission in the digital factory, ensuring data integrity and legality, and achieving stable data transmission and accuracy.
Patent Information
- Application Number
- CN202511516403.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-23
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2045-10-23
AI Technical Summary
In digital factories, the lack of effective verification mechanisms during data transmission between acquisition terminals, intermediate transmission equipment, and cloud platforms leads to data loss, data tampering, or data errors, making it impossible to guarantee the authenticity and reliability of the data.
A three-level verification system consisting of a data acquisition device, a base station, and the cloud is adopted. By generating and verifying multiple verification codes, the integrity and authenticity of the data are verified step by step. This includes the data acquisition device generating the first verification code, the data acquisition device generating the second verification code, the base station generating the third verification code, and the cloud generating the fourth verification code. Finally, the data is converted into a universal format.
It effectively filters out erroneous and tampered data caused by interference or malfunctions during transmission, improving the authenticity and reliability of data transmission and ensuring the integrity and legality of data received in the cloud.
Smart Images

Figure CN121013053B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of big data processing, and particularly relates to a data processing method for responding to a base station inquiry instruction by a magic box. BACKGROUND
[0002] In the production and operation process of a digital factory, there are frequent and diverse big data transmission requirements of a large number of data collection devices (such as production devices, electricity meters, etc.), which usually communicate with a base station through a wireless network. In general, in core scenarios such as online manufacturing supervision, energy management, and automatic device control, the running status data of the data collection devices need to be accurately and efficiently acquired to support device monitoring, energy consumption control, cost allocation, and device remote control, and other key businesses.
[0003] Currently, when digital factory data is transmitted between a collection terminal, an intermediate transmission device, and a cloud platform, there is a lack of effective verification mechanism, and data loss, data tampering, or data errors are easily caused by transmission interference, device failure, and other factors, thereby making the authenticity and reliability of the original data obtained by the cloud unable to be guaranteed.
[0004] Therefore, how to improve the authenticity and reliability of data transmission is a technical problem worthy of attention. SUMMARY
[0005] In view of this, to solve the above-mentioned part or all technical problems, the present disclosure provides a data processing method for responding to a base station inquiry instruction by a magic box.
[0006] In a first aspect, the present disclosure provides a data processing method for responding to a base station inquiry instruction by a magic box, the method comprising:
[0007] a data collection device collects running status data, generates first transmission data containing a first check code based on the running status data, and sends the first transmission data to a magic box;
[0008] the magic box verifies the first transmission data based on the first check code obtained by analyzing the first transmission data, generates second transmission data containing a second check code based on the first transmission data in the case that the first transmission data passes the verification, and sends the second transmission data to a base station in response to an inquiry instruction of the base station;
[0009] the base station verifies the second transmission data based on the second check code obtained by analyzing the second transmission data, generates third transmission data containing a third check code based on the second transmission data in the case that the second transmission data passes the verification, and sends the third transmission data to a cloud;
[0010] The cloud checks the third transmission data based on a third check code obtained by analyzing the third transmission data; and converts target data corresponding to the running status data in the third transmission data into general format data in a case where the third transmission data passes the check.
[0011] In some possible implementation manners, the second transmission data is sent to the base station, including:
[0012] The second transmission data is integrated into a hexadecimal array;
[0013] The target function containing the hexadecimal array is sent to the base station; and
[0014] The second transmission data is checked based on a second check code obtained by analyzing the second transmission data, including:
[0015] The second transmission data is checked based on a second check code obtained by analyzing the second transmission data in the target function.
[0016] In some possible implementation manners, the target function containing the hexadecimal array is sent to the base station, including:
[0017] The address of the magic box pre-burned is read from a preset storage space in the magic box;
[0018] The target function containing the hexadecimal array and the address is sent to the base station.
[0019] In some possible implementation manners, the first transmission data is sent to the magic box, including:
[0020] The communication instruction sent by the magic box is received;
[0021] A fourth check code is obtained by analyzing the communication instruction;
[0022] The communication instruction is checked based on the fourth check code;
[0023] The first transmission data is sent to the magic box in a case where the communication instruction passes the check.
[0024] In some possible implementation manners, the cloud stores device identifiers of a plurality of data acquisition devices, and the third transmission data includes the device identifier of the data acquisition device; and
[0025] The third transmission data is checked based on a third check code obtained by analyzing the third transmission data, including:
[0026] The third transmission data is analyzed to obtain the device identifier and the third check code in the third transmission data;
[0027] It is determined whether the analyzed device identifier is included in the device identifiers stored by the cloud;
[0028] If the device identifier stored in the cloud contains the parsed device identifier, the third transmitted data is verified based on the third checksum.
[0029] In some possible implementations, based on the second transmitted data, third transmitted data containing a third checksum is generated, including:
[0030] Based on the second transmitted data, determine the operational status data;
[0031] The operational status data is processed according to a preset processing strategy to obtain the processed data.
[0032] Generate third transmission data containing a third checksum and processed data; and
[0033] Convert the target data corresponding to the operational status data in the third transmission data into a common format data, including:
[0034] The processed data in the third transmission data is used as the target data corresponding to the operational status data.
[0035] Convert the target data into a common format.
[0036] In some possible implementations, the magic box determines the base station to be established for communication in the following way:
[0037] In response to the activation of the Magic Box, search for multiple base stations within the Magic Box's signal coverage area;
[0038] Determine the signal strength, first load data, and historical packet loss rate of each of the multiple base stations. The historical packet loss rate represents the percentage of data packets lost during data transmission between the base station and the magic box within a historical time period, relative to the total number of data packets transmitted.
[0039] Based on the signal strength, initial load data, and historical packet loss rate of each of the multiple base stations, a base station to be established for communication connection is selected from the multiple base stations.
[0040] In some possible implementations, a base station to be selected for establishing a communication connection is selected from multiple base stations based on their respective signal strength, first load data, and historical packet loss rate, including:
[0041] Based on the absolute value of signal strength from smallest to largest, a target number of base stations are selected from multiple base stations to obtain a subset of base stations;
[0042] For the base stations in the base station subset, the signal strength, load value represented by the first load data, and historical packet loss rate of the base station are standardized and weighted summated to obtain the calculation results.
[0043] The base station with the largest calculation result in the base station subset is identified as the base station to be established for communication connection.
[0044] In some possible implementations, the target number is determined based on the load of the magic box.
[0045] In some possible implementations, after the magic box establishes a communication connection with the base station, the magic box is also used to receive second load data from the base station with which the communication connection has been established; and
[0046] Based on the signal strength, initial load data, and historical packet loss rate of multiple base stations, base stations from which a communication connection to be established are selected, including:
[0047] Determine the duration for which the load value represented by the second load data is greater than or equal to a preset value;
[0048] If the duration is greater than or equal to the preset duration, the base station to be established is selected from multiple base stations based on their respective signal strength, first load data and historical packet loss rate.
[0049] The data processing method for a magic box responding to a base station query command provided in this embodiment can be implemented by a data acquisition device collecting operational status data. The data acquisition device then generates first transmission data containing a first checksum based on the operational status data. The data acquisition device then sends the first transmission data to the magic box. The magic box verifies the first transmission data based on the first checksum obtained from parsing the first transmission data. If the first transmission data passes verification, the magic box generates second transmission data containing a second checksum based on the first transmission data. Responding to a base station query command, the magic box sends the second transmission data to the base station. The base station then verifies the second transmission data based on the second checksum obtained from parsing the second transmission data. If the second transmission data passes verification, the base station generates third transmission data containing a third checksum based on the second transmission data and sends the third transmission data to the cloud. Subsequently, the cloud verifies the third transmission data based on the third checksum obtained from parsing the third transmission data. If the third transmission data passes verification, the cloud converts the target data corresponding to the operational status data in the third transmission data into a universal format data. Thus, a three-level verification system involving the magic box, base station, and cloud is used to verify the data. The triple verification mechanism effectively filters out erroneous and tampered data caused by interference or malfunctions during transmission, thereby improving the authenticity and reliability of data transmission. Attached Figure Description
[0050] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0051] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0052] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0053] Figure 1 A flowchart illustrating a data processing method for a magic box responding to a base station query command, provided in an embodiment of this disclosure;
[0054] Figure 2 A flowchart illustrating another data processing method for responding to base station query commands in accordance with an embodiment of this disclosure;
[0055] Figure 3 A flowchart illustrating another data processing method for responding to base station query commands in accordance with an embodiment of this disclosure;
[0056] Figure 4 This is a schematic diagram of the structure of a data processing system for responding to base station query commands provided in an embodiment of this disclosure. Detailed Implementation
[0057] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It is obvious that the described embodiments are only a part of, and not all, of the embodiments described herein. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the present disclosure.
[0058] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of this disclosure are only used to distinguish different steps, devices or modules, and do not represent any specific technical meaning, nor do they indicate the logical order between them.
[0059] It should also be understood that in this embodiment, "multiple" can refer to two or more, and "at least one" can refer to one, two or more.
[0060] It should also be understood that any component, data or structure mentioned in the embodiments of this disclosure can generally be understood as one or more unless expressly defined or given to the contrary in the context.
[0061] Furthermore, the term "and / or" in this disclosure is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this disclosure generally indicates that the preceding and following related objects have an "or" relationship.
[0062] It should also be understood that the description of the various embodiments in this disclosure emphasizes the differences between the various embodiments, and the similarities or similarities can be referred to each other. For the sake of brevity, they will not be described in detail.
[0063] The following description of at least one exemplary embodiment is merely illustrative and is not intended to limit the scope of this disclosure or its application or use.
[0064] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0065] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0066] It should be noted that, unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other. To facilitate understanding of the embodiments of this disclosure, the disclosure will be described in detail below with reference to the accompanying drawings and embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0067] To address the technical challenge of improving the authenticity and reliability of data transmission in existing technologies, this disclosure provides a data processing method for a magic box responding to base station query commands. This method utilizes a three-tiered verification system involving the magic box, base station, and cloud to verify the data. This triple verification mechanism effectively filters out erroneous and tampered data caused by interference or faults during transmission, thereby enhancing the authenticity and reliability of data transmission.
[0068] Figure 1 This is a flowchart illustrating a data processing method for a magic box responding to a base station query command, provided in an embodiment of this disclosure. Figure 1 As shown, the method specifically includes:
[0069] Step 101: The data acquisition device collects operational status data; based on the operational status data, it generates first transmission data containing a first verification code; and sends the first transmission data to the magic box.
[0070] In this embodiment, the data acquisition device is used to acquire various types of operational status data. As an example, the data acquisition device can be production equipment, electricity meters, or other devices in a digital factory. Here, the data acquisition device can collect operational status data, generate first transmission data containing a first checksum based on the operational status data, and send the first transmission data to the magic box.
[0071] Operational status data refers to various types of data reflecting the operating status of data acquisition equipment, covering equipment operating parameters, process execution parameters, and energy consumption data. For example, operational status data may include, but is not limited to: operating parameters of production equipment, such as the spindle speed and feed rate of a CNC machine tool; and energy consumption data from electricity meters, such as the useful work value recorded per hour by the electricity meters of a production line.
[0072] Check codes (including first check codes, second check codes, and third check codes) are codes generated to verify whether there are errors or tampering during data transmission. They are calculated from the original data using a specific algorithm. The receiver calculates and compares the check codes using the same algorithm to determine the integrity and authenticity of the data.
[0073] The first checksum is used by the magic box to verify the first transmitted data.
[0074] The first transmitted data includes a first checksum and operational status data; or, the first transmitted data includes a first checksum and operational status data after pre-processing (e.g., format conversion, adding timestamps).
[0075] As an example, the first transmitted data could be "00 03 0C 08 92 08 95 08 97 00 07 00 09 0008 D4 C2", and its format could be the address bits of the data acquisition device, function code, operating status data, and a first checksum. The first checksum could be a CRC (Cyclic Redundancy Check) code. In the example above, the first checksum is "D4 C2".
[0076] Cyclic Redundancy Check (CRC) codes are obtained by performing polynomial division on the data to obtain a fixed-length check code.
[0077] The Magic Box is an intermediate data processing device used in digital factories. It can perform one or more functions including data reception, parsing, verification, format conversion, and responding to query commands. It can connect to data acquisition devices and base stations. The Magic Box can have multiple communication interfaces, allowing it to connect to data acquisition devices using different communication methods such as RS485 (Recommended Standard 485, a differential signal transmission technology) and Ethernet, such as electricity meters and production equipment. The Magic Box can integrate an STM32F103 chip, storing address information in its internal FLASH (Flash Memory), supporting convenient address modification and rapid replacement.
[0078] Here, operating status data such as temperature, rotation speed, and useful work can be collected through data acquisition equipment.
[0079] In addition, a hexadecimal cyclic redundancy check algorithm can be used to calculate the operation status data, obtain the first check code, and then combine the operation status data and the first check code in a fixed order to generate the first transmission data containing the first check code.
[0080] Step 102: The Magic Box verifies the first transmission data based on the first checksum obtained by parsing the first transmission data; if the first transmission data passes the verification, it generates second transmission data containing a second checksum based on the first transmission data; in response to the query command from the base station, it sends the second transmission data to the base station.
[0081] In this embodiment, the magic box can verify the first transmission data based on the first check code obtained by parsing the first transmission data. If the first transmission data passes the verification, the magic box can also generate second transmission data containing a second check code based on the first transmission data. In response to the query command from the base station, the magic box can send the second transmission data to the base station.
[0082] Here, each magic box can be used to connect multiple data acquisition devices.
[0083] The second check code is used by the base station to verify the second transmitted data.
[0084] The second transmitted data includes a second checksum and operational status data; or, the second transmitted data includes a second checksum and operational status data after pre-processing (e.g., format conversion, adding timestamps).
[0085] Here, the Magic Box can extract a fixed length (e.g., 2 bytes) of data from a preset position (e.g., the end) of the first transmitted data according to a preset transmission data format (e.g., "operational status data + checksum"), and use this as the first checksum obtained through parsing. Alternatively, after reading the first transmitted data, the Magic Box can determine the starting position and length of the first checksum in the first transmitted data based on the format identifier in the data header (e.g., "00 03" indicates the length of subsequent data and the position of the checksum), and extract the first checksum.
[0086] During verification, the Magic Box can use the same hexadecimal cyclic redundancy check algorithm as the data acquisition device to recalculate the check code for the operating status data in the first transmitted data. The calculated result is compared with the parsed first check code. If they match, the verification passes.
[0087] Step 103: The base station verifies the second transmission data based on the second check code obtained by parsing the second transmission data; if the second transmission data passes the verification, it generates third transmission data containing a third check code based on the second transmission data; and sends the third transmission data to the cloud.
[0088] In this embodiment, the base station refers to the intermediate transmission and processing device used to receive data sent by the Magic Box, perform verification, parsing and integration, and then upload it to the cloud. It has the ability to perform secondary data verification and upload data to the 4G (4th Generation Mobile Communication Technology) network, and serves as a bridge connecting the Magic Box and the cloud.
[0089] Here, a single base station can establish communication with multiple data boxes, receiving secondary transmission data sent by each box, integrating it, and uploading it to the cloud in a unified manner, avoiding data chaos caused by multiple boxes communicating directly with the cloud. In remote factory scenarios, the base station overcomes the limitations of wired networks through the 4G network, achieving stable data uploads to the cloud.
[0090] An inquiry command is a message sent by the base station to the magic box to trigger it to send the processed second transmission data. The inquiry command has a fixed format and includes the base station's identification of the magic box and data request information. Inquiry commands can be used to standardize the timing of data transmission by the magic box, avoiding transmission conflicts caused by disordered data transmission and ensuring that the base station can proactively obtain the processed data from the magic box as needed. The base station can send inquiry commands to the magic box at fixed intervals (e.g., every minute) to ensure that the cloud can obtain device operation data in real time. Inquiry commands can be standardized hexadecimal numbers, such as "00 02 3002".
[0091] The third verification code is used to verify the third-party transmitted data in the cloud.
[0092] The third transmitted data includes a third checksum and operational status data; or, the third transmitted data includes a third checksum and operational status data after pre-processing (e.g., format conversion, adding timestamps).
[0093] Here, the base station can extract a fixed length (e.g., 2 bytes) of data from a preset position (e.g., the end) of the second transmitted data according to a preset transmission data format (e.g., "operational status data + checksum"), and use this as the parsed second checksum. Alternatively, after reading the second transmitted data, the base station can determine the starting position and length of the second checksum in the second transmitted data based on the format identifier in the data header (e.g., "00 03" indicates the length of subsequent data and the position of the checksum), and extract the second checksum.
[0094] During verification, the base station can use the same hexadecimal cyclic redundancy check algorithm as the Magic Box to recalculate the check code for the operational status data in the second transmitted data. The calculated result is compared with the parsed second check code. If they match, the verification passes.
[0095] Step 104: The cloud verifies the third transmission data based on the third checksum obtained from parsing the third transmission data; if the third transmission data passes the verification, the target data corresponding to the running status data in the third transmission data is converted into general format data.
[0096] In this embodiment, the cloud refers to a remote cloud platform with data storage, verification, format conversion, and big data analysis capabilities, which can receive data uploaded by the base station and perform further verification and processing.
[0097] Here, the cloud can receive third-party transmission data sent by the base station, perform final verification to ensure the data is authentic and valid, and convert the target data in the third-party transmission data into a universal format data, which is convenient for digital factories to carry out business applications such as online monitoring and energy management.
[0098] In energy management scenarios, the cloud performs statistical analysis on the converted general-format energy consumption data to generate unit product energy consumption reports, providing a basis for cost allocation; in online monitoring scenarios, the cloud converts equipment operating parameters into visual charts, allowing factory managers to view equipment status in real time.
[0099] Common format data refers to data (such as hexadecimal operational status data, hexadecimal processed data) converted into standardized data formats that are human-readable and can be directly used for business analysis and applications, such as numerical values, charts, reports, etc.
[0100] As an example, in a cost-sharing scenario, the cloud can convert the hexadecimal data corresponding to the useful work of the electricity meter into a universally formatted energy consumption value (such as "500kWh") for unit product energy consumption calculation; in an equipment maintenance scenario, the cloud can convert the hexadecimal data corresponding to the equipment fault code into a universally formatted fault description (such as "spindle bearing wear") to facilitate maintenance personnel in quickly locating problems.
[0101] Here, the cloud can extract a fixed length of data from a preset position in the third transmitted data according to a pre-defined transmission data format (such as "operational status data + checksum"), parse the third transmitted data, and thus obtain the device identifier and the third checksum from the third transmitted data. Alternatively, after reading the third transmitted data, the cloud can determine the starting position and length of the device identifier and the third checksum in the third transmitted data based on the format identifier in the data header (such as "00 03" indicating the length of subsequent data and the position of the checksum), and extract the device identifier and the third checksum.
[0102] During verification, the cloud can use the same hexadecimal cyclic redundancy check algorithm as the base station to recalculate the check code for the operational status data in the third transmitted data. The calculated result is compared with the parsed third check code, and if they match, the verification passes.
[0103] Here, the cloud can read the hexadecimal target data from the third-transmission data, convert the hexadecimal data to decimal values through code, and then add unit identifiers (such as "kWh" or "rpm") to generate general-format data. Alternatively, the cloud can also convert the encoded target data (such as fault code "0007") in the third-transmission data into corresponding text descriptions (such as "equipment overload fault") according to a preset data mapping table to generate general-format data.
[0104] For the same operational status data, the first check code, the second check code, the third check code, and the fourth check code (described later) can be the same or different from each other.
[0105] Therefore, in the above scheme, the data acquisition device generates first transmission data containing a first checksum, and the magic box verifies the data using the first checksum; the magic box generates second transmission data containing a second checksum, and the base station verifies the data using the second checksum; the base station generates third transmission data containing a third checksum, and the cloud verifies the data using the third checksum. These three verifications function in the three key transmission links: data acquisition device-magic box, magic box-base station, and base station-cloud. Each layer of verification filters out erroneous data caused by transmission interference or equipment failure, preventing erroneous data from entering the next link. Simultaneously, after receiving the first transmission data from different devices, the magic box generates second transmission data in a unified format, resolving the issue of communication protocol differences between different devices; the base station uses an interrogation command to trigger the magic box to send data, avoiding transmission conflicts caused by the magic box sending data out of order.
[0106] In some optional implementations of this embodiment, the cloud stores device identifiers of multiple data acquisition devices, and the third transmitted data includes the device identifiers of the data acquisition devices.
[0107] Based on this, the third transmission data can be verified using the third checksum obtained from parsing the third transmission data:
[0108] The first step is to parse the third transmitted data to obtain the device identifier and the third checksum from the third transmitted data.
[0109] The device identifier of a data acquisition device refers to a standardized code used to uniquely identify the data acquisition device. It is globally unique and consists of numbers, letters, or specific symbols. It is the core identifier used by the cloud to distinguish different data acquisition devices and verify the legitimacy of data sources.
[0110] As an example, the equipment identifier can be a hexadecimal code in the format of "F01-M03-005" which is "Factory Code + Equipment Type Code + Serial Number". Here, "F01" represents the first factory, "M03" represents the meter type, and "005" represents the fifth meter.
[0111] Here, the cloud can extract a fixed length (e.g., 2 bytes) of data from a preset position (e.g., the end) of the third transmitted data according to a pre-defined data transmission format (e.g., "operational status data + checksum"), using this data as the parsed third checksum. Alternatively, the magic box can, after reading the third transmitted data, determine the starting position and length of the third checksum within the third transmitted data based on the format identifier in the data header (e.g., "00 03" indicating the length of subsequent data and the position of the checksum), and extract the third checksum.
[0112] The second step is to determine whether the device identifier in the cloud storage contains the parsed device identifier.
[0113] Here, the cloud can compare the parsed device identifier with the list of device identifiers stored in the database one by one. If there is a completely matching identifier, it is determined that it is included; if no matching identifier is found after the traversal, it is determined that it is not included.
[0114] The third step involves verifying the transmitted data based on the third checksum, provided that the device identifier stored in the cloud contains the parsed device identifier.
[0115] Here, the third transmitted data can be further verified based on the third checksum only if the device identifier stored in the cloud contains the parsed device identifier; if the device identifier stored in the cloud does not contain the parsed device identifier, then it is not necessary to verify the third transmitted data based on the third checksum.
[0116] Understandably, in the above-mentioned optional implementation methods, the cloud first parses the third-party transmitted data to obtain the device identifier and the third-party verification code. It then verifies the legitimacy of the data source by comparing the device identifier stored in the cloud, and finally verifies the data integrity based on the third-party verification code, forming a dual verification logic of "identity verification + data verification." This logic first filters out false data sent by illegal data collection devices, preventing cloud data from being contaminated and solving the problem that a single verification code cannot identify illegal data sources. Simultaneously, the device identifier is uploaded along with the third-party transmitted data, enabling the cloud to classify and manage data according to device identifiers, solving the problem of tracing data from multiple devices. Furthermore, the dual verification ensures that the data received by the cloud is both legal and complete, providing a reliable data foundation for subsequent format conversion and business applications.
[0117] In some optional implementations of this embodiment, the third transmission data containing the third checksum can be generated based on the second transmission data in the following manner:
[0118] The first step is to determine the operational status data based on the second transmitted data.
[0119] Here, the second transmitted data may include operational status data. Therefore, operational status data can be extracted from the second transmitted data.
[0120] The second step is to process the operational status data according to the preset processing strategy to obtain the processed data.
[0121] Among them, the preset processing strategy refers to the pre-configured standardized processing rules for operational status data. It is set according to the business needs of the digital factory (such as customized requirements from the client and data format specifications), and may include operations such as data format conversion, information supplementation, and numerical calibration. It is the basis for ensuring that the processed data meets the requirements of cloud applications.
[0122] Processed data refers to the data obtained by the base station after processing the operational status data according to the preset processing strategy.
[0123] For example, the operational status data can be the meter's useful work data "00 03 9B 23" which is specially processed by adding time as required by the client, and changed to "0A 30 00 03 9B 23" ("0A 30" is a time-related code). This "time-added processing" is the preset processing strategy, and "0A 30 00 03 9B 23" is the processed data.
[0124] The third step is to generate third transmission data containing a third checksum and processed data.
[0125] Here, the third checksum and the processed data can be concatenated in a preset order to obtain the third transmitted data.
[0126] Based on this, the cloud can convert the target data corresponding to the operational status data in the third-party transmitted data into a common format data in the following way:
[0127] The first step is to use the processed data in the third transmitted data as the target data corresponding to the operational status data.
[0128] The second step is to convert the target data into a common format.
[0129] The target data refers to specific data that needs to be converted into a common data format in the cloud.
[0130] Common format data refers to standardized data that is human-readable and can be directly used in digital factory business applications after the target data is converted in the cloud. For example, it may include information such as data source (e.g., equipment name), data meaning (e.g., useful work, temperature), numerical value, unit, timestamp, etc.
[0131] Furthermore, the cloud can perform operations such as storage and transmission of data in common formats.
[0132] As an example, if the target data is useful work data with timestamps (such as "0A 30 00 03 9B 23"), the cloud first converts the time code "0A 30" into a specific time (such as "10:30"), converts the useful work data "00 03 9B 23" into decimal "14775kWh", and then combines it according to the format of "device identifier + time + data type + value" to obtain the general format data "meter 1 10:30 useful work: 14775kWh".
[0133] Understandably, in the above-mentioned optional implementation methods, the base station first determines the operational status data from the second transmitted data to avoid interference from irrelevant data; then it processes the data according to a preset processing strategy (such as adding time) to make the data meet the detailed business requirements, eliminating the need for secondary processing in the cloud; it generates third transmitted data containing a third checksum to ensure data transmission integrity; and the cloud explicitly uses the processed data as the target data for format conversion to avoid invalid conversion. This process shifts the data processing burden from the cloud to the base station, reducing cloud computing power consumption; at the same time, through preset strategies and clearly defined target data, it ensures that the converted general-format data is directly usable, solving the problems of the original data requiring additional cloud processing and the unclear conversion target.
[0134] In some optional implementations of this embodiment, the magic box can determine the base station to be established for communication connection in the following manner:
[0135] The first step, in response to the activation of the Magic Box, is to search for multiple base stations within the Magic Box's signal coverage area.
[0136] Here, after the Magic Box is activated, its wireless communication module can scan the broadcast signals sent by surrounding base stations at a preset frequency (e.g., once per second), parse the base station identification information in the broadcast signals, and filter out multiple base stations within the signal coverage area (signal strength greater than or equal to -110dBm). Alternatively, the Magic Box can send a base station search request through its 4G module, receive the response signals returned by surrounding 4G base stations, determine whether it is within the coverage area based on the strength of the response signals, and collect information on multiple base stations that meet the criteria.
[0137] Signal coverage range refers to the physical spatial range within which the Magic Box's communication module (such as a wireless communication module) can receive base station signals. This range is affected by factors such as the Magic Box's communication power, base station signal strength, and environmental obstructions (such as factory walls).
[0138] The second step is to determine the signal strength, initial load data, and historical packet loss rate of each of the multiple base stations.
[0139] Signal strength refers to the power of the signal transmitted by the base station received by the Magic Box, usually measured in decibels and milliwatts (dBm). The closer the value is to 0, the stronger the signal. It is used to measure the quality of the communication link between the base station and the Magic Box.
[0140] The first load data refers to the current workload of the base station when searching for magic boxes. It usually includes indicators such as the number of magic boxes currently connected to the base station, the length of the data transmission queue, and the CPU (Central Processing Unit) utilization rate.
[0141] Historical packet loss rate refers to the percentage of data packets lost during data transmission between the base station and the aforementioned "magic box" within a historical time period (such as the past 24 hours). It is an indicator reflecting the long-term communication stability of the base station.
[0142] Here, the Magic Box can send indicator query commands to each searched base station, and the base station, upon receiving the command, returns its current signal strength (obtained through the signal detection module); alternatively, the Magic Box can collect the signal strength of each base station in real time through its own signal detection unit. Furthermore, the Magic Box can obtain the initial load data and historical packet loss rate of each base station through the base station management system. The base station management system can be used to statistically analyze the initial load data and historical packet loss rate of each base station.
[0143] The third step involves selecting a base station from among multiple base stations based on their respective signal strength, initial load data, and historical packet loss rate.
[0144] Here, weights can be assigned to the three indicators (e.g., signal strength corresponds to a weight of 40%, first load data corresponds to a weight of 30%, and historical packet loss rate corresponds to a weight of 30%). Each indicator is standardized (e.g., signal strength -60dBm is standardized to 100 points, and -90dBm is standardized to 40 points; the lower the load value represented by the first load data and the lower the historical packet loss rate, the higher the score). The comprehensive score of each base station is calculated, and the base station with the highest score is selected as the base station to establish a communication connection.
[0145] Understandably, in the above-mentioned optional implementation methods, after the magic box starts, it first searches for base stations within the signal coverage area to ensure the feasibility of the selection range; then it acquires three core indicators of the base station: signal strength (to ensure communication quality), initial load data (to avoid congestion), and historical packet loss rate (to ensure long-term reliability), avoiding the limitations of selecting a single indicator; finally, it selects a base station based on a comprehensive consideration of the three indicators, ensuring that the selected base station simultaneously meets the requirements of "good signal, low load, and historical reliability." This solution solves the transmission instability problem caused by random selection or selection of a single indicator, laying the foundation for the stable transmission of subsequent second transmission data.
[0146] Optionally, the Magic Box also uses the following method to determine the base station to establish a communication connection: In response to the Magic Box startup, it receives a list of base station distributions around the Magic Box deployment location from the cloud; based on the distribution list, it sends signal detection requests to the base stations in the list to determine the signal strength, real-time data transmission rate, and number of Magic Boxes currently connected to each base station (a type of first load data); based on signal strength (weight 30%), real-time transmission rate (weight 40%), and number of Magic Boxes currently connected (weight 30%), it calculates the comprehensive adaptability of each base station and selects the base station with the highest adaptability to establish a communication connection.
[0147] In some cases, the base station to be established for communication can also be determined in the following way:
[0148] First, after the Magic Box is started, it searches for multiple base stations within the Magic Box's signal coverage area, determines the signal strength, remaining load value (representing remaining load), and historical packet loss rate of each base station, identifies the data acquisition devices connected to the Magic Box, the total amount of data transmitted to the Magic Box by each connected data acquisition device within a preset time period (e.g., 1 hour), and the importance of the data collected by each connected data acquisition device (e.g., high, medium, low).
[0149] Next, based on the total data volume, the remaining load threshold of the base station to be established is determined. Based on the importance, the packet loss rate threshold of the communication connection to be established is determined.
[0150] Here, by pre-setting a correspondence table, the remaining load threshold of the base station to be established for communication can be determined based on the total data volume, and the packet loss rate threshold of the communication connection to be established can be determined based on the importance.
[0151] Then, among the searched base stations, those whose remaining load value is greater than or equal to the remaining load threshold, whose absolute signal strength value is less than or equal to the preset absolute signal strength value (indicating a good signal), and whose historical packet loss rate is less than or equal to the packet loss rate threshold are identified as a subset of base stations. For the base stations in this subset, their signal strength, remaining load value, and historical packet loss rate are standardized (using unified dimensions), and then the three standardized results are weighted and summed to obtain the final calculation result.
[0152] Finally, the base station with the largest calculation result in the base station subset is determined as the base station to be established for communication connection.
[0153] Therefore, the above scheme adopts a method of coarse screening followed by fine selection. First, a subset of base stations meeting basic requirements is selected through multi-dimensional threshold filtering. Then, the base stations in the subset are weighted and calculated to select the most suitable base station for the current communication needs of the Magic Box. This approach not only improves the controllability of communication quality but also enhances adaptability in complex network environments, effectively ensuring the stability and efficiency of data transmission. Furthermore, by dynamically adjusting the remaining load threshold and packet loss rate threshold involved in the base station selection strategy based on the total data volume and data importance of the Magic Box's currently connected data acquisition devices, and combining this with a preset absolute signal strength value for initial base station screening, the actual communication needs of the Magic Box can be matched more accurately, thereby achieving optimal utilization of communication resources in different scenarios.
[0154] In some application scenarios of the above-mentioned optional implementation methods, the following approach can be used to select the base station to establish a communication connection from multiple base stations based on their respective signal strength, initial load data, and historical packet loss rate:
[0155] The first step is to select a target number of base stations from multiple base stations in ascending order of absolute signal strength to obtain a subset of base stations.
[0156] The target number refers to the number of candidate base stations selected by the Magic Box when filtering base stations, after sorting them from smallest to largest based on the absolute value of the signal strength. This number can be a fixed value set in advance, or it can be pre-configured or dynamically adjusted according to the actual scenario.
[0157] A base station subset refers to the set formed by selecting a target number of base stations from all searched base stations in ascending order of absolute signal strength.
[0158] The second step involves standardizing and weighting the signal strength, load value represented by the first load data, and historical packet loss rate of the base stations in the base station subset, and then performing a summation calculation to obtain the calculation results.
[0159] Here, the Magic Box can pre-store the weights of each indicator, standardize each indicator to 0-100 points according to "(actual value - minimum value) / (maximum value - minimum value) × 100" (negative indicators are reversed, such as the lower the load value, the higher the score), and then calculate the weighted sum according to the weights to obtain the calculation result for each base station; or, the Magic Box can also obtain dynamic weights from the cloud (adjusted according to the current communication busyness of the factory, such as increasing the load value weight to 40% during peak periods), map the signal strength to a fixed score according to the dBm value (-50dBm corresponds to 100 points, -55dBm corresponds to 90 points), and map the load value and historical packet loss rate to a score according to a preset level (such as the load value ≤30% corresponds to 100 points, 30%-50% corresponds to 80 points), and then calculate the weighted sum according to the dynamic weights.
[0160] The third step is to identify the base station with the largest calculation result in the base station subset as the base station to be established for communication connection.
[0161] Understandably, in the above application scenario, a subset of target base stations can be formed by first filtering them based on signal strength, eliminating base stations with weak signals, reducing unnecessary calculations, and solving the problem of resource waste. Then, a weighted summation calculation is used to convert multi-dimensional indicators into a comprehensive score, ensuring objective and consistent evaluation and avoiding subjective selection bias. Finally, the base station with the highest score is selected, ensuring that the selected base station simultaneously meets the requirements of "strong signal, low load, and low historical packet loss rate." This process improves the efficiency of base station screening while ensuring the reliability of the selection results.
[0162] Optionally, based on the signal strength, first load data, and historical packet loss rate of each of the multiple base stations, the base station to be established for communication can be selected from the multiple base stations. This includes: selecting a target number of base stations from the multiple base stations in ascending order of historical packet loss rate to obtain a subset of base stations; for the base stations in the subset of base stations, standardizing and weighting the signal strength, load value represented by the first load data, and historical packet loss rate of the base station (with the historical packet loss rate weight increased to 40%, signal strength to 35%, and load value to 25%) to obtain the calculation result; and determining the base station with the largest calculation result in the subset of base stations as the base station to be established for communication.
[0163] In some of the above application scenarios, the target quantity is determined based on the load of the magic box.
[0164] Among them, the load of the Magic Box refers to the amount of work and resource consumption status that the Magic Box is currently undertaking. It usually includes quantitative indicators such as the number of production equipment and electricity meters currently connected to the Magic Box, the length of the first data transmission queue to be processed, CPU utilization, and memory utilization. It is a core parameter that reflects the Magic Box's current data processing capability and resource stress.
[0165] Here, based on the preset mapping relationship between load level and target quantity (e.g., high load → target quantity 2; medium load → target quantity 3; low load → target quantity 5), the Magic Box determines its own load level and directly calls the corresponding mapping relationship to obtain the target quantity; or, the Magic Box can also use a dynamic calculation formula to determine the target quantity, such as "target quantity = initial quantity (e.g., 5) - INT (load value / 30%)" (INT is the rounding function, and the load value is expressed as a percentage). When the load value is 25%, the target quantity = 5 - 0 = 5; when the load value is 50%, the target quantity = 5 - 1 = 4; when the load value is 80%, the target quantity = 5 - 2 = 3. The target quantity is linearly adjusted with the load through the formula.
[0166] As can be understood, in the above scheme, the target number is determined based on the magic box load. The core logic is that "load and target number are negatively correlated." That is, when the magic box load is high, the target number is reduced to decrease the computational load of base station screening and avoid crowding out the computing power of core functions such as data collection and verification. When the load is low, the target number is increased to expand the range of candidate base stations and increase the probability of selecting the optimal base station. This design solves the problem of mismatch between the fixed target number and the magic box's computing power, ensuring that the base station screening process does not affect the core functions of the magic box and can optimize the selection results when resources allow.
[0167] Optionally, the number of targets can also be determined based on the load of the magic box and the base station distribution density. The magic box first determines its own load level (high, medium, low), and then obtains the distribution density of surrounding base stations (i.e., a subset of base stations) (such as the number of base stations per square kilometer) through signal scanning; if the base station distribution density is high (>5 / square kilometer), the number of basic targets corresponding to the load is reduced by 1 (e.g., the number of basic targets for high load is 2→1); if the base station distribution density is low (<2 / square kilometer), the number of basic targets corresponding to the load is increased by 1 (e.g., the number of basic targets for low load is 5→6); if the density is medium, the number of basic targets remains unchanged.
[0168] This scheme introduces a base station distribution density parameter on the basis of the original scheme to avoid computational redundancy due to an excessive number of targets in densely populated base station areas, or to avoid a lack of high-quality candidates due to an insufficient number of targets in sparsely populated base station areas.
[0169] In some optional implementations of this embodiment, after the magic box establishes a communication connection with the base station, the magic box is also used to receive the second load data of the base station with which the communication connection has been established.
[0170] The second load data refers to the dynamic load status data of the base station that is fed back to the magic box in real time after the magic box establishes a communication connection with the base station. Compared with the "first load data" (initial load) obtained when the magic box selects a site, it focuses more on the real-time load changes after the connection. It usually includes quantitative indicators such as the total number of magic boxes currently connected to the base station, the real-time data transmission bandwidth utilization rate, and the CPU utilization rate.
[0171] Based on this, the following method can be used to select the base station from multiple base stations to establish a communication connection, based on the signal strength, initial load data, and historical packet loss rate of each base station:
[0172] The first step is to determine the duration for which the load value represented by the second load data is greater than or equal to a preset value.
[0173] The preset value refers to the threshold value set in advance to determine whether the base station load exceeds the standard.
[0174] Duration refers to the continuous time during which the base station's load value is greater than or equal to a preset value. It is used to distinguish between "short-term overload" and "continuous overload" to prevent the Magic Box from misjudging the long-term load status of the base station due to instantaneous load fluctuations (such as data transmission peaks at a certain moment).
[0175] The preset duration refers to the time threshold set in advance by the Magic Box to determine whether a reselection of a base station needs to be triggered due to continuous overload. It is usually determined based on the real-time requirements of data transmission services. The higher the real-time requirements, the shorter the preset duration should be to respond quickly to load issues; the lower the real-time requirements, the longer the preset duration can be to avoid frequent link switching.
[0176] The second step is to select a base station from multiple base stations to establish a communication connection, based on the signal strength, first load data and historical packet loss rate of each base station, provided that the duration is greater than or equal to the preset duration.
[0177] Here, the process of selecting a base station to establish a communication connection from multiple base stations based on their respective signal strength, initial load data, and historical packet loss rate can be referred to the above description and will not be repeated here.
[0178] Understandably, in the above solution, after establishing a connection with the base station, the magic box monitors the base station's load changes in real time by receiving second load data. It first determines whether the load value is greater than or equal to a preset value, then calculates the duration of this state. Only when the duration is greater than or equal to the preset duration is a new base station selected. This process firstly solves the problem of "unnoticed persistently high base station load after connection," ensuring timely detection of excessive load through real-time monitoring. Secondly, the "duration" judgment filters out instantaneous load fluctuations, avoiding frequent reselection of a base station and disrupting communication continuity.
[0179] Optionally, after the magic box establishes a communication connection with the base station, the magic box can also receive the second load data and real-time packet loss rate data of the base station with which the communication connection has been established; and select the base station to establish a communication connection from the multiple base stations based on the signal strength, first load data and historical packet loss rate of the multiple base stations, including: determining the superposition duration of the load value represented by the second load data being greater than or equal to a preset value and the real-time packet loss rate being greater than or equal to a preset packet loss rate (e.g., 1%); and selecting the base station to establish a communication connection from the multiple base stations based on the signal strength, first load data and real-time packet loss rate of the multiple base stations when the superposition duration is greater than or equal to the preset duration.
[0180] It should be noted that, where there is no conflict, the technical features described in different alternative implementations can be included in the same embodiment. For the sake of brevity, they will not be elaborated here.
[0181] The data processing method for a magic box responding to a base station query command provided in this embodiment can be implemented by a data acquisition device collecting operational status data. The data acquisition device then generates first transmission data containing a first checksum based on the operational status data. The data acquisition device then sends the first transmission data to the magic box. The magic box verifies the first transmission data based on the first checksum obtained from parsing the first transmission data. If the first transmission data passes verification, the magic box generates second transmission data containing a second checksum based on the first transmission data. Responding to a base station query command, the magic box sends the second transmission data to the base station. The base station then verifies the second transmission data based on the second checksum obtained from parsing the second transmission data. If the second transmission data passes verification, the base station generates third transmission data containing a third checksum based on the second transmission data and sends the third transmission data to the cloud. Subsequently, the cloud verifies the third transmission data based on the third checksum obtained from parsing the third transmission data. If the third transmission data passes verification, the cloud converts the target data corresponding to the operational status data in the third transmission data into a universal format data. Thus, a three-level verification system involving the magic box, base station, and cloud is used to verify the data. The triple verification mechanism effectively filters out erroneous and tampered data caused by interference or malfunctions during transmission, thereby improving the authenticity and reliability of data transmission.
[0182] The following describes the embodiments of this disclosure by way of example. However, it should be noted that the following content is only used to understand the technical solutions of the embodiments of this disclosure and does not constitute a limitation on the protection scope of the embodiments of this disclosure.
[0183] The Magic Box can be applied to online monitoring, energy management, and automated equipment control in digital factories. Online monitoring involves monitoring the operational status of production equipment, such as equipment operating parameters, process parameters, quality, and safety. Energy management provides real-time data on the energy consumption of production equipment, converting the useful work from multiple meters into reliable, universal information and breaking down energy consumption to the unit product for cost allocation and control. It also provides energy-saving and consumption-reducing solutions for product energy consumption and equipment efficiency. Automated equipment control provides real-time online solutions for alarm handling, emergency response, and remote control.
[0184] In this solution, the Magic Box can send fixed-format communication commands to production equipment and electricity meters (i.e., data acquisition devices), receive and parse the returned data (i.e., the first transmission data), extract the required information using a preset formula, and assemble a sending function (i.e., the target function). Upon receiving an inquiry command from the base station, it responds and sends the data. The base station verifies, parses, and integrates the received data (i.e., the second transmission data), then uploads it to the cloud via the 4G network. The cloud then performs final data verification and format conversion, transforming the raw data into readable general information (i.e., the aforementioned general format data), thus achieving accurate acquisition and secure uploading of device data.
[0185] Specifically, the Magic Box sends a communication command A "00 03 00 40 0009 85 C9" (production equipment and meter address bits + function code + starting address + data length + CRC checksum) to the device (i.e., the data acquisition device) to obtain the data B (i.e., the first transmitted data) "00 03 0C 08 92 08 95 08 97 00 07 00 09 00 08 D4C2" (address bits + function code + returned data + CRC checksum) returned by the device. It then verifies whether 00 03 0C 0892 08 95 08 97 00 07 00 09 00 08 is D4 C2 (i.e., the first checksum) using a hexadecimal MODBUS CRC checksum to determine if the data returned by the device is authentic and reliable. If the data is reliable, the Magic Box analyzes the returned data (first transmitted data) to determine the location of the required data (operational status data), i.e., data 08. The data sequence 92 08 95 08 97 00 07 00 09 00 08 (with the same communication command and returned data format) can be used to directly obtain the location of the required data through the magic box. This data is then parsed using the formula k1m = k1 * 0xFA / 0x2710 (where k1m represents the parsed data; *0xFA / 0x2710 represents multiplying by hexadecimal 0xFA and dividing by hexadecimal 0x2710; the parsing method is developed based on the communication protocol provided by the equipment manufacturer or meter manufacturer). This data is then integrated into a hexadecimal array to form the required sending function C: "0002 30 02 00 E8 00 EB 00 EC 00 07 00 09 00 08 00 03 9B 23 93". E3 (Company + Factory + Function Code + Device Address + Combined Data (i.e., the above array) + CRC Check). The communication protocols and methods of different production equipment and electricity meters vary greatly. The Magic Box converts the received data into a unified format. When the Magic Box receives the query command D "00 02 30 02" sent by the base station, it sends the sending function to the base station for secondary processing, verification, and cloud upload.
[0186] After receiving data from the "magic box", the base station performs a hexadecimal MODBUS CRC check on the received function "00 02 30 02 00 E8 00 EB 00EC 00 07 00 09 00 08 00 03 9B 23 93 E3" to confirm its validity. It also performs further parsing and integration of specific data (e.g., for useful data like "00 03 9B 23", it refines the requirements, adding time and other special processing to change it to "0A 30 00 03 9B 23"). After confirmation and integration, the base station sends the processed data to the cloud via the 4G module. The cloud then verifies the data again to determine its authenticity and validity, checking the first four digits of the code "00 02 30 02" for correctness, and then re-verifying "00 02 30 02 00 E8 00 EB 00 EC 00 0700 09 00 08 00". The hexadecimal MODBUS CRC check value of 03 9B 23 is 93 E3. After the data undergoes triple verification by the Magic Box, base station, and cloud, the ASIIC data in the array is converted into a viewable, universal format data through big data analysis in the cloud.
[0187] It should be noted that, in addition to the contents described above, this embodiment may also include the technical features described in the above embodiments, thereby achieving the technical effect of the data processing method of the magic box responding to the base station query command shown above. Please refer to the above description for details. For the sake of brevity, it will not be elaborated here.
[0188] Figure 2 This is a flowchart illustrating another data processing method for a magic box responding to a base station query command, provided in an embodiment of this disclosure. Figure 2 As shown, the method specifically includes:
[0189] Step 201: The data acquisition device collects operational status data; based on the operational status data, it generates first transmission data containing a first verification code; and sends the first transmission data to the magic box.
[0190] In this embodiment, step 201 and Figure 1 Step 101 in the corresponding embodiment is basically the same, and will not be repeated here.
[0191] Step 202: The Magic Box verifies the first transmission data based on the first checksum obtained by parsing the first transmission data; if the first transmission data passes the verification, it generates second transmission data containing a second checksum based on the first transmission data; in response to the query command from the base station, it integrates the second transmission data into a hexadecimal array; and sends a target function containing a hexadecimal array to the base station.
[0192] In this embodiment, a hexadecimal array refers to an ordered data set composed of hexadecimal digits (0-9, AF) in a fixed order. Each element corresponds to a specific data field, possessing the characteristics of clear data structure, small storage space occupation, and high compatibility with industrial equipment parsing. Here, the sending function (i.e., the target function) C "00 02 30 02 00 E800 EB 00 EC 00 07 00 09 00 08 00 03 9B 23 93 E3" generated by the magic box is a hexadecimal array containing the second transmission data, where each element corresponds to fields such as company, factory, and function code.
[0193] The objective function refers to a standardized data transmission unit containing a hexadecimal array (including the second transmission data). It has a fixed format structure and includes fields such as data identifier and data body (hexadecimal array), which are used for standardized data interaction between the magic box and the base station.
[0194] Here, the magic box converts each field in the second transmitted data into hexadecimal values according to the preset data field order (such as "device address + function code + operating parameters + intermediate calculation results"), and fills them into an array of preset length in order to form a hexadecimal array, such as integrating them into an array in the order of "company + factory + function code + device address + combined data".
[0195] In addition, the Magic Box can establish a wired communication connection with the base station through the default communication port (which can be modified). According to the MODBUS protocol format, the target function containing a hexadecimal array is encapsulated into a MODBUS frame and sent to the designated communication port of the base station via serial port.
[0196] In addition, step 202 and Figure 1 Step 102 in the corresponding embodiment is basically the same, and will not be repeated here.
[0197] Step 203: The base station verifies the second transmission data based on the second check code obtained by parsing the second transmission data in the objective function; if the second transmission data passes the verification, it generates third transmission data containing a third check code based on the second transmission data; and sends the third transmission data to the cloud.
[0198] In this embodiment, after the base station reads the target function, it extracts the second transmission data body from the target function except for the second check code according to a preset format, recalculates the check code of the data body using the hexadecimal MODBUS CRC check algorithm, and compares the calculation result with the second check code parsed from the target function. If they match, the check passes.
[0199] In addition, step 203 and Figure 1 Step 103 in the corresponding embodiment is basically the same, and will not be repeated here.
[0200] Step 204: The cloud verifies the third transmission data based on the third checksum obtained by parsing the third transmission data; if the third transmission data passes the verification, the target data corresponding to the running status data in the third transmission data is converted into general format data.
[0201] In this embodiment, step 204 and Figure 1 Step 104 in the corresponding embodiment is basically the same, and will not be repeated here.
[0202] In some optional implementations of this embodiment, the target function containing a hexadecimal array can be sent to the base station in the following manner:
[0203] The first step is to read the address of the pre-burned Magic Box from the preset storage space inside the Magic Box.
[0204] The second step is to send a target function containing a hexadecimal array and an address to the base station.
[0205] The preset storage space inside the Magic Box refers to a dedicated storage area inside the Magic Box used to store fixed configuration information (such as the Magic Box address). It features data retention even when power is off and fast read speed. For example, the preset storage space can be flash memory.
[0206] The address of the pre-programmed Magic Box refers to the unique identification information written into the Magic Box's preset storage space by a special tool before the Magic Box leaves the factory or is deployed. It has global uniqueness and is used to distinguish different Magic Boxes. The format is usually a fixed-length code (such as hexadecimal code).
[0207] Here, the Magic Box concatenates the read Magic Box address into a hexadecimal array in a preset order (such as address first, hexadecimal array second) to form a complete data sequence containing the address. Then, it adds the identifier field of the target function and the check code, and sends it to the base station through the communication port according to the MODBUS protocol.
[0208] Understandably, the above solution, which reads pre-programmed addresses from the pre-set storage space inside the magic box, avoids the tedious operation of manually configuring addresses and reduces maintenance costs. Sending a target function containing a hexadecimal array and the address to the base station enables the base station to identify the magic box by address, accurately distinguishing data from different magic boxes in multi-magic-box scenarios and resolving the problem of data ownership confusion. Simultaneously, the pre-programmed addresses are stored inside the magic box and are not lost upon power failure, ensuring that the magic box can still read addresses normally after restarting, thus ensuring data transmission continuity.
[0209] It should be noted that, in addition to the contents described above, this embodiment may also include... Figure 1 The corresponding technical features described in the corresponding embodiments, thereby achieving Figure 1For details on the technical effects of the data processing method for the magic box in response to base station query commands, please refer to [link / reference needed]. Figure 1 The relevant descriptions are presented concisely and will not be elaborated upon here.
[0210] Based on the embodiments of this disclosure, the second transmitted data is integrated into a hexadecimal array, transforming the potentially scattered second transmitted data into a structured data set. Combined with the design of "the magic box converting received data into a unified format," parsing difficulties caused by chaotic data formats are avoided. A target function containing the hexadecimal array is sent to the base station, further encapsulating the structured hexadecimal array into a standardized transmission unit, ensuring the base station can quickly identify and receive it. During verification, the second checksum is parsed based on the second transmitted data in the target function, ensuring the correspondence between the obtained second checksum and the second transmitted data, avoiding verification errors caused by data misalignment. This process solves the problems of low parsing efficiency and easy data loss in unstructured data transmission.
[0211] Figure 3 This is a flowchart illustrating another data processing method for a magic box responding to a base station query command, provided in an embodiment of this disclosure. (See attached diagram.) Figure 3 As shown, the method specifically includes:
[0212] Step 301: The data acquisition device collects operational status data; based on the operational status data, it generates first transmission data containing a first verification code; it receives a communication command sent by the magic box; it parses the communication command to obtain a fourth verification code; based on the fourth verification code, it verifies the communication command; if the communication command verification passes, it sends the first transmission data to the magic box.
[0213] In this embodiment, the communication command refers to the standardized command sent by the Magic Box to the data acquisition device, which is used to instruct the data acquisition device to send specified type of operation status data. It has a fixed format and usually includes fields such as data acquisition device address, function code, starting address, data length, and check code.
[0214] The fourth check code is an encoding appended to the communication command sent by the magic box. It is used to verify whether there are any errors, losses or tamperings in the communication command during transmission. It is calculated by a specific verification algorithm on the core fields (excluding the check code) in the communication command and is the basis for the data acquisition device to judge the validity of the communication command.
[0215] Here, the data acquisition device can establish a wired or wireless connection with the Magic Box through a preset communication interface in order to receive communication commands sent by the Magic Box.
[0216] In addition, the data acquisition device can determine the fourth checksum by following the fixed format of the communication command (such as "address bits + function code + start address + data length + fourth checksum"), identifying the last fixed byte (e.g., the last 2 bytes) of the communication command, and extracting the last 2 bytes of data from the command as the parsed fourth checksum. Alternatively, the data acquisition device can read the format identifier field (e.g., "00 03") from the header of the communication command, determine the starting index and length of the fourth checksum according to the format rules corresponding to this identifier, and extract the corresponding segment from the communication command to obtain the fourth checksum.
[0217] The data acquisition device can use the same hexadecimal MODBUS CRC algorithm as the fourth check code generated by the Magic Box to recalculate the check values of other fields in the communication command (such as address bits, function code, starting address, and data length) except for the fourth check code. The calculated results are compared with the parsed fourth check code. If they match, the communication command verification is successful.
[0218] Step 302: The Magic Box verifies the first transmission data based on the first checksum obtained by parsing the first transmission data; if the first transmission data passes the verification, it generates second transmission data containing a second checksum based on the first transmission data; in response to the query command from the base station, it sends the second transmission data to the base station.
[0219] In this embodiment, step 302 and Figure 1 Step 102 in the corresponding embodiment is basically the same, and will not be repeated here.
[0220] Step 303: The base station verifies the second transmission data based on the second check code obtained by parsing the second transmission data; if the second transmission data passes the verification, it generates third transmission data containing a third check code based on the second transmission data; and sends the third transmission data to the cloud.
[0221] In this embodiment, step 303 and Figure 1 Step 103 in the corresponding embodiment is basically the same, and will not be repeated here.
[0222] Step 304: The cloud verifies the third transmission data based on the third checksum obtained by parsing the third transmission data; if the third transmission data passes the verification, the target data corresponding to the running status data in the third transmission data is converted into general format data.
[0223] In this embodiment, step 304 and Figure 1 Step 104 in the corresponding embodiment is basically the same, and will not be repeated here.
[0224] It should be noted that, in addition to the contents described above, this embodiment may also include... Figure 1The corresponding technical features described in the corresponding embodiments, thereby achieving Figure 1 For details on the technical effects of the data processing method for the magic box in response to base station query commands, please refer to [link / reference needed]. Figure 1 The relevant descriptions are presented concisely and will not be elaborated upon here.
[0225] Based on the embodiments of this disclosure, the data acquisition device first receives the communication command from the magic box, then parses it to obtain the fourth verification code and verifies the communication command. Only after the verification is successful does it send the first transmission data. This process verifies the validity of the communication command first, avoiding the data acquisition device from sending useless data due to incorrect communication commands. At the same time, sending the first transmission data only when the communication command is valid reduces the occupation of communication bandwidth by invalid data, ensures the smooth flow of other normal data transmission channels, and provides a matching and valid data foundation for the subsequent verification of the first transmission data by the magic box.
[0226] Figure 4 This is a schematic diagram of the structure of a data processing system for responding to base station query commands provided in an embodiment of this disclosure.
[0227] like Figure 4 As shown, the data processing system for responding to base station query commands includes: data acquisition device 401, magic box 402, base station 403, and cloud 404.
[0228] The data acquisition device 401 acquires operational status data; based on the operational status data, it generates first transmission data containing a first checksum; and sends the first transmission data to the magic box.
[0229] The magic box 402 verifies the first transmission data based on the first check code obtained by parsing the first transmission data; if the first transmission data passes the verification, it generates second transmission data containing a second check code based on the first transmission data; and in response to the query command of the base station, it sends the second transmission data to the base station.
[0230] The base station 403 verifies the second transmission data based on the second check code obtained by parsing the second transmission data; if the second transmission data passes the verification, it generates third transmission data containing a third check code based on the second transmission data; and sends the third transmission data to the cloud.
[0231] The cloud-based 404 verifies the third transmission data based on the third checksum obtained by parsing the third transmission data; if the third transmission data passes the verification, the target data corresponding to the operation status data in the third transmission data is converted into general format data.
[0232] The data processing system for responding to base station query commands provided in this embodiment can execute the corresponding steps of the data processing methods for responding to base station query commands described above, thereby achieving the technical effects of the data processing methods for responding to base station query commands described above. The data processing system and methods for responding to base station query commands can be referenced and used in each other in terms of specific implementation and technical effects. For the sake of brevity, they will not be elaborated here.
[0233] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.
[0234] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A data processing method for a magic box to respond to a base station inquiry instruction, characterized in that, The method comprises: The data acquisition device collects the operation condition data; based on the operation condition data, first transmission data containing a first check code is generated; the first transmission data is sent to the magic box; The magic box checks the first transmission data based on the first check code obtained by analyzing the first transmission data; in the case that the first transmission data passes the check, second transmission data containing a second check code is generated based on the first transmission data; in the case that the first transmission data fails the check, the first transmission data is filtered; the second transmission data is sent to the base station in response to the inquiry instruction of the base station; The base station checks the second transmission data based on the second check code obtained by analyzing the second transmission data; in the case that the second transmission data passes the check, third transmission data containing a third check code is generated based on the second transmission data; in the case that the second transmission data fails the check, the second transmission data is filtered; the third transmission data is sent to the cloud; The cloud checks the third transmission data based on the third check code obtained by analyzing the third transmission data; in the case that the third transmission data passes the check, target data corresponding to the operation condition data in the third transmission data is converted into general format data; in the case that the third transmission data fails the check, the third transmission data is filtered; Wherein, the following method is used to determine the base station to be established for communication connection: After the magic box is started, a plurality of base stations within the signal coverage range of the magic box are searched, the signal strength, the residual load value and the historical packet loss rate of each of the plurality of base stations are determined, the data acquisition devices connected to the magic box are determined, the total data amount transmitted by each of the data acquisition devices connected to the magic box to the magic box within a preset time length is determined, and the importance of the data collected by each of the data acquisition devices connected to the magic box is determined; Based on the total data amount, the residual load threshold of the base station is determined; Based on the importance, the packet loss rate threshold of the base station is determined; Among the plurality of searched base stations, the base station whose residual load value is greater than or equal to the residual load threshold, the absolute value of the signal strength is less than or equal to the preset signal strength absolute value, and the historical packet loss rate is less than or equal to the packet loss rate threshold is determined as a subset of base stations; For the base stations in the subset of base stations, the signal strength, the residual load value and the historical packet loss rate of the base stations are standardized, and then the weighted sum of the standardized results is calculated to obtain a calculation result; The base station with the largest calculation result in the subset of base stations is determined as the base station to be established for communication connection.
2. The method of claim 1, wherein, The sending of the second transmission data to the base station comprises: The second transmission data is integrated into a hexadecimal array; The target function containing the hexadecimal array is sent to the base station; and The checking of the second transmission data based on the second check code obtained by analyzing the second transmission data comprises: The second transmission data is checked based on the second check code obtained by analyzing the second transmission data in the target function.
3. The method of claim 2, wherein, The sending of the target function containing the hexadecimal array to the base station comprises: reading the pre-burned address of the magic box from the preset storage space inside the magic box; sending the target function containing the hexadecimal array and the address to the base station.
4. The method of claim 1, wherein, The sending of the first transmission data to the magic box comprises: receiving a communication instruction sent by the magic box; parsing the communication instruction to obtain a fourth check code; verifying the communication instruction based on the fourth check code; in the case that the communication instruction passes the verification, sending the first transmission data to the magic box.
5. The method of claim 1, wherein, The cloud storage has a plurality of device identifiers of data acquisition devices, and the third transmission data comprises a device identifier of a data acquisition device. And The verification of the third transmission data based on the third check code obtained by parsing the third transmission data comprises: parsing the third transmission data to obtain the device identifier and the third check code in the third transmission data; determining whether the parsed device identifier is contained in the device identifiers stored in the cloud; in the case that the parsed device identifier is contained in the device identifiers stored in the cloud, verifying the third transmission data based on the third check code.
6. The method of claim 1, wherein, The generation of the third transmission data containing a third check code based on the second transmission data comprises: determining the running status data based on the second transmission data; processing the running status data according to a preset processing strategy to obtain processed data; generating third transmission data containing a third check code and the processed data; and The conversion of the target data corresponding to the running status data in the third transmission data into general format data comprises: taking the processed data in the third transmission data as the target data corresponding to the running status data; converting the target data into general format data.
7. The method according to one of claims 1 to 6, characterized in that The magic box determines the base station to be established for communication connection in the following way: in response to the start of the magic box, searching for a plurality of base stations within the signal coverage range of the magic box; determining the signal strength, first load data and historical packet loss rate of each of the plurality of base stations, wherein the historical packet loss rate represents the percentage of the number of lost data packets in the process of data transmission between the base station and the magic box in the historical time period to the total number of transmitted data packets; selecting the base station to be established for communication connection from the plurality of base stations based on the signal strength, first load data and historical packet loss rate of each of the plurality of base stations.
8. The method of claim 7, wherein, The selection of the base station to be established for communication connection from the plurality of base stations based on the signal strength, first load data and historical packet loss rate of each of the plurality of base stations comprises: selecting a target number of base stations from the plurality of base stations in the order of the absolute value of the signal strength from small to large to obtain a subset of base stations; for the base stations in the subset of base stations, performing standardization processing and weighted summation calculation on the signal strength, load value represented by the first load data and historical packet loss rate of the base station to obtain a calculation result; determining the base station with the largest calculation result in the subset of base stations as the base station to be established for communication connection.
9. The method of claim 8, wherein, The target number is determined based on the load of the magic box.
10. The method of claim 7, wherein, After the magic box establishes the communication connection with the base station, the magic box is further configured to receive second load data of the base station with which the communication connection is established. And The selecting the base station to be established the communication connection from the plurality of base stations based on the signal strength, the first load data and the historical packet loss rate of each base station comprises: determining a duration that a load value represented by the second load data is greater than or equal to a preset value; in a case that the duration is greater than or equal to a preset duration, selecting the base station to be established the communication connection from the plurality of base stations based on the signal strength, the first load data and the historical packet loss rate of each base station.
Citation Information
Patent Citations
Water environment monitoring method and system based on Internet of Things, and storage medium
CN120028506A