Quality Control of a Paint Production Process - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Applications and Example Worksheets : Science and Engineering : Quality Control of a Paint Production Process

Quality Control of a Paint Production Process

Introduction

1. Formulation of Reaction Kinetics Equation

2. Derivation of the Reaction Kinetics Model

3. Validation of the Reaction Kinetics Model

4. Updated Reaction Kinetics Model

 

Introduction

Quality control in terms of paint production consists of sampling at regular intervals to ensure that the end product meets a set of target criteria, which include desired yield and concentration levels. These criteria are determined by developing a model to accurately represent the reaction kinetics of the system. With a highly accurate model of the chemical process one can quickly identify and correct sources of error during the production process.

During a routine sample control inspection, a quality control engineer identified a significant discrepancy between the expected and actual concentration of paint produced in the reactor; the concentration of paint produced was double the expected value. This application illustrates how Maple was used to identify and subsequently correct the source of error between the model-predicted and actual concentrations of paint produced.

1. Formulation of the Reaction Kinetics Equation

The equations that define the chemical process are shown below. The reactants, A and B, are mixed together while carbon dioxide is continuously added to produce a desired third compound C. In the interest of commercial competition, the names of the chemical species have been changed.

 

We can define the above reaction scheme as a mathematical system, using the equation below:

 

Mⅆydt=fy, y0=y0

with yℝ6 and 0t180.  

The matrix, M, is of rank 5 and given by:

M100000010000001000000100000010000000:

  and the function f by:

fy2r1+r2r3r412r1r412r5+Finr1r2+r3r2+r32r4r2r3+r5Ksy1ty4ty6t:

where the ri and Fin are auxiliary variables given by:

r1:=k1y1t4y2t:

 

r2:=k2y3ty4t:

 

r3:=k2y1ty5tK:

 

r4:=k3y1ty4t2:

 

r5:=k4y6t2y2t:

 

Fin:=klAρHy2t:

 

The variables y1t, y2t, y3t, y4t, y5t, and y6t, are the concentrations of the following compounds A, CO2, AT, B, C and A.B, respectively. The partial pressure of CO2 is given by ρ and H is Henry's law constant.  

     

Using the information above, we can derive the system of nonlinear differential-algebraic equations (DAEs) that models the chemical process described above.

dy:=ⅆⅆty1tⅆⅆty2tⅆⅆty3tⅆⅆty4tⅆⅆty5tⅆⅆty6t:

syst_of_DAEsM.dy=fy

syst_of_DAEsⅆⅆty1tⅆⅆty2tⅆⅆty3tⅆⅆty4tⅆⅆty5t0=2k1y1t4y2t+k2y3ty4tk2y1ty5tKk3y1ty4t2k1y1t4y2t2k3y1ty4t2k4y6t2y2t2+klAρHy2tk1y1t4y2tk2y3ty4t+k2y1ty5tKk2y3ty4t+k2y1ty5tK2k3y1ty4t2k2y3ty4tk2y1ty5tK+k4y6t2y2tKsy1ty4ty6t

(1)

 


Rearranging the equations derived above, we end up with a stiff system of 6 non-linear DAEs of index 1. Although there is no single formulation, stiffness is usually defined as an equation (or system of equations) with terms that can lead to rapid variations in the solution.  

 

for i from 1 to 6 do      eqi lhssyst_of_DAEsi = rhssyst_of_DAEsi end do:

 

eq1 = ⅆⅆty1t=2k1y1t4y2t+k2y3ty4tk2y1ty5tKk3y1ty4t2 

 

eq2 = ⅆⅆty2t=k1y1t4y2t2k3y1ty4t2k4y6t2y2t2+klAρHy2t 

 

eq3 = ⅆⅆty3t=k1y1t4y2tk2y3ty4t+k2y1ty5tK   

 

eq4 = ⅆⅆty4t=k2y3ty4t+k2y1ty5tK2k3y1ty4t2   

 

eq5 = ⅆⅆty5t=k2y3ty4tk2y1ty5tK+k4y6t2y2t 

 

eq6 = 0=Ksy1ty4ty6t   

We now create a system model containing the equations derived above and the initial conditions.

Systemseqeqi,i=1..6 union ics

Systemics,0=Ksy1ty4ty6t,ⅆⅆty1t=2k1y1t4y2t+k2y3ty4tk2y1ty5tKk3y1ty4t2,ⅆⅆty2t=k1y1t4y2t2k3y1ty4t2k4y6t2y2t2+klAρHy2t,ⅆⅆty3t=k1y1t4y2tk2y3ty4t+k2y1ty5tK,ⅆⅆty4t=k2y3ty4t+k2y1ty5tK2k3y1ty4t2,ⅆⅆty5t=k2y3ty4tk2y1ty5tK+k4y6t2y2t

(2)

 

2. Derivation of the Reaction Kinetics Model

The values of the physical parameters and initial conditions of the system are given by:

Parameters

Initial Conditions

  k1

y10

k2

y20

k3

y30

k4

y40

K

y50

klA

y60

Ks

ρ

H

 

params

k1=28.7,k2=0.58,k3=0.09,k4=0.42,K=34.4,klA=3.3,Ks=115.83,ρ=0.9,H=737

(3)

ic

y10=0.444,y20=0.00123,y30=0,y40=0.007,y50=0,y60=0.36

(4)

We can now solve the DAE system and plot how the concentrations of the various compounds change with time using the odeplot command

soldsolvesubsics=ic,params, System,y1t,y2t,y3t,y4t,y5t,y6t,numeric,output=procedurelist: 

 

 

3. Validation of Reaction Kinetics Model

 

The discrepancy between the actual and expected concentration of compound C was revealed by comparing the experimental reaction kinetics for each compound to the predicted values.

 

The experimental data, stored in an Excel file, was extracted using the following commands:

 

 

ExcelDirectoryLocation  catkerneloptsdatadir, /Excel/:ExcelFilePath  catExcelDirectoryLocation, ExperimentalData.xls:

ExperimentalDataImportExcelFilePath, Experimental, A2:G12

The following commands extract the values from Excel:

ExperimentalConcA  MatrixExperimentalData1 .. 1, 1 .. 2:ExperimentalConcCO2  ArrayTools:-Concatenate2, VectorcolumnExperimentalData1 .. 1, 1, VectorcolumnExperimentalData1 .. 1, 3:ExperimentalConcAT  ArrayTools:-Concatenate2, VectorcolumnExperimentalData1 .. 1, 1, VectorcolumnExperimentalData1 .. 1, 4:ExperimentalConcB  ArrayTools:-Concatenate2, VectorcolumnExperimentalData1 .. 1, 1, VectorcolumnExperimentalData1 .. 1, 5:ExperimentalConcC  ArrayTools:-Concatenate2, VectorcolumnExperimentalData1 .. 1, 1, VectorcolumnExperimentalData1 .. 1, 6:ExperimentalConcAB  ArrayTools:-Concatenate2, VectorcolumnExperimentalData1 .. 1, 1, VectorcolumnExperimentalData1 .. 1, 7:

The following plots show the experimental versus predicted reaction kinetics for each compound. From these results, it is apparent that the model derived in the previous section does not adequately predict the experimental results for compound A and compound C.

 

In fact, the concentration of compound C at steady state is 0.0142085mol, which is 1.5 times lower than the steady state concentration observed via the experimental data. Similarly, the concentration of compound A at steady state is 0.0963959mol, which is 1.3 times smaller than the steady state concentration obtained via the experimental data.    

 

SteadyStateConcentrationCevalf6rhsselecthas,sol200,y5tmol = 0.0142085mol 

SteadyStateConcentrationAevalf6rhsselecthas,sol200,y1tmol = 0.0963959mol   

 

 

The statistical calculations (mean, standard deviation, and root-mean square error), confirm the presence of an error in one of the rate constants controlling the concentration of compound A. The data, summarized below, show the root mean square error of compound A to be 0.00301799 which is several orders larger than the root mean square error values of the other compounds.

Extract statistical data

 

StatsAStatsTheoreticalConcA,ExperimentalConcA

StatsAPredicted Mean=0.246700,Experimental Mean=0.211500,Mean Difference=0.035180,Predicted Std.=0.078450,Experimental Std.=0.122800,Std. Difference=-0.044320,Root Mean Square Error=0.0104358

(5)

StatsCO2StatsTheoreticalConcCO2,ExperimentalConcCO2

StatsCO2Predicted Mean=0.000776,Experimental Mean=0.001145,Mean Difference=-0.000370,Predicted Std.=0.000351,Experimental Std.=0.000116,Std. Difference=0.000236,Root Mean Square Error=4.76021e-08

(6)

StatsATStatsTheoreticalConcAT,ExperimentalConcAT

StatsATPredicted Mean=0.096910,Experimental Mean=0.136600,Mean Difference=-0.039650,Predicted Std.=0.038230,Experimental Std.=0.048210,Std. Difference=-0.009976,Root Mean Square Error=0.00110483

(7)

StatsBStatsTheoreticalConcB,ExperimentalConcB

StatsBPredicted Mean=0.003504,Experimental Mean=0.001394,Mean Difference=0.002110,Predicted Std.=0.002067,Experimental Std.=0.002190,Std. Difference=-0.000123,Root Mean Square Error=6.47920e-06

(8)

StatsCStatsTheoreticalConcC,ExperimentalConcC

StatsCPredicted Mean=0.009181,Experimental Mean=0.019370,Mean Difference=-0.010190,Predicted Std.=0.004153,Experimental Std.=0.006637,Std. Difference=-0.002484,Root Mean Square Error=2.91804e-05

(9)

StatsABStatsTheoreticalConcAB,ExperimentalConcAB

StatsABPredicted Mean=0.118000,Experimental Mean=0.047870,Mean Difference=0.070090,Predicted Std.=0.102600,Experimental Std.=0.101900,Std. Difference=0.000698,Root Mean Square Error=0.00373211

(10)

Predicted and Experimental Mean of the Reaction Kinetics for each Compound

Predicted Mean

Experimental Mean

Difference

A

CO2

AT

B

C

A.B

Predicted and Experimental Standard Deviation of the Reaction Kinetics for each Compound

Predicted Std

Experimental Std

Difference

A

CO2

AT

B

C

A.B

Root-Mean Square Error

A

CO2

AT

B

C

A.B

4. Updated Reaction Kinetics Model

 

A better prediction for the reaction kinetics of compound A can be obtained by parameterizing the numerical solution for the differential equation obtained earlier, and fitting the theoretical model to the experimental data using the least-squares approach.

 

The following procedure calculates the sum of the squares of the error between the experimental data and the model prediction for the rate constant k1. It assumes that the only uncertainty in the experimental data exists in the concentration, y1t. In reality, the time the reading was taken will also be subject to a degree of error. If this was to be taken into account, then the following procedure can be easily modified to calculate the sum of the short orthogonal distance between the data points and model predictions; this is also known as orthogonal regression.

 

SumOfSquaresErrorprock1_vallocal temp, y1_temp,i; if not typek1_val,numeric then return 'procname'args; end if;tempdsolvesubsk1=k1_val, ics=ic,params, System,y1t,y2t,y3t,y4t,y5t,y6t,numeric,output=listprocedure,range=0..200:y1_temprhsselectalhsa=y1t, temp:return addExperimentalConcAi,2  y1_tempExperimentalConcAi,12,i=1..11:end proc:


The value of k1 that best describes the experimental data is

k1experimentalevalf6 rhsMinimize'SumOfSquaresError'var,var=1..502 = 10.9258 

 

This value for k1 is much smaller than the value of k1 that was used to develop the original model (that is, 10.925 vs. 28.7). 

 

Taking into account the new value of k1 as shown below, the theoretical model accurately predicts the experimental results.

 

UpdatedSystemdsolvesubsk1=k1experimental, ics=ic,params, System,y1t,y2t,y3t,y4t,y5t,y6t,numeric,output=listprocedure:

UpdatedSteadyStateConcentrationAevalf6rhsselectalhsa=y1t,UpdatedSystem200mol = 0.132042mol

UpdatedSteadyStateConcentrationCevalf6rhsselectalhsa=y5t,UpdatedSystem200mol = 0.0227358mol 

 

With this new rate constant, the concentration of compound C now more accurately matches the concentration being produced at the plant.