Double-chain fusion product quality tracing method and system applied to production line
Through the double-chain fusion product quality traceability method, reverse clustering and genetic algorithms are used to build a traceability chain, which solves the problem that product quality traceability in the existing technology is not reliable and credible, and achieves efficient and reliable product quality traceability.
Patent Information
- Application Number
- CN202510262748.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-03-06
AI Technical Summary
The prior art is difficult to achieve reliable traceability of product quality in electronic product manufacturing, and there are problems with data integrity and credibility.
The double-chain fusion product quality traceability method is adopted, and the comprehensive data and node attributes of the production node are obtained, and the node clustering is used to cluster nodes, and the basic traceability chain and quality traceability chain are constructed to realize the full process traceability of product quality.
It improves the reliability and credibility of product quality traceability, ensures data integrity and immutability, and enhances the system's fault tolerance and trust.
Smart Images

Figure CN120146871A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of blockchain, and specifically relates to a method and system for product quality traceability with dual-chain integration applied to a production line. Background Art
[0002] Under the deep penetration of the digital wave, new-generation information technologies such as 5G communication, smart finance, and industrial Internet are accelerating their evolution, driving explosive growth in various fields of society. Especially in the field of electronic product manufacturing, the deep integration of industrial Internet of Things technology has reconstructed the traditional production mode. Due to problems such as complex acquisition links and unstable dynamic storage in the massive process data generated during the entire process of electronic product processing, it is extremely easy to cause key processing parameters to be missing in a broken chain manner, making it difficult to accurately locate the source of process defects when the quality of the finished product is abnormal.
[0003] To address the above industry pain points, the current industry generally uses an Internet of Things sensing network to build a full-process monitoring system. Although such a system has initially realized the visual traceability of production data through device interconnection, its underlying architecture still uses an intermediate proxy architecture or a master-slave architecture, and all terminal devices must complete identity authentication and data interaction through a centralized data center. This centralized operation and maintenance mode may not only lead to the collapse of the core database and the annihilation of historical data in the event of abnormal situations such as hardware failures and cyberattacks, but also pose a risk of malicious data tampering under permission management loopholes, resulting in the final quality traceability report being unable to meet the data integrity requirements and being difficult to be generally accepted by the upstream and downstream of the supply chain. Summary of the Invention
[0004] The present invention provides a method and system for product quality traceability with dual-chain integration applied to a production line to solve the problem that the traceability result of product quality is unreliable and lacks credibility.
[0005] In a first aspect, the present invention provides a method for product quality traceability with dual-chain integration applied to a production line, the method comprising the following steps:
[0006] Obtain the comprehensive production data and node attributes of multiple production nodes at different production stages of the target product, where the node attributes include the stage number unique to the production stage corresponding to the production node;
[0007] Randomly select multiple production nodes with different stage numbers as the initial clustering centers, and the number of initial clustering centers is the same as the number of stages of the production stage;
[0008] Cluster all production nodes based on the node attributes and using the reverse clustering algorithm with the initial clustering centers as the basis to obtain multiple production node clusters;
[0009] All production nodes in the same production node cluster are used as blockchain nodes to construct a basic traceability chain, and all integrated production data is integrated to generate a basic blockchain ledger;
[0010] Core nodes are selected from each basic traceability chain according to node attributes, and a quality traceability chain is constructed by combining all core nodes;
[0011] The corresponding basic blockchain ledger is updated through the core nodes, and the updated basic blockchain ledger is uploaded to the quality traceability chain;
[0012] The quality traceability data of the target product is queried using the quality traceability chain.
[0013] Optionally, the node attributes also include the production capacity index and production category number of the production node. The production category numbers of each production node are all different. Based on the node attributes and using the reverse clustering algorithm, all production nodes are clustered based on the initial clustering center, and obtaining multiple production node clusters includes the following steps:
[0014] Taking the maximization of the stage number or production category number difference as the clustering target, all other production nodes are clustered towards the initial clustering center to obtain multiple initial clustering clusters;
[0015] Generate a first optimization target by combining the stage number and production category number;
[0016] All initial clustering clusters are encoded as an initial first-generation population, and the initial first-generation population is optimized according to the first optimization target and using the genetic algorithm to obtain an optimal first-generation population;
[0017] Generate a second optimization target based on the production capacity index;
[0018] The optimal first-generation population is used as the initial second-generation population, and the initial second-generation population is optimized according to the second optimization target and using the genetic algorithm to obtain an optimal second-generation population;
[0019] The optimal second-generation population is disassembled into multiple production node clusters in the form of clustering clusters.
[0020] Optionally, the expression formula of the first optimization target is as follows:
[0021]
[0022] In the formula: F 1 represents the first optimization target, max(·) represents the maximum value function, N represents the number of clusters of the initial clustering clusters in the initial first-generation population, M n represents the number of nodes of the production nodes in the nth initial clustering cluster, represents the stage number of the mth production node in the nth initial clustering cluster, It represents the average stage number of all generating nodes in the nth initial clustering cluster. It represents the production category number of the mth production node in the nth initial clustering cluster. It represents the average production category number of all generating nodes in the nth initial clustering cluster.
[0023] Optionally, the expression formula of the second optimization objective is as follows:
[0024]
[0025] In the formula: F 2 It represents the second optimization objective, and min(·) represents the minimum value function. It represents the average production capacity index of all production nodes in the nth initial clustering cluster. It represents the production capacity index of the mth production node in the nth initial clustering cluster.
[0026] Optionally, taking all production nodes in the same production node cluster as blockchain nodes to construct a basic traceability chain, and integrating all comprehensive production data to generate a basic blockchain ledger includes the following steps:
[0027] Construct a basic traceability chain in the form of a consortium chain for all production nodes in the production node cluster;
[0028] Upload the comprehensive production data corresponding to all production nodes to the basic traceability chain by creating block transactions;
[0029] Combining the Bayesian network and the Kalman filter model to perform data fusion on the comprehensive production data of the same type to obtain fusion traceability data, where the fusion traceability data includes public traceability data and private traceability data;
[0030] Encrypt the private traceability data into encrypted traceability data through a preset encryption algorithm;
[0031] Broadcast the public traceability data and the encrypted traceability data to the basic traceability chain to generate the basic blockchain ledger of the basic traceability chain.
[0032] Optionally, combining the Bayesian network and the Kalman filter model to perform data fusion on the comprehensive production data of the same data type to obtain fusion traceability data includes the following steps:
[0033] Use the Kalman filter model to process the comprehensive production data of the same type to eliminate the data error of the comprehensive production data and obtain the benchmark production data;
[0034] Calculate the information gain of the benchmark production data based on the probability distribution;
[0035] Select a set of target production data from the reference production data according to information gain;
[0036] Perform data fusion on all data in the set of target production data through a Bayesian network to obtain fused traceability data.
[0037] Optionally, selecting a set of target production data from the reference production data according to information gain includes the following steps:
[0038] Obtain the data acquisition cost of the reference production data;
[0039] Construct an optimal utility function by combining information gain and data acquisition cost;
[0040] Use the optimal utility function to select a set of target production data from the reference production data.
[0041] Optionally, the node attributes further include the device attributes of the embedded devices set on the production nodes, and the device attributes include device storage space, device computing power, and device bandwidth; selecting core nodes from each basic traceability chain according to the node attributes includes the following steps:
[0042] Every time a preset interval passes, obtain the device attributes corresponding to all blockchain nodes at the current moment;
[0043] Normalize all device attributes;
[0044] Assign index weights to the normalized device attributes according to a preset weight allocation strategy;
[0045] Combine the device attributes and the corresponding index weights and obtain the node status score of the blockchain node through weighted calculation;
[0046] Select the blockchain node with the highest node status score as the core node at the current moment.
[0047] Optionally, the node attributes further include the product category popularity of the production categories corresponding to the production nodes, and the method further includes the following steps:
[0048] Extract the original Huffman tree from the basic blockchain ledger;
[0049] Assign popularity weights to all tree nodes in the original Huffman tree based on the product category popularity, and the higher the product category popularity, the greater the popularity weight;
[0050] Reconstruct the original Huffman tree into a weighted Huffman tree according to the popularity weights and following the principle of minimizing the weighted path;
[0051] Use the weighted Huffman tree to replace the original Huffman tree in the basic blockchain ledger, and save the basic blockchain ledger after replacement to the core node;
[0052] Calculate the trunk depth of the weighted Huffman tree based on the heat weight and through the Huffman algorithm;
[0053] Screen out the edge tree nodes in the weighted Huffman tree according to the trunk depth to obtain a simplified weighted Huffman tree;
[0054] Use the simplified weighted Huffman tree to replace the weighted Huffman tree in the basic blockchain ledger, and save the completed basic blockchain ledger to all other blockchain nodes except the core nodes in the basic traceability chain.
[0055] In a second aspect, the present invention also provides a double-chain fusion product quality traceability system applied to a production line, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the double-chain fusion product quality traceability method applied to the production line as in the first aspect.
[0056] The beneficial effects of the present invention are:
[0057] The product quality traceability method used in the present invention is based on blockchain technology. One of the core characteristics of blockchain is that data cannot be tampered with. Once each transaction or data record is added to the blockchain, it cannot be tampered with or deleted, ensuring the integrity and authenticity of the data. On the other hand, blockchain is a decentralized distributed ledger technology that does not rely on a single central control node, reducing the risk of single-point failures and improving the reliability and fault tolerance of the traceability process. Therefore, compared with the existing Internet of Things traceability methods with poor reliability and lack of credibility, the blockchain-based product quality traceability has significant advantages in aspects such as data immutability, decentralization, data transparency, security, traceability, smart contract support, and data sharing, and can provide higher system reliability and trust. Brief Description of the Drawings
[0058] Figure 1 It is a schematic flow chart of the double-chain fusion product quality traceability method applied to a production line in one implementation manner of this application.
[0059] Figure 2 It is a schematic diagram of constructing a quality traceability chain by combining multiple core nodes in one implementation manner of this application. Detailed Embodiments
[0060] Next, the technical solutions in the embodiments of this application will be clearly described in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some, but not all, of the embodiments of this application. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of this application.
[0061] The terms "first", "second", etc. in the description and claims of this application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of this application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and do not limit the number of objects. For example, the first object can be one or multiple. In addition, "and / or" in the description and claims means at least one of the connected objects, and the character " / ", generally represents an "or" relationship between the associated objects before and after.
[0062] Figure 1 It is a schematic flowchart of a double-chain fusion product quality traceability method applied to a production line in an embodiment. It should be understood that, although Figure 1 the steps in the flowchart are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, Figure 1 at least a part of the steps in Figure 1 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps. As Figure 1 shown, a double-chain fusion product quality traceability method applied to a production line disclosed by the present invention specifically includes the following steps:
[0063] S101. Obtain the comprehensive production data and node attributes of multiple production nodes of the target product in different production stages.
[0064] Among them, in the first step of product quality traceability, it is necessary to comprehensively collect the comprehensive production data and node attribute information of the target product at each production stage on the entire production line. Comprehensive production data includes but is not limited to multi-dimensional information such as production parameters, quality inspection results, production environment data, and equipment operation status. The node attribute mainly includes the unique stage number of the production node corresponding to the production stage, which is used to clearly identify the specific location and processing stage of the product on the production line. For example, on a smartphone production line, there may be multiple production stages such as PCB manufacturing (stage number 01), chip packaging (stage number 02), screen assembly (stage number 03), battery installation (stage number 04), and whole machine testing (stage number 05), and each stage may contain multiple specific production nodes. Data acquisition is usually achieved through multiple channels such as IoT sensors, RFID tags, data interfaces of production equipment, and quality inspection equipment deployed on the production line. These devices will collect various data in the production process in real time, such as temperature, humidity, pressure, voltage, production rate, defect rate, etc.
[0065] In the actual implementation process, a distributed data acquisition architecture can be adopted to deploy edge computing devices at each production node for preliminary data processing and storage. These data are transmitted to the central data processing center via industrial Ethernet or wireless communication technology (such as 5G, Wi-Fi6) to form a complete data set. The frequency of data collection may vary from milliseconds to hours depending on the production process requirements to ensure the timeliness and integrity of the data. In order to ensure data quality, the collected raw data also needs to be preprocessed, including outlier detection, missing value processing, and data standardization. Through these preprocessing steps, the data used for subsequent analysis is ensured to be of high quality and reliability, laying a solid data foundation for product quality traceability.
[0066] S102. Randomly select multiple production nodes with different stage numbers as initial clustering centers.
[0067] Among them, in the process of determining the initial clustering centers, a special random selection strategy is adopted, that is, one production node is selected from each of the different production stages as the initial clustering center. This strategy ensures that the number of initial clustering centers is consistent with the number of production stages, and at the same time ensures that each initial clustering center comes from a different production stage, avoiding the situation where the initial clustering centers are overly concentrated in a certain production stage. When implementing specifically, the method of stratified random sampling can be used. First, all production nodes are grouped according to the stage numbers to form multiple node subsets, and each subset contains all the nodes in the same production stage. Then, one node is randomly selected from each node subset as the representative of that stage, and together they form the set of initial clustering centers. Random sampling can use a pseudo-random number generator, and through the random indices generated in this way, the nodes at the corresponding positions can be selected from the node list of each stage. To enhance randomness and avoid selection bias, random selection can be re-performed before each clustering, or the average effect can be taken after multiple random selections.
[0068] The advantage of this selection method is that it can ensure that the initial clustering centers are representative in the spatial distribution of the production process, covering the entire process of product production. At the same time, since there may be significant differences in the process characteristics and data characteristics of each production stage, this selection method also helps to capture the characteristic differences of different production stages and improve the subsequent clustering effect. In addition, this method also avoids the local optimum problem that may be brought about by the selection of initial clustering centers in the traditional K-means algorithm, because it forcibly guarantees the diversity and dispersion of the initial clustering centers. In terms of the implementation effect, this method of selecting the initial clustering centers can improve the convergence speed and clustering quality of the clustering algorithm, reduce the risk of the algorithm falling into the local optimum, and provide a good starting point for the subsequent reverse clustering algorithm, so as to more accurately identify groups of production nodes with similar characteristics.
[0069] S103. Cluster all production nodes based on the node attributes and using the reverse clustering algorithm with the initial clustering centers as the basis to obtain multiple production node clusters.
[0070] Among them, in this step, the reverse clustering algorithm is used to group all production nodes, which is essentially different from traditional clustering methods. Instead of clustering similar nodes together, the reverse clustering algorithm assigns nodes to different cluster centers based on the differences in node attributes, aiming to maximize the differences between clusters. This method is particularly suitable for the product quality traceability scenario because it can ensure that each cluster contains production nodes with different characteristics, thereby improving the coverage and representativeness of the entire traceability system. The core idea of reverse clustering is to assign each node to be classified to the cluster center with the greatest difference from it. The specific algorithm process is as follows: First, based on the initial cluster centers selected in the previous step, calculate the difference degrees between each unclassified node and all cluster centers; then, assign the node to the cluster where the cluster center with the greatest difference degree from it is located; next, update the cluster center of this cluster (the average value of the attributes of all nodes in the cluster can be used as the new cluster center); finally, repeat the above process until all nodes are assigned or the preset number of iterations is reached.
[0071] To optimize the clustering results, a genetic algorithm can be introduced for multi-objective optimization. First, encode the initial clustering results into chromosomes, and each chromosome represents a possible clustering scheme. Then, define a fitness function to evaluate the quality of each clustering scheme, and the fitness function can combine multiple objectives such as the difference in stage numbers, the difference in production category numbers, and the difference in production capacity indices. Next, generate a new generation of populations through selection, crossover, and mutation operations and continuously iterate and optimize to finally obtain the optimal clustering scheme that meets the requirements of multi-objective optimization. The implementation effect of this step is to form multiple production node clusters with high differences, and each node cluster contains key nodes in the product production process. This clustering method provides a reasonable node grouping for the subsequent construction of the basic traceability chain, ensuring that each basic traceability chain can cover the complete process of product production, and at the same time improving the robustness and reliability of the entire traceability system.
[0072] S104. Use all production nodes in the same production node cluster as blockchain nodes to construct a basic traceability chain, and integrate all comprehensive production data to generate a basic blockchain ledger.
[0073] Among them, after completing the clustering of production nodes, the next step is to transform each cluster of production nodes into an independent blockchain network, namely the basic traceability chain. The core of this step is to map the nodes in the physical production environment to the nodes in the blockchain network and construct the corresponding data structure and consensus mechanism to ensure the trustworthy recording and traceability of production data. Specifically, all production nodes in the same production node cluster will participate in the corresponding basic traceability chain as blockchain nodes, forming a consortium chain structure. During the implementation process, first, blockchain node software needs to be configured for each production node, including components such as a distributed ledger, a consensus algorithm module, and an intelligent contract execution environment. Considering that the computing power and storage space of devices in the production environment may be limited, a lightweight blockchain framework such as Hyperledger Fabric or an optimized Ethereum private chain can be adopted. Each blockchain node will be assigned a pair of public and private keys for digital signature and identity authentication.
[0074] Next, the comprehensive production data of the production nodes needs to be integrated and uploaded to the blockchain network. These data can be submitted by creating block transactions, and each transaction contains information such as production parameters, quality inspection results, and timestamps. To improve data processing efficiency, a batch processing method can be adopted to package the production data within a certain time period (such as every hour or every shift) into a single transaction. Before uploading the data, the production node needs to use its private key for digital signature to ensure the authenticity and non-repudiation of the data source.
[0075] To process the same type of comprehensive production data, the system will combine the Bayesian network and the Kalman filter model for data fusion. The Kalman filter model is mainly used to eliminate random noise and measurement errors in the data, while the Bayesian network is used to handle the probabilistic dependence relationships between multi-source data, describe the causal relationships between variables through a conditional probability table (CPT), and perform inference calculations using Bayes' theorem. After data fusion, the system will divide the fusion results into two parts: public traceability data and private traceability data. The public traceability data can be directly stored on the blockchain, while the private traceability data needs to be encrypted through encryption algorithms (such as AES-256 or RSA) to generate encrypted traceability data. This separated storage method not only ensures the security of the data but also improves the storage efficiency of the blockchain. The encrypted private data can be stored in an off-chain database, and only the hash value and access control information of the data are saved on the blockchain, and data integrity verification is achieved through hash pointers.
[0076] In the selection of the consensus mechanism for the basic traceability chain, considering the limited number of nodes and trusted identities in the production environment, efficient consensus algorithms such as Practical Byzantine Fault Tolerance (PBFT) or Proof of Stake (PoS) can be adopted instead of the computationally intensive Proof of Work (PoW) algorithm. For example, in PBFT consensus, when more than two-thirds of the nodes reach an agreement, the validity of a block can be confirmed. This consensus mechanism can provide a high transaction processing speed and deterministic finality while ensuring security, meeting the real-time requirements of product quality traceability. The data structure design of the basic blockchain ledger is also crucial. Each block consists of a block header and a block body. The block header contains information such as the hash value of the previous block, timestamp, Merkle root hash, nonce, etc.; the block body contains multiple transaction records, and each transaction record corresponds to a production data. To improve query efficiency, an index structure can be built outside the blockchain, such as an index based on a B+ tree or an inverted index, to achieve fast queries for specific products, specific production parameters, or specific time periods.
[0077] The implementation effect of this step is to form multiple parallel basic traceability chains. Each chain contains the key nodes of the entire product production process and can independently complete the recording and tracing of product quality data. This distributed architecture improves the scalability and fault tolerance of the system. Even if a certain basic traceability chain fails, other traceability chains can still operate normally. At the same time, due to the limited number of nodes in each basic traceability chain, the consensus process is more efficient, improving the overall performance of the system. In addition, the construction of the basic traceability chain also provides a reliable data foundation and technical support for the subsequent quality traceability chain.
[0078] S105. Select core nodes from each basic traceability chain according to node attributes, and construct a quality traceability chain by combining all core nodes.
[0079] Among them, referring to Figure 2 , after constructing multiple basic traceability chains, it is necessary to select core nodes from these basic traceability chains and integrate these core nodes into a higher-level quality traceability chain to achieve global quality traceability across basic traceability chains. The selection of core nodes is based on node attributes. To ensure that the selected core nodes can represent the entire production process, the distribution of nodes in the production stage also needs to be considered. Ideally, at least one core node should be selected from each key production stage to ensure that the quality traceability chain can cover the entire process of product production.
[0080] After selecting the core nodes, these nodes need to be integrated into a quality traceability chain. The quality traceability chain adopts a hierarchical architecture, including a data layer, a network layer, a consensus layer, an incentive layer, a contract layer, and an application layer. The data layer is responsible for the encrypted storage and access control of data; the network layer is responsible for communication and data transmission between nodes; the consensus layer adopts an improved Byzantine fault tolerance algorithm (PBFT) to ensure efficient consensus in a limited node environment; the incentive layer designs an incentive mechanism based on quality contributions to encourage nodes to provide high-quality data and services; the contract layer implements smart contracts related to quality traceability, such as quality data verification contracts, quality anomaly warning contracts, etc.; the application layer provides functional interfaces such as quality traceability queries and quality analysis. During the construction of the quality traceability chain, the interoperability problem between core nodes needs to be solved. This can be achieved through a unified data exchange format (such as JSON-LD) and a cross-chain communication protocol. Each core node is both a participant in its underlying traceability chain and a maintainer of the quality traceability chain, playing a bridging role. The core node realizes the conversion and synchronization of data from the underlying traceability chain to the quality traceability chain through a specific adapter module.
[0081] The implementation effect of this step is to form a high-level quality traceability chain, which integrates the core nodes and key quality data from each underlying traceability chain and provides the ability to trace the product quality from a global perspective. The quality traceability chain can not only track the entire production process of a single product but also analyze the quality correlation between different products and different batches, providing strong support for the root cause analysis and prevention of quality problems. At the same time, since the quality traceability chain only contains core nodes and key data, it has higher efficiency and stronger scalability compared to the complete underlying traceability chain.
[0082] S106. Update the corresponding underlying blockchain ledger through the core node and upload the updated underlying blockchain ledger to the quality traceability chain.
[0083] Among them, after the construction of the quality traceability chain is completed, an efficient mechanism needs to be established to enable the core nodes to continuously update the basic blockchain ledger and synchronize the updated ledger information to the quality traceability chain, so as to achieve data consistency and information interconnection between the basic traceability chain and the quality traceability chain. This step is a key link for the normal operation of the entire traceability system, ensuring the effective flow and timely update of product quality data between different levels of blockchains. The process of the core node updating the basic blockchain ledger adopts a two-way synchronization mechanism. First, as a participant in the basic traceability chain, the core node can receive production data transactions submitted by other nodes on the same basic traceability chain. When new production data is submitted, all nodes (including the core node) on the basic traceability chain will verify the validity of these data through a consensus algorithm and package the verified data into a block and add it to the basic blockchain ledger. Second, the core node can also receive quality feedback information from the quality traceability chain, such as quality anomaly alerts, quality improvement suggestions, etc., and convert this information into a transaction and submit it to the basic traceability chain, triggering the update of the basic blockchain ledger.
[0084] To improve the update efficiency and reduce the network load, the core node adopts an incremental update strategy and only synchronizes the newly added or modified data since the last update. Specifically, the Merkle tree difference comparison algorithm can be used: first calculate the Merkle root hash of the current ledger state and the root hash at the time of the last synchronization; if the two are different, start from the root node and recursively compare the hash values of the subtrees until all the changed leaf nodes are found, and the data corresponding to these leaf nodes is the incremental data that needs to be synchronized. When uploading the basic blockchain ledger to the quality traceability chain, the core node needs to perform data processing and conversion. First, screen and aggregate the basic ledger data and only extract the key data related to product quality. Second, perform standardization processing on the screened data and convert it into the unified data format defined by the quality traceability chain. Finally, the core node uses its identity credentials on the quality traceability chain to package the processed data into a transaction and submit it to the quality traceability chain.
[0085] To ensure data security and privacy protection, the core node will perform differential privacy processing before uploading the data. Differential privacy is a data publishing technology that adds carefully designed random noise to the original data, so that the analysis results will not change significantly due to the addition or removal of any single individual, thus protecting individual privacy. In practical applications, the update frequency of the core node can be dynamically adjusted according to the production rhythm and data importance. For high-value and high-risk products (such as medical devices, aviation components), real-time or near-real-time updates may be required; while for general consumer goods, a batch update strategy may be adopted, such as updating once per hour or per shift.
[0086] The implementation effect of this step is to establish a data bridge between the basic traceability chain and the quality traceability chain, realizing information interconnection and data consistency in a multi-level blockchain system. Through the two-way synchronization mechanism of the core nodes, the detailed production data on the basic traceability chain can be refined and aggregated to form high-value quality information and uploaded to the quality traceability chain. At the same time, the global quality analysis results and improvement suggestions on the quality traceability chain can also be fed back to the basic traceability chain to guide the optimization and adjustment of the production process. This two-way information flow mechanism greatly improves the data value and application effect of the entire traceability system.
[0087] S107. Query the product quality traceability data of the target product using the quality traceability chain.
[0088] Among them, after the construction and data synchronization of the quality traceability chain are completed, the ultimate goal is to provide an efficient, secure, and convenient query interface that enables users to obtain the complete quality traceability data of the target product through the quality traceability chain. This step is the application layer manifestation of the entire traceability system, directly serving the information needs of end-users, including various user groups such as quality management personnel within production enterprises, regulatory agencies, downstream customers, and end consumers. The query process first requires confirming the identity and permissions of the querier. An attribute-based access control (ABAC) mechanism is adopted, and based on multi-dimensional information such as the identity attributes of the querier (such as organizational affiliation, position level), environmental attributes (such as query time, query location), resource attributes (such as data sensitivity level), and operation attributes (such as query type), the access permissions of the querier to specific traceability data are dynamically judged. For example, quality management personnel within an enterprise may have the right to access all detailed quality data, while ordinary consumers may only be able to access public data such as product basic information and quality certificates of conformity.
[0089] Identity authentication adopts a multi-factor authentication method, combining technologies such as digital certificates (X.509 standard), cryptographic proofs (such as zero-knowledge proofs), and biometric recognition to ensure the authenticity of the querier's identity. For example, the elliptic curve digital signature algorithm (ECDSA) can be used for identity authentication: the querier signs a random challenge value using the private key, and the system uses the querier's public key to verify the validity of the signature to confirm the identity of the querier. Identity authentication adopts a multi-factor authentication method, combining technologies such as digital certificates (X.509 standard), cryptographic proofs (such as zero-knowledge proofs), and biometric recognition to ensure the authenticity of the querier's identity. For example, the elliptic curve digital signature algorithm (ECDSA) can be used for identity authentication: the querier signs a random challenge value using the private key, and the system uses the querier's public key to verify the validity of the signature to confirm the identity of the querier.
[0090] In one of the embodiments, the node attributes further include the production capacity index and production category number of the production nodes, and the production category numbers of each production node are all different. Based on the node attributes and using the reverse clustering algorithm, clustering all production nodes based on the initial clustering centers is performed, and obtaining multiple production node clusters specifically includes the following steps:
[0091] Taking the maximization of the difference in stage numbers or production category numbers as the clustering objective, clustering all other production nodes towards the initial clustering centers to obtain multiple initial clustering clusters;
[0092] Combining the stage number and the production category number to generate a first optimization objective;
[0093] Encoding all the initial clustering clusters into an initial first-generation population, and optimizing the initial first-generation population according to the first optimization objective and using the genetic algorithm to obtain an optimal first-generation population;
[0094] Generating a second optimization objective based on the production capacity index;
[0095] Taking the optimal first-generation population as the initial second-generation population, and optimizing the initial second-generation population according to the second optimization objective and using the genetic algorithm to obtain an optimal second-generation population;
[0096] Decomposing the optimal second-generation population into multiple production node clusters in the form of clustering clusters.
[0097] In this embodiment, first, select the K nodes with the largest difference in stage numbers or production category numbers from all production nodes as the initial clustering centers. The selection method of maximizing the difference is: calculate the number differences between all node pairs, and select the K nodes with the largest number differences. For example, if the stage numbers of the nodes are {1, 2, 3, 5, 8, 9} respectively, when K = 3, select the nodes numbered 1, 5, and 9 as the initial clustering centers because the difference between them is the largest. Subsequently, for each remaining production node, calculate its distance from each initial clustering center and assign it to the cluster where the nearest clustering center is located. The distance calculation uses the weighted Euclidean distance: d(i,j) = w 1 (S i -S j ) 2 +w 2 (C i -C j ) 2 , where S i and S j respectively represent the stage numbers of nodes i and j, C i and C j represent the production category numbers, w 1 and w 2is the weight coefficient. In this way, all production nodes are divided into K initial clustering clusters, and each cluster contains an initial clustering center and the nodes around it. The implementation effect of this step is to form a preliminary node grouping, so that nodes in different stages or different production categories are divided into different clusters, laying a foundation for subsequent optimization.
[0098] Next, combine the stage number and the production category number to generate the first optimization objective. The first optimization objective aims to maximize the similarity of nodes within the cluster and minimize the similarity of nodes between different clusters. The expression formula of the first optimization objective is as follows:
[0099]
[0100] In the formula: F 1 represents the first optimization objective, max(·) represents the maximum value function, N represents the number of clusters in the initial generation population of initial clustering clusters, and M n represents the number of production nodes in the nth initial clustering cluster, represents the stage number of the mth production node in the nth initial clustering cluster, represents the average value of the stage numbers of all generated nodes in the nth initial clustering cluster, represents the production category number of the mth production node in the nth initial clustering cluster, represents the average value of the production category numbers of all generated nodes in the nth initial clustering cluster.
[0101] Encode all initial clustering clusters into the initial generation population, and optimize the initial generation population according to the first optimization objective and using the genetic algorithm to obtain the optimal generation population. Specifically, when implementing, first encode each clustering scheme into a chromosome, and the chromosome length is equal to the total number of production nodes N. The value of each position represents the cluster number to which the corresponding node belongs. For example, the chromosome [1, 1, 2, 3, 2, 1] means that nodes 1, 2, and 6 belong to cluster 1, nodes 3 and 5 belong to cluster 2, and node 4 belongs to cluster 3. The initial population contains M chromosomes, corresponding to M different clustering schemes, including the initial clustering scheme obtained in step S1. The fitness function of the genetic algorithm directly uses the first optimization objective function F 1 The reciprocal of: fitness = 1 / F 1 , F 1The smaller the value, the higher the fitness. The selection operation adopts the roulette wheel and elitist retention strategy, and retains the chromosomes with higher fitness to enter the next generation. The crossover operation adopts two-point crossover, randomly selects two crossover points, exchanges the segments between two parent chromosomes, and generates new offspring chromosomes. To maintain the effectiveness of clustering, repair is required after crossover to ensure that each cluster contains at least one node. The mutation operation randomly selects certain positions on the chromosome and changes their values with a certain probability, that is, reassigns some nodes to different clusters. The selection, crossover, and mutation operations are iteratively executed until the preset termination conditions (such as the maximum number of iterations or fitness convergence) are reached. Finally, the chromosome with the highest fitness is selected as the optimal generation population, representing the optimal clustering scheme in the dimensions of stage number and production category number. The implementation effect of this step is to obtain the optimal clustering result under the first optimization objective, ensuring that the nodes within the same cluster have high similarity in production stage and production category.
[0102] Next, a second optimization objective is generated based on the production capacity index. The second optimization objective aims to balance the production capacity of each cluster and avoid the situation where the production capacity of some clusters is too strong or too weak. The expression formula of the second optimization objective is as follows:
[0103]
[0104] In the formula: F 2 represents the second optimization objective, min(·) represents the minimum value function, represents the average production capacity index of all production nodes in the nth initial clustering cluster, represents the production capacity index of the mth production node in the nth initial clustering cluster. The second optimization objective constructs an objective function that can evaluate the balance of cluster production capacity, provides a new optimization direction for the subsequent genetic algorithm optimization, and ensures the rationality of the clustering result in the production capacity dimension.
[0105] Take the optimal generation population as the initial second-generation population, and optimize the initial second-generation population according to the second optimization objective and using the genetic algorithm to obtain the optimal second-generation population. Specifically, when implementing, take the optimal generation population obtained in the previous step as part of the initial second-generation population, and at the same time generate some new chromosomes to increase the population diversity. The fitness function of the genetic algorithm uses the reciprocal of the second optimization objective function F 2 : fitness = 1 / F 2 , F 2The smaller the value, the higher the fitness. To balance the first optimization goal and the second optimization goal, a weighted combination method can be used to define the comprehensive fitness function. The selection operation also adopts the roulette wheel and elitist retention strategies. The crossover operation uses uniform crossover, and for each position of the two parent chromosomes, their values are exchanged with a certain probability. The mutation operation uses an adaptive mutation rate, and the mutation probability is dynamically adjusted according to the diversity of the population: when the population diversity is low, the mutation rate is increased; when the population diversity is high, the mutation rate is decreased. Diversity can be measured by calculating the average Hamming distance between chromosomes in the population. The selection, crossover, and mutation operations are iteratively executed until a preset termination condition is reached. Finally, the chromosome with the highest fitness is selected as the optimal second-generation population, representing the optimal clustering scheme after comprehensively considering the stage number, production category number, and production capacity index. The implementation effect of this step is to obtain the optimal clustering result under the second optimization goal, ensuring the balance of production capacity between clusters while maintaining the excellent characteristics of the first optimization goal.
[0106] The optimal second-generation population is disassembled into multiple production node clusters in the form of clustering clusters. Specifically, during implementation, according to the chromosome with the highest fitness in the optimal second-generation population, all production nodes are divided into multiple node clusters. For the position with the value of i on the chromosome, the corresponding node is assigned to the i-th node cluster. For example, for the chromosome [1, 1, 2, 3, 2, 1], nodes 1, 2, and 6 are assigned to the first node cluster, nodes 3 and 5 are assigned to the second node cluster, and node 4 is assigned to the third node cluster. For the convenience of subsequent processing, a unique identifier can be assigned to each node cluster, and the information of all nodes within the cluster is recorded, including node ID, stage number, production category number, and production capacity index, etc. In addition, the characteristic statistics of each node cluster can be calculated, such as the distribution of stage numbers, the distribution of production category numbers, the total production capacity index, the average production capacity index, etc. of the nodes within the cluster. These statistics help to understand the characteristics of the node cluster. The finally formed node clusters will serve as the basic units for constructing the basic traceability chain, and each node cluster corresponds to a basic traceability chain. The implementation effect of this step is to transform the optimized clustering result into practically usable node clusters. These node clusters have internal similarity in terms of stage number and production category number, and achieve cross-cluster balance in production capacity, laying a foundation for the subsequent construction of an efficient and reasonable multi-level blockchain traceability system.
[0107] In one implementation, all production nodes in the same production node cluster are used as blockchain nodes to construct the basic traceability chain, and all comprehensive production data is integrated to generate the basic blockchain ledger, which specifically includes the following steps:
[0108] Construct the basic traceability chain with all production nodes in the production node cluster in the form of a consortium chain;
[0109] Upload the comprehensive production data corresponding to all production nodes to the basic traceability chain by creating block transactions;
[0110] Combine the Bayesian network and the Kalman filter model to perform data fusion on the comprehensive production data of the same type to obtain fused traceability data, which includes public traceability data and private traceability data;
[0111] Encrypt the private traceability data into encrypted traceability data through a preset encryption algorithm;
[0112] Broadcast the public traceability data and the encrypted traceability data to the basic traceability chain to generate the basic blockchain ledger of the basic traceability chain.
[0113] In this embodiment, first, an independent consortium chain network is established for each production node cluster. This network adopts a permissioned blockchain architecture, and only the production nodes within the cluster can participate in the consensus process as verification nodes. Each production node needs to be configured with a dedicated blockchain node server, install unified blockchain client software, and connect to each other through a secure network protocol (such as TLS 1.3). The node - to - node communication adopts a P2P network topology, and each node is directly connected to at least 3 - 5 other nodes within the cluster to ensure the robustness of the network. The consensus mechanism of the consortium chain adopts the Practical Byzantine Fault Tolerance (PBFT) algorithm or a variant of the Proof of Stake (PoS). Among them, the voting weight of the nodes can be weighted and allocated according to the production capacity index. The higher the production capacity index of a node, the higher the voting weight it obtains. For example, if the production capacity index of node A is 100 and that of node B is 50, then the voting weight of node A is twice that of node B. The block generation time of the consortium chain is set to 30 seconds, each block can accommodate up to 1000 transactions, and the upper limit of the block size is 2MB. To ensure the security of the chain, a multi - signature mechanism is implemented, requiring at least 2 / 3 of the nodes to sign to confirm the validity of the block. In addition, each basic traceability chain is also configured with a smart contract execution environment to support subsequent data verification and business logic execution.
[0114] Each production node needs to standardize the data generated during its production process to form structured comprehensive production data. The comprehensive production data includes, but is not limited to: production batch number, production timestamp, raw material information, production parameters, quality inspection results, environmental monitoring data, etc. The data is organized in JSON format. Before the data is uploaded to the blockchain, the production node needs to use its private key to digitally sign the data to generate a signature value sig = Sign(Hash(data), privateKey), where Hash is the SHA-256 hash function and Sign is the ECDSA signature algorithm. Subsequently, the production node constructs a blockchain transaction, and the transaction content includes: data sender address, data recipient address (usually the smart contract address), comprehensive production data, digital signature, timestamp, transaction fee, etc. The transaction is sent to the consortium blockchain network through the RPC interface or a dedicated API, and is collected and packed into a block by the currently rotating block generation node. To improve the efficiency of data uploading to the blockchain, a batch submission mechanism can be adopted to merge multiple production data generated in a short period of time into a single transaction package, reducing the number of transactions. For large data (such as high-definition images, videos, etc.), the off-chain storage and on-chain indexing method is adopted, that is, the data is stored in a distributed storage system such as IPFS, and only the data hash value is uploaded to the blockchain. The implementation effect of this step is to achieve an immutable record of production data, establish a trustworthy data foundation starting from the production source, and provide raw data support for subsequent data fusion and traceability queries.
[0115] Data fusion is performed on the same type of comprehensive production data by combining a Bayesian network and a Kalman filter model to obtain fused traceability data, which includes public traceability data and private traceability data. In specific implementation, a Bayesian network model is first constructed to represent the probabilistic dependence relationships between different production data. A Bayesian network is a directed acyclic graph (DAG), where nodes represent random variables (such as production parameters, quality indicators, etc.), and edges represent the conditional dependence relationships between variables. For each node X, its conditional probability distribution P(X|Parents(X)) is defined, where Parents(X) represents the set of parent nodes of X. For example, if product quality Q may depend on raw material quality M and production temperature T, then P(Q|M,T) is defined. The Bayesian network learns these conditional probability distributions from historical data. At the same time, for time-series production data, a Kalman filter model is applied for state estimation and noise filtering. The Kalman filter consists of two steps: the prediction step calculates the prior state estimate and the prior error covariance; the update step calculates the Kalman gain, the posterior state estimate, and the posterior error covariance. During the data fusion process, the Kalman filter is first used to filter the time-series data of each data source, and then the filtered data is used as the observed values of the Bayesian network, and the fusion result is obtained through probabilistic inference. The fused data is divided into public traceability data (such as product basic information, quality grade, etc.) and private traceability data (such as detailed formula, precise production parameters, etc.) according to sensitivity. The implementation effect of this step is to improve the accuracy and reliability of the traceability data, eliminate conflicts and noise between different data sources, and at the same time prepare for data privacy protection.
[0116] Next, a multi-level encryption strategy is adopted to protect the privacy of traceability data. First, the symmetric encryption algorithm AES-256-GCM is used to encrypt the privacy data, generating the ciphertext C = AES-Encrypt(K, IV, P, AAD), where K is the symmetric key, IV is the initialization vector, P is the plaintext data, and AAD is the additional authentication data. The encryption result includes the ciphertext and the authentication tag. The symmetric key K is randomly generated to ensure that different keys are used for each batch of data. Subsequently, the attribute-based encryption (ABE) technology is used to encrypt the symmetric key K twice to achieve fine-grained access control. The ABE encryption process is: Enc(K, A), where A is the access policy, such as "(role = regulatory agency OR role = quality inspection department) AND security level >= 3". This ensures that only users who meet a specific combination of attributes can decrypt and obtain the symmetric key. To support traceable authorized access, a proxy re-encryption (PRE) mechanism is also implemented, allowing the data owner to generate a re-encryption key RK_A→B without exposing the original key, enabling the authorized party B to decrypt the data that could originally only be decrypted by A. During the encryption process, a unique identifier UUID is generated for each piece of privacy data, and the encryption metadata is recorded, including the encryption algorithm version, access policy description, timestamp, etc. For particularly sensitive data, homomorphic encryption technology can also be applied, allowing specific calculations to be directly performed on the ciphertext without decryption. For example, using the Paillier encryption algorithm, the sum or average of the data can be calculated in the encrypted state. The implementation effect of this step is to ensure the security of the privacy traceability data during storage and transmission, while providing a flexible access control mechanism to meet the different access requirements of different roles for the data.
[0117] Finally, the public traceability data and the encrypted traceability data are broadcast to the basic traceability chain to generate the basic blockchain ledger of the basic traceability chain. During specific implementation, first, a transaction structure containing the public traceability data and the encrypted traceability data is constructed. The transaction structure includes: a transaction header (version number, timestamp, transaction type identifier, etc.), the data sender address, the smart contract address, the public traceability data field, the encrypted traceability data field, the data hash value, the digital signature, etc. The public traceability data is stored in plaintext, while the encrypted traceability data includes ciphertext and encryption metadata. After the transaction is constructed, it is broadcast to all nodes of the basic traceability chain through the P2P broadcast protocol of the blockchain network. The broadcast uses the Gossip protocol. After each node receives the transaction, it verifies the validity of its format and signature, and then continues to spread it to other nodes. The currently rotating block generation node collects the valid transactions within a certain period of time (such as 30 seconds), and packs the transactions into a block according to a predetermined rule (such as chronological order or transaction fee level). The block structure includes: a block header (the hash of the previous block, timestamp, Merkle root, difficulty target, nonce, etc.) and a block body (containing multiple transactions). After the block is generated, it reaches an agreement in the network through a consensus algorithm (such as PBFT), and at least 2 / 3 of the verification nodes need to confirm that the block is valid. The confirmed block is added to the local ledger of each node to form the basic blockchain ledger. To improve the query efficiency, the node also maintains an index database to record the mapping relationships of key information such as transaction ID, block height, and timestamp. In addition, the blockchain browser function is implemented to allow authorized users to query the public traceability data and (after authorization) decrypt and view the private traceability data through a Web interface. The implementation effect of this step is to form a distributed ledger containing complete traceability information, which not only ensures the openness and transparency of the data but also protects the privacy and security of sensitive information, providing a solid foundation for the trustworthy traceability of the entire product life cycle.
[0118] In one implementation, the data fusion of the same type of comprehensive production data is performed by combining the Bayesian network and the Kalman filter model, and the steps for obtaining the fused traceability data are as follows:
[0119] Use the Kalman filter model to process the same type of comprehensive production data, eliminate the data error of the comprehensive production data, and obtain the benchmark production data;
[0120] Calculate the information gain of the benchmark production data based on the probability distribution;
[0121] Select the target production data set from the benchmark production data according to the information gain;
[0122] Perform data fusion on all the data in the target production data set through the Bayesian network to obtain the fused traceability data.
[0123] In this embodiment, for the integrated production data of the same data type, the Kalman filter model is used to process the integrated production data, eliminate the data error of the integrated production data, and obtain the reference production data. The Kalman filter model is a recursive algorithm that can estimate and correct noise and errors in a dynamic system. Through two steps of prediction and update, the estimated value of the data is continuously adjusted to obtain more accurate reference production data. Specifically, during implementation, the integrated production data can be input into the Kalman filter model, and the prediction and update mechanisms of the model can be used to gradually eliminate the errors and noise in the data, and finally output stable and reliable reference production data.
[0124] Calculate the information gain of the reference production data based on the probability distribution. The principle of this step is to evaluate the contribution degree of each data point in the reference production data to the overall information volume through the concept of information gain in information theory. Information gain can be measured by calculating the entropy value change of the data point in different states. Specifically, during implementation, probability distribution analysis can be performed on the reference production data, and the entropy value change of each data point can be calculated to determine its information gain. Select the target production data set from the reference production data according to the information gain. This step aims to screen out those data points that contribute the most to the overall information volume to ensure the efficiency and accuracy of subsequent data fusion. Specifically, during implementation, according to the information gain value calculated in the previous step, a threshold can be set or a sorting method can be used to select data points with higher information gain to form the target production data set.
[0125] Fuse all the data in the target production data set through a Bayesian network to obtain the fused traceability data. The Bayesian network is a probabilistic graphical model that can represent and calculate the conditional dependence relationship between variables. Through Bayesian inference, multiple data sources can be fused to obtain unified fused data. Specifically, during implementation, the target production data set can be used as the input of the Bayesian network, the network structure can be constructed and parameter learning can be carried out. Through Bayesian inference, different data points can be fused to finally obtain highly consistent and accurate fused traceability data. Through these steps, production data can be effectively processed and fused, improving the reliability and consistency of the data, and providing a solid data foundation for the traceability and management of the production process.
[0126] In one of the embodiments, the step of selecting the target production data set from the reference production data according to the information gain specifically includes the following steps:
[0127] Obtain the data acquisition cost of the reference production data;
[0128] Construct an optimal utility function by combining the information gain and the data acquisition cost;
[0129] Use the optimal utility function to select the target production data set from the reference production data.
[0130] In this embodiment, the data acquisition cost of obtaining the reference production data is obtained. The principle of this step is to evaluate various costs involved in the process of collecting and processing the reference production data, including the usage costs of sensors and devices, data transmission costs, storage costs, and data processing and analysis costs, etc. In specific implementation, the acquisition process of each data point can be analyzed in detail, the costs of each link can be quantified, and finally the data acquisition cost of each data point can be obtained. An optimal utility function is constructed by combining the information gain and the data acquisition cost. The principle of this step is to construct a comprehensive utility function by combining the information gain and the data acquisition cost, so as to consider both the contribution of the data to the amount of information and the cost of obtaining the data when selecting data. In specific implementation, the information gain can be used as the revenue part of the utility function, and the data acquisition cost can be used as the cost part of the utility function. A comprehensive utility function can be constructed through a weighting method or other mathematical methods.
[0131] The target production data set is selected from the reference production data by using the optimal utility function. The principle of this step is to optimize the optimal utility function and select those data points that achieve the best balance between the information gain and the data acquisition cost, ensuring the efficiency and economy of the data. In specific implementation, the reference production data can be traversed or an optimization algorithm such as a greedy algorithm or dynamic programming can be used to calculate the utility value of each data point, and the target production data set is selected according to the size of the utility value, ensuring that the selected data points achieve the optimal balance between the information gain and the acquisition cost. Through these steps, the data points that are most valuable to the production process and have the lowest acquisition cost can be effectively screened out, providing an efficient and economic data basis for subsequent data analysis and decision-making.
[0132] In one of the embodiments, the node attributes further include the device attributes of the embedded devices set on the production nodes, and the device attributes include device storage space, device computing power, and device bandwidth. The steps of selecting core nodes from each basic traceability chain according to the node attributes are as follows:
[0133] Every time a preset interval of time passes, obtain the device attributes corresponding to all blockchain nodes at the current moment;
[0134] Normalize all device attributes;
[0135] According to the preset weight allocation strategy, allocate index weights to the normalized device attributes;
[0136] Combine the device attributes and the corresponding index weights and obtain the node status score of the blockchain node through weighted calculation;
[0137] Select the blockchain node with the highest node status score as the core node at the current moment.
[0138] In this embodiment, every time a preset interval of time elapses, the device storage space, device computing power, and device bandwidth corresponding to all blockchain nodes at the current moment are obtained. Specifically, the key performance indicators of each blockchain node are collected regularly to facilitate subsequent performance evaluation and optimization. In this embodiment, monitoring software can be deployed on each blockchain node to regularly collect and record the storage space, computing power, and bandwidth data of the device, and these data are aggregated to the central management system through the network. The device storage space, device computing power, and device bandwidth are respectively normalized. Specifically, through the normalization method, performance indicators with different dimensions and ranges are converted into standardized data with the same dimension and range, which is convenient for subsequent weighted calculation. In this embodiment, methods such as maximum-minimum normalization and Z-score standardization can be used to convert the storage space, computing power, and bandwidth data of each node into standardized values between 0 and 1.
[0139] According to the preset weight allocation strategy, index weights are respectively assigned to the normalized device storage space, device computing power, and device bandwidth. Specifically, through the preset weight allocation strategy, the importance of each performance indicator in the overall evaluation is determined. In this embodiment, according to the system requirements and business scenarios, the weight ratios of the storage space, computing power, and bandwidth can be set. For example, the storage space weight is 0.3, the computing power weight is 0.4, and the bandwidth weight is 0.3. Then these weights are applied to the normalized data. Based on the index weights and combined with the device storage space, device computing power, and device bandwidth, the node status score of the blockchain node is obtained through weighted calculation. Specifically, through weighted calculation, the normalized value of each performance indicator is multiplied by its corresponding weight and accumulated to obtain the comprehensive status score of each blockchain node. In this embodiment, the normalized storage space, computing power, and bandwidth values of each node can be multiplied by their corresponding weights respectively, and then these weighted values are added to obtain the final status score of each node.
[0140] The blockchain node with the highest node status score is selected as the core node at the current moment. Specifically, by comparing the status scores of each node, the node with the optimal comprehensive performance is selected as the core node to optimize the performance and stability of the blockchain network. In this embodiment, the status scores of all nodes can be sorted, the node with the highest score is selected, and it is set as the core node at the current moment. In this way, it can be ensured that the blockchain network is dominated by the node with the best performance at each moment, improving the overall efficiency and reliability of the network.
[0141] Based on the above embodiments, in one of the embodiments, the node attribute further includes the product category popularity of the production category corresponding to the production node. The double-chain fusion product quality traceability method applied to the production line disclosed by the present invention further includes the following steps:
[0142] Extract the original Huffman tree from the basic blockchain ledger;
[0143] Assign heat weights to all tree nodes in the original Huffman tree based on the product category popularity, and the higher the product category popularity, the greater the heat weight;
[0144] Reconstruct the original Huffman tree into a weighted Huffman tree according to the heat weights and following the principle of minimizing the weighted path;
[0145] Use the weighted Huffman tree to replace the original Huffman tree in the basic blockchain ledger, and save the basic blockchain ledger after the replacement to the core node;
[0146] Calculate the trunk depth of the weighted Huffman tree based on the heat weights and through the Huffman algorithm;
[0147] Screen out the edge tree nodes in the weighted Huffman tree according to the trunk depth to obtain a simplified weighted Huffman tree;
[0148] Use the simplified weighted Huffman tree to replace the weighted Huffman tree in the basic blockchain ledger, and save the basic blockchain ledger after the replacement to all other blockchain nodes except the core node in the basic traceability chain.
[0149] In this embodiment, extracting the original Huffman tree from the basic blockchain ledger is specifically to obtain the basic Huffman tree structure for data compression and encoding from the blockchain ledger for subsequent optimization processing. In this embodiment, the data structure of the blockchain ledger can be parsed to locate and extract the part containing the original Huffman tree, and load it into memory for further processing. Assigning heat weights to all tree nodes in the original Huffman tree based on the product category popularity, and the higher the product category popularity, the greater the heat weight, is specifically to analyze the heat data of the product category and assign corresponding weights to each node in the Huffman tree to reflect its importance in actual applications. In this embodiment, the access frequency or sales data of the product category can be statistically analyzed to calculate the heat value of each category, and then these heat values are used as weights to be assigned to the corresponding nodes in the Huffman tree.
[0150] The original Huffman tree is reconstructed into a weighted Huffman tree according to the heat weight and following the principle of minimizing the weighted path. Specifically, by the principle of minimizing the weighted path, the structure of the Huffman tree is optimized so that the path length of high-heat nodes is as short as possible to improve data access efficiency. In this embodiment, a weighted version of the Huffman algorithm can be used to reconstruct the Huffman tree, making the nodes with higher heat weights closer to the root node in the tree, thereby reducing their access path lengths. The original Huffman tree in the basic blockchain ledger is replaced with the weighted Huffman tree, and the basic blockchain ledger after replacement is saved to the core node. Specifically, by applying the optimized Huffman tree to the blockchain ledger, the encoding efficiency and data access performance of the ledger are improved. In this embodiment, the reconstructed weighted Huffman tree can be used to replace the original Huffman tree, update the relevant parts of the blockchain ledger, and save the updated ledger data to the core node to ensure data consistency and reliability.
[0151] Based on the heat weight and calculated by the Huffman algorithm, the trunk depth of the weighted Huffman tree is obtained. Specifically, by calculating the trunk depth of the weighted Huffman tree, its structural characteristics are evaluated to provide a basis for subsequent node screening. In this embodiment, the Huffman algorithm can be used to calculate the path lengths from the root node to each leaf node in the weighted Huffman tree to determine the maximum depth of the trunk. According to the trunk depth, the edge tree nodes in the weighted Huffman tree are screened out to obtain a simplified weighted Huffman tree. Specifically, by screening out the edge nodes with larger trunk depths, the structure of the Huffman tree is simplified, reducing the overhead of data storage and transmission. In this embodiment, a threshold can be set according to the trunk depth calculated in the previous step, and the edge nodes exceeding the threshold are screened out, retaining the main nodes to form a simplified weighted Huffman tree.
[0152] The weighted Huffman tree in the basic blockchain ledger is replaced with the simplified weighted Huffman tree, and the basic blockchain ledger after replacement is saved to all other blockchain nodes except the core node in the basic traceability chain. Specifically, by applying the simplified Huffman tree to the blockchain ledger, the storage and transmission efficiency of the ledger is further optimized. In this embodiment, the simplified weighted Huffman tree can be used to replace the weighted Huffman tree in the ledger, update the ledger data, and copy and distribute the updated ledger to all other blockchain nodes except the core node to ensure data consistency and efficiency across the blockchain network. Through these steps, the structure and performance of the blockchain ledger can be effectively optimized, improving data access efficiency and the economy of data storage and transmission.
[0153] The present invention also discloses a double-chain fusion product quality traceability system applied to a production line, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the double-chain fusion product quality traceability method applied to the production line described in any of the above embodiments.
[0154] Among them, the processor may adopt a central processing unit (CPU). Of course, according to actual usage, other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. may also be used. The general-purpose processor may adopt a microprocessor or any conventional processor, etc. This application does not make any restrictions in this regard.
[0155] Among them, the memory may be an internal storage unit of the computer device, for example, the hard disk or memory of the computer device, or may also be an external storage device of the computer device, for example, a plug-in hard disk, a smart media card (SMC), a secure digital card (SD), or a flash card (FC) equipped on the computer device, etc. Moreover, the memory may also be a combination of the internal storage unit and the external storage device of the computer device. The memory is used to store the computer program and other programs and data required by the computer device. The memory may also be used to temporarily store the data that has been output or will be output. This application does not make any restrictions in this regard.
[0156] Those of ordinary skill in the art should understand that: The discussion of any of the above embodiments is only exemplary and is not intended to imply that the protection scope of this application is limited to these examples; under the concept of this application, the technical features in the above embodiments or different embodiments can also be combined, and the steps can be implemented in any order, and there are many other variations in different aspects of one or more embodiments in the present application as above. For the sake of brevity, they are not provided in detail.
[0157] One or more embodiments in this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of this application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments in this application shall be included within the protection scope of this application.
Claims
1. A double-chain fusion product quality tracing method applied to a production line, characterized in that: The steps include: Obtaining comprehensive production data and node attributes of multiple production nodes of the target product in different production stages, wherein the node attributes include a unique stage number of the production node corresponding to the production stage; Randomly select multiple production nodes with different stage numbers as initial cluster centers. The number of initial cluster centers is the same as the number of production stages. Based on the node attributes and using the reverse clustering algorithm, all production nodes are clustered based on the initial cluster center to obtain multiple production node clusters; All production nodes in the same production node cluster are used as blockchain nodes to build a basic traceability chain, and all comprehensive production data are integrated to generate a basic blockchain ledger; Select core nodes from each basic traceability chain based on node attributes, and build a quality traceability chain by combining all core nodes; Update the corresponding basic blockchain ledger through the core node, and upload the updated basic blockchain ledger to the quality traceability chain; Use the quality traceability chain to query the product quality traceability data of the target product.
2. The double-chain fusion product quality tracing method applied to a production line according to claim 1, characterized in that: The node attributes also include the production capacity index and production category number of the production node. The production category number of each production node is different. Based on the node attributes and using the reverse clustering algorithm, all production nodes are clustered based on the initial cluster center to obtain multiple production node clusters, including the following steps: Taking the maximization of the difference of stage number or production category number as the clustering target, all other production nodes are clustered to the initial clustering center to obtain multiple initial clustering clusters; The first optimization target is generated by combining the stage number and the production category number; Encode all initial clustering clusters as an initial generation population, optimize the initial generation population using a genetic algorithm according to the first optimization goal, and obtain an optimal generation population; generating a second optimization objective based on the production capacity index; The optimal first-generation population is used as the initial second-generation population, and the initial second-generation population is optimized by using a genetic algorithm according to the second optimization objective to obtain the optimal second-generation population; The optimal second-generation population is decomposed into multiple production node clusters in the form of clusters.
3. The double-chain fusion product quality tracing method applied to a production line according to claim 2 is characterized in that: The expression formula of the first optimization objective is as follows: Where: F1 represents the first optimization goal, max(·) represents the maximum function, N represents the number of clusters in the initial generation population, M n Indicates the number of production nodes in the nth initial clustering cluster, represents the stage number of the mth production node in the nth initial cluster. represents the mean of the stage numbers of all generated nodes in the nth initial cluster, Indicates the production category number of the mth production node in the nth initial cluster. Represents the mean of the production category numbers of all generated nodes in the nth initial cluster.
4. The double-chain fusion product quality tracing method applied to a production line according to claim 3 is characterized in that: The expression formula of the second optimization objective is as follows: Where: F2 represents the second optimization objective, min(·) represents the minimum function, represents the mean production capacity index of all production nodes in the nth initial cluster, Represents the production capacity index of the mth production node in the nth initial cluster.
5. The double-chain fusion product quality tracing method applied to a production line according to claim 1 is characterized in that: Using all production nodes in the same production node cluster as blockchain nodes to build a basic traceability chain, and integrating all comprehensive production data to generate a basic blockchain ledger includes the following steps: All production nodes in the production node cluster are used to build a basic traceability chain in the form of a consortium chain; Upload the comprehensive production data corresponding to all production nodes to the basic traceability chain by creating block transactions; Combine the Bayesian network and Kalman filter model to fuse the same type of comprehensive production data to obtain fused traceability data, which includes public traceability data and private traceability data. Encrypt the privacy traceability data into encrypted traceability data through a preset encryption algorithm; Broadcast the public traceability data and encrypted traceability data to the basic traceability chain to generate the basic blockchain ledger of the basic traceability chain.
6. The double-chain fusion product quality tracing method applied to a production line according to claim 5 is characterized in that: Combining the Bayesian network and Kalman filter model to fuse the same type of comprehensive production data to obtain fused traceability data includes the following steps: The Kalman filter model is used to process the same type of comprehensive production data, eliminate the data error of the comprehensive production data, and obtain the benchmark production data; Calculate the information gain of the benchmark production data based on the probability distribution; Selecting a target production data set from the benchmark production data based on information gain; All data in the target production data set are fused through the Bayesian network to obtain fused traceability data.
7. The double-chain fusion product quality tracing method applied to a production line according to claim 6, characterized in that: Selecting the target production data set from the benchmark production data based on information gain includes the following steps: Data acquisition costs to obtain baseline production data; Construct the optimal utility function by combining information gain and data acquisition cost; The target production data set is selected from the benchmark production data using the optimal utility function.
8. The double-chain fusion product quality tracing method applied to a production line according to claim 1, characterized in that: The node attributes also include the device attributes of the embedded device set by the production node, which include device storage space, device computing power and device bandwidth. Selecting the core nodes from each basic traceability chain according to the node attributes includes the following steps: After each preset interval, obtain the device attributes corresponding to all blockchain nodes at the current moment; Normalize all device attributes; Assign indicator weights to the normalized device attributes according to a preset weight allocation strategy; The node status score of the blockchain node is obtained by combining the device attributes and the corresponding indicator weights through weighted calculation; The blockchain node with the highest node status score is selected as the core node at the current moment.
9. The double-chain fusion product quality tracing method applied to a production line according to claim 8, characterized in that: The node attribute also includes the product category heat of the production category corresponding to the production node, and the method also includes the following steps: Extract the original Huffman tree from the underlying blockchain ledger; Assign heat weights to all tree nodes in the original Huffman tree based on the heat of the product category; The original Huffman tree is reconstructed into a weighted Huffman tree according to the heat weight and following the principle of minimizing the weighted path; Use the weighted Huffman tree to replace the original Huffman tree in the basic blockchain ledger, and save the replaced basic blockchain ledger to the core node; The trunk depth of the weighted Huffman tree is calculated based on the heat weight and through the Huffman algorithm; The edge tree nodes in the weighted Huffman tree are screened out according to the trunk depth to obtain a simplified weighted Huffman tree; The weighted Huffman tree in the basic blockchain ledger is replaced with the simplified weighted Huffman tree, and the replaced basic blockchain ledger is saved to all blockchain nodes except the core node in the basic traceability chain.
10. A dual-chain fusion product quality traceability system applied to a production line, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the double-chain fusion product quality tracing method applied to the production line as claimed in any one of claims 1 to 9.
Citation Information
Patent Citations
Blockchain-based grain and oil food full supply chain credible tracing model based on block chain and construction method
CN110516965A
Planting industry agricultural product tracing method based on multi-chain fusion
CN116542681A
IDPC algorithm-based industrial chain data feature reconstruction method
CN116881702A
Power grid system partitioning method and device, storage medium and computer equipment
CN117458442A
Block chain-based asset processing traceability method and system
CN118505398A
Cited By
Logistics traceability system and method based on block chain technology
CN120525433A
Dual-carbon intelligent data management method and system
CN120578720A
A dual-carbon intelligent data management method and system
CN120578720B
Copper pipe quality tracing data storage method and system
CN120631904A
Workflow engine task allocation data traceability method in LIMS
CN122472709A