You are on page 1of 29

CHE 317: COMPUTER PACKAGES FOR

CHEMICAL ENGINEERS

(EXCEL SECTION)

WEEK 4

Instructors:
Engr. (Dr) Efeovbokhan, V.E and Mr. A. T. Ogunbiyi
CONVERTING UNITS IN EXCEL
Class Examples
• SIMPLE CONVERSIONS IN EXCEL
Use Excel to carry out the following simple unit
conversions:
(a) 2.5 ft to m

• COMPLEX CONVERSIONS IN EXCEL


Use Excel to carry out the following complex unit
conversions:
(a) Convert a viscosity of 78.8 g(cm)(sec) to lbm /(ft)(hr)
Practice Problems
• SIMPLE CONVERSIONS IN EXCEL
Use Excel to carry out the following simple unit conversions:
(a) 400 grams to slugs (b) 1.71 ounces to pounds mass
(c) 200 horsepower to watts (d) 91.2 pascals to atmospheres
(e) 8.5 liters to gallons

• COMPLEX CONVERSIONS IN EXCEL


Use Excel to carry out the following complex unit conversions:
(a) Convert a viscosity of 78.8 g(cm)(sec) to lbm /(ft)(hr)
(b) Density of 137lbm /ft3 to kg/m3
(c) Heat capacity of 0.285 BTU/(lbm)(oF) to J/(kg)(K)
(d) Acceleration of 14ft/sec2 to m/hr2
(e) Volumetric flowrate of 12500 gal/hr to liters/min
SOLUTION TO
ASSIGNMENTS 1
AND 2
Solutions to Assignments 1 and 2 were reviewed in class using
selected students’ solution. Sample solutions will be uploaded to the
Moodle.
ASSIGNMENT 2 QUESTIONS

1. Solve the van der Waals’ equation (written in cubical form


below)
𝑝𝑣 3 − (𝑝𝑏 + 𝑅𝑇)𝑣 2 + 𝑎𝑣 − 𝑎𝑏 = 0
for the volume per mole (v) of an organic compound at 10 atm
pressure and 400K. The van der Waals’ constants for this
𝑙𝑖𝑡𝑒𝑟 2 𝑎𝑡𝑚 𝑙𝑖𝑡𝑒𝑟
particular compound are 𝑎 = 40.0 𝑎𝑛𝑑 𝑏= 0.2 .
𝑚𝑜𝑙𝑒 2 𝑚𝑜𝑙𝑒
Use the Newton-Raphson Iterative procedure neatly setup in an
Excel worksheet. Take R as 0.08205(atm)(liter)/(mol)(K).
Hint: Take all the parameters in that equation as constants except
‘v’, i.e. the equation can be taken as f(v) = 0, and substitute the
values of the a, b, R, p and T into the equation.
Formulae: Newton-Raphson’s equation can be written as: 𝑥𝑛+1 =
𝑓(𝑥𝑛 ) 𝑥𝑛+1 −𝑥𝑛
𝑥𝑛 − and the convergence criterion ∈=
𝑓′ (𝑥𝑛 ) 𝑥𝑛+1

2. The van der Waals’ constants for carbon dioxide have been
𝑙𝑖𝑡𝑒𝑟 2 𝑎𝑡𝑚 𝑙𝑖𝑡𝑒𝑟
determined to be 𝑎 = 3.592 𝑎𝑛𝑑 𝑏= 0.04267 .
𝑚𝑜𝑙𝑒 2 𝑚𝑜𝑙𝑒
Solve the van der Waals’ equation of state (EOS) for the volume
per mole (v) of carbon dioxide under the following conditions: P
= 8 atm, T = 300K, using Excel’s Solver.
𝑅𝑇 𝑎
The van der Waals’ EOS is given by 𝑝 = − 2. Take R =
v−b 𝑣
0.082054 (liter)(atm)/(gmol)(K).
Assignment 3 Question (Due date – Friday 22nd Sept., 2017)
Barron (1985) lists the specific volume of nitrogen at 5 X 106Pa and 150K as
0.116m3/kmol. The gas constant, R in these units is 8317 (Pa)(m3)/(kmol)(K). Use the
Peng-Robinson’s equation of state (EOS) and Excel’s Solver to calculate the specific
volume (to 3 d.p) and compare with this value. The critical constants Tc and Pc are
126.2K and 3.4 X 106Pa respectively, and the accentric factor, ω for nitrogen is 0.040.
Peng-Robinson’s EOS for Pure Components

𝑅𝑇 𝑎
𝑝= −
𝑣 − 𝑏 𝑣 𝑣 + 𝑏 + 𝑏(𝑣 − 𝑏)

OR in the expanded form,

𝑣 3 (𝑝) − 𝑣 2 𝑏𝑝 − 𝑅𝑇 + 𝑣 𝑎 − 3𝑝𝑏 2 − 2𝑅𝑇𝑏 + 𝑝𝑏 3 + 𝑅𝑇𝑏 2 − 𝑎𝑏 = 0

𝑅 2 𝑇𝑐 2 𝑅𝑇𝑐
where 𝑎 = 0.45724 𝛼 𝑏 = 0.07780
𝑃𝑐 𝑃𝑐

𝑇
𝑇𝑟 = 𝛼 = [1 + 𝑚 1 − 𝑇𝑟 0.5 ]2
𝑇𝑐

𝑚 = 0.37464 + 1.54226𝜔 − 0.26992𝜔2


Curve Fitting with Excel
• Engineers often collect paired data in order to
understand the characteristics or the behaviour of a
system.
• Relationships between the paired data are often
developed graphically.
• Mathematical expressions that capture the
relationships shown in the data can then be developed.
• Our goal is to determine the equation of a curve that
represents the trend reflected by the entire data set.
• To do so, we will make use of the method of least
squares, which is commonly used for fitting straight line
or a curve to a set of data.
The method
The methodof
of least squares
least squares
Cluster of measured data during an
experimental session in the lab.
The method of least squares
• The method of least squares is based on
minimizing the sum of the deviations or errors
of each of the data points from the values on
the line of best fit. For example, the figure that
follows shows how much data point number 8
is deviated from the line of best fit. If each
error is calculated this way and then summed
together. The least squares method is a way of
minimizing the sum of all these errors (Read up
on this from your engineering mathematics or
statistics textbook if you have forgotten).
The method
The methodof
of least squares
least squares
Fitting a straight line to a set of data
• To fit a straight line to a set of data means we wish to
determine the values of the coefficients a and b in the
straight-line equation y = ax + b so that the line will pass
through n data points. The coefficients are obtained by
satisfying the least squares criteria. In particular, the
coefficients are determined by solving the following two
simultaneous equations (You can find out how this is
derived from books on curve fittings). .
Fitting a straight line to a set of data
Class Example:
An engineer has measured the force exerted by
a spring as a function of its displacement from
its equilibrium position. The following data
have been obtained:
Fitting a straight line to a set of data

Pass a straight line through the data points


using the method of least squares. Then plot
the data points and the resulting straight line.

Solution
Fitting a straight line to a set of data

Pass a straight line through the data points


using the method of least squares. Then plot
the data points and the resulting straight line.
i xi yi xi2 xiyi
Solution 1 2 2 4 4
2 4 3.5 16 14
3 7 4.5 49 31.5
4 11 8 121 88
5 17 9.5 289 161.5
Total 41 27.5 479 299
Fitting a straight line to a set of data
On substituting the values in the table into the
simultaneous equations earlier written, we have:

41a + 5b = 27.5
479a + 41b = 299

Which on solving, a = 0.514706 and b = 1.279412

Hence, the equation of the line of best fit then


becomes y = 0.514706x + 1.279412

The next figure shows a plot of the given data and the
line of best fit.
Fitting a straight line to a set of data

14

12

10
Force, N

0
0 5 10 15 20 25
Displacement from Equilibrium Position, cm
Accessing a curve fit

• To access the quality of the curve fit, sum of the


squares of the errors (SSE) is usually computed to
evaluate each of the error terms and is given by

SSE is an indication of the quality of the curve fit – the


smaller the sum of the square errors, the better the fit.
• Another indication of the quality of the curve fit is the so-
called R-squared value defined as :
Accessing a curve fit

• where SST is the sum of the squares of the


deviations about the mean, and is given by

The R-squared value varies between 0 and 1. Note that


Will equal 1 when SSE equals zero. Hence, an value
close to 1 (which means that the sum of the square errors
is small) generally indicates a good fit.
Fitting a straight line to a set of data

Read up about curve fittings to understand


more about the underlying mathematical
principles of the method of least squares,
which is what Excel uses to fit equations to
data.
Linear Regression With Excel:
TRENDLINE

chart inserted into your worksheet


•To add a line of best fit (linear regression )
• click on Trendline in the Layout tab.
In the window that appears, select linear or any one
appropriate for the Trend/Regression type and
click on the checkboxes for:
“Display Equation on chart” and
“Display R-squared value on chart”.

For fit to a polynomial


must specify the degree
Or order
R2 is the square of the correlation coefficient or coefficient
of determination, is used as the measure of correlation
It ranges from 0 (no correlation) to 1 (perfect correlation).
R2 can be used as a measure of the goodness of fit of data.
A value of R2 of less than 0.9 corresponds to a rather poor
fit of data

EXCEL FUNCTIONS-all with similar arguments:


a. SLOPE(known_y's,known-x's);
b. INTERCEPT(known_y's,known-x's)
c. RSQ (known_y's,known-x's)
the arguments are the same as for the
SLOPE function.
ARGUMENTS OF SLOPE , INTERCEPT AND RSQ FUNCTIONS
To fit data to a straight line:

a. SLOPE(known_y's,known-x's)

b. INTERCEPT(known_y's,known-x's)

c. RSQ (known_y's,known-x's)
slope =SLOPE(A2:A8,B2:B8)

intercept =INTERCEPT(A2:A8,B2:B8)

RSQ =RSQ(A2:A8,B2:B8)
If one is dealing with a set of points (x,y) for a
straight line, the slope, the intercept and R2can be
found without plotting by using the functions:
SLOPE,
Practice Questions
Q1
y: 0.038; 0.080; 0.174; 0.448; 1.43; 5.13; 9.47;
x: 0.2 0.4 0.8 2.0 6.0 20.0 35.0
Find the best values of the constants bo and b1 that best describe the
data by the equation: Y = b0Xb1
Q2. Develop a polynomial equation from the data on the heat capacity
of benzene vapour as a function of temperature.
Cp cal/K gmol: 19.65; 26.74; 32.80; 37.74; 41.75; 45.06; 47.83; 50.16;
TK 300; 400; 500; 600; 700; 800; 900; 1000.

Q3
V mm/s: 11.71; 13.63; 17.25; 18.92;
P bar : 50.6; 75.3; 116.3; 138.8.
Based on theoretical and empirical knowledge the relationship between
burning rate and pressure had the form: V=bPn
Determine the coefficients b and n
A[4]
The relation between the heat capacity of liquid sulfuric acid in cal/g C
and temperature in C is as follows:
Ccal/g C: 0.377; 0.389; 0.396; 0.405; 0.466; 0.458;
T C: 50; 100; 150; 200; 250; 300
Determine regression coefficients in the linear regression:
Cp = bo + b1T

You might also like