An offline livestock product quality traceability method and system

CN122802890APending Publication Date: 2026-09-22RES & DEV INST OF NORTHWESTERN POLYTECHNICAL UNIV IN SHENZHEN +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611266840.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-20
Publication Date
2026-09-22

AI Technical Summary

Technical Problem

[0003]现有的溯源技术,在实际应用中面临着成本、信任与防伪的三重悖论,具体表现在以下几方面:(1)“云端存储”架构的信任逻辑缺陷:现有溯源系统普遍采用“终端采集-网络上传-服务器存储”的物联网架构

Benefits of technology

[0019]本发明的实施例所提供的离线式牲畜品质量溯源方法,通过在监测终端生成非对称密钥,能够利用不可导出的设备私钥SK在监测终端本地对数据块哈希值进行数字签名,并利用设备公钥PK在查验终端执行离线验签;通过对监测终端配置设备数据标识,配置溯源数据写入规则,使得监控终端可以在本地进行数据采集、存储与校验,而无需依赖中心化服务器,能够有效降低云端数据易被篡改的风险。并且,监控终端在本地进行溯源数据的存储与校验,并可以完成对原始数据的去噪、分级计算,仅在与查验终端通信时才将溯源数据上传至查验终端,不需要实时在线通讯,从而可以有效的降低监测终端的成本;同时,结合在监控终端设置防拆检测回路,从而实现从物理防拆与数字签名技术确保数据的原生性与不可篡改性。并且,通过初始时对监测终端配置物种类型、日龄模型、光照阈值、养殖区域、出生/入栏日期,以及设备身份标识、采样周期、分析窗口的多个信息用于对溯源数据的计算,从而可以实现从多个维度记录溯源数据,并保证数据的真实性和准确性。能够有效的实现成本极低、数据记录过程无需服务器介入,且数据一旦生成即在本地芯片内加密锁死的牲畜品质量化溯源方法。监测终端利用环境微能量维持终端全生命周期工作,不需要实时上传数据,可以有效降低终端设备的成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122802890A_ABST
    Figure CN122802890A_ABST
Patent Text Reader

Abstract

This invention specifically relates to an offline livestock quality traceability method and system. The system includes: a monitoring terminal, worn on the monitored object, for periodically collecting and storing traceability data; and an verification terminal, for acquiring the traceability data of the monitored object from the monitoring terminal via short-range wireless communication and performing offline validity verification on the traceability data locally on the terminal. The system and method of this invention can utilize environmental micro-energy to achieve self-powered operation throughout the entire life cycle, enabling offline monitoring and traceability for livestock activity quantification rating and origin authenticity verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of smart agriculture technology, specifically to an offline livestock quality traceability method and system. Background Technology

[0002] In related technologies, the issue of traceability for agricultural and livestock products is receiving increasing attention as the market size of high-end agricultural products (such as geographical indication protected products and free-range poultry) expands.

[0003] Existing traceability technologies face a triple paradox of cost, trust, and anti-counterfeiting in practical applications, specifically manifested in the following aspects: (1) The trust logic defect of the "cloud storage" architecture: Existing traceability systems generally adopt the Internet of Things architecture of "terminal collection-network upload-server storage". This architecture relies heavily on centralized servers, and the ownership and management rights of the data are held by technical service providers or breeding enterprises. The server's backend database is at risk of being tampered with. (2) Hardware reusability leads to "misapplication": Existing electronic ear tags or ankle bracelets focus on durability and lack a mandatory constraint mechanism for single use. (3) High cost and low efficiency of real-time online: In order to maintain real-time data upload, traditional equipment must integrate high-power cellular communication modules and pay continuous traffic fees, which directly increases hardware costs. In addition, it not only requires large-capacity batteries, but also faces the problem of poor signal coverage in remote pastures. (4) The contradiction between energy supply and full life cycle monitoring: Traditional battery-powered equipment is difficult to support continuous monitoring for several years (such as cattle and sheep). Replacing batteries or equipment midway will lead to the break of the data chain. In addition, there is the problem of inaccurate original traceability data.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] This invention provides an offline livestock quality traceability method and system, which can effectively overcome the defects existing in the prior art.

[0006] Other features and advantages of the invention will become apparent from the following detailed description, or may be learned in part by practice of the invention.

[0007] According to a first aspect of the present invention, an offline livestock product quality traceability method is provided for an offline livestock product quality traceability system, the system comprising: a service terminal for initializing a monitoring terminal; a monitoring terminal worn on a monitored object for self-powering throughout its entire life cycle using ambient micro-energy, and periodically collecting and storing traceability data of the monitored object; and an verification terminal for obtaining traceability data of the monitored object from the monitoring terminal via short-range wireless communication, and performing offline validity verification of the traceability data locally on the terminal. The method includes: Establish a communication connection between the monitoring terminal and the service terminal, and initialize the monitoring terminal; the monitoring terminal generates an asymmetric key using a true random number generator through the microcontroller unit; the asymmetric key includes: public key PK and private key SK; the private key SK is written to the secure storage area and is physically protected by a circuit breaker; the public key PK is written to the public read area; The service terminal configures the monitoring terminal with the species type, age model, light threshold, breeding area, birth / entry date of the monitored object, as well as the device identification, sampling cycle, and analysis window; among which, the age model includes the expected daily activity data corresponding to different age stages; The service terminal configures the monitoring terminal with device data identifiers and traceability data writing rules; wherein, the traceability data writing rules include: adding device data identifiers to data blocks of each collection cycle and writing them to the public read area; and activating the anti-tamper detection circuit; The monitoring terminal acquires the source data corresponding to the current data collection period and organizes the data to generate a data block. The source data includes: timestamp, step count result, and location information. The terminal also calculates the hash value corresponding to the data block, signs the hash value using the private key SK, and generates a signature value. The data block and signature value are then written to local storage.

[0008] In some exemplary embodiments, the monitoring terminal acquires the traceability data corresponding to the current data collection cycle, including: The current voltage Vcap of the hybrid energy storage unit in the monitoring terminal is acquired according to a preset voltage reading cycle, and the current voltage is compared with a preset energy threshold to configure the terminal working mode based on the comparison result; the terminal working modes include: keep-alive mode, low power mode, and full monitoring mode. When the terminal is in keep-alive mode, it maintains the passive reading functions of clock, tamper detection, most recent checkpoint, and near-field communication; and pauses sensor data acquisition. When the terminal is in low power mode or full monitoring mode, the sensor is woken up at a preset period to obtain the original sensor signal for the purpose of acquiring traceability data. The original sensor signal in low power mode includes the original sensor signal of the triaxial accelerometer. The original sensor signal in full monitoring mode includes the original sensor signals of the triaxial accelerometer and the positioning sensor. The raw sensor signal from the triaxial accelerometer is filtered, and an adaptive gait threshold is calculated based on the filtered signal to screen candidate gaits. Abnormal noise is screened based on the changes in the signal waveform corresponding to the candidate gaits to obtain the step counting results corresponding to the analysis window. The step counting results of the analysis window include: the number of valid steps and the number of abnormal steps. The open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell in the monitoring terminal are obtained based on the preset environmental monitoring cycle, and the environmental status is configured according to the comparison results with the preset threshold. The environmental status includes: outdoor status, indoor status, nighttime status or insufficient evidence status. The corresponding motion integral is calculated by combining the step count results with the weighting coefficients corresponding to the environmental conditions during the corresponding time period.

[0009] In some exemplary embodiments, the current voltage Vcap of the hybrid energy storage unit in the monitoring terminal is acquired according to a preset voltage reading cycle, and the current voltage is compared with a preset energy threshold for configuring the terminal's operating mode based on the comparison result, including: When the current voltage is determined to be less than or equal to the first energy threshold, configure the terminal operating mode to keep-alive mode; or, When the current voltage is determined to be between a first energy threshold and a second energy threshold, the terminal operating mode is configured to low-power mode; wherein the second threshold is greater than the first threshold; or, When the current voltage is determined to be greater than or equal to the second energy threshold, the terminal is configured to operate in full monitoring mode; wherein, the sensor data acquisition frequency in full monitoring mode is greater than the sensor data acquisition frequency in low power mode.

[0010] In some exemplary embodiments, the raw sensor signal from the triaxial accelerometer is filtered, and an adaptive gait threshold is calculated based on the filtered signal to screen candidate gaits; abnormal noise is screened based on the signal waveform changes corresponding to the candidate gaits to obtain the step counting results corresponding to the analysis window, including: Within the analysis window, the gravity baseline is estimated for the acceleration in the three directions output by the triaxial accelerometer; the corresponding dynamic components are determined based on the acceleration in the three directions and the gravity baseline; and the triaxial composite acceleration is calculated by combining the dynamic components in each direction. The triaxial composite acceleration is bandpass filtered based on a preset frequency threshold to obtain the filtered gait bandpass signal; the high-frequency residual signal is calculated based on the gait bandpass signal and the dynamic components before filtering. Determine the motion amplitude corresponding to the gait bandpass signal; perform a recursive averaging operation on the motion amplitude to obtain the corresponding background amplitude, and determine the average deviation of the motion amplitude relative to the background amplitude; configure the current adaptive gait entry threshold based on the background amplitude and the average deviation; and determine the current adaptive gait exit threshold based on the preset relationship between the gait entry threshold and the exit threshold; wherein the gait entry threshold is greater than the gait exit threshold. When the amplitude of movement changes from less than the gait entry threshold to greater than or equal to the gait entry threshold, a candidate gait event is established; when the amplitude of movement changes to less than or equal to the gait exit threshold, or when the peak duration is greater than the preset peak duration, the candidate gait event is configured to end; wherein, the start time, end time, maximum amplitude, and amplitude accumulation value during the peak duration of the candidate gait event are configured according to the change process of the amplitude of movement. Candidate gait events are judged based on preset candidate step count judgment conditions, and the candidate step count is determined when the preset candidate step count judgment conditions are met; or, when the candidate gait event does not meet the preset candidate step count judgment conditions, an abnormal step count or an abnormal impact step count is configured according to the candidate gait event; wherein, the preset candidate step count judgment conditions include: the cumulative area of ​​the wave crests is greater than or equal to the preset minimum area; the time interval between the current candidate gait event and the adjacent previous candidate gait event meets the preset time threshold; the candidate gait event is not marked as invalid posture, and the anti-tamper flag information based on the anti-tamper detection loop is 0; At the end of the analysis window, the candidate steps within the analysis window are evaluated based on preset valid step count identification conditions to eliminate mechanical shaking and transportation vibrations, and the step count result is determined as a valid step count or an abnormal step count. The valid step count identification conditions include: the degree of variation of adjacent candidate gait intervals, the three-axis dynamic energy discrimination condition, the single-axis energy ratio discrimination condition, the high-frequency energy ratio discrimination condition, and the gravity vector change at the beginning and end of the window discrimination condition. The high-frequency energy ratio is determined based on the high-frequency residual signal and the gait bandpass signal.

[0011] In some exemplary embodiments, the open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell in the monitoring terminal are acquired based on a preset environmental monitoring cycle, and the environmental status is configured according to the comparison result with a preset threshold, including: Based on a preset environmental monitoring cycle, the output voltage Vsolar of the micro-energy harvesting and sensing multiplexing unit in the monitoring terminal, or the open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell are obtained. During the daytime, if the output voltage is determined to be greater than or equal to the outdoor entry threshold twice consecutively, the environmental state for the corresponding time period is configured as outdoor state; or, if the output voltage is determined to be less than or equal to the outdoor exit threshold twice consecutively, the environmental state for the corresponding time period is configured as indoor state. During nighttime hours, or when the output voltage is determined to be less than the dark environment threshold, the environmental state for the corresponding time period is configured as nighttime state or insufficient evidence state. When the analysis window contains valid steps, configure the corresponding environment state of the analysis window according to the identification result of the environment state, and configure the environment state of the step count result.

[0012] In some exemplary embodiments, the corresponding motion integral is calculated by combining the step count results with the weighting coefficients corresponding to the environmental state during the corresponding time period, including: Configure the environmental status corresponding to each analysis window based on the environmental status identification results; Based on the environmental state corresponding to the step count results within the analysis window, calculate the motion integral, including: Sq = Nout × Kout + Nin × Kin + Nunk × Kunk Wherein, Kout, Kin, and Kunk are the weights for outdoor, indoor, and night / unknown states, respectively; Nout is the number of valid steps outdoors, Nin is the number of valid steps indoors, and Nunk is the number of valid steps in either the night / unknown state.

[0013] In some exemplary embodiments, the method further includes: The effective sampling task count for the statistical data collection period is calculated, and the corresponding effective sampling coverage rate C is calculated in conjunction with the theoretical sampling task count; the expected daily exercise volume E(d) is read from the growth model based on the type of monitored object and its current age; the expected exercise volume is determined by combining the effective sampling coverage rate and the expected daily exercise volume; and the original aquaculture process index I is configured by combining the expected exercise volume and the exercise integral, including: I = 100 × Sq_total / ΣEadj(d) in, Eadj(d) Indicates the expected amount of exercise; Sq_total This represents the motion integral counted during the data acquisition period; When the monitoring terminal is currently executing a full monitoring mode and within a preset positioning cycle, the positioning sensor is activated to acquire a location snapshot. The location snapshot includes: location information, positioning accuracy, and positioning time. If the current location snapshot meets the preset accuracy requirements, it is configured as a valid location snapshot. The location information is compared with a preset aquaculture area. If the current location is identified as being within the preset aquaculture area, a snapshot within the enclosure is configured. Based on the snapshot within the enclosure and the valid location snapshot, the origin consistency rate is configured. Based on the number of abnormal steps and candidate steps, the proportion of abnormal gait is determined; combining the effective sampling coverage, the proportion of abnormal gait, and the consistency rate of origin, a data confidence level is configured; based on the data confidence level, the original aquaculture process index I is flexibly adjusted to obtain the final index Ieff, which includes: Ieff = I × (0.8 + 0.2 × Conf) The quantitative grade code for the aquaculture process is generated by combining the final index Ieff, data confidence Conf, tamper mark Tamper, and effective sampling coverage C.

[0014] In some exemplary embodiments, the method further includes: In response to the wireless link established between the monitoring terminal and the inspection terminal, the monitoring terminal extracts the periodic motion integral increment ΔSqn from each data block, and sums up the periodic motion integral increments to obtain the cumulative motion integral Sqtotal of the monitored object's lifecycle. The cumulative motion score over the life cycle (Sqtotal) is compared with a preset level threshold to determine the corresponding level result. Calculate the cumulative number of steps based on the step count results in each data block; Calculate the outdoor duration based on the timestamp corresponding to the outdoor status; Based on the grade results, cumulative steps, location information, outdoor time, and preset data labels, traceability data is constructed. The monitoring terminal transmits the traceability data to the inspection terminal.

[0015] In some exemplary embodiments, the method further includes: When the service terminal completes the initialization of the monitoring terminal, it triggers the monitoring terminal's automatic data entry task. This task is used by the service terminal to generate device writing information based on the current monitoring terminal's device information, device data identifier, and current query count. The service terminal generates summary data for the first writing information, encapsulates it into transaction data, and writes it to the blockchain. as well as, In response to the acquired traceability data, the verification terminal triggers an automatic query task from the monitoring terminal, obtains the current number of queries corresponding to the monitoring terminal from the blockchain, and writes the current query task into the device write information and encapsulates the transaction data, which is then written into the blockchain for the verification terminal to verify the validity of the traceability data based on the existing number of queries.

[0016] According to a second aspect of the present invention, an offline livestock quality traceability system is provided, comprising: The service terminal is used to initialize the monitoring terminal. The monitoring terminal, worn on the monitored object, is used to achieve self-powered operation throughout its entire life cycle by utilizing micro-energy from the environment, and to periodically collect and store traceability data of the monitored object. The verification terminal is used to obtain traceability data of the monitored object from the monitoring terminal through short-range wireless communication, and to perform offline validity verification on the traceability data locally on the terminal. The monitoring terminal includes: A hybrid energy storage unit is used to provide power to the monitoring terminal, including a micro supercapacitor and a wide-temperature lithium-ion battery, wherein the micro supercapacitor and the wide-temperature lithium-ion battery are respectively connected to the power supply bus via a power management branch; The sensor, connected to the microcontroller unit, is used to collect motion information of the monitored object according to a preset sampling period, and to collect position information when the energy conditions and positioning period are met; the sensor includes a triaxial accelerometer and a positioning sensor. The micro-energy harvesting and sensing multiplexing unit is used to collect solar energy to power and charge the hybrid energy storage unit, provide power to the monitoring terminal, and generate ambient light intensity information. The micro-energy harvesting and sensing multiplexing unit includes: a flexible thin-film solar cell and a power management chip. The power management chip is connected to the output terminal of the flexible thin-film solar cell, the analog-to-digital conversion pin of the microcontroller unit, and the hybrid energy storage unit, respectively, and is used to provide the microcontroller unit with the open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell to determine the ambient light intensity information. The wireless communication unit, connected to the microcontroller unit, is used for short-range wireless communication with the inspection terminal. The tamper detection circuit is connected to the microcontroller unit and is used to trigger an interrupt when a physical disconnection occurs. The microcontroller unit is used to collect ambient light intensity information at preset intervals, generate traceability data based on the motion and location information of the monitored object, and encrypt the traceability data. The storage unit, connected to the microcontroller unit, is used to store traceability data.

[0017] According to a third aspect of the present invention, a computer program product is provided, on which a computer program is stored, and when the computer program is executed by a processor, the above-described offline livestock product quality traceability method is implemented.

[0018] According to a fourth aspect of the present invention, a storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described offline livestock quality traceability method.

[0019] The offline livestock quality traceability method provided by the embodiments of the present invention generates an asymmetric key at the monitoring terminal. This key, using a non-exportable device private key SK, digitally signs the hash value of a data block locally at the monitoring terminal, and performs offline signature verification at the verification terminal using the device public key PK. By configuring device data identifiers and traceability data writing rules on the monitoring terminal, the monitoring terminal can collect, store, and verify data locally without relying on a centralized server, effectively reducing the risk of cloud data being easily tampered with. Furthermore, the monitoring terminal stores and verifies traceability data locally and can perform noise reduction and hierarchical calculations on the original data. Traceability data is only uploaded to the verification terminal during communication, eliminating the need for real-time online communication and effectively reducing the cost of the monitoring terminal. Simultaneously, by setting up an anti-tamper detection loop at the monitoring terminal, the originality and immutability of the data are ensured through physical anti-tampering and digital signature technology. Furthermore, by initially configuring the monitoring terminal with multiple pieces of information, including species type, age model, light threshold, breeding area, birth / entry date, device identification, sampling cycle, and analysis window, the traceability data can be calculated. This allows for the recording of traceability data from multiple dimensions, ensuring the authenticity and accuracy of the data. It effectively achieves a livestock quality quantification traceability method that is extremely low-cost, requires no server intervention in the data recording process, and encrypts and locks the data locally on the chip once generated. The monitoring terminal utilizes environmental micro-energy to maintain its operation throughout its entire lifecycle, eliminating the need for real-time data uploads and effectively reducing the cost of the terminal equipment.

[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0022] Figure 1 The diagram illustrates an offline livestock product quality traceability method according to an exemplary embodiment of the present invention. Figure 2 This schematic diagram illustrates an offline livestock quality traceability system according to an exemplary embodiment of the present invention. Figure 3 This diagram schematically illustrates the configuration of a monitoring terminal according to an exemplary embodiment of the present invention. Figure 4This schematic diagram illustrates the structure of a monitoring terminal device according to an exemplary embodiment of the present invention. Figure 5 An exploded view schematically illustrating the structure of a monitoring terminal device according to an exemplary embodiment of the present invention; Figure 6 This schematic diagram illustrates a partially enlarged view of a one-way locking member in an exemplary embodiment of the present invention; Figure 7 This diagram illustrates the working principle of an anti-tamper monitoring circuit in an exemplary embodiment of the present invention. Figure 8 This diagram illustrates the working principle of a monitoring terminal in an exemplary embodiment of the present invention. Figure 9 This diagram illustrates the working principle of a data chain-based solidification and offline verification in an exemplary embodiment of the present invention. Detailed Implementation

[0023] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that the invention will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0024] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0025] In related technologies, existing livestock traceability technologies face a triple paradox of cost, trust, and anti-counterfeiting in practical applications, specifically manifested in: (1) The trust logic defect of the "cloud storage" architecture: Existing traceability systems generally adopt the Internet of Things architecture of "terminal collection - network upload - server storage". This architecture relies heavily on centralized servers, and the ownership and management rights of the data are in the hands of technology service providers or breeding enterprises. Driven by interests, the server backend database is at risk of being artificially modified by administrators (such as tampering with step counts or forging origin coordinates). As long as the data leaves the terminal hardware, its authenticity cannot be guaranteed by mathematical consistency, causing "traceability data" to become "marketing copy" and difficult to prove its innocence. (2) The reusability of hardware leads to "mislabeling": Existing electronic ear tags or leg bands focus on durability and lack a mandatory constraint mechanism for one-time use. Unscrupulous merchants can remove terminal devices that record high-quality data (such as high step counts and excellent origins) from livestock that have already been sold and wear them on ordinary livestock for "counterfeit" sales. The lack of physical anti-tampering and self-destruction mechanisms and non-reusable logic at the data level makes it impossible to establish a unique and strong binding relationship between the hardware carrier and the biological individual it identifies. (3) High cost and low efficiency of real-time online: In order to maintain real-time data upload, traditional devices must integrate high-power cellular communication modules and pay continuous traffic fees, which directly increases hardware costs. In addition, they not only require large-capacity batteries, but also face the problem of poor signal coverage in remote pastures. In fact, for quality traceability scenarios, consumers and regulators are concerned about the "authenticity of historical totals" (how many steps this chicken has taken in its lifetime and in which area it grew up), rather than the "instantaneous status" (where it is at this moment). The existing excessive online design has caused a huge waste of computing power and energy, and cannot meet the needs of large-scale low-cost deployment. (4) The contradiction between energy supply and full life cycle monitoring: Traditional battery-powered equipment is difficult to support continuous monitoring for several years (such as cattle and sheep). Replacing batteries or equipment in the middle will lead to the break of the data chain.

[0026] To address the shortcomings and deficiencies of existing technologies, this example embodiment provides an offline livestock quality traceability method and system. This system achieves extremely low cost, requires no server intervention, utilizes environmental energy for lifelong operation, and encrypts and locks data within a local chip once it is generated, thereby enabling efficient and accurate traceability of livestock quality.

[0027] The following will describe in more detail the offline livestock product quality traceability system and the offline livestock product quality traceability method in this exemplary embodiment, with reference to the accompanying drawings and embodiments.

[0028] This example implementation provides an offline livestock quality traceability system. (Reference) Figure 2As shown, the system includes: a service terminal for initializing the monitoring terminal 100; the monitoring terminal 100, worn on the monitored object, for utilizing environmental micro-energy to achieve self-powered operation throughout its entire lifecycle, and for periodically collecting and storing traceability data of the monitored object; and an verification terminal 200 for obtaining traceability data of the monitored object from the monitoring terminal 100 via short-range wireless communication, and performing offline validity verification on the traceability data locally on the terminal.

[0029] For example, refer to Figure 3 As shown, the monitoring terminal 100 includes: The hybrid energy storage unit 101 is used to provide power to the monitoring terminal, including a micro supercapacitor and a wide-temperature lithium-ion battery; wherein the micro supercapacitor and the wide-temperature lithium-ion battery are respectively connected to the power supply bus of the monitoring terminal through the power management branch; The sensor, connected to the microcontroller unit, is used to collect motion information of the monitored object according to a preset sampling period, and to collect position information when the energy conditions and positioning period are met; the sensor includes a triaxial accelerometer 102 and a positioning sensor 103. The micro-energy harvesting and sensing multiplexing unit is used to collect solar energy to power and charge the hybrid energy storage unit, provide power to the monitoring terminal, and generate ambient light intensity information. The micro-energy harvesting and sensing multiplexing unit includes: a flexible thin-film solar cell 104 and a power management chip 105. The power management chip is connected to the output terminal of the flexible thin-film solar cell, the analog-to-digital conversion pin of the microcontroller unit, and the hybrid energy storage unit, and is used to provide the microcontroller unit with the open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell to determine the ambient light intensity information. The wireless communication unit 106 is connected to the microcontroller unit and is used to communicate with the inspection terminal; The tamper detection circuit 107 is connected to the microcontroller unit and is used to trigger an interrupt when a physical disconnection occurs. The microcontroller unit 108 is used to collect ambient light intensity information at a preset cycle, monitor the motion information and position information of the object, generate traceability data, and encrypt the traceability data. Storage unit 109, connected to the microcontroller unit, is used to store traceability data.

[0030] Specifically, when the monitoring terminal collects solar energy, the micro-energy harvesting and sensing multiplexing unit uses a flexible thin-film solar cell 104 to collect solar energy and supply power to the hybrid energy storage unit 101, while simultaneously outputting voltage and / or current signals related to ambient light. The flexible thin-film solar cell 104 can be attached to the outer surface of the monitoring terminal's housing, or to the outer surface of an ear tag, leg band, or neck band to accommodate the bending stress of animal limbs. In other embodiments, the micro-energy harvesting and sensing multiplexing unit can also be supplemented with piezoelectric energy harvesting elements or thermoelectric energy harvesting elements, but the supplementary energy harvesting elements do not replace the ambient light sensing function of the flexible thin-film solar cell 104. The storage unit can be configured to store digitally signed data blocks based on a one-time write or logic locking strategy. The microcontroller unit is configured to execute an offline livestock quality traceability method, performing motion artifact filtering, environmental weighting algorithms, and digital signature operations on the raw sensor data. The wireless communication unit can be a Bluetooth communication module and / or an NFC communication module. The wireless communication unit chip has dual interfaces: one end communicates with the MCU via an I2C bus, and the other end communicates with an external mobile phone via an RF antenna. Data exchange adopts a passive mode, and the reading is triggered by the power field of the mobile phone, without consuming the energy storage power of the monitoring terminal.

[0031] The hybrid energy storage unit 101 employs a hybrid energy storage architecture consisting of a micro supercapacitor (e.g., 0.5F) and a wide-temperature lithium-ion battery. The micro supercapacitor and the wide-temperature lithium-ion battery are connected to the power supply bus via anti-reverse-feedback or isolated power management branches. Solar energy prioritizes charging the micro supercapacitor and provides the pulse energy required for sensing, data acquisition, computation, and positioning startup. The wide-temperature lithium-ion battery primarily serves as a backup power source for the real-time clock (RTC), tamper detection circuit, and data retention in extremely dark environments, preventing direct parallel connection of different energy storage devices from causing mutual charging and discharging, and ensuring uninterrupted timestamp recording.

[0032] refer to Figure 4 , Figure 5As shown, in one exemplary embodiment, the monitoring terminal 100 includes: a housing 110, a flexible thin-film solar cell 104 disposed on the outer surface of the housing 110, a circuit board 114 and a hybrid energy storage unit 101 disposed inside the housing 110, and a wearable substrate 115 connected to the housing 110. The housing 110 includes an upper housing 111 and a lower housing 112 that are interlocked. The flexible thin-film solar cell 104 is disposed on the side of the upper housing 111 facing the external environment and is electrically connected to a power management chip 105. A light-transmitting protective layer 113 is disposed on the upper layer of the flexible thin-film solar cell 104 to provide waterproof, dustproof, and impact-resistant protection for the flexible thin-film solar cell 104 without affecting the incidence of ambient light. The circuit board 114 is disposed within the receiving space formed by the upper housing 111 and the lower housing 112. The microcontroller unit 108, positioning sensor 103, positioning antenna, triaxial accelerometer 102, power management chip 105, wireless communication unit 106 and storage unit 109 are integrated on the circuit board 114; the positioning sensor 103 and its positioning antenna are located near the upper housing 111; the hybrid energy storage unit 101 is located below the circuit board 114 and is connected to the power supply terminal of the circuit board 114 through the power management chip 105.

[0033] The wearing base 115 is configured as an ear tag, ankle strap, or neck strap, and is equipped with a one-way locking element 116 and a locking pin or buckle 117. An tamper-proof conductive line 118 is arranged along the wearing base 115 and the one-way locking element 116, forming part of the tamper-proof detection circuit 107. After the monitoring terminal completes its initial wearing, the microcontroller unit 108 activates the tamper-proof detection circuit 107. (Reference) Figure 6 , Figure 7 As shown, when the wearing base 115 is cut, the one-way locking element 116 is forcibly disassembled, or the locking pin or buckle 117 is pulled out, the anti-tamper conductive line 118 is disconnected, causing the anti-tamper detection circuit 107 to generate a level change, and triggering the microcontroller unit 108 to record the anti-tamper event.

[0034] For example, refer to Figure 8As shown, taking the NFC module as an example of a wireless communication module, the microcontroller unit (MCU) can use STM32L series or Ambiq Apollo series chips. The MCU integrates a secure encryption coprocessor (Secure Element) for hardware-level storage of non-exportable private keys and supports ECDSA (Elliptic Curve Digital Signature Algorithm) hardware acceleration, ensuring that encryption operations do not consume excessive general-purpose computing resources. The flexible thin-film solar cell acts as a micro-energy collector, with its output connected to the input of the power management unit (PMIC) via power supply line L1, and also connected to the MCU's analog-to-digital converter (ADC) pin via sensing line L2. The MCU connects to the NFC dynamic tag chip and RF antenna coil via the I2C bus, serving as the monitoring terminal's only external data exchange channel; it lacks a SIM card slot or cellular RF module. The MCU's GPIO pins are connected to an anti-tamper detection circuit; this circuit can be located at the ear tag pin or ankle clip, etc.; when the anti-tamper detection circuit is physically disconnected, an interrupt signal is immediately triggered.

[0035] This exemplary embodiment provides an offline livestock product quality traceability method, which can be applied to the aforementioned offline livestock product quality traceability system. (Reference) Figure 1 As shown, the method includes: Step S11: Establish a communication connection between the monitoring terminal and the service terminal, and initialize the monitoring terminal; the monitoring terminal generates an asymmetric key using a true random number generator through the microcontroller unit; wherein, the asymmetric key includes: public key PK and private key SK; the private key SK is written to the secure storage area and subjected to physical circuit breaker write protection processing; the public key PK is written to the public read area; Step S12: The service terminal configures the monitoring terminal with the species type, age model, light threshold, breeding area, birth / entry date of the monitored object, as well as the device identification, sampling cycle, and analysis window; wherein, the age model includes the expected daily activity data corresponding to different age stages; Step S13: The service terminal configures the device data identifier and traceability data writing rules for the monitoring terminal; wherein, the traceability data writing rules include: adding device data identifiers to data blocks of each collection cycle and writing them to the public read area; and activating the anti-tamper detection circuit. Step S14: The monitoring terminal acquires the traceability data corresponding to the current data collection period and organizes the data to generate a data block; wherein, the traceability data includes: timestamp, step count result, location information; and calculates the hash value corresponding to the data block; signs the hash value using the private key SK to generate a signature value; and writes the data block and signature value to local storage.

[0036] The following will describe in more detail each step of the offline livestock product quality traceability method in this exemplary embodiment, with reference to the accompanying drawings and embodiments.

[0037] In step S11, a communication connection is established between the monitoring terminal and the service terminal, and the monitoring terminal is initialized. The monitoring terminal generates an asymmetric key using a true random number generator through the microcontroller unit. The asymmetric key includes a public key PK and a private key SK. The private key SK is written to the secure storage area and is protected by physical circuit breaker write. The public key PK is written to the public read area.

[0038] For example, when the monitoring terminal is manufactured or first activated, it can first be initialized using a service terminal. Specifically, a connection can be established between the service terminal and the monitoring terminal via wired or wireless means. On the monitoring terminal, the control microcontroller uses a true random number generator to generate an asymmetric key; the asymmetric key includes a public key PK and a private key SK. For details, refer to... Figure 9 As shown, the private key SK is written to the secure storage area (OTP area) and physically protected against write-by-wire, making it permanently unreadable and unexportable. The public key PK is written to the public read area for verification terminals to read.

[0039] Specifically, the private key SK can only be used for signing within the monitoring terminal and cannot be read by external devices. The public key PK is written to a publicly readable area.

[0040] In step S12, the service terminal configures the monitoring terminal with the species type, age model, light threshold, breeding area, birth / entry date of the monitored object, as well as the device identification, sampling cycle, and analysis window; wherein, the age model includes the expected daily activity data corresponding to different age stages.

[0041] Specifically, during initialization, the monitoring terminal can be programmed with information such as livestock species, date of birth or entry into the pen, terminal placement location, breeding area, and corresponding age-growth model. The age-growth model must include at least the expected daily activity level E(d) for different age stages; where d represents the current age, and E(d) represents the expected number of effective steps for evaluation at that age. The sampling period and analysis window size can also be pre-configured based on the livestock species and programmed accordingly. Furthermore, a device identification identifier can be programmed into the monitoring terminal as its unique and unchangeable identity.

[0042] During initialization, the monitoring terminal clears the candidate step count Nc, valid step count Nv, abnormal step count Na, outdoor valid step count Nout, indoor valid step count Nin, nighttime or unknown state valid step count Nunk, weighted motion integral Sq, valid location snapshot count Ng, and fenced location snapshot count Nin_geo to zero; at the same time, it reads and writes the device's unique ID dev, as well as the newly generated device private key SK, device public key PK, current record sequence number Seq, and the hash value of the previous data block Hn-1.

[0043] In step S13, the service terminal configures the device data identifier and traceability data writing rules for the monitoring terminal; wherein, the traceability data writing rules include: adding device data identifiers to data blocks of each collection cycle and writing them to the public read area; and activating the anti-tamper detection circuit.

[0044] Specifically, the service terminal can also configure and write device data identifiers and traceability data writing rules for monitoring devices. The device data identifier serves as a unique data identity for the traceability data generated by that device. A pre-configured mapping relationship between device identifiers and device data identifiers is also included. This mapping relationship represents a unique association between devices and their generated data, preventing discrepancies between device data and preventing data tampering. The traceability data writing rules include adding device data identifiers to data blocks in each collection cycle and writing them to a public read area. Furthermore, the write location and verification method of the device data identifier within the data block can be configured.

[0045] Simultaneously, the tamper detection circuit connected to the MCU can be activated, and the corresponding tamper flag Tamper can be configured to 0. For example, if the tamper detection circuit is disconnected after the monitoring terminal completes its first use, the tamper flag Tamper will be set to 1, and the subsequent breeding process will be marked as failed or abnormal at the quantification level G. For example, if the conductive wire breaks, the ankle band antenna is cut, or the one-way locking structure is damaged, the tamper detection circuit will be broken, and the MCU will set the tamper flag Tamper to 1.

[0046] In this exemplary embodiment, the method may further include: When the service terminal completes the initialization of the monitoring terminal, it triggers the monitoring terminal's automatic data entry task. This task is used by the service terminal to generate device write information based on the current monitoring terminal's device information, device data identifier, and current query count. The service terminal generates summary data for the first write information, encapsulates it into transaction data, and writes it to the blockchain.

[0047] Specifically, for the service terminal, a pre-established association between the initialization task and the information entry task can be created. Upon completion of the initialization process for the monitoring terminal, an automatic data entry task for the current monitoring terminal can be automatically triggered. This task writes the monitoring terminal's information into the blockchain for subsequent verification of device identity, device status, and data identifier validity. Specifically, the monitoring terminal's device information (e.g., device identity identifier) ​​and device data identifier can be generated as initial write information based on a custom format or editing method. This initial write information serves as traceability identification information. A digest algorithm is then used to calculate the corresponding digest data. The initial write information and digest information are encapsulated into blockchain transaction data and written to the blockchain system. The initial write information may also include species type, breeding area, birth / entry date, etc. After generating the initial write information, the service terminal can write it into the blockchain for subsequent verification of the monitoring device's usage status by reading this information.

[0048] In step S14, the monitoring terminal acquires the traceability data corresponding to the current data collection cycle and organizes the data to generate a data block; wherein, the traceability data includes: timestamp, step count result, location information; and calculates the hash value corresponding to the data block; signs the hash value using the private key SK to generate a signature value; and writes the data block and signature value to local storage.

[0049] For example, in step S14, the monitoring terminal acquires the traceability data corresponding to the current data collection cycle, including: Step S21: Obtain the current voltage Vcap of the hybrid energy storage unit in the monitoring terminal according to the preset voltage reading cycle, and compare the current voltage with the preset energy threshold to configure the terminal working mode according to the comparison result; wherein, the terminal working mode includes: keep-alive mode, low power mode, and full monitoring mode. Step S22: When the terminal is in keep-alive mode, maintain the passive reading functions of clock, tamper detection, most recent checkpoint, and near-field communication; and pause sensor data acquisition. Step S23: When the terminal is in low power mode or full monitoring mode, wake up the sensor according to a preset period to obtain the original sensor signal for use in obtaining traceability data; wherein, the original sensor signal in low power mode includes the original sensor signal of the triaxial accelerometer; the original sensor signal in full monitoring mode includes the original sensor signals corresponding to the triaxial accelerometer and the positioning sensor. Step S24: Filter the raw sensor signal of the triaxial accelerometer and calculate the adaptive gait threshold based on the filtered signal to screen candidate gaits; screen for abnormal noise based on the signal waveform changes corresponding to the candidate gaits to obtain the step counting results corresponding to the analysis window; wherein, the step counting results of the analysis window include: the number of valid steps and the number of abnormal steps; Step S25: Based on a preset environmental monitoring cycle, obtain the open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell in the monitoring terminal, and configure the environmental status according to the comparison result with the preset threshold; wherein, the environmental status includes: outdoor status, indoor status, and nighttime status or insufficient evidence status. Step S26: Combine the step count results with the weighting coefficients corresponding to the environmental conditions of the corresponding time period to calculate the corresponding motion integral.

[0050] Specifically, the current data collection period can be based on one calendar day. Within this period, the collection of other parameters can be configured with their own specific collection periods. Correspondingly, the source data of one calendar day can be used to generate corresponding data blocks. Alternatively, the data block capacity can be predefined, and source data from one or multiple consecutive calendar days can be used to generate data blocks.

[0051] The calculation of traceability data can take triaxial acceleration data, output voltage of solar thin-film batteries, energy storage terminal voltage, clock information, and optional low-frequency position snapshots as inputs, and sequentially perform energy state scheduling, motion signal filtering, candidate gait detection, mechanical artifact recognition, environmental state determination, weighted integration, age normalization, grade assessment, and security evidence storage. Simultaneously, the final output traceability data can include any combination of the following: selected steps Nc, cumulative effective steps Nv, abnormal steps Na, outdoor effective steps Nout, indoor effective steps Nin, effective steps at night or in unknown states Nunk, full life-cycle weighted motion integral Sq, data confidence Conf, origin consistency rate Lgeo, and any combination of the following quantitative grades of the breeding process G.

[0052] For example, step S21 above may include: when it is determined that the current voltage is less than or equal to a first energy threshold, configuring the terminal working mode to keep-alive mode; Alternatively, when it is determined that the current voltage falls between a first energy threshold and a second energy threshold, the terminal operating mode is configured to a low-power mode; wherein the second threshold is greater than the first threshold. Alternatively, when the current voltage is determined to be greater than or equal to the second energy threshold, the terminal operating mode is configured to full monitoring mode; wherein, the sensor data acquisition frequency in full monitoring mode is greater than the sensor data acquisition frequency in low power mode.

[0053] Specifically, the monitoring terminal can first determine its operating mode. At the start of the data acquisition cycle, a voltage reading cycle can be triggered first, reading the current voltage Vcap of the hybrid energy storage unit and comparing it with a first energy threshold VE1 and a second energy threshold VE2; the operating mode of the monitoring terminal is then configured based on the comparison result. In subsequent periods, the current voltage Vcap of the hybrid energy storage unit can be read and judged periodically according to the preset voltage reading cycle duration, thereby ensuring that the computational workload of the traceability data matches the currently available environmental energy.

[0054] Specifically, when the current voltage is identified to be less than or equal to a first energy threshold, that is: Vcap <VE1 Correspondingly, the monitoring terminal is configured to enter keep-alive mode E0. In E0 keep-alive mode, the monitoring terminal only maintains the passive reading functions of real-time clock, tamper detection, most recent checkpoint, and near-field communication, while suspending continuous motion sampling and active positioning.

[0055] When the current voltage is identified as falling between the first energy threshold and the second energy threshold, that is: VE1 ≤ Vcap <VE2 Correspondingly, the terminal is configured to operate in low-power mode E1. In E1 low-power monitoring mode, the monitoring terminal collects acceleration data with a low duty cycle. For example, it can wake up the sensor periodically to complete an analysis window W, and then go back to sleep; high-power positioning is not initiated during this time.

[0056] When the current voltage is identified as being greater than or equal to the second energy threshold, that is: Vcap ≥ VE2.

[0057] Correspondingly, the monitoring terminal can be configured to operate in full monitoring mode E2. In E2 full monitoring mode, the monitoring terminal continuously executes motion algorithms according to the set acceleration sampling rate and allows the use of global navigation satellite systems (GNSS, such as GPS or BeiDou) to obtain low-frequency position snapshots at intervals of several hours or once a day.

[0058] For example, in step S23 above, in low-power mode E1 or full monitoring mode E2, the triaxial accelerometer outputs accelerations ax[n], ay[n], and az[n] in three directions at a predefined sampling rate fs; where n represents the current sampling point number. When fs = 25 Hz, the terminal obtains 25 sets of triaxial data per second.

[0059] For example, step S2 above may specifically include: Step S241: In the analysis window, perform gravity baseline estimation on the acceleration in the three directions output by the triaxial accelerometer; determine the corresponding dynamic components based on the acceleration in the three directions and the gravity baseline; and calculate the triaxial composite acceleration by combining the dynamic components in each direction. Step S242: Bandpass filtering is performed on the triaxial composite acceleration based on a preset frequency threshold to obtain the filtered gait bandpass signal; the high-frequency residual signal is calculated based on the gait bandpass signal and the dynamic components before filtering. Step S243: Determine the motion amplitude corresponding to the gait bandpass signal; perform a recursive averaging operation on the motion amplitude to obtain the corresponding background amplitude, and determine the average deviation of the motion amplitude relative to the background amplitude; configure the current adaptive gait entry threshold by combining the background amplitude and the average deviation; and determine the current adaptive gait exit threshold according to the preset relationship between the gait entry threshold and the exit threshold; wherein, the gait entry threshold is greater than the gait exit threshold. Step S244: When the detected movement amplitude changes from less than the gait entry threshold to greater than or equal to the gait entry threshold, a candidate gait event is established; when the detected movement amplitude changes to less than or equal to the gait exit threshold, or the peak duration is greater than the preset peak duration, the candidate gait event is configured to end; wherein, the start time, end time, maximum amplitude, and amplitude accumulation value during the peak duration corresponding to the candidate gait event are configured according to the change process of the movement amplitude. Step S245: Based on preset candidate step count judgment conditions, judge the candidate gait events, and determine the candidate step count when the preset candidate step count judgment conditions are met; or, when the candidate gait event does not meet the preset candidate step count judgment conditions, configure the abnormal step count or abnormal impact step count according to the candidate gait event; wherein, the preset candidate step count judgment conditions include: the cumulative area of ​​the wave crests is greater than or equal to the preset minimum area; the time interval between the current candidate gait event and the adjacent previous candidate gait event meets the preset time threshold; the candidate gait event is not marked as invalid posture, and the anti-tamper flag information based on the anti-tamper detection loop is 0; Step S246: At the end of the analysis window, the candidate steps within the analysis window are subjected to mechanical shaking and transportation vibration elimination based on preset effective step count identification conditions to determine whether the step count result is a valid step count or an abnormal step count; wherein, the effective step count identification conditions include: the degree of variation of adjacent candidate gait intervals, the three-axis dynamic energy discrimination condition, the single-axis energy ratio discrimination condition, the high-frequency energy ratio discrimination condition, and the gravity vector change at the beginning and end of the window discrimination condition; wherein, the high-frequency energy ratio is determined based on the high-frequency residual signal and the gait bandpass signal.

[0060] Specifically, when acquiring sensor data, a current analysis window can be created as a motion analysis window. This analysis window can represent the duration of a single concentrated analysis, and its size can be configured based on the species type and the animal's current age. For example, if W is pre-configured to 4 seconds, 100 sets of sampled data can be analyzed.

[0061] Considering that the monitoring terminal is installed on the animal's neck or legs, the terminal's posture will change with the animal's posture. Therefore, this method does not simply use a single axis as a fixed and unique step counting signal. Specifically, we can first estimate three slowly changing gravity baselines gx[n], gy[n], and gz[n]; for example, using a constant gravitational acceleration g as the gravity baseline for static accelerometer measurement. Then, the corresponding dynamic components can be calculated based on the acceleration in each direction and the gravity baseline, expressed by the following formula: dx[n] = ax[n] - gx[n] dy[n] = ay[n] - gy[n] dz[n] = az[n] - gz[n] Where ax[n], ay[n] and az[n] represent the accelerations of the triaxial accelerometer in the three directions, respectively; gx[n], gy[n] and gz[n] represent the gravity baselines in the three directions, respectively; and dx[n], dy[n] and dz[n] represent the dynamic components of the triaxial accelerometer in the three directions, respectively.

[0062] Then, the triaxial resultant acceleration m[n] can be calculated based on the dynamic components in each direction. Specifically, the triaxial resultant acceleration m[n] is equal to the square root of the sum of the squares of the accelerations along the three axes, expressed by the formula:

[0063] By utilizing the dynamic components in three directions to calculate the triaxial composite acceleration m[n], and using the triaxial composite acceleration m[n] as the main motion signal, the impact of changes in the wearing direction of the terminal can be effectively reduced.

[0064] Then, by bandpass filtering the triaxial composite acceleration m[n], the normal walking frequency can be preserved while high-frequency mechanical vibrations can be extracted. Specifically, the lower bandpass limit is denoted as fL, and the upper bandpass limit is denoted as fH. The triaxial composite acceleration is filtered by pre-configured upper and lower bandpass frequencies. Slow changes below the lower bandpass limit fL mainly reflect slow changes in posture, gravity baseline drift, or slow movement of the terminal position; rapid changes above the upper bandpass limit fH are more likely to come from collisions, motors, treadmills, vehicle vibrations, or rapid human shaking.

[0065] For example, fL = 0.4 Hz and fH = 3.0 Hz can be configured. The signal in the range of 0.4 to 3.0 Hz is denoted as the gait bandpass signal b[n].

[0066] In addition, the high-frequency residual signal r[n] is also saved for subsequent mechanical artifact identification. The formula is expressed as: r[n] = q[n] - b[n].

[0067] The dynamic signal q[n] is obtained by high-pass filtering the triaxial composite acceleration m[n] with a cutoff frequency of fL, and is used to preserve the gait frequency band and dynamic components above the gait frequency band. The formula is: q[n] = HPFfL{m[n]}.

[0068] Where HPFfL{·} represents a high-pass filtering operation with a cutoff frequency of fL; q[n] is used to retain the gait frequency band and dynamic components above the gait frequency band, and remove gravity baseline drift, slow posture changes and slow terminal displacement. The high-frequency residual signal r[n] mainly characterizes signal components with frequencies higher than the upper bandpass fH, including high-frequency motion components generated by collision impact, vehicle transportation vibration, mechanical shaking and rapid human shaking.

[0069] The filter can employ a fixed-point digital filter structure suitable for low-power microcontrollers (MCUs). The filter coefficients are pre-converted to integers, and point-by-point operations only require addition, subtraction, multiplication, and shifting, thereby reducing operating power consumption.

[0070] For example, adaptive gait entry and exit thresholds can also be calculated for the current analysis window. Specifically, the motion amplitude e[n] is obtained by taking the absolute value of the gait bandpass signal b[n]. The formula is expressed as: e[n] =|b[n]|.

[0071] Subsequently, the background amplitude B[n] can be obtained by a slower recursive averaging of the motion amplitude e[n], and the average deviation D[n] of the current motion amplitude relative to the background value can be calculated. Based on the background amplitude B[n] and the average deviation D[n], the gait entry threshold Th[n] can be configured first; then, based on the predefined proportional relationship between the gait entry threshold Th[n] and the gait exit threshold Tl[n], the gait exit threshold Tl[n] can be determined. The formula is expressed as: Th[n] = amplitude limit {B[n] + 2D[n]} Tl[n] = 0.45 × Th[n] Among them, the gait entry threshold is higher than the gait exit threshold, which can prevent the same wave peak from being repeatedly crossed near the threshold and thus being counted repeatedly.

[0072] For example, the lower limit of the gait entry threshold Th[n] is set to 60 milligravity acceleration, and the upper limit is set to 600 milligravity acceleration; the specific values ​​should be calibrated according to the livestock species, sensor range, and wearing position.

[0073] Then, candidate step counts Nc can be filtered and detected based on the adaptive gait entry threshold and gait exit threshold of the current analysis window.

[0074] Specifically, when the movement amplitude e[n] rises from below the gait entry threshold Th[n] to above the gait entry threshold Th[n], a candidate gait event is established, and the event start time, maximum amplitude, and cumulative amplitude value during the peak duration are recorded. At this time, the event cannot be directly counted into the effective step count Nv.

[0075] The candidate event ends when the amplitude of movement e[n] drops below the gait exit threshold Tl[n], or when the duration of the current peak exceeds 400 milliseconds.

[0076] Then, candidate gait events can be judged according to pre-configured candidate step count judgment conditions. Only when all conditions are met simultaneously will the candidate step count Nc be incremented by 1, and the event will be temporarily stored in the current analysis window W. The candidate step count judgment conditions may include: (1) The peak amplitude is not lower than the gait entry threshold Th[n]; (2) The cumulative area of ​​the peaks shall not be less than the preset minimum area; (3) The time interval Tstep between the current candidate event and the previous candidate event is between Tmin and Tmax; for example, 0.25 to 2.0 seconds; (4) The current data is not marked as invalid and the tamper flag is 0.

[0077] Impact events that do not meet the above conditions are directly counted in the abnormal step count Na, or counted separately in the abnormal impact count. Candidate gaits that meet the conditions are still only a part of the candidate step count Nc, and mechanical artifact judgment needs to be completed after the current analysis window W ends.

[0078] Specifically, in step S246 above, at the end of each analysis window W, a comprehensive determination can be made for the candidate step count Nc within the window to exclude mechanical shaking and transportation vibration. By using window determination instead of immediately accumulating each detected peak, it is possible to avoid counting each consecutive regular peak generated by the treadmill into the valid step count.

[0079] The preset effective step count recognition conditions include: the degree of variation of the interval between adjacent candidate gait, the three-axis dynamic energy discrimination condition, the single-axis energy ratio discrimination condition, the high-frequency energy ratio discrimination condition, and the change of gravity vector at the beginning and end of the window discrimination condition.

[0080] The triaxial dynamic energy discrimination condition is used to characterize the overall motion intensity of the monitored object within the analysis window. Assuming the analysis window contains NW sampling points, the dynamic energy in the three directions is expressed as follows: Ex=Σ[n=1, NW] dx²[n]; Ey = Σ[n=1, NW] dy²[n]; Ez = Σ[n=1, NW] dz²[n] Edyn = (Ex + Ey + Ez) / NW Here, Edyn represents the triaxial average dynamic energy within the analysis window. When Edyn is less than the preset lower limit of dynamic energy, Emin, it indicates that the overall motion amplitude within the window is insufficient, and the candidate event may originate from sensor noise or slight disturbance. When Edyn is greater than the preset upper limit of dynamic energy, Emax, it indicates that there may be severe impact, vehicle transport vibration, or rapid human shaking within the window. The analysis window is determined to meet the triaxial dynamic energy discrimination condition only when Emin ≤ Edyn ≤ Emax. Emin and Emax are pre-calibrated based on livestock species, age, sensor range, and terminal wearing position.

[0081] The formula for the uniaxial energy proportion criterion is expressed as follows: Raxis = max(Ex, Ey, Ez) / (Ex + Ey + Ez) Here, Raxis represents the degree to which kinetic energy is concentrated in a single direction; Ex, Ey, and Ez represent the sum of squares of dynamic accelerations in the three directions within the window, respectively. The closer Raxis is to 1, the more likely the motion is a unidirectional mechanical oscillation.

[0082] The proportion of high-frequency energy is determined based on the high-frequency residual signal and the gait bandpass signal. The formula is: Rhf = high-frequency residual energy / (high-frequency residual energy + gait bandpass signal energy).

[0083] Where Rhf represents the proportion of high-frequency mechanical vibration in the total kinetic energy.

[0084] The coefficient of variation (CVstep) of adjacent candidate gait intervals is used to represent the degree of variation in adjacent candidate gait intervals; the calculation formula includes: Suppose that there are M candidate gait events in the current analysis window, and the peak times of each candidate gait event are t1, t2, ..., tM, then the time interval between adjacent candidate gait events is expressed as: ΔTi=ti-t(i-1), i = 2, 3,…,M Tmean=(1 / (M-1))×Σ[i=2,M] ΔTi σT={(1 / (M-1))×Σ[i=2,M](ΔTi - Tmean)²} CVstep = σT / Tmean In this context, a smaller CVstep indicates a more uniform time interval and a more regular gait interval between candidate gaits. Mechanical gaiters typically produce highly regular periodic movements, hence their smaller CVstep. During natural walking, livestock are affected by changes in walking speed, turning, pauses, and terrain, resulting in fluctuations in the intervals between adjacent gaits. When the number of candidate gaits M within the window is less than 3, the number of adjacent time intervals is insufficient, and CVstep is not used alone for mechanical gait evaluation; instead, this item is marked as insufficient evidence of gait interval.

[0085] To reduce the impact of noise from individual sampling points, L consecutive sampling points are selected at the beginning and end of the analysis window, respectively, and the average gravity vector gstart at the beginning of the window and the average gravity vector gend at the end of the window are calculated: gstart=(1 / L)×Σ[n=1,L][gx[n],gy[n],gz[n]]

[0086] gend=(1 / L)×Σ[n=NW-L+1, NW][gx[n], gy[n], gz[n]]

[0087] Δg = ||gend - gstart|| 2 ={(gx,end-gx,start)²+(gy,end-gy,start)²+(gz,end-gz,start)²} The change in gravity vector at the beginning and end of the window, Δg, is the L2 norm of the difference between the two average gravity vectors, not simply a direct subtraction of individual sampling points. Δg is used to characterize whether the terminal's wearing posture changes within the analysis window and is used in conjunction with CVstep, Raxis, and Rhf, but is not used as a single criterion for anomaly detection.

[0088] Specifically, if any of the above anomaly detection conditions are met, all candidate steps in the current analysis window are counted as anomaly steps Na, without increasing the effective step count Nv. If no anomaly is found, the candidate step count in the current analysis window is officially converted from Nc to the effective step count Nv.

[0089] After classification, the number of candidate gaits in this window satisfies the relationship of "number of candidates = number of valid gaits + number of outliers". The formula is expressed as: Nc_window = Nv_window + Na_window For example, if the number of candidate steps in window W is not less than 8, and CVstep is less than 5%, Raxis is greater than 82%, and the change in gravity vector at the beginning and end of the window is very small, it is judged as highly regular mechanical shaking; if Rhf is greater than 55% and the number of candidate steps in the window is not less than 4, it is judged as high-frequency mechanical vibration; if the number of candidate steps in the window exceeds the theoretical upper limit derived from Tmin, it is judged as impossible step frequency.

[0090] For example, step S25 described above may specifically include: Based on a preset environmental monitoring cycle, the output voltage Vsolar of the micro-energy harvesting and sensing multiplexing unit in the monitoring terminal, or the open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell are obtained. During the daytime, if the output voltage is determined to be greater than or equal to the outdoor entry threshold twice consecutively, the environmental state for the corresponding time period is configured as outdoor state; or, if the output voltage is determined to be less than or equal to the outdoor exit threshold twice consecutively, the environmental state for the corresponding time period is configured as indoor state. During nighttime hours, or when the output voltage is determined to be less than the dark environment threshold, the environmental state for the corresponding time period is configured as nighttime state or insufficient evidence state. When the analysis window contains valid steps, configure the corresponding environment state of the analysis window according to the identification result of the environment state, and configure the environment state of the step count result.

[0091] Specifically, the environmental monitoring cycle can be pre-configured, for example, set to 30 minutes. The microcontroller unit reads the output voltage Vsolar of the micro-energy harvesting and sensing multiplexing unit through an analog-to-digital converter (ADC), and uses this output voltage Vsolar to determine the available environmental energy. At the same time, it serves as an auxiliary observation of light intensity to determine the outdoor, indoor, and nighttime status, thereby enabling energy harvesting and environmental sensing multiplexing.

[0092] Specifically, after the data acquisition cycle begins, the environmental status can be judged periodically according to a predefined environmental monitoring cycle. To prevent the output voltage Vsolar from fluctuating around the threshold and causing repeated state switching, this embodiment refines the illumination threshold into an outdoor entry threshold Vout_on and an outdoor exit threshold Vout_off, and satisfies Vout_on > Vout_off.

[0093] During daytime hours, when the output voltage Vsolar is determined to be no lower than the outdoor entry threshold Vout_on for two consecutive times, the environment state switches to OUTDOOR, corresponding to the outdoor state; when the output voltage Vsolar is determined to be no higher than the outdoor exit threshold Vout_off for two consecutive times, the environment state switches to INDOOR, corresponding to the indoor state. In one implementation example, Vout_on = 1.6 V and Vout_off = 1.3 V can be configured.

[0094] When it is nighttime, or when Vsolar is below the dark environment threshold Vdark, the environment state is recorded as UNKNOWN / NIGHT, i.e., nighttime or insufficient evidence state. In one implementation, Vdark = 0.25 V. The number of valid steps generated in this state is recorded as Nunk, instead of directly as the number of rounded steps Nin.

[0095] For example, step S26 described above may specifically include: Step S261: Configure the environmental status corresponding to each analysis window based on the environmental status identification results; Step S262: Calculate the motion integral based on the environmental state corresponding to the step count results in the analysis window.

[0096] Specifically, once an analysis window W is identified as a true motion window, the effective steps are accumulated according to the corresponding environmental state, into outdoor effective steps Nout, indoor effective steps Nin, or nighttime / unknown state effective steps Nunk. Based on this step count, a motion score is calculated, which is used to calculate the weighted motion score over the entire lifespan. The formula includes: Sq = Nout × Kout + Nin × Kin + Nunk × Kunk Wherein, Kout, Kin, and Kunk are the weights for outdoor, indoor, and night / unknown states, respectively; Nout is the number of valid steps outdoors, Nin is the number of valid steps indoors, and Nunk is the number of valid steps in either the night / unknown state.

[0097] For example, you can configure Kout=1.5, Kin=0.8, Kunk=1.0.

[0098] For example, if the current analysis window confirms 12 valid steps Nv and the environment is outdoors, then the valid outdoor steps Nout increase by 12, and the exercise score Sq increases by 12 × 1.5 = 18. If the environment is indoors, then the valid indoor steps Nin increase by 12, and the exercise score Sq increases by 12 × 0.8 = 9.6. If the environment cannot be reliably determined, then the valid steps Nunk in the unknown state increase by 12, and the exercise score Sq increases by 12 × 1.0 = 12. The terminal saves Nout, Nin, Nunk, and Sq respectively for verification of the scoring source displayed on the terminal.

[0099] For example, the method further includes: Step S31: Calculate the effective sampling coverage rate C based on the number of valid sampling tasks during the statistical data collection period and the theoretical sampling coverage rate C; read the expected daily activity level E(d) from the growth model according to the type of monitored object and its current age; determine the expected activity level by combining the effective sampling coverage rate and the expected daily activity level; configure the original aquaculture process index I by combining the expected activity level and the activity score, including: I = 100 × Sq_total / ΣEadj(d) in, Eadj(d) Indicates the expected amount of exercise; Sq_total This represents the motion integral counted during the data acquisition period; Step S32: When the monitoring terminal is currently executing the full monitoring mode and within the preset positioning cycle, activate the positioning sensor to acquire a location snapshot; wherein, the location snapshot includes: location information, positioning accuracy, and positioning time; when the current location snapshot meets the preset accuracy requirement, configure it as the number of valid location snapshots; compare the location information with the preset breeding area; when the current location is identified as being within the preset breeding area, configure a snapshot within the fence; configure the origin consistency rate based on the snapshot within the fence and the valid location snapshots. Step S33: Determine the proportion of abnormal gait based on the number of abnormal steps and candidate steps; configure the data confidence level by combining the effective sampling coverage, the proportion of abnormal gait, and the consistency rate of origin; perform flexible correction on the original aquaculture process index I based on the data confidence level to obtain the final index Ieff, including: Ieff = I × (0.8 + 0.2 × Conf) Step S34: Generate a quantitative grade code for the aquaculture process based on the final index Ieff, data confidence Conf, tamper mark Tamper, and effective sampling coverage C.

[0100] Specifically, at the end of each natural day, i.e., after the current data sampling period ends, the number of valid sampling tasks actually completed that day, Nsample_valid, and the theoretically required number of sampling tasks, Nsample_total, can be calculated to determine the effective sampling coverage rate C. The formula is expressed as: C = Nsample_valid / Nsample_total For example, if theoretically 100 sampling tasks should be completed, but only 80 are actually completed, then C = 80%. The lower the effective sampling coverage rate C, the more data the monitoring terminal may have missed during that period due to insufficient power, sensor malfunction, invalid posture, or tampering protection.

[0101] Simultaneously, the monitoring terminal reads the expected daily exercise E(d) from the growth model based on the livestock species and current age d. To avoid evaluation bias caused by missing data, the expected daily exercise is recalculated using coverage C, resulting in the recalculated expected exercise Eadj(d). The formula is expressed as: Eadj(d) = E(d) × C For example, if the expected daily exercise volume E(d) for a certain age is 5000 steps and the coverage rate on that day is 80%, then the expected exercise volume Eadj(d) is 4000 steps.

[0102] The whole life cycle original aquaculture process index I is calculated as the ratio of the cumulative weighted exercise integral Sq to the cumulative converted expected exercise amount. The formula is expressed as: I = 100 × Sq_total / ΣEadj(d) When the original breeding process index I is approximately equal to 100, it indicates that the weighted amount of exercise of livestock has roughly reached the expected level of the pre-set growth model; I above 100 indicates that it is above the expected level of the model, and the original breeding process index I below 100 indicates that it is below the expected level of the model.

[0103] For example, when the identification voltage Vcap reaches the full monitoring mode requirement and the positioning cycle is reached, the monitoring terminal initiates the Global Navigation Satellite System to acquire a position snapshot. Each position snapshot includes at least latitude, longitude, positioning time, and positioning accuracy. When positioning is successful and the accuracy meets the requirements, the number of valid position snapshots Ng increases by 1.

[0104] The monitoring terminal compares the current location with a pre-defined aquaculture area. The aquaculture area can be represented by a center point and an allowable radius, or by a polygon formed by multiple latitude and longitude points. If the current location is within the aquaculture area, the number of snapshots within the enclosure, Nin_geo, is increased by 1. The origin consistency rate, Lgeo, is then calculated using the formula: Lgeo = Nin_geo / Ng.

[0105] For example, if Ng=80 and Nin_geo=76, then Lgeo=95%. When the number of valid location snapshots Ng is lower than the preset minimum number of valid snapshots, the place of origin is not directly determined to be abnormal; instead, "insufficient location evidence" is output. When the positioning module is not configured, the inspection results clearly show "location verification not enabled," and the lack of location data cannot be interpreted as the place of origin having been verified.

[0106] For example, the proportion of abnormal gait Ra is calculated from the number of abnormal steps Na and the number of candidate steps Nc.

[0107] When the number of candidate steps Nc is greater than 0, Ra = Na / Nc; When the number of candidate steps Nc is equal to 0, the abnormal gait ratio Ra is treated as 0, and the data sufficiency is determined in conjunction with the coverage C.

[0108] Data confidence (Conf) comprehensively considers the effective sampling coverage (C), the proportion of abnormal gaits (Ra), and the origin consistency rate (Lgeo). If location verification is enabled, the origin consistency rate (Lgeo) is calculated using the following formula: Conf = C × (1 - Ra) × Lgeo Alternatively, if the monitoring terminal does not have location enabled, the location item will not be multiplied, but the unverified place of origin must be marked in the result.

[0109] To avoid overestimating low-confidence data, the original aquaculture process index I can be softly adjusted using the data confidence level Conf to obtain the final index Ieff. The formula is expressed as: Ieff = I × (0.8 + 0.2 × Conf) Conf uses decimals from 0 to 1 in calculations.

[0110] For example, with C=0.90, Ra=0.05, and Lgeo=0.95, the data confidence level (Conf) is approximately 0.812. This value indicates that the data coverage is relatively complete, there are few abnormal movements, and most of the locations are within the aquaculture area.

[0111] For example, the monitoring terminal generates a quantitative grade code G for the aquaculture process based on the final index Ieff, data confidence level Conf, tamper mark Tamper, and effective sampling coverage C. The quantitative grade code G for the aquaculture process serves as a quantitative result of the aquaculture process based on movement, environment, and data integrity.

[0112] For example, if Tamper=1, or the effective sampling coverage C is less than 50%, the quantitative grade code G for the aquaculture process will output INVALID, indicating that the data is invalid or the evidence is insufficient. If the final index Ieff is not lower than the A-level threshold IA=115, and the data confidence level Conf is not lower than 75%, then G=A; If the final index Ieff is not lower than the B-level threshold IB=80, and the data confidence level Conf is not lower than 60%, then G=B; The remaining valid data is output as G=C. The formula is expressed as: G = INVALID, if Tamper=1 or C<50%. G = A, if Ieff ≥ IA and Conf ≥ 75% G = B, if Ieff ≥ IB and Conf ≥ 60%. G = C, other valid cases The grade threshold can be pre-configured based on species type and corresponding growth model. Grade G cannot replace physicochemical test results such as meat quality, moisture, fat, protein, drug residues, or microorganisms. Its technical role is to quantify and demonstrate the effective movement, outdoor activity, origin consistency, and data completeness of livestock during the breeding process.

[0113] In step S14, the monitoring terminal acquires the traceability data corresponding to the current data collection cycle and organizes the data to generate a data block; wherein, the traceability data includes: timestamp, step count result, location information; and calculates the hash value corresponding to the data block; signs the hash value using the private key SK to generate a signature value; and writes the data block and signature value to local storage.

[0114] For example, refer to Figure 9 As shown, for the monitoring terminal, upon reaching the preset storage period or the end of the data collection period, the traceability data of the current period can be organized into a data block Dn. The data block can include: timestamps, step count results, latitude and longitude fingerprints, quantitative level codes G for the aquaculture process, and may also include abnormal step counts, environmental components, coverage, and tamper protection status. The formula is expressed as: Dn={IDdev, Seq, Tn, Nv, Na, Nout, Nin, Nunk, ΔSqn, Sqtotal, Ieff, Conf, Lgeo, G, Tamper, Hn-1}. Wherein, IDdev is the unique device identifier; Seq is the monotonically increasing record sequence number; Tn is the current record timestamp; Nv is the cumulative valid steps; Na is the cumulative abnormal steps; Nout, Nin, and Nunk are the cumulative valid steps under different environmental conditions; ΔSqn is the motion integral increment within the storage period corresponding to the nth data block; Sqtotal is the cumulative motion integral over the lifetime up to the current moment; Ieff is the final index; Conf is the data confidence level; Lgeo is the origin consistency rate; G is the grade code; Tamper is the tamper-proof mark; and Hn-1 is the hash value of the previous data block.

[0115] The data block Dn is serialized into byte data according to a fixed field order, and then the current hash value Hn is calculated. The formula is expressed as: Hn = SHA-256(Serialize(Dn)) SHA-256 represents a 256-bit secure hash algorithm. The hash value Hn represents the digital fingerprint of the current record. If any field in data block Dn changes, Hn will change accordingly. Since data block Dn already contains the hash value Hn-1 of the previous data block, the connection between subsequent records will also be invalidated after any historical record is modified.

[0116] Specifically, a digital signature, Signn, can be generated from the hash value using the private key SK. The formula is: Signn = Sign(Hn, SK) Where Signn represents the digital signature of the nth record.

[0117] The signature algorithm can be an elliptic curve digital signature algorithm, such as the P-256 curve. The monitoring terminal appends the data block Dn, hash value Hn, and digital signature Signn to non-volatile memory or a write-once, read-many memory area. After writing, the current hash value Hn is saved as Hn-1 in the next record, and Seq is incremented by 1.

[0118] For example, by writing a checkpoint at the end of an analysis window W, and / or when a data sampling period is completed, and / or when a storage period is reached, write power consumption and memory wear can be effectively reduced. In some exemplary implementations, the storage period can be longer than the data sampling period, that is, the trace data of multiple consecutive data sampling periods can be stored together. Alternatively, the data sampling period can be equal to or longer than the storage period, that is, the trace data within a data sampling period can be stored once, or evenly distributed into multiple storage sessions. The checkpoint must at least store Nv, Na, Nout, Nin, Nunk, Sq, Ng, Nin_geo, Seq, and Hn.

[0119] When the monitoring terminal is powered back on (or at the start of a new data acquisition cycle), it reads the most recent complete checkpoint and checks whether the record sequence number Seq is consecutive, whether the currently saved Hn is consistent with the recalculated hash of the corresponding Dn, and whether the Hn in the previous record is the same as the Hn-1 in the next record. If it finds that the Seq has decreased, the sequence number has changed, Dn and Hn do not match, or the hashes before and after cannot be connected, the data status is marked as abnormal. This prevents the memory from being restored to an earlier point in time, thus avoiding the reuse of past high-level records.

[0120] For example, the method further includes: Step S41: In response to the wireless link established between the monitoring terminal and the inspection terminal, the monitoring terminal extracts the periodic motion integral increment ΔSqn from each data block, and sums up each periodic motion integral increment to obtain the cumulative motion integral Sqtotal of the monitored object's lifecycle. Step S42: Compare the cumulative motion score Sqtotal over the life cycle with the preset level threshold to determine the corresponding level result; Step S43: Calculate the cumulative number of steps based on the step counting results in each data block; Step S44: Calculate the outdoor duration based on the timestamp corresponding to the outdoor status; Step S45: Construct traceability data based on the grade results, cumulative steps, location information, outdoor duration, and preset data identifiers; Step S46: The monitoring terminal transmits the traceability data to the inspection terminal.

[0121] Specifically, refer to Figure 9 As shown, after a user establishes a Bluetooth or NFC connection with the monitoring terminal using the verification terminal, the monitoring terminal can output the device certificate, device public key PK, data block Dn, current hash Hn, and digital signature Signn. The data block can include traceability data fixed in the current data collection cycle, timestamp, step count result (cumulative steps), quality level, and previous hash. The traceability data (status data) from the adjacent previous data collection cycle can be chained to the traceability data of the current cycle by calculating the corresponding hash.

[0122] For terminal verification, the root public key can be used first to verify the device certificate and confirm that the device public key PK is a legitimate monitoring terminal; then, the device public key PK is used to perform signature verification. This is represented as: Verify(Hn, Signn, PK) = pass or fail.

[0123] After successful signature verification, the verification terminal also needs to check whether the monotonically increasing record sequence number Seq is continuous, whether the recalculated hash value Hn for each record is correct, and whether Hn-1 in the subsequent record is equal to the hash value Hn in the previous record. If all checks pass, it displays "Device source valid, records not tampered with"; if any check fails, it displays "Data abnormal," indicating whether it is a certificate abnormality, signature abnormality, missing record, broken hash chain, or anti-tampering abnormality. The above process can be completed offline locally on the verification terminal, without relying on a backend server.

[0124] Specifically, for the monitoring terminal, when the verification terminal authenticates the current monitoring terminal, it can trigger the automatic summation of the periodic motion integral increment ΔSqn in each data block to generate the lifecycle cumulative motion integral Sqtotal and determine the corresponding level result. Simultaneously, it can also statistically analyze all step count results and generate step count results; it also calculates outdoor time. The level result, cumulative steps, location information, outdoor time, and preset data identifiers are used to construct traceability data, which is then sent to the verification terminal, allowing it to be displayed on the verification terminal.

[0125] In some exemplary embodiments, the method further includes: in response to the acquired traceability data, the verification terminal triggers an automatic query task of the monitoring terminal to obtain the existing query count corresponding to the current monitoring terminal from the blockchain; and writes the current query task into the device write information and encapsulates the transaction data and writes it into the blockchain; so that the verification terminal can verify the validity of the traceability data based on the existing query count.

[0126] Specifically, after receiving traceability data, the verification terminal can trigger an automatic query task from the monitoring terminal and retrieve the current query count for the monitoring terminal from the blockchain based on the terminal data identifier. Specifically, the monitoring terminal's terminal data identifier can be used as a traceability identifier and / or transaction identifier, and this identifier is used to find the corresponding summary data on the blockchain to obtain the corresponding query count. Simultaneously, the time of the verification terminal's query to the monitoring terminal is written into the device write information, transaction data is encapsulated, and then written to the blockchain.

[0127] By counting the number of queries, it becomes clear whether the monitoring terminal is interacting with the service terminal and / or the verification terminal, helping to determine if the data of the monitoring terminal has been tampered with. Simultaneously, the number of queries for the monitoring terminal can be updated on the blockchain.

[0128] By configuring the monitoring terminal to interact with the service terminal only during initialization, and prohibiting further communication and data writing after initialization, the monitoring terminal can only communicate with the verification terminal and output existing data. Furthermore, by configuring the monitoring terminal to write data to the blockchain only after initialization and by automatically writing query information to the blockchain after the verification terminal obtains traceability data, the frequency of traceability data acquisition by the monitoring terminal can be statistically analyzed and verified to determine the frequency of data access and the validity of the monitoring terminal, thus serving as supplementary verification information for the traceability data's effectiveness. Moreover, since it is not necessary to write the complete traceability data to the blockchain, the cost of using the blockchain is effectively reduced, enabling a second-level verification of traceability data using blockchain at a lower cost.

[0129] In one exemplary embodiment, the monitoring terminal controls a microcontroller to perform the collection and storage of traceability data, specifically including: Step 1: After the device is started, read the species parameters, age model E(d), light threshold, breeding area, device number IDdev, record number Seq and key status.

[0130] Step 2: Read the energy storage voltage Vcap, and select the E0, E1 or E2 operating mode according to VE1 and VE2.

[0131] Step 3: For each set of triaxial accelerations ax[n], ay[n], az[n], complete the gravity baseline elimination, resultant acceleration calculation and bandpass filtering.

[0132] Step 4: Use Th[n] and Tl[n] to detect candidate gaits, increase the number of candidate steps Nc, and temporarily store the candidate events in the analysis window W.

[0133] Step 5: When the analysis window W ends, calculate CVstep, Raxis, and Rhf, and classify the candidate gait into valid steps Nv or abnormal steps Na.

[0134] Step 6: Read Vsolar at predetermined intervals and update the outdoor, indoor, or night / unknown status based on Vout_on, Vout_off, and Vdark.

[0135] Step 7: Accumulate the valid steps into the outdoor valid steps Nout, indoor valid steps Nin, or night / unknown state valid steps Nunk respectively, and update the weighted exercise score Sq according to Kout, Kin, and Kun.

[0136] Step 8: When energy is sufficient and the positioning cycle is reached, take a location snapshot, update Ng and Nin_geo, and calculate the origin consistency rate Lgeo.

[0137] Step 9: At the end of each day, calculate the effective sampling coverage C, read E(d), and update the original index I, data confidence Conf, and final index Ieff.

[0138] Step 10: Generate the grade code G based on Ieff, Conf, C, and Tamper.

[0139] Step 11: When the storage period is reached or an NFC request is received, a data block Dn is formed, Hn is calculated, and Signn is generated using SK.

[0140] Step 12: Append Dn, Hn, and Signn to save the checkpoint, increment Seq by 1, and set Hn as Hn-1 for the next record.

[0141] For example, taking a livestock wearing a leg band monitoring terminal as an example, the sampling rate is set to fs = 25 Hz, and the analysis window is W = 4 s. Therefore, each window contains 25 × 4 = 100 sets of triaxial acceleration data. A certain window initially detects a candidate step number Nc_window = 12.

[0142] Window analysis results show that there are normal fluctuations in the intervals between adjacent gait states, motion energy is present on all three axes, the proportion of high-frequency energy is lower than the mechanical vibration threshold, and the anti-tampering and posture states are normal. Therefore, the window is not mechanically shaken, and all 12 candidate gait states are converted into valid steps, i.e., Nv_window=12 and Na_window=0.

[0143] If Vsolar is higher than Vout_on twice consecutively at this time, and the environment is outdoors, then Nout increases by 12. Taking Kout=1.5, the weighted motion integral of this window increases by 12×1.5=18, therefore Sq increases by 18.

[0144] The other window also detected Nc_window=12, but CVstep was very small, Raxis was greater than 82%, and the proportion of high-frequency energy was high, so the algorithm determined it to be mechanical shaking. At this time, Na_window=12, Nv_window=0, and Nout, Nin, Nunk, and Sq did not increase.

[0145] Assuming Nv=120000, Na=3000, and Sq=145000 at the end of the rearing cycle, with a cumulative expected activity level of 130000, then I is approximately 111.5. If C=95%, Ra=3000 / (120000+3000) is approximately 2.44%, and Lgeo=96%, then Conf is approximately 88.9%, and Ieff is approximately 109.0. Based on IA=115, IB=80, and the confidence level requirement, the individual's output grade G=B.

[0146] The system and method provided in this invention do not rely on a centralized server for data storage and verification. They utilize environmental micro-energy to maintain the terminal's operation throughout its entire lifecycle, achieve noise reduction, weighting, and classification of motion data through edge computing on the device side, and employ physical anti-tampering and digital signature technologies to ensure the data's originality and immutability. This effectively solves the problems of existing technologies, such as the ease with which cloud data can be tampered with, the high cost of real-time online communication, the ease with which hardware can be illegally reused, and the inability to accurately quantify quality using a single-dimensional step counting method.

[0147] It should be noted that, as another aspect, this application also provides a storage medium, which may be included in an electronic device or may exist independently without being assembled into the electronic device. The aforementioned storage medium carries one or more programs, which, when executed by an electronic device, cause the electronic device to perform the methods described in the following embodiments. For example, the electronic device may perform... Figure 1 The steps of the method shown.

[0148] In one embodiment, this application provides a computer program product including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0149] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

Claims

1. An offline method for tracing the quality of livestock products, characterized in that, An offline livestock quality traceability system is applied, comprising: a service terminal for initializing a monitoring terminal; a monitoring terminal worn on the monitored object for self-powering throughout its entire life cycle using ambient micro-energy, and for periodically collecting and storing traceability data of the monitored object; and an verification terminal for obtaining traceability data of the monitored object from the monitoring terminal via short-range wireless communication, and performing offline validity verification of the traceability data locally on the terminal. The method includes: Establish a communication connection between the monitoring terminal and the service terminal, and initialize the monitoring terminal; the monitoring terminal generates an asymmetric key using a true random number generator through the microcontroller unit; the asymmetric key includes: public key PK and private key SK; the private key SK is written to the secure storage area and is physically protected by a circuit breaker; the public key PK is written to the public read area; The service terminal configures the monitoring terminal with the species type, age model, light threshold, breeding area, birth / entry date of the monitored object, as well as the device identification, sampling cycle, and analysis window; among which, the age model includes the expected daily activity data corresponding to different age stages; The service terminal configures the monitoring terminal with device data identifiers and traceability data writing rules; wherein, the traceability data writing rules include: adding device data identifiers to data blocks of each collection cycle and writing them to the public read area; and activating the anti-tamper detection circuit; The monitoring terminal acquires traceability data corresponding to the current data acquisition cycle, including: acquiring the current voltage Vcap of the hybrid energy storage unit in the monitoring terminal according to a preset voltage reading cycle, and comparing the current voltage with a preset energy threshold to configure the terminal's operating mode based on the comparison result; wherein, the terminal operating modes include: keep-alive mode, low-power mode, and full monitoring mode; when the terminal operating mode is keep-alive mode, the passive reading functions of clock, tamper detection, most recent checkpoint, and near-field communication are maintained; and sensor data acquisition is paused; when the terminal operating mode is low-power mode or full monitoring mode, the sensors are woken up according to a preset cycle to acquire raw sensor signals for acquiring traceability data; wherein, the raw sensor signals in low-power mode include the raw sensor signals of the triaxial accelerometer; the raw sensor signals in full monitoring mode include the raw sensor signals of the triaxial accelerometer; and the raw sensor signals in full monitoring mode include the raw sensor signals of the triaxial accelerometer. The sensor signals include: raw sensor signals from the triaxial accelerometer and positioning sensor; the raw sensor signal from the triaxial accelerometer is filtered, and an adaptive gait threshold is calculated based on the filtered signal to screen candidate gaits; abnormal noise is screened based on the signal waveform changes corresponding to the candidate gaits to obtain the step counting results corresponding to the analysis window; the step counting results of the analysis window include: valid steps and abnormal steps; the open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell in the monitoring terminal are obtained based on a preset environmental monitoring cycle, and the environmental state is configured according to the comparison results with the preset threshold; the environmental state includes: outdoor state, indoor state, and nighttime state or insufficient evidence state; the corresponding motion integral is calculated by combining the step counting results and the weight coefficients corresponding to the environmental state of the corresponding time period. In addition, the source data is processed to generate data blocks; the source data includes: timestamps, step count results, location information and the hash value corresponding to the data block; the hash value is signed using the private key SK to generate a signature value; the data block and the signature value are written to local storage; In response to the wireless link established with the inspection terminal, the monitoring terminal extracts the periodic motion integral increment ΔSqn from each data block, sums the periodic motion integral increments, and obtains the lifetime cumulative motion integral Sqtotal of the monitored object. It then compares the lifetime cumulative motion integral Sqtotal with a preset level threshold to determine the corresponding level result. Based on the step count results in each data block, it calculates the cumulative step count. Based on the timestamp corresponding to the outdoor status, it calculates the outdoor duration. Based on the level result, cumulative step count, location information, outdoor duration, and preset data identifiers, it constructs traceability data. The monitoring terminal then transmits the traceability data to the inspection terminal.

2. The method according to claim 1, characterized in that, The current voltage Vcap of the hybrid energy storage unit in the monitoring terminal is acquired according to a preset voltage reading cycle, and the current voltage is compared with a preset energy threshold to configure the terminal's operating mode based on the comparison result, including: When the current voltage is determined to be less than or equal to the first energy threshold, configure the terminal operating mode to keep-alive mode; or, When the current voltage is determined to be between a first energy threshold and a second energy threshold, the terminal operating mode is configured to low-power mode; wherein the second threshold is greater than the first threshold; or, When the current voltage is determined to be greater than or equal to the second energy threshold, the terminal is configured to operate in full monitoring mode; wherein, the sensor data acquisition frequency in full monitoring mode is greater than the sensor data acquisition frequency in low power mode.

3. The method according to claim 1, characterized in that, The raw sensor signal from the triaxial accelerometer is filtered, and an adaptive gait threshold is calculated based on the filtered signal to screen candidate gaits. Abnormal noise is screened based on changes in the signal waveform corresponding to candidate gaits to obtain the step counting results corresponding to the analysis window, including: Within the analysis window, the gravity baseline is estimated for the acceleration in the three directions output by the triaxial accelerometer; the corresponding dynamic components are determined based on the acceleration in the three directions and the gravity baseline; and the triaxial composite acceleration is calculated by combining the dynamic components in each direction. The triaxial composite acceleration is bandpass filtered based on a preset frequency threshold to obtain the filtered gait bandpass signal; the high-frequency residual signal is calculated based on the gait bandpass signal and the dynamic components before filtering. Determine the motion amplitude corresponding to the gait bandpass signal; perform a recursive averaging operation on the motion amplitude to obtain the corresponding background amplitude, and determine the average deviation of the motion amplitude relative to the background amplitude; configure the current adaptive gait entry threshold based on the background amplitude and the average deviation; and determine the current adaptive gait exit threshold based on the preset relationship between the gait entry threshold and the exit threshold; wherein the gait entry threshold is greater than the gait exit threshold. When the amplitude of movement changes from less than the gait entry threshold to greater than or equal to the gait entry threshold, a candidate gait event is established; when the amplitude of movement changes to less than or equal to the gait exit threshold, or when the peak duration is greater than the preset peak duration, the candidate gait event is configured to end; wherein, the start time, end time, maximum amplitude, and amplitude accumulation value during the peak duration of the candidate gait event are configured according to the change process of the amplitude of movement. Candidate gait events are judged based on preset candidate step count judgment conditions, and the candidate step count is determined when the preset candidate step count judgment conditions are met; or, when the candidate gait event does not meet the preset candidate step count judgment conditions, an abnormal step count or an abnormal impact step count is configured according to the candidate gait event; wherein, the preset candidate step count judgment conditions include: the cumulative area of ​​the wave crests is greater than or equal to the preset minimum area; the time interval between the current candidate gait event and the adjacent previous candidate gait event meets the preset time threshold; the candidate gait event is not marked as invalid posture, and the anti-tamper flag information based on the anti-tamper detection loop is 0; At the end of the analysis window, the candidate steps within the analysis window are evaluated based on preset valid step count identification conditions to eliminate mechanical shaking and transportation vibrations, and the step count result is determined as a valid step count or an abnormal step count. The valid step count identification conditions include: the degree of variation of adjacent candidate gait intervals, the three-axis dynamic energy discrimination condition, the single-axis energy ratio discrimination condition, the high-frequency energy ratio discrimination condition, and the gravity vector change at the beginning and end of the window discrimination condition. The high-frequency energy ratio is determined based on the high-frequency residual signal and the gait bandpass signal.

4. The method according to claim 1, characterized in that, The open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell in the monitoring terminal are acquired based on a preset environmental monitoring cycle, and the environmental status is configured according to the comparison results with preset thresholds, including: Based on a preset environmental monitoring cycle, the output voltage Vsolar of the micro-energy harvesting and sensing multiplexing unit in the monitoring terminal, or the open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell are obtained. During the daytime, if the output voltage is determined to be greater than or equal to the outdoor entry threshold twice consecutively, the environmental state for the corresponding time period is configured as outdoor state; or, if the output voltage is determined to be less than or equal to the outdoor exit threshold twice consecutively, the environmental state for the corresponding time period is configured as indoor state. During nighttime hours, or when the output voltage is determined to be less than the dark environment threshold, the environmental state for the corresponding time period is configured as nighttime state or insufficient evidence state. When the analysis window contains valid steps, configure the corresponding environment state of the analysis window according to the identification result of the environment state, and configure the environment state of the step count result.

5. The method according to claim 1 or 4, characterized in that, Based on the step count results and the weighting coefficients corresponding to the environmental conditions during the corresponding time period, the corresponding motion integral is calculated, including: Configure the environmental status corresponding to each analysis window based on the environmental status identification results; Based on the environmental state corresponding to the step count results within the analysis window, calculate the motion integral, including: Sq = Nout × Kout + Nin × Kin + Nunk × Kunk Wherein, Kout, Kin, and Kunk are the weights for outdoor, indoor, and night / unknown states, respectively; Nout is the number of valid steps outdoors, Nin is the number of valid steps indoors, and Nunk is the number of valid steps in either the night / unknown state.

6. The method according to claim 1, characterized in that, The method further includes: The effective sampling task count for the statistical data collection period is calculated, and the corresponding effective sampling coverage rate C is calculated in conjunction with the theoretical sampling task count; the expected daily exercise volume E(d) is read from the growth model based on the type of monitored object and its current age; the expected exercise volume is determined by combining the effective sampling coverage rate and the expected daily exercise volume; and the original aquaculture process index I is configured by combining the expected exercise volume and the exercise integral, including: I = 100 × Sq_total / ΣEadj(d) in, Eadj(d) Indicates the expected amount of exercise; Sq_total This represents the motion integral counted during the data acquisition period; When the monitoring terminal is currently executing a full monitoring mode and within a preset positioning cycle, the positioning sensor is activated to acquire a location snapshot. The location snapshot includes: location information, positioning accuracy, and positioning time. If the current location snapshot meets the preset accuracy requirements, it is configured as a valid location snapshot. The location information is compared with a preset aquaculture area. If the current location is identified as being within the preset aquaculture area, a snapshot within the enclosure is configured. Based on the snapshot within the enclosure and the valid location snapshot, the origin consistency rate is configured. Based on the number of abnormal steps and candidate steps, the proportion of abnormal gait is determined; combining the effective sampling coverage, the proportion of abnormal gait, and the consistency rate of origin, a data confidence level is configured; based on the data confidence level, the original aquaculture process index I is flexibly adjusted to obtain the final index Ieff, which includes: Ieff = I × (0.8 + 0.2 × Conf) The quantitative grade code for the aquaculture process is generated by combining the final index Ieff, data confidence Conf, tamper mark Tamper, and effective sampling coverage C.

7. The method according to claim 1, characterized in that, The method further includes: When the service terminal completes the initialization of the monitoring terminal, it triggers the monitoring terminal's automatic data entry task. This task is used by the service terminal to generate device writing information based on the current monitoring terminal's device information, device data identifier, and current query count. The service terminal generates summary data for the first writing information, encapsulates it into transaction data, and writes it to the blockchain. as well as, In response to the acquired traceability data, the verification terminal triggers an automatic query task from the monitoring terminal, obtains the current number of queries corresponding to the monitoring terminal from the blockchain, and writes the current query task into the device write information and encapsulates the transaction data, which is then written into the blockchain for the verification terminal to verify the validity of the traceability data based on the existing number of queries.

8. An offline livestock quality traceability system, characterized in that, The system includes: The service terminal is used to initialize the monitoring terminal. The monitoring terminal, worn on the monitored object, is used to achieve self-powered operation throughout its entire life cycle by utilizing micro-energy from the environment, and to periodically collect and store traceability data of the monitored object. The verification terminal is used to obtain traceability data of the monitored object from the monitoring terminal through short-range wireless communication, and to perform offline validity verification on the traceability data locally on the terminal. The monitoring terminal includes: A hybrid energy storage unit, used to provide power to the monitoring terminal, includes a micro supercapacitor and a wide-temperature lithium-ion battery; wherein the micro supercapacitor and the wide-temperature lithium-ion battery are respectively connected to the power supply bus via a power management branch; The sensor, connected to the microcontroller unit, is used to collect motion information of the monitored object according to a preset sampling period, and to collect position information when the energy conditions and positioning period are met; the sensor includes a triaxial accelerometer and a positioning sensor. The micro-energy harvesting and sensing multiplexing unit is used to collect solar energy to power and charge the hybrid energy storage unit, provide power to the monitoring terminal, and generate ambient light intensity information. The micro-energy harvesting and sensing multiplexing unit includes: a flexible thin-film solar cell and a power management chip. The power management chip is connected to the output terminal of the flexible thin-film solar cell, the analog-to-digital conversion pin of the microcontroller unit, and the hybrid energy storage unit, respectively, and is used to provide the microcontroller unit with the open-circuit voltage and / or short-circuit current of the flexible thin-film solar cell to determine the ambient light intensity information. The wireless communication unit, connected to the microcontroller unit, is used for short-range wireless communication with the inspection terminal. The tamper detection circuit is connected to the microcontroller unit and is used to trigger an interrupt when a physical disconnection occurs. The microcontroller unit is used to collect ambient light intensity information at preset intervals, generate traceability data based on the motion and location information of the monitored object, and encrypt the traceability data. The storage unit, connected to the microcontroller unit, is used to store traceability data.