AIoT device updating method and system

By dynamically identifying memory address conflicts and network status, and combining this with the Q-Learning model, the AIoT device update method is optimized, solving the problem of unstable device updates in existing technologies and achieving a more efficient and reliable update process.

CN120342870BActive Publication Date: 2026-02-13BEIJING SHENZHOU BANGBANG TECH SERVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing AIoT device update methods lack deep integration with the current operating status of the device, and cannot effectively cope with sudden fluctuations in memory usage or sudden changes in network parameters, resulting in update failures and resource waste. Furthermore, the recovery mechanism is simplistic and cannot maintain stable device operation under high load scenarios.

Method used

By collecting the process status of industrial gateway devices, memory address conflicts are dynamically identified. Combined with network bandwidth utilization, data transmission packet loss rate, and storage I/O latency, a device update permission flag is generated. The Q-Learning model is used to determine whether the storage block update has failed, and a multi-level fault tolerance mechanism is established to achieve adaptive decision-making and resource scheduling.

Benefits of technology

It reduces the risk of upgrade interruption due to storage area overwrite errors, lowers the probability of update failure, improves the robustness and update efficiency of the device under complex load scenarios, and ensures that the device maintains basic functions under extreme abnormal conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120342870B_ABST
    Figure CN120342870B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of device firmware updating, in particular to an AIoT device updating method and system, which comprises the following steps: collecting a process state, checking a memory address overlap rate, generating a to-be-updated block, extracting a to-be-updated area, normalizing network parameters, calculating a cosine similarity, generating an updating mark, combining the block and the mark, comparing a version hash, generating a replacement or skipping instruction, writing incremental data, determining a failure number through a Q-Learning model, counting the failure number, analyzing a global state, executing recovery or version updating, and the like. In the application, the memory address conflict overlap area is dynamically identified to reduce the upgrading interruption risk, network bandwidth, packet loss rate and storage delay parameters are evaluated to avoid inefficient updating, hash comparison is accurately used to judge version compatibility to prevent system collapse, Q-Learning is combined to analyze load prediction failure risk and enhance updating robustness, the failure number is counted to establish a multilevel fault-tolerant mechanism to maintain device basic functions, and dynamic scheduling and environment sensing are cooperated to improve stability and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of device firmware update, in particular to an AIoT device update method and system. BACKGROUND

[0002] The technical field of device firmware update includes version management, transmission verification and execution control of embedded system bottom layer programs. Its core is to realize reliable replacement and function iteration of device running programs through firmware data check mechanism, transmission protocol optimization strategy and version difference processing rules. This field involves technical processes such as segment check and verification of firmware binary files, difference comparison algorithm of incremental update package, device end abnormal rollback mechanism and timing control of multi-node collaborative update, and needs to solve key problems such as data packet loss and retransmission in wireless transmission environment, hardware compatibility adaptation and cross-version upgrade conflict detection. Among them, an AIoT device update method refers to comparing the firmware version difference at the byte level through a difference compression algorithm to generate an incremental update package containing only changed data, combining a device end storage partition double backup mechanism, using block cyclic redundancy check and XOR check double verification strategy in the firmware writing stage, dynamically adjusting the transmission path priority and data packet retransmission number threshold through the version consistency negotiation protocol between multi-hop relay nodes, and based on the hash mapping relationship between device hardware identification code and firmware version number, establishing a version dependency tree to solve the cross-generation upgrade conflict.

[0003] The prior art has the following deficiencies: it lacks deep integration with the current running state of the device, resource allocation only relies on preset thresholds or static strategies, and cannot effectively respond to sudden memory occupancy fluctuations or network parameter mutations. For example, when multiple processes share a storage area and the update data volume increases sharply, the existing method is prone to coverage errors due to undetected memory address conflicts, resulting in termination of critical processes or data corruption. The existing version dependency determination is usually based on fixed rules and does not consider the dynamic influence of the device running environment on the compatibility of the difference package, which 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 technology uses a single rollback strategy for recovery mechanism after update failure, without differential processing based on global state analysis, which may exacerbate system resource consumption and prolong device downtime in high-load industrial gateway scenarios. The existing verification process focuses on packet integrity detection and ignores the impact of hardware load on the writing process. When CPU or memory usage increases sharply in the short term, it is easy to cause update interruption or system deadlock due to resource contention, affecting production line continuous operation. SUMMARY

[0004] To solve the technical problems existing in the prior art, the embodiments of the present application provide an AIoT device update method and system. The technical solution is as follows:

[0005] In order to achieve the above object, the application adopts the following technical scheme, an AIoT device updating method, comprising the following steps:

[0006] S1: collecting the current process state through the industrial gateway device, checking the overlap rate of the memory address conflict in the process state, comparing the overlap rate with the overlap threshold, and generating a storage block to be updated according to the comparison result;

[0007] S2: extracting the corresponding industrial gateway device update area in the storage block to be updated, collecting the network bandwidth utilization rate, data transmission packet loss rate and storage I / O delay rate parameter after normalization, representing in vector form, calculating the cosine similarity between parameters, and generating a device update permission flag according to the similarity degree;

[0008] S3: combining the storage block to be updated and the device update permission flag, calculating and comparing the hash values of the current version and the target version of the incremental package, and generating a version replacement or skip instruction;

[0009] S4: according to the version replacement or skip instruction, write the incremental package data into the storage block to be updated, input the current CPU load and memory occupation 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;

[0010] S5: comparing the number of update failures with the determination threshold, analyzing the global state of the industrial gateway device, executing the operation of restoring to the original state or updating the global version number, and obtaining the industrial gateway device update result.

[0011] As a further scheme of the application, the storage block to be updated includes memory address intersection coverage, driver version span judgment value, and storage partition block number satisfying the dependency condition, the device update permission flag specifically is normalized bandwidth value, standard I / O ratio value, similarity calculation value, and Boolean judgment identifier obtained according to the hash check result, the version replacement or skip instruction includes partition block number, target version number, hash check key, replacement admission state, and exception record identifier, the number of update failures specifically is write pointer position, original checksum and original version number, the number of update failures specifically is the recorded abnormal write behavior based on the write pointer position backtracking check, and the accumulated number of failures in the unchecked state of the current write version number is obtained by combining the comparison result of the original checksum and the original version number, the industrial gateway device update result includes failure rollback mark, instruction clearing state, global version update number, storage block release amount, and alarm signal triggering state.

[0012] As a further scheme of the present application, the specific steps for collecting the current process state through the industrial gateway device, checking the overlap rate of the memory address conflict in the process state, comparing the overlap rate with the overlap threshold, and generating the specific steps for updating the storage block according to the comparison result include:

[0013] S101: Collecting the memory address call range start value and end value, the driver version number date, and the process mutex identifier in each drive patch of the incremental package, obtaining the memory address segment start value and end value, the current driver version number date, and the running process mutex identifier in the industrial gateway device, calculating the ratio of the overlap address segment length to the total length of the call range, defining it as the memory overlap rate, calling the memory address conflict threshold, calculating the deviation of the memory overlap coverage rate and the conflict threshold, and generating the conflict deviation degree;

[0014] The memory address conflict threshold is in percentage, and the source is based on device running data, laboratory stress test results, and statistical analysis, with a value range of 10% to 30%;

[0015] The incremental package is generated according to the driver difference information and the target version characteristics;

[0016] The overlap address segment length and the total length of the call range are both in bytes;

[0017] S102: Based on the memory overlap coverage rate screening, the patch with a conflict deviation degree lower than the deviation threshold is extracted, the driver version number date and the current device version date are converted into span values in days, and the span values are compared with the version span threshold to generate a patch update priority;

[0018] The version span threshold is calculated according to the minimum safe interval period of version replacement set in the driver program life cycle management specification combined with the statistical data of the average stable running time of the device platform, and the obtained value is used to measure the necessity and urgency of version replacement;

[0019] The deviation threshold is set according to the memory address conflict probability distribution in the industrial gateway device running data record and the version update stability test results;

[0020] S103: Calling the patch update priority, screening the patches with a priority value greater than or equal to 1, extracting the process mutex identifier and the device running mutex identifier for complete string matching, retaining the matching successful patches, arranging them in ascending order of memory address call range, merging the patch number and the version number, and generating the storage block to be updated.

[0021] As a further scheme of the present application, characterized in that the specific steps of extracting the corresponding industrial gateway device to be updated area in the to-be-updated storage block, collecting the network bandwidth utilization rate, data transmission packet loss rate and storage I / O delay rate parameter after normalization in vector form, calculating the cosine similarity between parameters, and generating the device update permission flag according to the similarity degree include:

[0022] S201: Based on the to-be-updated storage block, extract the partition block number, call the associated running task time window start and end time stamp, collect the network bandwidth utilization rate original value of the industrial gateway device within the time window, calculate the original value with the device network interface maximum bandwidth capacity, and generate the bandwidth normalization rate;

[0023] The bandwidth normalization rate = original bandwidth / maximum bandwidth capacity;

[0024] S202: Call the bandwidth normalization rate, filter the time period with a value less than or equal to the bandwidth utilization rate standard threshold, collect the data transmission packet loss rate original sequence within the time period, calculate the sequence data according to the exponential smoothing algorithm, generate the packet loss stability coefficient, and collect the storage I / O delay rate current value at the same time period, call the device storage reference delay, compare the current delay with the reference value, and generate the delay deviation ratio;

[0025] S203: Construct a four-dimensional vector in order according to the bandwidth normalization rate, packet loss stability coefficient, delay deviation ratio and suppression stability factor, calculate the cosine similarity between vectors, if the similarity is greater than or equal to a 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.

[0026] The preset consistency threshold is an empirical value based on historical operation data statistical analysis of the industrial gateway device;

[0027] As a further scheme of the present application, the network and storage state of the industrial gateway device is processed by multi-dimensional parameters, and the formula is:

[0028] ;

[0029] Calculate the cosine similarity ;

[0030] Among them, The similarity adjustment coefficient of the i-th dimension, where i = 1, 2, 3, 4 corresponds to the bandwidth normalization rate, the packet loss stability coefficient, the delay deviation ratio, and the suppression stability factor, The delay deviation ratio is the most critical indicator, the greater the delay deviation ratio, the greater the importance coefficient, and the value range is 0.1 to 0.4, The i-th dimension of the current network state vector, that is, the real-time collected network parameter value This represents the i-th dimension of the historical baseline vector, i.e., the preset baseline value of the network parameters. This indicates a summation operation on parameters in four dimensions.

[0031] As a further aspect of the present invention, 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, in conjunction with the storage block to be updated and the device update permission flag, include:

[0032] S301: Based on the storage block to be updated and the update permission flag, call the partition block identification information and the current status parameters, perform the block-level update admission judgment operation, calculate whether the update is allowed according to the version status corresponding to the identifier and the update permission flag, filter the partition blocks that meet the update conditions, and generate the update block number.

[0033] S302: Based on the updated block number, call the hash value corresponding to the partition block version and the incremental package version, perform consistency comparison according to the hash value matching method, match the target incremental package version number according to the partition block number, identify the version inconsistency items and record the difference block information, and generate the block consistency difference value.

[0034] The hash value matching method is SHA-256 verification;

[0035] S303: Call the block consistency difference value, combine the partition block number and update permission flag, readjust the update permission status of the corresponding partition block according to the comparison result, and integrate the allowed update number with the target version number and the corresponding hash value verification information to generate a replacement instruction including the partition block number, target version number and verification key. If the partition block does not meet the update conditions, record the exception and generate a skip instruction to obtain the version replacement or skip instruction.

[0036] As a further aspect of the present invention, the incremental package data is written into the storage block to be updated according to the version replacement or skip instruction, and the current CPU load and memory usage of the industrial gateway device are input into the Q-Learning model to determine whether the storage block update has failed. The specific steps for counting the number of update failures include:

[0037] S401: Execute the replacement operation according to the version replacement instruction in the version replacement or skip instruction, create a segmented snapshot of the target partition block with the current write pointer position, original checksum and partition block version number, call the segmented write verification function to write incremental packet data in the order of hash key attached to the replacement instruction, monitor the offset position change after each write and record the update range interval, and generate a segmented snapshot information set.

[0038] The generation of the incremental package data is based on the target version and the current version binary difference to generate a minimum driving patch, combines a hash check chain and a version dependency tree to verify data integrity and version compatibility, and matches the current running load condition of the device through a dynamically adjusted check threshold;

[0039] S402: based on the write pointer position and the update range interval in the segmented snapshot information set, the current CPU load rate and the memory occupation rate of the industrial gateway device are collected, a two-dimensional state space parameter group of CPU occupation and memory usage is constructed, the state space parameter group is input into the trained Q-Learning reinforcement model as model training data, the current state corresponding to the exclusive or check threshold is obtained by calling the model strategy table, and is matched to the corresponding snapshot section to generate a dynamic check threshold;

[0040] The dynamic check threshold generation method of the Q-Learning reinforcement model realizes the dynamic adjustment of the exclusive or check threshold by constructing a two-dimensional state space parameter group of CPU load rate and memory occupation rate, combining a reward and punishment function and a model strategy table;

[0041] The Q-Learning model is a reward and punishment function setting according to the abnormal check rate, resource occupation level and write result state triplets in the storage write state feedback, the reward and punishment function of the Q-Learning model adopts a weight distribution of 0.6 and 0.4, and the weighted combination of the abnormal check rate and the resource occupation level ensures the data reliability while considering the system running efficiency, and guides the model to learn the optimal exclusive or check threshold adjustment;

[0042] S403: according to the matched exclusive or check threshold in the dynamic check threshold, the current checksum of each snapshot section is recalculated respectively and exclusive or operation is performed with the original checksum of the snapshot, whether each result is zero is judged, if the exclusive or result is not zero, the replacement failure is marked and the continuous failure counter of the partition block is incremented by one, and the number of update failures is counted.

[0043] As a further scheme of the application, the number of update failures is compared with a determination threshold, the global state of the industrial gateway device is analyzed, and a recovery to the original state or an update of the global version number operation is performed, and the specific steps of obtaining the update result of the industrial gateway device include:

[0044] S501: based on the number of update failures and a preset fault tolerance threshold, a global state determination is performed, the number of replacement failures corresponding to all partition blocks is called, compared with the overall verification fault tolerance threshold, the index number set exceeding the overall verification fault tolerance threshold is obtained, and the determination state is expressed as a Boolean value sequence in a binary logic form to generate a fault tolerance overflow state sequence;

[0045] The whole verification fault tolerance threshold is calculated according to the single-cycle maximum acceptable failure number set in the device fault recovery capability evaluation index system in combination with the partition block writing average failure frequency statistics, and the parameters used are obtained by fitting the device stable operation experimental data.

[0046] S502: According to the index number of the true state in the fault tolerance overflow state sequence, the original write pointer position, the original checksum and the original version number in the corresponding segmented snapshot are extracted, the snapshot data is reconstructed to replace the storage content before the content restoration operation is performed, the recovery result is calculated with the current block content state, and the recovery data offset set is integrated;

[0047] S503: Based on the recovery data offset degree, the offset is zero, the current replacement is verified to have been successfully rolled back, the corresponding storage block is released, the global version number of the device is updated to the current target version, and the corresponding replacement instruction record is cleared, the upgrade process of the remaining untriggered alarm partition is completed, and the industrial gateway device update result is obtained.

[0048] As a further scheme of the application, whether the industrial gateway device is allowed to perform the firmware upgrade operation under the current system resource state is determined, and the formula is used:

[0049] ;

[0050] Calculate the dynamic alarm threshold ;

[0051] Among them represents the basic threshold, represents the initial stability of the device, is the current CPU load rate, is the maximum allowed load rate of the CPU, is the current memory occupancy rate, represents the maximum allowed memory occupancy rate, represents the continuous running time of the device, represents the time decay offset, represents the attenuation degree of the system stability with time in the continuous running process of the device, and the value range is 0.5 to 1.5.

[0052] On the other hand, an AIoT device updating system is provided, which is applied to the AIoT device updating method, and the system comprises:

[0053] The verification module depends on the industrial gateway device to collect the current process state, checks the overlap rate of the memory address conflict in the process state, compares the overlap rate with the overlap threshold, generates the storage block to be updated and outputs to the running state evaluation module;

[0054] The running state evaluation module is used for extracting a corresponding industrial gateway device to-be-updated area in the to-be-updated storage block, collecting network bandwidth utilization, data transmission packet loss rate and storage I / O delay rate parameters after normalization in a vector form, calculating cosine similarity between the parameters, generating a device update permission flag including a normalized bandwidth value, a smooth packet loss coefficient, a standard I / O ratio value, a similarity calculation value and a Boolean judgment identifier according to the similarity, and delivering the device update permission flag to the version comparison module.

[0055] The version comparison module is used for combining the to-be-updated storage block and the device update permission flag, calculating and comparing hash values of a current version and an incremental package target version, generating a version replacement or skipping instruction and delivering the version replacement or skipping instruction to the update writing module.

[0056] The update writing module is used for writing incremental package data into the to-be-updated storage block according to the version replacement or skipping instruction, inputting current CPU load and memory occupation of the industrial gateway device into a Q-Learning model to determine whether storage block updating fails, counting the number of update failures, generating a continuous failure counter value and delivering the continuous failure counter value to the state judgment module.

[0057] The state judgment module is used for comparing the number of update failures with a judgment threshold, analyzing the global state of the industrial gateway device, performing a recovery to an original state or an update of a global version number operation, and obtaining an industrial gateway device update result.

[0058] The technical scheme provided by the embodiment of the application has at least the following beneficial effects: the verification process state memory address conflict overlap rate is checked, the to-be-updated storage block is generated, potential resource conflict areas are dynamically identified, and the risk of upgrade interruption caused by storage area coverage errors is reduced. After the network bandwidth utilization, data transmission packet loss rate and storage I / O delay rate parameters are normalized, the cosine similarity is calculated, the current running environment and network transmission conditions of the device are comprehensively evaluated, inefficient update operations are avoided when resources are insufficient or communication is unstable, and the probability of update failure caused by external interference is reduced. The version replacement or skipping instruction is generated by combining the hash value comparison, the compatibility of the incremental package and the current version of the device is accurately judged, and system crashes caused by mismatched dependencies are prevented. The Q-Learning model is introduced to analyze the influence of CPU load and memory occupation on the storage block update, the potential failure risk is predicted, and the writing strategy is currently adjusted, thereby enhancing the update robustness in complex load scenarios. After the number of update failures is counted and compared with the threshold, the global state recovery or version number update is performed, a multi-level fault tolerance mechanism is established, and the device can still maintain the basic functions in extreme abnormal conditions. The overall process realizes the synchronous improvement of update process stability and efficiency through the synergistic effect of dynamic resource scheduling, multi-dimensional environment perception and adaptive decision-making. BRIEF DESCRIPTION OF DRAWINGS

[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description only constitute some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.

[0060] Figure 1 The workflow diagram of the present application;

[0061] Figure 2 The system flowchart of the present application. DETAILED DESCRIPTION

[0062] The technical solutions in the present application will be described below in combination with the drawings.

[0063] In the embodiments of the present application, the words such as "example", "for example" are used to represent as an example, illustration or description. Any embodiment or design scheme described as "example" in the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the word "example" is intended to present the concept in a specific way. In addition, in the embodiments of the present application, the meaning expressed by "and / or" can be both, or can be one of the two.

[0064] In the embodiments of the present application, "image" and "picture" can be used interchangeably at times. It should be pointed out that when the distinction is not emphasized, the meanings expressed are consistent. "Of", "corresponding" and "corresponding" can be used interchangeably at times. It should be pointed out that when the distinction is not emphasized, the meanings expressed are consistent.

[0065] In the embodiments of the present application, sometimes the subscript such as W1 can be written in the form of non-subscript such as W1. When the distinction is not emphasized, the meanings expressed are consistent.

[0066] In order to make the technical problems, technical solutions and advantages to be solved by the present application more clear, the following will be described in detail in combination with the drawings and specific embodiments.

[0067] Please refer to Figure 1 The present application provides a technical solution, an AIoT device updating method, comprising the following steps:

[0068] S1: Collecting the current process state through the industrial gateway device, checking the overlap rate of the memory address conflict in the process state, comparing the overlap rate with the overlap threshold, and generating a storage block to be updated according to the comparison result;

[0069] S2: extract the corresponding industrial gateway device to be updated in the storage block to be updated, collect the normalized network bandwidth utilization, data transmission packet loss rate and storage I / O delay rate parameters in vector form, calculate the cosine similarity between the parameters, and generate a device update permission flag according to the similarity;

[0070] S3: combining the storage block to be updated and the device update permission flag, calculating and comparing the hash values of the current version and the target version of the incremental package, generating a version replacement or skipping instruction;

[0071] S4: according to the version replacement or skipping instruction, write the incremental package data into the storage block to be updated, input the current CPU load and memory occupation 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;

[0072] S5: compare the number of update failures with the determination threshold, analyze the global state of the industrial gateway device, and execute the operation of restoring to the original state or updating the global version number to obtain the industrial gateway device update result.

[0073] The storage block to be updated includes memory address intersection coverage, driver version span judgment value, and storage partition block number satisfying the dependency condition. The device update permission flag specifically includes normalized bandwidth value, standard I / O ratio value, similarity calculation value, and Boolean judgment identifier obtained according to the hash check result. The version replacement or skipping instruction includes partition block number, target version number, hash check key, replacement admission state, and exception record identifier. The number of update failures specifically includes write pointer position, original checksum, and original version number. The number of update failures specifically includes the number of failures accumulated under the unverified state by comparing the recorded abnormal write behavior based on the write pointer position with the current write version number, and the original checksum. The industrial gateway device update result includes failure rollback flag, instruction clearing state, global version update number, storage block release amount, and alarm signal triggering state.

[0074] Please refer to Figure 1 , by collecting the current process state of the industrial gateway device, verifying the overlap rate of the memory address conflict in the process state, comparing the overlap rate with the overlap threshold, and generating the specific steps of the storage block to be updated according to the comparison result, including:

[0075] S101: collect the memory address call range start value and end value of each driver patch in the incremental package, the driver version number date, and the process mutex identifier, obtain the memory occupation address segment start value and end value of the industrial gateway device, the current driver version number date, and the running process mutex identifier, calculate the ratio of the overlapping address segment length to the total length of the call range, define it as the memory overlap rate, set the memory address conflict threshold, calculate the deviation of the memory overlap coverage rate and the conflict threshold, and generate the conflict deviation degree;

[0076] The memory address conflict threshold is in percentage, and the source is based on device running data, laboratory pressure test results, and statistical analysis, with a value range of 10% to 30%;

[0077] The incremental package is generated according to the driving difference information and the target version characteristics;

[0078] The overlapping address segment length and the total length of the call range are in bytes;

[0079] The starting value (denoted as ) and the ending value (denoted as ) of the memory address call range of each drive patch in the incremental package are collected, for example, , The starting value ( ) and the ending value ( ) of the current memory address segment of the device are collected, and the starting value of the overlapping segment is calculated as , the ending value is , the overlapping segment length is , the total length of the call range is , the memory overlapping rate is , the call memory address conflict threshold is (based on historical conflict frequency statistics, when , it is considered that the conflict risk is high), the conflict deviation is , if the of another patch B is , the deviation threshold is set as , The patch is retained, for example, patch B meets the conditions, patch A is excluded, and the drive version date (such as 2025-04-10) and the mutex identifier (such as Mutex_001) of patch B are extracted.

[0080] Table 1: Patch memory address range and device memory occupancy data

[0081]

[0082] As shown in Table 1, the and of patch B are , 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 and need to be recalculated, and after correction , , , still higher than Therefore, patch B does not meet the condition and needs to be re-screened, assuming that another patch C has Then , meets the screening condition, keep patch C.

[0083] S102: Based on the memory overlap coverage, screen the patch with a conflict deviation lower than the deviation threshold, extract the driver version date and the current device version date, convert the two dates into span values in days, compare them with the version span threshold, and generate a patch update priority;

[0084] The version span threshold is calculated according to the minimum safe interval period of version replacement set in the driver program life cycle management specification combined with the average drive stable running time length statistical data of the device platform, and the obtained value is used to measure the necessity and urgency of version replacement;

[0085] The deviation threshold is set according to the memory address conflict probability distribution in the industrial gateway device running data record and the version update stability test result;

[0086] Based on the retained patch (such as patch C), extract its driver version date (2025-04-15) and the current device version date (2025-04-23), and calculate the date span Days, set the version span threshold Days (set by the device manufacturer according to the patch release frequency), priority , if the Days, then , only keep patch (such as patch C), extract the process mutex lock identifier (such as Mutex_002) of patch C and the current running mutex lock identifier (such as Mutex_002, Mutex_005) of the device, and perform a string complete match, keep patch C after the match is successful, and arrange them in ascending order of memory address call range, for example, the address range of patch C is , the address range of patch E is , and after sorting, patch E, patch C, merge the patch number (PTCH-003) and the version number (V2.5.0), and generate a patch update priority.

[0087] S103: Call the patch update priority, screen the patch with a priority value greater than or equal to 1, extract the process mutex lock identifier and the device running mutex lock identifier for a string complete match, keep the patch with a successful match, arrange them in ascending order of memory address call range, merge the patch number and the version number, and generate a storage block to be updated.

[0088] Call priority list (such as patch C) ),filter For each patch, extract its mutex identifier (e.g., Mutex_002) and compare it one by one with the identifiers (Mutex_002, Mutex_005) in the device's operation. If a match is found, keep patch C and sort it in ascending order by memory address range (e.g., the address of patch F is...). Patch C is The patch number (PTCH-003) and version number (V2.5.0) are merged to generate a storage block (PTCH-003_V2.5.0). The block records the address range, version date, and mutex identifier of patch C for the device to load in sequence.

[0089] Formula Explanation: Memory Overlap Rate In the calculation, and These are the start and end addresses of the patch. and The start and end addresses of the device memory usage, the overlap length is determined by... and Difference calculation, conflict deviation degree through Calculation, where Based on historical data settings, for example, in the historical conflict records of a certain device, when The probability of a conflict occurring is 90%, therefore, it is set... Date span Priority is calculated based on date difference. pass Quantify the timeliness of patches. The equipment update policy stipulates a 10-day interval.

[0090] Patch C , Device memory , Then the overlapping segment is , , , , ,satisfy Patch C is retained.

[0091] Please see Figure 1 The specific steps for extracting the corresponding industrial gateway device update area from the storage block to be updated, collecting network bandwidth utilization, data transmission packet loss rate, and storage I / O latency parameters, normalizing them and representing them in vector form, calculating the cosine similarity between the parameters, and generating a device update permission flag based on the similarity degree include:

[0092] S201: Extract the sub-block number based on the to-be-updated storage block, call the associated running task time window start and end timestamps, collect the network bandwidth utilization raw value of the industrial gateway device within the time window, calculate the raw value with the device network interface maximum bandwidth capacity, and generate the bandwidth normalization rate;

[0093] Bandwidth normalization rate = original bandwidth / maximum bandwidth capacity;

[0094] Based on the to-be-updated storage block (block number PTCH-003_V2.5.0), extract the sub-block number (e.g. PTCH-003), call the associated running task time window start and end timestamps (start timestamp 2025-04-23, 10:00:00, end timestamp 2025-04-23, 11:00:00), collect the network bandwidth utilization raw value of the industrial gateway device within the time window (bandwidth utilization is 45Mbps at 10:00:00, 52Mbps at 10:15:00, 48Mbps at 10:30:00, and 50Mbps at 10:45:00), calculate the raw value with the device network interface maximum bandwidth capacity (device network interface maximum bandwidth capacity is 100Mbps), and generate the bandwidth normalization rate (bandwidth normalization rate at 10:00:00 is 45 / 100=0.45, at 10:15:00 is 52 / 100=0.52, at 10:30:00 is 48 / 100=0.48, and at 10:45:00 is 50 / 100=0.5).

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

[0096]

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

[0098] S202: Call the bandwidth normalization rate, screen the period with a value less than or equal to the bandwidth utilization rate standard threshold, collect the data transmission packet loss rate raw sequence within the period, calculate the sequence data according to the exponential smoothing algorithm, generate the packet loss stability coefficient, and collect the storage I / O delay rate current value at the same period, call the device storage reference delay, compare the current delay with the reference value, and generate the delay deviation ratio;

[0099] Using the bandwidth normalization rates (0.45, 0.52, 0.48, and 0.5 in Table 1), filter for time periods where the values ​​are less than or equal to the standard bandwidth utilization threshold (e.g., setting the threshold to 0.6 means the device's network bandwidth utilization should not exceed 60% of its maximum capacity). Collect the raw sequence of data transmission packet loss rates within these time periods (collecting packet loss rates every 5 minutes from 10:00:00 to 10:45:00, resulting in the sequence [0.001, 0.002, 0.0015, 0.0025, 0.0018, 0.0022, 0.0019, 0.0021, ...). [0.0020]), calculate the sequence data using the exponential smoothing algorithm. For example, set the smoothing coefficient α=0.3, 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 latency rate during the same period. For example, during the period from 10:00:00 to 10:45:00, collect the latency rate every 5 minutes to obtain the sequence [15ms, 16ms, 14ms, 17ms, 15ms, 16ms, 14ms, 17ms, 15ms]. Call the device storage baseline latency (for example, the device storage baseline latency is 20ms), compare the current latency with the baseline value, and generate the latency deviation ratio.

[0100] S203: Construct a four-dimensional vector by order of bandwidth normalization rate, packet loss stability coefficient, latency deviation ratio, and suppression stability factor, calculate the cosine similarity between the vectors, and if the similarity is greater than or equal to the preset consistency threshold and the latency deviation ratio is less than or equal to 1.0, determine that the update condition is met and generate a device update permission flag.

[0101] The preset consistency threshold is an empirical value derived from statistical analysis of historical operating data of industrial gateway devices;

[0102] A four-dimensional vector is constructed sequentially from the bandwidth normalization rate, packet loss stability coefficient, latency deviation ratio, and suppression stability factor. First, when obtaining the bandwidth normalization rate, the normalization value is calculated by dividing the actual throughput rate of the monitored device by the theoretical maximum bandwidth in the network environment. For example, if a device... Internal monitoring throughput rate is Its maximum bandwidth is The bandwidth normalization rate is then obtained. The packet loss stability coefficient is obtained by setting... Observe the changes in packet loss rate within a time window, for example, packet loss rates are respectively With the largest fluctuation range With maximum packet loss rate By comparison, we can obtain , after stability adjustment , the delay deviation ratio is the current average delay of the device and the set reference delay , the value is , the inhibition stability factor reflects the degree of device inhibition stability by reflecting the standard deviation of instruction response time in the interference scene, for example, the response time of five consecutive times is , the standard deviation is about , by , wherein , the value is , so as to construct the current device state vector: , the calculation formula is:

[0103] ;

[0104] wherein, , wherein i=1, 2, 3, 4 respectively correspond to the bandwidth normalization rate, the packet loss stability coefficient, the delay deviation ratio, and the inhibition stability factor, The delay deviation ratio is the most critical indicator, the greater the delay deviation ratio, the greater the importance coefficient, and the value range is 0.1 to 0.4, , the i-th dimension of the current network state vector, that is, the real-time collected network parameter value , the i-th dimension of the historical reference vector, that is, the preset network parameter reference value, , the sum operation is performed on the four dimensions of the parameters.

[0105] The numerator is calculated as follows:

[0106] ,

[0107] ;

[0108] The square root on the left side of the denominator:

[0109] ;

[0110] The square root on the right side of the denominator:

[0111] ;

[0112] The final similarity result is:

[0113] ;

[0114] Because the calculation result meets the similarity condition , and the delay deviation ratio Therefore, it can be determined that the update condition is established, and the device update permission flag is generated.

[0115] Referring to Figure 1 In combination with the to-be-updated storage block and the device update permission flag, the hash values of the current version and the target version of the incremental package are calculated and compared, and the specific steps of generating the version replacement or skipping instruction include:

[0116] S301: Based on the to-be-updated storage block and the update permission flag, the partition block identification information and the current state parameter are called to perform a block-level update admission decision operation. According to the corresponding version state and the update permission flag, it is calculated whether the update is allowed, the partition block that meets the update condition is filtered, and the update block number is generated.

[0117] Based on the to-be-updated storage block (block number PTCH-003_V2.5.0) and the update permission flag (the permission flag is True), the partition block identification information (PTCH-003) and the current state parameter (device storage occupancy rate 80%, network delay 15ms) are called to perform a block-level update admission decision operation. The version state (V2.5.0) corresponding to the partition block and the update permission flag (True / False) are checked. If the permission flag is True and the version state is different from the target version (V3.0.0), it is determined that the update is allowed. The update permission flag of the partition block PTCH-003 is True, the version state is V2.5.0, the target version is V3.0.0, and the update condition is met. The permission flag of the partition block PTCH-004 is False or the version state is consistent with the target version (V3.0.0), and is excluded. After the screening is completed, the update block number list ([PTCH-003, PTCH-005]) is generated.

[0118] Table 3: Partition block update admission decision data

[0119]

[0120] As shown in Table 3, the partition blocks PTCH-003 and PTCH-005 are allowed to be updated because the version state is inconsistent with the target version and the permission flag is True, and PTCH-004 is prohibited because the version is consistent.

[0121] S302: According to the update block number, the hash values corresponding to the partition block version and the incremental package version are called, consistency comparison is performed according to the hash value matching mode, the target incremental package version number is matched according to the partition block number, the version inconsistency item is identified and the difference block information is recorded, and the block consistency difference value is generated.

[0122] The hash value matching mode is SHA-256 verification.

[0123] According to the update block number (PTCH-003, PTCH-005), the hash value corresponding to the partition block version is called (the hash value of PTCH-003 is , and the incremental package version hash value is ), a consistency comparison is performed, if , the difference block information is recorded, including the hash value of the partition block PTCH-005 , the incremental package hash value is , the difference value is calculated (set the hash conversion to decimal value, , , then ), the difference threshold is set (according to the data setting, the difference exceeding the value is considered as inconsistent version), if , it is determined that it is inconsistent, and the difference block information (the difference value of PTCH-005 is 86419754) is generated.

[0124] S303: Call the block consistency difference value, combine the partition block number and the update permission flag, and adjust the update permission state of the corresponding partition block according to the comparison result, and integrate the number allowed to update, the target version number and the corresponding hash value check information to generate a replacement instruction including the partition block number, the target version number and the check key. If the partition block does not meet the update condition, record the exception and generate a skip instruction to get the version replacement or skip instruction;

[0125] Call the block consistency difference value (such as the difference value of PTCH-005 ), combine the update permission flag (such as the permission flag of PTCH-005 is True), if , adjust its update permission state to False, for example, the difference value of PTCH-005 exceeds the threshold, the update permission flag is set to False, and the difference value of PTCH-003 (hash consistent), the permission state remains True, integrate the number of partition blocks allowed to update (such as PTCH-003), the target version number (V3.0.0) and the check key (SHA-256 hash value ), generate a replacement instruction, and generate a skip instruction for the partition block (PTCH-005) not allowed to update.

[0126] Formula explanation: Hash difference value , wherein is the decimal value of the partition block hash, is the decimal value of the incremental package hash, and the difference threshold is According to the conflict data setting (90% of the legal update difference value is less than ), if , determine that the versions are inconsistent, the advantage of the formula is that by comparing the quantified hash difference value with the preset threshold, the version consistency state is determined, and subjective errors are avoided.

[0127] Hash value of partition block PTCH-003 Incremental package hash Difference value Because , determine that they are consistent, the hash value of the partition block PTCH-005 Incremental package hash Difference value Because , determine that they are inconsistent, the results show that PTCH-005 has version tampering or damage, and the update needs to be skipped.

[0128] See Figure 1 According to the version replacement or skip instruction, write the incremental package data into the to-be-updated storage block, input the current CPU load and memory occupation of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails, and the specific steps of counting the number of update failures include:

[0129] S401: According to the version replacement instruction in the version replacement or skip instruction, perform a replacement operation, create a segmented snapshot of the current write pointer position, the original checksum, and the partition block version number for the target partition 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 segmented snapshot information set;

[0130] 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 driving patch, and the data integrity and version compatibility are verified in combination with the hash verification chain and the version dependency tree, and the current running load condition of the device is matched through a dynamically adjusted verification threshold;

[0131] Based on the version replacement instruction (REPLACE PTCH-003 WITH V3.0.0 KEYs 5t6u7v8), the target partition block number PTCH-003 is extracted, the write pointer position (start address 0x1000) is called, and the original checksum (CRC32 value ) With version number V2.5.0, create a segment snapshot (snapshot ID is SNAP-001), call the segment 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 writing 64 bytes each time (the offset changes from 0x1000 to 0x1040 after the first write), monitor and record the update range interval [0x1000, 0x1200], and generate a segment snapshot information set (including snapshot ID, write pointer sequence [0x1000, 0x1040, 0x1200], and checksum sequence [0xA5B3C7D9, 0xB4D2E1F0,]).

[0132] Table 4: Segment snapshot information

[0133]

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

[0135] S402: Based on the write pointer position in the segment snapshot information set and the update range interval, the current CPU load rate and memory occupancy rate of the industrial gateway device are collected, a two-dimensional state space parameter group of CPU occupancy and memory usage is constructed, the state space parameter group is input into the trained Q-Learning reinforcement model as model training data, the current state corresponding to the exclusive or verification threshold value is obtained by calling the model strategy table, and is matched to the corresponding snapshot segment to generate a dynamic verification threshold value;

[0136] The dynamic verification threshold value generation method of the Q-Learning reinforcement model realizes the dynamic adjustment of the exclusive or verification threshold value 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 strategy table;

[0137] The Q-Learning model is a reward and punishment function setting constructed according to the abnormal verification rate, resource occupancy level and write result state triplets in the storage write state feedback, the reward and punishment function of the Q-Learning model adopts a weight distribution of 0.6 and 0.4, and through the weighted combination of the abnormal verification rate and the resource occupancy level, the system running efficiency is considered while ensuring data reliability, and the model is guided to learn the optimal exclusive or verification threshold value adjustment;

[0138] Based on the write pointer position [0x1000, 0x1200] of snapshot SNAP-001, the current CPU load rate (45%) and memory occupancy rate (65%) of the device are collected, and a two-dimensional state space parameter group is constructed Input the parameter set into the Q-Learning model strategy table, and obtain the corresponding XOR check threshold according to the state interval matching rule (matching strategy 1 when CPU load rate < 50% and memory < 70%). If the state interval is CPU ≥ 50% or memory ≥ 70%, then the threshold of matching strategy 2 is applied. For example, if the current parameter group (45, 65) conforms to strategy 1, a dynamic verification threshold is generated. .

[0139] Table 5: Q-Learning Strategy Table

[0140]

[0141] As shown in Table 5, the policy table maps device status to dynamic verification thresholds.

[0142] S403: Based on the XOR check threshold matched in the dynamic check threshold, recalculate the current checksum for each snapshot segment and perform an XOR operation with the original checksum of the snapshot. Determine whether each result is zero. If the XOR result is non-zero, mark the replacement failure and increment the consecutive failure counter of the partition block to count the number of update failures.

[0143] Based on dynamic verification threshold For each segment of snapshot SNAP-001 (segment 1: 0x1000-0x1040), recalculate the current checksum. , with the original checksum Perform XOR operation ,judge Is it equal to the threshold? ,like If the replacement fails, the consecutive failure counter for partition block PTCH-003 will increment from 0 to 1, and the number of update failures will be counted as 1.

[0144] XOR check formula:

[0145] ;

[0146] Parameter definition:

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

[0148] Operation logic: The XOR operation is used to detect the difference in checksum before and after data is written. If the result is non-zero, it indicates that the data has been tampered with or written incorrectly.

[0149] Dynamic threshold setting: policy matching rule: when the device state satisfies and , set (strict verification), when or , set (loose verification, allow non-critical differences).

[0150] Through the association of dynamic threshold and device state , self-matching adjustment of verification strength is performed, strict verification is performed when the device load is low, and non-critical differences are allowed when the load is high, balancing update safety and system performance.

[0151] Please refer to Figure 1 , compare the number of update failures with the judgment 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 specific steps of the industrial gateway device update result:

[0152] S501: Based on the number of update failures and the preset fault tolerance threshold, the global state is determined, the number of replacement failures corresponding to all partition blocks is called, compared with the overall verification fault tolerance threshold, the index number set exceeding the overall verification fault tolerance threshold is obtained, and the determination state is expressed as a Boolean value sequence in binary logic form, generating a fault tolerance overflow state sequence;

[0153] The overall verification fault tolerance threshold is calculated according to the single-cycle maximum acceptable failure number set in the device fault recovery capability evaluation index system combined with the partition block write average failure frequency statistics, and the parameters used are obtained by fitting the device stable operation experimental data;

[0154] Based on the number of update failures (PTCH-003 ) and dynamic fault tolerance threshold , the global state is determined, where is the reference threshold, and are weight coefficients, is the CPU load rate, is the memory occupancy rate, and is calculated , call the of all partition blocks, if is 1, otherwise 0, generate a Boolean sequence , integrate the index set {PTCH-004}, for example, the of PTCH-004 , trigger fault tolerance overflow.

[0155] Table 6: Fault tolerance threshold parameter calibration experiment

[0156]

[0157] As shown in Table 6, the dynamic threshold Through experimental calibration, it is ensured that the deviation rate of the formula calculation value from the actual fault tolerance upper limit is less than 15%.

[0158] S502: According to the index number of the true state in the fault tolerance overflow state sequence, the original write pointer position, the original checksum and the original version number in the corresponding segmented snapshot are extracted, the storage content before replacement is reconstructed according to the snapshot data, and the content restoration operation is performed, the deviation difference calculation between the recovery result and the current block content state is performed, and the recovery data offset set is integrated;

[0159] According to the PTCH-004 state of the true state, the snapshot parameters: the original write pointer , the original checksum , and the original version number are extracted. When reconstructing the storage content, the data block size bytes are recovered block by block, and the checksum after recovery is calculated . The difference entropy is defined by comparing the current checksum , where is the first byte of the current data block , and is the first byte of the recovered data block . The first byte difference is calculated, the weight is contributed to the entropy value , and the total byte difference is obtained after accumulating all byte differences. If , it is determined that the offset is abnormal, and the offset is recorded , and the recovery data offset set {PTCH-004:0x200} is integrated.

[0160] S503: Based on the partition block number with zero offset in the recovery data offset degree, it is verified that the current replacement has been successfully rolled back, the corresponding storage block is released, the global version number of the device is updated to the current target version, and the corresponding replacement instruction record is cleared, the upgrade process of the remaining untriggered alarm partition is completed, and the industrial gateway device update result is obtained.

[0161] Based on the partition block number with zero offset in the recovered data offset degree, the offset values of the partition blocks B1, B2 and B3 are identified as 0, the block mapping table of the storage management system is traversed, the storage addresses of B1, B2 and B3 are extracted as 0x80000000, 0x80001000 and 0x80002000 respectively, the storage release interface is called one by one, the release instruction is sent to the storage controller, the instruction contains the address parameter and the release flag (the flag is set to 0x01), the storage controller returns the operation code 0xA1 after responding, the consistency of the operation code and the preset success code 0xA1 is checked, if consistent, the current value 0x00020105 of the device global version register address 0x8000F000 is updated to the target version number 0x00020104, the version number is written through the write register instruction 0x57, the register value is read to verify whether the update is successful, the replacement instruction queue is traversed, the instruction record IDs (the record IDs are 0012, 0013 and 0014 respectively) of the partition blocks B1, B2 and B3 are matched, the corresponding records in the queue are deleted, the upgrade state fields of the remaining partition blocks B4 and B5 are scanned, if the state is “to be upgraded”, the upgrade interface is called to trigger the partition firmware transmission, the transmission rate is 512Kbps, after the transmission is completed, the firmware hash value is verified, compared with the preset hash value 0x3A7D…B9E2, if consistent, the partition state is updated to “completed”, all partition block states are summarized to generate a device update report, in the upgrade process, the alarm threshold is dynamically adjusted to adapt to the device load change.

[0162] Dynamic alarm threshold formula:

[0163]

[0164] Wherein is The basic threshold represents the initial stability of the device, is the current CPU load rate, is the maximum allowed CPU load rate, is the current memory occupancy rate, represents the maximum allowed memory occupancy rate, represents the continuous running time of the device, represents the time decay offset, which represents the degree of attenuation of the system stability over time during the continuous running of the device, and the value range is 0.5 to 1.5.

[0165] Current CPU load: Maximum CPU load: Current memory occupancy: 6Maximum memory capacity: Current continuous running time of the device: ;

[0166] Time offset: ; device base threshold: ;

[0167] CPU load item is calculated: , .

[0168] Memory item is calculated: , .

[0169] Time item is calculated: .

[0170] The final calculation result is .

[0171] 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, allowing the upgrade operation to be performed, and 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 state is updated to "completed", the device global version number is updated to 0x00020104, and the related records in the replacement instruction queue are deleted. The operation result is recorded in the log file, and the industrial gateway device update process is completed.

[0172] Please refer to Figure 2 , an AIoT device update system, the AIoT device update system is used to execute the above-mentioned AIoT device update method, the system comprises:

[0173] A dependency verification module, which collects the current process state through the industrial gateway device, verifies the overlap rate of the memory address conflict in the process state, compares the overlap rate with the overlap threshold, generates a to-be-updated storage block and outputs it to the running state evaluation module;

[0174] A running state evaluation module for extracting the corresponding industrial gateway device to-be-updated area in the to-be-updated storage block, collecting the network bandwidth utilization rate, data transmission packet loss rate and storage I / O delay rate parameters after normalization in vector form, calculating the cosine similarity between the parameters, generating a device update permission flag according to the similarity and passing it to the version comparison module;

[0175] A version comparison module for combining the to-be-updated storage block and the device update permission flag, calculating and comparing the hash values of the current version and the target version of the incremental package, generating a version replacement or skipping instruction and passing it to the update writing module;

[0176] The update writing module is configured to write the incremental package data into the to-be-updated storage block according to the version replacement or skipping instruction, input the current CPU load and memory occupation 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 input the continuous failure counter value into the state determination module.

[0177] The state determination module is configured to compare the number of update failures with a determination threshold, analyze the global state of the industrial gateway device, perform a recovery to an original state or an update global version number operation, and obtain an update result of the industrial gateway device.

[0178] It should be understood that the term "and / or" herein merely describes an association relationship of associated objects, and indicates that there can be three relationships, for example, A and / or B can represent three cases of A alone, A and B together, and B alone, wherein A and B can be singular or plural. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects, but can also represent an "and / or" relationship, which can be understood according to the context before and after.

[0179] In the present application, "at least one" means one or more, and "a plurality of" means two or more. "At least one of the following" or the like means any combination of these items, including any combination of single item or multiple items. 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, wherein a, b, and c can be single or multiple.

[0180] It should be understood that the size of the serial number of each process described above in each embodiment of the present application does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0181] Those skilled in the art can realize that each unit and algorithm step of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

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

[0183] In several embodiments provided by the present application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the above-described apparatus embodiments are merely schematic, and the division of units is merely a logical function division. Actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another device, or some features can be omitted or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.

[0184] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place or distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

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

[0186] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of each embodiment of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and any medium that can store program codes.

[0187] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. An AIoT device updating method, characterized in that, The method comprises: S1: collecting the current process state through the industrial gateway device, checking the overlap rate of memory address conflicts in the process state, comparing the overlap rate with an overlap threshold, and generating a storage block to be updated according to the comparison result; S2: extracting the corresponding industrial gateway device update area 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 after normalization in the form of a vector, calculating the cosine similarity between the parameters, and generating a device update permission flag according to the similarity; S3: combining the storage block to be updated and the device update permission flag, calculating and comparing the hash values of the current version and the target version of the incremental package, and generating a version replacement or skip instruction; S4: writing incremental package data into the storage block to be updated, inputting the current CPU load and memory occupation of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails, and counting the number of update failures; S5: comparing the number of update failures with a determination threshold, analyzing the global state of the industrial gateway device, and performing a recovery to the original state or an update global version number operation to obtain an industrial gateway device update result.

2. The AIoT device updating method of claim 1, wherein The specific steps of collecting the current process state through the industrial gateway device, checking the overlap rate of memory address conflicts in the process state, and generating a storage block to be updated according to the comparison result include: S101: collecting the memory address call range start value and end value, driver version number date, and process mutex identifier of each driver patch in the incremental package, obtaining the memory occupation address segment start value and end value, current driver version number date, and running process mutex identifier of the industrial gateway device, calculating the ratio of the overlap address segment length to the total length of the call range, defining it as the memory overlap rate, calling the memory address conflict threshold, calculating the deviation of the memory overlap coverage rate from the conflict threshold, and generating a conflict deviation degree; The memory address conflict threshold is in percentage, and is based on device running data, laboratory stress test results, and statistical analysis, with a value range of 10% to 30%; The incremental package is generated according to the driver difference information and target version characteristics; The overlap address segment length and the total length of the call range are both in bytes; S102: based on the patch with a conflict deviation degree lower than the deviation threshold selected by the memory overlap coverage rate, extracting the driver version number date and the current device version date, converting the two dates into a span value in days, and comparing the span value with a version span threshold to generate a patch update priority; The version span threshold is calculated according to the minimum safe interval period of version replacement set in the driver program life cycle management specification and the average stable running time length statistical data 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 in the industrial gateway device running data record and the version update stability test result. S103: Call the patch update priority, filter the patches with priority values greater than or equal to 1, extract the process mutual exclusion lock identifier, and perform string complete matching with the device running mutual exclusion lock identifier, retain the matching successful patches, arrange in ascending order according to the memory address call range, merge the patch number and version number, and generate the to-be-updated storage block.

3. The AIoT device updating method of claim 1, wherein The specific steps of extracting the corresponding industrial gateway device to-be-updated area in the to-be-updated storage block, collecting the network bandwidth utilization rate, data transmission packet loss rate, and storage I / O delay rate parameters after normalization 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 to-be-updated storage block, extract the partition block number, call the associated running task time window start and end time stamps, collect the network bandwidth utilization rate original value of the industrial gateway device within the time window, calculate the bandwidth normalization rate by comparing the original value with the device network interface maximum bandwidth capacity; The bandwidth normalization rate = original bandwidth / maximum bandwidth capacity; S202: Call the bandwidth normalization rate, filter the time periods with values less than or equal to the bandwidth utilization rate standard threshold, collect the data transmission packet loss rate original sequence within the time period, calculate the packet loss stability coefficient according to the exponential smoothing algorithm, and collect the storage I / O delay rate current value at the same time period, call the device storage benchmark delay, compare the current delay with the benchmark value, and generate the delay deviation ratio; S203: Construct a four-dimensional vector in order of 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 met, and generate the device update permission flag; The preset consistency threshold is an empirical value based on statistical analysis of industrial gateway device operation data.

4. The AIoT device updating method of claim 1, wherein The specific steps of combining the to-be-updated storage block and the device update permission flag, calculating and comparing the hash values of the current version and the incremental package target version, and generating the version replacement or skip instruction include: S301: Based on the to-be-updated storage block and the update permission flag, call the partition block identification information and the current state parameters, perform block-level update access judgment operation, calculate whether to allow update according to the version state corresponding to the identification and the update permission flag, filter the partition blocks that meet the update condition, and generate the update block number; S302: According to the update block number, call the hash values corresponding to the partition block version and the incremental package version, perform consistency comparison according to the hash value matching method, match the target incremental package version number according to the partition block number, identify the inconsistent items and record the difference block information, and generate the block consistency difference value; The hash value matching method is SHA-256 verification; S303: Call the block consistency difference value, combine the partition block number and the update permission flag, adjust the update permission state of the corresponding partition block according to the comparison result, and integrate the number of allowed updates, the target version number and the corresponding hash value check information to generate a replacement instruction including the partition block number, the target version number and the check key. If the partition block does not meet the update condition, an exception is recorded and a skip instruction is generated, and a version replacement or skip instruction is obtained.

5. The AIoT device updating method of claim 1, wherein According to the version replacement or skip instruction, write the incremental package data into the to-be-updated storage block, and input the current CPU load and memory occupation of the industrial gateway device into the Q-Learning model to determine whether the storage block update fails. The specific steps of counting the number of update failures include: S401: According to the version replacement instruction in the version replacement or skip instruction, perform a replacement operation, create a segmented snapshot of the current write pointer position, the original checksum and the partition block version number for the target partition block, call the segmented write check function to write the incremental package data in the order of the hash key attached to the replacement instruction, monitor the offset position change 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 minimum driving patch, and the hash check chain and the version dependency tree are used to verify the data integrity and version compatibility, and the check threshold is dynamically adjusted to match the current running load condition of the device; 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 occupation rate of the industrial gateway device, construct a two-dimensional state space parameter group of CPU occupation and memory usage, input the state space parameter group into the trained Q-Learning reinforcement model as model training data, call the model strategy table to obtain the corresponding exclusive or check threshold of the current state, and match it to the corresponding snapshot segment to generate a dynamic check threshold; The dynamic check threshold generation method of the Q-Learning reinforcement model is to construct a two-dimensional state space parameter group of CPU load rate and memory occupation rate, combine the reward and punishment functions and the model strategy table, and realize the dynamic adjustment of the exclusive or check threshold; The reward and punishment function of the Q-Learning model is set according to the abnormal check rate, resource occupation level and write result state triplets in the storage write state 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 occupation level, the system running efficiency is considered while ensuring data reliability, guiding the model to learn the optimal exclusive or check threshold adjustment; S403: According to the exclusive or check threshold matched in the dynamic check threshold, recalculate the current checksum for each snapshot segment respectively and perform exclusive or operation with the snapshot original checksum, judge whether each result is zero, if the exclusive or result is not zero, mark the replacement failure and add one to the continuous failure counter of the partition block, and count the number of update failures.

6. The AIoT device updating method of claim 1, wherein 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 industrial gateway device update result include: S501: Based on the number of update failures and the preset fault tolerance threshold, the global state is determined, the number of replacement failures corresponding to all partition blocks is called, compared with the overall verification fault tolerance threshold, the index number set exceeding the overall verification fault tolerance threshold is obtained, and the determination state is expressed as a Boolean value sequence in binary logic form, and a fault tolerance overflow state sequence is generated; The overall verification fault tolerance threshold is calculated according to the single-cycle maximum acceptable failure number set in the device fault recovery capability evaluation index system combined with the partition block write average failure frequency statistics. The parameters used are obtained by fitting the experimental data of stable operation of the device; S502: According to the index number of the true state in the fault tolerance overflow state sequence, the original write pointer position, the original checksum and the original version number in the corresponding segmented snapshot are extracted, the storage content before replacement is reconstructed according to the snapshot data, and the content restoration operation is performed. Calculate the offset difference between the recovery result and the current block content state, and integrate it into a recovery data offset set; S503: Based on the partition block number with zero offset in the recovery data offset degree, it is verified that the current replacement has been successfully rolled back, the corresponding storage block is released, the global version number of the device is updated to the current target version, and the corresponding replacement instruction record is cleared. Complete the upgrade process of the remaining untriggered alarm partition, and obtain the industrial gateway device update result.

7. The AIoT device updating method of claim 1, wherein Determine whether the industrial gateway device is allowed to perform the firmware upgrade operation under the current system resource state, using the formula: ; Computing dynamic alarm thresholds ; wherein represents the base threshold, represents the initial stability of the device, is the current CPU load rate, is the maximum allowed CPU load rate, is the current memory occupancy rate, represents the maximum allowed memory occupancy rate, represents the continuous running time of the device, represents the time decay offset, represents the degree of decay of the system stability over time during the continuous running of the device, and the value range is 0.5 to 1.5.

Citation Information

Patent Citations

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

    CN111045714A

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

    CN119441976A