Self-adaptive fault diagnosis method for traditional Chinese medicine granulation production line based on digital twinning and transfer learning

By constructing a dynamic digital twin framework and a deep transfer learning model, the problem of fault diagnosis in the Chinese medicine granulation production line under varying operating conditions was solved, achieving high-precision, real-time fault warning and diagnosis, adapting to the needs of multi-variety, small-batch production, and improving the stability and efficiency of equipment operation.

CN121743979APending Publication Date: 2026-03-27KUNMING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-15
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

In the process of traditional Chinese medicine granulation production, there are many types of equipment with strong coupling and complex failure modes. Existing technologies cannot effectively solve the problems of data distribution deviation, scarcity of fault samples and weak model generalization ability under varying operating conditions, resulting in high false alarm and false negative rates, and failing to meet the needs of real-time diagnosis.

Method used

We employ a digital twin and transfer learning approach to construct a dynamic and transferable digital twin framework. By combining it with a deep transfer learning model (STFusionCNN), we can achieve rapid and high-precision diagnosis under conditions of scarce fault data. Through a multi-level transfer system and adaptive strategies, we can identify changes in operating conditions and improve the model's adaptability and diagnostic accuracy.

Benefits of technology

It enables early warning of faults under varying operating conditions, improves the accuracy and robustness of fault diagnosis, reduces reliance on historical fault data, adapts to the multi-variety, small-batch production mode of traditional Chinese medicine granulation production lines, and has good engineering practicality and interpretability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121743979A_ABST
    Figure CN121743979A_ABST
Patent Text Reader

Abstract

The invention discloses a traditional Chinese medicine granulation production line adaptive fault diagnosis method based on digital twinning and transfer learning, and belongs to the technical field of industrial intelligent manufacturing. The method comprises the following steps: collecting multi-source heterogeneous data of a granulation production line and constructing a space-time diagram structure; establishing a high-fidelity digital twinborn model to realize virtual-real mapping; starting an adaptive migration strategy based on working condition identification, adopting a feature layer freezing fine tuning strategy for similar working conditions, and adopting a spatial feature freezing retraining strategy for different working conditions; constructing an STFusion CNN fusion model, integrating CNN local feature extraction, Swin Transform global dependency capture and GRU time sequence modeling capability, and realizing multi-scale feature fusion through a gating attention mechanism; and finally outputting a fault prediction result and triggering early warning. According to the method, the problem of model mismatching under variable working conditions is solved, high-precision fault diagnosis under small sample conditions is realized, the accuracy rate on a traditional Chinese medicine granulation production line reaches 98% or above, and the equipment operation and maintenance efficiency and the production reliability are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial intelligent manufacturing and equipment health management technology, specifically a fault diagnosis method for traditional Chinese medicine granulation production lines that integrates digital twin and transfer learning. More specifically, this invention is applicable to traditional Chinese medicine granulation production lines operating under multi-variety, small-batch, and variable-condition production conditions. It enables real-time status monitoring, accurate fault prediction, and adaptive diagnosis of key equipment such as wet granulators, fluidized bed dryers, mixers, and filling machines, solving the problem of model failure caused by fluctuations in operating conditions. Background Technology

[0002] The production process of traditional Chinese medicine (TCM) granulation involves multiple complex steps, including extraction, concentration, drying, granulation, blending, and packaging. It is characterized by a wide variety of products, small batches, and frequent fluctuations in operating conditions. Granulation, as a core step, directly affects the quality of the medicine (e.g., particle size distribution, moisture content) and production efficiency. However, TCM production lines involve a wide variety of equipment with strong coupling and complex failure modes. These include both "local mechanical failures" such as servo motor overload, transmission mechanism wear, and bearing damage, and "system-level misalignment" caused by the interaction of process parameters (e.g., material viscosity, ambient temperature and humidity). More importantly, under "variable operating conditions" such as switching between different product specifications, changes in environmental parameters, and equipment performance degradation, the data distribution of equipment operation will significantly shift (i.e., concept drift). This leads to a sharp decline in the performance of fault diagnosis models trained on historical data, resulting in a "mismatch" phenomenon and increased false alarm and false negative rates.

[0003] Currently, the mainstream technical solutions in this field and their limitations include:

[0004] (1) Mechanism-based modeling: It relies on precise physical equations and equipment parameters, and the modeling process is complex. For the complex biochemical process of traditional Chinese medicine production, it is difficult to establish a precise general model, and the model is difficult to update. It cannot adapt to the dynamically changing production conditions and has poor practicality.

[0005] (2) Traditional machine learning methods, such as support vector machine (SVM) and random forest, require a lot of manual feature engineering. They have limited ability to process high-dimensional, nonlinear and strongly coupled industrial time series data, and the models have insufficient generalization ability, making it difficult to cope with unknown fault types and changes in working conditions. They rely heavily on expert experience.

[0006] (3) Single-model methods based on deep learning: such as convolutional neural networks (CNN), long short-term memory networks (LSTM) and their combinations (CNN-LSTM), although they can automatically extract features, are mostly "one model for one working condition" and lack the ability to transfer knowledge across working conditions. When the working conditions change, a large amount of labeled data needs to be collected again for training, which is costly and has poor timeliness, and cannot meet the needs of online real-time diagnosis.

[0007] (4) Static digital twin model: Current research focuses on building high-fidelity virtual models to achieve visual monitoring. However, once the model is built, it is relatively fixed and lacks the "adaptive" ability to evolve synchronously with the physical entity based on real-time working conditions and optimize autonomously. Its predictive function is not reliable under changing working conditions and becomes "advanced animation", failing to give full play to the predictive insight value of digital twin.

[0008] Therefore, existing technologies cannot effectively solve the three core challenges faced by traditional Chinese medicine granulation production lines under varying operating conditions: data distribution deviation, scarcity of fault samples, and weak model generalization ability. There is an urgent need for an intelligent fault diagnosis method that enables digital twin models to have autonomous evolution capabilities and can quickly transfer existing knowledge to new operating conditions. Summary of the Invention

[0009] The primary objective of this invention is to overcome the shortcomings of existing technologies and provide an adaptive fault diagnosis method for traditional Chinese medicine granulation production lines based on digital twins and transfer learning. This method aims to achieve the following goals by constructing a dynamically transferable digital twin framework and integrating a novel deep transfer learning model (STFusionCNN):

[0010] (1) Enhance the adaptability and self-evolution of digital twin models to dynamic changes in production conditions, transforming them from "static mirror images" into "dynamic intelligent agents";

[0011] (2) To solve the problem of scarce fault data under target operating conditions, the transfer learning mechanism is used to achieve rapid and high-precision fault diagnosis under small sample or even zero sample conditions, thereby reducing the dependence on the accumulation of historical fault data.

[0012] (3) Accurately capture the evolution and propagation patterns of equipment faults in the spatiotemporal dimension (internal migration and inter-fault migration) to achieve early warning of complex fault chains;

[0013] (4) Provide a complete, reliable and practical technical solution and tools for predictive maintenance and intelligent operation and maintenance of Chinese medicine granulation production lines.

[0014] To achieve the above objectives, the present invention adopts the following technical solution:

[0015] An adaptive fault diagnosis method for a traditional Chinese medicine granulation production line based on digital twins and transfer learning includes the following steps:

[0016] S1. Construction of Real-time Mapping Mechanism for Digital Twin Model and Acquisition of Multi-Source Heterogeneous Data: Construct a high-fidelity digital twin model and a real-time mapping mechanism. The digital twin model achieves dynamic simulation, real-time monitoring and intelligent optimization of the production process through the close integration of virtual and physical production lines. In the physical production line, the PLC system serves as the core data acquisition terminal, and collects early warning data from multiple devices in the Chinese medicine granulation production line through high-precision real-time monitoring functions, forming multi-source heterogeneous data.

[0017] S2. Data preprocessing: The multi-source heterogeneous data obtained in S1 is subjected to cleaning, denoising and normalization preprocessing operations in sequence to obtain multi-source time series data with uniform format;

[0018] S3. Develop a migration process for an adaptive fault diagnosis method for a TCM granulation production line based on digital twins and transfer learning. This process constructs a multi-level dynamic migration system. The digital twin model migration is divided according to the different objects being migrated, namely, digital twin model migration within the same type of fault diagnosis and between different fault diagnoses.

[0019] S4. Formulate adaptive migration strategy decision based on working condition identification: Input multi-source time series data into a multi-level dynamic migration system to identify the current working condition in real time. If the working conditions are similar, adopt intra-fault migration strategy 1; if the working conditions are different, adopt inter-fault migration strategy 2. Finally, output the fault prediction result.

[0020] S5. Online Fault Diagnosis and Early Warning: Synchronize fault prediction results with the digital twin model and trigger early warnings within the digital twin model.

[0021] S1 specifically includes the following steps:

[0022] S11. Based on the physical structure of the production line, equipment relationships, and process characteristics, a digital twin model covering key processes is constructed. First, in the physical production line, the operation process of traditional Chinese medicine granulation is clarified, the moving parts of the equipment are identified, and the motion behavior and parent-child relationship of the decomposed moving parts are defined. Simultaneously, in the virtual twin, the digital twin is constructed, a visual model of the traditional Chinese medicine granulation production line is built, and the production line behavior logic is scripted. Then, an OPCUA data interface is established based on the physical production line, and a data interaction interface is established between the virtual twin and the physical production line to communicate. Data collection is carried out on equipment operation data, production count data, regulatory code data, equipment monitoring data, and equipment early warning data to achieve a virtual-real mapping effect.

[0023] S12. The digital twin model achieves two-way interaction between the virtual and the real through a real-time mapping mechanism. The digital twin model and the actual production line achieve two-way data communication through OPC / PLC, industrial bus or edge acquisition device. The real-time collected equipment operation data, production count data, supervision code data and equipment monitoring data are continuously mapped into the digital twin model, so that the twin keeps synchronized with the physical entity in the state space.

[0024] The data collected by S13 and OPC / PLC serves two purposes: firstly, real-time data from the physical production line drives the updating of the digital twin model; secondly, equipment early warning data becomes a multi-source dataset for the adaptive migration strategy of fault identification under varying operating conditions.

[0025] Specifically, the multi-layered dynamic migration system in S3 adopts a three-layer architecture and forms a bidirectional migration path that is interwoven vertically and horizontally.

[0026] S31, Top layer is the working condition layer It consists of five modules with data acquisition capabilities. Each module independently processes small-scale field data to achieve preliminary data perception and acquisition.

[0027] S32. The intermediate model transfer layer uses a digital twin model to perform deep feature extraction on the preprocessed multi-source time series data, thereby realizing knowledge transfer and sharing across working conditions.

[0028] S33, the underlying layer is an algorithm model library, covering diagnostic strategy modules under varying operating conditions. This supports hierarchical fault diagnosis decision-making from level one to level four.

[0029] S34. The digital twin model achieves efficient transformation from raw data features to diagnostic strategies through a vertical migration path, that is, from the working condition layer to the model migration layer and then to the algorithm model library. At the same time, with the help of the horizontal migration path, it promotes the dynamic updating of the algorithm model library and the iterative optimization of diagnostic knowledge. The data flow runs through the entire process of data acquisition, preprocessing, feature library and production library, and builds a dynamic migration system that integrates data acquisition, model migration, algorithm calling and decision output.

[0030] The specific steps of S4 are as follows:

[0031] S41. Construct the STFusionCNN fusion model. The model uses multi-source time-series data and outputs predicted values. Its architecture includes the following components: Convolutional CNN layer: extracts local features through one-dimensional convolution, with 128 output channels; Projection layer: maps the feature dimension of the CNN output from 128 to the model dimension; Positional encoding: adds positional information to the sequence; Swing Transformer layer: captures local and global dependencies in the sequence through a window self-attention mechanism, containing multiple blocks, with some blocks using shifted windows to enhance global modeling; GRU: models long-term dependencies in the time series and outputs the hidden state of the last time step; Output MLP layer: maps the GRU output to the signal prediction dimension to generate the final result. Input the existing multi-source time-series data from multiple operating conditions into STFusionCNN for training to form the source model. ;

[0032] S42, Fault Intra-Transfer Strategy 1 is a digital twin model transfer strategy within the same fault diagnosis. It fixes the feature extractor parameters in the pre-trained source model STFusionCNN, which consists of CNN and Swing Transformer layers. It only uses the target working condition data to adjust the parameters of the GRU layer and MLP output layer at the top of the pre-trained source model. It inputs multi-source time series data into STFusionCNN for fault diagnosis and outputs the prediction results.

[0033] The pre-trained source model is updated using fault in-transfer strategy 1. Based on the source model Corresponding working conditions The following fault characteristic data, For working conditions The original production data below, For source model Corresponding working conditions The characteristic data below; where n=1,2,3,…,n represents different working conditions;

[0034] The implementation steps of fault migration strategy 1 are as follows: Step 1: The fault feature data of the two faults under similar operating conditions are similar, and the source model is fixed. The parameters of CNN and Swing Transformer in case 1 Examples of similar working conditions, through Feature data parameter fine-tuning The model is used to obtain the transferred algorithm model. And save it to the algorithm model library; Step 2: Obtain the transferred model, update the model, and store the data. The transferred model diagnoses new operating conditions Real-time faults.

[0035] S43, Fault Transfer Strategy 2 is a digital twin model transfer strategy between different fault diagnoses. It selects the pre-trained source model that best matches the target working condition from the algorithm model library, freezes the parameters of its CNN layer and Swing Transformer layer, re-initializes and trains the GRU layer and MLP output layer, and inputs multi-source time series data to perform fault diagnosis and output prediction results.

[0036] When changes in operating conditions significantly affect the distribution of feature data, an adaptation method is used to update the source model. Indicates working conditions The following fault characteristic data, For working conditions The original production data below, The working conditions corresponding to the source model Based on the feature data, suitable source models are obtained from the algorithm model library during the fault diagnosis transfer process. Subsequently, through fault migration strategy 2, The system was updated to ultimately provide a solution suitable for the new operating conditions. Algorithm model ;

[0037] The implementation steps of fault migration strategy 2 are as follows:

[0038] Step 1: Based on the target working conditions Use the index to retrieve the corresponding production data. ;

[0039] Step 2: Based on Characteristic data of the target working condition Combining transfer learning theory with the source model Migrate and update to build a system suitable for new operating conditions. Algorithm model .

[0040] Preferably, the Swin Transformer layer uses a shift window mechanism to compute multi-head self-attention, and its window size is configurable, which is used to efficiently capture global long-range dependencies in time series.

[0041] Preferably, the warning in step S5 is displayed through a digital twin visualization interface and presented in the form of color changes, animation effects, and pop-up messages. At the same time, the warning signal is uploaded to the upper-level information management system through a standard industrial communication protocol.

[0042] Preferably, the digital twin model is developed based on the Unity3D engine and supports 3D model-driven, real-time data binding and interactive operation; the adaptive fault diagnosis method for the TCM granulation production line using digital twin and transfer learning integrates a clustering algorithm, which can automatically classify real-time operating conditions and match them with a historical operating condition database.

[0043] The beneficial effects of this invention are:

[0044] 1. Dynamic Adaptation and Strong Generalization Ability: Through the "Work Condition Identification-Transfer Strategy" decision-making mechanism, the model can actively perceive and adapt to changes in work conditions, solving the fundamental problem of performance degradation of static models under varying work conditions, and greatly improving the model's generalization performance, robustness and practical scope.

[0045] 2. Superior Fault Prediction Accuracy: The proposed STFusionCNN model is a highly efficient hybrid architecture that deeply integrates the local feature extraction capabilities of CNNs, the global dependency modeling capabilities of Swing Transformers, and the fine-grained temporal dynamic capture capabilities of GRUs. It can fully exploit the complex spatiotemporal characteristics of industrial data, thereby achieving diagnostic accuracy far exceeding that of traditional single models. Figure 8 Comparative experiments show that the accuracy rate can reach over 0.98.

[0046] 3. Effectively solves the problem of small sample learning: The innovative transfer learning mechanism allows the model to make full use of the large amount of general knowledge learned under the source conditions, and only requires a very small number of new samples under the target conditions to achieve high performance. This effectively reduces the enterprise's dependence on the accumulation of historical fault data, and is particularly suitable for the "multi-variety, small-batch" production mode of traditional Chinese medicine, which greatly reduces the threshold and cost of model application.

[0047] 4. Strong Systemic and Engineering Applicability: This invention is not merely a simple algorithm improvement, but rather the construction of a complete technical system encompassing data perception, twin modeling, intelligent algorithms, and decision-making applications (architecture as follows). Figure 1 As shown in the figure, it is closely integrated with industrial field systems (such as PLC, SCADA, MES) to form an application closed loop of "digital twin-transfer learning-fault diagnosis", which has good practical application value and promotion prospects.

[0048] 5. Enhanced Knowledge Transferability and Interpretability: The model can learn common characteristics among different devices and faults, enabling effective knowledge transfer and reuse. Simultaneously, the attention weight distribution in the Swin Transformer can provide a basis for model decision-making to some extent, indicating which time steps and variables are most critical for fault diagnosis, thus enhancing the model's interpretability and helping engineers trust and adopt diagnostic results. Attached Figure Description

[0049] Figure 1 This is the real-time mapping mechanism for the traditional Chinese medicine granulation production line of the system described in this invention;

[0050] Figure 2 This is the digital twin model migration process of the present invention;

[0051] Figure 3 This is a flowchart illustrating the framework of the similar fault migration strategy (strategy 1) of this invention.

[0052] Figure 4 This is a flowchart illustrating the framework of the migration strategy (strategy 2) between dissimilar faults in this invention.

[0053] Figure 5 The following are performance comparison charts for four different transfer learning modes (Model1-Model4) of this invention, i.e., comparison charts of fault experiment indicators under different models, where (a) is a comparison chart of accuracy values ​​of different models; (b) is a comparison chart of precision values ​​of different models; and (c) is a comparison chart of F1 score values ​​of different models.

[0054] Figure 6 This is a performance comparison chart of the present invention on migration tasks (A→C, B→D, C→A, D→B) with similar faults, where (a) is a comparison chart of Accuracy values ​​under different migrations; (b) is a comparison chart of Precision values ​​under different migrations; and (c) is a comparison chart of F1 Score values ​​under different migrations.

[0055] Figure 7 This is a performance comparison chart of the present invention on migration tasks between dissimilar faults (such as A→B, A→D, B→A, etc.), where (a) represents a comparison chart of Accuracy, Precision, and F1 Score values ​​under A→C migration; (b) represents a comparison chart of Accuracy, Precision, and F1 Score values ​​under B→D migration; (c) represents a comparison chart of Accuracy, Precision, and F1 Score values ​​under C→A migration; and (d) represents a comparison chart of Accuracy, Precision, and F1 Score values ​​under D→B migration.

[0056] Figure 8This is a comparison chart of the overall performance of the STFusionCNN model of this invention with the Swin Transformer, Transformer, and CNN-LSTM benchmark models under different transfer scenarios. (a) shows the comparison chart of the Accuracy, Precision, and F1 Score values ​​of the four models without transfer to dataset A; (b) shows the comparison chart of the Accuracy, Precision, and F1 Score values ​​of the four models under transfer from A to B; (c) shows the comparison chart of the Accuracy, Precision, and F1 Score values ​​of the four models under transfer from A to C; and (d) shows the comparison chart of the Accuracy, Precision, and F1 Score values ​​of the four models under transfer from A to D.

[0057] Figure 9 A schematic diagram of the application verification interface of the digital twin model for fault early warning in a traditional Chinese medicine granulation workshop. Detailed Implementation

[0058] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. These embodiments are implemented based on the technical solution of the present invention, but the scope of protection of the present invention is not limited to the following embodiments.

[0059] Example 1: As Figure 1-9 As shown, an adaptive fault diagnosis method for a traditional Chinese medicine granulation production line based on digital twins and transfer learning includes the following steps:

[0060] S1. Real-time mapping mechanism of digital twin model and acquisition of multi-source heterogeneous data:

[0061] like Figure 1 As shown, this invention constructs a real-time mapping mechanism and cross-domain data interaction system based on a digital twin model.

[0062] (1) Physical layer data acquisition and PLC control system

[0063] In actual production lines, the PLC system serves as the core data acquisition unit, acquiring various process operation information in real time through high-precision monitoring. The PLC is primarily responsible for collecting the operating status, process parameters, and alarm information of key equipment such as packaging machines, counting machines, and cartoning machines. Relying on the OPC UA standard interface, the PLC can continuously collect multi-dimensional data such as temperature, humidity, pressure, current, and speed with millisecond-level accuracy, providing high-frequency dynamic drive signals for the digital twin model. PLC data forms the foundation for real-time mapping of the digital twin, enabling the system to accurately reflect the operating status of the physical equipment and providing reliable data support for subsequent predictive analysis and process optimization.

[0064] (2) Digital twin modeling and virtual-real mapping

[0065] Digital twin models construct high-fidelity virtual production line models based on data collected by PLCs. These models not only reconstruct the geometric structure and assembly relationships of equipment but also dynamically simulate process behaviors such as energy consumption characteristics and process fluctuations. In terms of forward mapping, any state change of the physical production line is instantly synchronized in the virtual space.

[0066] (3) Intelligent predictive and optimization control based on PLC data

[0067] The continuous time-series data provided by PLCs not only drives virtual-real mapping but also offers a rich source of features for intelligent analysis and prediction. By acquiring PLC data to form multi-source heterogeneous data, and processing this heterogeneous data to form multi-source time-series data, feature extraction and anomaly identification can be performed on the multi-source time-series data. The digital twin model can then use deep learning models to predict equipment failure trends and locate key features, thereby identifying potential risks in advance and providing a basis for intelligent optimization of the production process.

[0068] Based on the prediction results, the digital twin model can feed back the optimized control strategy to the physical equipment. When the system detects anomalies or potential faults, it can adjust process parameters or optimize control settings based on the analysis results of the virtual model, thereby achieving real-time adjustment of production equipment and ensuring the stability and efficiency of the process.

[0069] (4) Cross-domain data interaction and closed-loop control mechanism

[0070] Cross-domain data interaction is a key step in achieving deep collaboration between physical and virtual systems. Digital twin models enable bidirectional data flow through multiple types of interfaces, ensuring that the virtual model and physical devices remain continuously synchronized.

[0071] In terms of data transmission, the PLC transmits equipment status, process data, and alarm information to the virtual system in real time through standardized communication mechanisms such as OPC UA and Socket; the virtual model then uses this data for dynamic simulation and model updates. Regarding closed-loop control, the overall system forms a closed-loop operation mechanism of "data acquisition—twin modeling—intelligent prediction—optimization feedback".

[0072] S2. Multi-source heterogeneous data acquisition and preprocessing:

[0073] Multi-source heterogeneous data were collected from the traditional Chinese medicine granulation production line. This data was acquired through equipment PLCs, sensors, SCADA systems, and MES systems, and mainly includes:

[0074] Equipment operating data: such as motor current, voltage, speed, torque, bearing vibration signal, and temperature;

[0075] Equipment monitoring data: such as material flow rate, adhesive addition rate, pot pressure, inlet / outlet temperature, wind speed, motor power;

[0076] Regulatory code data: such as product batch number, work order information, product specifications, etc.

[0077] Equipment warning data: such as temperature imbalance, servo failure, abnormal current, etc.;

[0078] The above-mentioned multi-source heterogeneous data is cleaned (by handling missing values ​​and outliers), denoised (using filtering algorithms), and normalized (Min-Max or Z-Score standardization) to obtain multi-source time series data.

[0079] S3. Develop a transfer process for an adaptive fault diagnosis method for traditional Chinese medicine granulation production lines based on digital twins and transfer learning:

[0080] Digital twin model migration can be divided according to the different objects being migrated: migration within the same type of fault diagnosis and migration between different fault diagnoses. For example... Figure 2 As shown in the diagram, this framework constructs a multi-layered dynamic migration system, adopting a three-layer architecture and forming a bidirectional migration path that interweaves vertical and horizontal connections. The top layer is the working condition layer (…). The system consists of five modules with data acquisition capabilities, each capable of independently processing small-scale field data to achieve initial data perception and acquisition. The middle model transfer layer uses a physical model to perform deep feature extraction on the preprocessed data, thereby enabling knowledge transfer and sharing across different working conditions. The bottom layer is an algorithm model library, covering diverse diagnostic strategy modules (…). This supports hierarchical fault diagnosis decisions from level one to level four. The digital twin model achieves efficient transformation from raw data features to diagnostic strategies through a vertical migration path. Simultaneously, it drives dynamic updates to the algorithm library and iterative optimization of diagnostic knowledge through a horizontal migration path.

[0081] It is the source model; This is the initial operating condition; These are different working conditions; They are The algorithm model is as follows; fault diagnosis 1-4 diagnoses faults under different operating conditions. Figure 2 The system's architecture is designed to achieve dynamic modeling through two core layers: the operating condition layer is responsible for defining and recording the product's operating parameters and data acquisition standards under diverse production conditions; the model migration layer is configured with an adaptive mechanism that can trigger parameter reconstruction and knowledge transfer of the digital twin model in real time when the operating condition parameters deviate from the set threshold, thereby achieving intra-fault migration and inter-fault migration.

[0082] S4. Develop adaptive migration strategy decisions based on working condition identification.

[0083] (1) STFusionCNN Fusion Model Construction and Training: A deep learning model called STFusionCNN is constructed, whose core structure includes the following:

[0084] 1. One-dimensional CNN layer: Multiple one-dimensional convolutional kernels are used to perform sliding window convolution operations on the input multivariate time-series signal to extract local feature patterns and high-frequency features.

[0085] 2. Projection Layer: A fully connected layer that maps the feature dimensions of the CNN output to a unified high-dimensional feature space (such as 256 dimensions) to meet the requirements of the subsequent Transformer structure.

[0086] 3. Positional Encoding: Add learnable positional encoding information to each time step in the sequence, enabling the model to perceive and understand the temporal order and making up for the positional insensitivity of the self-attention mechanism itself.

[0087] 4. Swing Transformer Layer: Employs a Shifted Window (SWindow) mechanism for multi-head self-attention (MSA) computation. The sequence is divided into non-overlapping windows, and attention is computed within each window. Cross-window information exchange is then achieved through the shifted window mechanism. This significantly reduces computational complexity and efficiently captures long-range dependencies and global context information between different time steps.

[0088] 5. Bidirectional Gated Recurrent Unit (Bi-GRU) layer: Further models the forward and backward long-term time dependencies of the sequence, enhances the ability to capture the evolution of complex time dynamic characteristics, and makes up for the possible shortcomings of Transformer in local fine-grained time series modeling.

[0089] 6. Multilayer Perceptron (MLP) Output Layer: The output of the Bi-GRU undergoes a nonlinear transformation, ultimately outputting the failure probability or specific health status prediction value (such as Remaining Useful Life, RUL) for each node. The model is pre-trained using historical normal and fault data. The loss function is selected based on the task type: Mean Squared Error (MSE) for regression prediction or Cross-Entropy for fault classification.

[0090] (2) Transfer strategy for similar fault diagnosis in digital twin models

[0091] When changes in operating conditions have a minimal impact on data distribution, it falls under the category of intra-fault migration within similar faults, requiring the use of intra-fault migration strategy 1 to update the model. The migration strategy is as follows: Figure 3As shown, Based on the source model Corresponding working conditions The following fault characteristic data. Among them, Indicates working conditions The following fault characteristic data, For working conditions The original production data below, The working conditions corresponding to the source model The following feature data.

[0092] The implementation steps of fault migration strategy 1 are as follows:

[0093] Step 1: Since the fault characteristic data of the two types of faults under similar operating conditions are similar, the parameters of the first few layers of the source model are fixed. Through... Feature data parameter fine-tuning The model is used to obtain the transferred algorithm model. And save it to the model library.

[0094] Step 2: Obtain the migrated model, update the model, and store the data. The transferred model can diagnose new operating conditions. Real-time fault detection and storage of production data in the database.

[0095] (3) Transfer strategy between different fault diagnoses in digital twin models

[0096] When changes in operating conditions significantly impact data distribution, it falls under the category of inter-fault migration, requiring the use of inter-fault migration strategy 2 to update the model. This strategy addresses the issue of differing data distributions across various operating conditions. When changes in operating conditions significantly affect the distribution of feature data, there are often significant differences in feature data under different operating conditions. Therefore, for such complex operating condition changes, this invention proposes an adaptation method by updating the source model, the overall process of which is as follows: Figure 4 As shown. Among them, Indicates working conditions The following fault characteristic data, For working conditions The original production data below, The working conditions corresponding to the source model The feature data is as follows. Similar to model migration under intra-fault migration conditions, in inter-fault diagnosis migration, a suitable source model needs to be matched and obtained from the model library. Subsequently, a migration strategy was implemented. The system was updated to ultimately provide a solution suitable for the new operating conditions. Algorithm model .

[0097] The implementation steps of fault migration strategy 2 are as follows:

[0098] Step 1: Based on the target working conditions Use the index to retrieve the corresponding production data. .

[0099] Step 2: Based on Characteristic data of the target working condition Combining transfer learning theory with the source model Migrate and update to build a system suitable for new operating conditions. model .

[0100] The system monitors the production line's operating status in real time, extracts feature vectors representing the operating conditions (such as average power, main frequency components, key parameter settings, etc.) from the data stream, and matches them with the historical operating condition database using unsupervised clustering algorithms (such as K-Means) or supervised classification algorithms to calculate similarity and determine the similarity between the current operating condition and the historical operating condition database.

[0101] S5. Online Fault Diagnosis and Early Warning:

[0102] After the real-time acquired data stream undergoes preprocessing in step S2, it passes through the dynamic migration system in step S3, and finally is input into the STFusionCNN fusion model in step S4. The STFusionCNN fusion model outputs the fault diagnosis status of each device node in real time. Multi-level warning thresholds are set; when the predicted value or probability exceeds the threshold, the corresponding level of warning is automatically triggered (e.g., yellow alert, orange alarm, red emergency shutdown suggestion), and this is communicated through a digital twin model (application interface such as...). Figure 9 As shown, the system can highlight and display animated warnings, and can also notify the MES / ERP system via API interface or notify on-site staff via SMS or email, forming a closed-loop intelligent operation and maintenance system from perception and decision-making to execution.

[0103] Example 2: The present invention will be described in detail below with reference to a specific case.

[0104] Application of fault diagnosis in the granulation production line of a traditional Chinese medicine company.

[0105] 1. Data Acquisition and Preprocessing

[0106] To verify the effectiveness of the proposed fault diagnosis method for traditional Chinese medicine granulation based on deep transfer learning using digital twins, this invention was practically applied to a traditional Chinese medicine granulation production line in a process manufacturing enterprise. The dataset used was production data collected from the PLC under normal production conditions on the traditional Chinese medicine production line, spanning from September 3, 2024 to October 20, 2024. The data was analyzed, and fault locations were distributed across four machines: the filling machine, cartoning machine, secondary counter, and heat shrink machine. The dataset was divided into four datasets: A, B, C, and D, as shown in Table 1. The mechanical execution equipment (filling machine A, cartoning machine C) and the electrical control equipment (secondary counter B, heat shrink machine D) fall into two similar operating conditions. However, the mechanical execution equipment and the electrical control equipment represent two significantly different operating conditions. This invention uses precision, accuracy, and F1 score to measure model performance.

[0107] 2. Description of Experimental Dataset

[0108] To verify the effectiveness of the method of the present invention, four typical datasets A, B, C, and D were constructed from the collected data, and their characteristics are shown in Table 1:

[0109] Table 1. Description of Experimental Dataset Characteristics

[0110]

[0111] Datasets A and C belong to the category of mechanical actuation equipment and have high similarity in operating conditions; datasets B and D belong to the category of electrical control equipment and have high similarity in operating conditions; however, there are significant differences in operating conditions between mechanical actuation equipment and electrical control equipment.

[0112] 3. Digital Twin Model and System Development

[0113] Develop a 3D visualization digital twin model of the production line using the Unity3D engine (effect as shown). Figure 9 (As shown). A data communication module is written in C# script to read data from KepServerEX in real time through the OPC .NET API client library, and drive the equipment animation (such as the rotation of the agitator and the flow of materials), parameter panel refresh (real-time display of values), and status changes (such as the gradual change of equipment color according to health status) in the 3D model.

[0114] 4. Model Training and Transfer Settings

[0115] Source model pre-training: Select data from product A as the source domain and train the STFusionCNN model using the data described in S1. Training parameters: learning rate lr=0.0001, batch size=64, epochs=100, optimizer is Adam, and early stopping on the validation set is used to prevent overfitting.

[0116] Migration scenario:

[0117] Similar working condition migration (Strategy 1): Switch from producing product A to product C (Compound Danshen Tablets), which has similar physical properties. The system automatically identifies this as a similar working condition and activates Strategy 1. Figure 3 The first four layers of the pre-trained model (CNN, Projection, PosEncoding, SwinT) were frozen, and only the GRU and MLP layers were fine-tuned. Fine-tuning was performed using the first two batches of data from product C, with a learning rate of 0.00001.

[0118] Migration under different operating conditions (Strategy 2): Switching from producing product A to product B (direct compression of traditional Chinese medicine extract powder) with significantly different physical properties, resulting in large differences in equipment load and process parameters. The system identifies this as an different operating condition and activates Strategy 2. Figure 4 The CNN and SwinT layers were frozen, and the GRU and MLP layers were retrained. Training was performed using the first 8 batches of data from product B.

[0119] 5. Multi-scale feature extraction and fusion

[0120] The STFusionCNN model of this invention achieves multi-level feature extraction:

[0121] Local feature extraction: Capturing device-level local anomaly patterns through a one-dimensional CNN layer;

[0122] Global feature extraction: Capture global dependencies at the production line level through the Swing Transformer layer;

[0123] Temporal feature modeling: Capturing the temporal dynamic characteristics of fault evolution through Bi-GRU layers;

[0124] Feature fusion: Adaptive fusion of multi-scale features using a gated attention mechanism.

[0125] 6. Results and Analysis

[0126] The system ran continuously for one quarter after deployment, during which time it underwent 34 product batch changes. The system successfully issued warnings for multiple faults, such as:

[0127] Early warning of "main motor overload" for wet granulation machine caused by viscosity change of new batch of material (10-15 minutes in advance).

[0128] Warning of slow temperature rise caused by "reduced heater efficiency" in the first boiling dryer (more than 30 minutes in advance).

[0129] Several "poor lubrication of the main mixer" risk warnings were issued due to large temperature differences between day and night. On-site maintenance personnel confirmed that the warning accuracy rate reached 98.7%, with an average warning time more than 20 minutes earlier than traditional alarm systems based on fixed thresholds. This effectively prevented three unplanned downtimes and significant material waste, improving overall equipment efficiency (OEE).

[0130] 7. Selection of migration method in ablation experiments and comparative analysis

[0131] This invention addresses the multi-condition operation scenarios of traditional Chinese medicine granulation equipment by systematically comparing the performance of four transfer learning strategies to select the most suitable transfer learning method for online quality prediction. The specific method comparison is as follows:

[0132] Retraining (Mode 1): Completely discard the pre-trained model parameters, retain only the network structure, randomly initialize all layer weights, and retrain the model on the target domain data.

[0133] Parameter sharing (Mode2): The network structure and parameters of the pre-trained model are completely transferred as the initial weights of the target domain model, and the adaptability of the model under the new conditions is optimized by fine-tuning.

[0134] Freeze Coding Layer (Mode3): Fix the coding structure of the pre-trained model (including the parameters of CNN, Projection, PositionalEncoding and SwinTransformer layers), and only randomly initialize and retrain the subsequent temporal modeling (GRU) and regression prediction (MLP) modules.

[0135] Freeze all feature extraction layers (Mode4): Lock all feature extraction modules (CNN, SwinTransformer, GRU), and only fine-tune the final MLP decoder to retain the pre-trained feature representation capabilities to the maximum extent.

[0136] The experiment compares the prediction accuracy and model update time of each migration method on the test set, and comprehensively evaluates its applicability for online deployment, providing the optimal migration strategy for real-time quality monitoring of the traditional Chinese medicine granulation process.

[0137] Table 2 Comparison of Fault Diagnosis Experimental Indicators under Different Models

[0138]

[0139] As shown in Table 2 and Figure 5As shown, this experiment compared the fault diagnosis performance of four transfer learning models in the target domain. Model 1, trained from scratch, had the lowest accuracy and F1 score (Accuracy 0.9721, F1 0.8939), with the longest training time of 17.80s, serving as a benchmark. Model 2 transferred all pre-trained parameters, improving accuracy and F1 (0.9436, 0.9006), but still had a relatively long training time of 16.33s. Model 3 shared only the encoder part (such as CNN, SwinTransformer), froze its parameters, randomly initialized GRU and MLP, and retrained, achieving the highest performance (Accuracy 0.9751, F1 0.9445), with the shortest training time of 8.06s, achieving the optimal balance between accuracy and efficiency. Model 4 froze all feature extraction layers and trained only the MLP, resulting in the second-best performance (F1 0.9299), suitable for resource-constrained scenarios. In summary, Model 3 performed best in terms of accuracy and training efficiency, and is the recommended solution for fault diagnosis using transfer learning.

[0140] Similar Fault In-Migration Model Experiment

[0141] Based on the experiments above, as shown in Table 1, the datasets were divided into four datasets: A, B, C, and D. This experiment, focusing on the task of industrial equipment fault diagnosis, constructed a model evaluation system based on transfer learning. Four representative equipment datasets (A, B, C, and D) were selected to represent two types of operating conditions: mechanical execution equipment (A: filling machine, C: cartoning machine) and electrical control equipment (B: secondary counter, D: heat shrink machine). Four sets of transfer tasks were designed (A→C, B→D, C→A, D→B), where the source and target domains maintained a high degree of similarity in function and operating conditions to verify the feasibility and effectiveness of transfer strategy 1 in industrial scenarios.

[0142] Table 3 Comparison of experimental metrics for fault diagnosis using migration strategy 1 across different datasets

[0143]

[0144] From Table 3 and Figure 6The experimental results show that transfer learning improved performance or at least maintained the original level in most tasks. In the A→C task, the model accuracy improved to 0.9882, and the precision and F1 score improved to 0.9155 and 0.8587, respectively, all of which are better than the model trained only on the source domain A. This indicates that transfer learning has good generalization ability among mechanical devices. Similarly, in the D→B task, the model achieved the best results on all evaluation metrics, with an F1 score as high as 0.8957, showing a significant advantage in transfer learning among electrical control devices. It is worth noting that although the C→A and B→D tasks showed slight declines in some metrics, the overall performance remained robust, with the F1 score basically on par with or even slightly improved compared to the non-transfer model, demonstrating that the transfer strategy has a positive impact on model stability. The graphs also show that each task converged rapidly in the early stages of training, and the model has a fast learning speed and good transfer adaptability. Overall, transfer strategy 1 performed well in this experiment, especially in scenarios with similar equipment functions and operating conditions. It effectively alleviated the difficulty of model training caused by insufficient target domain samples and improved the model's diagnostic ability and generalization performance in new scenarios.

[0145] Experiment on migration model between similar faults

[0146] This experiment focuses on the task of fault diagnosis for industrial equipment. A model evaluation system based on transfer learning was constructed, selecting four representative equipment datasets (A, B, C, D) to represent two types of operating conditions: mechanical execution equipment (A: filling machine, C: cartoning machine) and electrical control equipment (B: secondary counter, D: heat shrink machine). Eight transfer tasks were designed (A→B, A→D, B→A, B→C, C→B, C→D, D→A, D→C), covering combinations of equipment with significant functional differences, aiming to verify the effectiveness and generalization ability of transfer strategy 2 in industrial scenarios.

[0147] Table 4 Comparison of experimental metrics for migration strategy 2 fault diagnosis under different datasets

[0148]

[0149] The experimental statistics in Table 4 further demonstrate that transfer learning brought performance gains in most tasks. For example, the accuracy for B→C improved to 0.9916, and the F1 score improved to 0.8773; the F1 score for C→B even reached 0.8946, higher than the 0.8158 of the target domain B model, showing that the features extracted from the source domain C also have discriminative power for device B. Furthermore, the D→A and A→D tasks also showed improvements in both F1 and accuracy, indicating that even with significant differences in device functionalities, the transfer strategy can still capture universally applicable representational features.

[0150] like Figure 7 As shown in the indicator curves plotted during training, all models converged rapidly after approximately 10-20 training epochs, and their performance stabilized, indicating a good training process and that the transfer strategy did not introduce significant training instability. Most transfer tasks outperformed the native target domain model in terms of precision and F1 score, especially combinations such as C→B and D→A, where the F1 score significantly improved, reaching a maximum of 0.8946, demonstrating the effectiveness of the transfer strategy in handling practical problems such as insufficient and imbalanced samples in the target domain. It is worth noting that some tasks, such as D→C, showed a slight decrease in accuracy and F1 score compared to the native C model, suggesting that not all transfer paths have positive gains. This difference may be related to the expressive power of the source domain model, the degree of feature alignment between the source and target domains, and the transferability of equipment conditions.

[0151] Transfer Model Comparison Experiment

[0152] This invention uses the Swin Transformer, Transformer, and CNNLSTM models for comparative experiments. The experiment aims to evaluate and compare the performance of four advanced deep transfer learning models—STFusionCNN, Swin Transformer, Transformer, and CNNLSTM—in fault diagnosis tasks, with a particular focus on their adaptability in cross-domain transfer learning scenarios. Four scenarios were set up: direct application on the original A dataset, and transfer learning tasks from domain A to three different target domains (B, C, and D). By tracking key metrics such as accuracy, precision, and F1 score during training, the learning characteristics and generalization ability of each model under different conditions were systematically analyzed. As shown in Table 5, the experimental results show that STFusionCNN performs best overall, achieving the highest accuracy of 0.9747, precision of 0.8877, and F1 score of 0.8234 on the original A dataset. This model achieves an astonishing accuracy of 0.9882 in the A→C transfer scenario, demonstrating strong adaptability to complex conditions. It is worth noting that the Swin Transformer demonstrates excellent adaptability in cross-domain transfer tasks, especially in the A→D scenario, where its accuracy of 0.9642 surpasses all other models. This is likely due to its powerful feature extraction capabilities and effective handling of inter-domain differences. Nevertheless, CNNLSTM performs relatively poorly across all scenarios, particularly in transfer tasks with significantly different data distributions, where its performance lags considerably behind other models. This may be related to its inherent network structure and its handling of temporal features.

[0153] Table 5 Comparison of Fault Diagnosis Experimental Indicators under Different Migration Models

[0154]

[0155] like Figure 8 As shown in the training curves, STFusionCNN converges faster and with less fluctuation, indicating a more stable learning process. In contrast, CNNLSTM exhibits significant performance fluctuations across multiple scenarios, particularly in the early stages of training, which may limit its application potential in real-world industrial environments. Furthermore, all models show some performance degradation in cross-domain transfer tasks, but the degree of degradation varies from model to model. Transformer maintains relatively stable performance in cross-domain transfer. Model selection should be based on a trade-off between specific task characteristics and inter-domain similarity. STFusionCNN is suitable for handling fault diagnosis tasks with high similarity to the training domain. This experiment provides important reference for model selection and transfer learning strategies in the field of fault diagnosis in traditional Chinese medicine granulation, and also reveals the necessity of developing more robust and adaptable fault diagnosis models.

[0156] 8. Conclusion

[0157] This embodiment fully demonstrates the effectiveness, advancement, and practicality of the method described in this invention in real industrial scenarios. It successfully solves the problem of model failure caused by changing operating conditions in traditional Chinese medicine granulation production lines. Through an efficient transfer learning mechanism, it significantly reduces the need for data on new operating conditions, achieving high-precision, early-warning intelligent fault diagnosis. This brings significant economic benefits and management improvements to enterprises, and has good industry promotion value.

[0158] The specific embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to these descriptions. Within the scope of knowledge possessed by those skilled in the art, various modifications, substitutions and improvements can be made without departing from the principles of the present invention.

Claims

1. An adaptive fault diagnosis method for a traditional Chinese medicine granulation production line based on digital twins and transfer learning, characterized in that, Includes the following steps: S1. Construction of Real-time Mapping Mechanism for Digital Twin Model and Acquisition of Multi-Source Heterogeneous Data: Construct a high-fidelity digital twin model and a real-time mapping mechanism. The digital twin model achieves dynamic simulation, real-time monitoring and intelligent optimization of the production process through the close integration of virtual and physical production lines. In the physical production line, the PLC system serves as the core data acquisition terminal, and collects early warning data from multiple devices in the Chinese medicine granulation production line through high-precision real-time monitoring functions, forming multi-source heterogeneous data. S2. Data preprocessing: The multi-source heterogeneous data obtained in S1 is subjected to cleaning, denoising and normalization preprocessing operations in sequence to obtain multi-source time series data with uniform format; S3. Develop a migration process for an adaptive fault diagnosis method for a TCM granulation production line based on digital twins and transfer learning. This process constructs a multi-level dynamic migration system. The digital twin model migration is divided according to the different objects being migrated, namely, digital twin model migration within the same type of fault diagnosis and between different fault diagnoses. S4. Formulate adaptive migration strategy decision based on working condition identification: Input multi-source time series data into a multi-level dynamic migration system to identify the current working condition in real time. If the working conditions are similar, adopt the intra-fault migration strategy; if the working conditions are different, adopt the inter-fault migration strategy. Finally, output the fault prediction results; S5. Online Fault Diagnosis and Early Warning: Synchronize fault prediction results with the digital twin model and trigger early warnings within the digital twin model.

2. The adaptive fault diagnosis method for a traditional Chinese medicine granulation production line based on digital twins and transfer learning according to claim 1, characterized in that, S1 specifically includes the following steps: S11. Based on the physical structure of the production line, equipment relationships, and process characteristics, a digital twin model covering key processes is constructed. First, in the physical production line, the operation process of traditional Chinese medicine granulation is clarified, the moving parts of the equipment are identified, and the movement behavior and parent-child relationship of the decomposed moving parts are defined. Simultaneously, in the virtual twin, the digital twin is constructed, a visual model of the traditional Chinese medicine granulation production line is built, and the production line behavior logic is scripted. Then, an OPC UA data interface is established based on the physical production line, and a data interaction interface is established between the virtual twin and the physical twin to communicate. Data collection is carried out on equipment operation data, production count data, regulatory code data, equipment monitoring data, and equipment early warning data to achieve a virtual-real mapping effect. S12. The digital twin model achieves two-way interaction between the virtual and the real through a real-time mapping mechanism. The digital twin model and the actual production line achieve two-way data communication through OPC / PLC, industrial bus or edge acquisition device. The real-time collected equipment operation data, production count data, supervision code data and equipment monitoring data are continuously mapped into the digital twin model, so that the twin keeps synchronized with the physical entity in the state space. The data collected by S13 and OPC / PLC serves two purposes: firstly, real-time data from the physical production line drives the updating of the digital twin model; secondly, equipment early warning data becomes a multi-source dataset for the adaptive migration strategy of fault identification under varying operating conditions.

3. The adaptive fault diagnosis method for a traditional Chinese medicine granulation production line based on digital twins and transfer learning according to claim 1, characterized in that, The S3 multi-layered dynamic migration system adopts a three-layer architecture and forms a bidirectional migration path that is interwoven vertically and horizontally. S31, Top layer is the working condition layer It consists of five modules with data acquisition capabilities. Each module independently processes small-scale field data to achieve preliminary data perception and acquisition. S32. The intermediate model transfer layer uses a digital twin model to perform deep feature extraction on the preprocessed multi-source time series data, thereby realizing knowledge transfer and sharing across working conditions. S33, the underlying layer is an algorithm model library, covering diagnostic strategy modules under varying operating conditions. This supports hierarchical fault diagnosis decision-making from level one to level four. S34. The digital twin model achieves efficient transformation from raw data features to diagnostic strategies through a vertical migration path, that is, from the working condition layer to the model migration layer and then to the algorithm model library. At the same time, with the help of the horizontal migration path, it promotes the dynamic updating of the algorithm model library and the iterative optimization of diagnostic knowledge. The data flow runs through the entire process of data acquisition, preprocessing, feature library and production library, and builds a dynamic migration system that integrates data acquisition, model migration, algorithm calling and decision output.

4. The adaptive fault diagnosis method for a traditional Chinese medicine granulation production line based on digital twins and transfer learning according to claim 1, characterized in that, The specific steps of S4 are as follows: S41. Construct the STFusionCNN fusion model. The input to the model is multi-source time-series data, and the output is the predicted value. Its architecture includes the following components: Convolutional CNN layer: extracts local features through one-dimensional convolution, with 128 output channels; Projection layer: maps the feature dimension of the CNN output from 128 to the model dimension; Position encoding: adds positional information to the sequence; SwingTransformer layer: captures local and global dependencies in the sequence through a window self-attention mechanism, containing multiple blocks, with some blocks using shifted windows to enhance global modeling; GRU: models the long-term dependencies of the time series and outputs the hidden state of the last time step; Output MLP layer: maps the GRU output to the signal prediction dimension to generate the final result. Input the existing multi-source time-series data of multiple working conditions into STFusionCNN for training to form the source model. ; S42. The fault-based transfer strategy is Strategy 1, which is a digital twin model transfer strategy within the same fault diagnosis. It fixes the feature extractor parameters in the pre-trained source model STFusionCNN, which consists of CNN and Swing Transformer layers. It only uses the target working condition data to adjust the parameters of the GRU layer and MLP output layer at the top of the pre-trained source model. It inputs multi-source time series data into STFusionCNN for fault diagnosis and outputs the prediction results. The pre-trained source model is updated using fault in-transfer strategy 1. Based on the source model Corresponding working conditions The following fault characteristic data, For working conditions The original production data below, For source model Corresponding working conditions The characteristic data below; where n=1,2,3,…,n represents different working conditions; The implementation steps of fault migration strategy 1 are as follows: Step 1: The fault feature data of the two faults under similar operating conditions are similar, and the source model is fixed. The parameters of CNN and Swing Transformer in case 1 Examples of similar working conditions, through Feature data parameter fine-tuning The model is used to obtain the transferred algorithm model. And save it to the algorithm model library; Step 2: Obtain the transferred model, update the model, and store the data. The transferred model diagnoses new operating conditions Real-time faults under the following conditions; S43, the fault transfer strategy is strategy 2, which is a digital twin model transfer strategy between different fault diagnoses. It selects the pre-trained source model that best matches the target working condition from the algorithm model library, freezes the parameters of its CNN layer and Swing Transformer layer, re-initializes and trains the GRU layer and MLP output layer, and inputs multi-source time series data to perform fault diagnosis and output prediction results. When changes in operating conditions significantly affect the distribution of feature data, an adaptation method is used to update the source model. Indicates working conditions The following fault characteristic data, For working conditions The original production data below, The working conditions corresponding to the source model Based on the feature data, suitable source models are obtained from the algorithm model library during the fault diagnosis transfer process. Subsequently, through fault migration strategy 2, The system was updated to ultimately provide a solution suitable for the new operating conditions. Algorithm model ; The implementation steps of fault migration strategy 2 are as follows: Step 1: Based on the target working conditions Use the index to retrieve the corresponding production data. ; Step 2: Based on Characteristic data of the target working condition Combining transfer learning theory with the source model Migrate and update to build a system suitable for new operating conditions. Algorithm model .

5. The adaptive fault diagnosis method for a traditional Chinese medicine granulation production line based on digital twins and transfer learning according to claim 4, characterized in that, The Swin Transformer layer employs a shift window mechanism to compute multi-head self-attention, with a configurable window size, which is used to efficiently capture global long-range dependencies in time series.

6. The adaptive fault diagnosis method for a traditional Chinese medicine granulation production line based on digital twins and transfer learning according to claim 1, characterized in that, The warning mentioned in step S5 is displayed through a digital twin visualization interface and presented in the form of color changes, animation effects, and pop-up messages. At the same time, the warning signal is uploaded to the upper-level information management system through a standard industrial communication protocol.

7. The adaptive fault diagnosis method for a traditional Chinese medicine granulation production line based on digital twins and transfer learning according to claim 1, characterized in that, The digital twin model is developed based on the Unity3D engine and supports 3D model-driven, real-time data binding and interactive operation. The adaptive fault diagnosis method for the TCM granulation production line using digital twin and transfer learning integrates a clustering algorithm, which can automatically classify real-time operating conditions and match them with a historical operating condition database.