Method for predicting return water temperature of casting cooling system based on MShOA-CNN-LSTM-Attention
By using the MShOA-CNN-LSTM-Attention hybrid prediction model, the problems of lag and adaptability in the prediction of return water temperature in the casting cooling system are solved, achieving high-precision and stable temperature prediction, and improving the control effect and production efficiency of the cooling system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-08
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies cannot achieve advanced prediction of return water temperature in casting cooling systems, resulting in significant lag in cooling system control. Furthermore, traditional methods have poor adaptability to changes in operating conditions, and their prediction accuracy and stability are insufficient.
A hybrid prediction model based on MShOA-CNN-LSTM-Attention is adopted, which combines multimodal industrial data and constructs a prediction model for the return water temperature of the casting cooling system through a convolutional-temporal network structure and a bio-inspired hyperparameter optimization algorithm. Multi-dimensional temporal data is integrated and hyperparameters are optimized.
It significantly improves the accuracy of return water temperature prediction and the robustness of the model, enabling it to adapt to complex operating conditions, achieve advanced sensing and precise control of cooling intensity, reduce energy consumption, and increase material yield and equipment life.
Smart Images

Figure CN121786428A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of predicting the return water temperature of a casting cooling system, and more particularly to a data-driven method for predicting the return water temperature of a casting cooling system. Background Technology
[0002] In deep-well casting of aluminum alloy round bars, the molten metal is injected into the crystallizer through a flow channel. Primary cooling water circulates on the outer wall of the crystallizer, and the cast bar is then subjected to secondary cooling by high-pressure spray water after being pulled out. The return water temperature is a core indicator for measuring cooling intensity and judging the solidification process, directly affecting the microstructure, mechanical properties, and crack defects of the cast bar. Currently, industrial sites mainly use thermocouples or infrared thermometers to measure the return water temperature, combined with empirical formulas or simplified heat transfer models for offline estimation. Traditional measurement methods can only obtain temperature data at the current moment, failing to achieve advanced prediction, resulting in significant lag in cooling system control and difficulty in coping with the thermal inertia effects of the casting process. Empirical formulas and simplified heat transfer models ignore the multi-source coupling relationship between cooling water parameters, melt state, and control commands, and rely on manual calibration, exhibiting extremely poor adaptability to changes in operating conditions such as production changes in specifications or seasonal transitions, and incurring high maintenance costs.
[0003] In addition, some researchers have attempted to use shallow data-driven methods, employing techniques such as least squares regression and simple artificial neural networks (ANNs) to mine the correlation between input parameters (such as inlet water temperature and flow rate) and return water temperature from historical operating data. The modeling process does not rely on physical mechanisms such as heat transfer. However, significant drawbacks remain: First, the model structure is too simple to effectively capture the strong nonlinear coupling relationships between multiple variables (valve opening, casting speed, melt temperature, etc.) in the casting cooling system, resulting in large prediction errors. Second, the generalization ability is insufficient, exhibiting poor adaptability to changes in operating conditions (such as changes in casting specifications or abnormal operating conditions). Under unseen operating conditions, the prediction results deviate from the actual values, failing to meet the high accuracy and stability requirements of return water temperature prediction in the casting process. Summary of the Invention
[0004] To address the limitations of existing technologies, such as poor adaptability, limited accuracy, and the constraints of manual parameter tuning, this invention proposes a method for predicting the return water temperature of casting cooling systems based on MShOA-CNN-LSTM-Attention. The aim is to construct a robust and highly accurate return water temperature prediction model by fusing multimodal industrial data, combining a convolutional-temporal hybrid network structure, and introducing a bio-inspired hyperparameter optimization algorithm. This enables advanced perception and precise control of cooling intensity during the casting process, thereby meeting the comprehensive requirements of intelligent manufacturing in terms of safety and energy efficiency.
[0005] To achieve the above objectives, the technical solution of the present invention is implemented as follows:
[0006] A method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention includes the following steps:
[0007] S1: Collect multi-dimensional time-series data on the operating parameters of the cooling water system and the melt state of the casting cooling system, and perform data preprocessing to obtain a prediction dataset;
[0008] S2: Construct a CNN-LSTM-Attention hybrid prediction model, train the hybrid prediction model based on the prediction dataset, and use the Mantis Shrimp Optimization Algorithm to optimize the hyperparameters of the hybrid prediction model during the training process;
[0009] S3: Obtain the data to be processed, and after preprocessing, use the trained hybrid prediction model to predict the return water temperature of the casting cooling system.
[0010] Furthermore, the multi-dimensional time-series data includes: cooling system parameters, cooling system production control parameters, and melt state parameters;
[0011] The cooling system parameters include the casting machine cooling water valve opening value, the historical value of the casting machine return water temperature, the difference between the cooling water inlet temperature and the casting well drainage temperature, the crystallizer or mold plate inlet flow rate, inlet water pressure, and inlet water temperature.
[0012] The production control parameters of the cooling system include casting speed and casting length;
[0013] The melt state parameters include the inlet liquid level of the distribution channel or mold plate, the actual value of the metal temperature in the channel, and the liquid level at the furnace opening.
[0014] Further, data preprocessing is performed to obtain the prediction dataset, including: normalization using casting process benchmarks.
[0015] ;
[0016] in, As a benchmark value for the casting process, This is the casting safety threshold.
[0017] Furthermore, the CNN-LSTM-Attention hybrid prediction model includes: a CNN network layer, an LSTM network layer, a self-attention mechanism layer, and a fully connected layer. The CNN network layer is used to extract local spatial coupling features from the preprocessed multi-dimensional temporal data; the LSTM network layer is used to capture the long-range temporal dependencies of the multi-dimensional temporal data of the casting cooling system based on the local spatial coupling features, and obtain temporal features containing historical and current key information; the self-attention mechanism layer is used to dynamically focus on attention enhancement features that are key to predicting return water temperature from the temporal features output by the LSTM.
[0018] Furthermore, the CNN network layers sequentially include convolutional layers, pooling layers, and ReLU activation functions. The convolutional layers are used to extract local spatial coupling features from the preprocessed multi-dimensional temporal data, the pooling layers are used to reduce the dimensionality of the local spatial coupling features and retain key features, and the ReLU activation function is used to activate the dimensionality-reduced local spatial coupling features.
[0019] Furthermore, the LSTM network layer includes multiple LSTM units, each LSTM unit including an input gate, a forget gate, a cell state update, and an output gate, and each LSTM unit is activated by a ReLU activation function; a melt temperature surge determination logic is introduced into the input gate, a solidification time forget logic is introduced into the forget gate, and a casting speed linkage logic is introduced into the output gate.
[0020] Furthermore, a melt temperature surge determination logic is introduced into the input gate, including:
[0021] ;
[0022] in, The output of the input gate at time step t. It is the Sigmoid activation function. For the input gate weights, This indicates that the previous state will be hidden. and current input Concatenate them into a vector. For input gate bias, As a weighted gain for the sudden increase in melt temperature, This is an indicator function that returns 1 when the temperature rises sharply. This represents the temperature difference between the current moment and the previous moment. The threshold for sudden increase;
[0023] The forgetting gate introduces a time-lapse forgetting logic, including:
[0024] ;
[0025] in, The output of the forget gate at time step t. Here is the weight matrix for the forget gate. For the bias term of the forget gate, To reduce the weighting of solidification time, a value of -0.8 is used to decrease the focus on expired data. This is the timestamp when the melt begins to solidify. For the casting solidification cycle;
[0026] The output gate incorporates casting speed linkage logic, including:
[0027] ;
[0028] in, The output of the output gate at time step t. Here is the weight matrix of the output gate. This is the bias term for the output gate. For speed-linked weight gain, At the current casting speed, As the reference speed, This is the equivalent heat conduction time after the speed increase.
[0029] Furthermore, the hybrid prediction model is trained based on the prediction dataset, including:
[0030] Using the training set in the prediction dataset as input data, hyperparameters are randomly initialized. During the nth training iteration, the CNN network layer extracts local spatial coupling features from the temporal matrix of the multi-source parameters of the casting cooling system. The LSTM network layer captures the long-range temporal dependencies of the multi-dimensional temporal data of the casting cooling system based on the local spatial coupling features, obtaining temporal features containing key historical and current information. The attention mechanism layer dynamically focuses on attention enhancement features that are crucial for predicting the return water temperature from the temporal features output by the LSTM. Finally, the attention enhancement features are fed into the fully connected layer to calculate the predicted return water temperature value. The loss is calculated using the mean squared error as the loss function, and the parameters of the hybrid prediction model are updated through the backpropagation algorithm.
[0031] Using the validation set as input, and based on the model after the nth training iteration, the Mantis Shrimp Optimization Algorithm is used to optimize the hyperparameters. The hyperparameter combination obtained after the hyperparameter optimization after the nth training iteration is used as the hyperparameter combination for the (n+1)th training iteration to train the hybrid prediction model until the training stopping condition is reached.
[0032] Furthermore, the hyperparameter optimization of the hybrid prediction model using the mantis shrimp optimization algorithm includes:
[0033] S20: Determine the optimization hyperparameters, hyperparameter search space, and fitness function;
[0034] S21: Generate the initial population, determine the initial global optimal hyperparameter combination based on the fitness function, and assign an initial polarization type to each initial hyperparameter combination;
[0035] S22: In each iteration, based on the current globally optimal hyperparameter combination and the polarization type assigned to each hyperparameter combination, determine the stress strategy and update the hyperparameter combination based on the stress strategy;
[0036] S23: Assign polarization type to each updated hyperparameter combination and determine the direction of subsequent iteration stress strategy;
[0037] S24: Based on the updated hyperparameter combination, calculate the updated global optimal hyperparameter combination based on the fitness function; repeat steps S22 to S23 until the termination condition is met, and output the final global optimal hyperparameter combination.
[0038] Furthermore, the fitness function is:
[0039] ;
[0040] in, In hyperparameter combination The root mean square error of the validation set. The maximum allowable temperature prediction error for a casting scenario. The weights for the accuracy target, To predict the lag time for the model, For the casting solidification cycle, Weights for real-time objectives.
[0041] The beneficial effects of this invention are as follows:
[0042] First, supported by multimodal data-driven and spatial-temporal-attention triple feature fusion technology, this invention significantly improves the prediction accuracy of return water temperature in deep well casting cooling systems. The model is based on high-dimensional operational data collected from industrial sites and utilizes the Mantis Shrimp optimization algorithm to automatically search for optimal hyperparameters, deeply exploring the deep coupling relationship between cooling water state, melt conditions, and control commands, thereby significantly reducing the error between the predicted value and the actual return water temperature.
[0043] Second, the CNN-LSTM-Attention hybrid architecture fully leverages the advantages of CNN in local spatial feature extraction, LSTM in long-term temporal dependency modeling, and the Attention mechanism in dynamically weighting key information. Compared to single-network or simple combination models, this structure has stronger robustness and generalization ability, and can adapt to various complex working conditions such as changes in specifications, alloys, and seasonal changes.
[0044] Third, relying on the model's high-precision predictive capabilities, this invention achieves advance sensing and closed-loop control of cooling intensity. The system can generate valve opening control signals in real time based on the prediction results, stabilizing the return water temperature within the process setting range. This effectively suppresses the generation of hot cracks in the cast rod, improves yield, reduces energy consumption, and extends equipment lifespan, bringing significant economic benefits and a competitive advantage to the enterprise.
[0045] In summary, this invention demonstrates significant technical value and application potential in improving the accuracy of return water temperature prediction in deep well casting cooling systems, achieving intelligent closed-loop control, and ensuring the safety and quality of the casting process. Attached Figure Description
[0046] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0047] Figure 1 This is a flowchart of the method of the present invention.
[0048] Figure 2 This is a flowchart of the MshOA optimization algorithm of the present invention.
[0049] Figure 3 This is an overall structural diagram of the present invention.
[0050] Figure 4 This is a diagram showing the training results of the present invention. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] A method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention, such as... Figure 1 As shown, the steps include:
[0053] S1: Collect multi-dimensional time-series data on the operating parameters of the cooling water system and the melt state of the casting cooling system, and perform data preprocessing to obtain a prediction dataset.
[0054] In this embodiment of the application, the multi-dimensional time-series data includes:
[0055] Cooling system parameters: casting machine cooling water valve opening value, casting machine return water temperature (historical value), difference between cooling water inlet temperature and casting well drainage temperature, crystallizer (or mold plate) inlet water flow rate, inlet water pressure, and inlet water temperature. Production control parameters of the cooling system: casting speed and casting length.
[0056] Melt state parameters: inlet liquid level of distribution channel (or mold plate), actual value of metal temperature in channel, and liquid level at furnace mouth.
[0057] The temperature of the casting return water is affected by the coupling of multiple factors such as cooling, melt, and control (e.g., low inlet water pressure and fast casting speed can cause a sudden rise in return water temperature). Collecting only a single variable cannot reflect the true pattern. The multi-dimensional time series data of this invention covers key parameters of the entire scenario, providing an information foundation for the subsequent model to extract deep features and avoiding blind prediction.
[0058] In this embodiment of the application, data preprocessing is performed to obtain the prediction dataset, including: firstly, a detailed analysis of the system operation mechanism is conducted to select variables that are not related to the predicted values; secondly, based on various operating parameters collected from the circulating water system and the ingot casting machine system, after signal preprocessing methods such as data cleaning and filtering, a data normalization method is used to transform each dimension of discrete time series data in the multi-dimensional time series data into a standardized numerical range.
[0059] The data normalization method uses casting process benchmark normalization:
[0060] ;
[0061] in, These are benchmark values for the casting process, such as the benchmark value for cooling water inlet temperature = local tap water temperature + ambient temperature rise in the foundry workshop. These are benchmarks specific to the casting environment. For casting safety thresholds, such as the maximum allowable return water temperature = the critical solidification temperature of the casting rod - 20℃, exceeding this will lead to cracks. There is no critical solidification temperature for other scenarios.
[0062] Specifically:
[0063] Based on the 3σ criterion, abnormal data caused by sensor failures and transmission errors are removed. Industrial data is easily interfered with, and outliers can cause the model to learn the wrong rules, so they need to be filtered first.
[0064] Linear interpolation is used to fill in missing points in the time series. Casting data has strong temporal characteristics and smooth changes between adjacent time points. Linear interpolation can preserve the temporal trend to the greatest extent and avoid bias caused by human assumptions.
[0065] Min-Max normalization is used to transform all variables into standardized data in the range [0,1].
[0066] The standardized data is divided into training and testing sets.
[0067] S2: Construct a CNN-LSTM-Attention hybrid prediction model, train the hybrid prediction model based on the prediction dataset, and use the Mantis Shrimp Optimization Algorithm to optimize the hyperparameters of the hybrid prediction model during the training process.
[0068] In this embodiment of the application, the CNN-LSTM-Attention hybrid prediction model sequentially includes a CNN network layer, an LSTM network layer, a self-attention mechanism layer, and a fully connected layer, such as... Figure 3 As shown.
[0069] The CNN network layer is used to extract local spatial coupling features from the preprocessed multi-dimensional time series data. Specifically, it captures the local coupling relationships between parameters from the time series matrix of 11 cooling operation parameters, such as the local correlation between inlet water temperature and return water temperature, and the synergistic effect between casting speed and crystallizer flow rate. Finally, it outputs a standardized feature sequence that is adapted to subsequent LSTM time series modeling, is redundant-free, and contains key coupling information (such as flow-temperature correlation and speed-pressure synergy). This lays the spatial dimension feature foundation for subsequent capture of long-range time series dependencies and improvement of return water temperature prediction accuracy.
[0070] In the embodiments of this application, such as Figure 3 As shown, the CNN network layers sequentially include convolutional layers, pooling layers, and ReLU activation functions.
[0071] Convolutional layers are used to extract local spatial coupling features from the temporal matrix of multi-source parameters of the casting cooling system. Pooling layers are used to reduce the dimensionality of the local coupling features of the casting cooling system, filter out small noise from the sensors (such as fluctuations in inlet water pressure), retain key operating condition abrupt changes (such as sudden increases in flow rate), reduce model parameters and the risk of overfitting, and provide adapted input for subsequent LSTM temporal modeling.
[0072] In this embodiment of the application, the calculation process of the CNN network layer is as follows:
[0073] First, the input to the CNN is S1, resulting in a two-dimensional matrix containing the time step × parameter dimension. Based on the dynamic response characteristics of the casting cooling system, such as the lag of the return water temperature in parameter adjustment being approximately 5-10 sampling periods, a time window is selected from the past T moments. For example, T=20, meaning data from the first 20 sampling moments is used. Each time window corresponds to an input matrix. , The row dimension represents the time step, with each row corresponding to one sampling time. The column dimension represents the cooling system parameters, with each column corresponding to one core operating variable.
[0074] Furthermore, based on the local correlation characteristics of casting parameters, the convolution kernel size is selected, such as k×k=3×3, which covers the local region of 3 time steps × 3 parameters. The number of convolution kernels is also selected, such as 16, corresponding to the extraction of 16 different local features. Each 3×3 convolution kernel corresponds to a local parameter coupling mode. For example: Convolution kernel 1: focuses on the correlation of the three parameters "inlet water temperature (column 2) - inlet water flow rate (column 7 - return water temperature (column 2)" in 3 consecutive time steps (capturing the local law of flow rate change → temperature response); Convolution kernel 2: focuses on the correlation of the three parameters "casting speed (column 10) - crystallizer inlet water pressure (column 8) - trough metal temperature (column 5)" in 3 time steps (capturing the synergistic effect of casting rhythm → cooling intensity). Convolution operations are performed according to the set convolution kernel size and number.
[0075] Furthermore, the core of the pooling layer is dimensionality reduction in spatial dimensions, preserving key features, avoiding model overfitting, and improving robustness to minor parameter fluctuations, such as the small noise from sensors in a casting scenario. A 2×2 pooling window size (covering a region spanning 2 time steps × 2 feature dimensions) and a stride of 2 are chosen, employing max pooling, which is more suitable for capturing abrupt changes in key parameters in casting scenarios, such as sudden increases in water flow or adjustments in casting speed. Max pooling is performed based on the set pooling window size and stride.
[0076] Furthermore, the pooled spatial feature map is transformed into a one-dimensional temporal vector through a fully connected layer, which prepares for the subsequent temporal modeling of LSTM. The output dimension of the fully connected layer is optimized by MShOA.
[0077] The STM network layer is used to capture the long-range temporal dependencies of multi-dimensional temporal data of the casting cooling system based on the local spatial coupling features, and to obtain temporal features containing historical and current key information, such as the hysteresis response of the return water temperature after the cooling water valve opening is adjusted, and the thermal inertia of melt solidification.
[0078] In this embodiment of the application, the LSTM network layer includes multiple LSTM units, each LSTM unit includes an input gate, a forget gate, a cell state update gate and an output gate, and each LSTM unit is activated by the ReLU activation function.
[0079] Input Gate:
[0080] It determines which new information from the current input needs to be updated in the cell state. It consists of two parts: a Sigmoid layer that decides which values to update, and a Tanh layer that generates a vector of candidate new values.
[0081] The formula for calculating the input gate is:
[0082] ;
[0083] ;
[0084] in, It is the Sigmoid activation function. The input at time t, The hidden state at time t-1 contains time-series dependency information on the cooling process from the initial time to time (t-1), such as the trend of return water temperature change, the cumulative effect of cooling water parameter adjustments, and the thermal inertia of melt solidification. It is key to the model capturing long-range time-series relationships. For the input gate weights, For input gate bias, This means concatenating the previous hidden state and the current input into a vector. The output of the input gate at time step t represents the probability of updating the cell state with the current input information, for example... Indicates the current 80% of the information (such as changes in current inlet water pressure and casting speed) needs to be incorporated into the new cell state. The hyperbolic tangent activation function is used. The weights for the candidate cell states. This is a bias term for the candidate cell state. The candidate cell state represents the new candidate information brought about by the current input.
[0085] This invention introduces a melt temperature surge detection logic into the input gate:
[0086] ;
[0087] in, To account for the weighting gain of the sudden increase in melt temperature, a value of 1.2 is assigned to enhance the focus on this node. This is an indicator function that returns 1 when the temperature rises sharply. This represents the temperature difference between the current moment and the previous moment. This is the threshold for sudden increase.
[0088] Forgotten Gate:
[0089] The forgetting gate determines which historical information in the cell state needs to be discarded or attenuated. It receives the current input and the hidden state from the previous time step, and outputs a forgetting factor. The mathematical formula for the forgetting gate is:
[0090] ;
[0091] in, It is the Sigmoid activation function. Here is the weight matrix for the forget gate. For the bias term of the forget gate, The output of the forget gate at time step t (a vector between 0 and 1) represents the proportion of historical information forgotten.
[0092] This invention introduces a solidification-time forgetting logic into the forgetting gate:
[0093] ;
[0094] in, To reduce the weighting of solidification time, a value of -0.8 is used to decrease the focus on expired data. This is the timestamp when the melt begins to solidify. This refers to the solidification cycle during casting.
[0095] Cell status update:
[0096] ;
[0097] in, The cell state at time step t-1. This represents the cell state at time step t, the updated long-term memory unit, which incorporates historical information retained after forgetting. It retains valid historical information that has not exceeded the coagulation period. At the same time, it incorporates new information about the sudden increase in melt temperature. This enables the updating of casting-specific timing information.
[0098] Output gate:
[0099] Based on the updated cell state, the output gate determines what the hidden state should be at the current time step. The hidden state is typically the network output at the current time step and is passed to the next time step. The mathematical formula for the output gate is:
[0100] ;
[0101] ;
[0102] in, Here is the weight matrix of the output gate. This is the bias term for the output gate. The output of the output gate at time step t represents the output ratio of the cell state. The hidden state at time step t, This indicates element-wise multiplication.
[0103] This invention introduces casting speed linkage logic into the output gate:
[0104] ;
[0105] in, The weight gain for speed-linked calculations is set to 0.6 to enhance the focus on short-term data. At the current casting speed, As the reference speed, This is the equivalent heat conduction time after the speed increase. For example, if the speed increases by 20%, the heat conduction time is shortened to... .
[0106] This invention embeds casting-specific logic into the input gate, forget gate, and output gate, respectively, which includes the sudden rise in melt temperature, the forgetting of solidification time, and the linkage of casting speed. This LSTM module can accurately capture the long-term thermal inertia and process node characteristics of the casting cooling system. The output hidden state not only retains key historical information but also focuses on real-time process changes, providing temporal feature support for subsequent backflow temperature prediction that is adapted to the casting scenario.
[0107] In this embodiment of the application, the computation process of the LSTM network layer is as follows:
[0108] First, obtain the running parameters after CNN processing at time t. Read the hidden state of the LSTM output at time t-1. and cell state Hidden state Includes cooling time-series characteristics prior to t-1, cell state It contains long-term memory information; for example, the input at time t. It could be "cooling water valve opening 50%, inlet water flow rate 20m³ / h, casting speed 0.8m / min". Includes the trend of return water temperature changes over the first 100 time points. Includes the cooling intensity mode for the past hour.
[0109] Furthermore, the output of the forget gate at time step t is calculated using the forget gate calculation formula. It determines whether to retain information from historical cell states, for example, if the current working conditions are stable (such as casting speed and water inlet temperature without sudden changes). Approaching 1 (e.g., 0.95), retaining most of the values. The historical cooling pattern in the memory, such as the previous return water temperature being stable at around 40℃; if the working conditions change abruptly (such as the casting speed increasing from 0.8m / min to 1.2m / min). Approaching 0 (e.g., 0.1), discard outdated historical information to avoid interfering with predictions under new operating conditions.
[0110] Furthermore, the output of the input gate at time step t is calculated using the input gate calculation formula. Filter the current input Information about the return water temperature is important; for example, a sudden increase in the difference between the current inlet water temperature and the cast iron well drainage temperature may cause the return water temperature to rise. The difference will approach 1, and this difference information will be incorporated into the new memory; if a certain variable (such as casting length) does not change significantly, Approaching 0, redundant information about this variable is ignored; candidate cell states are calculated. Generate new feature candidate values under the current operating conditions. Including current input The nonlinear relationship between variables and return water temperature, such as the nonlinear mapping of increasing influent flow rate → decreasing return water temperature.
[0111] Furthermore, update cell state ,For example, =0.9, retaining 90% of historical memory =0.8, incorporating 80% of the current new information, then It retains the return water temperature trend under previous stable operating conditions, while incorporating the new impact of current changes in influent flow rate, forming the core long-term memory at time t.
[0112] Furthermore, the output of the output gate at time step t is calculated using the output gate calculation formula. ,control Which information is output to ,For example =0.85 means that 85% of the key information output, such as cooling intensity characteristics directly related to return water temperature, is filtered out as irrelevant redundancy; the hidden state of calculation time step t is also included. , It is a condensed representation of the temporal features of the cooling system at time t by LSTM, containing historical long-term memory and current key new information, which will be passed to the subsequent Attention layer.
[0113] The self-attention mechanism layer dynamically focuses on key temporal features for predicting return water temperature from the casting cooling system time-series feature sequence output by the LSTM. By weighting and enhancing key information, it improves prediction accuracy under complex operating conditions. Specifically, it identifies and weights the time / parameter combinations that have the greatest impact on the current return water temperature from the time-series feature sequence output by the LSTM, such as the moment of sudden change in cooling water valve opening or the moment of abnormal crystallizer inlet flow. This addresses the shortcomings of traditional models that treat all time steps equally and ignore key information, ultimately improving prediction accuracy under complex operating conditions (such as changing alloy specifications or seasonal changes).
[0114] In this embodiment, the self-attention mechanism layer maps the input to a query vector Q (Quey) that focuses on information of other elements, a key vector K (Key) of the input data index, and a value vector V (Value) corresponding to the information of the actual stored data index, thereby achieving focus on the target vector and weight enhancement. The self-attention mechanism significantly improves the model's ability to analyze complex industrial time-series data through dynamic feature focusing and cross-scale information fusion.
[0115] The mathematical formula for the attention module is:
[0116] ;
[0117] ;
[0118] in, For querying the matrix, The key matrix, for The feature dimensions.
[0119] In this embodiment of the application, the attention calculation process is as follows:
[0120] First, the input for attention calculation is the temporal feature sequence output by the LSTM, denoted as... T represents the number of time steps, D represents the feature dimension, and H is the result of LSTM further modeling the temporal dependencies of the local spatial features extracted by CNN. Each row vector corresponds to the comprehensive temporal features of the cooling system at a given time moment (such as coupled features including the inlet water temperature, casting speed, and flow channel metal temperature at that time). Constructing the query matrix through linear transformation Key matrix Value matrix Assuming the LSTM outputs T=10 time steps (corresponding to time t-9 to t) and D=128-dimensional features (integrating local parameter coupling features extracted by CNN): the 10th row of Q: the query vector corresponding to time t, aiming to find which historical time steps (t-9 to t-1) features are most critical for predicting the return water temperature at time t; the 7th row of K: the key vector corresponding to time t-3, used to index the cooling features at that time (e.g., the crystallizer influent flow rate suddenly increases from 15 m³ / h to 20 m³ / h at time t-3); the 7th row of V: the value vector corresponding to time t-3, used to store the specific information of the features at that time (e.g., the intensity of the impact of the flow rate change on the subsequent temperature, and the coupling relationship with other parameters).
[0121] Furthermore, calculate the attention score. .like =2.8 (the score of the query at time t and the key at time t-3). =0.5 (scores at time t and time t-7), indicating that the cooling characteristics at time t-3 (such as sudden changes in inlet flow rate) have a much greater impact on the return water temperature at time t than at time t-7. This is because after the sudden change in flow rate, the return water temperature will show a significant response after 3 time steps (time t), which is in perfect match with the thermal inertia hysteresis characteristics of the casting cooling system.
[0122] Furthermore, attention weight normalization For example, for time t (query row i=10): Score =2.8 After Softmax, the weight A10,7 = 0.35 (accounting for 35%); Score After applying Softmax, the weight A10,3 = 0.08 (8% of the total weight). The weights at other times are all less than 0.1, indicating that the model automatically identifies the sudden change in flow rate at time t-3 as the core influencing factor for predicting the return water temperature at time t, which needs to be given special attention. The features of stable conditions such as time t-7 are less important and can be appropriately weakened.
[0123] Furthermore, the normalized attention weight matrix A is weighted and summed with the value matrix V, and key temporal features are fused to generate attention-enhanced features, thus obtaining the final output of the attention mechanism. Attention output at time t =0.35× (Characteristics at time t-3) +0.08× (Features at time t-7) + ... + other low-weighted terms, which is equivalent to using 35% weight to highlight the impact of the sudden change in flow rate at time t-3, and using 8% weight to include the basic information of the stable operating condition at time t-7. This captures key disturbances while preserving the basic trend. Compared with the traditional LSTM method of equally weighting features at all times, this output can more accurately reflect the key disturbance-temperature response relationship of the casting cooling system, such as sudden operating conditions such as valve opening adjustment and alloy composition change, thereby reducing prediction error.
[0124] In this embodiment of the application, training the hybrid prediction model based on the prediction dataset includes:
[0125] Using the training set as input data, hyperparameters are randomly initialized. During the nth training iteration, the CNN network layer extracts local spatial coupling features, performs dimensionality reduction and noise reduction, and fuses features from the temporal matrix of the multi-source parameters of the casting cooling system. The LSTM network layer captures the long-range temporal dependencies of the multi-source parameters of the casting cooling system from the temporal vector output by the CNN network layer. The attention mechanism layer dynamically focuses on the key temporal features for predicting the return water temperature from the temporal feature sequence of the casting cooling system output by the LSTM, and enhances the key information through weighting. Finally, the output of the attention mechanism layer is fed into the fully connected layer to calculate the predicted value of the return water temperature. The loss is calculated using the mean squared error as the loss function, and the parameters of the hybrid prediction model are updated through the backpropagation algorithm.
[0126] Using the validation set as input, and based on the model after the nth training iteration, the Mantis Shrimp Optimization Algorithm is used to optimize the hyperparameters. The hyperparameter combination obtained after the hyperparameter optimization after the nth training iteration is used as the hyperparameter combination for the (n+1)th training iteration to train the hybrid prediction model until the training stopping condition is reached, that is, the preset maximum number of training iterations is reached or the model performance index, such as the change in mean square error, is less than a preset threshold.
[0127] like Figure 2 As shown, the method for hyperparameter optimization using the mantis shrimp optimization algorithm is as follows:
[0128] S20: Determine the hyperparameters for optimization. Hyperparameters for the CNN network include: number of convolutional kernels, search range [16, 64] integers, kernel size [3×3, 7×7] odd matrix, pooling window size [2×2, 4×4] integer matrix; hyperparameters for the LSTM network include: number of hidden layer neurons [64, 256] integers, time step [10, 50] integers; attention hyperparameters include: number of attention heads [2, 8] integers, learning rate [1e-5, 1e-3] floating-point numbers, and determine the fitness function. Obtain the hyperparameter optimization list. , Let represent the i-th individual, i.e., the i-th hyperparameter combination, where D is the hyperparameter dimension and the boundary of the hyperparameter search space. , For each hyperparameter, This represents the upper bound of each hyperparameter.
[0129] The fitness function is: ;
[0130] in, In hyperparameter combination The root mean square error of the validation set. The maximum allowable temperature prediction error for a casting scenario. Model prediction lag time is the time from data input to output prediction value, including the time spent on the entire process of data preprocessing, model inference, and result output, and represents the real-time performance of model prediction. For casting solidification cycle, such as the total time from molten injection and crystallization to complete solidification into a solid bar for a certain specification (here, 20 seconds), it is the total time from inputting real-time operating data to outputting the predicted return water temperature. The time required is ≤4 seconds. The solidification of the casting rod is a process in which heat is gradually released and the temperature changes slowly. If the model prediction lag time is too long (e.g., τ=10 seconds), when the model outputs a prediction that the return water temperature is about to exceed the standard, the actual casting rod may have already passed the stage where the quality can be salvaged by adjusting the cooling valve (e.g., cracks have already formed), resulting in complete control lag. The weighting of the accuracy target reflects the core value of predicting the quality of the cast rod. The weights are assigned to real-time targets to reflect the crucial role of rapid prediction in control timeliness. This is achieved by adjusting the weights. and weight It can be adapted to the needs of different application scenarios.
[0131] Traditional optimization methods that solely aim to minimize RMSE can easily lead to overly complex models in pursuit of accuracy, resulting in drastically increased inference time and control lag, or overly simplified models in pursuit of speed, leading to insufficient accuracy and a high risk of casting cracks. This new function, by simultaneously constraining both accuracy and real-time performance, forces the model to find the optimal balance between predictive accuracy and control timeliness. This design, which embeds process parameters into the optimization objective, allows the model optimization process to directly serve the core needs of casting solidification-crack control, ensuring that the optimized model has practical production value in casting scenarios, rather than being a generic model. Furthermore, this quantitative and interpretable design significantly reduces the trial-and-error costs from the laboratory to the production line, accelerating industrialization. To minimize... The model needs to find the optimal solution between structural complexity, inference speed and prediction accuracy. This kind of reverse optimization produces a model that is neither too complex and has poor generalization ability, nor too simple and lacks robustness. It can stably adapt to changes in working conditions in casting production (such as changing specifications and seasonal changes).
[0132] S21, Generate the initial population, determine the initial global optimal hyperparameter combination based on the fitness function, and assign an initial polarization type to each initial hyperparameter combination.
[0133] Step S21 includes:
[0134] First, generate the initial population:
[0135] ;
[0136] in, Follows a uniform distribution. For the first Individual in the first The coordinates are in dimension N, and the population size is N.
[0137] Furthermore, the initial globally optimal hyperparameter combination is determined based on the fitness function:
[0138] For each initial hyperparameter combination Substitute the values into the hybrid prediction model, validate it using the validation set, and then apply the fitness function. Calculate each initial hyperparameter combination The fitness of the initial hyperparameters is used to select the combination of initial hyperparameters with the best fitness as the global optimal combination of hyperparameters. .
[0139] Furthermore, an initial polarization type is assigned to each initial hyperparameter combination:
[0140] ;
[0141] in, This indicates that each initial hyperparameter combination is assigned a polarization type indicator with a value of 1, 2, or 3, where 1 represents vertically linearly polarized light, 2 represents horizontally linearly polarized light, and 3 represents circularly polarized light. A random number in the interval [0,1). This is the rounding operation.
[0142] S22: In each iteration, based on the current globally optimal hyperparameter combination and the polarization type assigned to each hyperparameter combination, determine the stress strategy and update the hyperparameter combination based on the stress strategy;
[0143] When polarization type Simulating the Brownian motion of mantis shrimp foraging, fine-grained jitter is applied around the current optimal hyperparameters to achieve localized mining:
[0144] ;
[0145] in, For the updated hyperparameter combination, This represents the current globally optimal combination of hyperparameters. The current velocity vector, The diffusion coefficient is used to control the direction and intensity of random swimming of mantis shrimp near their optimal position. By introducing positional differences among individuals within the population as random vectors, the randomness of Brownian motion is simulated. The hyperparameters are randomly selected. New solution. The value of D determines whether it is positive or negative, allowing for fine-grained fluctuations or slight deviations from the optimal range, thus achieving a balance between localized mining and micro-diffusion.
[0146] When polarization type When simulating the mantis shrimp's forelimb strike, which can be viewed as a circular oscillation in a two-dimensional plane, then:
[0147] ;
[0148] in, This is the swing angle. By controlling the transfer amplitude, individuals are thrown out along a large arc direction "around" the optimal solution, thus achieving remote exploration that escapes local extrema.
[0149] When polarization type Simulate mantis shrimp evasion / defense, balancing local development with diversity:
[0150] defense: ;
[0151] Evade: ;
[0152] Here, the coefficient k is a random scaling factor that slightly contracts or expands the position around the optimum, enhancing fine-grained development while maintaining a certain degree of diversity. If the updated hyperparameter combination exceeds the boundary, it is truncated to the boundary.
[0153] S23: Assign polarization type to each updated hyperparameter combination to determine the direction of subsequent iteration stress strategy.
[0154] Furthermore, based on each current hyperparameter combination And new interpretation Calculate the left and right eye viewing angles:
[0155] The left eye view is the current hyperparameter combination. And new interpretation The included angle between them:
[0156] ;
[0157] in, For the first Left eye perspective based on hyperparameter combination It is an inverse cosine function.
[0158] The right eye's perspective is:
[0159] ;
[0160] in, For the first Right eye perspective based on hyperparameter combinations.
[0161] Furthermore, based on a preset set of reference angles, the Euclidean distances between the left-eye and right-eye viewing angles and the reference angles are calculated respectively. The polarization type corresponding to the reference angle with the smallest Euclidean distance is selected as the left-eye polarization type. And right eye polarization type The left angle difference is selected as the distance corresponding to the minimum Euclidean distance. Difference between right and right corners ,like The left eye polarization type is retained. Indicator of final polarization type Otherwise, the right eye polarization type is retained. Indicator of final polarization type .
[0162] The preset set of reference angles is: 0 corresponds to horizontally linearly polarized light. Corresponding to horizontally linearly polarized light, Corresponding to circularly polarized light.
[0163] The calculation formula is as follows:
[0164] ;
[0165] ;
[0166]
[0167]
[0168] ,
[0169] ;
[0170] .
[0171] in, This indicates the calculation of Euclidean distance.
[0172] S24: Based on the updated hyperparameter combination, calculate the updated global optimal hyperparameter combination based on the fitness function; repeat steps S22 to S23 until the termination condition is met, and output the final global optimal hyperparameter combination.
[0173] For each updated hyperparameter combination Substitute the values into the hybrid prediction model, validate it using the validation set, and then apply the fitness function. Calculate each updated hyperparameter combination The fitness of the initial hyperparameters is used to select the combination of initial hyperparameters with the best fitness as the global optimal combination of hyperparameters. The termination condition is reaching the maximum number of iterations, or the change in fitness is less than the fitness change threshold.
[0174] S3: Obtain the data to be processed, and after preprocessing, use the trained hybrid prediction model to predict the return water temperature of the casting cooling system.
[0175] Finally, the root mean square error (RMSE), mean absolute error (MAE), mean square error (MSE), and coefficient of determination were used. As an indicator for evaluating the predictive performance of a model.
[0176] ;
[0177] In the formula For the true value, For predicted values, The average value is the predicted value, and N is the total sample size.
[0178] The MShOA-CNN-LSTM-Attention predictive model was compared with four other models: CNN, LSTM, CNN-LSTM, and CNN-LSTM-Attention. The training results are as follows. Figure 4 As shown in Table 1, the comparison results indicate that, compared with other models, the MShOA-CNN-LSTM-Attention model reduces the MAE by 1.17 and R... 2 The value increased by 4.54%, demonstrating superior performance in time series prediction. Compared with other models, the MShOA-CNN-LSTM-Attention model outperforms other models in terms of evaluation metrics.
[0179] Table 1 compares the models with the other four models.
[0180]
[0181] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention, characterized in that, Including the following steps: S1: Collect multi-dimensional time-series data on the operating parameters of the cooling water system and the melt state of the casting cooling system, and perform data preprocessing to obtain a prediction dataset; S2: Construct a CNN-LSTM-Attention hybrid prediction model, train the hybrid prediction model based on the prediction dataset, and use the Mantis Shrimp Optimization Algorithm to optimize the hyperparameters of the hybrid prediction model during the training process; S3: Obtain the data to be processed, and after preprocessing, use the trained hybrid prediction model to predict the return water temperature of the casting cooling system.
2. The method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention according to claim 1, characterized in that, The multi-dimensional time-series data includes: cooling system parameters, cooling system production control parameters, and melt state parameters; The cooling system parameters include the casting machine cooling water valve opening value, the historical value of the casting machine return water temperature, the difference between the cooling water inlet temperature and the casting well drainage temperature, the crystallizer or mold plate inlet flow rate, inlet water pressure, and inlet water temperature. The production control parameters of the cooling system include casting speed and casting length; The melt state parameters include the inlet liquid level of the distribution channel or mold plate, the actual value of the metal temperature in the channel, and the liquid level at the furnace opening.
3. The method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention according to claim 1, characterized in that, Data preprocessing was performed to obtain the prediction dataset, including: normalization using casting process benchmarks. ; in, As a benchmark value for the casting process, This is the casting safety threshold.
4. The method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention according to any one of claims 1-3, characterized in that, The CNN-LSTM-Attention hybrid prediction model includes: a CNN network layer, an LSTM network layer, a self-attention mechanism layer, and a fully connected layer. The CNN network layer is used to extract local spatial coupling features from the preprocessed multi-dimensional temporal data. The LSTM network layer is used to capture the long-range temporal dependencies of the multi-dimensional temporal data of the casting cooling system based on the local spatial coupling features, and to obtain temporal features containing historical and current key information. The self-attention mechanism layer is used to dynamically focus on attention enhancement features that are key to predicting return water temperature from the temporal features output by the LSTM.
5. The method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention according to claim 4, characterized in that, The CNN network layers sequentially include convolutional layers, pooling layers, and ReLU activation functions. The convolutional layers are used to extract local spatial coupling features from the preprocessed multi-dimensional temporal data. The pooling layers are used to reduce the dimensionality of the local spatial coupling features and retain key features. The ReLU activation function is used to activate the dimensionality-reduced local spatial coupling features.
6. The method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention according to claim 4 or 5, characterized in that, The LSTM network layer includes multiple LSTM units, each of which includes an input gate, a forget gate, a cell state update, and an output gate. Each LSTM unit is activated by a ReLU activation function. A melt temperature surge determination logic is introduced into the input gate, a solidification time forget logic is introduced into the forget gate, and a casting speed linkage logic is introduced into the output gate.
7. The method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention according to claim 6, characterized in that, The input gate incorporates melt temperature surge detection logic, including: ; in, The output of the input gate at time step t. It is the Sigmoid activation function. For the input gate weights, This indicates that the previous state will be hidden. and current input Concatenate them into a vector. For input gate bias, As a weighted gain for the sudden increase in melt temperature, This is an indicator function that returns 1 when the temperature rises sharply. This represents the temperature difference between the current moment and the previous moment. The threshold for sudden increase; The forgetting gate introduces a time-lapse forgetting logic, including: ; in, The output of the forget gate at time step t. Here is the weight matrix for the forget gate. For the bias term of the forget gate, To reduce the weighting of solidification time, a value of -0.8 is used to decrease the focus on expired data. This is the timestamp when the melt begins to solidify. For the casting solidification cycle; The output gate incorporates casting speed linkage logic, including: ; in, The output of the output gate at time step t. This is the weight matrix of the output gate. This is the bias term for the output gate. For speed-linked weight gain, At the current casting speed, As the reference speed, This is the equivalent heat conduction time after the speed increase.
8. The method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention according to claim 1, characterized in that, Training the hybrid prediction model based on the prediction dataset includes: Using the training set in the prediction dataset as input data, hyperparameters are randomly initialized. During the nth training iteration, the CNN network layer extracts local spatial coupling features from the temporal matrix of the multi-source parameters of the casting cooling system. The LSTM network layer captures the long-range temporal dependencies of the multi-dimensional temporal data of the casting cooling system based on the local spatial coupling features, obtaining temporal features containing key historical and current information. The attention mechanism layer dynamically focuses on attention enhancement features that are crucial for predicting the return water temperature from the temporal features output by the LSTM. Finally, the attention enhancement features are fed into the fully connected layer to calculate the predicted return water temperature value. The loss is calculated using the mean squared error as the loss function, and the parameters of the hybrid prediction model are updated through the backpropagation algorithm. Using the validation set as input, and based on the model after the nth training iteration, the Mantis Shrimp Optimization Algorithm is used to optimize the hyperparameters. The hyperparameter combination obtained after the hyperparameter optimization after the nth training iteration is used as the hyperparameter combination for the (n+1)th training iteration to train the hybrid prediction model until the training stopping condition is reached.
9. The method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention according to claim 1, characterized in that, The hyperparameter optimization of the hybrid prediction model using the mantis shrimp optimization algorithm includes: S20: Determine the optimization hyperparameters, hyperparameter search space, and fitness function; S21: Generate the initial population, determine the initial global optimal hyperparameter combination based on the fitness function, and assign an initial polarization type to each initial hyperparameter combination; S22: In each iteration, based on the current globally optimal hyperparameter combination and the polarization type assigned to each hyperparameter combination, determine the stress strategy and update the hyperparameter combination based on the stress strategy; S23: Assign polarization type to each updated hyperparameter combination and determine the direction of subsequent iteration stress strategy; S24: Based on the updated hyperparameter combination, calculate the updated global optimal hyperparameter combination based on the fitness function; repeat steps S22 to S23 until the termination condition is met, and output the final global optimal hyperparameter combination.
10. The method for predicting the return water temperature of a casting cooling system based on MShOA-CNN-LSTM-Attention according to claim 1, characterized in that, The fitness function is: ; in, In hyperparameter combination The root mean square error of the validation set. The maximum allowable temperature prediction error for a casting scenario. The weights for the accuracy target, To predict the lag time for the model, For the casting solidification cycle, Weights for real-time objectives.