Disclosure of Invention
The invention aims to provide a recursion Lasso-based flowmeter anomaly online monitoring method, a recursion Lasso-based flowmeter anomaly online monitoring system and a storage medium, so that the problems in the prior art are solved, and the anomaly condition of a flowmeter can be monitored in time.
The invention provides a recursion Lasso-based flowmeter abnormity on-line monitoring method, which comprises the following steps:
establishing an autoregressive model according to historical flow data of the flow meter, and determining a model coefficient of the autoregressive model through an offline Lasso algorithm;
updating the autoregressive model by a recursion Lasso algorithm by utilizing the real-time flow of the flowmeter;
and determining whether the flowmeter is abnormal or not according to the predicted flow obtained based on the updated autoregressive model and the actual flow of the flowmeter at the next moment.
The method for monitoring abnormality of a flow meter on line based on recursive Lasso as described above, wherein preferably, the establishing an autoregressive model according to historical flow data of the flow meter, and determining a model coefficient of the autoregressive model by an offline Lasso algorithm specifically includes:
collecting a data sample of the flow of the flowmeter to obtain a historical flow data set;
constructing an autoregressive model according to the historical flow data set;
solving a regression coefficient of the autoregressive model based on an offline Lasso algorithm;
and determining the regularization parameters of the autoregressive model by using a cross validation method.
The method for monitoring flow meter anomaly online based on recursive Lasso as described above, wherein preferably, the optimal condition of the offline Lasso algorithm is determined by the following formula, and the regression coefficient and the regularization parameter of the autoregressive model are determined according to the optimal condition of the offline Lasso algorithm:
wherein p is the hysteresis coefficient of the autoregressive model, y n Representing the flow value to be predicted at the current moment, y n-i Represents the flow rate value at the historical time, alpha represents the regression coefficient of the autoregressive model, mu n-1 The regularization parameters of the autoregressive model are represented.
The method for monitoring abnormality of a flow meter on line based on recursive Lasso as described above, wherein preferably, the updating the autoregressive model by using the real-time flow rate of the flow meter through a recursive Lasso algorithm specifically includes:
taking the model coefficient of the autoregressive model determined by an offline Lasso algorithm as an initial model coefficient of the autoregressive model in an updating process;
updating the model parameters of the autoregressive model according to the new real-time flow of the flowmeter every time a new real-time flow of the flowmeter is read in, and updating the autoregressive model by the following formula:
wherein Y is n-1 Historical flow data set, Z, representing flow measured by the flowmeter n-1 Autoregressive term, y, representing an autoregressive model n Representing the flow value to be predicted at the current moment, Z n And the value of t is 0-1, the value of t is changed from 0 to 1 after new data is read, when t =1, the new data is completely read, the parameters alpha and mu in the autoregressive model are updated, the new data at the next moment is ready to be read, and after the new data at the next moment is read, the value of t is changed from 0 to 1.
The method for online monitoring of flow meter abnormality based on recursive Lasso as described above, wherein preferably, the determining whether the flow meter is abnormal according to the predicted flow rate obtained based on the updated autoregressive model and the actual flow rate of the flow meter at the next time includes:
predicting the flow of the flowmeter at the next moment in real time according to the updated autoregressive model to obtain predicted flow;
obtaining an estimation curve graph of the predicted flow according to the obtained predicted flow corresponding to different moments;
obtaining a residual error map according to the deviation between the predicted flow and the actual flow of the flowmeter at the next moment;
and determining whether the flow meter is abnormal according to the residual error map.
The method for online monitoring of flow meter abnormality based on recursive Lasso as described above, wherein preferably, the determining whether the flow meter is abnormal according to the residual error map includes:
when the ordinate of the residual error map exceeds a preset threshold value, determining that the flow data of the flowmeter is abnormal;
and determining whether the reason causing the flow data abnormity of the flowmeter is the abnormity of the flowmeter or the batch replacement of the cut stem product according to the production record.
The method for monitoring the flow meter abnormality on line based on the recursive Lasso as described above, wherein, preferably, the method for monitoring the flow meter abnormality on line based on the recursive Lasso is used for monitoring whether the flow rate of the humidifying water in the tobacco shred making process is abnormal,
the flowmeter abnormity on-line monitoring method based on recursion Lasso further comprises the following steps:
and determining the cut stem product specification at the current moment based on a preset flow threshold of the cut stem product batch and the predicted flow.
The invention also provides a recursion Lasso-based flowmeter abnormity on-line monitoring system adopting the method, which comprises the following steps:
the autoregressive model establishing module is used for establishing an autoregressive model according to historical flow data of the flow meter and determining a model coefficient of the autoregressive model through an offline Lasso algorithm;
the autoregressive model updating module is used for updating the autoregressive model through a recursion Lasso algorithm by utilizing the real-time flow of the flowmeter;
and the flow monitoring module is used for determining whether the flowmeter is abnormal according to the predicted flow obtained based on the updated autoregressive model and the actual flow of the flowmeter at the next moment.
The present invention also provides a computer-readable storage medium, in which a computer program is stored, and when the computer program runs on a computer, the computer is caused to execute the method for online monitoring of flow meter abnormality based on recursive Lasso.
The invention also provides a computer program product, which is characterized in that when the computer program product runs on a terminal device, the terminal device executes the flow meter abnormity online monitoring method based on recursion Lasso.
The invention provides a recursion-based flowmeter anomaly online monitoring method, which updates an autoregressive model through a recursion-based Lasso algorithm, monitors the anomaly condition of a flowmeter according to the predicted flow and the actual flow obtained based on the updated autoregressive model, has the characteristics of high accuracy, convenient operation, real-time tracking and the like, provides scientific, objective and reliable technical support for online monitoring of the humidifying water flow in the tobacco shred manufacturing process, and further can ensure the metering performance stability of the flowmeter.
Detailed Description
Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. The description of the exemplary embodiments is merely illustrative and is in no way intended to limit the disclosure, its application, or uses. The present disclosure may be embodied in many different forms and is not limited to the embodiments described herein. These embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art. It should be noted that: the relative arrangement of parts and steps, the composition of materials, numerical expressions and numerical values set forth in these embodiments are to be construed as merely illustrative, and not as limitative, unless specifically stated otherwise.
As used in this disclosure, "first", "second": and the like, do not denote any order, quantity, or importance, but rather are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that the element preceding the word comprises the element listed after the word, and does not exclude the possibility that other elements may also be included. "upper", "lower", and the like are used merely to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
In the present disclosure, when a specific component is described as being located between a first component and a second component, there may or may not be intervening components between the specific component and the first component or the second component. When it is described that a specific component is connected to other components, the specific component may be directly connected to the other components without having an intervening component, or may be directly connected to the other components without having an intervening component.
All terms (including technical or scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs unless specifically defined otherwise. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail, but are intended to be part of the specification where appropriate.
The invention provides a recursion Lasso-based flowmeter anomaly online monitoring method for online monitoring a flowmeter, aiming at a flowmeter which is a sensing device frequently used in the cigarette production process, based on an actual application scene and an objective scientific thought, so that faults are found in time and loss is reduced.
The method for monitoring the abnormity of the flowmeter based on the recursion Lasso is used for monitoring whether the flow rate of the humidifying water in the tobacco shred making process is abnormal or not, and as shown in fig. 1, the method for monitoring the abnormity of the flowmeter based on the recursion Lasso provided by the embodiment specifically comprises the following steps in the actual implementation process:
s1, establishing an autoregressive model according to historical flow data of the flow meter, and determining a model coefficient of the autoregressive model through an offline Lasso algorithm.
In an embodiment of the online monitoring method for flow meter anomaly based on recursive Lasso according to the present invention, the step S1 may specifically include:
and S11, collecting data samples of the flow of the flowmeter to obtain a historical flow data set.
Specifically, data collected by a humidified water flow meter in the cut stem charging unit is collected as a data source for online monitoring according to a preset time length, so that a historical flow data set is obtained.
And S12, constructing an autoregressive model according to the historical flow data set.
And S13, solving a regression coefficient of the autoregressive model based on an offline Lasso algorithm.
And S14, determining the regularization parameters of the autoregressive model by using a cross validation method.
Specifically, the optimal condition of the offline Lasso algorithm is determined through the following formula, and the regression coefficient and the regularization parameter of the autoregressive model are determined according to the optimal condition of the offline Lasso algorithm:
wherein p is the hysteresis coefficient of the autoregressive model, y n Representing the flow value to be predicted at the current moment, y n-i Represents the flow rate value at the historical time, alpha represents the regression coefficient of the autoregressive model, mu n-1 Representing the regularization parameters of the autoregressive model.
Will l
1 The norm is introduced into the autoregressive model, and the flow number measured by the flowmeter is assumedAccording to y ∈ R
n-1 The regression coefficient of the model is p,
wherein epsilon
i Representing noisy data measured by the flow meter. Then the optimal solution for Lasso becomes:
wherein mu n-1 The method is a regularization parameter, the form of the solution of the formula (1) is sparse, only a few elements are nonzero, and the purpose of the Lasso algorithm is to highlight some nonzero important variables by zeroing some unimportant variables under the condition of a large number of variables, wherein the nonzero variables are variables useful for prediction, so that the flow at which historical moments are helpful for predicting the flow at the current moment can be determined according to the nonzero variables.
The indices of the non-zero elements in the regression coefficient vector α define an "active set" which is preceded for simplicity of notation, e.g. α T =(α 1 T ,0 T )、v T =(v 1 T ,v 2 T ). Wherein the step function v is satisfied for all i 1i =sgn(α 1i ) (ii) a For all j, -1 ≦ v 2j ≦ 1, where i and j are indices that are separately represented for different sets, which may avoid confusion. While dividing Y into Y = (Y) according to "active set =: (Y) 1 Y 2 ) Wherein Y represents Y in the formula (1) n-1 To y n-p Each set of elements corresponding to a regression coefficient alpha, Y 1 Representing elements in the corresponding Y for which the regression coefficient alpha is not zero, Y 2 Refers to the element in the corresponding Y that represents a regression coefficient α of zero. If the solution obtained is unique, Y 1 T Y 1 Is reversible, then the optimal conditions are
It should be noted that α can be calculated in a closed form by knowing the "active set" and the sign of the coefficients in the feature vector α.
And S2, updating the autoregressive model by using the real-time flow of the flow meter and a recursion Lasso (Least absolute convergence and selection operator) algorithm.
The model parameters of the autoregressive model are finely adjusted according to the read new data, so that the prediction effect of the autoregressive model can be improved. In an embodiment of the online monitoring method for flow meter anomaly based on recursive Lasso according to the present invention, the step S2 may specifically include:
and S21, taking the model coefficient of the autoregressive model determined by the offline Lasso algorithm as an initial model coefficient of the autoregressive model in the updating process.
Step S22, when a new real-time flow rate of the flowmeter is read in, updating the model parameters of the autoregressive model according to the new real-time flow rate of the flowmeter, and updating the autoregressive model according to the following formula:
wherein, Y n-1 A set of historical flow data, Z, representing the measured flow of the flowmeter n-1 Autoregressive term, y, representing an autoregressive model n Representing the flow value to be predicted at the current moment, Z n And the value of t is 0-1, the value of t is changed from 0 to 1 after new data is read, when t =1, the new data is completely read, the parameters alpha and mu in the autoregressive model are updated, the new data at the next moment is ready to be read, and after the new data at the next moment is read, the value of t is changed from 0 to 1.
In particular, it is assumed that it has already been calculated atn-1 time solution alpha of equation (1) (n-1) Then, new observation data y is obtained n Then y can be utilized n And historical data to predict data y at time n +1 n+1 Then the target is changed to calculate alpha (n) The value of (c). Thereby leading to a recursive Lasso solution. Note z n =(y n ,y n-1 ,...,y n-p ),Z n =(z 1 ,z 2 ,...,z n ) T ,Y n-1 =(y 1 ,y 2 ,...y n-1 ) T Wherein z is n Representing historical time flow, Z, needed to predict current flow n Representing the set of traffic at all previous historical moments, Y n-1 Representing all historical time flows, the optimized objective function becomes:
the entire update path becomes alpha (n-1) =α(0,μ n-1 ) To alpha (n) =α(1,μ n ) According to the update path, the update method can be divided into two steps:
the first step is as follows: when t =0, from μ n-1 To mu n And updating the regularization parameters, which is equivalent to calculating the regularization path between the two by adopting a minimum angle regression method.
The second step: when mu = mu n Then, t is calculated from 0 to 1.
The solving process of the second step is as follows: it should be first demonstrated that α (t, μ) is a piecewise smooth function for t. To make the sign simpler, let α (t) = α (t, μ), if the signs of the "active set" and the α -intra coefficients are known, the solution to Lasso can be calculated. In the first step, the sign of the "active set" and the intra- α coefficients have been calculated, and when t ∈ [0,t * ) When (wherein, t) * Is expressed in t e [0,t * ) When α (t) is a smooth curve), the sign of the "active set" and the α -inner coefficient remain unchanged, and the solution α (t) of Lasso is smooth. One point at which the "active set" changes is called a turnBreak point, how to calculate this point is analyzed next:
when t = t * The "active set" and the sign of the coefficients in α are updated and kept constant until the next turning point is reached, and the process is iterated until t =1, so that the required solution α (t) can be calculated.
Thus, an online update algorithm for Lasso with added observations is obtained:
STEP1: calculating alpha (n-1) =α(0,μ n-1 ) To alpha (n) =α(1,μ n );
STEP2: initializing alpha (0, mu)
n ) To the "active set" with v = sgn (α (0, μ)
n ) Let v) make v
1 And z
n,1 Is v and z
n The sub-vectors are partitioned according to the "active set",
is that
Wherein the columns are "active sets", initializing
Initializing turning point t' =0;
STEP3: the next turning point t' is calculated. If the turning point is smaller than the previous turning point or if the turning point is larger than 1, STEP5 is skipped,
the first case is: alpha first 1 (t') the ith element becomes 0; then i is removed from the "active set"; then v is measured i Setting 0;
the second case is: firstly, omega is measured 2 (t') the absolute value of the jth element reaches 1; j is then added to the "active set"; next, if the element reaches 1 (or-1), v will be j Put 1 (or-1).
STEP4: updating v according to updated' active set
1 ,
And z
n,1 Update
STEP5: calculate the final result when t =1, where α
(n) Is given a value of
Is given.
When the observation values in the data set are too many, the calculation time of STEP1 is prolonged, and in the subsequent calculation process, the observation point data which is relatively far away from the current time has little influence on the value of the predicted current time, so that the initial historical data is removed after a period of time, and the calculation time of the model is stabilized within a certain range.
Suppose that the solution α at time n has been calculated (n) Later, the first data needs to be removed before the new observation data is read in, thereby leading to a solution for recursive Lasso removal of historical data. Note z 1 =(y 0 ,y -1 ,...,y -p ),Z=(z 2 ,...,z n ) T ,Y=(y 2 ,y 3 ,...,y n ) T Then the optimized objective function becomes:
the whole update path becomes alpha (n) =α(1,μ n ) To alpha (n') =α(0,μ n' ) According to the update path, the update method can be divided into two steps: STEP1: when t =1, from μ n To mu n ' updating the regularization parameters, which is equivalent to computing the regularization path between the two using a least-angle regression method.
STEP2: when mu = mu n' When t is calculated from 1 to 0.
The calculation procedure of STEP2 at this time is the same as the procedure of adding the observation data.
And S3, determining whether the flowmeter is abnormal according to the predicted flow obtained based on the updated autoregressive model and the actual flow of the flowmeter at the next moment.
In an embodiment of the online anomaly monitoring method for the flowmeter based on recursive Lasso, the step S3 may specifically include:
and S31, predicting the flow of the flowmeter at the next moment in real time according to the updated autoregressive model to obtain the predicted flow.
And S32, obtaining an estimation curve graph of the predicted flow according to the obtained predicted flow corresponding to different moments.
The dashed line in fig. 2 is an estimated graph of the predicted flow rate.
And S33, obtaining a residual error map according to the deviation between the predicted flow and the actual flow of the flowmeter at the next moment.
The deviation is the absolute value of the difference between the predicted value and the actual flow rate. The residual map is used for representing whether the flow rate is abnormal under the preset use environment. In some embodiments of the present invention, the residual error map is shown in FIG. 3, in which the straight lines are 50kg/h, 25kg/h, and 10kg/h from top to bottom.
And step S34, determining whether the flow meter is abnormal or not according to the residual error map.
And estimating the change of the online flow in the working process by using the deviation value, and determining abnormal operation of the flow when the deviation value is overlarge. In an embodiment of the online anomaly monitoring method for a flow meter based on recursive Lasso according to the present invention, the step S34 may specifically include:
and step S341, when the ordinate of the residual error map exceeds a preset threshold value, determining that the flow data of the flowmeter is abnormal.
In fig. 3, when the flow meter was out of order at the 7000 th time point, the predicted value was greatly deviated from the actual value, and the residual (ordinate of the residual map) was larger than 50kg/h, and it was determined that the flow rate data was abnormal (the abnormal point in the map was around 100 kg/h).
And step S342, determining whether the reason causing the flow data abnormity of the flow meter is the abnormity of the flow meter or the replacement of the cut stem product batch according to the production record.
If the cut stem product batch is replaced, determining that the reason for causing the flow data abnormity of the flowmeter is production adjustment; if the cut stem product batch is not replaced, determining that the reason for causing the flow data abnormity of the flowmeter is the abnormity of the flowmeter, and at the moment, timely maintaining the flowmeter is needed. In the invention, the state performance of the flowmeter is tracked in real time by using the residual error map, and when the flow is abnormal, the flow can be monitored in time and an alarm is given.
Further, in some embodiments of the present invention, the method for online monitoring of an abnormality of a flowmeter based on recursive Lasso further includes:
and S4, determining the cut stem product specification at the current moment based on a preset flow threshold of the cut stem product batch and the predicted flow.
And determining the product batch entering the cut stem charging unit at the current moment based on a preset flow threshold value of the cut stem product batch and an estimation curve chart drawn based on the predicted flow at a plurality of moments. Because each cut stem product has different batches and different humidification water flow rates, the cut stem product specification can be judged according to the flow rate estimated by the autoregressive model by setting the range of the humidification water flow rates.
The cut stems in the data sample are divided into two types, one is common stems, and the other is special stems for golden leaves. When the material supply is stable, the humidifying water flow of the common peduncle is in the range of 110-130 kg/h, and the humidifying water flow of the special golden leaf peduncle is in the range of 140-170 kg/h. Therefore, the product specification of the cut stems can be judged according to the predicted flow value. In fig. 2, the dotted line is a predicted value, and the solid curve is an actual value; the solid straight line is a dividing line of 140kg/h, if the material supply is stable, the predicted flow is less than 140kg/h, the stem is judged as a common stem, and the measured flow is more than 140kg/h, the stem is judged as a special stem for golden leaf.
The recursion Lasso-based flowmeter anomaly online monitoring method provided by the embodiment of the invention updates the autoregressive model through the recursion Lasso algorithm, monitors the anomaly condition of the flowmeter according to the predicted flow and the actual flow obtained based on the updated autoregressive model, has the characteristics of high accuracy, convenient operation, real-time tracking and the like, provides scientific, objective and reliable technical support for online monitoring of the humidifying water flow in the tobacco shred manufacturing process, and further can ensure the metering performance stability of the flowmeter.
Correspondingly, as shown in fig. 4, the present invention further provides an online monitoring system for flow meter anomaly based on recursive Lasso, including:
the system comprises an autoregressive model establishing module 1, a flow meter and a flow control module, wherein the autoregressive model establishing module is used for establishing an autoregressive model according to historical flow data of the flow meter and determining a model coefficient of the autoregressive model through an offline Lasso algorithm;
the autoregressive model updating module 2 is used for updating the autoregressive model through a recursion Lasso algorithm by utilizing the real-time flow of the flowmeter;
and the flow monitoring module 3 is used for determining whether the flowmeter is abnormal according to the predicted flow obtained based on the updated autoregressive model and the actual flow of the flowmeter at the next moment.
According to the recursion-based flowmeter anomaly online monitoring system provided by the embodiment of the invention, the autoregressive model is updated by the autoregressive model updating module through the recursion-based Lasso algorithm, and the flow monitoring module monitors the anomaly condition of the flowmeter according to the predicted flow and the actual flow obtained based on the updated autoregressive model, so that the system has the characteristics of high accuracy, convenience in operation, real-time tracking and the like, provides scientific, objective and reliable technical support for online monitoring of the humidifying water flow in the tobacco shred making process, further can ensure the metering performance stability of the flowmeter, is also suitable for detection scenes of other metering devices, and has a wide application prospect.
It should be understood that the division of the components of the online flow meter anomaly monitoring system based on recursive Lasso shown in fig. 4 is only a logical function division, and the actual implementation may be wholly or partially integrated into one physical entity or physically separated. And these components may all be implemented in the form of software calls by the processing element; or may be implemented entirely in hardware; and part of the components can be realized in the form of calling by the processing element in software, and part of the components can be realized in the form of hardware. For example, a certain module may be a separate processing element, or may be integrated into a certain chip of the electronic device. Other components are implemented similarly. In addition, all or part of the components can be integrated together or can be independently realized. In implementation, each step of the above method or each component above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in the form of software.
The present invention also provides a computer-readable storage medium, in which a computer program is stored, which, when running on a computer, causes the computer to execute the above-mentioned method for online monitoring of flow meter anomalies based on recursive Lasso.
The invention also provides a computer program product, which is characterized in that when the computer program product runs on a terminal device, the terminal device executes the flow meter abnormity online monitoring method based on recursion Lasso.
In the above embodiments, the implementation may be wholly or partly realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., digital Versatile Disk (DVD)), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
Thus, various embodiments of the present disclosure have been described in detail. Some details that are well known in the art have not been described in order to avoid obscuring the concepts of the present disclosure. It will be fully apparent to those skilled in the art from the foregoing description how to practice the presently disclosed embodiments.
Although some specific embodiments of the present disclosure have been described in detail by way of example, it should be understood by those skilled in the art that the foregoing examples are for purposes of illustration only and are not intended to limit the scope of the present disclosure. It will be understood by those skilled in the art that various changes may be made and equivalents may be substituted for elements thereof without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.