A lysozyme fermentation temperature control method based on LSTM-PID
By using mechanism modeling and an improved whale optimization algorithm to initialize the LSTM neural network parameters during the lysozyme fermentation process, combined with a PID controller, the overshoot and stabilization speed problems in temperature control were solved, fast and precise temperature control was achieved, and the stability of the fermentation process and yeast activity were ensured.
Patent Information
- Application Number
- CN202310058086.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-13
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2043-01-13
AI Technical Summary
The existing temperature control method has the problems of large temperature overshoot and slow stabilization speed during the lysozyme fermentation process, which affects yeast activity and the progress of the fermentation process.
Mechanism modeling is used to establish a temperature mathematical model. The whale optimization algorithm is enhanced by combining the random walk strategy and the Levy flight strategy. The improved whale optimization algorithm is used to initialize the LSTM neural network parameters, and the output of the LSTM is set as the three K values of the PID controller. The LSTM neural network and the PID algorithm are integrated to optimize the controller parameters.
The stabilization speed of temperature control is improved and overshoot is reduced, which enables fast response and precise temperature control and ensures the stability and quality of the lysozyme fermentation process.
Smart Images

Figure CN115966267B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of biological lysozyme fermentation, and specifically relates to a lysozyme fermentation temperature control method based on LSTM-PID. This method is used to control the temperature of lysozyme in a fermentation tank during the lysozyme fermentation process. Background Art
[0002] Lysozyme is an anti-infective substance with antiviral, antibacterial, hemostatic, analgesic, and tissue recovery-accelerating properties. In industrial production, temperature significantly impacts lysozyme fermentation, primarily in terms of the enzyme's reaction rate, changes in the synthesis of bacterial metabolites, and the effects on the metabolic regulation mechanisms of microorganisms. Therefore, stringent requirements are placed on temperature control technology in lysozyme production. During the fermentation process, due to the time lag in the refrigerant cooling of the fermenter system, conventional control algorithms using a fermenter production control system to control the fermenter temperature will produce a significant overshoot that cannot be recovered in a short period of time. This can lead to a large temperature error, which in turn affects the quality of the lysozyme and, in severe cases, can inactivate the yeast, preventing the fermentation process from continuing.
[0003] Proportional-integral-derivative (PID) controllers have become a staple of industrial control due to their simple structure, good stability, reliable operation, and easy adjustment. For example, K.V.Srikar used PID to control the temperature in aircraft cabins. K.Li and W.Liu used an expert PID control method to control cabin temperature. This method has the advantage of no overshoot, but they did not address other time-domain parameters, such as delay time, rise time, and steady-state time. X.Wu and X.Wang applied a fuzzy self-tuning PID control algorithm to the temperature control area of a 3D bioprinting device. G.He applied fuzzy adaptive PID to the temperature control of experimental environments in the development and production of military equipment. Fuzzy PID was used to achieve self-tuning of PID parameters, achieving satisfactory results in temperature control. These studies demonstrate the widespread application and importance of these controller types. Wiharya C. utilized the advantages of internal model control (IMC), such as simple design structure and good control performance, to significantly improve the design capabilities of conventional model control and PID. Based on this, he proposed an IMC-PID control method and applied it to a blackbody radiation source temperature control system. Research has shown that this method has good results.
[0004] In order for PID to play the required role in each system, it is necessary to adjust its gain quickly and accurately. The conventional tuning method is the Ziegler-Nichols tuning method, which is based on certain characteristic parameters in the open-loop dynamic response of the controlled process to tune the PID parameters. However, some studies have shown that some new methods have better results in parameter tuning. X. Zhang and J. Ren used fuzzy logic and optimized the PID parameters in real time according to certain fuzzy rules. Another algorithm is the swarm intelligence optimization (meta-heuristic) algorithm. For example, L. Jia and X. Zhao proposed a PID controller parameter tuning based on the particle swarm optimization algorithm, which cleverly combined bird flock foraging, group organization and optimization mechanism to form a new parameter tuning method. Another intelligent optimization algorithm for PID controller parameter tuning is the genetic algorithm, which has also achieved good results. Metaheuristic algorithms have been widely used in various fields. Numerous studies, including [ 1 ], have analyzed the characteristics of these algorithms in various fields. Although heuristic algorithms are highly adaptable and efficient, their iterative nature increases the execution time of online implementations. Another widely used method for PID parameter tuning is the artificial neural network (ANN), also known as a parallel distributed processing model or a connection mechanism model. This is a mathematical model that mimics the structure and function of physiological human brain neural networks. It is an adaptive nonlinear dynamic information processing system composed of a large number of artificial neurons capable of performing complex logical operations. Due to its advantages such as high parallelism, high nonlinearity, good fault tolerance, associative memory, and adaptability, it has been widely used by many researchers for PID parameter tuning. These studies indicate that PID parameter tuning is a topic worthy of further study. Summary of the Invention
[0005] In view of the shortcomings of the existing technology, the present invention provides a lysozyme fermentation temperature control method based on LSTM-PID, which aims to solve the technical problems of large temperature overshoot and slow stabilization speed in the existing temperature control method; the method first establishes a temperature mathematical model of a lysozyme fermenter through a mechanism modeling method, and then uses a random walk strategy and a Levy flight strategy to improve the optimization ability of a whale optimization algorithm (WOA), and then uses the improved whale optimization algorithm to determine the initial stage parameters for a long short-term memory network (LSTM), and then sets the output of the LSTM neural network as three K values of a PID controller and trains to obtain the most suitable K value, and finally substitutes the K value optimized by the LSTM neural network into the PID controller to complete the control of the fermenter control system.
[0006] A lysozyme fermentation temperature control method based on LSTM-PID comprises the following steps:
[0007] S1, the temperature mathematical model of the lysozyme fermentation tank was established using the mechanism modeling method;
[0008] S2, collecting the temperature, density, flow rate and volume of lysozyme in the fermentation tank, and bringing the acquired specific parameters into the established mathematical model to obtain the corresponding temperature transfer function;
[0009] S3, uses random walk strategy and Lévy flight strategy to enhance the whale optimization algorithm to enhance the global optimization ability of the whale optimization algorithm when dealing with complex problems;
[0010] S4, build an LSTM neural network model to find the most critical K value for the PID algorithm to speed up the optimization process, reduce overshoot, and increase the stabilization speed;
[0011] S5, based on step S3, uses the improved whale optimization algorithm to optimize the initial parameters of the neural network LSTM;
[0012] S6, build the LSTM-PID algorithm based on steps S3, S4, and S5. The algorithm sets the output of LSTM as the three parameters K of PID p , K i , K d The LSTM back propagation algorithm and the PID algorithm are integrated to ensure the smooth training of the model. The three parameters obtained after the LSTM neural network optimization are brought into the PID controller to obtain the control parameters.
[0013] S7, the control parameters obtained by the LSTM-PID algorithm are transferred to the fermentation tank production control system for temperature control.
[0014] Preferably, the detailed steps of S1 are:
[0015] A chemical reaction rate equation is established for the lysozyme fermenter according to the concentration and temperature of lysozyme; a material balance equation is established for the lysozyme fermenter according to the amount of material in the fermenter; a heat balance equation is established for the lysozyme fermenter according to the heat balance relationship; three nonlinear dynamic equations are obtained in sequence, and the nonlinear equations are linearized using differential operations to obtain the state equation.
[0016] Preferably, the detailed steps of S2 are:
[0017] The temperature, density, flow rate, volume of lysozyme in the fermenter, as well as the volume of the fermenter jacket and the volume of the condenser are collected. The heat transfer area, heat transfer coefficient, specific heat capacity, condenser density, reaction activation energy, gas constant, and reaction frequency factor are determined based on the fermenter parameters and the lysozyme fermentation process. The collected parameters are analyzed and adjusted and introduced into the mathematical model established in step S1 to obtain a specific fermenter temperature transfer function, which is as follows:
[0018]
[0019] Preferably, the detailed steps of S3 are:
[0020] Establish the whale optimization algorithm, random walk strategy and Levy flight strategy respectively. After the establishment is completed, in the process of whale optimization algorithm optimization, when the random individual value satisfies the best individual value or the second best individual value or the third best individual value and is less than When the whale individual selects the Lévy flight strategy update formula to update the individual position; when the random individual value satisfies the best individual value or the second best individual value or the third best individual value and is greater than or equal to When , the whale individual selects the random swimming strategy update formula to update the individual position; otherwise, the original whale optimization algorithm update formula is selected to update the individual position. Where t is the tth generation of the iterative process, max is the maximum number of iterations, is the exploration iteration ratio.
[0021] Preferably, the detailed steps of S4 are:
[0022] Build an LSTM neural network model and construct the model's input gate, output gate, forget gate, weights, and thresholds to facilitate the subsequent addition of the PID control algorithm.
[0023] Preferably, the detailed steps of S5 are:
[0024] The initial weights of the LSTM neural network are set to the whale individuals of the improved whale optimization algorithm (LRWOA) described in step S3, and the back propagation algorithm of the LSTM neural network is set to the fitness function of LWROA. When LWROA satisfies less than the given fitness function, the initial weights of the neural network W obtained by LWROA iterative optimization are obtained. f ,W i ,W c ,W o .
[0025] Preferably, the detailed steps of S6 are:
[0026] S6.1: Construct a PID control algorithm and combine it with the LSTM neural network. Determine the learning rate η and inertia coefficient α of the LSTM neural network and set the initial time m to 1.
[0027] S6.2: By setting the target temperature r(m) and the actual temperature y(m) obtained by measurement sampling, the error e(m) at this moment is calculated. The calculation formula of e(m) is e(m) = r(m) - y(m);
[0028] S6.3: Use r(m), y(m), e(m), e(m-1), and e(m-2) as the input of the LSTM neural network, and set the initial values r(0), y(0), e(0), e(-1), and e(-2) to 0;
[0029] S6.4: Set the output of the LSTM neural network as the three adjustable parameters K of the PID controller p , K i , K d ;
[0030] S6.5: Calculate the output Δu(m) of the PID controller:
[0031]
[0032] S6.6: Set the difference e(m) between y(m) and r(m) as the error of the LSTM neural network, perform LSTM neural network learning, and adjust the neural network weight parameters online to achieve adaptive adjustment of the controller parameters;
[0033] S6.7: When e(m) is less than the set threshold, stop adjusting the controller parameters, determine the final controller parameters and bring them into the PID controller to obtain the control parameters.
[0034] The beneficial effects of the present invention are as follows:
[0035] 1. The present invention uses Lévy flight and random walk strategies to optimize the whale algorithm, and utilizes the good global search capability of Lévy flight and the good local search capability of random walk strategy to solve the problem that the whale optimization algorithm easily falls into local extreme values, i.e., converges prematurely, when facing complex models such as neural network LSTM.
[0036] 2. This paper uses the optimized whale algorithm for LSTM parameter initialization. Because initial parameters have a significant impact on the speed of neural network training, and the traditional method of random parameter initialization has a certain degree of uncertainty, this paper uses an improved whale optimization algorithm to optimize the initial parameters of the neural network LSTM, thereby accelerating the speed and stability of neural network training.
[0037] 3. This invention uses LSTM for intelligent adjustment of PID parameters. Traditional neural network PID uses a simple BP neural network, which is not ideal in terms of control speed and overshoot. The LSTM neural network with memory function proposed in this invention can utilize effective target information as well as previous parameter information and control variable information to further improve the performance of the controller. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1is a flowchart of the steps of the method according to an embodiment of the present invention;
[0039] Figure 2 1 is a flow chart of a PID controller according to an embodiment of the present invention;
[0040] Figure 3 This is a flow chart of LRWOA optimization of LSTM parameters according to an embodiment of the present invention;
[0041] Figure 4 This is a structural diagram of the LSTM neural network algorithm according to an embodiment of the present invention;
[0042] Figure 5 is a graph of three K values in a PID controller according to an embodiment of the present invention;
[0043] Figure 6 2 is a test result diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0045] The purpose of the present invention is to provide a lysozyme fermentation temperature control method based on LSTM-PID, which optimizes the PID controller by the neural network LSTM according to the difference between the temperature in the fermentation tank and the expected temperature to achieve rapid response.
[0046] Figure 1 This is a flow chart of the neural network LSTM-PID controller of the present invention, as shown Figure 1 As shown in the figure, to improve the global optimization capability of the whale optimization algorithm for complex problems, the Lévy flight and random walk strategies, both of which have strong optimization capabilities, are used to optimize the whale algorithm. The optimized whale algorithm is used to initialize the initial parameters of the LSTM neural network, improving the convergence speed and stability of the LSTM training. The LSTM neural network is then used to self-tune the parameters of the PID controller, accelerating control speed and reducing overshoot. Finally, the PID controller is used to establish the transfer function for this method.
[0047] like Figure 1-5 As shown in FIG, a lysozyme fermentation temperature control method based on LSTM-PID is implemented as follows:
[0048] A method for LSTM neural network PID temperature control, comprising the following steps:
[0049] S1, the temperature mathematical model of the lysozyme fermentation tank was established using the mechanism modeling method;
[0050] S1.1: Establish a chemical reaction rate equation and model the temperature of the lysozyme fermenter; the fermenter is a first-order irreversible exothermic reaction. The concentration and temperature of the reactants in the fermentation tank are uniformly distributed and consistent with the concentration and temperature of the fermentation product; thus, the reaction rate equation of reactant A is obtained: A for:
[0051]
[0052] Where A is bacterial seed; B is lysozyme; E is the activation energy of reaction, KJ / mol; R is the gas constant; k0 is the reaction frequency factor; c A is the concentration of reactant A;
[0053] S1.2: Establish a material balance equation. For a fermenter, the amount of material entering the fermenter minus the amount of material leaving the fermenter per unit time, plus (or minus) the amount of material generated (or consumed) by the chemical reaction, should equal the rate of change of the cumulative amount of material in the fermenter. Since the fermenter is fully stirred, it is assumed that the reaction tank is fully mixed, so the temperature, density, and molecular concentration of reactant A are equal throughout the tank.
[0054] For the fermentation tank, the overall material balance equation is:
[0055]
[0056] Where F0, ρ0 are the volume flow rate and density of the feed respectively; F, ρ are the volume flow rate and density of the discharge respectively; V is the effective volume of the reactor;
[0057] The material balance formula for reactant A is
[0058]
[0059] Where C A0 is the reactant concentration in the feed;
[0060] S1.3: Establish a heat balance equation, using the fermentation tank as the isolator. The heat balance relationship shows:
[0061]
[0062] Where H Ris the amount of heat accumulated in the tank, Q1 is the heat brought into the reaction material per unit time, and Q2 is the heat taken away by the reaction material per unit time; Q3 is the thermal effect of the chemical reaction per unit time. For exothermic reactions, the sign before Q3 is "+"; for endothermic reactions, it is "-"; Q4 is the amount of heat exchanged with the outside world per unit time. If heat is dissipated to the outside, it is "-", and if heat is supplied to the fermenter from the outside, it is "+". In the case of adiabatic, this item is 0;
[0063] In order to facilitate the problem, the coolant temperature in the jacket and the coolant outlet temperature T C0 The heat balance formula for the fermentation tank is:
[0064]
[0065] Where C p is the average specific heat capacity of the materials entering and leaving the reaction; T f is the reaction feed temperature; F p is the average volume flow rate of the inlet and outlet materials; ΔH is the unit reaction heat, KJ / mol; K e A is the total heat transfer coefficient between the heat carrier and the material in the fermentation tank; e is the heat transfer area;
[0066] Similarly, the heat balance formula of the condensed water in the jacket is:
[0067]
[0068] Where C pc is the average specific heat capacity of the condenser; V c is the volume of the condenser in the jacket; ρ c is the density of the refrigerant; F c is the volume flow rate of the refrigerant; T ci , T co are the inlet and outlet temperatures of the condenser respectively;
[0069] Since the volumes of the fermentation tank and the jacket remain unchanged and the densities of the inlet and outlet reaction materials are the same, F = F0 can be obtained from formula (2). Substituting formulas (1) and (2) into formulas (3), (5), and (6), we can obtain:
[0070]
[0071]
[0072]
[0073] S1.4: Linearization of nonlinear model. The equations (7) to (9) derived above are nonlinear dynamic equations. In order to facilitate the application of current control theory to analyze the dynamic behavior under small disturbances, the above equations need to be linearized. The state variables of the fermentation tank system are {c A ,T,T co The input variables of the fermentation tank system are composed of the manipulated variables of the actual industrial process and the main external disturbances. The input variables considered here are {F,c A0 ,T f ,F c ,T ci};
[0074] The steady-state values of the fermentation tank system state and input variables are The change in the input variable is {Δc A ,ΔT,ΔT co ,ΔF,Δc A0 ,ΔT f ,ΔF c ,ΔT ci}; Use differential operation to obtain the linearized model, which can be obtained from formula (7);
[0075]
[0076] Where, Δ represents the amount of change; the superscript - represents the vector of each variable;
[0077] Similarly, from formula (8) and formula (9), we can get:
[0078]
[0079]
[0080] If Z={Δc A ΔT ΔT co} T ,U={ΔF Δc A0 ΔT f ΔF c ΔT ci} T , we can get the following standard current state equation:
[0081]
[0082] Where:
[0083]
[0084]
[0085] The state equation comprehensively reflects the dynamic characteristics of the fermenter temperature system input (including manipulated variables and external disturbances) on the fermenter temperature system output, and can be used as the basis for object stability analysis and current control method design.
[0086] S2, by measuring and collecting the temperature, density, flow rate and volume of lysozyme in the fermentation tank, the specific parameters obtained are brought into the established mathematical model to obtain the corresponding transfer function;
[0087] The temperature, density, flow rate, volume of lysozyme in the fermenter, as well as the volume of the fermenter jacket and the volume of the condenser are collected. The heat transfer area, heat transfer coefficient, specific heat capacity, condenser density, reaction activation energy, gas constant, and reaction frequency factor are determined based on the fermenter parameters and the lysozyme fermentation process. The collected parameters are analyzed and adjusted and then applied to the mathematical model established in step S1 to obtain the specific transfer function required by the present invention. The function is as follows:
[0088]
[0089] S3, uses random walk strategy and Lévy flight strategy to enhance the whale optimization algorithm to enhance the global optimization ability of the whale optimization algorithm when dealing with complex problems;
[0090] S3.1: The establishment of the whale optimization algorithm requires three main steps. The first step is to surround the prey. Assume that in the D-dimensional space, the current best whale individual X * The location is Whale Individual X j The location is Then the whale individual X j Next position under the influence of the best whale individuals The calculation formula is as follows:
[0091]
[0092]
[0093] C1=2r2 (17)
[0094] A1=2a·r1-a (18)
[0095] in Represents the spatial coordinate X j+1 The kth component of k Denotes the distance between the kth whale and its prey; calculate D k In the formula, || means to find the absolute value; a decreases linearly from 2 to 0 as the number of iterations increases; r1 and r2 are both random numbers between 0 and 1;
[0096] S3.2: The second is the bubble net attack, which is a unique bubble-blowing predation behavior of humpback whales. To simulate this predation behavior, two mathematical models are designed to express the above predation behavior.
[0097] Convergence Mechanism: This predation behavior is almost identical to the mathematical model for the aforementioned encirclement behavior, with the difference being the range of A1. Because converging means moving the whale in its current position closer to the whale in the current optimal position, the range of A1 is adjusted from [-a, a] to [-1, 1], while the other formulas remain unchanged.
[0098] Spiral update position: The current whale moves in a spiral manner towards the current best whale, simulating the spiral movement of the humpback whale as follows:
[0099]
[0100]
[0101] Where b is the logarithmic spiral shape constant, and l is a random number between -1 and 1. When humpback whales hunt their prey, they not only tighten their encirclement but also swim towards it in a spiral. Therefore, with a 50% probability of either tightening the encirclement or swimming towards it in a spiral, the mathematical model is as follows:
[0102]
[0103] S3.3: Finally, there is search and predation. In the mathematical model of shrinking and encircling predation behavior, the value range of A1 is limited to [-1, 1]. However, when the value range of A1 is not [-1, 1], the current whale individual may not approach the current best whale individual, but instead randomly select a whale individual from the current whale group to approach. This is the concept of search and predation. Although search and predation may cause a random whale individual in the current whale group to deviate from the target prey, it will enhance the global search ability of the whale group. In D-dimensional space, a random whale individual X in the current whale group rand The location is Whale Individual X j The location is The mathematical model of search and predation behavior is as follows:
[0104]
[0105]
[0106] S3.4: The Lévy flight strategy enables whales to be widely distributed within the search range. To improve the local optimization capability of the whale optimization algorithm, we introduce a random walk strategy to enable whales to search for the optimal value within a relatively concentrated range.
[0107] Lévy flight refers to a random walk whose step length probability distribution follows a heavy-tailed distribution. It can maximize the efficiency of resource search in uncertain environments. Lévy flight has good global search capabilities because it searches small areas with a high probability and flies long distances with a low probability.
[0108] Levy flight uses the following formula to update individual positions:
[0109]
[0110] Where levy(λ) represents the step size of the Levy distribution and satisfies levy~u=t -λ , 1<λ≤3; ⊕ represents the point-to-point product; β represents the control step factor, l=0.01(x k (t)-x b ), x b is the optimal solution obtained after t generations; x n (t) is the nth solution of the tth generation;
[0111] Since it is relatively complicated to generate a random number that obeys the Levy distribution, the Mantegna method is often used to obtain the step length s of the Levy flight. The formula is as follows:
[0112]
[0113] Among them, γ is usually taken as 1.5; μ and ν obey the normal distribution and are defined as follows:
[0114]
[0115]
[0116]
[0117] S3.5: Random walk refers to the endless irregular movement of a group, which is the ideal mathematical state of Brownian motion. Random walk uses crossover and hybrid mutation to generate certain new solutions, which can enhance the diversity of the group and effectively avoid falling into the local optimal solution, thereby improving the local search ability of the algorithm. Introducing the random walk strategy in the intelligent group algorithm can increase the speed of finding the optimal solution. The update formula of the random walk strategy is as follows:
[0118]
[0119] Where ε is the scaling factor, ε ~ U(0,1); x j (t) and x i (t) are two random solutions in the tth generation;
[0120] S3.6: After the random walk strategy and Levy flight strategy are established, the whale optimization algorithm is in the process of searching for the best individual value, the second best individual value, or the third best individual value and less than When the whale individual selects the Lévy flight strategy update formula to update the individual position; when the random individual value satisfies the best individual value or the second best individual value or the third best individual value and is greater than or equal to When , the whale individual selects the random swimming strategy update formula to update the individual position; otherwise, the original whale optimization algorithm update formula is selected to update the individual position. Where t is the tth generation of the iterative process, max is the maximum number of iterations, is the exploration iteration ratio.
[0121] S4, build an LSTM neural network model to find the most critical K value for the PID algorithm to speed up the optimization process, reduce overshoot, and increase the stabilization speed;
[0122] The biggest difference between LSTM neural networks and recurrent neural networks (RNNs) is the presence of gates. Gates allow useful information to flow and block useless information. A gate is actually a fully connected layer with a vector as input and a real number vector between 0 and 1 as output. The gate weight vector and bias are represented by W and b respectively. The gate can be expressed as follows:
[0123]
[0124] Among them, σ is the sigmoid function, that is,
[0125] The output of the gate is a real number vector between 0 and 1. Therefore, when the gate output is 1, its multiplication with any vector will remain unchanged, which is equivalent to no change; when the output is 0, its multiplication with any vector is a 0 vector, which is equivalent to no data passing through; because the range of the sigmoid function is (0, 1), the state of the gate is half open and half closed;
[0126] The content of the LSTM cell state c is controlled by two gates. One is the input gate, which is used to determine how much input x is currently present. t Input to cell state c t ; The other is the forget gate, which is used to determine the unit state c at the previous moment t-1 How many cell states c are retained to the current moment t; The above input gate and forget gate formulas are shown in the following two formulas respectively:
[0127] i t =σ(W i ·[h t-1 ,x t ]+b i ) (29)
[0128] f t =σ(W f ·[h t-1 ,x t ]+b f ) (30)
[0129] Among them, W i is the weight matrix of the input gate, where the subscript t represents the tth moment, [h t-1 ,x t ] means concatenating two vectors into a longer vector, b i is the bias term of the input gate, h t-1 is the output at the previous moment, W f is the weight matrix of the forget gate, b f is the bias term of the forget gate;
[0130] The current input state of LSTM is the cell state To indicate that it is calculated based on the current input and the previous output, the formula is as follows:
[0131]
[0132] Where W c is the weight matrix of the unit state, b c is the bias term of the unit state;
[0133] The current cell state c t , is the forget gate and the last cell state c t-1 Multiply by element, and then use the cell state of the input gate and the current input state Multiply element-wise and add the two products together; the formula is as follows:
[0134]
[0135] In the above formula, the symbol Represents element-wise multiplication;
[0136] In the above formula, the new unit state c t The cell state currently input by LSTM and the cell state c at the previous moment t-1Combined together, due to the control of the input gate and the forget gate, it can prevent unimportant information from entering the memory while preserving previous information. Finally, the output gate is used to control the impact of long-term memory on the current output. The output gate formula is as follows:
[0137]
[0138] Where W o is the weight matrix of the output gate, b o is the bias term of the output gate;
[0139] The final output of LSTM is determined by the cell state and the output gate. The output formula is as follows:
[0140]
[0141] S5, uses the improved whale optimization algorithm to optimize the initial parameters of the neural network LSTM;
[0142] The improved whale optimization algorithm is used to provide initial parameters for the LSTM neural network. The initial weights of the LSTM neural network are set to the whale individuals of the improved whale optimization algorithm (LRWOA) described in step S3. The back propagation algorithm of the LSTM neural network is set to the fitness function of LRWOA. When LRWOA satisfies less than the given fitness function, the initial weights W of the neural network obtained by iterative optimization of LRWOA are obtained. f ,W i ,W c ,W o .
[0143] S6, build the LSTM-PID algorithm based on steps S3, S4, and S5. The algorithm sets the output of LSTM as the three parameters K of PID p , K i , K d The LSTM back propagation algorithm and the PID algorithm are integrated to ensure the smooth training of the model. The three parameters obtained after the LSTM neural network optimization are brought into the PID controller to obtain the control parameters.
[0144] S6.1: Construct a PID control algorithm and combine it with the LSTM neural network. Determine the learning rate η and inertia coefficient α of the LSTM neural network and set the initial time m to 1.
[0145] S6.2: By setting the target temperature r(m) and the actual temperature y(m) obtained by measurement sampling, the error e(m) at this moment is calculated. The calculation formula of e(m) is e(m) = r(m) - y(m);
[0146] S6.3: Use r(m), y(m), e(m), e(m-1), and e(m-2) as the input of the LSTM neural network, and set the initial values r(0), y(0), e(0), e(-1), and e(-2) to 0;
[0147] S6.4: Set the output of the LSTM neural network as the three adjustable parameters K of the PID controller p , K i , K d ;
[0148] S6.5: Calculate the output Δu(m) of the PID controller:
[0149]
[0150] S6.6: Set the difference e(m) between y(m) and r(m) as the error of the LSTM neural network, perform LSTM neural network learning, and adjust the neural network weight parameters online to achieve adaptive adjustment of the controller parameters;
[0151] S6.7: When e(m) is less than the set threshold, stop adjusting the controller parameters, determine the final controller parameters and bring them into the PID controller to obtain the control parameters.
[0152] S7, transferring the control parameters obtained by the LSTM-PID algorithm to the fermentation tank production control system for temperature control;
[0153] Figure 6 2 is a test result diagram of an embodiment of the present invention.
[0154] The above description is a further detailed description of the present invention in conjunction with specific / preferred embodiments, and the specific implementation of the present invention should not be considered to be limited to these descriptions. Those skilled in the art of the present invention may make various substitutions or modifications to the described embodiments without departing from the scope of the present invention, and such substitutions or modifications should be considered to fall within the scope of protection of the present invention.
[0155] Parts of the present invention that are not described in detail belong to the common knowledge of those skilled in the art.
Claims
1. A lysozyme fermentation temperature control method based on LSTM-PID, characterized in that: The following steps are involved: S1, the temperature mathematical model of the lysozyme fermentation tank was established using the mechanism modeling method; S2, collecting the temperature, density, flow rate and volume of lysozyme in the fermentation tank, and bringing the acquired specific parameters into the established mathematical model to obtain the corresponding temperature transfer function; S3, uses random walk strategy and Lévy flight strategy to enhance the whale optimization algorithm to enhance the global optimization ability of the whale optimization algorithm when dealing with complex problems; S4, build an LSTM neural network model to find the most critical K value for the PID algorithm to speed up the optimization process, reduce overshoot, and increase the stabilization speed; S5, based on step S3, uses the improved whale optimization algorithm to optimize the initial parameters of the neural network LSTM; S6, build the LSTM-PID algorithm based on steps S3, S4, and S5. The algorithm sets the output of LSTM as the three parameters K of PID p , K i , K d The LSTM back propagation algorithm and the PID algorithm are integrated to ensure the smooth training of the model. The three parameters obtained after the LSTM neural network optimization are brought into the PID controller to obtain the control parameters. S7, transferring the control parameters obtained by the LSTM-PID algorithm to the fermentation tank production control system for temperature control; The detailed steps of S6 are: S6.1: Construct a PID control algorithm and combine it with the LSTM neural network. Determine the learning rate η and inertia coefficient α of the LSTM neural network and set the initial time m to 1. S6.2: By setting the target temperature r(m) and the actual temperature y(m) obtained by measurement sampling, the error e(m) at this moment is obtained. The calculation formula of e(m) is e(m) = r(m) - y(m); S6.3: Use r(m), y(m), e(m), e(m-1), and e(m-2) as the input of the LSTM neural network, and set the initial values r(0), y(0), e(0), e(-1), and e(-2) to 0; S6.4: Set the output of the LSTM neural network as the three adjustable parameters K of the PID controller p , K i , K d ; S6.5: Calculate the output u(m) of the PID controller: S6.6: Set the difference e(m) between y(m) and r(m) as the error of the LSTM neural network, perform LSTM neural network learning, and adjust the neural network weight parameters online to achieve adaptive adjustment of the controller parameters; S6.7: When e(m) is less than the set threshold, stop adjusting the controller parameters, determine the final controller parameters and bring them into the PID controller to obtain the control parameters.
2. A lysozyme fermentation temperature control method based on LSTM-PID according to claim 1, characterized in that: The detailed steps of S1 are: A chemical reaction rate equation is established for the lysozyme fermentation tank based on the concentration and temperature of the lysozyme; a material balance equation is established for the lysozyme fermentation tank based on the amount of material in the fermentation tank; and a heat balance equation is established for the lysozyme fermentation tank based on the heat balance relationship. Three nonlinear dynamic equations are obtained in sequence, and the nonlinear equations are linearized using differential operations to obtain the state equation.
3. The lysozyme fermentation temperature control method based on LSTM-PID according to claim 2, characterized in that: The detailed steps of S2 are: The temperature, density, flow rate, volume of lysozyme in the fermenter, as well as the volume of the fermenter jacket and the volume of the condenser are collected. The heat transfer area, heat transfer coefficient, specific heat capacity, condenser density, reaction activation energy, gas constant, and reaction frequency factor are determined based on the fermenter parameters and the lysozyme fermentation process. The collected parameters are analyzed and adjusted and introduced into the mathematical model established in step S1 to obtain a specific fermenter temperature transfer function, which is as follows:
4. The lysozyme fermentation temperature control method based on LSTM-PID according to claim 3, characterized in that: The detailed steps of S3 are: Establish the whale optimization algorithm, random walk strategy and Levy flight strategy respectively. After the establishment is completed, in the process of whale optimization algorithm optimization, when the random individual value satisfies the best individual value or the second best individual value or the third best individual value and is less than When the whale individual selects the Lévy flight strategy update formula to update the individual position; when the random individual value satisfies the best individual value or the second best individual value or the third best individual value and is greater than or equal to When , the whale individual selects the random swimming strategy update formula to update the individual position; otherwise, the original whale optimization algorithm update formula is selected to update the individual position; where t is the tth generation of the iterative process, max is the maximum number of iterations, is the exploration iteration ratio.
5. The lysozyme fermentation temperature control method based on LSTM-PID according to claim 4, characterized in that: The detailed steps of S4 are: Build an LSTM neural network model and construct the model's input gate, output gate, forget gate, weights, and thresholds to facilitate the subsequent addition of the PID control algorithm.
6. A lysozyme fermentation temperature control method based on LSTM-PID according to claim 5, characterized in that: The detailed steps of S5 are: The initial weights of the LSTM neural network are set to the whale individuals of the improved whale optimization algorithm LRWOA described in step S3, and the back propagation algorithm of the LSTM neural network is set to the fitness function of LRWOA. When LRWOA satisfies less than the given fitness function, the initial weights W of the neural network obtained by iterative optimization of LRWOA are obtained. f ,W i ,W c ,W o .
Citation Information
Patent Citations
Anaerobic fermentation temperature control system and method based on RBF neural network prediction
CN114134031A