Traditional Chinese medicine concentrated solution density soft measurement method based on neural network

By establishing a soft measurement model for the density of traditional Chinese medicine concentrate based on neural network, the lag and accuracy of online measurement of concentration process density in traditional Chinese medicine production are solved, and the precise online detection and control of density parameters are achieved.

CN119920360APending Publication Date: 2025-05-02HARBIN SHIP BOILER TURBINE RESEARCH INSTITUTE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411955973.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-28
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

The online measurement of the concentration process of the concentration process in traditional Chinese medicine production has problems such as high hysteresis and insufficient accuracy of hardware instruments.

Method used

A soft measurement method for concentration concentration of traditional Chinese medicine based on neural network is adopted to establish a soft measurement model for concentration density, and simulate and implement and train it through matlab programming, optimize the weight and threshold of the neural network, and combine it with PLC program for density detection and control.

Benefits of technology

The online detection of density parameters of the concentration stage of traditional Chinese medicine is realized, which improves the accuracy and real-time detection, avoids control errors, and optimizes the quality and advancedness of the concentration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119920360A_ABST
    Figure CN119920360A_ABST
Patent Text Reader

Abstract

The invention discloses a traditional Chinese medicine concentrated solution density soft measurement method based on a neural network, and relates to a traditional Chinese medicine concentrated solution density soft measurement method. The invention aims to solve the problems of high hysteresis and insufficient accuracy of a hardware instrument in the process of acquiring the density of liquid medicine in an important concentration process by adopting a manual analysis mode. The method comprises the following steps: step 1, establishing a concentrated solution density soft measurement model; 2, simulation implementation and training are carried out through matlab programming; 3, analyzing a simulation result, and continuously optimizing an obtained model result; step 4, optimizing a local minimum value of the neural network and two points of a weight domain by adding a dynamic factor and introducing a genetic algorithm; and 5, judging whether the density is qualified or not through a PLC program, and concentrating and discharging the medicine. The invention belongs to the technical field of traditional Chinese medicine production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a soft measurement method for density of a traditional Chinese medicine concentrate, belonging to the technical field of traditional Chinese medicine production. Background Art

[0002] The most important processes in the production process of traditional Chinese medicine are extraction, concentration and alcohol precipitation. These three processes involve a variety of physical changes and are a complex dynamic process system. In a traditional Chinese medicine production process, the soaked raw medicinal materials are first placed in the extraction tank for cyclic decoction to extract the available components in the liquid as much as possible, and at the same time, the volatile oil is separated by heating and condensation for use in the preparation of ingredients; the next step is to heat and concentrate the extracted liquid medicine to evaporate excess water to obtain the required liquid medicine that meets the density requirements; the subsequent alcohol precipitation stage is to separate the impurities in the liquid medicine through alcohol, and use the property that impurities are not easily soluble in alcohol to separate the impurity layer and the liquid medicine layer to obtain a purely refined liquid medicine, and finally the ingredients are packaged to obtain the finished liquid medicine that meets the process requirements.

[0003] The density of the liquid medicine in the concentration process is an important parameter indicator. Whether it meets the standards directly affects the quality of important products. Compared with easy-to-measure process parameters, its accurate online measurement is more difficult. Density detection is also an important step in the concentration process control. The method of direct measurement with instruments is simple, but the installation is complex, the cost is high, and regular maintenance is required. Some old production workshops do not have density measurement equipment installed, and the assembly and position of the hardware instrument will also affect the accuracy of its measurement. At the same time, in actual production, interference factors such as foaming in the final stage of concentration affect the volume of the solution and also cause deviations in density measurement. At this time, a density soft measurement model can also be constructed to estimate the density value online, and the control strategy can be adjusted immediately according to the prediction to avoid control errors. Therefore, the method of using only direct instrument measurement has certain limitations. Combining soft measurement technology with direct sensor measurement, an effective online detection method for the density parameters of traditional Chinese medicine in the concentration section can ensure the quality and advancement of the concentration process control, and optimize the problems of high hysteresis of manual analysis and insufficient accuracy of hardware instruments. Summary of the invention

[0004] The present invention aims to solve the problems of high hysteresis and insufficient accuracy of hardware instruments in obtaining the density of traditional Chinese medicine concentrate in an important concentration process by manual analysis, and further proposes a soft measurement method for the density of traditional Chinese medicine concentrate based on a neural network.

[0005] The technical solution adopted by the present invention to solve the above-mentioned problem is: the specific steps of the present invention include:

[0006] Step 1, establishing a soft measurement model for the density of concentrated liquid;

[0007] Step 2: Simulate and train through Matlab programming;

[0008] Step 3: Analyze the simulation results and continue to optimize the obtained model results;

[0009] Step 4: Optimize the local minimum value and weight range of the neural network by increasing the dynamic factor and introducing the genetic algorithm;

[0010] Step 5: Use the PLC program to determine whether the density is qualified and concentrate the medicine.

[0011] Furthermore, step 1 specifically includes:

[0012] The relationship between output density D and variable is:

[0013] D=F(P1,P2,T1,H1)(1),

[0014] In formula (1), P1 represents the steam pipeline pressure, P2 represents the vacuum degree of the first-effect evaporation chamber, T1 represents the temperature of the first-effect evaporation chamber, and H1 represents the liquid level of the first-effect evaporation chamber; the input layer of the neural network constructed by selecting the four parameters P1, P2, T1, and H1 in formula (1) as the input of the density soft measurement model consists of these four auxiliary variables, and the output layer is the dominant variable density D. The input nodes of the model are 4, the output node is 1, and a single hidden layer structure is used to construct a three-layer BP neural network model;

[0015] The function that acts as a link in the forward propagation process is f(x), and the output layer is:

[0016]

[0017] The hidden layer output equation is:

[0018]

[0019] The activation function is a unipolar Sigmoid function with an infinite domain and a range of (0,1), and a continuously differentiable function definition:

[0020]

[0021] Introducing x0=-1, b0=-1, formulas (2) and (3) are simplified to:

[0022]

[0023] The modified derivation process of weights is as follows:

[0024] The output error is:

[0025]

[0026] Formula (7) is back-propagated to the hidden layer to obtain:

[0027]

[0028] Formula (8) is expanded back to the input layer to obtain:

[0029]

[0030] There is a functional relationship between the error and the weights of each layer. The error size can be changed by adjusting the weights, thereby continuously reducing the error value.

[0031]

[0032] In formulas (10) and (11), the number η is a proportional coefficient with a value range of (0,1). The BP back propagation algorithm is an error signal δ algorithm based on gradient descent;

[0033] Formulas (10) and (11) are expanded to:

[0034]

[0035] Introducing error signals into the output layer and hidden layer and Formulas (10) and (11) are optimized as follows:

[0036] Δw j1 =ηδ1 y b j (14)

[0037] Δv ij =ηδ j b x i (15)

[0038] The weight is proportional to the input. Expand the output layer and hidden layer separately, and we have:

[0039]

[0040] Combining the error expressions (8) and (9), we have:

[0041]

[0042] Combined with the derivative of the S activation function, the proportional coefficient is obtained:

[0043] δ1 y =(dy)y(1-y) (20),

[0044] δ jb =[(dy)f'(net1)w j1 ]f'(net j )=(δ1 y w j1 )b j (1-b j ) (twenty one),

[0045] Substituting into formula (20) and (21), we get the weight modification equations for the hidden layer and the output layer respectively:

[0046] Δw j1 =ηδ1 y b j =η(dy)y(1-y)b j (twenty two),

[0047] Δv ij =ηδ j b x i =η(δ1 y w j1 )b j (1-b j )x i (twenty three),

[0048] The BP neural network continuously modifies the weights according to the above formula, and after multiple iterations, the error is reduced to obtain the best prediction output; the global sum of squares error E of the output of the concentrated density soft sensor model is q have:

[0049]

[0050] Furthermore, step 2 specifically includes:

[0051] The soft-sensing model of the BP neural network in the concentration section is programmed using Matlab and combined with its internal neural network toolbox for simulation. The specific steps include:

[0052] Step 1: Data processing;

[0053] Step 2: BP neural network design, training and testing;

[0054] Step 3: Performance evaluation of the neural network model;

[0055] Step 4: Run the Matlab program to obtain the simulation result curve.

[0056] Furthermore, the introduction of momentum factor in step 4 can pass through the minimum value, and add a value proportional to the previous weight change to each weight change to generate a new weight change. The value modification formula including the momentum factor is as follows:

[0057] ΔW(k+1)=(1-mc)ηδX+mcΔW(k)(26),

[0058] In formula (26), W is the weight matrix of a certain layer, X is the input vector of a certain layer, k is the number of training times, and mc is the introduced momentum factor; the value range of mc is 0 to 1. When mc = 0, the change of weight is adjusted according to the error decrease, and when mc = 1, the next weight change is the same as the previous weight change; the value of the momentum factor is 0.9, and the network model selects mc = 0.95. At this time, the judgment condition of the momentum method is:

[0059]

[0060] In formula (27), SSE(k) is the error, and the error change rate is 1.04.

[0061] Furthermore, in step 4, a genetic algorithm is introduced to optimize the weights and thresholds of the network. The specific steps include:

[0062] Step (i), chromosome encoding and population initialization;

[0063] Step (ii), select fitness function;

[0064] Step (iii), performing genetic manipulation;

[0065] Step (iv), loop operation; continuously loop step (ii) and step (iii), repeatedly train the neural network until the result of genetic neural network training meets the error requirement or the number of iterations reaches the target; the individual records the weight and threshold of each iteration, and updates them once after one cycle; genetic operation is used to continuously update and correct the weight and threshold to obtain the optimal individual value, so that the neural network estimation result is more accurate.

[0066] Furthermore, in step (a), the structural model of the neural network is designed and constructed according to the input and output variables, and the number of input and output nodes and the overall number of layers are determined. The input layer node of the density soft measurement BP network is 4, the output layer node is 1, and the number of layers is three. All weights and thresholds of the BP neural network are coded, and the length of the code is calculated as:

[0067] S = n × m + m × l + m + l (28),

[0068] In formula (28), n is the input layer node, m is the hidden layer node, n×m is the total weight of the input layer and the hidden layer, and l is the output layer node, then m×l is the total weight of the hidden layer and the output layer, m is the threshold of the hidden layer, l is the threshold of the output layer, n=4, m=10, l=1 determined above, the calculated coding length is 61, and the population size is 50.

[0069] Furthermore, the fitness function in step (ii) is:

[0070]

[0071] The larger the value of the fitness function, the smaller the deviation value of the neural network model, and the better the adaptability of the neural network.

[0072] Furthermore, the steps of performing genetic manipulation in step (iii) are:

[0073] Step a: Perform selection operation: The probability of an individual being selected is based on the proportion of its fitness value, and the selection is carried out in a roulette wheel manner. The larger the proportion in the roulette wheel, the better the fitness; if k is the total number of individuals in the population, f i is the value of an individual’s fitness, so the probability of the gene being selected can be expressed as:

[0074]

[0075] Step b: Perform crossover operation: generate new evolved individuals by crossovering certain positions of two individuals, improve the structure of individuals, and the crossover probability is b. c The value of is selected in the interval [0,1];

[0076] Step c, perform mutation operation: The mutation operation selects gene points in the parent sample individuals and replaces them with random numbers to ensure the diversity of population individuals and improve the search ability of genetic algorithms applied to the global network. The mutation probability b m The value is in the range [0,1], and 0.1 is chosen.

[0077] The beneficial effects of the present invention are as follows: the present invention designs a density soft measurement algorithm based on BP neural network, selects parameter samples in the concentration process, and performs online detection on the density before the concentration section is discharged; after the present invention establishes a soft measurement model for the density of the concentrated liquid, the model is implemented and trained through matlab programming, and the simulation results are analyzed, and the obtained model results are optimized. The local minimum value and the weight threshold of the neural network are optimized by increasing the momentum factor and introducing the genetic algorithm. The simulation verification shows that the curves of the expected value and the predicted value of the soft measurement model after the genetic algorithm 3 are basically completely consistent, and a soft measurement model with better performance is obtained. It is combined with hardware instruments to make the online detection of the density parameters of the traditional Chinese medicine concentration stage in the project more accurate. Finally, the density is judged to be qualified through the PLC program, and the medicine is concentrated and discharged to complete the control. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] Figure 1 It is a schematic diagram of the BP network soft sensor model of concentrated density;

[0079] Figure 2 This is a schematic diagram of the training comparison results of the BP network model for density prediction;

[0080] Figure 3 It is a schematic diagram of the comparison results of density prediction by the BP network model with momentum factor added;

[0081] Figure 4 This is a schematic diagram of the training comparison results of density prediction based on the BP network model optimized by genetic algorithm;

[0082] Figure 5 It is the error comparison diagram of three network models;

[0083] Figure 6 It is a schematic diagram of density judgment;

[0084] Figure 7 It is a schematic diagram of density detection;

[0085] Figure 8 It is a schematic diagram of a request for medicine;

[0086] Figure 1 In the formula, X=(x1,x2...x i ...x4) T is the input vector, B=(b1,b2...b j ...b m ) T is the hidden layer output vector, y is the estimated output, d is the expected output, V=(v1,v2...v j ...v m ) Tis the weight matrix between the input layer and the hidden layer, W = (w 11 ,w 21 ... j1 ... m1 ) T is the weight matrix between the hidden layer and the output layer. DETAILED DESCRIPTION

[0087] Specific implementation method 1: Figures 1 to 4 As shown in FIG. 1 , the soft measurement method for density of concentrated Chinese medicine solution based on neural network includes the following specific steps:

[0088] Step 1: Establish a soft measurement model for the density of concentrated liquid; the relationship between the output density D and the variable is:

[0089] D=F(P1,P2,T1,H1)(1),

[0090] In formula (1), P1 represents the steam pipeline pressure, P2 represents the vacuum degree of the first-effect evaporation chamber, T1 represents the temperature of the first-effect evaporation chamber, and H1 represents the liquid level of the first-effect evaporation chamber; the input layer of the neural network constructed by selecting the four parameters P1, P2, T1, and H1 in formula (1) as the input of the density soft measurement model consists of these four auxiliary variables, and the output layer is the dominant variable density D. The input nodes of the model are 4, the output node is 1, and a single hidden layer structure is used to construct a three-layer BP neural network model;

[0091] The function that acts as a link in the forward propagation process is f(x), and the output layer is:

[0092]

[0093] The hidden layer output equation is:

[0094]

[0095] The activation function is a unipolar Sigmoid function with an infinite domain and a range of (0,1), and a continuously differentiable function definition:

[0096]

[0097] Introducing x0=-1, b0=-1, formulas (2) and (3) are simplified to:

[0098]

[0099] The modified derivation process of weights is as follows:

[0100] The output error is:

[0101]

[0102] Formula (7) is back-propagated to the hidden layer to obtain:

[0103]

[0104] Formula (8) is expanded back to the input layer to obtain:

[0105]

[0106] There is a functional relationship between the error and the weights of each layer. The error size can be changed by adjusting the weights, thereby continuously reducing the error value.

[0107]

[0108] In formulas (10) and (11), the number η is a proportional coefficient with a value range of (0,1). The BP back propagation algorithm is an error signal δ algorithm based on gradient descent;

[0109] Formulas (10) and (11) are expanded to:

[0110]

[0111] Introducing error signals into the output layer and hidden layer and Formulas (10) and (11) are optimized as follows:

[0112] Δw j1 =ηδ1 y b j (14)

[0113] Δv ij =ηδ j b x i (15)

[0114] The weight is proportional to the input. Expand the output layer and hidden layer separately, and we have:

[0115]

[0116] Combining the error expressions (8) and (9), we have:

[0117]

[0118]

[0119] Combined with the derivative of the S activation function, the proportional coefficient is obtained:

[0120] δ1 y =(dy)y(1-y)(20),

[0121] δ j b =[(dy)f'(net1)w j1 ]f'(net j )=(δ1 y w j1 )b j (1-b j )(twenty one),

[0122] Substituting into formula (20) and (21), we get the weight modification equations for the hidden layer and the output layer respectively:

[0123] Δw j1 =ηδ1 y b j= η(dy)y(1-y)b j (twenty two),

[0124] Δv ij =ηδ j b x i= η(δ1 y w j1 )b j (1-b j )x i (twenty three),

[0125] The BP neural network continuously modifies the weights according to the above formula, and after multiple iterations, the error is reduced to obtain the best prediction output; the global sum of squares error E of the output of the concentrated density soft sensor model is q have:

[0126]

[0127] Step 2: Simulate and train through Matlab programming;

[0128] The soft-sensing model of the BP neural network in the concentration section is programmed using Matlab and combined with its internal neural network toolbox for simulation. The specific steps include:

[0129] Step 1: Data processing;

[0130] Step 2: BP neural network design, training and testing;

[0131] Step 3: Performance evaluation of the neural network model;

[0132] Step 4: Run the Matlab program to obtain the simulation result curve;

[0133] Step 3: Analyze the simulation results and continue to optimize the obtained model results;

[0134] Step 4: Optimize the local minimum value and weight range of the neural network by increasing the dynamic factor and introducing the genetic algorithm;

[0135] The introduction of momentum factor can pass through the minimum value, and a value proportional to the previous weight change is added to each weight change to generate a new weight change. The value modification formula including the momentum factor is as follows:

[0136] ΔW(k+1)=(1-mc)ηδX+mcΔW(k)(26),

[0137] In formula (26), W is the weight matrix of a certain layer, X is the input vector of a certain layer, k is the number of training times, and mc is the introduced momentum factor; the value range of mc is 0 to 1. When mc = 0, the change of weight is adjusted according to the error decrease, and when mc = 1, the next weight change is the same as the previous weight change; the value of the momentum factor is 0.9, and the network model selects mc = 0.95. At this time, the judgment condition of the momentum method is:

[0138]

[0139] In formula (27), SSE(k) is the error, and the error change rate is 1.04;

[0140] Genetic algorithm is introduced to optimize the weights and thresholds of the network. The specific steps include:

[0141] Step (i), chromosome encoding and population initialization;

[0142] According to the input and output variables, the structural model of the neural network is designed and constructed, and the number of input and output nodes and the overall number of layers are determined. The input layer nodes of the density soft measurement BP network are 4, the output layer node is 1, and the number of layers is three. All weights and thresholds of the BP neural network are coded, and the length of the code is calculated as:

[0143] S = n × m + m × l + m + l (28),

[0144] In formula (28), n is the input layer node, m is the hidden layer node, n×m is the total weight of the input layer and the hidden layer, and l is the output layer node, then m×l is the total weight of the hidden layer and the output layer, m is the threshold of the hidden layer, l is the threshold of the output layer, n=4, m=10, l=1 determined above, the calculated coding length is 61, and the population size is 50;

[0145] Step (ii), select fitness function;

[0146] The fitness function is:

[0147]

[0148] The larger the value of the fitness function, the smaller the deviation value of the neural network model, and the better the adaptability of the neural network;

[0149] Step (iii), performing genetic manipulation;

[0150] The steps for performing genetic manipulation are:

[0151] Step a: Perform selection operation: The probability of an individual being selected is based on the proportion of its fitness value, and the selection is carried out in a roulette wheel manner. The larger the proportion in the roulette wheel, the better the fitness; if k is the total number of individuals in the population, f i is the value of an individual’s fitness, so the probability of the gene being selected can be expressed as:

[0152]

[0153] Step b: Perform crossover operation: generate new evolved individuals by crossovering certain positions of two individuals, improve the structure of individuals, and the crossover probability is b. c The value of is selected in the interval [0,1];

[0154] Step c, perform mutation operation: The mutation operation selects gene points in the parent sample individuals and replaces them with random numbers to ensure the diversity of population individuals and improve the search ability of genetic algorithms applied to the global network. The mutation probability b m Take the value in [0,1], and choose 0.1;

[0155] Step (iv), loop operation; continuously looping step (ii) and step (iii), repeatedly training the neural network until the result of genetic neural network training meets the error requirement or the number of iterations reaches the target; the individual records the weight and threshold of each iteration, and updates them once after one cycle; genetic operations are used to continuously update and correct the weight and threshold to obtain the optimal individual value, so that the neural network estimation result is more accurate;

[0156] Step 5: Use the PLC program to determine whether the density is qualified and concentrate the medicine.

[0157] Among them, the design points of density soft measurement BP neural network include:

[0158] Selection and design of training sets

[0159] Sixty groups were selected for training and testing, of which forty groups were used for training and the remaining twenty groups were used for testing. The selected sample data are shown in Tables 4.1 and 4.2 below:

[0160] Table 4.1 Density soft measurement training set sample data

[0161]

[0162]

[0163] Table 4.1 Density soft measurement training set sample data

[0164]

[0165] Table 4.2 Density soft measurement test set sample data

[0166]

[0167]

[0168] Table 4.2 Density soft measurement test set sample data

[0169]

[0170] Data preprocessing

[0171] The link function of the network output layer is an S-shaped activation function, whose value is between [0,1], and its value outside this range is too small to be ignored. Therefore, before training, the training data is normalized to the interval [0,1] to make the range of variation of the selected data close, shorten the training time of the neural network, and increase the convergence speed.

[0172] The normalized expression converted to the [0,1] interval is:

[0173]

[0174] In formula (25), x is the sample value before conversion, y is the sample value after conversion, and x min and x max is the minimum and maximum value of the sample initial data;

[0175] Hidden nodes selection

[0176] First, set a small number of hidden nodes, and then increase the number of hidden nodes one by one each time training, and compare the training results of the same sample to find the interval of hidden node values ​​with smaller errors; the empirical formula for hidden node selection can be used: Where n is the number of input layer nodes, l is the number of output layer nodes. According to the test, the range of α is set to 4 to 10, so the hidden nodes of this model are selected in the range of 6 to 12;

[0177] The network error comparison of the number of hidden nodes within the value range is obtained, and the error comparison of the number of hidden layer nodes is shown in Table 5.3. Obviously, when the number of hidden nodes is 10, the network error is the smallest and the approximation effect is the best. Although the error values ​​of 11 and 12 nodes are also excellent, the number of hidden nodes is large, and the network training time will increase accordingly. Considering all factors, it is the most reasonable to choose 10 nodes.

[0178] Table 4.3 Error comparison of different numbers of hidden nodes

[0179]

[0180] Comparison and selection of training methods

[0181] According to the selected sample set, under the same other conditions, the number of hidden nodes is selected as 10, and the six algorithms are trained. The comparison table of training effects is shown in Table 4.4:

[0182] Table 4.4 Comparison of the training effects of different training methods on BP network

[0183]

[0184] From the table analysis, we know that the number of iterations of the quasi-Newton algorithm and the Levenberg-Marquardt algorithm is small, but the error of the quasi-Newton algorithm is large, while the errors of the Levenberg-Marquardt algorithm and the Bayesian algorithm are similar, but the number of iterations of the Bayesian algorithm is too many and the convergence speed is slow; the Levenberg-Marquardt algorithm is selected to train the model. The algorithm has a short training cycle, fast training time, and small training error, which speeds up the training speed and improves the generalization ability of the soft sensor model;

[0185] Learning rate determination

[0186] The initial learning rate of the selected density prediction neural network model is 0.01.

[0187] Among them, the soft measurement model of BP neural network in the concentration section was constructed and programmed using matlab2018a software, and simulation analysis was performed in combination with its internal neural network toolbox;

[0188] The writing and implementation of the program is divided into the following steps:

[0189] According to the above design, the soft-sensing model of the BP neural network in the concentration section is programmed using matlab2018a, and combined with its internal neural network toolbox for running simulation. The programming and implementation of the program are divided into the following steps:

[0190] (1) Data processing:

[0191] load input / / load input data

[0192] load output / / load output data

[0193] input_train = input((1:40),:)'; / / 40 training set inputs

[0194] output_train = output((1:40),:)'; / / 40 training set outputs

[0195] input_test = input((41:end),:)'; / / 20 test set inputs

[0196] output_test=output((41:end),:)'; / / 20 test set outputs

[0197] Sample data is normalized to (0,1):

[0198] [input_train, inputs_input]=mapminmax(input_train,0,1);

[0199] input_test=mapminmax('apply',input_test,inputs_input);

[0200] [output_train, inputs_output]=mapminmax(output_train,0,1);

[0201] (2) BP neural network design, training and testing:

[0202] net = newff(input_train, output_train, 10); / / Create a network, the network hidden nodes are initially set to 10

[0203] net.trainFcn = 'trainlm'; / / Select Levenberg-Marquardt training method

[0204] net.trainParam.epochs = 10000; / / Set training parameters, this is the number of training times, set it to a maximum of 10000 times and stop

[0205] net.trainParam.goal = 0.001; / / Set the minimum error required for the target, here it is set to 0.001

[0206] net.trainParam.lr = 0.01; / / Set the learning rate, the standard initial network is set to 0.01

[0207] The network weights and thresholds are stored in net.IW, net.LW, and net.b.

[0208] net=train(net,input_train,output_train); / / Train the network

[0209] output_sim=sim(net,input_test); / / Perform simulation and call sim function to implement network test

[0210] output_sim=mapminmax('reverse',output_sim,inputs_output); / / data normalization

[0211] (3) Performance evaluation of neural network models

[0212] errors = output_sim - output_test; / / error

[0213] error=abs(output_sim–output_test). / T_test; / / relative error

[0214] R2 = (N*sum(output_sim.*output_test)-sum(output_sim)*sum(output_test))^2 / ((N*sum((output_sim).^2)-(sum(output_sim))^2)*(N*sum((output_test).^2)-(sum(output_test))^2)); / / Absolute coefficient of the regression curve, used to evaluate the goodness of fit of the prediction results of the neural network model.

[0215] result = [output_test'input_sim'errors'error'] / / The output results are expected data, predicted data, error and relative error.

[0216] When constructing a genetically optimized neural network, the GAOT genetic algorithm toolbox was selected. This toolbox was developed and launched by Carolina State University in the United States. When using it, it should be configured in Matlab in advance and the toolbox should be quickly called through the following statement:

[0217] [x,endPop,bPop,trace]=ga(aa,'gabpEval',[],initPpp,[1e-6 1 1],'maxGenTerm',gen,...

[0218] 'normGeomSelect',[0.09],['arithXover'],[2],'nonUnifMutation',[2gen3]);

[0219] The GA-BP network is given a genetic algebra of 100. According to the set parameters, the GA operation is performed to improve the network structure. The constructed neural network density soft measurement model is retrained using the optimized weights and thresholds. The simulation results are as follows: Figure 4 As shown;

[0220] Depend on Figure 4 It can be seen that the actual value of the BP neural network density soft measurement model optimized by genetic algorithm is basically consistent with the output value of the model, and the density value detected during the concentration process can be predicted more perfectly.

[0221] The prediction values, absolute errors, and relative errors of the initial BP neural network soft measurement model, the neural network soft measurement model with momentum factor, and the neural network soft measurement model with genetic algorithm are compared to obtain the following Table 4.5. Obviously, the difference between the predicted value and the actual value of the density of the BP neural network with genetic algorithm is the smallest. After calculation, it is found that the average absolute error of the initial BP neural network is 0.41%, the average absolute error of the concentrated liquid density soft measurement model with momentum factor added is 0.24%, and the average absolute error of the predicted data of the finally optimized BP neural network concentrated liquid density soft measurement model based on genetic algorithm is 0.13%. By comparison, it can be seen that the soft measurement model based on the BP neural network with the introduction of momentum factor genetic algorithm is most consistent with the actual value and has the highest accuracy.

[0222] Table 4.5 Data comparison of three neural network soft sensor models

[0223]

[0224]

[0225] Compare the absolute errors of the predicted values ​​of the three models with the actual values ​​and draw a curve, such as Figure 5As shown in the figure, curve a is the error of the initial standard BP network soft measurement model, curve b is the error curve of the soft measurement model with a momentum factor of 0.95, and curve c is the error curve of the soft measurement model with a genetic algorithm added to optimize the weight threshold on the basis of adding the momentum factor. By comparison, it can be seen that the oscillation amplitude of curve c is the smallest, and the model error after the two optimizations is the lowest.

[0226] The essence of density measurement is to detect the density of the concentrated liquid. After judgment, the concentrated medicine that meets the conditions can be discharged and the concentration is completed. In actual engineering, step7 can be used to program density detection processing. The program segment of this process is as follows Figures 6 to 8 As shown:

[0227] Among them, NS03 is the three stages of concentration, Kg_Pause is the cut-off switch for concentrator pause, MDJC is density detection, An_MdJc is manual intervention density detection, An_NsEndSp_Ait is the end of manual intervention concentration, Wincc sets the qualified density value, PvMdOkT is the current density qualified time, Ait_No is unqualified density after detection, Ait_OK is qualified density after detection, and CyQQ is the drug delivery request.

[0228] The above is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent replacement and improvement made to the above embodiments without departing from the content of the technical solution of the present invention, based on the technical essence of the present invention, within the spirit and principles of the present invention, still fall within the protection scope of the technical solution of the present invention.

Claims

1. A soft measurement method for density of Chinese medicine concentrate based on neural network, characterized in that: The specific steps include: Step 1, establishing a soft measurement model for the density of concentrated liquid; Step 2: Simulate and train through Matlab programming; Step 3: Analyze the simulation results and continue to optimize the obtained model results; Step 4: Increase the dynamic factor and introduce the genetic algorithm to optimize the local minimum value and weight range of the neural network respectively; Step 5: Use the PLC program to determine whether the density is qualified and concentrate the medicine.

2. The method for soft measurement of density of concentrated Chinese medicine solution based on neural network according to claim 1, characterized in that: Step 1 specifically includes: The relationship between output density D and variable is: D=F(P1,P2,T1,H1)(1), In formula (1), P1 represents the steam pipeline pressure, P2 represents the vacuum degree of the first-effect evaporation chamber, T1 represents the temperature of the first-effect evaporation chamber, and H1 represents the liquid level of the first-effect evaporation chamber; the input layer of the neural network constructed by selecting the four parameters P1, P2, T1, and H1 in formula (1) as the input of the density soft measurement model consists of these four auxiliary variables, and the output layer is the dominant variable density D. The input nodes of the model are 4, the output node is 1, and a single hidden layer structure is used to construct a three-layer BP neural network model; The function that plays a link role in the forward propagation process is f(x), and the output layer is: The hidden layer output equation is: The activation function is a unipolar Sigmoid function with an infinite domain and a range of (0,1), and a continuously differentiable function definition: Introducing x0=-1, b0=-1, formulas (2) and (3) are simplified to: The modified derivation process of weights is as follows: The output error is: Formula (7) is back-propagated to the hidden layer to obtain: Formula (8) is expanded back to the input layer to obtain: There is a functional relationship between the error and the weights of each layer. The error size can be changed by adjusting the weights, thereby continuously reducing the error value. In formulas (10) and (11), the number η is a proportional coefficient with a value range of (0,1). The BP back propagation algorithm is an error signal δ algorithm based on gradient descent; Formulas (10) and (11) are expanded to: Introducing error signals into the output layer and hidden layer and Formulas (10) and (11) are optimized as follows: Δw j1 =ηδ1 y b j (14), Δv ij =hd j b x i (15), The weight is proportional to the input. Expand the output layer and hidden layer separately, and we have: Combining the error expressions (8) and (9), we have: Combined with the derivative of the S activation function, the proportional coefficient is obtained: δ1 y =(d-y)y(1-y)(20), δ j b =[(dy)f'(net1)w j1 ]f'(net j )=(δ1 y In j1 )b j (1-b j )(21), Substituting into formula (20) and (21), we get the weight modification equations for the hidden layer and the output layer respectively: Δw j1 =ηδ1 y b j= η(d-y)y(1-y)b j (22), Δv ij =hd j b x i= n(δ1 y w j1 )b j (1-b j )x i (23), The BP neural network continuously modifies the weights according to the above formula, and after multiple iterations, the error is reduced to obtain the best prediction output; the global sum of squares error E of the output of the concentrated density soft sensor model is q have:

3. The method for soft measurement of density of concentrated Chinese medicine solution based on neural network according to claim 1, characterized in that: Step 2 specifically includes: The soft-sensing model of the BP neural network in the concentration section is programmed using Matlab and combined with its internal neural network toolbox for simulation. The specific steps include: Step 1: Data processing; Step 2: BP neural network design, training and testing; Step 3: Performance evaluation of the neural network model; Step 4: Run the Matlab program to obtain the simulation result curve.

4. The method for soft measurement of density of concentrated Chinese medicine solution based on neural network according to claim 1, characterized in that: The introduction of momentum factor in step 4 can pass through the minimum value, and add a value proportional to the previous weight change to each weight change to generate a new weight change. The value modification formula including the momentum factor is as follows: ΔW(k+1)=(1-mc)ηδX+mcΔW(k)(26), In formula (26), W is the weight matrix of a certain layer, X is the input vector of a certain layer, k is the number of training times, and mc is the introduced momentum factor; the value range of mc is 0 to 1. When mc = 0, the change of weight is adjusted according to the error decrease, and when mc = 1, the next weight change is the same as the previous weight change; the value of the momentum factor is 0.9, and the network model selects mc = 0.

95. At this time, the judgment condition of the momentum method is: In formula (27), SSE(k) is the error, and the error change rate is 1.

04.

5. The method for soft measurement of density of concentrated Chinese medicine solution based on neural network according to claim 1, characterized in that: In step 4, a genetic algorithm is introduced to optimize the weights and thresholds of the network. The specific steps include: Step (i), chromosome encoding and population initialization; Step (ii), select fitness function; Step (iii), performing genetic manipulation; Step (iv), loop operation; continuously loop step (ii) and step (iii), repeatedly train the neural network until the result of genetic neural network training meets the error requirement or the number of iterations reaches the target; the individual records the weight and threshold of each iteration, and updates them once after one cycle; genetic operation is used to continuously update and correct the weight and threshold to obtain the optimal individual value, so that the neural network estimation result is more accurate.

6. The method for soft measurement of density of concentrated Chinese medicine solution based on neural network according to claim 5, characterized in that: In step (a), the structural model of the neural network is designed and constructed according to the input and output variables, and the number of input and output nodes and the overall number of layers are determined. The input layer node of the density soft sensor BP network is 4, the output layer node is 1, and the number of layers is three. All weights and thresholds of the BP neural network are coded, and the length of the code is calculated as: S = n × m + m × l + m + l (28), In formula (28), n is the input layer node, m is the hidden layer node, n×m is the total weight of the input layer and the hidden layer, and l is the output layer node, then m×l is the total weight of the hidden layer and the output layer, m is the threshold of the hidden layer, l is the threshold of the output layer, n=4, m=10, l=1 determined above, the calculated coding length is 61, and the population size is 50.

7. The method for soft measurement of density of concentrated Chinese medicine solution based on neural network according to claim 5, characterized in that: The fitness function in step (2) is: The larger the value of the fitness function, the smaller the deviation value of the neural network model, and the better the adaptability of the neural network.

8. The method for soft measurement of density of concentrated Chinese medicine solution based on neural network according to claim 5, characterized in that: The steps of performing genetic operations in step (iii) are: Step a: Perform selection operation: The probability of an individual being selected is based on the proportion of its fitness value, and the selection is carried out in a roulette wheel manner. The larger the proportion in the roulette wheel, the better the fitness; if k is the total number of individuals in the population, f i is the value of an individual’s fitness, so the probability of the gene being selected can be expressed as: Step b: Perform crossover operation: generate new evolved individuals by crossovering certain positions of two individuals, improve the structure of individuals, and the crossover probability is b. c The value of is selected in the interval [0,1]; Step c, perform mutation operation: The mutation operation selects gene points in the parent sample individuals and replaces them with random numbers to ensure the diversity of population individuals and improve the search ability of genetic algorithms applied to the global network. The mutation probability b m The value is in the range [0,1], and 0.1 is chosen.