Virtual Instrument for Determining Rate Constant of Second-Order Reaction by pX Based on LabVIEW 8.0

The virtual instrument system based on LabVIEW 8.0 for ion analyzer which can measure and analyze ion concentrations in solution is developed and comprises homemade conditioning circuit, data acquiring board, and computer. It can calibrate slope, temperature, and positioning automatically. When applied to determine the reaction rate constant by pX, it achieved live acquiring, real-time displaying, automatical processing of testing data, generating the report of results; and other functions. This method simplifies the experimental operation greatly, avoids complicated procedures of manual processing data and personal error, and improves veracity and repeatability of the experiment results.


Introduction
LabVIEW is the abbreviation of Laboratory Virtual Instrument Engineering Workbench, which is the innovative software product of National Instruments (NIs) in United States. It is the preferred platform when people exploit virtual instrument as the most functional graphic software at present [1][2][3][4][5].
Ion analyzer is one of the most widely used analysis instruments in scientific research and practice. It is widely applied in biomedical, chemical, environmental protection, and other fields. Manual reading and processing data with traditional ion analyzer is not only cumbersome in operation process but also difficult to avoid personal error. The research about ion analyzer connected to computer has been reported in recent years [6]; however, the quantity is small, and the software is mostly developed in text-based programming language (e.g., C, Turbo Pascal, VB, and so on). The disadvantage of the text-based language is long developing periods, difficult maintenance, and expandedness. The VI of ion analyzer based on LabVIEW has not been reported yet. The VI of ion analyzer developed by authors is developed in graphical programming language-LabVIEW 8.0. It not only has friendly interface, easy operation, and expandability, but also can realize automatic slope, temperature, and positioning calibrations. The system has been applied to determine the rate constant of ethyl acetate saponification reaction when the LabVIEW program for determining the reaction rate constant by pX is embedded into the system. The authors have obtained satisfactory results.

System Principles and Configuration
Actually, Ion analyzer, as a high input impedance millivoltmeter, is widely used in measuring the EMF of the battery which is composed by ion selective electrode, reference electrode, and solution. The concentration of the unknown solution is acquired through measuring the EMF margin between standard solution and tested solution under the same electrode system. By the Nernst equation the authors have inferred where E x is the potential, and pX is the pX value of tested solution.  It is obvious that the relation between pX and ΔE(ΔE = E x − E s ) is linear. S is theoretic slope of the electrode system; however, the actual electrode slope is also influenced by temperature, ion valence, manufacturing process, surface structure, activation state of the electrode, and other factors. Although the electrodes are of the same type, the S values of the electrodes may be different. It is why ion analyzer must be proofreaded by standard solution before being used. Traditional ion analyzer needs transform switches and rheostats to complete positioning, ion valence, polarity, electrode slope, and temperature calibrations for proofreading the instrument. In this condition, operators must read and process the data artificially during measurements. The virtual instrument system based on LabVIEW 8.0 for ion analyzer brings the advantage of virtual instrument that "software is instrument" into full play. It achieves proofreading the instrument and data processing automatically by LabVIEW program, so the authors can easily get real-time pX ∼ t and mV ∼ t curve.
System structure of the virtual instrument is shown in Figure 1. Ion selecting electrode and reference electrode are immersed into the tested solution constituting electrode system. The potential signal enters into computer via the PCI-6014 Data Acquisition (DAQ) after impedance transformation and filtering by high input impedance conditioning circuit. Precise digital temperature thermoscope connects the computer by RS-232 serial port which makes the automatical temperature compensation easily.
The homemade conditioning circuit is shown in Figure 2. It is made up of one high input impedance voltage follower with CA3140 and second-order active low-pass filter with low drift OP07. Specially the CA3140 is used to accomplish impedance transformation of electrode system, then the low drift OP07 accomplishes the output signal filtering.

Design and Implementation of the Main LabVIEW Program for System
The system software consists of four main parts, including operation panel, data acquiring and real-time displaying, data storage, and data processing and result displaying. Thereinto, the former three parts of the system software are necessary, and the last one can be adjusted according to the purpose of users' measurement. Figure 3. To enable users to adjust sampling interval and channels according to their needs, sampling interval knob and channels selecting controller are set on the left of the panel. Users can also decide whether to save the date synchronously by synchronous memory controller or not. In this LabVIEW program, Event Structure which comprises data acquiring, data saving, data processing, result printing, and exit five subevents is used. Each subevent corresponds with a control button on the panel. When clicking the control button, corresponding event will be called. Operation panel adopts Tab Control on the whole to achieve the switch between mV stall and pX stall and connects Tab Control with Selection Terminal of a Case Structure on block panel. Clicking the mV stall and pX stall button on top of the operation panel can complete the switch between mV stall and pX stall easily.

Program for Data Acquiring and Real-time Displaying.
Program for data acquiring and real-time displaying of pX measurement is the key program of the system which can automatically complete temperature, slope, orientation, and ion valence correction. The program consists of a Stacked Sequence Structure, which includes seven frameworks. While the program is running the structure will gradually execute the framework program according to the order of selection for labels 0,1,2 . . . . Figure 4 shows the block program of the last framework. It executes real-time acquiring anddisplays the pX value of the solution under test and data provisional storage, which is mainly constituted by three While Structure. The upmost While Structure accomplishes the driving of data acquisition card and data acquiring continuously. Channels selecting controller select channel, AI Config function sets up the size of buffer, AI Read function sets up sampling rate, and Max & Min function controls the amount lagging to avoid data coverage. To enhance the stability and veracity of the result, 300 acquired data will be switched to pX value after averaged and then real-time displayed by the control Meter and transmitted to the downmost While Journal of Automated Methods and Management in Chemistry Structure by native variable to save. At the same time the textboxes on the right of the operation panel display pX value, electrode slope, mV, ion concentration of X, and other data. The While Structure in the middle real time acquires the temperature value of exact digital temperature thermoscope by the serial communication VI and then transmits it to the upmost While Structure by native variable to accomplish temperature compensation automatically. The temperature of solution is real-time displayed by the control Thermometer in the operation panel. The While Structure downmost writes the discrete pX value to file according to the sampling interval set by users and displays it in Express XY Graph. Because LabVIEW program adopts parallel operation mechanism, the three While Structure can run independently.
The program of mV stall is similar to this and simpler relatively; the only difference is real-time displays are potential ∼time curve. Figure 5. First, open a file dialog box with the function File Open to offer the storage path for users. Then copy the data saved in provisional file to appointed file with the function Copy and superadd initial experiment conditions to the file which is saved for the use of data processing at the same time. If any failure during data storage, it will pop up invalid save and give error reasons to users, allowing users to save again until success.

Basic Principles of Determining Rate Constant by pX.
The biggest advantage of virtual instrument is easy expandability, fully playing the powerful data processing function of computer to deal with the test data collected according to the programming needs of users. Basic principles of determining rate constant by pX are that the concentration of the participation in the reaction system changes over time with reaction proceeding, so tracking and recording a curve of pX with the change of time t, and then by corresponding data processing under the principle of dynamics the corresponding parameters of dynamics can be determined. For easy presentation, take a typical second-order reaction the reaction of ethyl acetate saponification as an example: With reaction proceeding, OH − gradually diminishes, and CH 3 COO − gradually increases in the system, so the PH value of the system gradually reduces. The information of reaction course is obtained by determining the PH value with the time. So the rate constant of this reaction can be determined by the method of pX.
For second-order reaction, data processing formulae are different for the equal and unequal initial concentration  of reactants. In accordance with the principle of dynamics, according to [7][8][9], when the initial concentrations of reactants are equal, setups of the initial concentration are both c 0 , then the dynamic formula for the reaction is where c is the concentration of NaOH at the time t; k is rate constant, for strong base BOH, So we can educe the relationship formula between the pH value of the system and time as (5) 10 14−pH = kt + 1 c 0 .
It shows that by plotting 10 14−pH against t, the slope of the line is rate constant, k.
When the initial concentrations of reactants are unequal, setups a, b (a > b) are, respectively, the initial concentration of NaOH and CH 3 COOC 2 H 5 , then the concentration of each component of the reaction system at different reaction time can be expressed as CH 3 COOC 2 H 5 + NaOH −→ CH 3 COONa + C 2 H 5 OH where a t , a ∞ are, respectively, the concentration of NaOH at the time of t and t = ∞, and x is the concentration of product CH 3 COONa and C 2 H 5 OH at the time of t. When a / = b the dynamic formula for second-order reaction is Because Set up A = − ln(1 − (10 pH ∞ −14 /10 pH t −14 )), then Equation (11) is the relationship formula between pH value and time, which shows that by plotting A against t a straight line is obtained, and after determining [OH − ] t , [OH − ] ∞ of the system at the time of t = t and t = ∞ rate constant k can be obtained from the slope of the line.
These methods do not require determining the accurate initial concentration of reactants, which simplifies the experimental operation. By Arrhenius equation ln(k 1 /k 2 ) = E a (1/T 2 − 1/T 1 )/R, the activation energy can be obtained by the rate constant of different temperature.

Program for Data Processing and Results
Displaying. The block program is shown in Figure 6. The corresponding program in the Sequence Structure on the far left firstly judges whether the initial concentration of reactant is equal, then chooses the corresponding data file which is waiting for processing. The program performs the corresponding subdiagram of Case Structure according to judging result. Data processing includes linear transforming of data, transforming the label of axis, straight line fitting, and correlation coefficient R calculating, and so forth. A group of data read out from data file enters For Loop structure, by using the Loop Iteration; the automatically matching of data of X axis and data of Y axis is achieved. The autoindex of For Loop makes the results to be an array. After this array enters subprogram for straight line fitting, the unqualified data is deleted and the line slope, intercept, and other data are obtained. A cluster array is produced by the function Build Array after the data "after deleted" and "the data after fitted" are, respectively, bundled by the function Bundle, and is displayed by the control XY Graph. At the same time, by using Xscale.NameLb1.Text and Y scale.NameLb1.Text in Property Node of graph and condition of initial concentration of reactant, the label of axis is automatically transformed with different beginning condition. Correlation coefficient of straight line fitting is obtained after the data enters subprogram for R. The system

Example of Application
This system is used to determine the rate constant of ethyl acetate saponification reaction at the temperature of 298 K and 308 K when the initial concentration of reactants is equal and unequal. In the measuring process the system automatically collects testing data and real-time displays pH ∼ t curve, as shown in Figure 3. It also automatically processes testing data and generates the report of result. Figure 7 is the data processing panel under equal initial reactants concentration, and the two XY Graphs on each side, respectively, display testing data at the temperature of 298 K and 308 K. The underside of panel is a testing conditions and results showing box which can display reaction temperature, rate constant, correlation coefficient, and apparent activation energy together. Relevant data of test is shown in Table 1.

Conclusion
The virtual instrument system based on Labview8.0 for ion analyzer, which has advantages of easy operation and friendly interface, can determine pX, realize real-time displaying and drawing a curve of pX or mV with the change of time t, process data, and generate result report automatically. The relative error of result is less than 3.5%. For any secondorder reaction system, the virtual instrument system can track the concentration change of the corresponding ion and then determine its rate constant if appropriate ion-selective electrode is used. For other series of reactions, the system can also determine their rate constants by amending dataprocessing program under the principle of dynamics. With its easy expandability, the system can be used in autodetermination studies such as potential titration, potential analysis, and potential equilibrium constant measurement through embeding different data-processing programs of LabVIEW. What is more, the system provides users with great convenience for tracking and measuring pX or potential application research; the authors believe that it can be widely used in the production and environmental monitoring.