3.1.1 Data in CENG 301's Databases

One of the most important procedures involved with the solution of
engineering problems is finding the data required to determine
relations between variables. In chemical systems much of the data is
associated with properties of compounds. Properties such as the
boiling point and latent heat are obviously important in establishing
how a compound would behave when heated. Individual numbers that
specify such properties may be found in Tables in sources like
Perry's Chemical Engineers' Handbook, Lange's Handbook of
Chemistry, and The Handbook of Chemistry and Physics as well as
the Appendices in various Chemical Engineering texts. Looking up such
information can be quite tedious, but it is a procedure that all
engineers have to become proficient in. Even more important than the
fact that it is tedious is that looking up data in a printed table
can lead to errors if the data is stored in units that are not
consistent with what you need in solving a problem or if you simply
enter the data incorrectly into your solution algorithm. Many of the
physical properties that we need in our solution are not simply fixed
numbers, but depend on state variables such as temperature and
pressure. Thus we need more than just individual numbers to determine
these properties.

In order to expedite the solution of problems that require
physical property data, we have collected data for most of the
compounds that you will encounter in your homework and exams. This
data has been converted to a consistent set of units (SI) and stored
in files in two MATLAB data structures. stores much more data used in
Mass & Energy balances for almost 150 compounds. Note that all
compounds in struct4.mat are also in
struct3.mat, but not vice
versa.

If you would like to read more on structures, the way they store
data and the way they are created, go to the CENG
303 pages.

Several variables' "vectors" of data can be
used to approximate properties that depend on temperature. The
specific heat data specify polynomial approximations exactly as in
the Reklaitis text. Thus the specific heat of water vapor is
approximately given as a function of temperature by the fourth order
polynomial:

Of course any program that uses this data must know that it
gives the coefficients in a fourth order polynomial and that the data
is stored in ascending order. The units for both Cp and T must also
be known. In the functions developed for this course, the units for
Cp are J/mol*K and T is assumed to be in K. Polynomials approximating
the specific heat of our compounds in the liquid and solid states are
assumed to be cubic polynomials with the coefficients in the table
arranged in the same way as for the vapor.

The Antoine constants give the vapor pressure as a function of
temperature so that the approximate value for water vapor pressure
is:

P*(T) = exp(16.5362 - 3985.44/(T - 38.997))

Again, our programs can only make use of this expression if
units for the vapor pressure: P* and T are known. We have
used the pressure units kPa and temperature again in K for our data
base.

For many of the compounds, only a limited amount of data is
present. In some cases much of the data is not meaningful: e. g. the
specific heat of most compounds is known only for one or two states,
but not all three.

3.1.2 Creating Your Own Data

Users who need compound data for the modules that are not
contained in either of the two structures, may easily set up their
own compound data. Currently, we are in the process of making a way
to add to the Mass and Energy Balance structure. However, there
already exists a simple way to add to the Mass Balance Only
structure. We will assume that you have the formula and common name
of the compound that you wish to add. If you only have the common
name check the ChemFinder
web page to look up the formula. Then we recommend that you run the
UNIX program fwt to calculate the molecular
weight. Say we want to add naphthalene (C10H8), it would look like
this:

vermiculated% fwt
For each Formula you Give, fwt will report:
1) the number of atoms of each element in it,
2) its molecular weight and
3) its name if it is in the chemical engineering
compound list: namfor.t
Give the formula or stop to STOP
C10H8
Element Number: 6 1
Number of Atoms: 10 8
Molecular Weight= 128.173 Name:
Give the formula or stop to STOP
stop
Formula Molecular Weight Name
C10H8 128.1732
If you want the mol wts. printed for copying to MATLAB, reply: y
n <-- Answering "y" here just prints a vector that is
useless for this purpose. Simply select and paste
the molecular weight in a MATLAB session

Now that we have all the information necessary, we now want to
start a MATLAB session and use the create function to add
our compound. When you add a compound, you will create a new
structure that will be saved in your own directory. Thus, it is
important that as you continue to add compounds, that you add them to
Your Previous Database, since they are rather large and will
use up your quota space.

>>help addcomp
Add a compound to the data base
function st=addcomp(st0)
You can choose to load 301's Mass or Mass & Energy Bal. structure
or you can add to the structure st0.
The compound in the initial structure's first position is used to
set the type and size of the data added to each field.
The structure with data for the added compound is returned.
>>addcomp
Choose a database to edit

<-- Select Mass Balances since that
will give fewer items to add. The
program will allow any number of
items, but this will do for now.

After choosing the 301 Mass Balance
structure to edit the following menu will be displayed to allow you
to enter all the data you know about the compound. In all cases you
will want to give the compound a name and in most cases you will want
to give its formula and molecular weight. If you start with the 301
Mass Balance structure these three items are the only ones that can
be set for your new compound.

<-- This menu will appear as many
times as you wnat.Select cnms,
then form, then mw. Then select
Finished to end this part of the
session.

cnms= ?New Compound <-- When you select cnms, you will be asked for the name
in the Command Window.
form= ? C25H33
Give a vector of length 1
mw= ? 325
ans =
1x249 struct array with fields:
cnms
form
mw
>> who
Your variables are:
ans
>> stdat2=ans <-- stdat2 is the name of the structure used in the 301 start program.
stdat2 =
1x249 struct array with fields:
cnms
form
mw
>> stdat2(249) <-- This is the data we enetered.
ans =
cnms: 'New Compound'
form: 'C25H33'
mw: 325
>> stdat2(248) <-- Here is the data for the next to last compound
ans =
cnms: 'sodium sulfate'
form: 'Na2SO4'
mw: 142.0370
>> stdat2(1) <-- Here is the first compound
ans =
cnms: 'water'
form: 'H2O'
mw: 18.0150
>> save myceng301<-- The file myceng301 is now saved in your directory and the
information can be accessed by start301.

You are given the option in start301 to use either CENG
301's database or Your own database. So, if you are using
a compound that you have created, use your own database. Otherwise,
use the CENG 301 database. From time to time, compounds will be added
to the CENG 301 databases, so be conscious of which databases contain
which compounds, and decide carefully which database you use in
start301.

3.1.3 Programs used to Access Data

Compound Data Files

In Previous versions of the start301, there were two programs, one
used to retrieve the data, then, another to take the data and set it
into variables. These programs were written and compiled in FORTRAN
to retrieve data from files. However, as a result of a new way of
storing data called structures,
the start301 programs have been consolidated into a single stand
alone program. The program now loads a database, searches for
selected compounds and then places the data in variables where they
can be used.

MATLAB program reads a database and sets the arrays used
in mass and energy balance calculations.

>> start301
Copyright 1998 Rice University
All rights reserved
Welcome to CENG301's start301!!
You have three choices, Please read them carefully
Then click on the appropriate choice in the menu bar
1: Click (1) to start a new session
2: Click (2) to enter the name of a datafile from
a previous session, in the current directory
3: Click (3) to use compound names not in the CENG 301 database
WARNING...if you hit (3) no compound data will be available

Session Using shownoh to list headings

Since Section 1.3.3 showed a session
to list names, here is a Unix session used to list headings:station%
shownoh

If you want to show, reply:
compound names n
Names of headings h
Neither, STOP listing s
h
If you want to show the short (MATLAB) names, reply: y
y<-- This will show both kinds of headings
Antoine constants <-- Main heading
Aabc <-- Name used for Antoine constants in Matlab
Acentric Factor <-- Main heading
AcF <-- Matlab name for Acentric Factor
Acentric Factor <-- Main heading
Acentf <-- Another abbreviation that is accepted
......... <-- the list goes on

Options in the use of shownoh include:

listing all compound names rather than just those starting
with a single letter, but you are advised that there are over 200
compounds in the complete list,

listing the formulae for each compound as well as its
name,

listing formula rather than names starting with a specified
letter,

listing headings that may be specified in compound data
files,

listing only the main headings.

Listing Property Data with: listcom

If you want to see the names you can choose from, reply y at the
first prompt. See the 2nd session for a continuation of the example
to list the data for water. You can see all data stored in the course
data file for a compund by:

This program starts by asking if you want to see the list of
compound names. It uses the same listing program for the names that
shownoh does and gives the same options. A carriage return bypasses
the name listing program. Only the data given in the file are listed.
For many compounds (such as water) much more data will be shown than
for carbon. For many compounds only the name, formula and molecular
weight will be given.

Setting names for Mass and Energy Balances:
start301

The MATLAB program start301 has been demonstrated
in the section on the mass balance
modules. To use them in problems that require information stored in
the data files, you simply answer Energy & Mass Balances
at the pop up menu. For example:

>> start301
Copyright 1998 Rice University
All rights reserved
Welcome to CENG301's start301!!
You have three choices, Please read them carefully
Then click on the appropriate choice in the menu bar
1: Click (1) to start a new session
2: Click (2) to enter the name of a datafile from
a previous session, in the current directory
3: Click (3) to use compound names not in the CENG 301 database
WARNING...if you hit (3) no compound data will be available
<-- Choose (1) New Session
Now choose from the above menu
<-- We want Mass & Energy Balances

<-- In most cases we load CENG 301's database.

Please wait while loading database...
Which units do you want to use for temperature?
Choose one from the menu

<-- We will choose Kelvin most often for the
purpose of more applications. It can be
altered, so if you are unsure, choose Kelvin
and then change if necessary.

Input the name of your new file: test
The output file name is: test
Input the number of compounds: 2
The number of compounds is: 2
Enter the name of compound # 1: carbon
Enter the name of compound # 2: water
Enter the number of reactions: 0
Here are your compounds' formulae and names:
No. Formula Name
----------------------------------------
1 C carbon
2 H2O water
Here are your reactions:
----------------------------------------
No reactions given
Enter the number of streams: 2
The variables for your compounds have now been created,
you may continue, or come back later and reload the same data.

Here is a list of all the variables that were
set with start301 from using
who:

You may find several blanks or NaNs in several variables. This
occurs because there are many compounds which don't have an entry for
every variable.
Here is a brief description of the data stored in each variable:

The array ne is set with the proper size to store data
from simulations in them, but it simply has zeros in all its
elements. Note that the Aabc array has a row of NaNs in it.
Many of the arrays you set will contain these numbers. They are
inserted for all data that is missing in the data files for one or
more compounds while others do have that data in their files.. The
NaNs may prevent your doing meaningful calculations that involve
missing data. If you try to get the vapor pressure of carbon, you
will simply have the answer: NaN. This should be an indication that
you need to gather more data for one or more compounds. Alternately,
you might have to avoid calculations for the compounds that have
missing data.

The start301 program searches a structure for data, sets
variables, calls a program to check chemical equations to be sure
they are balanced, if asked, and creates a data file for later use in
start301. The structure searched through for property data are
usually in the CENG 301 structure, but a user's custom database may
also be used. Once a start301 file is created, it may be used several
times. The user may find more recent property data than that in the
department's files. If so, editing the data file to include that new
data can be done with ease. The simplest way would be to run
start301, then change the arrays in your Matlab session so that the
new data is used.

Balancing Equations With
Start301

As previously discussed is start301's ability to check the
equations that you enter to see if they are balanced. If you are
confident (as we are in our examples) in your reactions you can
bypass this step as shown in several examples. If you check your
equations, regardless of whether you find them correct or not, you
are given one opportunity to change your equations and
then the program moves on. Below is an example of how to use start301
to check your equations. Keep in mind that the simplest way to input
the data requested is to cut and paste. This is done by highlighting
the area to copy and then moving the cursor to the desired place and
click the middle mouse button. This example is run using (1) New
Session, Energy & Mass Balances, and CENG 301's
database. The units for temperature was chosen to be
Kelvin.

>> start301
Copyright 1998 Rice University
All rights reserved
Welcome to CENG301's start301!!
You have three choices, Please read them carefully
Then click on the appropriate choice in the menu bar
1: Click (1) to start a new session
2: Click (2) to enter the name of a datafile from
a previous session, in the current directory
3: Click (3) to use compound names not in the CENG 301 database
WARNING...if you hit (3) no compound data will be available
Now choose from the above menu
Please wait while loading database...
Which units do you want to use for temperature?
Choose one from the menu
Input the name of your new file: test
The output file name is: test
Input the number of compounds: 5
The number of compounds is: 5
Enter the name of compound # 1: CO2
Enter the name of compound # 2: CO
Enter the name of compound # 3: H2O
Enter the name of compound # 4: O2
Enter the name of compound # 5: H2
Enter the number of reactions: 3
Enter the coefficients for each compound in the same order that
the compounds are listed. Coefficients for reactants should be
Negative, and coefficients for products should be positive
Enter the coefficients for each compound in reaction # 1
CO2 CO H2O O2 H2
0 0 -2 1 2
Enter the coefficients for each compound in the same order that
the compounds are listed. Coefficients for reactants should be
Negative, and coefficients for products should be positive
Enter the coefficients for each compound in reaction # 2
CO2 CO H2O O2 H2
-1 1 0 1 0
Enter the coefficients for each compound in the same order that
the compounds are listed. Coefficients for reactants should be
Negative, and coefficients for products should be positive
Enter the coefficients for each compound in reaction # 3
CO2 CO H2O O2 H2
-1 1 -1 1 1
Do you want to check to see if the coefficients are correct?
type "y" for yes or simply press enter to move on: y
number of compounds = 5
number of reactions = 3
Here are your formulae...
CO2
CO
H2O <-- Highlight these and copy them below
O2
H2
Give the number of compounds and number of reactions
5, 3
Give the formulae for each of the compounds
CO2CO
H2O<-- Enter these by the copy method
O2
H2
Give the stoichiometric coefficients for reaction # 1
0 0 -2 1 2 <-- Enter these by the copy method
0. 0. -2.00000 1.00000 2.00000
the equation is balanced
Give the stoichiometric coefficients for reaction # 2
-1 1 0 1 0 <-- Enter these by the copy method
-1.00000 1.00000 0. 1.00000 0.
WARNING ! The element O
is not balanced in that equation.
Give the stoichiometric coefficients for reaction # 3
-1 1 -1 1 1 <-- Enter these by the copy method
-1.00000 1.00000 -1.00000 1.00000 1.00000
the equation is balanced
Your reactions are currently as follows:
1) 2H2O --> O2 + 2H2
2) CO2 --> CO + O2
3) CO2 + H2O --> CO + O2 + H2
Type "y" to change an equation, or press "enter" to continue: y
How many equations do you want to change: 1
Enter the equation number you wish to change: 2
<-- We only need to change 1 equation and it is
equation number 2
Enter the coefficients for each compound in the same order that
the compounds are listed. Coefficients for reactants should be
Negative, and coefficients for products should be positive
Enter the coefficients for each compound in reaction # 2
CO2 CO H2O O2 H2
1 -1 0 -.5 0
<-- Correcting the Equation
Do you want to check to see if the coefficients are correct?
type "y" for yes or simply press enter to move on: y
number of compounds = 5
number of reactions = 3
Here are your formulae...
CO2
CO
H2O
O2
H2
Give the number of compounds and number of reactions
5, 1 <-- We only need to check one equation this time
Give the formulae for each of the compounds
CO2
CO
H2O <-- Enter these by the copy method
O2
H2
Give the stoichiometric coefficients for reaction # 1
1 -1 0 -.5 0 <-- Enter these by the copy method
1.00000 -1.00000 0. -0.500000 0.
the equation is balanced
<-- Note no additional opportunity to alter the reactions
Here are your compounds' formulae and names:
No. Formula Name
----------------------------------------
1 CO2 carbon dioxide
2 CO carbon monoxide
3 H2O water
4 O2 oxygen
5 H2 hydrogen
Here are your reactions:
----------------------------------------
1) 2H2O --> O2 + 2H2
2) CO + 0.5O2 --> CO2
3) CO2 + H2O --> CO + O2 + H2
Enter the number of streams: 3
The variables for your compounds have now been created,
you may continue, or come back later and reload the same data.