A method for predicting pH value in neutral leaching process of hydrometallurgical zinc smelting
Through deep learning technology, a series LSTM and self-attention mechanism model is established to capture the temporal relationship of the leaching process, solve the problem of pH fluctuation at the outlet of No. 3 leaching tank during the leaching process, and improve the prediction accuracy and impurity removal rate.
Patent Information
- Application Number
- CN202210088765.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-01-25
AI Technical Summary
During the leaching process, the pH value at the outlet of No. 3 leaching tank fluctuated violently, making accurate prediction difficult and affecting subsequent optimization control and the achievement of impurity removal rates.
Deep learning technology is used, combined with the characteristics of the leaching process, to establish a series LSTM module and a self-attention mechanism model to capture the short-term and long-term temporal relationships of the leaching process and predict the pH value.
It improves the accuracy of pH value prediction, improves subsequent optimization control and impurity removal rate, and meets process production requirements.
Smart Images

Figure CN114420220B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of wet leaching, and in particular relates to a method for predicting pH value in a neutral leaching process of wet zinc smelting. Background Art
[0002] Leaching refers to the process of using dilute sulfuric acid as a solvent, maintaining appropriate acidity, temperature, pressure and other conditions, dissolving zinc compounds in zinc-containing materials (such as zinc roasted sand, smoke, zinc leaching residue, etc.) into the solution as zinc sulfate, and forming a residue with insoluble solids. The most important indicators of the leaching process are the leaching rate and the impurity removal rate. If the pH value is stably controlled within a reasonable range, it can ensure that the leaching rate and impurity removal rate meet the process production requirements. Since the leaching process is a large time-delay system, the current pH value cannot reflect the process status of the current reactor, so accurate pH value prediction is of great significance for subsequent optimization control.
[0003] Due to the fluctuation of raw materials, the dynamic characteristics of the leaching tank, and the complex time sequence relationship, the pH value of the tail tank fluctuates violently during the leaching process. The operator only adjusts the amount of waste acid added according to the current material discharge and pH value, resulting in the stability of the pH value being greatly dependent on the operator's work experience. In addition, due to the complex and harsh production environment on site, the pH value measurement is only manually measured by test paper, and the information is delayed, resulting in inaccurate adjustment, which further makes pH adjustment difficult.
[0004] Long S et al. provided a pH prediction model that integrates mechanism and data. In this example, the researchers first established a mechanism model of the tail tank pH value and each process variable based on the characteristics of the leaching process and combined with the material balance equation. Then, according to the historical data, different industrial operation states were divided, and a data model of pH value and process data under different working conditions was established using an adaptive fuzzy inference system. The results of the mechanism model and the data model were integrated to obtain the final pH value prediction value.
[0005] Yuan X et al. provided an effective soft-sensor modeling method for industrial processes. For each different moment, a dual attention mechanism was used to assign weights to the variables and time steps at that moment, and important moments and variables were selected for modeling, which is more interpretable.
[0006] The prediction method given in the first example has certain limitations. First, the leaching process is a complex nonlinear process with large time lags. The simplified mechanism model cannot reflect the uncertainty of complex industrial processes, and the model may be inaccurate. The data model established based on the adaptive fuzzy inference system is a static method that does not consider the time-varying dynamics of the process and fails to achieve good results. The method given in the second example is too theoretical and difficult to put into operation due to complex production conditions and other factors.
[0007] The process flow chart of the neutral leaching process of a smelter is as follows: Figure 1 As shown in the figure, it can be seen that the neutral leaching process is mainly composed of 5 cascaded stirred reactors (leaching tanks), which are arranged in a stepped manner. The entrance of each leaching tank is located at the top, with a height difference of about 1 meter from the exit, and the entrance and exit of the leaching tank are connected by a chute. Neutral leaching supernatant, mixed liquor, manganese ore slurry and other solvents are mixed in the chute and flow into leaching tank No. 1. Zinc roasted sand is continuously added to the leaching tank through a belt scale. Reactors No. 1 and No. 2 dissolve zinc roasted sand by adding waste acid. In order to ensure the leaching temperature of the production process, steam is continuously introduced into each leaching tank. In order to ensure the production plan, the discharge of the first three tanks is determined by the dispatcher. By controlling the amount of waste acid added to No. 1 and No. 2, the zinc roasted sand and waste acid are neutralized to generate zinc sulfate, so that the zinc is dissolved as much as possible. Therefore, the first three tanks mainly play a dissolving role; at the same time, in order to further oxidize ferrous ions into ferric ions, excessive oxygen is usually introduced into the last two tanks. By fine-tuning the amount of roasted sand added to No. 4 and No. 5 leaching tanks, the pH at the No. 5 outlet is between 4.8 and 5.2, providing a stable precipitation environment for the hydrolysis and precipitation reaction of impurity ions (ferrous ions and silicates, etc.) in the solution. Finally, the slurry at the No. 5 outlet is precipitated by the thickener, and the supernatant is sent to the purification process for further impurity removal, while the precipitate is sent to the acid leaching process.
[0008] In order to make the industrial indicators of the neutral leaching process - zinc leaching rate and impurity removal rate meet the standards, the specific control target is to keep the pH at the outlet of No. 5 leaching tank between 4.8 and 5.2. According to the on-site investigation, as long as the pH value of No. 3 is controlled between 3 and 3.5, no subsequent operation is required to ensure that the pH of No. 5 is between 4.8 and 5.2. Otherwise, it is necessary to fine-tune the amount of roasted sand added to No. 4 and No. 5 to control the pH of No. 5. In order to monitor the pH value information in the production process, a pH online detection device is often installed at the outlet of the leaching tank. Since No. 1 to No. 3 are the main feed tanks, the hydrogen ion concentration of the first two feed tanks is too high, so the hydrogen ion concentration of the solution at the outlet of No. 3 tank can be expressed in pH, so the pH detection device is installed at the outlet of No. 3 leaching tank. Due to the large fluctuations and hysteresis of the leaching inlet conditions (waste acid, mixed liquor flow), the pH value at the outlet of No. 3 tank fluctuates violently, so an accurate estimation of the pH value at the outlet of No. 3 tank is of great significance for subsequent optimization control and process detection.
[0009] The main problem solved by the invention is: the problem of accurately estimating the pH value at the outlet of No. 3 leaching tank in the leaching process. Summary of the invention
[0010] The purpose of the present invention is to provide a method for predicting the pH value of a neutral leaching process of hydrometallurgy zinc smelting, in view of the problems existing in the existing method for predicting the pH value of a hydrometallurgy zinc leaching process, wherein the method can obtain a predicted pH value with higher accuracy.
[0011] The present invention combines deep learning technology with the process characteristics of the leaching process to establish an accurate pH value prediction model.
[0012] By analyzing the leaching process, it is found that there is a long-term and short-term temporal dependency between the pH value of the leaching process and other process data. First, according to the average flow rate of the leaching process and the volume of each reactor, the average residence time of the solution in each reactor is calculated to obtain the sequence length of the model input (that is, prediction is made based on such a long historical data, which is a process characteristic); then a series LSTM module (deep learning technology) is established to simulate the first three cascaded leaching tanks (process topology), and the series LSTM modules are used to capture the short-term temporal relationship in the leaching process; finally, the attention mechanism (deep learning technology) is used to solve the long-term dependency of the leaching process, that is, the self-attention mechanism is used to capture the long-term temporal relationship in the leaching process.
[0013] In order to achieve the above objectives and solve the above technical problems, the present invention adopts the following technical solutions:
[0014] A method for predicting pH value in a hydrometallurgical zinc leaching process, comprising:
[0015] S1. Determine the process variables of each leaching tank as input parameters of the prediction model;
[0016] S2, determining the residence time of the solution in each leaching tank, and then determining the lag time of each leaching tank relative to the detection site (i.e., the outlet of the third leaching tank), as the input time domain of the prediction model;
[0017] S3, using three cascaded LSTMs to simulate the leaching process of three series-connected leaching tanks, obtaining the output feature sequences of three LSTMs, and using the output feature sequence of the third LSTM as the short-term time series impact of the leaching process on the pH value;
[0018] S4, position encoding the output feature sequences of the three cascaded LSTMs respectively, then concatenating the three output feature sequences in the time dimension, and then performing calculations of the self-attention mechanism, and using the obtained results as the long-term temporal impact of the leaching process on the pH value;
[0019] S5. The short-term temporal effects and long-term temporal effects of the leaching process on the pH value extracted in step 3 and step 4 are added and fused, and after LayerNorm normalization, a linear regression calculation is performed to obtain a prediction result of the pH value.
[0020] Furthermore, in step S1, the process variables of the leaching tank 1 include: the amount of zinc roasted sand entering the leaching tank 1 per unit time M 1#(Unit: t / h), waste acid flow rate of leaching tank 1 (Unit: m 3 / h), is the mixed liquid flow rate F of leaching tank 1 mix (Unit: m 3 / h) and the acid leaching supernatant flow F of the leaching tank 1 sup (Unit: m 3 / h); the process variables of the leaching tank 2 include: the amount of zinc roasted sand entering the leaching tank 2 per unit time M 2# (Unit: t / h), waste acid flow rate of leaching tank 2 (Unit: m 3 / h); the process variables of the leaching tank 3 include: the amount of zinc roasted sand M entering the leaching tank 3 per unit time 3# (Unit: t / h), the measured pH value y at the outlet of leaching tank 3.
[0021] Furthermore, in step S2, the lag time of each leaching tank relative to the detection site is determined by: the volume of the leaching tank is V, the average flow rate of the solution is F, and the residence time of a single leaching tank is T lag =V / F, so the lag time of leaching tank 1, leaching tank 2, and leaching tank 3 relative to the detection site is 3T respectively lag , 2T lag and T lag .
[0022] Further, in step S3, the process variables of each leaching tank determined in step 1 are used as the input variables of each LSTM, and the lag time of each leaching tank relative to the detection site determined in step 2 is used as the input sequence length of each corresponding LSTM, and then the output of the first LSTM at the next moment and its hidden state are recursively calculated based on the input variables and hidden states of the first LSTM at a certain moment, wherein the outputs of the first LSTM at all moments constitute the output feature series of the first LSTM; the hidden state at the last moment of the first LSTM is used as the initial hidden state of the second LSTM, and the output and hidden state of the second LSTM at the next moment are recursively calculated based on the input variables of the second LSTM at each moment, wherein the outputs of the second LSTM at all moments constitute the output feature series of the second LSTM; the hidden state at the last moment of the last LSTM of the second LSTM is used as the initial hidden state of the third LSTM unit, and the output and hidden state of the third LSTM at the next moment are recursively calculated based on the input variables of the third LSTM at each moment, wherein the outputs of the third LSTM at all moments constitute the output feature series of the third LSTM; the output feature sequence of the third LSTM obtained is used as the extracted short-term time series influence of the leaching process on the pH value.
[0023] Furthermore, step S4 includes: using sin and cos functions to positionally encode the outputs of the three cascaded LSTMs, splicing the three encoded output sequences in the time dimension to obtain the input sequence Y calculated by the self-attention mechanism, mapping Y to the query matrix Q, the weight matrix K and the value matrix V, calculating the weight coefficient according to the query matrix Q and the weight matrix K, and then performing weighted summation on the value matrix V according to the weight coefficient to obtain the output calculated by the self-attention mechanism as the long-term temporal impact of the leaching process on the pH value.
[0024] Furthermore, in step S4, multiple self-attention mechanism calculations are performed to better extract the long-term temporal impact of the leaching process on the pH value, and the number of calculations is obtained by a trial and error method.
[0025] Furthermore, in step S5, before using the prediction model to predict the pH value, a step of training the prediction model is also included; the training step includes: calculating the mean square error between the actual pH value data in the training set and the pH value data predicted by the model, using the gradient descent method to obtain the parameters that minimize the mean square error to update the model, and the training can be stopped when the training reaches convergence (the mean square error no longer decreases), and the trained model can be obtained for prediction. That is, by minimizing the mean square error between the predicted value of the training set and the true value To update the entire network parameters, where y p (t) is the predicted value of the outlet pH of the leaching tank 3 at time tmin, and y(t) is the measured pH value of the leaching tank 3 at time t. N is the number of samples in the training set.
[0026] Furthermore, the specific calculation process in step S3 includes:
[0027] The calculation of the output and hidden state of the first LSTM at each moment is:
[0028]
[0029]
[0030] Combining formulas (1) and (2), the output characteristics of the first leaching tank are obtained as follows:
[0031]
[0032] in represents all variables from leaching tank 1 at time i. When i takes the value 1, The value is x 1# ,and When i takes the value 1, the corresponding hidden state is 0; is the output of leaching tank 1 at time i, is the hidden state of leaching tank 1 at time i; Y 1# is the output feature sequence of leaching tank 1;
[0033] The output and hidden state of the second LSTM at each moment are calculated as follows:
[0034]
[0035]
[0036] Combining formulas (3) and (4), the output characteristic sequence of the second leaching tank is:
[0037] in represents all variables from slot 2 at time i; when i is T lag hour, The value is x 2# ,and is the output of leaching tank 2 at time i, is the hidden state of leaching tank 2 at time i; Y 2# is the output feature sequence of leaching tank 2;
[0038] The calculation of the output and hidden state of the third LSTM at each moment is:
[0039]
[0040]
[0041] Combining formulas (5) and (6), the output characteristic sequence of the third leaching tank is: in Represents all variables from slot 3 at time i; when i is 2T lag hour, The value is x 3# , and x 3# ={M 3# , y}; is the output of leaching tank 3 at time i, is the hidden state of leaching tank 3 at time i; Y 3# is the output feature sequence of leaching tank 3;
[0042] Income Y 3# This is the short-term temporal effect of the leaching process on pH value.
[0043] Furthermore, the specific calculation process in step S4 includes:
[0044] Y i# ′=Yi# +PE(Y i# ), i#=1,2,3 (7);
[0045] PE(pos,2i)=sin(pos / 1000 2i / dim ) (8);
[0046] PE(pos,2i+1)=cos(pos / 1000 2i / dim ) (9);
[0047] Among them, PE() represents the position encoding function, where pos represents the posth moment of the input sequence, i represents the i-th feature dimension of the sequence, and dim represents the dimension of the entire sequence feature;
[0048] Combining formulas (7), (8) and (9), we can calculate Y 1# ′、Y 2# ′ and Y 3# ′;
[0049] Y 1# ′、Y 2# ′ and Y 3# ' splicing to get Y = [Y 1# ′,Y 2# ′,Y 3# ′],
[0050] The Y sequence is used for linear mapping to obtain the input matrices Q, K and V of the self-attention mechanism:
[0051] Q=W Q Y, K = W K Y, V = WV; (10)
[0052] Among them, W Q , W K and W V are all linear transformation matrices, and the dimensions of Q, K, and V are
[0053] The following formula is used to calculate self-attention:
[0054]
[0055] Among them, QK T is the dot product of Q and K;
[0056] Combining formulas (10) and (11), we get
[0057] Then use the following formula (13) to calculate N times:
[0058] Y=LayNorm(Att(Y)+Y) (13)
[0059] The Y obtained after N calculations is the long-term temporal effect of the leaching process on the pH value.
[0060] Furthermore, the specific calculation process of step S5 includes:
[0061] Y F =LayNorm(Y 3# +Y); (14)
[0062] y p (t+30)=Linear(Y F ); (15)
[0063] where Y 3# is the short-term time series effect of the leaching process on the pH value, Y is the long-term time series effect of the leaching process on the pH value, and Y F It is the characteristic of the short-term and long-term effects of the leaching process on pH value combined.
[0064] Combining formulas (14) and (15), we get the prediction model
[0065] y p (t+τ)=f p ([x (t-T) , x (t-T+1) , …, x (t) ],[y (t-T) ,y (t-T+1) , …, y (t) ]).
[0066] Compared with the prior art, the present invention has the following beneficial effects:
[0067] The present invention analyzes the leaching process and obtains that there is a long-term and short-term temporal dependency between the pH value of the leaching process and other process data. First, according to the average flow rate of the leaching process and the volume of each reactor, the average residence time of the solution in each reactor is calculated to obtain the sequence length of the model input (that is, prediction is made based on such a long historical data, which is a process characteristic); then a series LSTM module (deep learning technology) is established to simulate the first three cascaded leaching tanks (process topology), and the series LSTM modules are used to capture the short-term temporal relationship between the leaching process and the pH value; finally, the attention mechanism (deep learning technology) is used to solve the long-term dependency of the leaching process, that is, the long-term temporal relationship between the leaching process and the pH value is captured by the self-attention mechanism, and the short-term temporal relationship between the leaching process and the pH value is integrated with the short-term temporal relationship, and a prediction model is obtained after calculation. When the prediction model was used to predict the pH value of the neutral leaching process of hydrometallurgical zinc smelting, it was found that the prediction results were very close to the actual values. Compared with the existing prediction methods, the prediction accuracy was significantly improved, which is conducive to improving subsequent optimization control and process detection, increasing the leaching rate and impurity removal rate, etc., and better meeting the process production requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0069] Figure 1 This is a process flow chart of the neutral leaching process of zinc roasted sand.
[0070] Figure 2 A pH prediction model for fusion process characteristics.
[0071] Figure 3 This is a structural diagram of three LSTMs connected in series in the present invention.
[0072] Figure 4 This is a comparison chart of the prediction results of the prediction method in Example 1 of the present invention and the ordinary LSTM. DETAILED DESCRIPTION
[0073] In order to facilitate the understanding of the present invention, the present invention will be described in more comprehensive and detailed manner below in conjunction with the accompanying drawings and preferred embodiments of the specification, but the protection scope of the present invention is not limited to the following specific embodiments.
[0074] The process flow chart of the neutral leaching process of a smelter is as follows: Figure 1As shown in the figure, it can be seen that the neutral leaching process is mainly composed of 5 cascaded stirred reactors (leaching tanks), which are arranged in a stepped manner. The entrance of each leaching tank is located at the top, with a height difference of about 1 meter from the exit, and the entrance and exit of the leaching tank are connected by a chute. The acid leaching supernatant, mixed liquor, manganese ore slurry and other solvents are mixed in the chute and flow into the No. 1 leaching tank. The zinc roasted sand is continuously added to the leaching tank through a belt scale. The No. 1 and No. 2 reactors dissolve the zinc roasted sand by adding waste acid.
[0075] in:
[0076] Zinc roasted sand: It comes from the roasting process. It is zinc oxide and the main dissolved product. It also includes some sulfates, silicates and ferrites containing impurity ions. These impurity ions are also dissolved into the solution, which has a certain impact on the subsequent processes.
[0077] Waste acid: The solution produced during the electrolysis process, the solute is mainly sulfuric acid, which is mainly used for neutralization with zinc roasted sand;
[0078] Mixed liquor: a mixture of post-production liquor (i.e. waste liquor) from various processes in a smelter;
[0079] Acid leaching supernatant: The clarified solution after the acid leaching process is filtered through a thickener;
[0080] Manganese ore slurry: A slurry prepared with manganese sulfate as solute, mainly used to oxidize ferrous elements and sulfur elements in the solution.
[0081] In order to ensure the leaching temperature of the production process, steam is continuously introduced into each leaching tank. In order to ensure the production plan, the discharge of the first three tanks is determined by the dispatching. By controlling the amount of waste acid added to tanks 1 and 2, the zinc roasted sand and waste acid are neutralized to generate zinc sulfate, so that the zinc is dissolved as much as possible. Therefore, the first three leaching tanks mainly play a dissolving role; in order to further oxidize ferrous ions into ferric ions, excessive oxygen is usually introduced into the last two tanks. By fine-tuning the amount of roasted sand added to leaching tanks 4 and 5, the pH at the outlet of No. 5 is between 4.8 and 5.2, providing a stable precipitation environment for the hydrolysis and precipitation reaction of impurity ions (ferrous ions and silicates, etc.) in the solution. Finally, the slurry at the outlet of No. 5 is precipitated by the thickener, and the supernatant is sent to the purification process for further impurity removal, while the precipitate is sent to the acid leaching process. In order to meet the industrial indicators of the neutral leaching process - zinc leaching rate and impurity removal rate, the specific control target is to keep the pH at the outlet of No. 5 leaching tank between 4.8 and 5.2. According to the on-site investigation, as long as the pH value of tank 3 is controlled between 3 and 3.5, no subsequent operation is required to ensure that the pH of tank 5 is between 4.8 and 5.2. Otherwise, it is necessary to fine-tune the amount of roasted sand added to tanks 4 and 5 to control the pH of tank 5. In order to monitor the pH value information during the production process, a pH online detection device is often installed at the outlet of the leaching tank (a pH online detection device is installed at the outlet of tanks 3 and 5). Since No. 1 to No. 3 are the main feed tanks and the hydrogen ion concentration of the first two leaching tanks is too large, only the solution concentration at the outlet of tank 3 can be expressed in pH, so the pH detection device is installed at the outlet of leaching tank 3. Due to the large fluctuations and hysteresis of the leaching inlet conditions (waste acid, mixed liquor flow), the pH value at the outlet of tank 3 fluctuates violently, so an accurate estimation of the pH value at the outlet of tank 3 is of great significance for subsequent optimization control and process detection.
[0082] Aiming at the problem that the DH value at the outlet of No. 3 leaching tank in the leaching process is difficult to be accurately predicted, the present invention provides an accurate prediction method for the pH value of the leaching process integrating the process characteristics, and adopts the zinc roasting amount (in t / h) entering No. 1-3 leaching tanks per unit time, the waste acid addition flow rate (in m3 / h) of No. 1-2 leaching tanks, the mixed liquor addition flow rate (in m3 / h), the acid leaching supernatant flow rate (in m 3 / h) and the measured pH value at the outlet of No. 3 tank in the past to predict the pH value at the outlet of No. 3 tank at a certain moment in the future;
[0083] Combined with Figure 1 First, the variables used in the present invention are defined: M 1# 、M 2# and M 3# They are the amount of zinc roasted sand entering No. 1 leaching tank, No. 2 leaching tank and No. 3 leaching tank per unit time, in t / h; and The waste acid addition flow rates of No. 1 leaching tank and No. 2 leaching tank, in m 3 / h; F mix The mixed liquid addition flow rate of tank 1, in m 3 / h; F sup is the acid leaching supernatant flow rate of tank 1, in m 3 / h; y represents the actual measured pH value at the outlet of tank No. 3, which is dimensionless.
[0084] A method for predicting pH value of leaching process integrating process topology uses the variables of the past period defined above to predict the pH value of outlet 3 at a certain moment in the future (prediction is to estimate future data based on data of the past period).
[0085] Then give the following definition: represents all process variables (excluding pH) and x (t) represents the process variable at time t, y represents the pH value at outlet 3 and y (t) Represents the pH value of outlet 3 at time t. and represents all variables from slot 1 at time t, and represents all variables from slot 2 at time t, x 3# ={M 3# , y} and represents all variables from slot 3 at time t. The following is the form of each prediction:
[0086] y p (t, τ) = f p (τ,x t-T:t ,y t-T:t )
[0087] y p (t, τ) represents the predicted pH value at time t+τ, f p () represents the prediction model, x t-T:t Represents the set of all process variables from time tT to time t, y t-T:t represents the set of all pH values from time tT to time t. We use the rolling prediction method to predict y p (t, τ+1), we assume that x t-T:t+1 and t-T:t+1 Since the control cycle on site is once every 30 minutes, τ is taken as 30, that is, the pH value after 30 minutes is predicted. The following steps will give the specific modeling method.
[0088] Assuming that we are currently at time t, we use the past period of time T (that is, the process variables from time tT to time t as known quantities) to predict the pH value at time t+τ in the future. The specific formula can be expressed as:
[0089] y p (t+τ)=f p ([x (t-T) , x (t-T+1) , …, x (t) ],[y (t-T) ,y (t-T+1) , …, y (t) ])
[0090] where y p (t+τ) represents the predicted pH value at time t+τ, f p () represents the prediction model, [x (t-T) , x (t-T+1) , …, x (t) ] represents the set of all process variables from time tT to time t, where the values are taken regularly in units of 1 minute, [y (t-T) ,y (t-T+1) , …, y (t) ] represents the set of all pH values from time tT to time t. Since the actual control period is generally 30 minutes, we take τ as 30, that is, predict the pH value after 30 minutes, and the prediction model f p () and the input time domain T will be given in the following steps. The establishment of the prediction model can be seen in Figure 2 shown.
[0091] The first step is to calculate the residence time of the solution in a single reactor, i.e. the time from the inflow to the outflow of the solution from the reactor. The volume of a single reactor is V = 350m 3 , take the average flow rate of the solution as F = 700m 3 / h, so the residence time of a single reactor is T lag =V / F. Therefore, the lag time of reactor No. 1, reactor No. 2, and reactor No. 3 relative to the detection site is 3T respectively. lag , 2T lag , T lag That is, 90min, 60min and 30min. That is to say, the pH value at the outlet of tank 3 at the current time t is affected by the variables of reactor 1 90min ago (t-90 to t), by the variables of reactor 2 60min ago (t-60 to t), and by the variables of reactor 3 30min ago (t-30 to t). Therefore, we take the largest 3T lag As the prediction model f p()’s input time domain T.
[0092] In the second step, the leaching process consists of several reaction tanks connected in series, such as Figure 1 As shown in Figure 1, since the last reaction tank is close to the detection point, the lag time is short and the pH value is affected quickly, so the short-term dependence in the extraction time series is very important. Figure 2 As shown in the figure, three cascaded long short-term memory networks (serial LSTM) are used to simulate the topological structure of the leaching process of the first three leaching reactors in the leaching system. The input sequence lengths of the three LSTMs are the lag time required in the first step, that is, the sequence length of the first LSTM is 3T. lag , the sequence length of the second LSTM is 2T lag , the sequence length of the third LSTM is T lag , and the input variables of the first, second, and third LSTM are The specific calculation steps are as follows:
[0093] For the specific structure of the tandem LSTM, see the attached Figure 3 , where the first two are LSTM encoders, the third is LSTM decoder, and the connection vector between adjacent LSTMs is the hidden state of the previous LSTM at the last moment.
[0094] For the first LSTM encoder, the input variable of the current moment i is input at each moment And the hidden state of the previous moment (The hidden state represents the record of useful information at the past moment, which will be passed down), and the hidden state at the current moment is obtained Output The output state and hidden state at the initial moment are obtained by the input variables at the initial moment (there is no hidden state at the previous moment). Then the hidden state and output of the first LSMT decoder at all moments can be obtained by the input sequence Step-by-step coding yields:
[0095]
[0096]
[0097] Where f() is a nonlinear function, and the output characteristic of the first leaching tank is obtained as follows:
[0098] The hidden state of the first LSTM encoder at the last moment It means to initialize the second LSTM encoder to simulate the information flow between the leaching tanks. Then the output feature of the second leaching tank is It can be obtained step by step by the following expressions:
[0099]
[0100]
[0101] Finally, we can get the same result:
[0102]
[0103]
[0104] We output the output feature sequence obtained by the third LSTM decoder It is considered to capture the short-term temporal dependence of the leaching process on pH.
[0105] Step 3: Leaching is a process technology. The leaching process is a large time-delay system. The first two reaction tanks are far from the pH detection point, so the impact on the pH value is relatively delayed. This step uses the self-attention mechanism to extract the long-term dependency in the time series, that is, to extract the long-term temporal impact of the leaching process on the pH value. Since the self-attention mechanism is to do dot products between sequences, it does not consider the temporal relationship in the sequence. Therefore, the input sequence must first be positionally encoded to add temporal correlation, such as Figure 2 As shown, firstly, the output feature sequences of the first three leaching tanks in step 2 are positionally encoded, that is, the outputs of the three cascaded LSTMs are positionally encoded using sin and cos functions, and the following is obtained:
[0106] Y i# ′=Y i# +PE(Y i# ), i#=1,2,3 (7)
[0107] PE(pos,2i)=sin(pos / 1000 2i / dim ) (8)
[0108] PE(pos,2i+1)=cos(pos / 1000 2i / dim ) (9)
[0109] PE() stands for position encoding function, where pos represents the posth moment of the input sequence, i represents the i-th feature dimension of the sequence, and dim represents the dimension of the entire sequence feature. For example, (Assuming 4 dimensions, dim = 4) then (pos=1) is positionally encoded as cos(1 / 1000 0 / 4 ), sin(1 / 1000 2 / n ), cos(1 / 10002 / n )}, cos(2 / 1000 0 / n ), sin(2 / 1000 2 / n ), cos(2 / 1000 2 / n )}…) After that, the three encoded output sequences are concatenated in the length dimension (i.e., the time dimension) to obtain the input sequence number Y calculated by the self-attention mechanism, i.e., Y = [Y 1# ′,Y 2# ′,Y 3# ′], and then perform self-attention calculation on Y.
[0110] The input of the classic self-attention mechanism includes three matrices Q, K, and V. They are all obtained by linearly mapping the above Y sequence through the following formula, where Q is the query matrix, K is the weight matrix, and V is the value matrix.
[0111] Q=W Q Y, K = W K Y, V = W V (10)
[0112] Among them, W Q , W K and W V are all linear transformation matrices, and the dimensions of Q, K, and V are
[0113] The self-attention calculation formula is as follows:
[0114]
[0115] First, the weight coefficient is calculated based on the query matrix Q and the weight matrix K, that is, the dot product of Q and K (QK T ), the result is divided by a normalization parameter, and then a weight matrix is obtained through the softmax() activation function. The value matrix V is then weighted and summed according to the weight coefficient. Multiplying the result with V is equivalent to weighting V. The final result is the calculation result of a layer of self-attention mechanism.
[0116] Combining the above formula (10) and formula (11) we can get
[0117]
[0118] In order to further improve the ability of feature extraction, we usually calculate N layers of self-attention mechanism, where N is determined by trial and error, that is, the formula Y = LayNorm (Att (Y) + Y) is calculated N times, where LayNorm () is a normalization function and Att () represents a layer of self-attention calculation. The final Y vector obtained after calculation is the long-term feature of the leaching process that is finally extracted, that is, the long-term time series effect Y of the leaching process on the pH value.
[0119] Step 4: The short-term process characteristics obtained in step 2, i.e., the short-term time series effect of the leaching process on the pH value, are converted into 3# The long-term process characteristics obtained in step 4, i.e., the long-term temporal effect Y of the leaching process on the pH value, are added and fused:
[0120] T F =LayNorm(Y 3# +Y) (13)
[0121] Then a linear regression layer is used to calculate the final prediction result:
[0122] y p (t+30)=Linear(Y F ); (14)
[0123] Combining formula (13) and formula (14) we get the prediction model:
[0124] y p (t+τ)=f p ([x (t-T) , x (t-r+1) , …, x (t) ],[y (t-T) ,y (t-T+1) , …, y (t) ]);
[0125] Among them, y p (t+30) is the predicted pH value of outlet 3 at time t+30min, and Linear() represents the linear regression layer. We minimize the square error mse=(y p (t+30)-y(t)) 2 To update the entire network parameters.
[0126] Example 1
[0127] This method is applied to the actual data of zinc smelting leaching process of a smelter. The specific prediction steps are shown in the following table:
[0128] Table 1. Algorithm flow
[0129]
[0130]
[0131] In order to demonstrate the superiority of this invention, we took 4200 sets of actual data as training models and 1800 sets for model testing. We compared the trained deep pH model with the ordinary LSTM on the test set. The specific comparison results are as follows: Figure 4 Shown by: Figure 4 It can be seen that the prediction results obtained by the deep pH prediction method of this embodiment have a better fitting effect and can better follow the actual value, because this invention organically combines deep learning with technology and process, and fully extracts the long-term and short-term dependencies of the process. In order to specifically reflect the superiority of the proposed method, the root mean square error (RMSE) and the coefficient of determination (R 2 ) was used to evaluate the model. The results are shown in Table 2, where RMSE is the root mean square error, and the smaller the RMSE, the higher the model accuracy; the coefficient of determination is R 2 , the value is between 0 and 1. The closer to 1, the closer the shape of the curve predicted by the model is to the actual value. It can be seen from the table that the prediction result of the prediction method of the embodiment is closer to the measured pH value. It can be seen that the prediction method of the present invention has higher prediction accuracy.
[0132] Table 2: Comparison between the proposed method and LSTM
[0133] Model RMSE <![CDATA[R 2 ]]> LSTM 0.1092 0.7752 Prediction method of embodiment 1 0.0510 0.9501
[0134] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for predicting pH value in neutral leaching process of hydrometallurgical zinc smelting. It is characterized in that include: S1. Determine the process variables of each leaching tank; S2, determining the residence time of the solution in each leaching tank, and then determining the lag time of each leaching tank relative to the detection site as the input time domain of the prediction model; S3, using three cascaded LSTMs to simulate the leaching process of the first three series-connected leaching tanks, obtaining the output feature sequences of the three LSTMs, and using the output feature sequence of the third LSTM as the short-term time series impact of the leaching process on the pH value; S4, the output feature sequences of the three cascaded LSTMs are first positionally encoded, and then the output feature sequences of the three LSTMs are spliced in the time dimension, and then the self-attention mechanism is calculated, and the obtained results are used as the long-term temporal influence of the leaching process on the pH value; S5. The short-term time series effect and long-term time series effect of the leaching process on the pH value extracted in step 3 and step 4 are added and fused, and after LayerNorm normalization, a linear regression calculation is performed to obtain the pH value prediction model y for the neutral leaching process of hydrometallurgical zinc smelting. p (t+τ)=f p ([x (t-T) , x (t-T+1) , ..., x (t) ],[y (t-T) ,y (t-T+1) , ..., y (t) ]), and then use the prediction model to predict the pH value.
2. The method for predicting pH value of neutral leaching process of hydrometallurgy of zinc according to claim 1, It is characterized in that In step S1, the process variables of the leaching tank 1 include: the amount of zinc roasted sand entering the leaching tank 1 per unit time M 1# , Waste acid flow rate of leaching tank 1 Mixed liquor flow rate F of leaching tank 1 mix and the acid leaching supernatant flow F of leaching tank 1 sup ; The process variables of the leaching tank 2 include: the amount of zinc roasted sand entering the leaching tank 2 per unit time M 2# , the waste acid addition flow rate of leaching tank 2 The process variables of the leaching tank 3 include: the amount of zinc roasted sand entering the leaching tank 3 per unit time M 3# , the measured pH value y at the outlet of leaching tank 3.
3. The method for predicting pH value of neutral leaching process of hydrometallurgy of zinc according to claim 1, It is characterized in that In step S2, the lag time of each leaching tank relative to the detection site is determined by: the volume of the leaching tank is V, the average flow rate of the solution is F, and the residence time of a single leaching tank is T lag =V / F, so the lag time of leaching tank 1, leaching tank 2, and leaching tank 3 relative to the detection site is 3T respectively lag , 2T lag and T lag .
4. The method for predicting pH value of neutral leaching process of hydrometallurgy of zinc according to claim 1, It is characterized in that In step S3, the process variables of each leaching tank determined in step S1 are used as the input variables of each corresponding LSTM, and the lag time of each leaching tank relative to the detection site determined in step S2 is used as the input sequence length of each LSTM, and then according to the input variables and hidden state of the first LSTM at a certain moment, the output of the first LSTM at the next moment and its hidden state are recursively calculated, wherein the output of the first LSTM at all moments constitutes the output feature series of the first LSTM; The hidden state of the last moment of the first LSTM is used as the initial hidden state of the second LSTM. The output and hidden state of the second LSTM at the next moment are recursively calculated according to the input variables of the second LSTM at each moment. The output of the second LSTM at all moments constitutes the output feature series of the second LSTM. The hidden state of the last LSTM of the second LSTM at the last moment is used as the initial hidden state of the third LSTM unit. The output and hidden state of the third LSTM at the next moment are recursively calculated according to the input variables of the third LSTM at each moment. The output of the third LSTM at all moments constitutes the output feature series of the third LSTM. The output feature sequence of the third LSTM is used as the short-term time series effect of the extracted leaching process on the pH value.
5. The method for predicting pH value of neutral leaching process of hydrometallurgy of zinc as claimed in claim 1, It is characterized in that The step S4 includes: using sin and cos functions to positionally encode the outputs of the three cascaded LSTMs, splicing the three encoded output sequences in the time dimension to obtain the input sequence Y calculated by the self-attention mechanism, mapping Y to the query matrix Q, the weight matrix K and the value matrix V, calculating the weight coefficient according to the query matrix Q and the weight matrix K, and then performing weighted summation on the value matrix V according to the weight coefficient to obtain the output calculated by the self-attention mechanism as the long-term temporal impact of the leaching process on the pH value.
6. The method for predicting pH value of neutral leaching process of hydrometallurgy of zinc as claimed in claim 5, It is characterized in that In step S4, multiple self-attention mechanism calculations are performed to better extract the long-term temporal impact of the leaching process on the pH value, and the number of calculations is obtained by trial and error.
7. The method for predicting pH value of neutral leaching process of hydrometallurgy of zinc as claimed in claim 1, It is characterized in that In step S5, before using the prediction model to predict the pH value, it also includes the step of training the prediction model; the training step includes: calculating the mean square error between the actual pH value data in the training set and the pH value data predicted by the model, using the gradient descent method to solve the parameters that minimize the mean square error to update the model, and stopping the training when the mean square error no longer decreases.
8. The method for predicting pH value of neutral leaching process of hydrometallurgy of zinc as claimed in claim 4, It is characterized in that The specific calculation process in step S3 includes: The calculation of the output and hidden state of the first LSTM at each moment is: Combining formulas (1) and (2), the output characteristic sequence of the first leaching tank is obtained as follows: in represents all variables from leaching tank 1 at time i; is the output of leaching tank 1 at time i, is the hidden state of leaching tank 1 at time i; Y 1# is the output feature sequence of leaching tank 1; The output and hidden state of the second LSTM at each moment are calculated as follows: Combining formulas (3) and (4), the output feature sequence of the second leaching tank is obtained as follows: in Represents all variables from slot 2 at time i; is the output of leaching tank 2 at time i, is the hidden state of leaching tank 2 at time i; Y 2# is the output feature sequence of leaching tank 2; The calculation of the output and hidden state of the third LSTM at each moment is: Combining formulas (5) and (6), the output feature sequence of the third leaching tank is obtained as follows: in Represents all variables from slot 3 at time i; is the output of leaching tank 3 at time i, is the hidden state of leaching tank 3 at time i; Y 3# is the output feature sequence of leaching tank 3; Income Y 3# This is the short-term temporal effect of the leaching process on pH value.
9. The method for predicting pH value in neutral leaching process of hydrometallurgy of zinc as claimed in claim 5, It is characterized in that The specific calculation process of step S4 includes: Y i#’ =Y i# +PE(Y i# ),i#=1,2,3 (7); PE(pos,2i+1)=cos(pos / 1000 2i / dim ) (9); Among them, PE() represents the position encoding function, where pos represents the posth moment of the input sequence, i represents the i-th feature dimension of the sequence, and dim represents the dimension of the entire sequence feature; Combining formulas (7), (8) and (9), we can calculate Y 1#’ , Y 2#’ and Y 3#’ ; Y 1#’ , Y 2#’ and Y 3#’ Splicing to get Y = [Y 1#’ , Y 2#’ , Y 3#’ ], The Y sequence is used for linear mapping to obtain the input matrices Q, K and V of the self-attention mechanism: Q=W Q Y,K=W K Y,V=W V ;(10) Among them, W Q , W K and W V are all linear transformation matrices, and the dimensions of Q, K, and V are The following formula is used to calculate self-attention: Among them, QK T is the dot product of Q and K; Combining formula (10) and (11), we get Then use the following formula (13) to calculate N times: Y=LayNorm(Att(Y)+Y) (13) The Y obtained after N calculations is the long-term temporal effect of the leaching process on the pH value.
10. The method for predicting pH value of neutral leaching process of hydrometallurgy of zinc according to claim 5, It is characterized in that The specific calculation process of step S5 includes: <h2 style=";text-align:left;direction:ltr">Y<h2 style=";text-align:left;direction:ltr"> F <h2 style=";text-align:left;direction:ltr"> =LayNorm(Y3<h2 style=";text-align:left;direction:ltr"> # <h2 style=";text-align:left;direction:ltr"> +Y); (14) y p (t+30)=Linear(Y F ); (15) where Y 3# is the short-term time series effect of the leaching process on the pH value, Y is the long-term time series effect of the leaching process on the pH value, and Y F It is the characteristic of the short-term and long-term effects of the leaching process on pH value. p (t+30) is the predicted pH value at the outlet of leaching tank 3 at time t+30min; Combining formulas (14) and (15), we get the prediction model and p (t+τ)=f p ([x (t-T) ,x (t-T+1) ,...,x (t) ],[and (t-T) ,and (t-T+1) ,...,and (t) ])。
