Analog signal segmentation calibration method and system based on dynamic priority
The analog signal segmented calibration method with dynamic priority and multi-layer encryption mechanism solves the problems of low efficiency, insufficient accuracy and safety hazards of analog signal calibration in embedded devices, and achieves efficient, flexible and safe calibration effect.
Patent Information
- Application Number
- CN202510478512.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-16
- Publication Date
- 2025-09-09
AI Technical Summary
The existing technology for analog signal calibration in embedded devices has problems such as low efficiency, insufficient accuracy, inability to flexibly respond to scene changes, and potential safety hazards.
An analog signal segmented calibration method based on dynamic priority is adopted. By creating an analog signal calibration table, setting the update rules of the enabled state and calibration priority, and combining multi-layer encryption mechanism and modular design, segmented calibration of analog signals is achieved.
It improves the accuracy, efficiency, flexibility and security of analog signal calibration, adapts to complex environments, reduces redundant data usage, and improves the operating performance and security of embedded devices.
Smart Images

Figure CN120609398A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of analog quantity calibration, and in particular to a dynamic priority-based analog signal segmented calibration method and system. Background Art
[0002] Many embedded devices use integrated sensors to sense environmental data, generating analog signals (analog quantities). These signals are then converted to digital signals using analog-to-digital converters (ADCs) for subsequent analysis or display. For example, temperature sensors, pressure sensors, or accelerometers can collect analog signals of temperature, pressure, or acceleration.
[0003] Since the process of sensor acquisition of analog signals is easily affected by factors such as sensor manufacturing tolerances and environmental interference (temperature drift, electromagnetic noise), resulting in deviations, the measurement accuracy of the original analog signals is often difficult to meet the requirements of high-reliability applications (such as industrial control and medical equipment). Therefore, it is necessary to calibrate the collected analog signals to ensure the accuracy of the subsequent converted digital signals.
[0004] For the calibration of analog signals collected by embedded devices, the linear parameter calibration method (y=kx+b) is traditionally adopted. Specifically, a global linear mapping relationship is established by calibrating two points (such as the zero point and the full scale). When the output of the sensor exhibits significant nonlinearity, the piecewise linear parameter calibration method is adopted, that is, multiple linear intervals are divided (such as 25%, 50%, and 75% of the range are divided into four linear intervals). In each linear interval, the corresponding compensation value is independently calculated using the linear parameter calibration method.
[0005] However, the traditional method has the following disadvantages: 1. The piecewise linear parameter calibration method requires calibrating all linear intervals (segments) in sequence, but in actual applications, embedded devices are inconsistent, or some applications only need to use certain linear intervals. Traditionally, targeted calibration cannot be performed, resulting in low calibration efficiency; for example, only 10%-30% of the pressure sensor's range is a high-frequency usage segment, and it may only be necessary to calibrate the linear interval within 10%-30%; 2. Some linear intervals may have higher precision requirements, and a single piecewise linear parameter calibration method cannot meet the higher precision requirements; 3. The traditional piecewise linear parameter calibration method uses a fixed linear interval (segment) and cannot respond to scene changes; for example, local nonlinearity is aggravated by sudden vibrations in industrial sites; 4. No safety measures are taken during the calibration process, and the calibration parameters may be maliciously modified, posing certain safety risks.
[0006] Therefore, how to provide a dynamic priority-based analog signal segmented calibration method and system to improve the accuracy, efficiency, flexibility and security of analog signal calibration has become a technical problem that needs to be solved urgently. Summary of the Invention
[0007] The technical problem to be solved by the present invention is to provide a method and system for analog signal segmented calibration based on dynamic priority, so as to improve the accuracy, efficiency, flexibility and security of analog signal calibration.
[0008] In a first aspect, the present invention provides a method for calibrating analog signals by segment based on dynamic priority, comprising the following steps:
[0009] Step S1: The embedded device creates an analog signal calibration table for storing segmentation intervals, calibration methods, calibration parameters, activation status, and calibration priority, sets a first update rule for the activation status and a second update rule for the calibration priority, and stores the analog signal calibration table;
[0010] Step S2: the embedded device obtains an input calibration table setting instruction, verifies the input calibration table setting instruction, and updates the stored analog signal calibration table based on the calibration table setting instruction;
[0011] Step S3: the embedded device obtains an input calibration start instruction, verifies the input calibration start instruction, and then starts a calibration function;
[0012] Step S4: the embedded device collects the original analog signal in real time through the sensor, and performs segmented calibration on the original analog signal based on the analog signal calibration table;
[0013] Step S5: The embedded device records the calibration log in real time and stores the calibration log in encrypted form.
[0014] Furthermore, the step S1 is specifically as follows:
[0015] The embedded device creates an analog signal calibration table for storing segmented intervals, calibration methods, calibration parameters, enabled states, and calibration priorities; the segmented intervals are segmented intervals of the analog signal, and the segmented intervals are continuous intervals, discontinuous intervals, or overlapping intervals; the calibration methods include at least linear function fitting calibration, polynomial function fitting calibration, and exponential function fitting calibration; the calibration parameters include at least function coefficients of linear functions, polynomial functions, and exponential functions; the enabled state is the enabled state of the segmented interval, and the value is enabled or disabled; and the calibration priorities correspond one-to-one to the segmented intervals;
[0016] A first update rule for the enabled state and a second update rule for the calibration priority are set; the first update rule is specifically: determining whether the span of the segmented interval is greater than a preset range, and if so, updating the corresponding enabled state to disabled; if not, updating the corresponding enabled state to enabled; the second update rule is specifically: sorting based on the span of each segmented interval, with smaller spans having higher priorities, and updating the calibration priority based on the sorting result;
[0017] The analog signal calibration table is stored in a specified memory block in the form of a Struct structure.
[0018] Furthermore, the step S2 is specifically as follows:
[0019] The embedded device obtains an input calibration table setting instruction including the first ciphertext data, the second ciphertext data and the hash value;
[0020] The first ciphertext data is obtained by encrypting the segmentation interval, calibration method and calibration parameters. The encryption rules are as follows: the segmentation interval, calibration method and calibration parameters are encrypted by the 3DES algorithm to obtain the first-level encrypted data, each character of the first-level encrypted data is mapped by the preset mapping rule to obtain the second-level encrypted data, the number 6 and the letter P are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped in the second-level encrypted data to obtain the third-level encrypted data, and the third-level encrypted data is encrypted into the first ciphertext data by the RC6 algorithm; the second ciphertext data is the device serial number , username, password, and first timestamp, wherein the encryption rule is as follows: encrypting the device serial number, username, password, and first timestamp using the AES algorithm to obtain a first layer of encrypted data, adding a random string of a specified length at a specified position of the first layer of encrypted data to obtain a second layer of encrypted data, encrypting the second layer of encrypted data into a third layer of encrypted data using the SM4 algorithm, segmenting the third layer of encrypted data according to a preset segmentation ratio and swapping the order to obtain second ciphertext data; the hash value is obtained by hashing the first ciphertext data and the second ciphertext data using the hash-256 algorithm;
[0021] The embedded device parses the calibration table setting instruction input to obtain first ciphertext data, second ciphertext data and a hash value; after performing integrity verification on the first ciphertext data and the second ciphertext data using the hash value, the first ciphertext data is decrypted into three-level encrypted data using the RC6 algorithm, the number 6 and the letter P in the three-level encrypted data are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped to obtain second-level encrypted data, each character of the second-level encrypted data is mapped according to the mapping rule to obtain first-level encrypted data, and the first-level encrypted data is decrypted using the 3DES algorithm to obtain a segmented interval, a calibration method and calibration parameters; the second ciphertext data is divided according to the inverse of the division ratio and the order is swapped to obtain three-layer encrypted data, the three-layer encrypted data is decrypted into two-layer encrypted data using the SM4 algorithm, a random string is located in the second-layer encrypted data based on the specified position and the specified length and is removed to obtain first-layer encrypted data, and the first-layer encrypted data is decrypted using the AES algorithm to obtain a device serial number, a user name and password and a first timestamp;
[0022] After the integrity check is performed using the first timestamp, the legitimacy of the device serial number and username password is checked using the preset user management table. Then, the stored analog signal calibration table is updated based on the segmentation interval, calibration method, and calibration parameters carried by the calibration table setting instruction. The analog signal calibration table synchronously updates the enabled status and calibration priority based on the first update rule and the second update rule, and feeds back the updated result.
[0023] Furthermore, the step S3 is specifically as follows:
[0024] The embedded device obtains an input calibration start instruction carrying a device serial number, a second timestamp, and a MAC value, where the MAC value is obtained by performing an HMAC calculation on the device serial number and the second timestamp;
[0025] The embedded device parses the received calibration start instruction to obtain the device serial number, the second timestamp and the MAC value. After performing an integrity check using the MAC value, a time validity check is performed using the time interval between the second timestamp and the first timestamp carried by the calibration table setting instruction. The device serial number is then verified for legitimacy using the preset user management table. If the check passes, the calibration function is started.
[0026] Furthermore, the step S4 is specifically as follows:
[0027] The embedded device collects the original analog signal in real time through the sensor, locates the segmented interval of the original analog signal based on the analog signal calibration table, and matches the corresponding calibration method, calibration parameters, activation status and calibration priority based on the segmented interval;
[0028] The embedded device sorts the segmented intervals whose enabling state is enabled based on the calibration priority, and then performs segmented calibration on the original analog signal of each segmented interval in sequence based on the calibration method and calibration parameters;
[0029] The step S5 is specifically as follows:
[0030] The embedded device records a calibration log including at least the calibration time, the original analog signal, and the calibration analog signal in real time, encrypts the calibration log into an encrypted log based on a preset storage period, stores the encrypted log in a designated path, and uploads the encrypted log to a server for backup via the TLS protocol;
[0031] The encryption process of the calibration log is as follows:
[0032] Create a pair of public keys and private keys based on the RSA algorithm, calculate the MD5 value of the calibration log using the MD5 algorithm, encrypt the calibration log and the MD5 value using the private key to obtain first encrypted data, encrypt the public key into a secret key using the AES256 algorithm, encrypt the first encrypted data and the secret key into second encrypted data using the ECDSA algorithm, and circularly shift each character of the second encrypted data right by 7 bits to obtain an encrypted log.
[0033] In a second aspect, the present invention provides a dynamic priority-based analog signal segmentation calibration system, comprising the following modules:
[0034] An analog signal calibration table creation module is configured to create an analog signal calibration table for storing segmentation intervals, calibration methods, calibration parameters, enablement status, and calibration priority for an embedded device, set a first update rule for the enablement status and a second update rule for the calibration priority, and store the analog signal calibration table;
[0035] An analog signal calibration table updating module is configured to enable an embedded device to obtain an input calibration table setting instruction, verify the input calibration table setting instruction, and then update a stored analog signal calibration table based on the calibration table setting instruction.
[0036] A calibration function starting module is used for the embedded device to obtain an input calibration starting instruction, verify the input calibration starting instruction, and then start the calibration function;
[0037] An analog signal segmented calibration module is used for an embedded device to collect an original analog signal in real time through a sensor, and perform segmented calibration on the original analog signal based on the analog signal calibration table;
[0038] The calibration log management module is used for recording the calibration log of the embedded device in real time and encrypting and storing the calibration log.
[0039] Furthermore, the analog signal calibration table creation module is specifically used to:
[0040] The embedded device creates an analog signal calibration table for storing segmented intervals, calibration methods, calibration parameters, enabled states, and calibration priorities; the segmented intervals are segmented intervals of the analog signal, and the segmented intervals are continuous intervals, discontinuous intervals, or overlapping intervals; the calibration methods include at least linear function fitting calibration, polynomial function fitting calibration, and exponential function fitting calibration; the calibration parameters include at least function coefficients of linear functions, polynomial functions, and exponential functions; the enabled state is the enabled state of the segmented interval, and the value is enabled or disabled; and the calibration priorities correspond one-to-one to the segmented intervals;
[0041] A first update rule for the enabled state and a second update rule for the calibration priority are set; the first update rule is specifically: determining whether the span of the segmented interval is greater than a preset range, and if so, updating the corresponding enabled state to disabled; if not, updating the corresponding enabled state to enabled; the second update rule is specifically: sorting based on the span of each segmented interval, with smaller spans having higher priorities, and updating the calibration priority based on the sorting result;
[0042] The analog signal calibration table is stored in a specified memory block in the form of a Struct structure.
[0043] Furthermore, the analog signal calibration table updating module is specifically used to:
[0044] The embedded device obtains an input calibration table setting instruction including the first ciphertext data, the second ciphertext data and the hash value;
[0045] The first ciphertext data is obtained by encrypting the segmentation interval, calibration method and calibration parameters. The encryption rules are as follows: the segmentation interval, calibration method and calibration parameters are encrypted by the 3DES algorithm to obtain the first-level encrypted data, each character of the first-level encrypted data is mapped by the preset mapping rule to obtain the second-level encrypted data, the number 6 and the letter P are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped in the second-level encrypted data to obtain the third-level encrypted data, and the third-level encrypted data is encrypted into the first ciphertext data by the RC6 algorithm; the second ciphertext data is the device serial number , username, password, and first timestamp, wherein the encryption rule is as follows: encrypting the device serial number, username, password, and first timestamp using the AES algorithm to obtain a first layer of encrypted data, adding a random string of a specified length at a specified position of the first layer of encrypted data to obtain a second layer of encrypted data, encrypting the second layer of encrypted data into a third layer of encrypted data using the SM4 algorithm, segmenting the third layer of encrypted data according to a preset segmentation ratio and swapping the order to obtain second ciphertext data; the hash value is obtained by hashing the first ciphertext data and the second ciphertext data using the hash-256 algorithm;
[0046] The embedded device parses the calibration table setting instruction input to obtain first ciphertext data, second ciphertext data and a hash value; after performing integrity verification on the first ciphertext data and the second ciphertext data using the hash value, the first ciphertext data is decrypted into three-level encrypted data using the RC6 algorithm, the number 6 and the letter P in the three-level encrypted data are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped to obtain second-level encrypted data, each character of the second-level encrypted data is mapped according to the mapping rule to obtain first-level encrypted data, and the first-level encrypted data is decrypted using the 3DES algorithm to obtain a segmented interval, a calibration method and calibration parameters; the second ciphertext data is divided according to the inverse of the division ratio and the order is swapped to obtain three-layer encrypted data, the three-layer encrypted data is decrypted into two-layer encrypted data using the SM4 algorithm, a random string is located in the second-layer encrypted data based on the specified position and the specified length and is removed to obtain first-layer encrypted data, and the first-layer encrypted data is decrypted using the AES algorithm to obtain a device serial number, a user name and password and a first timestamp;
[0047] After the integrity check is performed using the first timestamp, the legitimacy of the device serial number and username password is checked using the preset user management table. Then, the stored analog signal calibration table is updated based on the segmentation interval, calibration method, and calibration parameters carried by the calibration table setting instruction. The analog signal calibration table synchronously updates the enabled status and calibration priority based on the first update rule and the second update rule, and feeds back the updated result.
[0048] Furthermore, the calibration function starting module is specifically used to:
[0049] The embedded device obtains an input calibration start instruction carrying a device serial number, a second timestamp, and a MAC value, where the MAC value is obtained by performing an HMAC calculation on the device serial number and the second timestamp;
[0050] The embedded device parses the received calibration start instruction to obtain the device serial number, the second timestamp and the MAC value. After performing an integrity check using the MAC value, a time validity check is performed using the time interval between the second timestamp and the first timestamp carried by the calibration table setting instruction. The device serial number is then verified for legitimacy using the preset user management table. If the check passes, the calibration function is started.
[0051] Furthermore, the analog signal segmented calibration module is specifically used to:
[0052] The embedded device collects the original analog signal in real time through the sensor, locates the segmented interval of the original analog signal based on the analog signal calibration table, and matches the corresponding calibration method, calibration parameters, activation status and calibration priority based on the segmented interval;
[0053] The embedded device sorts the segmented intervals whose enabling state is enabled based on the calibration priority, and then performs segmented calibration on the original analog signal of each segmented interval in sequence based on the calibration method and calibration parameters;
[0054] The calibration log management module is specifically used to:
[0055] The embedded device records a calibration log including at least the calibration time, the original analog signal, and the calibration analog signal in real time, encrypts the calibration log into an encrypted log based on a preset storage period, stores the encrypted log in a designated path, and uploads the encrypted log to a server for backup via the TLS protocol;
[0056] The encryption process of the calibration log is as follows:
[0057] Create a pair of public keys and private keys based on the RSA algorithm, calculate the MD5 value of the calibration log using the MD5 algorithm, encrypt the calibration log and the MD5 value using the private key to obtain first encrypted data, encrypt the public key into a secret key using the AES256 algorithm, encrypt the first encrypted data and the secret key into second encrypted data using the ECDSA algorithm, and circularly shift each character of the second encrypted data right by 7 bits to obtain an encrypted log.
[0058] The advantages of the present invention are:
[0059] 1. Create an analog signal calibration table for storing segmented intervals, calibration methods, calibration parameters, enabled status, and calibration priority through an embedded device, set the first update rule for the enabled status and the second update rule for the calibration priority, and store the analog signal calibration table; then the embedded device obtains the input calibration table setting instruction, verifies the calibration table setting instruction, and updates the stored analog signal calibration table based on the calibration table setting instruction; then obtains the input calibration start instruction, verifies the calibration start instruction, and starts the calibration function; then the original analog signal is collected in real time through the sensor, and segmented calibration is performed on the original analog signal based on the analog signal calibration table, and the calibration log is recorded in real time and encrypted for storage; since the segmented interval is a continuous interval, a discontinuous interval, or an overlapping interval; the calibration method is linear Function fitting calibration, polynomial function fitting calibration or exponential function fitting calibration; the calibration parameters are function coefficients of linear function, polynomial function or exponential function; the enabled state value is enabled or not enabled; the calibration priority corresponds to the segmented interval one by one; before calibrating the analog signal, the segmented interval, calibration method and calibration parameters can be flexibly set through the calibration table setting instruction to match different calibration requirements. For example, different calibration methods can be set for different segmented intervals according to the difference in calibration accuracy requirements, and only the segmented intervals that must be calibrated are selected for calibration to avoid the inefficiency caused by calibrating all segmented intervals. Combined with the verification of the calibration table setting instruction and the calibration start instruction before calibration and the encrypted storage of the calibration log, the accuracy, efficiency, flexibility and security of the analog signal calibration are ultimately greatly improved.
[0060] 2. By setting the segmented intervals as continuous intervals, discontinuous intervals, or overlapping intervals, the smaller the span of each segmented interval, the higher the priority, which is suitable for patching scenarios. For example, if a deviation is found at an important point in the model signal, a segmented interval with a smaller span can be set based on this point to give this segmented interval a higher priority for calibration. Moreover, there is no need to consider whether this segmented interval overlaps with existing segmented intervals, thereby greatly improving the flexibility of analog signal calibration.
[0061] 3. By storing the analog signal calibration table in the form of a Struct structure in a specified memory block, it is not only convenient for subsequent maintenance and expansion, but also easy to read quickly, thereby improving calibration efficiency.
[0062] 4. By setting the calibration table setting instruction to carry the first ciphertext data, the second ciphertext data and the hash value, the integrity can be checked through the hash value later. The first ciphertext data is obtained through 4 encryption (3DES algorithm, mapping rule, character swap, RC6 algorithm), and the second ciphertext data is obtained through 4 encryption (AES algorithm, random string, SM4 algorithm, segmentation ratio), so as to prevent the segmentation interval, calibration method, calibration parameters, device serial number, user name and password and the first timestamp from being stolen and tampered with in plain text during transmission. The device serial number, user name and password and the first timestamp can be used for legitimacy and timeliness verification later, thereby greatly improving the security of the calibration table setting instruction transmission and avoiding updating the analog signal calibration table based on illegal instructions.
[0063] 5. By setting the calibration start command to carry the device serial number, second timestamp and MAC value, the integrity check can be performed by the MAC value, the timeliness check can be performed by the second timestamp, and the legitimacy check can be performed by the device serial number. This avoids starting the calibration function based on illegal instructions and further improves the security of analog signal calibration.
[0064] 6. Record the calibration log including at least the calibration time, original analog signal, and calibrated analog signal, store and back it up to facilitate traceability later.
[0065] 7. Create a pair of public and private keys based on the RSA algorithm, calculate the MD5 value of the calibration log using the MD5 algorithm, encrypt the calibration log and the MD5 value using the private key to obtain the first encrypted data, encrypt the public key into the key using the AES256 algorithm, encrypt the first encrypted data and the key into the second encrypted data using the ECDSA algorithm, and shift each character of the second encrypted data rightward by 7 bits to obtain the encrypted log. At least 6 security measures are taken (public and private keys, MD5 algorithm, AES256 algorithm, ECDSA algorithm, character shift direction, and number of character shifts). If the corresponding encryption algorithm or data transformation rule is not known, the encrypted log cannot be cracked, thereby greatly improving the security of the calibration log storage.
[0066] 8. Dynamically adjust the calibration priority by the span of the segmented interval (the smaller the span, the higher the priority), ensure that the analog signal in the high-precision interval is processed first, and improve the rationality of calibration resource allocation; automatically update the enabled status through the preset range to avoid invalid calibration operations and improve system operation efficiency.
[0067] 9. By supporting continuous / discontinuous / overlapping segmented intervals, it adapts to the needs of complex signal scenarios and breaks through the limitations of traditional single segmented intervals; by integrating linear function fitting calibration / polynomial function fitting calibration / exponential function fitting calibration, the optimal function can be selected according to the characteristics of the analog signal to enhance calibration adaptability.
[0068] 10. Encrypted logs are transmitted to the server for backup via TLS protocol, building a local-cloud dual disaster recovery system to further enhance security.
[0069] 11. By using the Struct structure to store the analog signal calibration table, the memory space utilization is optimized, the redundant data occupation is reduced, the limited memory resources of the embedded device are adapted, and the operating performance of the embedded device is effectively improved.
[0070] 12. Through the innovative combination of dynamic priority scheduling, multi-mode segmented calibration and multi-layer security protection, while ensuring the accuracy of analog signal calibration, the security and reliability of embedded devices in complex environments are significantly improved, and the modular design facilitates functional expansion. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0072] Figure 1 The present invention is a flow chart of a method for calibrating analog signal segments based on dynamic priority.
[0073] Figure 2 The present invention is a structural diagram of an analog signal segment calibration system based on dynamic priority. DETAILED DESCRIPTION
[0074] The technical solution in the embodiments of the present application has the following overall idea: the calibration operation is performed through an analog signal calibration table that stores segmented intervals, calibration methods, calibration parameters, enabled status and calibration priority; since the segmented intervals are continuous intervals, discontinuous intervals or overlapping intervals; the calibration method is linear function fitting calibration, polynomial function fitting calibration or exponential function fitting calibration; the calibration parameters are function coefficients of linear functions, polynomial functions or exponential functions; the enabled status is enabled or not enabled; the calibration priority corresponds one-to-one to the segmented intervals; before calibrating the analog signal, the segmented intervals, calibration methods and calibration parameters are flexibly set through the calibration table setting instructions, and the enabled status and calibration priority are updated synchronously to match different calibration requirements (accuracy, efficiency), combined with the verification of the calibration table setting instructions and the calibration start instructions before calibration and the encrypted storage of the calibration log, thereby improving the accuracy, efficiency, flexibility and security of the analog signal calibration.
[0075] Please refer to Figures 1 to 2 As shown, a preferred embodiment of the present invention is a method for calibrating analog signals by segment based on dynamic priority, comprising the following steps:
[0076] Step S1: The embedded device creates an analog signal calibration table for storing segmentation intervals, calibration methods, calibration parameters, activation status, and calibration priority, sets a first update rule for the activation status and a second update rule for the calibration priority, and stores the analog signal calibration table;
[0077] Step S2: the embedded device obtains an input calibration table setting instruction, verifies the input calibration table setting instruction, and updates the stored analog signal calibration table based on the calibration table setting instruction;
[0078] Step S3: the embedded device obtains an input calibration start instruction, verifies the input calibration start instruction, and then starts a calibration function;
[0079] Step S4: the embedded device collects the original analog signal in real time through the sensor, and performs segmented calibration on the original analog signal based on the analog signal calibration table;
[0080] Step S5: The embedded device records the calibration log in real time and stores the calibration log in encrypted form.
[0081] Through the innovative combination of dynamic priority scheduling, multi-mode segmented calibration, and multi-layer security protection, the accuracy of analog signal calibration is ensured while significantly improving the security and reliability of embedded devices in complex environments. The modular design also facilitates functional expansion.
[0082] The step S1 is specifically as follows:
[0083] The embedded device creates an analog signal calibration table for storing segmented intervals, calibration methods, calibration parameters, enabled states, and calibration priorities; the segmented intervals are segmented intervals of the analog signal, and the segmented intervals are continuous intervals, discontinuous intervals, or overlapping intervals; the calibration methods include at least linear function fitting calibration, polynomial function fitting calibration, and exponential function fitting calibration; the calibration parameters include at least function coefficients of linear functions, polynomial functions, and exponential functions; the enabled state is the enabled state of the segmented interval, and the value is enabled or disabled; and the calibration priorities correspond one-to-one to the segmented intervals;
[0084] By setting the segmented intervals as continuous intervals, discontinuous intervals, or overlapping intervals, the smaller the span of each segmented interval, the higher the priority, which is suitable for patching scenarios. For example, if a deviation is found at an important point in the model signal, a segmented interval with a smaller span can be set based on this point to give this segmented interval a higher priority for calibration. Moreover, there is no need to consider whether this segmented interval overlaps with existing segmented intervals, thereby greatly improving the flexibility of analog signal calibration.
[0085] By supporting continuous / discontinuous / overlapping segmented intervals, it adapts to the needs of complex signal scenarios and breaks through the limitations of traditional single segmented intervals. By integrating linear function fitting calibration / polynomial function fitting calibration / exponential function fitting calibration, the optimal function can be selected according to the characteristics of the analog signal to enhance calibration adaptability.
[0086] Dynamically adjust the calibration priority by the span of the segmented interval (the smaller the span, the higher the priority), ensuring that analog signals in the high-precision interval are processed first and improving the rationality of calibration resource allocation; automatically update the enabled status through the preset range to avoid invalid calibration operations and improve system operation efficiency.
[0087] A first update rule for the enabled state and a second update rule for the calibration priority are set; the first update rule is specifically: determining whether the span of the segmented interval is greater than a preset range, and if so, updating the corresponding enabled state to disabled; if not, updating the corresponding enabled state to enabled; the second update rule is specifically: sorting based on the span of each segmented interval, with smaller spans having higher priorities, and updating the calibration priority based on the sorting result;
[0088] The analog signal calibration table is stored in a specified memory block in the form of a Struct structure.
[0089] By storing the analog signal calibration table in the form of a Struct structure in a specified memory block, it is not only convenient for subsequent maintenance and expansion, but also easy to read quickly, thereby improving calibration efficiency.
[0090] By using the Struct structure to store the analog signal calibration table, the memory space utilization is optimized, the redundant data occupation is reduced, the limited memory resources of the embedded device are adapted, and the operating performance of the embedded device is effectively improved.
[0091] The step S2 is specifically as follows:
[0092] The embedded device obtains an input calibration table setting instruction including the first ciphertext data, the second ciphertext data and the hash value;
[0093] The first ciphertext data is obtained by encrypting the segmentation interval, calibration method and calibration parameters. The encryption rules are as follows: the segmentation interval, calibration method and calibration parameters are encrypted by the 3DES algorithm to obtain the first-level encrypted data, each character of the first-level encrypted data is mapped by the preset mapping rule to obtain the second-level encrypted data, the number 6 and the letter P are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped in the second-level encrypted data to obtain the third-level encrypted data, and the third-level encrypted data is encrypted into the first ciphertext data by the RC6 algorithm; the second ciphertext data is the device serial number , username, password, and first timestamp, wherein the encryption rule is as follows: encrypting the device serial number, username, password, and first timestamp using the AES algorithm to obtain a first layer of encrypted data, adding a random string of a specified length at a specified position of the first layer of encrypted data to obtain a second layer of encrypted data, encrypting the second layer of encrypted data into a third layer of encrypted data using the SM4 algorithm, segmenting the third layer of encrypted data according to a preset segmentation ratio and swapping the order to obtain second ciphertext data; the hash value is obtained by hashing the first ciphertext data and the second ciphertext data using the hash-256 algorithm;
[0094] By setting the calibration table setting instruction to carry the first ciphertext data, the second ciphertext data and the hash value, the integrity can be checked through the hash value later; the first ciphertext data is obtained through 4-fold encryption (3DES algorithm, mapping rule, character swap, RC6 algorithm), and the second ciphertext data is obtained through 4-fold encryption (AES algorithm, random string, SM4 algorithm, segmentation ratio), so as to prevent the segmentation interval, calibration method, calibration parameters, device serial number, user name and password and the first timestamp from being stolen and tampered with in plain text during transmission. The device serial number, user name and password and the first timestamp can be used for legitimacy and timeliness verification later, thereby greatly improving the security of the calibration table setting instruction transmission and avoiding updating the analog signal calibration table based on illegal instructions.
[0095] The embedded device parses the calibration table setting instruction input to obtain first ciphertext data, second ciphertext data and a hash value; after performing integrity verification on the first ciphertext data and the second ciphertext data using the hash value, the first ciphertext data is decrypted into three-level encrypted data using the RC6 algorithm, the number 6 and the letter P in the three-level encrypted data are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped to obtain second-level encrypted data, each character of the second-level encrypted data is mapped according to the mapping rule to obtain first-level encrypted data, and the first-level encrypted data is decrypted using the 3DES algorithm to obtain a segmented interval, a calibration method and calibration parameters; the second ciphertext data is divided according to the inverse of the division ratio and the order is swapped to obtain three-layer encrypted data, the three-layer encrypted data is decrypted into two-layer encrypted data using the SM4 algorithm, a random string is located in the second-layer encrypted data based on the specified position and the specified length and is removed to obtain first-layer encrypted data, and the first-layer encrypted data is decrypted using the AES algorithm to obtain a device serial number, a user name and password and a first timestamp;
[0096] After the integrity check is performed using the first timestamp, the legitimacy of the device serial number and username password is checked using the preset user management table. Then, the stored analog signal calibration table is updated based on the segmentation interval, calibration method, and calibration parameters carried by the calibration table setting instruction. The analog signal calibration table synchronously updates the enabled status and calibration priority based on the first update rule and the second update rule, and feeds back the updated result.
[0097] The step S3 is specifically as follows:
[0098] The embedded device obtains an input calibration start instruction carrying a device serial number, a second timestamp, and a MAC value, where the MAC value is obtained by performing an HMAC calculation on the device serial number and the second timestamp;
[0099] By setting the calibration startup command to carry the device serial number, second timestamp and MAC value, the integrity check can be performed through the MAC value, the timeliness check can be performed through the second timestamp, and the legitimacy check can be performed through the device serial number. This avoids starting the calibration function based on illegal commands and further improves the security of analog signal calibration.
[0100] The embedded device parses the received calibration start instruction to obtain the device serial number, the second timestamp and the MAC value. After performing an integrity check using the MAC value, a time validity check is performed using the time interval between the second timestamp and the first timestamp carried by the calibration table setting instruction. The device serial number is then verified for legitimacy using the preset user management table. If the check passes, the calibration function is started.
[0101] The step S4 is specifically as follows:
[0102] The embedded device collects the original analog signal in real time through the sensor, locates the segmented interval of the original analog signal based on the analog signal calibration table, and matches the corresponding calibration method, calibration parameters, activation status and calibration priority based on the segmented interval;
[0103] The embedded device sorts the segmented intervals whose enabling state is enabled based on the calibration priority, and then performs segmented calibration on the original analog signal of each segmented interval in sequence based on the calibration method and calibration parameters;
[0104] The step S5 is specifically as follows:
[0105] The embedded device records a calibration log including at least the calibration time, the original analog signal, and the calibration analog signal in real time, encrypts the calibration log into an encrypted log based on a preset storage period, stores the encrypted log in a designated path, and uploads the encrypted log to a server for backup via the TLS protocol;
[0106] By recording the calibration log including at least the calibration time, original analog signal, and calibrated analog signal and storing and backing it up, it is easy to trace the source later.
[0107] Encrypted logs are transmitted to the server for backup via TLS protocol, building a local-cloud dual disaster recovery system to further enhance security.
[0108] The encryption process of the calibration log is as follows:
[0109] Create a pair of public keys and private keys based on the RSA algorithm, calculate the MD5 value of the calibration log using the MD5 algorithm, encrypt the calibration log and the MD5 value using the private key to obtain first encrypted data, encrypt the public key into a secret key using the AES256 algorithm, encrypt the first encrypted data and the secret key into second encrypted data using the ECDSA algorithm, and circularly shift each character of the second encrypted data right by 7 bits to obtain an encrypted log.
[0110] By creating a pair of public and private keys based on the RSA algorithm, calculating the MD5 value of the calibration log using the MD5 algorithm, encrypting the calibration log and the MD5 value using the private key to obtain the first encrypted data, encrypting the public key into a secret key using the AES256 algorithm, encrypting the first encrypted data and the secret key into the second encrypted data using the ECDSA algorithm, and shifting each character of the second encrypted data rightward by 7 bits to obtain the encrypted log. At least 6 security measures are taken (public and private keys, MD5 algorithm, AES256 algorithm, ECDSA algorithm, character shift direction, and number of character shift bits). If the corresponding encryption algorithm or data transformation rule is not known, the encrypted log cannot be cracked, thereby greatly improving the security of the calibration log storage.
[0111] A preferred embodiment of the present invention's analog signal segment calibration system based on dynamic priority includes the following modules:
[0112] An analog signal calibration table creation module is configured to create an analog signal calibration table for storing segmentation intervals, calibration methods, calibration parameters, enablement status, and calibration priority for an embedded device, set a first update rule for the enablement status and a second update rule for the calibration priority, and store the analog signal calibration table;
[0113] An analog signal calibration table updating module is configured to enable an embedded device to obtain an input calibration table setting instruction, verify the input calibration table setting instruction, and then update a stored analog signal calibration table based on the calibration table setting instruction.
[0114] A calibration function starting module is used for the embedded device to obtain an input calibration starting instruction, verify the input calibration starting instruction, and then start the calibration function;
[0115] An analog signal segmented calibration module is used for an embedded device to collect an original analog signal in real time through a sensor, and perform segmented calibration on the original analog signal based on the analog signal calibration table;
[0116] The calibration log management module is used for recording the calibration log of the embedded device in real time and encrypting and storing the calibration log.
[0117] Through the innovative combination of dynamic priority scheduling, multi-mode segmented calibration, and multi-layer security protection, the accuracy of analog signal calibration is ensured while significantly improving the security and reliability of embedded devices in complex environments. The modular design also facilitates functional expansion.
[0118] The analog signal calibration table creation module is specifically used for:
[0119] The embedded device creates an analog signal calibration table for storing segmented intervals, calibration methods, calibration parameters, enabled states, and calibration priorities; the segmented intervals are segmented intervals of the analog signal, and the segmented intervals are continuous intervals, discontinuous intervals, or overlapping intervals; the calibration methods include at least linear function fitting calibration, polynomial function fitting calibration, and exponential function fitting calibration; the calibration parameters include at least function coefficients of linear functions, polynomial functions, and exponential functions; the enabled state is the enabled state of the segmented interval, and the value is enabled or disabled; and the calibration priorities correspond one-to-one to the segmented intervals;
[0120] By setting the segmented intervals as continuous intervals, discontinuous intervals, or overlapping intervals, the smaller the span of each segmented interval, the higher the priority, which is suitable for patching scenarios. For example, if a deviation is found at an important point in the model signal, a segmented interval with a smaller span can be set based on this point to give this segmented interval a higher priority for calibration. Moreover, there is no need to consider whether this segmented interval overlaps with existing segmented intervals, thereby greatly improving the flexibility of analog signal calibration.
[0121] By supporting continuous / discontinuous / overlapping segmented intervals, it adapts to the needs of complex signal scenarios and breaks through the limitations of traditional single segmented intervals. By integrating linear function fitting calibration / polynomial function fitting calibration / exponential function fitting calibration, the optimal function can be selected according to the characteristics of the analog signal to enhance calibration adaptability.
[0122] Dynamically adjust the calibration priority by the span of the segmented interval (the smaller the span, the higher the priority), ensuring that analog signals in the high-precision interval are processed first and improving the rationality of calibration resource allocation; automatically update the enabled status through the preset range to avoid invalid calibration operations and improve system operation efficiency.
[0123] A first update rule for the enabled state and a second update rule for the calibration priority are set; the first update rule is specifically: determining whether the span of the segmented interval is greater than a preset range, and if so, updating the corresponding enabled state to disabled; if not, updating the corresponding enabled state to enabled; the second update rule is specifically: sorting based on the span of each segmented interval, with smaller spans having higher priorities, and updating the calibration priority based on the sorting result;
[0124] The analog signal calibration table is stored in a specified memory block in the form of a Struct structure.
[0125] By storing the analog signal calibration table in the form of a Struct structure in a specified memory block, it is not only convenient for subsequent maintenance and expansion, but also easy to read quickly, thereby improving calibration efficiency.
[0126] By using the Struct structure to store the analog signal calibration table, the memory space utilization is optimized, the redundant data occupation is reduced, the limited memory resources of the embedded device are adapted, and the operating performance of the embedded device is effectively improved.
[0127] The analog signal calibration table updating module is specifically used for:
[0128] The embedded device obtains an input calibration table setting instruction including the first ciphertext data, the second ciphertext data and the hash value;
[0129] The first ciphertext data is obtained by encrypting the segmentation interval, calibration method and calibration parameters. The encryption rules are as follows: the segmentation interval, calibration method and calibration parameters are encrypted by the 3DES algorithm to obtain the first-level encrypted data, each character of the first-level encrypted data is mapped by the preset mapping rule to obtain the second-level encrypted data, the number 6 and the letter P are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped in the second-level encrypted data to obtain the third-level encrypted data, and the third-level encrypted data is encrypted into the first ciphertext data by the RC6 algorithm; the second ciphertext data is the device serial number , username, password, and first timestamp, wherein the encryption rule is as follows: encrypting the device serial number, username, password, and first timestamp using the AES algorithm to obtain a first layer of encrypted data, adding a random string of a specified length at a specified position of the first layer of encrypted data to obtain a second layer of encrypted data, encrypting the second layer of encrypted data into a third layer of encrypted data using the SM4 algorithm, segmenting the third layer of encrypted data according to a preset segmentation ratio and swapping the order to obtain second ciphertext data; the hash value is obtained by hashing the first ciphertext data and the second ciphertext data using the hash-256 algorithm;
[0130] By setting the calibration table setting instruction to carry the first ciphertext data, the second ciphertext data and the hash value, the integrity can be checked through the hash value later; the first ciphertext data is obtained through 4-fold encryption (3DES algorithm, mapping rule, character swap, RC6 algorithm), and the second ciphertext data is obtained through 4-fold encryption (AES algorithm, random string, SM4 algorithm, segmentation ratio), so as to prevent the segmentation interval, calibration method, calibration parameters, device serial number, user name and password and the first timestamp from being stolen and tampered with in plain text during transmission. The device serial number, user name and password and the first timestamp can be used for legitimacy and timeliness verification later, thereby greatly improving the security of the calibration table setting instruction transmission and avoiding updating the analog signal calibration table based on illegal instructions.
[0131] The embedded device parses the calibration table setting instruction input to obtain first ciphertext data, second ciphertext data and a hash value; after performing integrity verification on the first ciphertext data and the second ciphertext data using the hash value, the first ciphertext data is decrypted into three-level encrypted data using the RC6 algorithm, the number 6 and the letter P in the three-level encrypted data are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped to obtain second-level encrypted data, each character of the second-level encrypted data is mapped according to the mapping rule to obtain first-level encrypted data, and the first-level encrypted data is decrypted using the 3DES algorithm to obtain a segmented interval, a calibration method and calibration parameters; the second ciphertext data is divided according to the inverse of the division ratio and the order is swapped to obtain three-layer encrypted data, the three-layer encrypted data is decrypted into two-layer encrypted data using the SM4 algorithm, a random string is located in the second-layer encrypted data based on the specified position and the specified length and is removed to obtain first-layer encrypted data, and the first-layer encrypted data is decrypted using the AES algorithm to obtain a device serial number, a user name and password and a first timestamp;
[0132] After the integrity check is performed using the first timestamp, the legitimacy of the device serial number and username password is checked using the preset user management table. Then, the stored analog signal calibration table is updated based on the segmentation interval, calibration method, and calibration parameters carried by the calibration table setting instruction. The analog signal calibration table synchronously updates the enabled status and calibration priority based on the first update rule and the second update rule, and feeds back the updated result.
[0133] The calibration function starting module is specifically used for:
[0134] The embedded device obtains an input calibration start instruction carrying a device serial number, a second timestamp, and a MAC value, where the MAC value is obtained by performing an HMAC calculation on the device serial number and the second timestamp;
[0135] By setting the calibration startup command to carry the device serial number, second timestamp and MAC value, the integrity check can be performed through the MAC value, the timeliness check can be performed through the second timestamp, and the legitimacy check can be performed through the device serial number. This avoids starting the calibration function based on illegal commands and further improves the security of analog signal calibration.
[0136] The embedded device parses the received calibration start instruction to obtain the device serial number, the second timestamp and the MAC value. After performing an integrity check using the MAC value, a time validity check is performed using the time interval between the second timestamp and the first timestamp carried by the calibration table setting instruction. The device serial number is then verified for legitimacy using the preset user management table. If the check passes, the calibration function is started.
[0137] The analog signal segment calibration module is specifically used for:
[0138] The embedded device collects the original analog signal in real time through the sensor, locates the segmented interval of the original analog signal based on the analog signal calibration table, and matches the corresponding calibration method, calibration parameters, activation status and calibration priority based on the segmented interval;
[0139] The embedded device sorts the segmented intervals whose enabling state is enabled based on the calibration priority, and then performs segmented calibration on the original analog signal of each segmented interval in sequence based on the calibration method and calibration parameters;
[0140] The calibration log management module is specifically used to:
[0141] The embedded device records a calibration log including at least the calibration time, the original analog signal, and the calibration analog signal in real time, encrypts the calibration log into an encrypted log based on a preset storage period, stores the encrypted log in a designated path, and uploads the encrypted log to a server for backup via the TLS protocol;
[0142] By recording the calibration log including at least the calibration time, original analog signal, and calibrated analog signal and storing and backing it up, it is easy to trace the source later.
[0143] Encrypted logs are transmitted to the server for backup via TLS protocol, building a local-cloud dual disaster recovery system to further enhance security.
[0144] The encryption process of the calibration log is as follows:
[0145] Create a pair of public keys and private keys based on the RSA algorithm, calculate the MD5 value of the calibration log using the MD5 algorithm, encrypt the calibration log and the MD5 value using the private key to obtain first encrypted data, encrypt the public key into a secret key using the AES256 algorithm, encrypt the first encrypted data and the secret key into second encrypted data using the ECDSA algorithm, and circularly shift each character of the second encrypted data right by 7 bits to obtain an encrypted log.
[0146] By creating a pair of public and private keys based on the RSA algorithm, calculating the MD5 value of the calibration log using the MD5 algorithm, encrypting the calibration log and the MD5 value using the private key to obtain the first encrypted data, encrypting the public key into a secret key using the AES256 algorithm, encrypting the first encrypted data and the secret key into the second encrypted data using the ECDSA algorithm, and shifting each character of the second encrypted data rightward by 7 bits to obtain the encrypted log. At least 6 security measures are taken (public and private keys, MD5 algorithm, AES256 algorithm, ECDSA algorithm, character shift direction, and number of character shift bits). If the corresponding encryption algorithm or data transformation rule is not known, the encrypted log cannot be cracked, thereby greatly improving the security of the calibration log storage.
[0147] In summary, the advantages of the present invention are:
[0148] 1. Create an analog signal calibration table for storing segmented intervals, calibration methods, calibration parameters, enabled status, and calibration priority through an embedded device, set the first update rule for the enabled status and the second update rule for the calibration priority, and store the analog signal calibration table; then the embedded device obtains the input calibration table setting instruction, verifies the calibration table setting instruction, and updates the stored analog signal calibration table based on the calibration table setting instruction; then obtains the input calibration start instruction, verifies the calibration start instruction, and starts the calibration function; then the original analog signal is collected in real time through the sensor, and segmented calibration is performed on the original analog signal based on the analog signal calibration table, and the calibration log is recorded in real time and encrypted for storage; since the segmented interval is a continuous interval, a discontinuous interval, or an overlapping interval; the calibration method is linear Function fitting calibration, polynomial function fitting calibration or exponential function fitting calibration; the calibration parameters are function coefficients of linear function, polynomial function or exponential function; the enabled state value is enabled or not enabled; the calibration priority corresponds to the segmented interval one by one; before calibrating the analog signal, the segmented interval, calibration method and calibration parameters can be flexibly set through the calibration table setting instruction to match different calibration requirements. For example, different calibration methods can be set for different segmented intervals according to the difference in calibration accuracy requirements, and only the segmented intervals that must be calibrated are selected for calibration to avoid the inefficiency caused by calibrating all segmented intervals. Combined with the verification of the calibration table setting instruction and the calibration start instruction before calibration and the encrypted storage of the calibration log, the accuracy, efficiency, flexibility and security of the analog signal calibration are ultimately greatly improved.
[0149] 2. By setting the segmented intervals as continuous intervals, discontinuous intervals, or overlapping intervals, the smaller the span of each segmented interval, the higher the priority, which is suitable for patching scenarios. For example, if a deviation is found at an important point in the model signal, a segmented interval with a smaller span can be set based on this point to give this segmented interval a higher priority for calibration. Moreover, there is no need to consider whether this segmented interval overlaps with existing segmented intervals, thereby greatly improving the flexibility of analog signal calibration.
[0150] 3. By storing the analog signal calibration table in the form of a Struct structure in a specified memory block, it is not only convenient for subsequent maintenance and expansion, but also easy to read quickly, thereby improving calibration efficiency.
[0151] 4. By setting the calibration table setting instruction to carry the first ciphertext data, the second ciphertext data and the hash value, the integrity can be checked through the hash value later. The first ciphertext data is obtained through 4 encryption (3DES algorithm, mapping rule, character swap, RC6 algorithm), and the second ciphertext data is obtained through 4 encryption (AES algorithm, random string, SM4 algorithm, segmentation ratio), so as to prevent the segmentation interval, calibration method, calibration parameters, device serial number, user name and password and the first timestamp from being stolen and tampered with in plain text during transmission. The device serial number, user name and password and the first timestamp can be used for legitimacy and timeliness verification later, thereby greatly improving the security of the calibration table setting instruction transmission and avoiding updating the analog signal calibration table based on illegal instructions.
[0152] 5. By setting the calibration start command to carry the device serial number, second timestamp and MAC value, the integrity check can be performed by the MAC value, the timeliness check can be performed by the second timestamp, and the legitimacy check can be performed by the device serial number. This avoids starting the calibration function based on illegal instructions and further improves the security of analog signal calibration.
[0153] 6. Record the calibration log including at least the calibration time, original analog signal, and calibrated analog signal, store and back it up to facilitate traceability later.
[0154] 7. Create a pair of public and private keys based on the RSA algorithm, calculate the MD5 value of the calibration log using the MD5 algorithm, encrypt the calibration log and the MD5 value using the private key to obtain the first encrypted data, encrypt the public key into the key using the AES256 algorithm, encrypt the first encrypted data and the key into the second encrypted data using the ECDSA algorithm, and shift each character of the second encrypted data rightward by 7 bits to obtain the encrypted log. At least 6 security measures are taken (public and private keys, MD5 algorithm, AES256 algorithm, ECDSA algorithm, character shift direction, and number of character shifts). If the corresponding encryption algorithm or data transformation rule is not known, the encrypted log cannot be cracked, thereby greatly improving the security of the calibration log storage.
[0155] 8. Dynamically adjust the calibration priority by the span of the segmented interval (the smaller the span, the higher the priority), ensure that the analog signal in the high-precision interval is processed first, and improve the rationality of calibration resource allocation; automatically update the enabled status through the preset range to avoid invalid calibration operations and improve system operation efficiency.
[0156] 9. By supporting continuous / discontinuous / overlapping segmented intervals, it adapts to the needs of complex signal scenarios and breaks through the limitations of traditional single segmented intervals; by integrating linear function fitting calibration / polynomial function fitting calibration / exponential function fitting calibration, the optimal function can be selected according to the characteristics of the analog signal to enhance calibration adaptability.
[0157] 10. Encrypted logs are transmitted to the server for backup via TLS protocol, building a local-cloud dual disaster recovery system to further enhance security.
[0158] 11. By using the Struct structure to store the analog signal calibration table, the memory space utilization is optimized, the redundant data occupation is reduced, the limited memory resources of the embedded device are adapted, and the operating performance of the embedded device is effectively improved.
[0159] 12. Through the innovative combination of dynamic priority scheduling, multi-mode segmented calibration and multi-layer security protection, while ensuring the accuracy of analog signal calibration, the security and reliability of embedded devices in complex environments are significantly improved, and the modular design facilitates functional expansion.
[0160] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A segmented calibration method for analog signals based on dynamic priority, characterized in that: The steps include: Step S1: The embedded device creates an analog signal calibration table for storing segmentation intervals, calibration methods, calibration parameters, activation status, and calibration priority, sets a first update rule for the activation status and a second update rule for the calibration priority, and stores the analog signal calibration table; Step S2: the embedded device obtains an input calibration table setting instruction, verifies the input calibration table setting instruction, and updates the stored analog signal calibration table based on the calibration table setting instruction; Step S3: the embedded device obtains an input calibration start instruction, verifies the input calibration start instruction, and then starts a calibration function; Step S4: the embedded device collects the original analog signal in real time through the sensor, and performs segmented calibration on the original analog signal based on the analog signal calibration table; Step S5: The embedded device records the calibration log in real time and stores the calibration log in encrypted form.
2. The method for calibrating analog signals by segment based on dynamic priority according to claim 1, wherein: The step S1 is specifically as follows: The embedded device creates an analog signal calibration table for storing segmented intervals, calibration methods, calibration parameters, enabled states, and calibration priorities; the segmented intervals are segmented intervals of the analog signal, and the segmented intervals are continuous intervals, discontinuous intervals, or overlapping intervals; the calibration methods include at least linear function fitting calibration, polynomial function fitting calibration, and exponential function fitting calibration; the calibration parameters include at least function coefficients of linear functions, polynomial functions, and exponential functions; the enabled state is the enabled state of the segmented interval, and the value is enabled or disabled; and the calibration priorities correspond one-to-one to the segmented intervals; A first update rule for the enabled state and a second update rule for the calibration priority are set; the first update rule is specifically: determining whether the span of the segmented interval is greater than a preset range, and if so, updating the corresponding enabled state to disabled; if not, updating the corresponding enabled state to enabled; the second update rule is specifically: sorting based on the span of each segmented interval, with smaller spans having higher priorities, and updating the calibration priority based on the sorting result; The analog signal calibration table is stored in a specified memory block in the form of a Struct structure.
3. The method for calibrating analog signals by segment based on dynamic priority according to claim 1, wherein: The step S2 is specifically as follows: The embedded device obtains an input calibration table setting instruction including the first ciphertext data, the second ciphertext data and the hash value; The first ciphertext data is obtained by encrypting the segmentation interval, calibration method and calibration parameters. The encryption rules are as follows: the segmentation interval, calibration method and calibration parameters are encrypted by the 3DES algorithm to obtain the first-level encrypted data, each character of the first-level encrypted data is mapped by the preset mapping rule to obtain the second-level encrypted data, the number 6 and the letter P are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped in the second-level encrypted data to obtain the third-level encrypted data, and the third-level encrypted data is encrypted into the first ciphertext data by the RC6 algorithm; the second ciphertext data is the device serial number , username, password, and first timestamp, wherein the encryption rule is as follows: encrypting the device serial number, username, password, and first timestamp using the AES algorithm to obtain a first layer of encrypted data, adding a random string of a specified length at a specified position of the first layer of encrypted data to obtain a second layer of encrypted data, encrypting the second layer of encrypted data into a third layer of encrypted data using the SM4 algorithm, segmenting the third layer of encrypted data according to a preset segmentation ratio and swapping the order to obtain second ciphertext data; the hash value is obtained by hashing the first ciphertext data and the second ciphertext data using the hash-256 algorithm; The embedded device parses the input calibration table setting instruction to obtain first ciphertext data, second ciphertext data and a hash value; After performing integrity verification on the first ciphertext data and the second ciphertext data using the hash value, the first ciphertext data is decrypted into three-level encrypted data using the RC6 algorithm, the number 6 and the letter P are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B in the three-level encrypted data are swapped to obtain second-level encrypted data, each character of the second-level encrypted data is mapped according to the mapping rule to obtain first-level encrypted data, and the first-level encrypted data is decrypted using the 3DES algorithm to obtain a segmentation interval, a calibration method, and a calibration parameter; the second ciphertext data is divided according to the inverse of the division ratio and the order is swapped to obtain three-layer encrypted data, and the three-layer encrypted data is decrypted into two-layer encrypted data using the SM4 algorithm, and a random character string is located in the second-layer encrypted data based on the specified position and the specified length and removed to obtain first-layer encrypted data, and the first-layer encrypted data is decrypted using the AES algorithm to obtain the device serial number, the user name and password, and the first timestamp; After the integrity check is performed using the first timestamp, the legitimacy of the device serial number and username password is checked using the preset user management table. Then, the stored analog signal calibration table is updated based on the segmentation interval, calibration method, and calibration parameters carried by the calibration table setting instruction. The analog signal calibration table synchronously updates the enabled status and calibration priority based on the first update rule and the second update rule, and feeds back the updated result.
4. The method for calibrating analog signals by segment based on dynamic priority according to claim 1, wherein: The step S3 is specifically as follows: The embedded device obtains an input calibration start instruction carrying a device serial number, a second timestamp, and a MAC value, where the MAC value is obtained by performing an HMAC calculation on the device serial number and the second timestamp; The embedded device parses the received calibration start instruction to obtain the device serial number, the second timestamp and the MAC value. After performing an integrity check using the MAC value, a time validity check is performed using the time interval between the second timestamp and the first timestamp carried by the calibration table setting instruction. The device serial number is then verified for legitimacy using the preset user management table. If the check passes, the calibration function is started.
5. The method for calibrating analog signals by segment based on dynamic priority according to claim 1, wherein: The step S4 is specifically as follows: The embedded device collects the original analog signal in real time through the sensor, locates the segmented interval of the original analog signal based on the analog signal calibration table, and matches the corresponding calibration method, calibration parameters, activation status and calibration priority based on the segmented interval; The embedded device sorts the segmented intervals whose enabling state is enabled based on the calibration priority, and then performs segmented calibration on the original analog signal of each segmented interval in sequence based on the calibration method and calibration parameters; The step S5 is specifically as follows: The embedded device records a calibration log including at least the calibration time, the original analog signal, and the calibration analog signal in real time, encrypts the calibration log into an encrypted log based on a preset storage period, stores the encrypted log in a designated path, and uploads the encrypted log to a server for backup via the TLS protocol; The encryption process of the calibration log is as follows: Create a pair of public keys and private keys based on the RSA algorithm, calculate the MD5 value of the calibration log using the MD5 algorithm, encrypt the calibration log and the MD5 value using the private key to obtain first encrypted data, encrypt the public key into a secret key using the AES256 algorithm, encrypt the first encrypted data and the secret key into second encrypted data using the ECDSA algorithm, and circularly shift each character of the second encrypted data right by 7 bits to obtain an encrypted log.
6. A dynamic priority-based analog signal segment calibration system, characterized by: Includes the following modules: An analog signal calibration table creation module is configured to create an analog signal calibration table for storing segmentation intervals, calibration methods, calibration parameters, enablement status, and calibration priority for an embedded device, set a first update rule for the enablement status and a second update rule for the calibration priority, and store the analog signal calibration table; An analog signal calibration table updating module is configured to enable an embedded device to obtain an input calibration table setting instruction, verify the input calibration table setting instruction, and then update a stored analog signal calibration table based on the calibration table setting instruction. A calibration function starting module is used for the embedded device to obtain an input calibration starting instruction, verify the input calibration starting instruction, and then start the calibration function; An analog signal segmented calibration module is used for an embedded device to collect an original analog signal in real time through a sensor, and perform segmented calibration on the original analog signal based on the analog signal calibration table; The calibration log management module is used for recording the calibration log of the embedded device in real time and encrypting and storing the calibration log.
7. The dynamic priority-based analog signal segment calibration system according to claim 6, wherein: The analog signal calibration table creation module is specifically used for: The embedded device creates an analog signal calibration table for storing segmented intervals, calibration methods, calibration parameters, enabled states, and calibration priorities; the segmented intervals are segmented intervals of the analog signal, and the segmented intervals are continuous intervals, discontinuous intervals, or overlapping intervals; the calibration methods include at least linear function fitting calibration, polynomial function fitting calibration, and exponential function fitting calibration; the calibration parameters include at least function coefficients of linear functions, polynomial functions, and exponential functions; the enabled state is the enabled state of the segmented interval, and the value is enabled or disabled; and the calibration priorities correspond one-to-one to the segmented intervals; A first update rule for the enabled state and a second update rule for the calibration priority are set; the first update rule is specifically: determining whether the span of the segmented interval is greater than a preset range, and if so, updating the corresponding enabled state to disabled; if not, updating the corresponding enabled state to enabled; the second update rule is specifically: sorting based on the span of each segmented interval, with smaller spans having higher priorities, and updating the calibration priority based on the sorting result; The analog signal calibration table is stored in a specified memory block in the form of a Struct structure.
8. The dynamic priority-based analog signal segmented calibration system according to claim 6, wherein: The analog signal calibration table updating module is specifically used for: The embedded device obtains an input calibration table setting instruction including the first ciphertext data, the second ciphertext data and the hash value; The first ciphertext data is obtained by encrypting the segmentation interval, calibration method and calibration parameters. The encryption rules are as follows: the segmentation interval, calibration method and calibration parameters are encrypted by the 3DES algorithm to obtain the first-level encrypted data, each character of the first-level encrypted data is mapped by the preset mapping rule to obtain the second-level encrypted data, the number 6 and the letter P are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B are swapped in the second-level encrypted data to obtain the third-level encrypted data, and the third-level encrypted data is encrypted into the first ciphertext data by the RC6 algorithm; the second ciphertext data is the device serial number , username, password, and first timestamp, wherein the encryption rule is as follows: encrypting the device serial number, username, password, and first timestamp using the AES algorithm to obtain a first layer of encrypted data, adding a random string of a specified length at a specified position of the first layer of encrypted data to obtain a second layer of encrypted data, encrypting the second layer of encrypted data into a third layer of encrypted data using the SM4 algorithm, segmenting the third layer of encrypted data according to a preset segmentation ratio and swapping the order to obtain second ciphertext data; the hash value is obtained by hashing the first ciphertext data and the second ciphertext data using the hash-256 algorithm; The embedded device parses the input calibration table setting instruction to obtain first ciphertext data, second ciphertext data and a hash value; After performing integrity verification on the first ciphertext data and the second ciphertext data using the hash value, the first ciphertext data is decrypted into three-level encrypted data using the RC6 algorithm, the number 6 and the letter P are swapped, the number 7 and the letter T are swapped, and the number 8 and the letter B in the three-level encrypted data are swapped to obtain second-level encrypted data, each character of the second-level encrypted data is mapped according to the mapping rule to obtain first-level encrypted data, and the first-level encrypted data is decrypted using the 3DES algorithm to obtain a segmentation interval, a calibration method, and a calibration parameter; the second ciphertext data is divided according to the inverse of the division ratio and the order is swapped to obtain three-layer encrypted data, and the three-layer encrypted data is decrypted into two-layer encrypted data using the SM4 algorithm, and a random character string is located in the second-layer encrypted data based on the specified position and the specified length and removed to obtain first-layer encrypted data, and the first-layer encrypted data is decrypted using the AES algorithm to obtain the device serial number, the user name and password, and the first timestamp; After the integrity check is performed using the first timestamp, the legitimacy of the device serial number and username password is checked using the preset user management table. Then, the stored analog signal calibration table is updated based on the segmentation interval, calibration method, and calibration parameters carried by the calibration table setting instruction. The analog signal calibration table synchronously updates the enabled status and calibration priority based on the first update rule and the second update rule, and feeds back the updated result.
9. The dynamic priority-based analog signal segment calibration system according to claim 6, wherein: The calibration function starting module is specifically used for: The embedded device obtains an input calibration start instruction carrying a device serial number, a second timestamp, and a MAC value, where the MAC value is obtained by performing an HMAC calculation on the device serial number and the second timestamp; The embedded device parses the received calibration start instruction to obtain the device serial number, the second timestamp and the MAC value. After performing an integrity check using the MAC value, a time validity check is performed using the time interval between the second timestamp and the first timestamp carried by the calibration table setting instruction. The device serial number is then verified for legitimacy using the preset user management table. If the check passes, the calibration function is started.
10. The dynamic priority-based analog signal segment calibration system according to claim 6, characterized in that: The analog signal segment calibration module is specifically used for: The embedded device collects the original analog signal in real time through the sensor, locates the segmented interval of the original analog signal based on the analog signal calibration table, and matches the corresponding calibration method, calibration parameters, activation status and calibration priority based on the segmented interval; The embedded device sorts the segmented intervals whose enabling state is enabled based on the calibration priority, and then performs segmented calibration on the original analog signal of each segmented interval in sequence based on the calibration method and calibration parameters; The calibration log management module is specifically used to: The embedded device records a calibration log including at least the calibration time, the original analog signal, and the calibration analog signal in real time, encrypts the calibration log into an encrypted log based on a preset storage period, stores the encrypted log in a designated path, and uploads the encrypted log to a server for backup via the TLS protocol; The encryption process of the calibration log is as follows: Create a pair of public keys and private keys based on the RSA algorithm, calculate the MD5 value of the calibration log using the MD5 algorithm, encrypt the calibration log and the MD5 value using the private key to obtain first encrypted data, encrypt the public key into a secret key using the AES256 algorithm, encrypt the first encrypted data and the secret key into second encrypted data using the ECDSA algorithm, and circularly shift each character of the second encrypted data right by 7 bits to obtain an encrypted log.