AIoT device updating method and system

By collecting process status and network parameters in the AIoT device update method, generating update allow flags, combining hash value comparison and Q-Learning model, the problems of memory conflicts and network fluctuations in device updates are solved, and the stable and efficient update of the device in complex environments is achieved.

CN120342870AActive Publication Date: 2025-07-18BEIJING SHENZHOU BANGBANG TECH SERVICE CO LTD

Patent Information

Application Number
CN202510796102.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-07-18
Estimated Expiration
2045-06-16

AI Technical Summary

Technical Problem

The existing AIoT device update method fails to effectively integrate the current state of the device, resulting in memory address conflicts not being dynamically detected, update errors are caused when network parameters are muted, resource waste and performance declines, and the recovery mechanism after the update fails to be differentiated in combination with the global state, affecting the stability and efficiency of industrial gateway equipment.

Method used

By collecting the process status of industrial gateway equipment, verifying the memory address conflict overlap rate, generating storage blocks to be updated, combining the cosine similarity of network bandwidth, packet loss rate and storage delay rate to generate update allow flags, using hash value comparison to generate version replacement or skip instructions, and using the Q-Learning model to determine the storage block update failure, counting the number of failures to perform recovery or version update operations.

Benefits of technology

Dynamically identify potential resource conflicts, avoid inefficient updates, improve the robustness of the equipment in complex load scenarios, ensure that the equipment maintains basic functions in extreme cases, and improves the stability and efficiency of the update process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120342870A_ABST
    Figure CN120342870A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of equipment firmware updating, in particular to an AIoT equipment updating method and system.The AIoT equipment updating method comprises the following steps that the process state verification memory address overlapping rate is collected to generate a to-be-updated block, the to-be-updated block is extracted, network parameters are normalized, cosine similarity is calculated, and an updating mark is generated; generating a replacement or skipping instruction by combining the block and the mark comparison version hash, writing incremental data, judging the number of failures through a Q-Learning model, counting the number of failures, analyzing the global state, and executing recovery or version updating. According to the method, the upgrading interruption risk is reduced by dynamically recognizing the memory address conflict overlapping region, the network bandwidth, the packet loss rate and the storage delay parameter are evaluated to avoid low-efficiency updating, the version compatibility is accurately judged through Hash comparison to prevent system crash, the load prediction failure risk is analyzed in combination with Q-Learning, and the updating robustness is enhanced. And a multi-level fault-tolerant mechanism is established to maintain basic functions of the equipment by counting the number of failures, and stability and efficiency are improved by cooperating with dynamic scheduling and environmental perception.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of device firmware update, and particularly to an AIoT device update method and system. Background Art

[0002] The technical field of device firmware update includes technical contents such as version management, transmission verification, and execution control of the underlying program of the embedded system. Its core lies in realizing the reliable replacement and function iteration of the device running program through firmware data verification mechanism, transmission protocol optimization strategy, and version difference processing rules. This field involves technical processes such as segmented verification and validation of firmware binary files, differential comparison algorithms for incremental update packages, device-side exception rollback mechanisms, and multi-node collaborative update timing control, and needs to solve key problems such as packet loss and retransmission in the wireless transmission environment, hardware compatibility adaptation, and cross-version upgrade conflict detection. Among them, an AIoT device update method refers to byte-level comparison of firmware version differences through differential compression algorithms to generate incremental update packages that only contain changed data, combined with a dual-backup mechanism for device-side storage partitions. During the firmware writing stage, a dual-verification strategy of block cyclic redundancy check and exclusive-or check is adopted. Through the version consistency negotiation protocol between multi-hop relay nodes, the transmission path priority and packet retransmission times threshold are dynamically adjusted. At the same time, based on the hash mapping relationship between the device hardware identification code and the firmware version number, a version dependency tree is established to solve cross-generation upgrade conflicts.

[0003] The deficiencies of the prior art are that it lacks deep integration of the current running state of the device, and resource allocation only depends on preset thresholds or static policies, and cannot effectively cope with sudden memory occupancy fluctuations or network parameter mutations. For example, when multiple processes share the storage area and the update data volume surges, the existing methods are prone to overwrite errors caused by the failure to dynamically detect memory address conflicts, resulting in the termination of key processes or data corruption. The existing version dependency determination is usually based on fixed rules and does not consider the dynamic impact of the device running environment on the compatibility of differential packages. It may trigger invalid updates due to network packet loss or storage delay anomalies, causing waste of bandwidth resources and degradation of device performance. The existing recovery mechanism for update failures mostly adopts a single rollback strategy and does not perform differential processing in combination with global state analysis. In the high-load scenario of industrial gateways, it may exacerbate system resource consumption due to frequent rollbacks and extend the device unavailable time. The existing verification process focuses on packet integrity detection and ignores the impact of hardware load on the writing process. When the CPU or memory usage rate surges in the short term, it is easy to cause update interruption or system deadlock due to resource contention, affecting the continuous operation of the production line. Summary of the Invention

[0004] In order to solve the technical problems existing in the prior art, embodiments of the present invention provide an AIoT device update method and system. The technical solution is as follows: To achieve the above object, the present invention adopts the following technical solutions. An AIoT device update method includes the following steps: S1: Collect the current process status through an industrial gateway device, check the overlap rate of memory address conflicts in the process status, compare the overlap rate with an overlap threshold, and generate a storage block to be updated according to the comparison result; S2: Extract the corresponding area to be updated of the industrial gateway device in the storage block to be updated, collect the network bandwidth utilization rate, data transmission packet loss rate, and storage I / O delay rate parameters, represent them in vector form after normalization, calculate the cosine similarity between the parameters, and generate a device update permission flag according to the similarity degree; S3: Combine the storage block to be updated and the device update permission flag, calculate and compare the hash values of the current version and the target version of the incremental package, and generate a version replacement or skip instruction; S4: Write the incremental package data into the storage block to be updated according to the version replacement or skip instruction, input the current CPU load and memory occupancy of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails, and count the number of update failures; S5: Compare the number of update failures with a determination threshold, analyze the global state of the industrial gateway device, and perform an operation to restore to the original state or update the global version number to obtain the update result of the industrial gateway device.

[0005] As a further solution of the present invention, the storage block to be updated includes the memory address intersection coverage rate, the driver version span judgment value, and the storage sub-block number that meets the dependency condition. The device update permission flag is specifically the normalized bandwidth value, the standard I / O ratio, the similarity calculation value, and the boolean determination identifier obtained according to the hash verification result. The version replacement or skip instruction includes the sub-block number, the target version number, the hash verification key, the replacement access status, and the exception record identifier. The number of update failures is specifically the write pointer position, the original checksum and the original version number. The number of update failures is specifically the abnormal write behavior recorded by backtracking verification based on the write pointer position, and the failure number accumulated and statistically obtained in the state where the current write version number does not pass the verification by combining the original checksum comparison result. The update result of the industrial gateway device includes the failure rollback flag, the instruction clearing status, the global version update number, the storage block release amount, and the alarm signal trigger status.

[0006] As a further solution of the present invention, the specific steps of collecting the current process status through an industrial gateway device, checking the overlap rate of memory address conflicts in the process status, comparing the overlap rate with an overlap threshold, and generating a storage block to be updated include: S101: Collect the start value and end value of the memory address call range, the driver version number date, and the process mutex identifier for each driver patch in the incremental package. Obtain the start value and end value of the memory occupancy address segment of the industrial gateway device, the current driver version number date, and the process mutex identifier during operation. Calculate the ratio of the length of the overlapping address segment to the total length of the call range, which is defined as the memory overlap rate. Call the memory address conflict threshold, calculate the deviation between the memory overlap coverage rate and the conflict threshold, and generate the conflict deviation degree; The unit of the memory address conflict threshold is a percentage, and its source is based on device operation data, laboratory stress test results, and statistical analysis. The value range is from 10% to 30%; The incremental package is generated according to the driver difference information and the target version characteristics; The intersection coverage threshold is calculated according to the ratio of the address space allocation granularity set in the memory management unit to the driver call granularity; Both the length of the overlapping address segment and the total length of the call range are in bytes; S102: Based on the patches with a conflict deviation degree lower than the deviation threshold screened by the memory overlap coverage rate, extract the driver version number date and the device current version date, convert the two dates into span values in days, and perform a sorting comparison with the version span threshold to generate the patch update priority; The version span threshold is calculated according to the minimum safe interval period for version replacement set in the driver program lifecycle management specification combined with the statistical data of the average stable operation duration of the device platform. The obtained value is used to measure the necessity and urgency of version replacement; The deviation threshold is set according to the memory address conflict probability distribution in the industrial gateway device operation data record and the version update stability test results; S103: Call the patch update priority, screen the patches with a priority value greater than or equal to 1, extract the process mutex identifier and the mutex identifier during device operation for a complete string match, retain the patches with successful matches, sort them in ascending order of the memory address call range, and merge the patch number and version number to generate the storage block to be updated.

[0007] As a further solution of the present invention, it is characterized in that the specific steps of extracting the corresponding area to be updated of the industrial gateway device in the storage block to be updated, collecting the network bandwidth utilization rate, data transmission packet loss rate, and storage I / O latency rate parameters, representing them in vector form after normalization, calculating the cosine similarity between the parameters, and generating the device update permission flag according to the similarity degree include: S201: Extract the sub-block number based on the storage block to be updated, call the start and end timestamps of the associated running task time window, collect the original value of the network bandwidth utilization rate of the industrial gateway device within the time window, calculate the original value with the maximum bandwidth capacity of the device network interface, and generate a bandwidth normalization rate; The bandwidth normalization rate = original bandwidth / maximum bandwidth capacity; S202: Call the bandwidth normalization rate, filter out the time periods with values less than or equal to the standard threshold of the bandwidth utilization rate, collect the original sequence of data transmission packet loss rate within the time period, calculate the sequence data according to the exponential smoothing algorithm to generate a packet loss stability coefficient, and at the same time collect the current value of the storage I / O delay rate in the same time period, call the device storage reference delay, and compare the current delay with the reference value to generate a delay deviation ratio; S203: Construct a four-dimensional vector in sequence with the bandwidth normalization rate, packet loss stability coefficient, delay deviation ratio, and suppression stability factor, calculate the cosine similarity between the vectors. If the similarity is greater than or equal to the preset consistency threshold and the delay deviation ratio is less than or equal to 1.0, it is determined that the update condition is established, and a device update permission flag is generated.

[0008] The preset consistency threshold is an empirical value obtained based on the statistical analysis of the historical operation data of the industrial gateway device; As a further solution of the present invention, perform multi-dimensional parameter processing on the network and storage status of the industrial gateway device, using the formula: ; Calculate the cosine similarity ; Among them, represents the similarity adjustment coefficient of the i-th dimension, where i = 1, 2, 3, 4 correspond to the bandwidth normalization rate, packet loss stability coefficient, delay deviation ratio, and suppression stability factor respectively, In, the delay deviation ratio is the most critical indicator. The larger the delay deviation ratio, the larger the importance coefficient, and the value range is from 0.1 to 0.4, represents the i-th dimension of the current network status vector, that is, the real-time collected network parameter value represents the i-th dimension of the historical reference vector, that is, the preset network parameter reference value, represents the summation operation on the parameters of the four dimensions.

[0009] As a further solution of the present invention, combining the storage block to be updated and the device update permission flag, the specific steps for calculating and comparing the hash values of the current version and the target version of the incremental package to generate a version replacement or skip instruction include: S301: Based on the storage block to be updated and the update permission flag, call the sub-block identification information and the current status parameters, perform a block-level update admission determination operation, calculate whether to allow the update respectively according to the version status corresponding to the identification and the update permission flag, filter the sub-blocks that meet the update conditions, and generate an update block number; S302: According to the update block number, call the hash values corresponding to the sub-block version and the incremental package version, perform a consistency comparison according to the hash value matching method, match the target incremental package version number according to the sub-block number, identify the items with inconsistent versions and record the differential block information, and generate a block consistency difference value; The hash value matching method is SHA-256 verification; S303: Call the block consistency difference value, combine the sub-block number and the update permission flag, readjust the update permission status of the corresponding sub-block according to the comparison result, and integrate the allowed update number, the target version number and the corresponding hash value verification information to generate a replacement instruction including the sub-block number, the target version number and the verification key. If the sub-block does not meet the update conditions, record the exception and generate a skip instruction, and obtain the replacement instruction and the skip instruction.

[0010] As a further solution of the present invention, writing the incremental package data into the storage block to be updated according to the version replacement or skip instruction, and inputting the current CPU load and memory occupancy of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails. The specific steps for counting the number of update failures include: S401: Execute the replacement operation according to the replacement instruction, create a segmented snapshot of the current write pointer position, the original checksum and the sub-block version number for the target sub-block, call the segmented write verification function to write the incremental package data in the order of the hash key attached to the replacement instruction, monitor the change of the offset position after each write and record the update range interval, and generate a segmented snapshot information set; The generation of the incremental package data is based on generating a minimized driver patch from the binary difference between the target version and the current version, verifying the data integrity and version compatibility by combining the hash verification chain and the version dependency tree, and matching the current operating load condition of the device through a dynamically adjusted verification threshold; S402: Based on the write pointer position and the update range interval in the segmented snapshot information set, collect the current CPU load rate and memory occupancy rate of the industrial gateway device, construct a two-dimensional state space parameter group of CPU occupancy and memory usage, input the state space parameter group into the trained Q-Learning reinforcement model as model training data, call the model policy table to obtain the exclusive OR verification threshold corresponding to the current state, and match it to the corresponding snapshot section to generate a dynamic verification threshold; The dynamic verification threshold generation method of the Q-Learning reinforcement model realizes dynamic adjustment of the XOR verification threshold by constructing a two-dimensional state space parameter group CPU load rate and memory occupancy rate, combining the reward and punishment function and the model strategy table; The Q-Learning model is a reward and punishment function setting constructed based on the abnormal check rate, resource occupancy level and write result status triple in the storage write status feedback. The reward and punishment function of the Q-Learning model adopts a weight distribution of 0.6 and 0.4. Through the weighted combination of the abnormal check rate and the resource occupancy level, the system operation efficiency is taken into account while ensuring data reliability, and the model is guided to learn the optimal XOR check threshold adjustment; S403: According to the XOR check threshold matched in the dynamic check threshold matrix, recalculate the current checksum for each snapshot segment and perform XOR operation with the original checksum of the snapshot, determine whether each result is zero, and if the XOR result is non-zero, mark the replacement failure and increase the continuous failure counter of the partition block by one, and count the number of update failures.

[0011] As a further solution of the present invention, the specific steps of comparing the number of update failures with the determination threshold, analyzing the global state of the industrial gateway device, performing the operation of restoring to the original state or updating the global version number, and obtaining the update result of the industrial gateway device include: S501: Perform global state determination based on the continuous failure counter and the preset fault tolerance threshold, call the number of replacement failures corresponding to all partition blocks, compare it with the overall verification fault tolerance threshold, obtain the index number set that exceeds the overall verification fault tolerance threshold, and express the determination state as a Boolean value sequence in a binary logic form to generate a fault tolerance overflow state sequence; The overall verification fault tolerance threshold is calculated based on the maximum acceptable number of failures in a single cycle set in the equipment fault recovery capability evaluation index system combined with the average failure frequency of partition block writes, and the parameters used are fitted based on the equipment stable operation experimental data; S502: according to the index number of the true state in the fault-tolerant overflow state sequence, extract the original write pointer position, the original checksum and the original version number in the corresponding segment snapshot, reconstruct the storage content before replacement according to the snapshot data and perform the content restoration operation, calculate the offset difference between the restored result and the current block content state, and integrate them into a restored data offset set; S503: Based on the partition block number with an offset of zero in the recovery data offset, verify that the current replacement has been successfully rolled back, release the corresponding storage block and update the global version number of the device to which it belongs to the current target version, and at the same time clear the corresponding replacement instruction record, complete the upgrade process of the remaining partitions that have not triggered the alarm, and obtain the update result of the industrial gateway device.

[0012] As a further solution of the present invention, it is determined whether the industrial gateway device allows the execution of the firmware upgrade operation under the current system resource state, and the formula is used: ; Calculate the dynamic alarm threshold ; where is the basic threshold, representing the initial stability of the device, is the current CPU load rate, is the maximum allowable CPU load rate, is the current memory occupancy rate, represents the maximum allowable memory occupancy rate, represents the continuous running time of the device, represents the time decay offset, which represents the decay degree of the system stability with time during the continuous running of the device, and the value range is from 0.5 to 1.5.

[0013] On the other hand, an AIoT device update system is provided. This system is applied to the AIoT device update method, and the system includes: The dependency verification module collects the current process state through the industrial gateway device, verifies the overlap rate of memory address conflicts in the process state, compares the overlap rate with the overlap threshold, generates the storage block to be updated and outputs it to the running state evaluation module; The running state evaluation module is used to extract the corresponding area to be updated of the industrial gateway device in the storage block to be updated, collect the network bandwidth utilization rate, data transmission packet loss rate and storage I / O delay rate parameters, represent them in vector form after normalization, calculate the cosine similarity between the parameters, and generate a device update permission flag including the normalized bandwidth value, smooth packet loss coefficient, standard I / O ratio, similarity calculation value and boolean determination flag according to the similarity degree, and transfer it to the version comparison module; The version comparison module is used to combine the storage block to be updated and the device update permission flag, calculate and compare the hash values of the current version and the target version of the incremental package, generate a version replacement or skip instruction and transfer it to the update writing module; The update writing module is used to write the incremental package data into the storage block to be updated according to the version replacement or skip instruction, input the current CPU load and memory occupancy of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails, count the number of update failures, generate a continuous failure counter value and pass it to the state determination module; The state determination module is used to compare the number of update failures with the determination threshold, analyze the global state of the industrial gateway device, execute the operation of restoring to the original state or updating the global version number, and obtain the update result of the industrial gateway device.

[0014] The beneficial effects brought by the technical solution provided by the embodiments of the present invention at least include: By verifying the overlap rate of process state memory address conflicts and generating storage blocks to be updated, potential resource conflict areas are dynamically identified, reducing the risk of upgrade interruption caused by incorrect storage area coverage. After normalizing the parameters of network bandwidth utilization rate, data transmission packet loss rate, and storage I / O latency rate, the cosine similarity is calculated to comprehensively evaluate the current operating environment of the device and network transmission conditions, avoiding triggering inefficient update operations when resources are insufficient or communication is unstable, and reducing the probability of update failure caused by external interference. Combining hash value comparison to generate version replacement or skip instructions, accurately judging the compatibility between the incremental package and the current version of the device, and preventing system crashes caused by mismatched dependencies. Introducing the Q-Learning model to analyze the impact of CPU load and memory occupancy on storage block updates, predicting potential failure risks and adjusting the writing strategy accordingly to enhance the update robustness in complex load scenarios. Counting the number of update failures and comparing it with a threshold to perform global state recovery or version number update, establishing a multi-level fault tolerance mechanism to ensure that the device can still maintain basic functions in extreme abnormal situations. The overall process realizes the synchronous improvement of the stability and efficiency of the update process through the synergistic effect of dynamic resource scheduling, multi-dimensional environment perception, and adaptive decision-making. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0016] Figure 1 It is a schematic diagram of the working process of the present invention; Figure 2 It is a system flowchart of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0017] The following describes the technical solutions in the present invention with reference to the drawings.

[0018] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to represent examples, illustrations, or explanations. Any embodiment or design solution described as "example" in the present invention should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Exactly speaking, the use of the word "example" is intended to present concepts in a specific way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one of the two.

[0019] In the embodiments of the present invention, "image" and "picture" can sometimes be used interchangeably. It should be noted that when the difference is not emphasized, the meanings they express are the same. "Of", "corresponding", and "corresponding" can sometimes be used interchangeably. It should be noted that when the difference is not emphasized, the meanings they express are the same.

[0020] In the embodiments of the present invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meanings they express are the same.

[0021] To make the technical problems, technical solutions, and advantages to be solved by the present invention clearer, the following will be described in detail with reference to the accompanying drawings and specific embodiments.

[0022] Please refer to Figure 1 , the present invention provides a technical solution, an AIoT device update method, including the following steps: S1: Collect the current process status through an industrial gateway device, verify the overlap rate of memory address conflicts in the process status, compare the overlap rate with the overlap threshold, and generate a storage block to be updated according to the comparison result; S2: Extract the corresponding area to be updated of the industrial gateway device in the storage block to be updated, collect the network bandwidth utilization rate, data transmission packet loss rate, and storage I / O delay rate parameters, represent them in vector form after normalization, calculate the cosine similarity between the parameters, and generate a device update permission flag according to the similarity degree; S3: Combine the storage block to be updated and the device update permission flag, calculate and compare the hash values of the current version and the target version of the incremental package, and generate a version replacement or skip instruction; S4: Write the incremental package data into the storage block to be updated according to the version replacement or skip instruction, input the current CPU load and memory occupancy of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails, and count the number of update failures; S5: Compare the number of update failures with the determination threshold, analyze the global state of the industrial gateway device, and perform an operation to restore to the original state or update the global version number to obtain the update result of the industrial gateway device.

[0023] The storage block to be updated includes the memory address intersection coverage rate, the driver version span judgment value, the storage sub-block number that meets the dependency condition, and the device update permission flag specifically includes the normalized bandwidth value, the standard I / O ratio, the similarity calculation value, and the boolean determination identifier obtained according to the hash check result. The version replacement or skip instruction includes the sub-block number, the target version number, the hash check key, the replacement admission status, and the exception record identifier. The update failure count specifically includes the write pointer position, the original checksum, and the original version number. The update failure count is specifically the abnormal write behavior recorded based on the write pointer position backtracking check, and the failure count accumulated and statistically obtained when the current write version number fails the check in combination with the comparison result of the original checksum. The industrial gateway device update result includes the failure rollback flag, the instruction clearing status, the global version update number, the storage block release amount, and the alarm signal trigger status.

[0024] Please refer to Figure 1 , and the specific steps for generating the storage block to be updated by collecting the current process status through the industrial gateway device, verifying the overlap rate of memory address conflicts in the process status, and comparing the overlap rate with the overlap threshold are as follows: S101: Collect the start value and end value of the memory address call range of each driver patch in the incremental package, the driver version number date, and the process mutex identifier. Obtain the start value and end value of the memory occupancy address segment of the industrial gateway device, the current driver version number date, and the running process mutex identifier. Calculate the ratio of the length of the overlapping address segment to the total length of the call range, which is defined as the memory overlap rate. Call the memory address conflict threshold and calculate the deviation between the memory overlap coverage rate and the conflict threshold to generate the conflict deviation degree; The unit of the memory address conflict threshold is a percentage, and the source is based on device operation data, laboratory stress test results, and statistical analysis. The value range is 10% to 30%; The incremental package is generated according to the driver difference information and the target version characteristics; The intersection coverage threshold is calculated according to the ratio of the address space allocation granularity set in the memory management unit to the driver call granularity; Both the length of the overlapping address segment and the total length of the call range are in bytes; Collect the start value (denoted as ) and the end value (denoted as ) of the memory address call range of each driver patch in the incremental package. For example, for patch A, , , the start value ( ) and the end value ( ) of the current memory occupancy address segment of the device. Calculate the start value of the overlapping segment as , the end value as , the length of the overlapping segment , and the total length of the patch call range , memory overlap rate , call memory address conflict threshold (set based on historical conflict frequency statistics, considered high conflict risk when ), conflict deviation , if for another patch B , then , set the deviation screening threshold to , patches that meet the condition are retained. For example, if patch B meets the condition and patch A is excluded, extract the driver version date (such as 2025-04-10) and mutex identifier (such as Mutex_001) of patch B.

[0025] Table 1: Patch Memory Address Range and Device Memory Occupancy Data

[0026] As shown in Table 1, for patch B and , the device memory occupancy is , the overlapping segment is , , , , , but the actual of patch B is 0.8 (because the device memory occupancy range partially overlaps with the call range of patch B), and it is necessary to recalculate and . After correction , , , is still higher than , so patch B does not meet the condition and needs to be rescreened. Assume that for another patch C , then , meets the screening condition, and patch C is retained.

[0027] S102: Screen patches with conflict deviation lower than the deviation threshold based on memory overlap coverage rate, extract the driver version number date and the device current version date, convert the two dates into span values in days, and compare them with the version span threshold to generate patch update priorities; The version span threshold is calculated based on the minimum safe interval period for version replacement set in the driver lifecycle management specification combined with the statistical data of the average driver stable operation duration of the device platform. The obtained value is used to measure the necessity and urgency of version replacement; The deviation threshold is set based on the memory address conflict probability distribution and version update stability test results in the industrial gateway device operation data record; Based on the reserved patch (such as Patch C), extract its driver version date (2025-04-15) and the device's current version date (2025-04-23), and calculate the date span days, and set the version span threshold days (set by the device manufacturer according to the patch release frequency), and the priority , if the days of Patch D, then , only retain the patch (such as Patch C), extract the process mutex identifier of Patch C (such as Mutex_002) and the mutex identifiers currently running on the device (such as Mutex_002, Mutex_005), perform a complete string match, and retain Patch C after successful matching. Arrange them in ascending order according to the memory address call range. For example, the address range of Patch C is , and the address range of Patch E is . After sorting, it is Patch E, Patch C. Combine the patch number (PTCH-003) and the version number (V2.5.0) to generate the patch update priority

[0028] S103: Call the patch update priority, filter the patches with a priority value greater than or equal to 1, extract the process mutex identifier and the mutex identifier during device operation for a complete string match, retain the successfully matched patches, arrange them in ascending order according to the memory address call range, and combine the patch number and the version number to generate the storage block to be updated

[0029] Call the priority list (such as the of Patch C), filter the patches, extract their mutex identifiers (such as Mutex_002), and compare them one by one with the identifiers (Mutex_002, Mutex_005) during device operation. Retain Patch C after successful matching and arrange it in ascending order according to the memory address range (for example, the address of Patch F is , and Patch C is of Patch C), filter the of Patch C), filter the of Patch C), filter the patches, extract their mutex identifiers (such as Mutex_002), and compare them one by one with the identifiers (Mutex_002, Mutex_005) during device operation. Retain Patch C after successful matching and arrange it in ascending order according to the memory address range (for example, the address of Patch F is of Patch C), filter the of Patch C), filter the of Patch C), filter the ), combine the patch number (PTCH-003) and the version number (V2.5.0) to generate the storage block (PTCH-003_V2.5.0). Record the address range, version date, and mutex identifier of Patch C in the block for the device to load in order of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the

[0030] of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the Formula description: In the calculation of the memory overlap rate , of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the and of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the are the start and end addresses of the patch, of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the and of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the are the start and end addresses of the device's memory occupation. The length of the overlapping segment is calculated through of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the and of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the of Patch C), filter the difference calculation, and the conflict deviation is calculated through Calculation, where Set according to historical data. For example, in the historical conflict records of a certain device, when occurs, the probability of conflict is 90%. Therefore, set , date span Calculated by date difference, priority Through Quantify the timeliness of patches, Specified by the device update policy as 10 days.

[0031] For patch C , , device memory , , then the overlapping segment is , , , , , satisfying , patch C is retained.

[0032] Please refer to Figure 1 , extract the corresponding positioning industrial gateway device to be updated area in the storage block to be updated, collect the network bandwidth utilization rate, data transmission packet loss rate and storage I / O delay rate parameters, represent them in vector form after normalization, calculate the cosine similarity between the parameters, and the specific steps to generate the device update permission flag include: S201: Extract the sub-block number based on the storage block to be updated, call the start and end timestamps of the associated running task time window, collect the original value of the network bandwidth utilization rate of the industrial gateway device within the time window, calculate the original value with the maximum bandwidth capacity of the device network interface, and generate the bandwidth normalization rate; Bandwidth normalization rate = original bandwidth / maximum bandwidth capacity; Extract the sub-block number (such as PTCH-003) based on the storage block to be updated (block number: PTCH-003_V2.5.0), call the start and end timestamps of the associated running task time window (start timestamp: 2025-04-23, 10:00:00, end timestamp: 2025-04-23, 11:00:00), collect the original values of the network bandwidth utilization rate of the industrial gateway device within the time window (at 10:00:00, the bandwidth utilization rate is 45Mbps, at 10:15:00 it is 52Mbps, at 10:30:00 it is 48Mbps, at 10:45:00 it is 50Mbps), calculate the original values with the maximum bandwidth capacity of the device network interface (the maximum bandwidth capacity of the device network interface is 100Mbps), and generate the bandwidth normalization rate (the bandwidth normalization rate at 10:00:00 is 45 / 100 = 0.45, at 10:15:00 it is 52 / 100 = 0.52, at 10:30:00 it is 48 / 100 = 0.48, at 10:45:00 it is 50 / 100 = 0.5).

[0033] Table 2: Bandwidth utilization data within the time window

[0034] As shown in Table 2, the bandwidth utilization rate and its corresponding normalization rate at each time point within the time window are listed, and these data are used for subsequent screening and calculation.

[0035] S202: Call the bandwidth normalization rate, screen the time periods with values less than or equal to the standard threshold of the bandwidth utilization rate, collect the original sequence of data transmission packet loss rate within the time period, calculate the sequence data according to the exponential smoothing algorithm to generate the packet loss stability coefficient, and at the same time collect the current value of the storage I / O delay rate in the same time period, call the device storage reference delay, and compare the current delay with the reference value to generate the delay deviation ratio; Call the bandwidth normalization rate (0.45, 0.52, 0.48, 0.5 in Table 1), screen the time periods where the value is less than or equal to the standard threshold of the bandwidth utilization rate (for example, set the threshold to 0.6, indicating that the device network bandwidth utilization rate should not exceed 60% of the maximum capacity). During the time period, collect the original sequence of the data transmission packet loss rate (during 10:00:00 to 10:45:00, collect the packet loss rate every 5 minutes, and obtain the sequence [0.001, 0.002, 0.0015, 0.0025, 0.0018, 0.0022, 0.0019, 0.0021, 0.0020]). Calculate the sequence data according to the exponential smoothing algorithm. For example, set the smoothing coefficient α = 0.3 and the initial value S_0 = 0.001. Calculate S_1 = α×0.002+(1 - α)×0.001 = 0.0013, S_2 = α×0.0015+(1 - α)×0.0013 = 0.00136, and so on, to generate the packet loss stability coefficient. At the same time, collect the current value of the storage I / O delay rate in the same time period. For example, during 10:00:00 to 10:45:00, collect the delay rate every 5 minutes, and obtain the sequence [15ms, 16ms, 14ms, 17ms, 15ms, 16ms, 14ms, 17ms, 15ms]. Call the device storage benchmark delay (for example, the device storage benchmark delay is 20ms), compare the current delay with the benchmark value, and generate the delay deviation ratio.

[0036] S203: Construct a four-dimensional vector in order with the bandwidth normalization rate, packet loss stability coefficient, delay deviation ratio, and suppression stability factor, calculate the cosine similarity between the vectors. If the similarity is greater than or equal to the preset consistency threshold and the delay deviation ratio is less than or equal to 1.0, determine that the update condition is established, and generate a device update permission flag; The preset consistency threshold is an empirical value obtained based on the statistical analysis of the historical operation data of the industrial gateway device; Construct a four-dimensional vector in order with the bandwidth normalization rate, packet loss stability coefficient, delay deviation ratio, and suppression stability factor. First, when obtaining the bandwidth normalization rate, calculate the normalization value in the network environment by dividing the actual throughput rate of the monitored device by the theoretical maximum bandwidth. For example, for a certain device within the monitoring throughput rate is and its maximum bandwidth is , then the bandwidth normalization rate is . The packet loss stability coefficient is obtained by observing the change of the packet loss rate within the set time window. For example, the packet loss rates are , with the maximum fluctuation amplitude compared with the maximum packet loss rate , to obtain , and after stability adjustment, it is taken as , the delay deviation ratio is the current average delay of the device and the set reference delay The ratio of, obtain , the acquisition of the suppression stability factor reflects the suppression stability degree of the device through the standard deviation of the instruction response time under the interference scenario. For example, the continuous five response times are , calculate the standard deviation is about , through , where , the obtained value is , thus constructing the current device state vector as: ,, the calculation formula is: ; Among them, represents the importance coefficient of the i-th dimension, where i = 1, 2, 3, 4 correspond to the bandwidth normalization rate, packet loss stability coefficient, delay deviation ratio, and suppression stability factor respectively, Among them, the delay deviation ratio is the most critical index. The larger the delay deviation ratio, the larger the importance coefficient, and the value range is from 0.1 to 0.4, represents the i-th dimension of the current network state vector, that is, the real-time collected network parameter value represents the i-th dimension of the historical reference vector, that is, the preset network parameter reference value, represents the summation operation on the parameters of the four dimensions.

[0037] The numerator is calculated as follows: ; The left square root of the denominator: ; The right square root of the denominator: ; The final similarity result is: ; Because the calculation result meets the similarity condition , and the delay deviation ratio , so it can be determined that the update condition is established, and a device update permission flag is generated.

[0038] Please refer to Figure 1 , combining the storage block to be updated and the device update permission flag, the specific steps for calculating and comparing the hash values of the current version and the target version of the incremental package to generate a version replacement or skip instruction include: S301: Based on the storage block to be updated and the update permission flag, call the sub-block identification information and the current status parameters, perform the block-level update access determination operation, calculate whether to allow the update respectively according to the version status corresponding to the identification and the update permission flag, filter out the sub-blocks that meet the update conditions, and generate the update block numbers; Based on the storage block to be updated (block number PTCH-003_V2.5.0) and the update permission flag (the permission flag is True), call the sub-block identification information (PTCH-003) and the current status parameters (device storage occupancy rate 80%, network latency 15ms), perform the block-level update access determination operation, check the version status (V2.5.0) corresponding to the sub-block and the update permission flag (True / False). If the permission flag is True and there is a difference between the version status and the target version (V3.0.0), it is determined that the update is allowed. The update permission flag of sub-block PTCH-003 is True, the version status is V2.5.0, and the target version is V3.0.0, which meets the update conditions. If the permission flag of sub-block PTCH-004 is False or the version status is the same as the target version (V3.0.0), it is excluded. After the screening is completed, an update block number list ([PTCH-003, PTCH-005]) is generated.

[0039] Table 3: Sub-block update access determination data

[0040] As shown in Table 3, sub-blocks PTCH-003 and PTCH-005 are allowed to be updated because the version status is different from the target version and the permission flag is True, while PTCH-004 is prohibited because the versions are the same.

[0041] S302: According to the update block numbers, call the hash values corresponding to the sub-block version and the incremental package version, perform a consistency comparison according to the hash value matching method, match the target incremental package version number according to the sub-block number, identify the items with inconsistent versions and record the differential block information, and generate the block consistency difference value; The hash value matching method is SHA-256 verification; According to the update block numbers (PTCH-003, PTCH-005), call the hash value corresponding to the sub-block version (the hash value of PTCH-003 is , and the hash value of the incremental package version is ), perform the consistency comparison. If , record the differential block information, including the hash value of sub-block PTCH-005 is , the incremental package hash value is , and calculate the difference value (set the hash to a decimal value, , , then ), set the difference threshold (set according to the data, if the difference exceeds this value, it is regarded as version inconsistency). If , it is determined as inconsistent, and generate the difference block information (the difference value of PTCH-005 is 86419754).

[0042] S303: Call the block consistency difference value, combine the sub-block number and the update permission flag, readjust the update permission status of the corresponding sub-block according to the comparison result, and integrate the numbers allowed to be updated, the target version number and the corresponding hash value verification information to generate a replacement instruction including the sub-block number, the target version number and the verification key. If the sub-block does not meet the update conditions, record the exception and generate a skip instruction to obtain the replacement instruction and the skip instruction; Call the block consistency difference value (such as the of PTCH-005), combine the update permission flag (such as the permission flag of PTCH-005 is True). If , adjust its update permission status to False. For example, if the difference value of PTCH-005 exceeds the threshold, the update permission flag is set to False, while the of PTCH-003 (hash is consistent), the permission status remains True. Integrate the sub-block numbers allowed to be updated (such as PTCH-003), the target version number (V3.0.0) and the verification key (SHA-256 hash value ), generate a replacement instruction, and generate a skip instruction for the sub-block that is not allowed to be updated (PTCH-005).

[0043] Formula description: Hash difference value , where is the decimal value of the sub-block hash, is the decimal value of the incremental package hash, and the difference threshold is set according to the conflict data (90% of the legal update differences are less than ). If , it is determined that the versions are inconsistent. The benefit of the formula is to determine the version consistency status by comparing the quantified hash difference value with the preset threshold, avoiding subjective errors.

[0044] The hash value of sub-block PTCH-003 , the incremental package hash , the difference value , because , it is determined as consistent. The hash value of sub-block PTCH-005 , the incremental package hash , the difference value , because , it is determined to be inconsistent. The result shows that there is a version tampering or damage in PTCH-005, and the update needs to be skipped.

[0045] Please refer to Figure 1 , and write the incremental package data into the storage block to be updated according to the version replacement or skip instruction. Input the current CPU load and memory occupancy of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails. The specific steps for counting the number of update failures include: S401: Execute the replacement operation according to the replacement instruction, create a segmented snapshot of the current write pointer position, original checksum, and partition version number for the target sub-block, call the segmented write verification function to write the incremental package data in the order of the hash key attached to the replacement instruction, monitor the change of the offset position after each write and record the update range interval, and generate a segmented snapshot information set; The generation of the incremental package data is based on the binary difference between the target version and the current version to generate a minimized driver patch, combined with the hash verification chain and version dependency tree to verify data integrity and version compatibility, and match the current running load conditions of the device through a dynamically adjusted verification threshold; Based on the replacement instruction (REPLACE PTCH-003 WITH V3.0.0 KEYs5t6u7v8), extract the target sub-block number PTCH-003, call the write pointer position (starting address 0x1000), read the original checksum (CRC32 value ), and version number V2.5.0, create a segmented snapshot (snapshot ID is SNAP-001), call the segmented write verification function WriteVerify, write the incremental package data (data block length 512 bytes) byte by byte according to the hash key s5t6u7v8, record the offset position after every 64 bytes written (the offset changes from 0x1000 to 0x1040 after the first write), monitor and record the update range interval [0x1000, 0x1200], and generate a segmented snapshot information set (including snapshot ID, write pointer sequence [0x1000, 0x1040, 0x1200], checksum sequence [0xA5B3C7D9, 0xB4D2E1F0,]).

[0046] Table 4: Segmented Snapshot Information

[0047] As shown in Table 4, the update range interval of snapshot SNAP-001 is from 0x1000 to 0x1200, and the change in the checksum after the update is 0xC3D4E5F6.

[0048] S402: Based on the write pointer position and the update range interval in the segmented snapshot information set, collect the current CPU load rate and memory occupancy rate of the industrial gateway device, construct a two-dimensional state space parameter group of CPU occupancy and memory usage, input the state space parameter group into the trained Q-Learning reinforcement model as model training data, call the model policy table to obtain the exclusive OR check threshold corresponding to the current state, and match it to the corresponding snapshot section to generate a dynamic check threshold; A method for generating a dynamic check threshold of a Q-Learning reinforcement model, by constructing a two-dimensional state space parameter group of CPU load rate and memory occupancy rate, combining a reward and punishment function and a model policy table, realizes the dynamic adjustment of the exclusive OR check threshold; The Q-Learning model is set according to the reward and punishment function constructed by the triple group of exception check rate, resource occupancy level and write result state in the storage write state feedback. The reward and punishment function of the Q-Learning model uses a weight distribution of 0.6 and 0.4. Through the weighted combination of the exception check rate and the resource occupancy level, while ensuring data reliability, it takes into account the system operation efficiency and guides the model to learn the optimal exclusive OR check threshold adjustment; Based on the write pointer position [0x1000, 0x1200] of snapshot SNAP-001, collect the current CPU load rate (45%) and memory occupancy rate (65%) of the device, and construct a two-dimensional state space parameter group , input the parameter group into the Q-Learning model policy table, and according to the state interval matching rule (when the CPU load rate < 50% and the memory < 70%, match policy 1), obtain the corresponding exclusive OR check threshold , if the state interval is CPU ≥ 50% or memory ≥ 70%, then match the threshold of policy 2 , for example, the current parameter group (45, 65) conforms to policy 1, and a dynamic check threshold is generated .

[0049] Table 5: Q-Learning policy table

[0050] As shown in Table 5, the policy table maps the device state to a dynamic check threshold.

[0051] S403: According to the exclusive OR check threshold matched in the dynamic check threshold matrix, recalculate the current checksum for each snapshot segment and perform an exclusive OR operation with the original snapshot checksum, judge whether each result is zero. If the exclusive OR result is non-zero, mark the replacement as failed and increment the continuous failure counter of the sub-block, and count the number of update failures; According to the dynamic check threshold , recalculate the current checksum for each segment of snapshot SNAP-001 (segment 1: 0x1000 - 0x1040) , with the original checksum perform an exclusive OR operation , and determine whether it is equal to the threshold , if , then mark the replacement as failed, increment the consecutive failure counter of block PTCH-003 from 0 to 1, and count the update failure times as 1.

[0052] Exclusive OR checksum formula:

[0053] Parameter definition: : The checksum (CRC32 value) of the currently written data block, obtained by calculating the cyclic redundancy check code of the incremental packet data byte by byte, : The original checksum of the block, extracted from the snapshot information.

[0054] Operation logic: The exclusive OR operation is used to detect the difference in checksum before and after data writing. If the result is non-zero, it indicates data tampering or writing error.

[0055] Dynamic threshold setting: Policy matching rule: When the device status meets and , set (strict check), when or , set (loose check, allowing non-critical differences).

[0056] Through the association between the dynamic threshold and the device status , perform self-matching adjustment of the verification intensity, perform strict verification when the device load is low, and allow non-critical differences when the load is high, balancing update security and system performance.

[0057] Please refer to Figure 1 , compare the update failure times with the determination threshold, analyze the global status of the industrial gateway device, and the specific steps to perform the operation of restoring to the original state or updating the global version number to obtain the update result of the industrial gateway device include: S501: Based on the consecutive failure counter and the preset fault tolerance threshold, perform global status determination, call the replacement failure times corresponding to all blocks, compare with the overall verification fault tolerance threshold, obtain the set of index numbers exceeding the overall verification fault tolerance threshold, and represent the determination status in the form of a boolean value sequence according to binary logic to generate a fault tolerance overflow status sequence; The overall verification fault tolerance threshold is statistically calculated based on the maximum acceptable number of failures per cycle set in the device fault recovery ability evaluation index system in combination with the average failure frequency of block - by - block writing. The parameters used are obtained by fitting the experimental data of the stable operation of the device; Based on the continuous failure counter (of PTCH - 003 ) and the dynamic fault tolerance threshold perform a global state determination, where is the reference threshold, and are the weight coefficients, is the CPU load rate, is the memory occupancy rate, calculate , call the of all sub - blocks. If then mark it as 1, otherwise 0, generating a boolean sequence , integrate the index set {PTCH - 004}, for example, the of PTCH - 004, trigger a fault tolerance overflow.

[0058] Table 6: Fault Tolerance Threshold Parameter Calibration Experiment

[0059] As shown in Table 6, the dynamic threshold is calibrated through experiments to ensure that the deviation rate between the formula - calculated value and the actual fault tolerance upper limit is less than 15%.

[0060] S502: According to the index numbers of the true states in the fault tolerance overflow status sequence, extract the original write pointer position, original checksum, and original version number in the corresponding segmented snapshots. Reconstruct the stored content before replacement according to the snapshot data and perform a content restoration operation. Calculate the offset difference degree between the recovery result and the current block content status, and integrate it into the recovery data offset set; According to the PTCH - 004 in the true state, extract the snapshot parameters: the original write pointer , the original checksum , the original version number . When reconstructing the stored content, recover block - by - block according to the data block size bytes, calculate the recovered checksum , compare it with the current checksum , define the differential entropy , where is the th byte of the current data block ( ), is the th byte of the recovered data block ( ), is the periodic weight coefficient, calculate the difference of the first byte , weight , contribution entropy value , after accumulating all byte differences, get , if then it is determined as an offset anomaly, record the offset , integrate it into the recovery data offset set {PTCH-004:0x200}.

[0061] S503: Based on the block partition numbers with zero offset in the recovery data offset degree, verify that the current replacement has been successfully rolled back, release the corresponding storage block and update the global device version number to the current target version, and at the same time clear the corresponding replacement instruction record, complete the upgrade process of the remaining untriggered alarm partitions, and obtain the industrial gateway device update result; Based on the block partition numbers with zero offset in the recovery data offset degree, identify that the offset values of block partitions B1, B2, and B3 are 0. Traverse the block mapping table of the storage management system, extract the storage address 0x80000000 of B1, the storage address 0x80001000 of B2, and the storage address 0x80002000 of B3. Call the storage release interface one by one, send a release instruction to the storage controller. The instruction contains the address parameter and the release flag (the flag is set to 0x01). After the storage controller responds, it returns the operation code 0xA1. Check the consistency between the operation code and the preset success code 0xA1. If they are consistent, update the current value 0x00020105 of the device global version number register address 0x8000F000 to the target version number 0x00020104. Write the version number through the register write instruction 0x57, read the register value to verify whether the update is successful. At the same time, traverse the replacement instruction queue, match the instruction record IDs of block partitions B1, B2, and B3 (the record IDs are 0012, 0013, and 0014 respectively), delete the corresponding records in the queue, scan the upgrade status fields of the remaining block partitions B4 and B5. If the status is "to be upgraded", call the upgrade interface to trigger the partition firmware transmission. The transmission rate is 512Kbps. After the transmission is completed, verify the firmware hash value and compare it with the preset hash value 0x3A7D…B9E2. If they are consistent, update the partition status to "completed", summarize all block partition statuses, generate a device update report, and dynamically adjust the alarm threshold during the upgrade process to adapt to the device load change.

[0062] Dynamic alarm threshold formula:

[0063] where is the basic threshold, representing the initial stability of the device, is the current CPU load rate, is the maximum allowable CPU load rate, is the current memory occupancy rate, represents the maximum allowable memory occupancy rate, represents the continuous running time of the device, represents the time decay offset, which represents the decay degree of the system stability over time during the continuous operation of the device, and the value range is from 0.5 to 1.5.

[0064] Current CPU load: Maximum CPU load: ; Current memory occupancy: 6; Maximum memory capacity: ; Current continuous running time of the device: ; Time offset: ; Device basic threshold: ; Calculate the CPU load item: , .

[0065] Calculate the memory item: , .

[0066] Calculate the time item: .

[0067] The final calculation result is .

[0068] According to the device alarm rule, when is lower than the preset static threshold 40, it is determined that the system is in a low load state and the upgrade operation is allowed. If is higher than 40, the upgrade process is delayed. The current calculation result 37.91 is lower than 40, triggering the firmware transmission of the remaining partitions B4 and B5. After the transmission is completed, the firmware hash value 0x3A7D…B9E2 is read, which is consistent with the preset value, the partition status is updated to "completed", the device global version number is updated to 0x00020104, the relevant records in the instruction queue are deleted, and the operation result is recorded in the log file to complete the industrial gateway device update process.

[0069] Please refer to Figure 2 , an AIoT device update system. The AIoT device update system is used to execute the above AIoT device update method. The system includes: A dependency verification module, which collects the current process status through the industrial gateway device, verifies the overlap rate of memory address conflicts in the process status, compares the overlap rate with the overlap threshold, generates the storage block to be updated and outputs it to the running state evaluation module; The running state evaluation module is used to extract the area to be updated of the positioning industrial gateway device corresponding to the storage block to be updated, collect the normalized parameters of network bandwidth utilization rate, data transmission packet loss rate and storage I / O latency rate, represent them in vector form, calculate the cosine similarity between the parameters, generate a device update permission flag according to the similarity degree, and transfer it to the version comparison module; The version comparison module is used to combine the storage block to be updated and the device update permission flag, calculate and compare the hash values of the current version and the target version of the incremental package, and generate a version replacement or skip instruction to transfer to the update writing module; The update writing module is used to write the incremental package data into the storage block to be updated according to the version replacement or skip instruction, input the current CPU load and memory occupancy of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails, count the number of update failures, generate a continuous failure counter value and transfer it to the status determination module; The status determination module is used to compare the number of update failures with the determination threshold, analyze the global state of the industrial gateway device, perform the operation of restoring to the original state or updating the global version number, and obtain the update result of the industrial gateway device.

[0070] It should be understood that the term "and / or" in this article is only a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Here, A and B can be singular or plural. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after, but it may also represent an "and / or" relationship, which can be specifically understood with reference to the context before and after.

[0071] In the present invention, "at least one" means one or more, and "multiple" means two or more. "At least one of the following items (pieces)" or its similar expressions refer to any combination of these items, including any combination of single item (piece) or plural items (pieces). For example, at least one of a, b, or c can represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, and c can be single or multiple.

[0072] It should be understood that in each embodiment of the present invention, the size of the serial number of each process above does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.

[0073] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0074] Those skilled in the art can clearly understand that for the sake of convenience and brevity of description, the specific working processes of the devices, apparatuses, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.

[0075] In several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.

[0076] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0077] In addition, in each embodiment of the present invention, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0078] If a function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method according to each embodiment of the present invention. The aforementioned storage medium includes: USB flash drive, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disc, etc., each of which can store program codes.

[0079] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. An AIoT device update method, characterized in that, The method includes: S1: Collect the current process status through an industrial gateway device, verify the overlap rate of memory address conflicts in the process status, compare the overlap rate with an overlap threshold, and generate a storage block to be updated according to the comparison result; S2: Extract the area to be updated of the positioning industrial gateway device corresponding to the storage block to be updated, collect the network bandwidth utilization rate, data transmission packet loss rate, and storage I / O latency rate parameters, represent them in vector form after normalization, calculate the cosine similarity between the parameters, and generate a device update permission flag according to the similarity degree; S3: Combine the storage block to be updated and the device update permission flag, calculate and compare the hash values of the current version and the target version of the incremental package, and generate a version replacement or skip instruction; S4: Write the incremental package data into the storage block to be updated according to the version replacement or skip instruction, input the current CPU load and memory occupancy of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails, and count the number of update failures; S5: Compare the number of update failures with a determination threshold, analyze the global status of the industrial gateway device, and perform an operation to restore to the original state or update the global version number to obtain the update result of the industrial gateway device.

2. The AIoT device update method according to claim 1, characterized in that The storage block to be updated includes the memory address intersection coverage rate, the driver version span judgment value, and the storage sub-block number that meets the dependency condition. The device update permission flag is specifically the normalized bandwidth value, the standard I / O ratio, the similarity calculation value, and the boolean judgment identifier obtained according to the hash verification result. The version replacement or skip instruction includes the sub-block number, the target version number, the hash verification key, the replacement access status, and the exception record identifier. The number of update failures is specifically the write pointer position, the original checksum, and the original version number. The number of update failures is specifically the abnormal write behavior recorded by backtracking verification based on the write pointer position, and the failure times accumulated and statistically obtained in the state of not passing the verification by combining the comparison result of the original checksum and the current write version number. The update result of the industrial gateway device includes the failure rollback flag, the instruction clearing status, the global version update number, the storage block release amount, and the alarm signal trigger status.

3. The AIoT device update method according to claim 1, wherein The specific steps of collecting the current process status through an industrial gateway device, verifying the overlap rate of memory address conflicts in the process status, comparing the overlap rate with an overlap threshold, and generating a storage block to be updated include: S101: Collect the start value and end value of the memory address call range of each driver patch in the incremental package, the driver version number date, and the process mutex identifier, obtain the start value and end value of the memory occupancy address segment of the industrial gateway device, the current driver version number date, and the process mutex identifier during operation, calculate the ratio of the length of the overlapping address segment to the total length of the call range, define it as the memory overlap rate, call the memory address conflict threshold, calculate the deviation between the memory overlap coverage rate and the conflict threshold, and generate a conflict deviation degree; The unit of the memory address conflict threshold is a percentage, and its source is based on device operation data, laboratory stress test results, and statistical analysis, and its value range is from 10% to 30%; The incremental package is generated according to the driver difference information and the target version features; Both the length of the overlapping address segment and the total length of the call range are in bytes; S102: Based on the patches with a conflict deviation degree lower than the deviation threshold screened by the memory overlap coverage rate, extract the driver version number date and the device current version date, convert the two dates into span values in days, sort and compare them with the version span threshold, and generate the patch update priority; The version span threshold is calculated based on the minimum safe interval period for version replacement set in the driver lifecycle management specification combined with the statistical data of the average stable operation duration of the device platform, and the obtained value is used to measure the necessity and urgency of version replacement; The deviation threshold is set according to the memory address conflict probability distribution and the version update stability test results in the industrial gateway device operation data record; S103: Invoke the patch update priority, screen the patches with a priority value greater than or equal to 1, extract the process mutex identifier and the mutex identifier during device operation for a complete string match, retain the successfully matched patches, sort them in ascending order according to the memory address call range, merge the patch number and the version number, and generate the storage block to be updated; 4. The AIoT device update method according to claim 1, wherein The specific steps for extracting the corresponding area to be updated for the industrial gateway device in the storage block to be updated, collecting the network bandwidth utilization rate, data transmission packet loss rate, and storage I / O delay rate parameters, normalizing them and representing them in vector form, calculating the cosine similarity between the parameters, and generating the device update permission flag according to the similarity degree include: S201: Based on the storage block to be updated, extract the sub-block number, invoke the start and end timestamps of the associated running task time window, collect the original value of the network bandwidth utilization rate of the industrial gateway device within the time window, calculate the original value with the maximum bandwidth capacity of the device network interface, and generate the bandwidth normalization rate; The bandwidth normalization rate = original bandwidth / maximum bandwidth capacity; S202: Invoke the bandwidth normalization rate, screen the time periods with a value less than or equal to the bandwidth utilization standard threshold, collect the original sequence of the data transmission packet loss rate within the time period, calculate the sequence data according to the exponential smoothing algorithm, generate the packet loss stability coefficient, and at the same time collect the current value of the storage I / O delay rate in the same time period, invoke the device storage reference delay, and compare the current delay with the reference value to generate the delay deviation ratio; S203: Construct a four-dimensional vector in sequence with the bandwidth normalization rate, packet loss stability coefficient, delay deviation ratio, and suppression stability factor, calculate the cosine similarity between the vectors, if the similarity is greater than or equal to the preset consistency threshold and the delay deviation ratio is less than or equal to 1.0, determine that the update condition is established, and generate the device update permission flag; The preset consistency threshold is an empirical value obtained based on the statistical analysis of the industrial gateway device operation data; 5. The AIoT device update method according to claim 1, wherein Perform multi-dimensional parameter processing on the network and storage states of the industrial gateway device, using the formula: ; Calculate cosine similarity ; Among them, represents the importance coefficient of the i-th dimension, where i = 1, 2, 3, 4 correspond to the bandwidth normalization rate, packet loss stability coefficient, delay deviation ratio, and suppression stability factor respectively. Among them, the delay deviation ratio is the most critical indicator. The larger the delay deviation ratio, the larger the importance coefficient, and its value range is from 0.1 to 0.

4. represents the i-th dimension of the current network state vector, that is, the network parameter value collected in real time. represents the i-th dimension of the historical reference vector, that is, the preset network parameter reference value. represents the summation operation of the parameters in the four dimensions.

6. The AIoT device update method according to claim 1, wherein The specific steps for calculating and comparing the hash values of the current version and the target version of the incremental package in combination with the storage block to be updated and the device update permission flag, and generating the version replacement or skip instruction include: S301: Based on the storage block to be updated and the update permission flag, call the sub-block identification information and the current status parameters, perform a block-level update access determination operation, calculate whether to allow the update respectively according to the version status corresponding to the identification and the update permission flag, filter out the sub-blocks that meet the update conditions, and generate an update block number; S302: According to the update block number, call the hash values corresponding to the sub-block version and the incremental package version, perform a consistency comparison according to the hash value matching method, match the target incremental package version number according to the sub-block number, identify the items with inconsistent versions and record the differential block information, and generate a block consistency difference value; The hash value matching method is SHA-256 verification; S303: Call the block consistency difference value, combine the sub-block number and the update permission flag, readjust the update permission status of the corresponding sub-block according to the comparison result, and integrate the numbers allowed to be updated, the target version number and the corresponding hash value verification information, and generate a replacement instruction including the sub-block number, the target version number and the verification key. If the sub-block does not meet the update conditions, record the exception and generate a skip instruction, and obtain the replacement instruction and the skip instruction.

7. The AIoT device update method according to claim 6, wherein Write the incremental package data into the storage block to be updated according to the version replacement or skip instruction, and input the current CPU load and memory occupancy of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails. The specific steps for counting the number of update failures are as follows: S401: Execute the replacement operation according to the replacement instruction, create a segmented snapshot of the current write pointer position, the original checksum and the sub-block version number for the target sub-block, call the segmented write verification function to write the incremental package data in the order of the hash keys attached to the replacement instruction, monitor the change of the offset position after each write and record the update range interval, and generate a set of segmented snapshot information; The generation of the incremental package data is based on generating a minimized driver patch from the binary differences between the target version and the current version, verifying the data integrity and version compatibility by combining the hash verification chain and the version dependency tree, and matching the current operating load conditions of the device through a dynamically adjusted verification threshold; S402: Based on the write pointer position and the update range interval in the set of segmented snapshot information, collect the current CPU load rate and memory occupancy rate of the industrial gateway device, construct a two-dimensional state space parameter group of CPU occupancy and memory usage, input the state space parameter group into the trained Q-Learning reinforcement model as model training data, call the model policy table to obtain the exclusive OR verification threshold corresponding to the current state, and match it to the corresponding snapshot section to generate a dynamic verification threshold; The method for generating the dynamic verification threshold of the Q-Learning reinforcement model realizes the dynamic adjustment of the exclusive OR verification threshold by constructing a two-dimensional state space parameter group of CPU load rate and memory occupancy rate, combining the reward and punishment function and the model policy table; The Q-Learning model is set with a reward and punishment function constructed based on the triple of the abnormal verification rate, resource occupancy level, and write result status in the storage write status feedback. The reward and punishment function of the Q-Learning model uses a weight distribution of 0.6 and 0.

4. Through the weighted combination of the abnormal verification rate and the resource occupancy level, while ensuring data reliability, it also takes into account the system operation efficiency, guiding the model to learn the optimal XOR verification threshold adjustment; S403: According to the XOR verification threshold matched in the dynamic verification threshold matrix, recalculate the current checksum for each snapshot segment and perform an XOR operation with the original snapshot checksum, and determine whether each result is zero. If the XOR result is non-zero, mark the replacement as failed and increment the continuous failure counter for the partition block, and count and update the number of update failures.

8. The AIoT device update method according to claim 7, characterized in that Comparing the number of update failures with the determination threshold, analyzing the global state of the industrial gateway device, and performing operations to restore to the original state or update the global version number. The specific steps for obtaining the update result of the industrial gateway device include: S501: Perform a global state determination based on the continuous failure counter and the preset fault tolerance threshold, call the number of replacement failures corresponding to all partition blocks, compare with the overall verification fault tolerance threshold, obtain the set of index numbers exceeding the overall verification fault tolerance threshold, and represent the determination state in the form of a boolean value sequence according to binary logic to generate a fault tolerance overflow state sequence; The overall verification fault tolerance threshold is statistically calculated based on the maximum acceptable number of failures per cycle set in the device fault recovery ability evaluation index system combined with the average failure frequency of partition block writes, and the parameters used are obtained by fitting the experimental data of the device's stable operation; S502: According to the index numbers with true states in the fault tolerance overflow state sequence, extract the original write pointer position, original checksum, and original version number in the corresponding segmented snapshot, reconstruct the storage content before replacement according to the snapshot data and perform a content restoration operation, calculate the offset difference degree between the restoration result and the current block content state, and integrate it into the restoration data offset set; S503: Based on the partition block numbers with zero offset in the restoration data offset degree, verify that the current replacement has been successfully rolled back, release the corresponding storage block and update the global version number of the device to the current target version, and at the same time clear the corresponding replacement instruction record, complete the upgrade process of the remaining untriggered alarm partitions, and obtain the update result of the industrial gateway device.

9. The AIoT device update method according to claim 1, wherein, Determine whether the industrial gateway device allows the execution of firmware upgrade operations under the current system resource state, using the formula: ; Calculate the dynamic alarm threshold ; where is the basic threshold, representing the initial stability of the device, is the current CPU load rate, is the maximum allowable CPU load rate, is the current memory occupancy rate, represents the maximum allowable memory occupancy rate, represents the continuous running time of the device, represents the time decay offset, which represents the decay degree of system stability over time during the continuous operation of the device, and the value range is from 0.5 to 1.

5.

10. An AIoT device update system, characterized in that, The system is used to implement the AIoT device update method described in any one of claims 1-9. The system includes: A dependency verification module, which collects the current process state through the industrial gateway device, verifies the overlap rate of memory address conflicts in the process state, compares the overlap rate with the overlap threshold, generates the storage block to be updated, and outputs it to the running state evaluation module; The running state evaluation module is used to extract the to-be-updated area of the positioning industrial gateway device corresponding to the to-be-updated storage block, collect the network bandwidth utilization rate, data transmission packet loss rate, and storage I / O latency rate parameters, represent them in vector form after normalization, calculate the cosine similarity between the parameters, generate a device update permission flag including the normalized bandwidth value, smoothed packet loss coefficient, standard I / O ratio, similarity calculation value, and boolean determination flag according to the similarity degree, and transfer it to the version comparison module; The version comparison module is used to combine the to-be-updated storage block and the device update permission flag, calculate and compare the hash values of the current version and the incremental package target version, generate a version replacement or skip instruction, and transfer it to the update writing module; The update writing module is used to write the incremental package data into the to-be-updated storage block according to the version replacement or skip instruction, input the current CPU load and memory occupancy of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails, count the number of update failures, generate a continuous failure counter value, and pass it to the status determination module; The status determination module is used to compare the number of update failures with the determination threshold, analyze the global state of the industrial gateway device, perform an operation to restore to the original state or update the global version number, and obtain the update result of the industrial gateway device.

Citation Information

Patent Citations

  • Novel processor cache replacement method

    CN108287795A

  • A method and system for updating device software

    CN109002305B

  • Firmware updating method and device, earphone and computer readable storage medium

    CN111045714A

  • Cluster firmware updating method, product, equipment and storage medium

    CN118467016A

  • Representation learning-based online Internet of Things equipment firmware identification method

    CN119441976A

Cited By

  • Packet loss prevention transmission system based on dynamic redundancy adjustment

    CN120710638A

  • Finished product storage intelligent management system for medical instrument production and sales warehouse

    CN120994471A