CHAPTER FIVE SIMULATION TO ASSIST IN PROCESS CREATION 1
Feb 07, 2016
CHAPTER FIVESIMULATION TO ASSIST IN
PROCESS CREATION
1
Contents
1. Analysis of Degrees of Freedom2. Sequential Modular Flowsheeting3. Partitioning and Precedence
Ordering
2
5.1 Analysis of Degrees of Freedom
3
Objectives:
1. Identify stream variables entering and leaving a unit; identify variables that describe the unit.
2. Determine the number of independent equations for each unit.
3. Calculate the degrees of freedom or number of decision variables.
4. Specify the values of variables equal to the number of degrees of freedom.
4
Posing the Problem
To obtain a solution to a process model, we need to formulate a well-posed problem.
The degrees of freedom (DOF) are the variables in a set of independent equations which must have their values assigned.
DOF = # variables - # equations Nd = Nv - Nc
Equations include material and energy balances, unit constraints, composition constraints.
5
Important process variables
TemperaturePressureMass (mole) component flow rates concentration and total
flow ratesSpecific enthalpiesHeat flowWorkFlow ratios (e.g. recycle, feed/product, reflux)
6
Defining Stream Variables
To define the state of a stream with Nsp species:
The number of variables to describe a stream is given by:
Nv = Nsp +2
7
Constraints and balances
1. Independent material balances for each species or a total flow balance and (Nsp-1) species balances
2. Energy3. Phase equilibrium relationships that link the
compositions between phases4. Chemical equilibrium relationships5. Implicit constraints, e.g. a species concentration is zero6. Explicit constraints, e.g. a given stream fraction is
condensing8
Example - water heater
9
DOF- Water heater
10
Balance
Stream Splitter (adiabatic)
11
(Total)
Stream Splitter (adiabatic) (another sol)
12
NspSplitter Restriction =(m-1)(Nsp-1) Nsp-1
m=number of splitts
Mixer (not adiabatic)
13
Heat exchanger (not adiabatic) 1/2
14
Heat exchanger (not adiabatic) 2/2
Give example specification for a well-posed problem for Nsp = 2.
• What would change in the model if the number of components in each stream is not the same?
• Heat exchangers do have hydraulic pressure losses on the shell and tube sides. How would we incorporate this information into the model?
15
Pump
16
Flash tank (single phase streams)
17
1
3
2
3
={3( Nsp + 4
Reactions 1/2 If reactions are present, the number of variables stays the same, but
the number of material balances depends on the number of independent material balances, not species.
(Assume Isothermal and isobar conditions)
18
Reactions 2/2
19
14 25Nd = 29 - 25 = 4
Combinations of units: mixer and flash 1/2
20
34
Combinations of units: mixer and flash 2/2
21
10
+10} 2} = 2Nsp + 8-
Example: Ammonia Plant1/4
22
Flash
Example: Ammonia Plant2/4
Species: N2, H2, Ar, NH3
Specifications:Stream 1: T= 50 C, P = 100 atm, NH3 =0 (counted in mixer)Stream 2: no NH3, P=100 atmStream 3: P=100 atmStream 4: T=-50 C, P=100 atm, pure NH3 (N2, H2, Ar=0)Stream 5: T=-50 C, P=100 atm, NH3=0Stream 6: T=-50 C, P=100 atm, NH3=0Stream 7: T=-50 C, P=100 atm, NH3=0Adiabatic reactor conversion= 25%
23
Flash
Mixer
24
(stream 1,2,3)
(stream 1)
Stream 1: T= 50 C, P = 100 atm, NH3 =0 Stream 2: no NH3, P=100 atmStream 7: T=-50 C, P=100 atm, NH3=0
Flash
P1 =P2 = P7= 100 atm
(stream 7)
Reactor
25
(stream 2)
(stream 2,3)
4
Stream 2: no NH3, P=100 atmStream 3: P=100 atm
Flash
Separator
26
Stream 3: P=100 atmStream 4: T=-50 C, P=100 atm, pure NH3 (N2, H2, Ar=0)Stream 5: T=-50 C, P=100 atm, NH3=0
Nv = 3(Nsp+2) + 1 = 19Nc; Material Balance 4 Energy Balance 1 Specifications T5 = - 50 C 1 Ammonia =0 in stream 5 1 T4 = - 50 C 1 P3 = 100 atm, P4 = 100 atm P5 = 100 atm 3 Composition; N2 = 0, H2= 0, Ar=0 in(4) 3 14Nd = Nv - Nc = 19 – 15 = 5
Flash
Splitter
27
(P5=P6=P7=100)
(Stream 6)
Stream 6: T=-50 C, P=100 atm, NH3=0Stream 5: T=-50 C, P=100 atm, NH3=0Stream 6: T=-50 C, P=100 atm, NH3=0
Flash
Redundant variables and constrains
28
Total Nd = 6 + 4 + 5 + 4 = 19
Redundant variables and constrains
29
Example: Ammonia Plant4/4
Overall viewNv: 3(Nsp+2) +1 19Nc: Material balance (N, H, Ar) 3 (Atomic Species) Energy balance 1 Feed stream (stream 1) 3 (T=50 C,P =100 atm, NH3=0) Ammonia product (Stream 4) 5 (T=-50 C,P =100 atm, H2=0, Ar=0, N2=0) Purge stream (Stream 6) 3 (T=-50 C,P =100 atm, NH3 =0) Nd = 4
30
Degrees of FreedomExample-09
Splitter (adiabatic)
32
Stream 1: P=1 atm, T=30 C, Flow = 10000lb/h, xs =0.12Stream 3: F2/F1 = 0.1Stream 4: xs =0, P= 0.5 atm gauge, T= 50 CStream 5: xs =0.8
Nv = 3(Nsp+2) = 12Nc; Total Material Balance 1 composition specifications [2(Nsp -1) ] 2 Specifications T1 = T2 =T3 2 P1 = P2 =P3 2 Stream 1: P=1 atm, T=30 C, Flow = 10000lb/h, xs =0.12 4 Stream 3: F2/F1 = 0.1 1 12 Nd = Nv - Nc = 12 – 12 = 0
Flash evaporator
33
Stream 2: F2/F1 = 0.9Stream 4: xs =0, P= 0.5 atm gauge, T= 50 CStream 5: xs =0.8
Nv = 3(Nsp+2) + 1 = 13Nc; Material Balance 2 Energy Balance 1 Phase Equilibrium (water only) 1Specifications T4 = T5 1 P4 = P5 1 Stream 2: F2/F1 = 0.1 1 Stream 4: xs =0, P= 0.5 atm gauge, T= 50 C 3 Stream 5: xs =0.8 1 11 Nd = Nv - Nc = 13 – 11 = 2
Mixer (Adiabatic)
34
Stream 5: xs =0.8
Nv = 3(Nsp+2) = 12Nc; Material Balance 2 Energy Balance 1 Specifications Stream 5: xs =0.8 1 4 Nd = Nv - Nc = 12 – 4 = 8
Redundant variables and constrains
Total Nd = 0 + 2 + 8 = 10Redundant variable in intercomming streams= 3(Nsp+2) = 12Redundant constrains being eliminated = 2Stream 2: F2/F1 = 0.1Stream 5: xs =0.8Overall degrees of freedom = 10 -12+2=0
Overall
Nv = 3(Nsp+2) = 12
Nc; EQUATIONS: Material Balance 2 Energy Balance 1 The overall conversion of B in the process is 95% 1 Specifications Stream 3, C = 100 mole/h 1 Stream 1: P=1 atm, T=30 C, Flow = 10000lb/h, xs =0.12 4 Stream 4: xs =0, P= 0.5 atm gauge, T= 50 C 3 12Nd = Nv - Nc = 12 – 12 = 0
Example-09
Example-10
1- Conversion of B in reactor = 60%2- Most of the unreacted B is recovered in a flash separator and recycled to reactor3- The fresh feed to reactor consists of A and B 4- fresh A in feed being 30% in excess of the stoichiometric amount to required to react with the fresh B5- The overall conversion of B in the process is 95%6- The required production rate of C = 100 mole/h
Reactor
Nv = 3(Nsp+2) + 1(Q) + 1() = 20Nc; Material Balance 4 Energy Balance 1EQUATIONS: Conversion of B in reactor = 60% 1 Specifications Q=0 1 Stream 1, P = 1 atm, T= 25 C, A (30% excess) C =D=0(Composition) 5 Stream 4, COMP : A, C, D =0 3 15Nd = Nv - Nc = 20 – 15 = 5
Flash Separator
Nv = 3(Nsp+2) + 1(Q) = 19Nc;EQUATIONS: Material Balance 4 Energy Balance 1 The overall conversion of B in the process is 95% 1 equilibrium (B only) 1 T3 = T4 1 P3=P4 1 Specifications Q=0 1 Stream 3, C = 100 mole/h 2 Stream 4, COMP : A, C, D =0 3 15
Nd = Nv - Nc = 19 – 15 = 4
Redundant variables and constrains
Total Nd = 5 + 4= 9Redundant variable in intercomming streams= 2(Nsp+2) = 12Redundant constrains being eliminated = 3Stream 4, Composition : A, C, D =0 Overall degrees of freedom = 9 -12+3=0
Overall
Nv = 2(Nsp+2) = 12Nc;EQUATIONS: Material Balance 4 Energy Balance 1 The overall conversion of B in the process is 95% 1 Specifications Stream 3: C = 100 mole/h 1 Stream 1: P = 1 atm, T= 25 C, A (30% excess) C =D=0(Composition) 5 12 Nd = Nv - Nc = 12 – 12 = 0
Example-11
+
Nv = 3(Nsp+2) + 1 = 28Nc; Material Balance (species) 4 Energy Balance 1 Specifications Q=0 1 excess air 1 Stream 1, P = 1 atm, T= 25 C, F=100 mole/h 3 Stream 2, P = 1 atm, T= 25 C 2 Stream 3, P = 1 atm 1 composition Stream 1, 6 Stream 2, CH4, H2, CO, CO2,H2O =0 6 Stream 3, CH4, H2, CO, =0 3 Nd = Nv - Nc = 28 – 28 = 0
Example-11
5.2 Sequential Modular Flowsheeting
45
Sequential Modular Flowsheeting
Unit models are written to calculate output stream values, given input stream values and unit parameters.
46
Defining features
Need to specify all incoming streams (Stream 1)To calculate the outlet of the mixer - need to guess
the stream variable values for the recycle streams.The recycle stream values are then calculated and
checked against the values guessed for that iteration – if they agree within a tolerance, then the flowsheet is converged.
This procedure is called tearing a recycle stream.47
Tear the recycle
48
Follow the information flow
Tear stream 7, x, by guessing values for that stream – mixer unit can be calculated
Calculate the reactor, separator, purge unitsCheck the calculated stream 7, |F(x) – x| <
tolerance, then converged.If not, then use some combination of the guess (x)
and the calculated result (F(x)) to start another iteration. 49
Notation – recycle iteration
For each iteration, k, use notation xk and F(xk).We are really solving the explicit equationX=F(X)By iteration:X k+1 = F(Xk)Note that we could tear stream 7, 2, 3 or 5.Q? What criteria would you use to decide which streamshould be teared (i.e. the values guessed)?
50
Important questions:
1. How do we analyze a process flowsheet to determine whether there are recycles and which stream to tear (guess)?
2. How do we handle many recycles, which may be nested?3. How are calculated values for the recycle stream used for
subsequent iterations?4. What solution procedure should be used if not all the
inputs to the process are known, but some outputs are specified?
51
Ammonia reactor loop
Stream 1 is the process feed.Stream 4 is the desired product.
Define a stream vector Xji where j is the stream number and i is the
component. We take Xj to mean the vector of all the stream variables in stream j.
We have 4 components: i=1 H2
i=2 N2
i=3 NH3
i=4 Ar52
Write the Material balances
53
Write the Material balances
54
Degree of freedom analysis
Stream variables 7(4) = 28 (neglect T,P)Reactor 1Flash 4Purge split 1Total 34
Mixer equations 4Reactor equations 4Separator equations 8Purge split equations 8Total equations 24
10 degrees of freedom- which ones should we specify?55
Example specifications for ammonia plant
X1 = {300, 100, 0, 1.2}S = 0.012χ = 0.2K = {1, 1, 0, 1}
56
Convergence Block Schemes – Successive Substitution
Let Xk be the guess for the tear stream variables at the kth iteration.
Let F(Xk) be the calculated result for that tear stream’s values.The simplest iteration scheme is successive substitution, or
fixed point iteration. X k+1 = F(Xk)The next guess on the tear stream is the newly calculated
variable values.A more general, weighted form is: X k+1 = a F(Xk) + (1-a) Xk
Which is useful if the iterations start to oscillate, e.g. a=0.5
57
Successive substitution spreadsheet
58
Convergence Block Schemes –Wegstein acceleration1/3
59
Convergence Block Schemes –Wegstein acceleration2/3
60
Convergence Block Schemes –Wegstein acceleration3/3
61
Summary
Sequential modular models – require all inputs and unit parameters, then calculate outputs
Problems with recycles – we do not know one of the inputs
Concept of tear stream allows us to guess stream value to allow unit computation
Convergence blocks use previous and current iterations to predict next guess:
– Successive substitution – Wegstein acceleration
62
5.3 Partitioning and Precedence Ordering
63
Partitioning and Precedence Ordering
Partitioning: locate groups of units that must be solved together
Precedence ordering: solve these groups of units within a process in the proper computational order
A partition is unique, but the precedence ordering is not
Partitions may exist where the order of the solution may have groups of units calculated in serial or parallel order.
64
Consider the imaginary flowsheet
65
By inspection …. Recycle Groups
HPartition and precedence order: ABCDE FG I
Can we automate the selection?
66
Sargent and Westerberg algorithm
1. Trace from an arbitrary starting unit to the next unit, through a connecting stream, to form a string of units.
2. Continue, until:a) A unit in the string reappears. Then all the units between the
repeated unit occurrences, including the repeat unit, is a group. A group is treated as single unit.
b) A unit has no more outputs – place it at the top of a list of groups/units and delete from the problem
The list will contain the groups in the correct precedence order.
67
Example Problem 1/9
68
Example Problem 2/9
69
Example Problem 3/9
70
Example Problem 4/9
71
Example Problem 5/9
72
Example Problem 6/9
73
Example Problem 7/9
74
Example Problem 8/9
75
Example Problem 9/9
String 1: ABCDE-FG-I no output from IDelete IString 1: ABCDE-FG no output from FGString 1: ABCDE no output from ABCDEString 2: H no output from HNo units left
Precedence Order List:H
ABCDEFGI
76
Tearing
There are a number of approaches to develop better tearing strategies. However they require the analysis of the number of components and recycles.
Generally, try to minimize the number of tear streams and the number of variables in the tear streams.
77
Equation solving approaches
Model equations are written in the open form,F(x,u) = 0
Where x are the stream variables and u are the unit parameters.
All the nonlinear equations are assembled and solved simultaneously. This can create a huge nonlinear equation set: typically at least 103 to 105 equations.
The solution methodology is complicated because each equation includes relatively few variables – the variables in the unit and adjacent units. This is called a sparse set of equations.
78
Equation-based Approach1/2
Advantage is that any parameter or stream variable can be specified, if:
– The number of equations equals the number of
variables – The equations are linearly independent The problem must be nonsingular
79
Equation Based Approaches2/2
Tearing:Find the minimum number of variables that need to beguessed and iterate to find the rest of the variables andgroup the equations to solve them in the right order –e.g. a flash calculation.
Requires pre-analysis and does not generalizeLinearization:Linearize the nonlinear set of equations using Newton-Raphson - preferred method.
80
Problems with equation based strategy1/2
1. Difficult to use equations from existing sequential modular packages
2. Equation management is complex3. Large computer storage is required4. Numerical problems include obtaining derivatives
and singularity5. Need starting values6. Interface to thermodynamics packages must
provide derivative information81
Problems with equation based strategy2/2
7. Need to have backup plan in case solution fails to converge
8. Need input data verification to prevent singular problems ( structural or numerical singularity)
9. Ordering of the equations affects the equation solution time
BUT, equation based strategies remove the need forconvergence and control blocks and allow for more flexible
problem formulation Basis for all new simulators currently being developed.
82
Simple Example 1 1/2
83
Simple Example 1 2/2
84
Simple Example 2
A B C D E
FS1
• Partitioning: 3 unit groups, namely ABCD, E, and F• Procedence Ordering: ABCD, then E, then F• Actual computational sequence: Tear S1 --> C --> D --> A --> B --> Update S1 --> E --> F
85
Partitioning Algorithm 1/2
Path Tracing algorithm by Sargent and Westerberg (1964) - A simple algorithm for tracing unit outputs - Basically, one traces from one unit to the next through the unit output streams, forming a “string” of units. This tracing continues until (a) A unit in the string reappears. All units between the repeated unit, together with the repeated unit, become a group, which is collapsed together and treated as a single unit, and the tracing continues from it. (b) A unit or group of units with no more outputs is encountered. The unit or group of units is placed at the top of a list of groups and is deleted entirely from the problem.
86
Partitioning Algorithm 2/2
Algorithm:1. Select a unit/group2. Trace outputs downstream until (a) a unit or a group on the path reappears. Go to step 3. (b) a unit or a group is reached with no external outputs. Go to step 4.3. Label all units into a group. Go to step 2.4. Delete the unit or group. Record it in
a list. Go to step 2. Sequence is from bottom to top of list!
87
Example of S & W’s Partitioning Algorithm 1/4
A B C M E
IF G H D L
JK1. Start with unit AA B C M E I J K
Delete K and Delete J, since no output
ListKJ 88
Example of S & W’s Partitioning Algorithm 2/4
2. Start with unit A againA B C M E I L E
Loop => EIL is a group
A B C M E
I
D LJK
F G H
89
Example of S & W’s Partitioning Algorithm 3/4
EILD will be a group
3. A
B C M
4. Delete EILD since it has no more outputs
ListKJ
EILDMCBA
B C M EIL D EIL
5. A
Delete M
6. A B C
Delete C, B, and then A
90
Example of S & W’s Partitioning Algorithm 4/4
Delete GH, and then delete F
ListKJ
EILDMCBA
GHF
7. F G H G
F G H
Computational sequence is:F GH A B C M EILD
K J 91
Example-1
Example-2
Example-3
Example-4
Example-5
Example-6
Example-7
Example-8