Abstract:
Traditional Chinese medicine manufacturing is characterized by diverse product varieties, small batch sizes, and complex, variable operating conditions. Digital twin models established for specific scenarios lack the adaptive capability to handle changing operating conditions, making it difficult to identify equipment failures. This study proposes a research method for twin migration modeling and fault diagnosis of traditional Chinese medicine granulation production lines under various operating conditions. We first analyze the sources and mechanisms behind dynamic condition shifts in pharmaceutical production. These include material property differences across product specifications, batch switching, environmental humidity variations, and complex equipment-process interactions. Building on this analysis, we develop an adaptive migration framework for pharmaceutical digital twins, allowing the model to evolve with changing manufacturing conditions. This framework supports the identification of time-varying process behaviors, modeling of heterogeneous equipment states, and the representation of cross-specification processing patterns. Together, these elements provide a unified path for adaptive twin updating. To overcome the limitations of current digital twin-based fault diagnosis methods, particularly in model reuse, cross-condition adaptation, and knowledge transfer, we design a multilevel adaptive migration strategy that consists of four key stages: working-condition identification, offline training, model updating, and online fault prediction. The strategy facilitates both intra-fault knowledge transfer, which occurs within similar fault types, and inter-fault knowledge transfer across different fault scenarios. It also addresses common pharmaceutical production challenges, such as equipment heterogeneity and data scarcity. At the algorithm level, we propose STFusionGRU, a hybrid spatial-temporal fusion model that combines the global spatial representation ability of the swin transformer, fine-grained local perception of convolutional neural networks (CNNs), and temporal modeling capability of gated recurrent units. This model captures multiscale spatial patterns in process parameters, extracts hierarchical temporal dependencies, and represents dynamic fault evolution pathways. By integrating global and local spatiotemporal information, STFusionGRU improves robustness under varying operating conditions and accurately characterizes subtle abnormal patterns. We evaluate the proposed method across multiple typical variable-condition scenarios in TCM granulation production. These include significant process-parameter fluctuations, frequent batch transitions, and cross-specification switching. Our approach achieved a fault prediction accuracy of 0.98, outperforming baseline models in both adaptability and stability. After migration, the digital twin model maintains a fault prediction error below 0.05. This confirms that the adaptive migration strategy effectively preserves model performance under new conditions. Our method not only alleviates issues of insufficient labeled data and inconsistent fault distributions, but also enables reliable knowledge transfer across equipment types and production scenarios. In summary, this study establishes a transferable and self-adapting digital twin framework for multi-specification, variable-condition pharmaceutical manufacturing. By integrating adaptive migration, spatiotemporal feature fusion, and digital twin-driven fault modeling, we provide a novel solution for equipment fault prediction under complex and uncertain working conditions. The methodology shows strong generalization potential and can be extended to other industrial domains that face similar challenges related to dynamic conditions and equipment heterogeneity. This study enhances the resilience and adaptability of digital twin systems, contributing new insights into intelligent manufacturing and paving the way for next-generation adaptive fault diagnosis in pharmaceutical production.