Quality Control of a Paint Production Process
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
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:
with y∈ℝ6 and 0≤t≤180.
The matrix, M, is of rank 5 and given by:
and the function f by:
where the ri and Fin are auxiliary variables given by:
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.
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 = y1.⁡t=−2⁢k1⁢y1⁡t4⁢y2⁡t+k2⁢y3⁡t⁢y4⁡t−k2⁢y1⁡t⁢y5⁡tK−k3⁢y1⁡t⁢y4⁡t2
eq2 = y2.⁡t=−k1⁢y1⁡t4⁢y2⁡t2−k3⁢y1⁡t⁢y4⁡t2−k4⁢y6⁡t2⁢y2⁡t2+klA⁢ρH−y2⁡t
eq3 = y3.⁡t=k1⁢y1⁡t4⁢y2⁡t−k2⁢y3⁡t⁢y4⁡t+k2⁢y1⁡t⁢y5⁡tK
eq4 = y4.⁡t=−k2⁢y3⁡t⁢y4⁡t+k2⁢y1⁡t⁢y5⁡tK−2⁢k3⁢y1⁡t⁢y4⁡t2
eq5 = y5.⁡t=k2⁢y3⁡t⁢y4⁡t−k2⁢y1⁡t⁢y5⁡tK+k4⁢y6⁡t2⁢y2⁡t
eq6 = 0=Ks⁢y1⁡t⁢y4⁡t−y6⁡t
We now create a system model containing the equations derived above and the initial conditions.
System≔seqeqi,i=1..6 union ics
The values of the physical parameters and initial conditions of the system are given by:
We can now solve the DAE system and plot how the concentrations of the various compounds change with time using the odeplot command
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
ExcelFilePath≔c:\program files\maple 17\data/Excel/ExperimentalData.xls
ExperimentalData≔ImportExcelFilePath, Experimental, A2:G12
ExperimentalData≔ 1..11 x 1..7 ArrayData Type: anythingStorage: rectangularOrder: Fortran_order
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.0142085⁢mol, 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.0963959⁢mol, which is 1.3 times smaller than the steady state concentration obtained via the experimental data.
SteadyStateConcentrationC≔evalf6rhsselecthas,sol200,y5t⋅mol = SteadyStateConcentrationC≔0.0142085⁢mol
SteadyStateConcentrationA≔evalf6rhsselecthas,sol200,y1t⋅mol = SteadyStateConcentrationA≔0.0963959⁢mol
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.
StatsA≔Predicted 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
StatsCO2≔Predicted 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
StatsAT≔Predicted 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
StatsB≔Predicted 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
StatsC≔Predicted 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
StatsAB≔Predicted 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
Predicted and Experimental Mean of the Reaction Kinetics for each Compound
Predicted and Experimental Standard Deviation of the Reaction Kinetics for each Compound