CHE 204: Computer Application in Chemical Engineering I (2 units)
The aim of the course is to introduce basic theory, concepts and applications of computers in Chemical
Engineering. Material to be covered will include:
i. Basics of computer hardware and software.
ii. Applications in solving Chemical Engineering problems.
iii. Practical programming with EXCEL and MATLAB to solve typical problems in thermodynamics and
material balances.
iv. Technical presentation tools.
v. Internet Communication.
COMPUTER SYSTEM
Definition: Computer system is a collection of entities (hardware, software and liveware) that are designed to
receive process, manage and present information in a meaningful format.
Components of Computer System
I. Computer hardware - Are physical parts of a computer. Example Input devices, output devices,
central processing unit and storage devices.
II. Computer software - also known as programs or applications. They are classified into two classes
namely - System software and Application software.
III. Liveware - is the computer user. Also kwon as orgware or the humanware. The user commands the
computer system to execute an instruction.
Computer Hardware
Hardware refers to the physical, tangible computer equipment and devices, which provide support for major
functions such as input, processing (internal storage, computation and control), output, secondary storage (for
data and programs), and communication.
Functional Parts of computer hardware.
There are five main hardware components in a computer system: Input, Processing, Storage, Output and
Communication devices.
Input devices: Are devices used for entering data or instructions to the central processing unit. They are
classified according to the method they use to enter data.
a) Keying devices: Are devices used to enter data into the computer using a set of Keys e.g.
Keyboard, key-to- storage and keypad.
The keyboard: Similar to a typewriter, is the main input device of a computer. It
contains three types of keys-- alphanumeric keys, special keys and function keys.
Alphanumeric keys are used to type all alphabets, numbers and special symbols like $,
%, @, A etc. Special keys such as <Shift>, <Ctrl>, <Alt>, <Home>, <Scroll Lock>
etc. are used for special functions. Function keys such as <Fl>, <F2>, <F3> etc. are
used to give special commands depending upon the software used e.g.F5 reloads a
page of an internet browser. The function of each and every key can be well
understood only after working on a PC. When any key is pressed, an electronic signal
is produced. This signal is detected by a keyboard encoder that sends a binary code
corresponding to the key pressed to the CPU. There are many types of keyboards but
101 keys keyboard is the most popular one.
The keys on your keyboard can be divided into several groups based on function:
o Typing (alphanumeric) keys. These keys include the same letter, number,
punctuation, and symbol keys found on a traditional typewriter.
o Special (Control) keys. These keys are used alone or in combination with
other keys to perform certain actions. The most frequently used control keys
are CTRL, ALT, the Windows key, and ESC.
o Function keys. The function keys are used to perform specific tasks. They are
labelled as F1, F2, F3, and so on, up to F12. The functionality of these keys
differs from program to program.
o Cursor Movement (Navigation) keys. These keys are used for moving around
in documents or WebPages and editing text. They include the arrow keys,
HOME, END, PAGE UP, PAGE DOWN, DELETE, and INSERT and
ARROW KEYS.
o Numeric keypad. The numeric keypad is handy for entering numbers quickly.
The keys are grouped together in a block like a conventional calculator or
adding machine.
1. Pointing devices:
Are devices that enter data and instructions into the computer using a pointer that appears on the
screen. The items to be entered are selected by either pointing to or clicking on them.e.g mice,
joystick, touch sensitive screen, trackballs.
i. The mouse
A mouse is a small device used to point to and select items on your computer screen.
Although mice come in many shapes, the typical mouse does look a bit like an actual mouse.
It's small, oblong, and connected to the system unit by a long wire that resembles a tail and the
connector which can either be PS/2 or USB. Some newer mice are wireless. A mouse usually
has two buttons: a primary button (usually the left button) and a secondary button. Many mice
also have a wheel between the two buttons, which allows you to scroll smoothly through
screens of information.
Assignment 1. Draw a typical mouse, label all the functional parts and briefly describe how
it’s been operated.
Most mouse actions combine pointing with pressing one of the mouse buttons. There are four
basic ways to use your mouse buttons: clicking, double-clicking, right-clicking, and
dragging.
Clicking (single-clicking):
To click an item, point to the item on the screen, and then press and release the primary button
(usually the left button).
Clicking is most often used to select (mark) an item or open a menu. This is sometimes called
single-clicking or left-clicking.
Double-clicking:
To double-click an item, point to the item on the screen, and then click twice quickly. If the
two clicks are spaced too far apart, they might be interpreted as two individual clicks rather
than as one double-click.
Double-clicking is most often used to open items on your desktop. For example, you can start
a program or open a folder by double-clicking its icon on the desktop.
Right-clicking:
To right-click an item, point to the item on the screen, and then press and release the
secondary button (usually the right button).
Right-clicking an item usually displays a list of things you can do with the item. For example,
when you right-click the Recycle Bin on your desktop, Windows displays a menu allowing
you to open it, empty it, delete it, or see its properties. If you are unsure of what to do with
something, right-click it
2. Scanning devices:
Are devices that capture an object or a document directly from the source. They are classify
according to the technology used to capture data e.g. Scanners and Document readers.
a. Scanners: Used to capture a source document and converts it into an electronic form.
Example are - FlatBed and HandHeld scanners.
b. Document readers: Are documents that read data directly from source document and
convey them as input in the form of electronic signal.
c. Optical Character Readers
Other forms of input device include
i. Digital camera
ii. Joystick
iii. Microphone
iv. Touch screen
v. Light pen
vi. Real time clock
Output devices:
Control unit
The control unit (often called a control system or central controller) manages the computer's various
components; it reads and interprets (decodes) the program instructions, transforming them into control
signals that activate other parts of the computer.[d] Control systems in advanced computers may change the
order of execution of some instructions to improve performance. A key component common to all CPUs is
the program counter, a special memory cell (a register) that keeps track of which location in memory the next
instruction is to be read from.
The control system's function is as follows— this is a simplified description, and some of these steps may be
performed concurrently or in a different order depending on the type of CPU:
Read the code for the next instruction from the cell indicated by the program counter.
Decode the numerical code for the instruction into a set of commands or signals for each of the other
systems.
Increment the program counter so it points to the next instruction.
Read whatever data the instruction requires from cells in memory (or perhaps from an input device). The
location of this required data is typically stored within the instruction code.
Provide the necessary data to an ALU or register.
If the instruction requires an ALU or specialized hardware to complete, instruct the hardware to perform the
requested operation.
Write the result from the ALU back to a memory location or to a register or perhaps an output device.
Jump back to step (1).
Since the program counter is (conceptually) just another set of memory cells, it can be changed by
calculations done in the ALU. Adding 100 to the program counter would cause the next instruction to be read
from a place 100 locations further down the program. Instructions that modify the program counter are often
known as "jumps" and allow for loops (instructions that are repeated by the computer) and often conditional
instruction execution (both examples of control flow).
THE CENTRAL PROCESSING UNIT ( C P U)
The control unit, Arithmetic logic unit (ALU), and registers are collectively known as a central processing
unit (CPU). Early CPUs were composed of many separate components. Since the 1970s, CPUs have
typically been constructed on a single MOS integrated circuit chip called a microprocessor.
Arithmetic logic unit (ALU)
The ALU is capable of performing two classes of operations: arithmetic and logic.[119] The set of arithmetic
operations that a particular ALU supports may be limited to addition and subtraction, or might include
multiplication, division, trigonometry functions such as sine, cosine, etc., and square roots. An ALU may
also compare numbers and return Boolean truth values (true or false) depending on whether one is equal to,
greater than or less than the other ("is 64 greater than 65?"). Logic operations involve Boolean logic: AND,
OR, XOR, and NOT.
Registers or Memory
The CPU contains a special set of memory cells called registers that can be read and written to much more
rapidly than the main memory area. There are typically between two and one hundred registers depending on
the type of CPU. Registers are used for the most frequently needed data items to avoid having to access main
memory every time data is needed. As data is constantly being worked on, reducing the need to access main
memory (which is often slow compared to the ALU and control units) greatly increases the computer's speed.
A computer's memory can be viewed as a list of cells into which numbers can be placed or read. Each cell
has a numbered "address" and can store a single number. The computer can be instructed to "put the number
123 into the cell numbered 1357" or to "add the number that is in cell 1357 to the number that is in cell 2468
and put the answer into cell 1595." The information stored in memory may represent practically anything.
Letters, numbers, even computer instructions can be placed into memory with equal ease. Since the CPU
does not differentiate between different types of information, it is the software's responsibility to give
significance to what the memory sees as nothing but a series of numbers.
In almost all modern computers, each memory cell is set up to store binary numbers in groups of eight bits
(called a byte). Each byte is able to represent 256 different numbers (28 = 256); either from 0 to 255 or −128
to +127. To store larger numbers, several consecutive bytes may be used (typically, two, four or eight).
When negative numbers are required, they are usually stored in two's complement notation. Other
arrangements are possible, but are usually not seen outside of specialized applications or historical contexts.
A computer can store any kind of information in memory if it can be represented numerically. Modern
computers have billions or even trillions of bytes of memory.
Computer main memory comes in two principal varieties:
Random-access memory or RAM
Read-only memory or ROM
Random-Access Memory or RAM can be read and written to anytime the CPU commands it, but ROM is
preloaded with data and software that never changes, therefore the CPU can only read from it. ROM is
typically used to store the computer's initial start-up instructions. In general, the contents of RAM are erased
when the power to the computer is turned off, but ROM retains its data indefinitely. In a PC, the ROM
contains a specialized program called the BIOS that orchestrates loading the computer's operating system
from the hard disk drive into RAM whenever the computer is turned on or reset. In embedded computers,
which frequently do not have disk drives, all of the required software may be stored in ROM. Software
stored in ROM is often called firmware, because it is notionally more like hardware than software. Flash
memory blurs the distinction between ROM and RAM, as it retains its data when turned off but is also
rewritable. It is typically much slower than conventional ROM and RAM however, so its use is restricted to
applications where high speed is unnecessary.
APPLICATIONS IN SOLVING CHEMICAL ENGINEERING PROBLEMS.
The different packages can be applied to solve typical problems in operation involving mass and energy
balance, fluid mechanics, heat and mass transfer, unit operations, reactor engineering, and process
and equipment design and control.
Chemical process modeling is a computer modeling technique used in chemical engineering process
design. It typically involves using purpose-built software to define a system of interconnected
components,[1] which are then solved so that the steady-state or dynamic behavior of the system can
be predicted. The system components and connections are represented as a process flow diagram.
Simulations can be as simple as the mixing of two substances in a tank, or as complex as an entire
alumina refinery.
A simulation is an imitative representation of a process or system that could exist in the real world.
Chemical process modeling requires a knowledge of the properties of the chemicals involved in the
simulation,[1] as well as the physical properties and characteristics of the components of the system, such as
tanks, pumps, pipes, pressure vessels, and so on.
Chemical engineering software packages can be categorize as follows
A. Software for Mathematical Modeling:
I. MS Excel. Microsoft Office Excel is a spreadsheet application that features calculation,
graphing tools, tables, and a macro programming language - Visual Basic. The main
advantage of Excel is that it is available and is widely used in industry and academia. Thus, it
is a perfect tool or interface not only to perform calculations but also to connect different
software so that the end user can interact with Excel, and behind the scenes, other software
such as CHEMCAD, MATLAB etc. is running and reporting the results back to Excel.
It is best used for:
Built-In functions & formulas – there are a large number of built-in functions defined,
such as statistics (MEAN, AVERAGE, t-test), algebraic (SUM, ROUND, LOG,
LOG10), logical (IF, FALSE, etc.), reference, database, and information. Those are
easy to use in different kinds of formulas.
Operations with columns and rows – it is easy to find & sort data and use them in
replicated formulas etc.
Plotting – there is a large number of options depending on the needs
Solver - It is the tool to use within Excel to solve numerically a set of equations,
problem optimization including fitting a set of data to a given linear and nonlinear
equation and more. Solver is an add-in that needs to be activated to be used.
Building functions in Visual Basic for Applications - Excel has built-in capability to
generate customized functions using Visual Basic for Applications (VBA). This is a
powerful tool that can save time for you without becoming an expert in programming
as it opens the possibilities to run loops and conditionals on the background. This
capability also allows the user to build relatively large equations that are used in
several areas of the worksheet (e.g., polynomials for the esti¬mation of specific heat of
components) and allows the user to read the calculations easily when looking at the
formulas in the cells.
Link Excel with other software - Excel has become a standard package so that a
number of other specialized software use it as a source of information to report data
since it is more user-friendly. Therefore, we can use the information in Excel to be
loaded in MATLAB, Hysys or CHEMCAD or transferred back to Excel.
II. MATLAB
MATLAB is a programming language. Its operation is based on the use of .m files that can be
divided in two classes, scripts and functions. A script is basically a number of operations that
we want to perform in a certain sequence. Functions are a particular type of scripts that must
begin with the word “function” at the top of them. Functions can be user-defined or typical
operations such as equation solving or differential equations. Within MATLAB, we have all
the algebraic, statistical functions predefined along with plotting capabilities.
MATLAB has a number of functions that allow solving linear and nonlinear equations (fzero:
for one variable alone, fsolve), optimizing a function (fmincon: constrained optimization,
linprog: linear programming; fminin or fminsearch: unconstrained optimization; bintprog:
binary and integer optimization), and solving differential equations (ode__) or partial
differential equations (pdepe).
Some examples of how MATLAB can be used in chemical engineering include:
o Momentum, Mass, and Energy Transfer - There are a number of examples in the
transport phenomena field that, even though represent different phenomena, they can
be mathematically described using a partial differential equation, the “pdepe” toolbox.
o Distillation Column Operation – McCabe Method - typical shortcut approach for the
initial conceptual estimation of the operation of binary distillation columns
o Modeling of different kinds of process equipment – heat exchangers, pumps,
valves, evaporators, columns, reactors etc.
o Reactor design - The models are based on explicit algebraic equations and differential
equations. Thus, we use ODEXX function in MATLAB to solve the concentration,
temperature, and/or pressure profiles along the operation of such equipment.
o Control loops analysis, control design and tuning.
III. Simulink
Simulink® (Simulation and Link ) is a software add-on to MATLAB based on the concept of
block diagrams that are common in the control engineering areas. It is an environment for
dynamic simulation and process control. Each of the blocks can contain a subsystem inside,
which is helpful for big problems. We only need to select a number of blocks and with the
right button of the mouse, click and select create subsystem.
Simulink is easier to used for engineers because it does not require any programming skills,
therefore models can be build using blocks instead of defining functions.
Process Simulators
The simulation, design, and optimization of a chemical process plant, which comprises
several processing units interconnected by process streams, are the core activities in process
engineering. These tasks require performing material and energy balancing, equipment sizing,
and costing calculation. A computer package that can accomplish these duties is known as a
computer-aided process design package or simply a process simulator.
Chemstations CHEMCAD
CHEMCAD is Chemstations’ software suite for process simulation. Features include process
development, equipment design, equipment sizing, thermophysical property calculations,
dynamic simulations, process intensification studies, energy efficiency/optimization, data
reconciliation, process economics, troubleshooting/process improvement, Microsoft Visual
Basic etc.
The CHEMCAD suite includes six products that can be purchased individually or bundled as
needed for specific industries, projects, and processes.
CC - steady state simulations of continuous chemical processes, features libraries of chemical
components, thermodynamic methods, and unit operations, enabling you to simulate processes
from lab scale to full scale. Ideal for Users who want to design processes, or rate existing
processes, in steady state.
CC – dynamics is used to conduct dynamic flowsheet analysis, operability check-out, PID
loop tuning, operator training, online process control and soft sensor functionality. Ideal for
users who want to design or rate dynamic processes.
CC-THERM is used for sizing heat exchangers, covers shell-and-tube, plate-and-frame, air-
cooled, and double-pipe exchangers. Rigorous designs are based on physical property and
phase equilibria data.
CC-BATCH allows you to design or rate a batch distillation column.
CC-SAFETY NET - used for analysis of any pipe network with the piping and safety relief
network simulation software.
CC – FLASH – Used to calculate physical properties and phase equilibria (VLE, LLE, VLLE)
for pure components and mixtures with incredible accuracy. All products within the
CHEMCAD suite feature CC-FLASH capabilities.
ASPEN HYSYS & ASPEN PLUS
Two similar software packages with all the functionalities that process simulator should have
are also the most widespread among chemical engineers. AspenTech has a wide portfolio of
modeling tools, among them most important and most known are process simulation tools
Aspen Hysys and Aspen Plus.
Aspen HYSYS (or simply HYSYS) is a chemical process simulator used to mathematically
model chemical processes, from unit operations to full chemical plants and refineries. HYSYS
is able to perform many of the core calculations of chemical engineering, including those
concerned with mass balance, energy balance, vapor-liquid equilibrium, heat transfer, mass
transfer, chemical kinetics, fractionation, and pressure drop. HYSYS is used extensively in
industry and academia for steady-state and dynamic simulation, process design, performance
modeling, and optimization.
Aspen Plus is a process modeling tool for conceptual design, optimization, and performance
monitoring for the chemical, polymer, specialty chemical, metals and minerals, and coal
power industries. It can also be used for mass and energy balances, physical chemistry,
thermodynamics, chemical reaction engineering, unit operations, process design and process
control.
Solving chemical engineering problems using excel application
Iteration using excel
Iteration in excel uses either Goal seek or Solver
Considering the equation of state below, if we are provided with some data
a
(P - 2 )(v – b) = RT………………………………………………………….eq 1
v
a ab
Pv – Pb - + 2 = RT……………………………………………………….eq 2
v v
P.v - Pb.v – av +ab =RT.v2…………………………………………………………eq3
3 2
P.v3 – (Pb + RT). v2 - av +ab= 0……………………………………………….eq4
For pentane gas, the following data were given
a= 18.82 b=0.1183
P=2atm T=5000K
R=0.082lit.atm/mol.k
Solution steps to solve for volume v that satisfy the equation
Write the algebraic equation in the excel
Assume a value of v = 1
Go to data from the home page
From the menu Goto ‘what if analysis’ menu
From the drop down menu click on Goal seek
It then display the goal seek interface
Select the cell contain the formula to be solve
Enter the value which the equation is reduce to
Enter the reference point value which will keep changing until the targeted value is achieved
Solving Equation Using Solver
Solver icon can also be found on the excel data menu.
If the solver is not found then the following is followed to display it on the menu
Click on the file on the top right side of the excel page
Go to excel option
Click on Add-Ins
Click on Go…
On the displayed Add-Ins menu click on solver Add-in check box
Click ok to exit
To use solver it take thesame steps with goal seek