Data Driven Software Sensors in the Process Industry

download Data Driven Software Sensors in the Process Industry

of 16

Transcript of Data Driven Software Sensors in the Process Industry

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    1/16

    Data Driven soft Sensors in the Process Industry

    The instrument which is widely used in the process industry are sensors, primary purpose of

    these sensors are to deliver data for control process. As from the name of soft sensors, its combination

    of two words, software means models which are usually computer programmed and sensors whose

    work is to deliver information from their hardware to counterparts. There are two different classes of

    soft sensors i.e., model driven and data driven. These both types of sensors based on some kind of

    principles, model driven soft sensors based on First Principle Model (FPM) while data driven soft sensors

    based on extended kalman filters and Principle Component Analysis (PCA). The FPM describe the

    physical and chemical background of the system, developed primary for the planning and design of

    processing plant and usually focus on the description of the steady state of the process which is the

    drawback of this principle, so to solve this kind of drawback we use data driven soft sensors. Data driven

    soft sensors based on the data measured within the processing plant. These are better than model

    driven, generate better result, describe true condition of the process. The most dominant thing is the

    prediction of process variable at low sampling rate and off line analysis and these variables are

    important for process control as well as for the output quality. Another importance of soft sensors are

    monitoring and fault detection, if there is fault and process is deviating from normal condition than it

    identify the deviation source. As these sensors presenting the predicted process state they can support

    the process operators and allow them to make faster, better and more objective decision. Other

    important application field is sensors fault detection and reconstruction.

    Industrial Process:

    With respect to modeling point of view software sensor deals with different industrial process,

    continuous and batch process. Continuous processing as from the name running in uninterrupted way.

    When this process starts it moves on constant way hopefully optimal state. Soft sensors applied on thisprocess deal on steady state of the process instead of transient state while the steady state is changing

    due to which it produced negative effect. While the batch process means dis-continuous process it starts

    according to the given conditions and similarly stop in a vice versa. So the time is changed with the

    process means discrete time and discrete dimension of the data used. In this case most common

    method used is Principle Component analysis. So, there are some characteristics used for this industrial

    process which is given below:

    Missing Values:Missing data are single samples or consequent of samples where one or more variable

    has a value which does not reflect the real state of physical measured quantity. There are so many

    causes due to which missing values occurs. As there are so many sensors used in industrial process insome cases some sensors failed or they are not able to do work, may be due to mechanical problems.

    Another problem due to which the missing values occurs when there is transmission of information from

    on sensor to another sometimes errors occur due to database. To solve these type of problems deletion

    case is used means the skip the data samples consisting the variable with missing values. Another

    approach is the statistically makes the reconstruction of missing values dependent on the other variable

    of the affected samples.

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    2/16

    Data Outliers: data outliers are the values which deviate from the typical or sometimes from

    meaningful range of the measured values. There are two types of outliers, one is obvious and other is

    non-obvious. Obvious outliers are those values that violate the physical limitations. For example

    absolute pressure may not reach negative value. To detect this type of values system has to be provided

    limiting values in the form of priori information. Non-obvious outliers are difficult to detect because

    these outliers not violate the physical or technological limitation but still exist and effect the actual

    measurement or results.

    Drifting Data:there are two types of drift which depends on the cause of the drifting. One cause of the

    drifting is change of the process or process condition. There are so many mechanical instruments which

    undergo steady abrasion during the operation of the plant. This may have effect on process itself.

    Another cause is the changing in environmental conditions, the purity of the input materials. Actually

    the change may progress very slowly and may influence each other and thus make non-linear form

    which is difficult to detect and compensate. To solve this type of problems windows moving techniques

    is used; model is updated periodically depending on most defined number of recent values.

    Data co-linearity:The data co-linearity is different kind of characteristics in which the data measured

    in process industry is co-linear. Two neighboring temperature sensors will deliver strongly correlated

    measurement. For this it is necessary to be detailed information about all components of the process

    which results in large measurements. Such conditions are called data rich but information poor. There

    are two ways to solve the problems; one is to transforming the input variables into reducing space with

    less co linearity it is done by PCA. Another is selecting the subset of input variables which are co-linear.

    Sampling rate and measurement delays: Different sensors works in different sampling rates so one

    should take care of synchronization between them. Synchronizations handled by Process Information

    Management System (PIMS) which records depending on threshold value. This threshold value canaffect the quality of historical data. This is because two low values would cause recording of large

    number of unnecessary samples while large values would cause missing of important data. This fact

    causes problems in control processing. The delays of the particular measurement should be

    compensated by synchronizing the variables.

    Soft Sensors in the Process Industry

    Model-driven and data driven soft sensors

    Here we are distinguish between model driven and data driven soft sensing and also discuss

    hybrid model which is combination of these two models.

    Model driven: in model driven soft sensing we need complete information or phenomenological

    knowledge of process back ground, which is not possible in all the time. These types of model called

    white box. Its mostly used for the planning and development of process but the problem with this model

    is that it need expert knowledge which is not possible all the time.

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    3/16

    Data driven: This model is called black box because it itself has no need of knowledge it depends on

    empirical observation of the process. This type of techniques supports decision support system and used

    in control processing of the system.

    Hybrid model: The combination of both model is possible. So, this model is combination of both, model

    driven and data driven and so called gray box model.

    Soft sensor development methodology

    The general process of common issues of the soft sensors is as follows:

    I. First data inspectionIn this initial stage gain overview of the model and identify the problems which need to solve in this

    initial stage and also assessment the requirement for the model complexity. If the decision is not correct

    in this stage than the models and their performance is evaluated and compared with others in later

    stages.

    II. Selection of historical data and identification of stationary statesThe data which is to be used for the training and evaluation of the model is selected also the

    stationary parts of the data are identified and selected in this part.

    III. Data pre-processingIt requires a large amount of manual work and an expert knowledge for the underlying process. The

    aim is this step is to transfer the data in such a way that it can be more processed by the action mode.

    The usual steps used in this stage are handling of missing data, outliers detection and replacement,

    selection of relevant variable and handling of drifting data. This is an iterative process until the data is

    ready for next step.

    IV. Model selection, training and validationThis phase is very important for soft sensors because it selects the model which is the core of soft

    sensors. A simple approach is to start from simple model type and structure and gradually increased to

    make more and more complex, at the end get required model. The generalization performance can be

    obtained by applying ensemble methods. After finding the optimal model structure and training the

    model, the trained soft sensor has to be evaluated on independent data once again and used different

    tool sfor the evaluation of the model for example mean square error.

    V. Soft Sensor maintenanceAfter developing and deploying it should be maintained on regular basis due to drift and other

    changes of data. There are no automated machines for the maintenance of soft senor. Neuro-fuzzy

    based soft sensor provide mechanism for automatic adaption.

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    4/16

    Data-driven methods for soft sensing

    The most popular techniques used for soft sensor development are as follows.

    Principal Component Analysis

    This method reduces the number variables by building linear combination and has useful features

    because data is collinear. So, the linearity can be handled and the dimensionality of the input space can

    be decreased at the same time. The PCA is usually applied as a pre-processing step. The PCA has some

    extensions such as Model based PCA, non-linear PCA, Recursive PCA, moving window PCA and time

    lagged PCA. There are also some limitations of PCA

    Pure PCA can handle linear relationship of the data and can not deal with non-linearity, this issuecan be solved by extending the original PCA.

    Selection of optimal number of principle components, can be solved by cross validation techniques. This can describe very well input component but do not reflect the relation between input and

    output data space which actually have to be modeled it can be solved by partial least squares.

    Partial Least Square

    It is very popular techniques in process industry, pure PLS has same problem as Pure PCA. It also

    modeled only linear relationship of data. It pay attention on covariance matrix as it brings together input

    and output space. The algorithm decomposes input and output space while keep orthogonality constant.

    It main focus on input and output variables.

    Artificial neural networks

    Actually ANN was build to deal with biological neurons which are the basic information processing

    unit in nervous system. The task of both biological and artificial neuron is to collect information as input,

    process these information and output it. Feed forward is the common neural network in process

    industry. There are also recursive neural network which is same as feed forward NN but the difference

    as the feed back connections. The drawback of ANN during their learning they stuck in a local minima

    which can result in a sub optimal performance and also there are difficulties with estimation optimal

    topology of network.

    Neuro-Fuzzy System

    This is hybrid intelligent model which is combination of learning and universal approximation

    abilities with humane interface system. The diffusion of two system is to overcome the problem as well

    as have advantages of both techniques. It is very well suited to dealing with dynamics environment. The

    good thing is that these system can automatically adopt the environment of data and can update

    parameters.

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    5/16

    Support Vector Machines

    As from the name it deal with computational learning community. These are demonstrates for large

    spectrum of application and so they can also applied as a soft sensors. A lot of work needed when

    dealing with large amount of computational data.

    Techniques for batch process folding

    When measuring k variables at J times than one batch leads to J*K data tables, so the set of N

    batches leads to three ways matrix of the size N*J*K.

    To apply methods as we have discussed earlier we need to unfold three way matrix to two

    dimensional matrix. For this two types methods are very common which are Batch wise unfolding data

    and observation wise unfolding data. Progress of the model of the batch is modeled using the partial

    least square methods. If we have to monitor than it is often used to compare the batch with the well

    performed batch. This well performed batch is selected according to quality and required other

    parameters and called golden batch. The tested batch is compared with this golden batch. Theimportant thing is that the batches should of equal length, if the size is not same than it will effect the

    quality of production. This kind of problem is out of control of the process controllers. This issue can be

    overcome by various techniques such as PCA and PLS. During the OWU this is not a big issue because

    variation in length is kept constant.

    Open issues and future steps of Soft Sensor development

    The main issue is development phase, this phase is iterative phase means after optimizing one part of

    the model development process developer check the other part of the model and possible tune the

    affected part. This type process need much process knowledge to implement in model process. Theproblem is that the process knowledge differ from model to model due to which so each time a new soft

    sensor is developed. After launching the sensors one can see that the performance reduced this is due

    to the gradually changing in the process after sometimes the performance of the model is unacceptable

    and need to rebuilt for this purpose so many approaches used.

    Model Predictive Control (PID)

    A process has the transfer function,

    ()() =

    10+1(5+1)

    a. Use the equation to calculate the controller gain matrix, Kc, for two cases:1.P=3,M=12.P=4,M=2

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    6/16

    b. Assume that N=70, t=1, and that u is unconstrained for each case.Compare thesetpoint responses of two MPC controller and a digital PID controller with t=0.5and ITAE set point tuning: Kc=2.27,l=16.6, and D=1.49 compare both y and uresponses.

    c. Repeat (b) for a unit step disturbance and a PID controller with ITAE disturbancetuning: Kc=3.52,l=6.98, and D=1.73.

    Solution:

    Code:

    clearclcdisp('Model Predictive Control')Ts=1;

    N = input("Model Horizon = N = ");P1= input("Prediction Horizon= P1 = ");M1= input("Control Horizon = M1 = ");P2= input("Prediction Horizon= P2 = ");M2= input("Control Horizon = M2 = ");s=%s;G=syslin('c',1/(5*s+1)/(10*s+1));t=0:Ts:(N-1)*Ts;u_sim=ones(1,length(t));S=csim(u_sim,t,G)';

    T=80;S1=S(1:P1);//MPC 1S2=[S(1:P2)[0;S(1:P2-1)]];Q=1;R=0;// No move suppressionKc1=inv(S1'*Q*S1+R*eye(M1,M1))*S1'*Q;Kc2=inv(S2'*Q*S2+R*eye(M2,M2))*S2'*Q;mprintf('\nFor P=%i and M=%i,\nKc=\n[%f%f%f]\n',P1,M1,Kc1)mprintf('\nFor P=%i and M=%i,\nKc=',P2,M2)disp(Kc2)

    n=T/Ts*2+1;u=zeros(n,1);d=zeros(n,1);delta_u=zeros(n,1);u=cumsum(delta_u);delta_d=zeros(n,1);d = cumsum( delta_d ) ;y=zeros(1,n);

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    7/16

    yhat=zeros(1,n);ydot=zeros(P1,n);ydottilde=zeros(P1,n);yr=ones(P1,n);edot=zeros(P1,n);

    t=-(n-1)/2:Ts:(n-1)/2;for k=(n-1)/2+1:n-P1for J=1:P1ydot(J,k+1)=S(J+1:N-1)'*flipdim(delta_u(k +J-N+1:k-1),1)+S(N)*u(k+J-N);endJ=0;y(k+J)=S(1:N-1)'*flipdim(delta_u(k+J-N+1:k+J-1),1)+S(N)*u(k+J-N)+...S(1:N-1)'*flipdim(delta_d(k+J-N+1:k+J-1),1)+S(N)*d(k+J- N);J =0;yhat(k+J)=S(1:N-1)'*flipdim(delta_u(k+J-N+1:k+J-1),1)+S(N)*u(k+J-N);

    ydottilde(:,k+1)=ydot(:,k+1)+ones(P1,1)*(y(k)-yhat(k));edot(:,k+1)=yr(:,k+1)-ydottilde(:,k+1);delta_u(k)=Kc1*edot(:,k+1);u(k)=u(k-1)+delta_u(k);endsubplot(1,2,1);plot(t,y,'black-');subplot(1,2,2);plot2d2(t,u);n=T/Ts*2+1;

    u = zeros (n,1);d=zeros(n,1);delta_u = zeros (n ,1) ;u = cumsum ( delta_u ) ;delta_d = zeros (n ,1) ;d = cumsum ( delta_d ) ;y=zeros(1,n) ;yhat = zeros (1 , n ) ;ydot = zeros ( P2 , n ) ;ydottilde = zeros ( P2 , n ) ;yr = ones ( P2 , n ) ;edot = zeros ( P2 , n ) ;t = -(n -1) /2: Ts :( n -1) /2;for k =( n -1) /2+1: n - P2for J =1: P2ydot(J ,k +1) = S(J+1:N-1)'*flipdim(delta_u(k+J-N+1:k-1),1)+S(N)*u(k+J-N);endJ =0;

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    8/16

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    9/16

    set ( gca () , "data_bounds" ,[0 60 0 1.25]) ;l = legend ( "MPC (P1 ,M1)","MPC(P2 ,M2)" , "PID controller",position =4) ;xtitle ( " Process Output " , "Time ( min ) " , " $y$ " ) ;a = get ( "current_axes") ;c = a.y_label ; c.font_size =5;

    subplot (1 ,2 ,2) ;plot2d2 (t ,u , style =5) ;set(gca(),"data_bounds",[0 30 -100 100]) ;l = legend ( "MPC (P1 ,M1)", "MPC (P2 ,M2)","PID controller", position =4) ;xtitle( "ControllerOutput " , "Time ( min ) " , " $u$ " ) ;a = get ( "current_axes" ) ;c = a.y_label ; c.font_size =5;

    //=============Par t ( c ) MPC 1========//n = T/Ts*2+1;u = zeros (n ,1) ;

    d = zeros (n ,1) ;delta_u = zeros (n ,1) ;u = cumsum( delta_u ) ;delta_d = zeros (n ,1) ;delta_d (( n -1) /2+1) =1;// d i s t u r b a n c e t =0 mind = cumsum ( delta_d ) ;y = zeros (1 , n ) ;// Ac t u al v a l u e syhat = zeros (1 , n ) ;// p r e d i c t e d v a l u eydot = zeros (P1 , n ) ;// Un for c e d p r e d i c t i o n sydottilde = zeros (P1 , n ) ;

    yr = zeros ( P1 , n );edot = zeros ( P1 , n ) ;// p r e d i c t e d u n fo r c e d e r r o rt = -(n -1) /2: Ts :( n -1) /2;for k =( n -1) /2+1: n - P1

    // Un for c e d p r e d i c t i o n sfor J =1: P1ydot(J,k+1) = S(J+1:N -1)'* flipdim ( delta_u(k+J-N+1:k-1),1)+S(N)*u(k+J- N ) ;end

    // Ac t u al v a l u e s o f t h e p r o c e s sJ =0;y(k+J)=S(1:N-1)'* flipdim (delta_u(k+J-N+1:k+J-1),1) + S(N)* u ( k +J - N) +...S (1: N -1)'* flipdim( delta_d( k+J - N +1:k +J -1),1)+ S( N )* d ( k +J - N) ;

    // P r e d i c t e d v a l u e o f t h e p r o c e s sJ =0;yhat(k+J)=S(1:N-1)'* flipdim (delta_u(k +J- N +1: k +J-1) ,1)+S(N)*u(k+J- N);

    // C o r r e c t e d p r e d i c t i o n f o r u n fo r c e d c a s eydottilde(:,k +1) = ydot(:,k +1)+ ones( P1 ,1)*( y ( k )-yhat ( k )) ;

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    10/16

    // P r e d i c t e d u n fo r c e d e r r o r Eqn20 52edot(: , k +1) = yr(: , k +1) - ydottilde(: , k +1) ;

    // C o n t r o l movedelta_u( k )= Kc1 * edot(: , k +1) ;u(k)= u(k -1) + delta_u ( k ) ;

    endscf () ;subplot (1 ,2 ,1) ;plot(t,y,'black-') ;subplot (1 ,2 ,2) ;plot2d2 (t ,u ) ;//=============Par t ( c ) MPC 2========//n = T / Ts *2+1;u = zeros (n ,1) ;d = zeros (n ,1) ;

    delta_u = zeros (n ,1) ;u = cumsum ( delta_u ) ;delta_d = zeros (n ,1) ;delta_d (( n -1) /2+1) =1;// d i s t u r b a n c e t =0 mind = cumsum ( delta_d ) ;y = zeros (1 , n ) ;// Ac t u al v a l u e syhat = zeros (1 , n ) ;// p r e d i c t e d v a l u eydot = zeros ( P2 , n ) ;// Un for c e d p r e d i c t i o n sydottilde = zeros ( P2 , n ) ;yr = zeros ( P2 , n );

    edot = zeros ( P2 , n ) ;// p r e d i c t e d u n fo r c e d e r r o rt = -(n -1) /2: Ts :( n -1) /2;for k =( n -1) /2+1: n - P2

    // Un for c e d p r e d i c t i o n sfor J =1: P2ydot(J,k +1)= S(J+1:N-1)'*flipdim(delta_u(k+J-N+1:k -1),1) + S(N)*u(k+J-N);end

    // Ac t u al v a l u e s o f t h e p r o c e s sJ =0;y(k+J)=S(1:N-1)'*flipdim(delta_u(k+J-N+1:k+J-1),1) + S( N ) * u ( k +J - N) +...S(1: N -1)'*flipdim( delta_d( k+J - N +1: k +J -1),1) + S( N ) * d ( k +J - N);

    // P r e d i c t e d v a l u e o f t h e p r o c e s sJ =0;yhat(k+J)= S(1:N-1)'*flipdim( delta_u(k+J-N+1:k+J-1),1)+S(N)*u( k +J - N) ;

    // C o r r e c t e d p r e d i c t i o n f o r u n fo r c e d c a s eydottilde(: , k +1) = ydot(: , k +1) + ones( P2 ,1) *( y ( k ) -yhat( k )) ;

    // P r e d i c t e d u n fo r c e d e r r o r Eqn20 52edot (: , k +1) = yr (: , k +1) - ydottilde (: , k +1) ;

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    11/16

    // C o n t r o l movedelta_u ( k )= Kc2 (1 ,:) * edot (: , k +1) ;u ( k ) = u(k -1) + delta_u ( k ) ;endsubplot (1 ,2 ,1) ;

    plot (t ,y , '-' ) ;subplot (1 ,2 ,2) ;plot2d2 (t ,u , style =2) ;

    //=============Par t ( C ) PID========//n = T / Ts *2+1;u = zeros (n ,1) ;d = zeros (n ,1) ;delta_u = zeros (n ,1) ;u = cumsum ( delta_u ) ;delta_d = zeros (n ,1) ;

    delta_d (( n -1) /2+1) =1;// d i s t u r b a n c e t =0 mind = cumsum ( delta_d ) ;y = zeros (n ,1) ;// Ac t u al v a l u e sysp =0;// s e t p o i n te = zeros (n ,1) ;// e r r o rdelta_e = zeros (n ,1) ;// e r r o rt = -(n -1) /2: Ts :( n -1) /2;

    // PID s e t t i n g sKc =3.52; taui =6.98; tauD =1.73;for k=(n-1)/2+1:n-1

    // Ac t u al v a l u e s o f t h e p r o c e s sJ =0;y(k+J)=S(1:N-1)'*flipdim(delta_u(k+J-N+1:k+J-1),1)+S(N)*u(k+J-N)+S(1:N-1)'*flipdim(delta_d(k+J-N+1:k+J-1),1)+S(N)*d(k+J-N);

    // e r r o re(k)=ysp-y(k);delta_e(k)=e(k)-e(k-1);

    // C o n t r o l l e r move D i g i t a l PID Eqn 7 28 Pg//( V e l o c i t y for m )u(k)=u(k-1)+Kc*([delta_e(k,1)+e(k,1)*Ts/taui+tauD/Ts*(e(k)-2*e(k-1)+e(k-2))]);delta_u(k)=u(k)-u(k-1);endsubplot(1,2,1);plot(t,y,'red--');set(gca(),"data_bounds",[0 60 -0.1 0.3]);l=legend("MPC(P1,M1)","MPC(P2,M2)","PID controller",position=1);xtitle("Process Output","Time(min)"," $y$ " );a=get("current_axes");

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    12/16

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    13/16

    Figure:2. Disturbance responses

    Model Predictive Control

    Model Horizon = N = 70

    Prediction Horizon= P1 = 6

    Control Horizon = M1 = 1

    Prediction Horizon= P2 = 8

    Control Horizon = M2 = 2

    For P=6 and M=1,

    Kc=

    0. 0.2184458 0.7926101 1.6203926 2.621781 3.7345057

    For P=8 and M=2,

    Kc=

    column 1 to 6

    0. 4.8999296 11.292383 12.810982 10.692745 5.916814

    0. - 6.4865493 - 14.839665 - 16.56286 - 13.344762 - 6.5215779

    column 7 to 8

    - 0.7456006 - 8.6906296

    2.8546201 13.960397

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    14/16

    Figure:3. Set point responses

    Figure:4. Disturbance responses

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    15/16

    Model Predictive Control

    Model Horizon = N = 70

    Prediction Horizon= P1 = 3

    Control Horizon = M1 = 1

    Prediction Horizon= P2 = 3

    Control Horizon = M2 = 2

    For P=3 and M=1,

    Kc=

    0. 7.7954458 28.285039

    For P=3 and M=2,

    Kc=

    0. 110.42504 - 5.684D-14

    0. - 400.66683 110.42504

    Figure:5. Set point responses

  • 8/12/2019 Data Driven Software Sensors in the Process Industry

    16/16

    Figure:6. Disturbance responses

    Analysis:

    Figure1,3 and 5 compare the y and u responses for a unit set point change. Thetwo MPC controllers provide superior output responses with very small settling times,but their initial input changes are larger than those for the PID controller and also its clear

    fromthe above results that when we increased the value of Prediction horizon, P,

    lose its aggression while decreasing the value of P, controller becomes more

    aggressive as shown in figure 1,3 and 5 .

    Its clear from the disturbance responses figures 2,4 and 6that the outputresponses for the MPC controllers have relatively small maximum deviations and are nonoscillatory. By comparison, the PID controllers results in the largest maximum deviationand an oscillatory response. Of the two MPC controller, the one design using P=3 andM=1 provides a slightly more conservative response.

    As the control horizon M increase the MPC controller tends to become more aggressive

    and required computational effort increased, while decreasing the value of P tends thecontroller more aggressive.

    Muhammad Ishtiaq(137081101001)Control Theory and Control Process