Sie sind auf Seite 1von 55

# Advanced Process Modelling in gPROMS

## Page 1 2009 Process Systems Enterprise

1 Modelling and simulation of a buffer tank
1.1 Objectives
By the end of this exercise, you will know
- How to build a model from scratch
- How to write equations using the gPROMS language
- How to run a simulation
- How to obtain diagnostic information
1.2 Model description
We want to model the dynamic operation of a buffer tank.

Figure 1-1: Buffer tank
The tank has a single inlet and a single outlet. The outlet flowrate is driven by gravity. The tank
geometry and inlet flowrate will be provided as model inputs. The outlet flowrate is determined by
the model based on the level of the liquid in the tank.
1.3 Assumptions
- The operation of the tank is isothermal.
- The tank is well-stirred.
- The tank contains a single component in liquid phase.
- The cross-section area is constant along the height of the tank.

Page 2 2009 Process Systems Enterprise
1.4 Parameters
Symbol Description Units gPROMS identifier Parameter type
A Horizontal cross-section
area of the tank
m
2
area REAL
o Outlet flowrate coefficient kg/(s.m) outlet_flowrate_coefficient REAL
Liquid density kg/m
3
density REAL
Table 1-1: Model parameters
1.5 Variables
Symbol Description Units gPROMS identifier Variable type
in
F
Inlet mass flowrate kg/s inlet_mass_flowrate mass_flowrate
out
F
Outlet mass flowrate kg/s outlet_mass_flowrate mass_flowrate
M Amount of liquid mass
contained in the tank
kg mass_holdup mass
h Liquid level in the tank m height length
Table 1-2: Model variables
1.6 Equations
Mass balance:
(1.1)
in out
M
F F
t
c
=
c

Liquid level in the tank:
(1.2) M Ah =
Outlet mass flowrate:
(1.3)
out
F h o =
1.7 Parameter values
The cross-section area of the tank is 1 m
2
. The liquid density is 1000 kg/m
3
. The outlet flowrate
coefficient o is 10 kg/(s.m).
1.8 Degrees of freedom
The inlet mass flowrate into the tank is constant at 20 kg/s throughout the simulation.
1.9 Initial conditions
At the start of the operation, the liquid level in the tank is 2.1 m.
1.10 Things to do
1. Create a new project.
Go to the menu File > New. A new project called gPROMS_Project_1 appears in the project
tree area.

Page 3 2009 Process Systems Enterprise
2. Save your newly created project under a different name.
Make sure the name is highlighted in the project tree and go to the menu File > Save as...
Choose an appropriate location and name for the file, e.g. Buffer tank.gPJ.
3. Create the three variable types required for this model.
Name Lower bound Default value Upper bound Units
length 0 1 100 m
mass 0 1 1e5 kg
mass_flowrate 0 1 100 kg/s
Table 1-3 Variable types
To create a new variable type, go to the menu Entity > New entity... The New Entity dialog
box will appear. Provide the name for the new entity (e.g. length) and the type of entity (i.e.
VARIABLE TYPE). Click OK to create the variable type length. You will see a table with all
variable types created in this project so far. Using the information in Table 1-3, provide a
suitable lower and upper bound for this variable, as well as a default value and units. Repeat
this for the other variable types using the information given above.
4. Create a Buffer_tank model
To create a new model, right-click on the Models folder in the project tree and select New
entity.... In the New Entity dialog box, provide the name for the new entity (e.g.
Buffer_tank) and make sure the right type of entity is selected (MODEL). Leave the Use
template? box checked and click OK to create a new model. A new model Buffer_tank will
appear. Click on the gPROMS language tab of this new model to see the template for the
gPROMS language. The template shows you a list of sections (e.g. PARAMETER,
DISTRIBUTION_DOMAIN, UNIT, etc.) and the general syntax to be used when writing a
gPROMS model.
5. Define parameters for the Buffer_tank model
Select the gPROMS language tab of the Buffer_tank model. Complete the PARAMETER
section using the information given in Table 1-1. Start by removing the comment identifier (#)
in front of the PARAMETER keyword, and in the following lines type:

Remove the DISTRIBUTION_DOMAIN, UNIT and PORT sections from the template (we
dont need them for this model).
6. Define variables for the Buffer_tank model
In the VARIABLE section, uncomment the VARIABLE keyword by removing the # before
it. Use the information provided in Table 1-2 and the variable types you defined earlier to
define the variables needed for this model:
PARAMETER
area AS REAL
density AS REAL
outlet_flowrate_coefficient AS REAL

Page 4 2009 Process Systems Enterprise

Remove the SELECTOR, SET, BOUNDARY and TOPOLOGY sections from the template.
7. Write the equations for the Buffer_tank model.
Activate the EQUATION keyword by removing the comment identifier (#) in front of it, and
write the three equations according to section 1.6. Use control+space to get gPROMS to
suggest a list of available options as you are writing the equations. Place comments with the
Finally, clean up the model by removing the ASSIGN, PRESET, INITIALSELECTOR and
INITIAL sections from the template.
You have now created a generic model for a buffer tank. Next, you will set up a simulation using this
model. The input information specific to this simulation is provided in a process entity. (Note how
generic vs. specific information can be separated in different entities in gPROMS.)
8. Create a new process called Sim_buffer_tank
To create a new process entity, right-click on the Processes folder in the project tree and
select New entity.... In the New Entity dialog box, provide the name for the new entity (e.g.
Sim_buffer_tank) and make sure the right type of entity is selected (PROCESS). Leave the
Use template? box checked and click OK to create a new process. A new process will appear.
Click on the gPROMS language tab of this new process to see the template for the gPROMS
language.
9. Tell the simulation which model to use
The UNIT section defines which model (or models) will be used in the simulation. In this
case we want to perform a simulation with a single instance of the Buffer_tank model. We
will refer to this instance with the identifier T101. Remove the PARAMETER section from
the process template (we dont need it) and complete the UNIT section by typing the
following in the process:

10. Set parameter values
Provide values for each of the model parameters according to section 1.7 by completing the
SET section of the process (you can remove the MONITOR section). Use the WITHIN
construct to refer to parameters inside unit T101.
UNIT
T101 AS Buffer_tank
VARIABLE
inlet_mass_flowrate AS mass_flowrate
outlet_mass_flowrate AS mass_flowrate
mass_holdup AS mass
height AS length

Page 5 2009 Process Systems Enterprise

Remove the EQUATION section from the process template (we are not using it).
11. Assign degrees of freedom
Assign a value to the inlet flowrate according to section 1.8.

Remove the PRESET and INITIALSELECTOR sections from the template.
12. Provide initial conditions
Define the initial state of the model by providing the initial liquid level in the tank according
to section 1.9. In the INITIAL section, write:

Remove the SOLUTIONPARAMETERS section from the process template for now.
13. Define the duration of the simulation.
The SCHEDULE section defines what to do during a simulation. In this case we want to
simulate for 1800 seconds. Write the following to implement this:

This will make the simulation continue for 1800 time units.
You have now completely defined the problem setup and are ready to execute a simulation.
14. Execute the simulation
Select the process you just created (Sim_buffer_tank) in the project tree. In the toolbar, click
the simulate button ( ). The Simulate dialog box will appear. Accept the default settings
and run the simulation by clicking OK. The execution output appears and gRMS is started.
Also, note that a new case is being created this is the blue folder in the project tree. By
default, the name of the case is a concatenation of the process name (i.e. Sim_buffer_tank)
plus a date and time stamp.
SCHEDULE
CONTINUE FOR 1800
INITIAL
T101.height = 2.1 ; # m
ASSIGN
T101.inlet_mass_flowrate := 20 ; # kg/s
SET
WITHIN T101 DO
area := 1 ; # m2
outlet_flowrate_coefficient := 10 ; # kg/(s.SQRT(m))
density := 1000 ; # kg/m3
END # WITHIN T101

Page 6 2009 Process Systems Enterprise
15. Plot the results using gRMS
In gRMS (gPROMS Results Management System), create a new two-dimensional plot by
clicking on the 2D button ( ). An empty plot window will appear. Next, add a line to the plot
by clicking the Add line button ( ). In the Add line dialog, expand the variable tree by
clicking on the plus signs ( ) and double-click on the variable height. In the line properties
dialog, click OK to add the line to the plot area. Close the Add line dialog by clicking Cancel.
Explore the formatting options available in gRMS through the Format and Line menus.
Now that you have performed a simulation, it is time to explore some of the diagnostics tools
available.
16. Modify a copy of the Sim_buffer_tank process and compare the two
To do so, copy-paste the Sim_buffer_tank process. Open the copy named Sim_buffer_tank_1
and change the inlet flowrate to 25 kg/s, then run a simulation with the new process. When
the simulation has completed, select both Sim_buffer_tank and Sim_buffer_tank_1 in the
project tree (keep the control key pressed to select multiple entities) and compare the two
entities by going to the menu Tools > Compare. You will see a window with a side-by-side
comparison of the two entities, highlighting the differences.
17. Retain the license after execution of the Sim_buffer_tank_1 process to view additional
diagnostic information.
To do so, run another simulation with the Sim_buffer_tank_1 process, but this time un-tick
the option Release license after execution in the Simulate activity dialog. This will enable a
range of diagnostic tools. After the simulation has completed,
a. Right-click in the Execution Output window and select Create problem report....
Select OK to accept the default options for a problem report. Inspect the equation
scaling information in the problem report.
b. Right-click in the Execution Output window and select Query equation.... Select
equation number 1 (this is the mass balance as you can see from the problem
report), then OK. gPROMS will report the equation in symbolic form as well as the
values of the variables it contains, as well as the blocks in which the variables were
determined.
18. Explore the structure of the case file created after each simulation. Plot the liquid level in
the tank from the variable trajectories in the case.
19. Create a new project based on the case file. To do so, right-click on the case name in the
project tree and Click Create gPROMS project. (This enables you to use a previous simulation
as a starting point for future work.)

Page 7 2009 Process Systems Enterprise
2 Modelling and simulation of a Continuous Stirred Tank Reactor
2.1 Objectives
By the end of of this exercise, you will know
- How to declare array variables using enumerated domains
- How to write equations using arrays
- How to model discontinuities
2.2 Model description
We want to simulate the first three days of the dynamic operation of a Continuous Stirred Tank
Reactor (CSTR).

Figure 2-1: CSTR
The tank has a single inlet and a single outlet. The inlet consists of methanol (MeOH) and acetic acid
(HAc). These components will take part in an uncatalysed reaction in the CSTR to form methyl
acetate (MeAc) and water (H
2
O):
2
MeOH HAc MeAc H O + +

Or, in different notation,
3 3 3 3 2
CH OH CH COOH CH COOCH H O + +
The forward reaction is an esterification reaction, the reverse reaction is called a hydrolysis reaction
as water is used to split methyl acetate. Reaction rates are a function of reactant concentration and
temperature.
The outlet pipe is located at a height
p
h from the bottom of the vessel, and as a result the outlet
flowrate exists only if the liquid level exceeds
p
h .

2.3 Assumptions
- All components are in liquid phase.

Page 8 2009 Process Systems Enterprise
- The reactor is well-stirred.
- The operation of the reactor is isothermal.
- The cross-section area is constant along the height of the reactor.
2.4 Parameters
Symbol Description Units gPROMS identifier Parameter
type
COMP list of component names - component_list ORDERED_SET
REAC

list of reaction names - reaction_list ORDERED_SET
A

reactor cross section area m
2
cross_section_area REAL
p
h

overflow pipe height m pipe_height REAL
o

outlet valve constant kmol/(m.s) valve_constant REAL
i

## density of component i kmol/m

3
component_density REAL
ij
a

order of component i in
reaction j
- reaction_order REAL
ij
v

stoichiometry of component
i in reaction j
- reaction_stoichiometry INTEGER
0 j
k

pre-exponential factor in
reaction j rate expression
s
-1
reaction_pre_exponential_
factor
REAL
Aj
E

activation energy for
reaction j
kJ/kmol reaction_activation_energy REAL
R

ideal gas constant kJ/(kmol.K) ideal_gas_constant REAL
Table 2-1: Model parameters
2.5 Variables
Symbol Description Units gPROMS identifier Variable type
in
F
inlet molar flowrate kmol/s inlet_molar_flowrate molar_flowrate
, in i
x

inlet molar fraction
of component i
kmol/kmol inlet_molar_fraction molar_fraction
out
F

outlet molar
flowrate
kmol/s outlet_molar_flowrate molar_flowrate
i
x

molar fraction of
component i
kmol/kmol molar_fraction molar_fraction
V

total liquid volume m
3
total_volume volume
h

liquid level m level length
i
C

concentration of
component i
kmol/m
3
molar_concentration molar_concentration
p

pressure Pa pressure pressure
T

temperature K temperature temperature
i
N

holdup (i.e. the
amount of moles) of
component i
kmol holdup_moles moles
T
N

total holdup kmol total_holdup_moles moles
j
r

reaction j rate s
-1
molar_reaction_rate reaction_rate
Table 2-2: Model variables
2.6 Equations
Molar balance:

Page 9 2009 Process Systems Enterprise
(1.1)
,
,
i
in in i out i T ij j
j REAC
N
F x F x N r i COMP
t
v
e
c
= + e
c

Reaction rates:
(1.2)
0
,
Aj
ij
E
a
RT
j j i
i COMP
r k e x j REAC

e
= e
[

Total holdup:
(1.3)
T i
i COMP
N N
e
=

Total volume:
(1.4)
i
i COMP
i
N
V

e
=

Molar fractions:
(1.5) ,
i i T
N x N i COMP = e

Molar concentrations:
(1.6) ,
i i
N CV i COMP = e

Liquid level:
(1.7) V Ah =

Outlet flowrate:
(1.8)
( )
if
0 if
p p
out
p
h h h h
F
h h
o

>

=

s

2.7 Parameter values
The components considered are MeOH, HAc, MeAc and H
2
O. The reactions are referred to by their
names: esterification and hydrolysis. The reaction stoichiometry and order are given in Table 2-3:
Esterification Hydrolysis
Stoichiometry(MeOH) -1 +1
Stoichiometry(HAc) -1 +1
Stoichiometry(MeAc) +1 -1
Stoichiometry(H
2
O) +1 -1
Order(MeOH) 1 0
Order(HAc) 1 0
Order(MeAc) 0 1
Order(H
2
O) 0 1
pre-exponential factor [s
-1
] 2.54e6 1.02e7
Activation energy [kJ/kmol] 62500 77300
Table 2-3: Reaction data

Page 10 2009 Process Systems Enterprise
The cross-section area of the tank is 5 m
2
.The overflow pipe is located at 5 m above the reactor
bottom. The outlet valve coefficient o is 0.01 kmol/(m.s). The component densities are given in Table
2-4.
Component Density
[kmol/m
3
]
MeOH 24.1117
HAc 17.0950
MeAc 12.2603
H
2
O 55.0762
Table 2-4: Component densities
2.8 Degrees of freedom
The inlet molar flowrate into the tank is constant at 0.01 kmol/s throughout the simulation. The inlet
consists of 50% methanol and 50% acetic acid. The pressure and temperature are kept constant at
101325 Pa and 313.25 K.
2.9 Initial conditions
At the start of the simulation, the liquid level in the tank is 2 m.
There is half as much methanol as there is acetic acid: 0.5
MeOH HAc
N N =
There is no methyl acetate nor water present:
2
0
MeAc H O
N N = = .
2.10 Things to do
1. Open the gPROMS project file called Exercise 2 - CSTR template.gPJ and save it under a
different name.
2. Familiarise yourself with the contents of the project.
3. Open the model liquid_phase_CSTR. Complete the VARIABLE section by providing the
correct dimensions and variable type for each variable. For example,

Use the information provided in Table 1-2 and the ORDERED_SETs component_list and
reaction_list to complete this task. Remember that pressing control+space will bring up the
autocomplete functionality.
4. Complete the EQUATION section using the information provided in section 1.6.
You have now finished writing a generic CSTR model using array variables. The model also contains a
discontinuus equation for the outlet flowrate. You will now complete the specifications in the
process.
5. Open the process Simulate_CSTR.
6. Complete the parameter settings using the information provided in section 1.7.
VARIABLE
molar_fraction AS ARRAY ( component_list ) OF molar_fraction

Page 11 2009 Process Systems Enterprise
7. Complete the degrees-of-freedom specifications in the ASSIGN section using the information
provided in section 1.8.
8. Complete the INITIAL section using the information provided in section 1.9. (Hint: you need
to provide as many initial conditions as there are differential variables!)
You have now provided all necessary specifications for this problem.
10. Run the simulation by selecting the process and pressing F5.
11. Using the results in the case file, plot the trajectory for molar_concentration.

Page 12 2009 Process Systems Enterprise
3 Hierarchical decomposition of a Continuus Stirred Tank Reactor model
3.1 Objectives
By the end of of this exercise, the student will be able to
- Identify a self-contained and reusable set of equations
- Declare a submodel and access its variables
- Understand how to connect variables in hierarchical models
3.2 Model description
The model is the same as in the previous hands-on session.

Figure 3-1: CSTR
The Arrhenius equation for the reaction rate has been identified as a reusable component, and we
would like to isolate it from the rest of the model for potential re-use.
3.3 Things to do
1. If you have completed the previous exercise, use the resulting gPROMS project and save it
under a different name. Otherwise, open the gPROMS project file called Exercise 3 - CSTR
template.gPJ and save it under a different name.
2. Create a new model called reaction_kinetics in your working project. Open the new model
on the gPROMS language tab.
3. Copy and paste the reaction-related parameters from the liquid_phase_CSTR model into the
reaction_kinetics model. The parameters you should copy are:

PARAMETER
component_list AS ...
reaction_list AS ...
reaction_order AS ARRAY ( component_list ,
reaction_pre_exponential_factor AS ARRAY ( ...
reaction_activation_energy AS ARRAY ( ...
ideal_gas_constant AS ...

Page 13 2009 Process Systems Enterprise
4. Copy and paste the variables used in the reaction rate expression from the
liquid_phase_CSTR model into the reaction_kinetics model. The variables you should copy
are:

5. Cut and paste the reaction rate expression from the liquid_phase_CSTR model into the
reaction_kinetics model.
6. In the liquid_phase_CSTR model, create an instance of the reaction_kinetics model in the
UNIT section (the UNIT section should appear in between the PARAMETER and VARIABLE
section):

This line will make available to the liquid_phase_CSTR model one instance of the generic
model reaction_kinetics and this instance is named kinetics. In doing so, we have also
introduced the parameters and variables declared in the reaction_kinetics model. The
parameters will obtain their values implicitly through top-down propagation. The variables
need to be accounted for by adding additional connectivity equations to the
liquid_phase_CSTR model.
7. Add the necessary equations to connect the reaction_kinetics model variables to the
liquid_phase_CSTR model variables. In the liquid_phase_CSTR model, add the following
equations:

8. Run the simulation by selecting the process and pressing F5.
9. In the case file that is generated, fully expand the variable trajectories and observe the
model hierarchy.
10. Compare the results for molar_concentration with the result of the previous exercise (they
should be the same).
EQUATION
kinetics.temperature = temperature ;
kinetics.molar_fraction() = molar_fraction() ;
kinetics.molar_reaction_rate() = molar_reaction_rate() ;
PARAMETER
...

UNIT
kinetics AS reaction_kinetics

VARIABLE
...
VARIABLE
molar_fraction AS ARRAY ( component_list ...
temperature AS ...
molar_reaction_rate AS ARRAY ( ...

Page 14 2009 Process Systems Enterprise
The remainder of this exercise is optional.
11. Remove the variable declaration for molar_reation_rate from the liquid_phase_CSTR model
altogether. Where this variable is used in equations (the molar balance), replace it by
referring directly to kinetics.molar_reaction_rate. You can now also remove the third
connectivity equation.
12. Run the simulation again and check the results.

Page 15 2009 Process Systems Enterprise
4 Using the IPPFO foreign object to calculate the physical properties of an
4.1 Problem description
In this hands-on session the aim is to use the Ideal Physical Property Foreign Object (IPPFO) to
calculate the physical properties involved in a liquid-phase CSTR model. The physical properties
required in that particular model are
- the volume of the reactive mixture (V) which is calculated through the pure component
densities as:
1 =
=

NoComp
i
i
i
M
V
- the specific enthalpy of the mixture at the inlet (h
t
in
) and outlet (h
t
out
) of the reactor which is
calculated using the following correlation twice:
= + + =
2 2 3
3
1000 1 2 ( ) ( ) 2000 4 , 1...
2
i
i i i i ref ref
A
h R A A T T T T R A T i NoComp
=

NoComp
t i i
i
h X h
Do all the necessary changes in the liquid-phase CSTR model, in order to calculate the above physical
properties through the IPPFO methods described in table 1. An IPPFO database file is provided to
you, which contains all necessary pure component data required.

Table 1
Method name Definition Inputs
LiquidVolume Liquid volume T,P,n
i
LiquidEnthalpy Liquid enthalpy T,P,n
i

NumberofComponents Number of
components
--

Note that the third argument
i
n is the amount of mass under consideration. It therefore depends on
the form of the model equations if mass fractions or mass amounts are to be provided as arguments:
- If the method should return a property concerning the total amount of mass (e.g. the total
volume of the liquid in the reactor), then mass amounts need to be provided as arguments
- If the method should return a property per unit mass (e.g. the mass specific enthalpy), then
mass fractions need to be provided as arguments

Page 16 2009 Process Systems Enterprise
4.2 Process schematic

4.3 Key modelling assumptions

- As in the previous hands on session
- The reaction is taking place at atmospheric pressure

4.4 Mathematical model

4.4.1 Parameters
Symbol Definition
gPROMS code Units
NoComp
Number of components no_components
NoReac Number of reactions no_reactions
o
Outlet stream valve
position constant
valve_constant
A
Reactor cross sectional
area
cross_section_area m
2
h
p
Outlet pipe height pipe_height M
a
ij
Order of component i in
reaction j
reaction_order
v
ij
Component i
stoichiometric
coefficient in reaction j
reaction_stoichiometry
k
j,0
Arrhenius constant for reaction_pre_exponential_fac

V, h
t

T, P, n
i

Page 17 2009 Process Systems Enterprise
reaction j tor
E
A,j
Arrhenius activation
energy for reaction j
reaction_activation_energy J mol
-1

H
j
Enthalpy of reaction j reaction_enthalpy J kmol
-1
P
atm
Atmospheric pressure Patm 101325 Pa
R Ideal gas constant ideal_gas_constant
8.314 J mol
-1
K
-
1
i

Component liquid
density
Density Kmol m
-3
T
ref
Reference temperature Tref 298.15 K
A1
1
A2
i

A3
i
A4
i
Coefficients used for the
component specific
enthalpy calculation
A1
A2
A3
A4

4.4.2 Variables
Symbol Definition
gPROMS code Units
V Liquid volume inside reactor Volume m
3
H Liquid level inside reactor Height m
F
in
Inlet stream molar flowrate in_molar_flowrate kmol s
-1
X
in,i

Inlet stream molar fraction of
component i
in_molar_fraction
T
in
Inlet stream temperature in_temperature K
h
t
in
Inlet stream specific enthalpy in_molar_specific_enthalpy J kmol
-1
F
out
Outlet stream molar flowrate out_molar_flowrate kmol s
-1

X
i
Component i molar fraction molar_fraction
C
i
Component i molar
concentration
molar_conc kmol m
-3
T
Temperature Temperature K
h
t
out
Outlet stream specific
out_molar_specific_enthalpy J kmol
-1

Page 18 2009 Process Systems Enterprise
enthalpy
Q
Heat output energy_rate J s
-1
M
i
Component i molar holdup holdUp_moles kmol
M
T
Total molar holdup total_holdup_moles kmol
H
total
Total energy holdup holdup_energy J
r
j
Molar reaction rate of
reaction j
molar_reaction_rate
kmol m
-3
s
-
1

in
i
h
Inlet stream component
specific enthalpy
in_component_specific_enthalp
y
J kmol
-1

out
i
h
Outlet stream component
specific enthalpy
out_component_specific_enthal
py
J kmol
-1

4.4.3 Equations
- Component material balance
1
1
NoReac
i
out in in,i i ij j
j
dM
F X F X V r , i ...NoComp
dt
=
= + v =

- Reaction rate
0
1
1

=
= =
[
ij Aj
NoComp
a E / RT
j j,
i
i
r k e C , j .....NoReac
- Total holdup
1 =
=

NoComp
T i
i
M M
- Total volume
1 =
=

NoComp
i
i
i
M
V

- Component concentrations & molar fractions
1
1
i
i
i
i
T
M
C , i ....NoComp
V
M
X , i .....NoComp
M
= =
= =

- Calculation of liquid level in the tank
V Ah =

- Characterisation of the outlet stream flowrate

Page 19 2009 Process Systems Enterprise
0
p p
out
(h h ), if h h
F
, otherwise
o >
=

- Energy balance

=
= + A +

Re
1
( )
No ac
in out total
t out t in j j
j
dH
F h F h V H r Q
dt

- Energy holdup

=
out total
t
T
H
h
M

- Component specific molar enthalpy at the inlet stream

= + + =
2 2 3
3
1000 1 2 ( ) ( ) 2000 4 , 1...
2
in i
i i i in in i in ref ref
A
h R A A T T T T R A T i NoComp

- Specific molar enthalpy at the inlet stream

=
,
NoComp
in in
t in i i
i
h X h
- Component specific molar enthalpy inside the reactor and at the outlet stream

= + + =
2 2 3
3
1000 1 2 ( ) ( ) 2000 4 , 1...
2
out i
i i i i ref ref
A
h R A A T T T T R A T i NoComp

- Specific molar enthalpy inside the reactor and at the outlet stream

=

NoComp
out out
t i i
i
h X h
4.5 Things to do

1) Open the template project file F3_cstr_template.gPJ in gPROMS and save it under a new name.

2) Import the IPPFO database file (ReactorProps.ipp) that defines the four components involved in the
process and the data required for the physical property calculations. To do so, go to the Tools menu
and choose Import files Browse the ReactorProps.ipp configuration file and import it. It will appear
in the Miscellaneous Files entity of your project tree.

Page 20 2009 Process Systems Enterprise
3) Observe the structure of the database file. In the first column appear the names of the four
components while 8 lines are dedicated for each component. The data required for the calculation of
the enthalpy appear in the second and third lines while the data required for the calculation of the
volume appear in the sixth line.

4) Notice how the MODEL entity of the project is modified compared to the equations in section 4.4.3 to
introduce physical property calculations through IPPFO.
a) A new PARAMETER of type FOREIGN_OBJECT for the physical property calculations: phys_prop
AS FOREIGN_OBJECT
b) All PARAMETERs that are no longer required e.g.: density, Tref, A1 are commented out
c) All VARIABLES that are no longer required e.g.: in_component_specific_enthalpy and
out_component_specific_enthalpy are commented out
d) In the EQUATION section all existing physical property calculations are commented out.
Complete the missing information:
e) Define all required physical property calculations using foreign object methods calls. Use the
appropriate path for each call (e.g. phys_prop.LiquidVolume). Choose the appropriate inputs for
each call.

5) Modify the PROCESS entity of your project to:
a) SET the appropriate value to your FOREIGN OBJECT. Define the name of the IPPFO database file.
Define the component names (as they appear in the database file)
b) notice in the SET section the value of no_components is now obtained automatically through the
foreign object method NumberofComponents
c) notice the commented out SETings of all PARAMETERs that have been commented out in the
MODEL entity

6) Execute a simulation in gPROMS and compare the results with ones obtained in previous hands on
session.

Page 21 2009 Process Systems Enterprise
Distributed systems in gPROMS
Hands-on Session DS1
Modelling and simulation of a catalytic tubular reactor

Problem description
We want to simulate 5 seconds operation of a catalytic tubular reactor system in which a gas
phase reaction takes place.

Process schematic

Process description
The oxidation of o-xylene to phthalic anhydride is carried out in an externally-cooled tubular
reactor system. The reaction takes place in the gas phase of the reactor which is packed with
catalyst particles. A eutectic mixture of molten potassium nitrate and potassium nitrite is
used as a coolant.

Key modelling assumptions
- The tubular reactor behaviour is adequately described by a pseudo-homogeneous, two-
dimensional mathematical model.
- The heat of reaction goes into the bulk fluid phase rather than into heating up the catalyst
particles.
- The temperature in the cooling jacket is approximately uniform.
- The resistance to heat transfer occurs primarily between the reactor contents and the wall of
the tube, the latter being effectively at the cooling medium temperature.
- Physical properties are constant over the range of conditions in the system.

Page 22 2009 Process Systems Enterprise
- The ideal gas law holds in the gas phase.
- The reaction takes place in a dilute gas mixture with an inert carrier; the model considers the
two reacting components only, denoted as A and B.

Mathematical model

Tubular reactor model
Parameters
Symbol Definition gPROMS code Unit
L Reactor length reactor_length m

b
Bed density bulk_density kg m
-3

f
Fluid density fluid_density kg m
-3

C
pf
Fluid specific heat
capacity
specific_heat_capacity J kg
-1
K
-1

D
z
Axial diffusivity axial_diffus m
2
s
-1

D
r
k
z
Axial thermal
conductivity
axial_therm_condact
k
r
conductivity
-1
K
-1

c Bed voidage fraction void -
AH Reaction enthalpy reaction_enthalpy J mol
-1

A Pre-exponential
Arrhenius constant
arrhenius_constant mol kg
-1
s
-1
Pa
-
2

E Activation energy activation_energy J mol
-1

U Heat transfer coefficient heat_transfer_coeff W m
-2
K
-1

R
g
Ideal gas constant ideal_gas_constant J mol
-1
K
-1

Page 23 2009 Process Systems Enterprise
Variables
Symbol Definition gPROMS code Unit
C
i
(z,r) Concentration of component i molar_conc(z,r) mol m
-3

T(z,r) Reactor temperature temperature(z,r) K
P
rxn
(z,r) Reaction rate molar_reaction_rate(z,r) mol kg
-1
s
-
1

P
i
feed
Feed partial pressure of
component i
in_partial_pressure Pa
T
feed
Feed temperature in_temperature K
u Superficial gas velocity velocity m s
-1

T
w
Wall temperature wall_temperature K
Equations
Component mass balance
2 2
2 2
1
0 0
i i i i i
z r rxn b
C C C C C
u D D
t z z r r r
z ( ,L), r ( ,R), i A,B
| | c c c c c
= + c + c +
|
c c c c c
\ .
e e =
R

Energy balance
2 2
2 2
1
0 0
z r rxn b f pf f pf
T T T T T
C C u k k ( H)
t z z r r r
z ( ,L), r ( ,R)
| | c c c c c
= + + + + A
|
c c c c c
\ .
e e
R

Reaction rate
2
0 0
g
E
R T
rxn g A B
e (R T) C C , z [ ,L], r [ ,R]

= e e A R
Boundary Conditions
Reactor entrance (z = 0)

( )
0
0
feed
i i
z i feed
g
feed
z f pf
C P
D u C , r [ ,R] , i A,B
z R T
T
k C u T T , r [ ,R]
z
| |
c
c = e = |
|
c
\ .
c
= e
c

Reactor exit (z = L)

Page 24 2009 Process Systems Enterprise
0 0
0 0
i
C
, r [ ,R] , i A,B
z
T
, r [ ,R]
z
c
= e =
c
c
= e
c

Reactor centre (r = 0)

0 0
0 0
i
C
, z ( ,L), i A,B
r
T
, z ( ,L)
r
c
= e =
c
c
= e
c

Reactor perimeter (r = R)

( )
0 0
0
i
r w
C
, z ( ,L), i A,B
r
T
k U T T , z ( ,L)
r
c
= e =
c
c
= e
c

Cooling jacket model
Parameters
Symbol Definition gPROMS
code
Unit

c
Coolant density density kg m
-3

C
pc
Coolant specific heat capacity heat_capacity J kg
-1
K
-1

V
c
Cooling jacket volume volume m
3

U Overall heat transfer
coefficient
U W m
-2
K
-1

Variables
Symbol Definition gPROMS code Unit
F
c
Coolant mass flowrate mass_flowrate kg s
-1

T
c
in
Coolant inlet
temperature
in_temperature K

Page 25 2009 Process Systems Enterprise
T
c
Coolant temperature in the
jacket
temperature K
by coolant
energy_rate W
Equations
Coolant energy balance
( )
= +
in c
c c pc c pc c c
dT
VC FC T T Q
dt

Cooled reactor model
Parameters
Symbol Definition gPROMS code Unit
U Overall heat transfer
coefficient
heat_transfer_coeff_all W m
-2
K
-1

Units
Symbol Sub-model used
gPROMS
name
Reactor tubular_reactor Reactor
Jacket cooling_jacket Jacket
Equations
Connectivity equation

=
w C
Reactor.T Jacket.T

Heat transfer relationship

( ) ( )
0
2 = t
}
Reactor.L
C
Jacket.Q U Reactor.R Reactor.T z,R Jacket.T dz

Model configuration

Page 26 2009 Process Systems Enterprise
Parameter specifications
Tubular reactor
Parameter name Value
L 3 m
R 0.0127 m

b
1300 kg m
-3

f
1.293 kg m
-3

C
pf
992 J kg
-1
K
-1

D
z
0.01 m
2
s
-1

D
r
0.01 m
2
s
-1

k
z
0.5 W m
-1
K
-1

k
r
0.5 W m
-1
K
-1

c 0.35
AH - 1.2 10
6
J mol
-1

A 11.45
.
10
-3
mol kg
-1
s
-1
Pa
-2

E 113370 J mol
-1

R
g
8.314 J mol
-1
K
-1

U 500 W m
-2
K
-1

Cooling Jacket
Parameter name Value

c
2000 kg m
-3

C
pc
123900 J kg
-1
K
-
1

V
c
4.56
.
10
-3
m
3

Page 27 2009 Process Systems Enterprise
Cooled Reactor
Parameter name Value
U 500 W m
-2
K
-1

Variable specifications
Tubular reactor
Variable name Value
P
A
feed
1100 Pa
P
B
feed
21100 Pa
u 0.877 m s
-1

T
feed
625 K
Cooling jacket
Variable name Value
F
c
0.1 kg s
-1

T
c
in
625 K

Initial conditions
Tubular reactor
0 0 0
625 0 0
i
C , z ( ,L), r ( ,R), i A,B
T , z ( ,L), r ( ,R)
= e e =
= e e

Cooling jacket
625 =
c
T

Things to do

Page 28 2009 Process Systems Enterprise

1. Open the template project file DS1_tubular_template.gPJ in gPROMS and save it under a
new name.

2. Add the energy balance to the tubular reactor and observe the models of the cooling jacket
and the cooled reactor model.

3. Observe the PROCESS entity incorporating the data shown above. Use [CFDM,2,80] and
[OCFEM,3,5] to discretise the axial and radial domain respectively. Fill in the initial
conditions for the energy balance

4. Use gRMS to plot the component concentrations and temperature as functions of time,

5. [Optional] Copy and paste the existing PROCESS and rename it to Simulate_Tubular_NUG (for
non-uniform grid). Change the specification for the axial domain discretisation to use a
logarithmic transformation [CFDM, 2, 30, TRANSFORM(LOG, 4)]. Simulate the new process.

6. [Optional] Use gRMS to compare the temperature profile at r=0 and time=5 obtained with
the uniform grid (point 4) and the non-uniform grid (point 5).

Page 29 2009 Process Systems Enterprise

Building a flowsheet with PML models

Hands-on session: PML

Continuous separation of a mixture in a flash drum

Objective and process schematic

We want to simulate the dynamic behaviour of a flash drum unit subject to variations in the
heat input. The aim of the process is to separate a mixture of methane, hydrogen, methanol,
ethanol and n-butanol.
Figure 1

The flowsheet schematic shows the unit names with their corresponding generic PML model
names underneath. For example, the Drum unit is an instance of the Flash_Drum PML
model. The pressure and liquid level in Drum are controlled based on the control scheme
shown in the figure. After 10 s of operation, the drum is cooled by withdrawing 5e6 J/s of
heat from it. After 50 seconds of undisturbed operation, the energy input to the drum is

Page 30 2009 Process Systems Enterprise
ramped to 0.7e6 J/s. At the end of the procedure, the energy input is ramped to a cooling
rate of -2e6 J/s.
The flowsheet schematic shows annotations on the flowsheet such as a plot, a table and two
stream table. These have been added to allow a quick check on the important results.

Array No Component
1 methane
2 hydrogen
3 methanol
4 ethanol
5 n-butanol
Table 5

Model Specifications
The specifications required for all the units are summarised in the following table:

Feed
Specification mode Standard
Property calculation Two phase mixture
Physical properties Multiflash::mass:MIXTURE.mfl
Mass fraction Methane = 0.16
Hydrogen = 0.01
Methanol = 0.3
Ethanol = 0.3
n-Butanol = 0.23
Pressure 1.2E5 Pa
Temperature 300 K

Page 31 2009 Process Systems Enterprise

Feed_pipe
Specification mode Standard
Flow coefficient 1e-3 kg/sPa

Drum
Configuration Initialise
Heat input Manual
Initial conditions specifications Dynamic: P, all but one Xtot and liquid
level fraction
Configuration:
Volume 3 m3
Diameter 0.5 m
Rate of energy input 0 J/s

Initial conditions:
Pressure 1.1E5 Pa
Initial mass fractions Hydrogen = 0
Methanol = 0.02
Ethanol = 0.01
n-Butanol = 0.97
Initial liquid level ratio 0.5

Fl_bottom
Measurement type Flowrate

Flow_control

Page 32 2009 Process Systems Enterprise
Configuration:
Controller class PI
Initial conditions Dynamic
Controller action Direct
StopIntegrator inactive
Minimum input 0
Maximum input 10
Minimum output 0
Maximum output 1
Bias 1
Gain 100
Reset time 10
Rate limit 1
Rate 0

Initial conditions:
Integral term 0

Level_control
Configuration:
Controller class PI
Controller mode Automatic
Initial conditions Dynamic
Controller action Reverse
StopIntegrator inactive
Minimum input 0

Page 33 2009 Process Systems Enterprise
Maximum input 1
Minimum output 0
Maximum output 10
Bias 0
Gain 50
Reset time 100
Rate limit 1
Rate 0
Set point 0.6

Initial conditions:
Integral term 0

Press_control
Configuration:
Controller class P
Controller mode Automatic
Controller action Reverse
StopIntegrator inactive
Minimum input 1e3
Maximum input 1e6
Minimum output 1e-10
Maximum output 1
Bias 0
Gain 1000
Rate 0
Set point 1.1e5 Pa

Page 34 2009 Process Systems Enterprise

Gas_valve
Inherent characteristic Linear
Stem position specification Controlled
Leakage fraction 1e-3
Time constant 0.5 s
Flow directon Reversible
Flow coefficient 2e5 gpm/psi
0.5

Recovery factor 34.8

Liquid_valve
Inherent characteristic Linear
Stem position specification Controlled
Leakage fraction 1e-3
Time constant 0.5 s
Flow directon Reversible
Flow coefficient 82 gpm/psi
0.5

Gas_product
Property calculation Gas
Mass fraction 0.2 for all species

Page 35 2009 Process Systems Enterprise
Pressure 9E4 Pa
Temperature 440 K

Liquid_product
Property calculation Liquid
Mass fraction 0.2 for all species
Pressure 1.013E5 Pa
Temperature 275.15 K

Table 2

Things to do
Open all the PML libraries placed in the gPROMS installation directory by clicking on the
corresponding button on the ModelBuilder top bar.

In the project tree, observe the models included in each library.

Open the supplied PML_Template.gPJ project and save it with a different name.

In your new saved project, create a new model called flash_unit by following the steps below:
- Select the project name in the project tree,
- Right-click and select New entity on the pop-up menu,
- Introduce the new model name flash_unit in the Name field,
- Select Model in the drop-down Entity type menu

Configure the material and physical property calculation model using the Multiflash GUI:
- Open the Multiflash GUI from the Windows Start menu
- On the menu bar, click Select > Components This will open the Select Components
dialog. Add the mixture components (1. methane, 2. hydrogen, 3. methanol, 4. ethanol
and 5. n-butanol) to the component list by typing their names in the Enter Name: field.
Close the dialog box.
- From the menu, go to Select > Model Set to configure the thermodynamic model. Go
to the Activity Models tab and choose Ideal mixing for the liquid phase and Perfect
gas for the vapour phase. Click Define Model and then Close.
- Go to the File > Save problem setup menu and save your project under the name
MIXTURE.mfl in a easy-to-find location.
- Go back to gPROMS ModelBuilder and import the MIXTURE.mfl physical property
configuration file into your working project. It will appear in the Miscellaneous Files
group.

Page 36 2009 Process Systems Enterprise

Go to the topology tab of the flash_unit model and create a flowsheet similar to Figure 1 by
dragging and dropping the appropriate units from the model palette. Follow the steps
below:
- To show the model palette click on the palette tab at the bottom of the project tree,
- Browse on the different libraries, select the requested models (find the model names in
Figure 1), drag them and drop them on your model topology window,
- (Alternatively, models can be dragged directly from the project tree view),
- Provide the name Drum for the instance of the Flash_Drum model, to ensure the
operating procedure works (the name Drum is used in the Simulate_flash PROCESS).
- Create the appropriate connections among units. This is done by first selecting the
connection tool (3
rd
button in topology menu bar), selecting the first port to be
connected and then selecting the port this is to be connected to.

Introduce the model specifications shown in table 2 to the dialog boxes by double clicking the
model icon on the topology.

- In the Palette view, select the Plot template and drop it on the flowsheet. The value to
be plotted is the total hold up mass of the Drum. Double-click on the template, add a
title Total holdup mass to the plot, set the Y-Axis label to kg. Select the variable to be
plotted, the full variable path has to be given, the assisted pathname completion can be
used while editing a plot.
- Then create two stream value tables before the gas_product and liquid_product units to
track the composition at the outlet. Select the desired connexion between the units,
right-click and select add a value table, delete the pressure and mass specific enthalpy
information.
- Add a table to display the stem position of the gas and liquid valve. Drag and drop the
table template to the flowsheet, double click to set the variables to be displayed, edit
the label.
- Finaly, add a title to the flowsheet Flowsheet Flash Unit. Drag and drop the text
annotation template, type the text and apply a bold format and a size of 24pt.

- in the topology tab of the flash_unit model click on the Manage flowsheet layers
buttom available in the topology editor toolbar
- Rename the already existing Default layer to Process units
- Add two new layers: Process control and Results
- Assign all the controllers of the flowsheet to the Process control layer: to select all the
controllers keep pressing the Shift and left-click on each controller in the flowsheet, then
right-click anywhere in the flowsheet and choose Set layer to...> Process control
- In the same manner assign all the plots and stream value tables of the flowsheet to
the Results layer
- To specify the parts of the flowsheet to be displayed and printed, set the attributes of
each layer accordingly

To simulate the flowsheet, we need to create a PROCESS entity. To do this, right-click on the
flowsheet model in the project tree to create a process named Simulate_flash. You want to

Page 37 2009 Process Systems Enterprise
perform a simulation for 180 seconds. Tick on the option transient simulation and enter
the simple SCHEDULE that follows: CONTINUE FOR 180. Observe the PROCESS generated and
notice how the specifications from the dialog boxes in the flowsheet model appear
automatically in the Process. The blue shading indicates that they cannot be modified (except
by using the dialog box).

Run a simulation and observe the results using the model reports and stream tables in the case:
- Right-click on the FLOWSHEET entity and open the Topology view.
- View the stream tables by switching the stream tables tab.
- Double click on the FLOWSHEET entity inside the Trajectories entity in the simulation
case.
- Right-click on each unit to see the model reports.

Observe the results using the trajectories included in the case:
- Expand the tree Trajectories > FLOWSHEET. You will then see all the model names
occurring in the Plant flowsheet.
- To show the trajectory of a certain variable, expand the model folder and then the
Variables folder within this. This will then show a list of all the variables appearing in the
model. To see the trajectory double click on the variable. This first opens a table of the
results.
- To see a plot select the Graph tab at the bottom of the window opened.
- As an example plot the trajectory for temperature in the Drum model.

Page 38 2009 Process Systems Enterprise

Publishing models for flowsheeting
Hands-on Session PI1:
Defining a public interface for liquid-phase CSTR model
Problem description

So far you have successfully developed a generic model for a liquid-phase CSTR reactor. Your
task now is to develop a library based on that model to allow non-experts in your
organisation use that model in flowsheeting projects. The new library should be developed
under the following standards:

1. all quantities should be in molar SI units (as the ones used so far)
2. physical properties should be calculated through the use of a foreign object
3. Arrhenius based reaction kinetics should be provided as the default option. However, the library
should easily be extended to allow other kinetic models to be used as alternative options
4. A single Connection Type material should be introduced to allow PORT connections between
UNITs in a flowsheet model. Its configuration should be as follows:
a. Parameters

Symbol Definition
gPROMS code Units
NoComp Number of components no_components

PhysProp Physical property FO Phys_prop

b. Variables

Symbol Definition
gPROMS code Units
F Molar flowrate molar_flowrate Kmol s
-1

X
i
Component i molar
fraction
molar_fraction

T Temperature temperature K

5. A generic model called Material_source should be used to introduce a stream into a flowsheet
through a single outlet port. The dialog of the Material_source model should allow the user to
specify
a. the foreign object for physical property calculations
b. the reactive mixture,
c. the conditions (F, X
i
, T) under which the reactive mixture is introduced into a flowsheet
6. a generic model called Material_sink should be used to define a stream leaving a flowsheet

Page 39 2009 Process Systems Enterprise
7. the liquid_phase_CSTR model should have a single inlet and single outlet port. A PORT SET should
be used for port parameter propagation throughout the flowsheet. The liquid_phase_CSTR model
specifications dialog box should consist of the following three tabs:

Tab name PMAs included
Configuration o, A, h
p,
, Q (Assigned)
Reaction data

NoReac, a
ij
, v
ij
, k
j,0
, E
Aj
, H
j

Initial
V (Initial), X
i
(i=1NoComp-1) (Initial), T
(Initial)

8. model reports and stream tables should be available to the user at the end of a simulation
activity
Things to do

1. Open the library project PI_ModelLibrary_template.gPJ and save it as PI_ModelLibrary.gPJ

2. Observe the structure of the library. It consists of:
a. a set of Variable Types similar to the ones used in the previous hands on sessions
b. the material Connection Type entity configured according to the library standards (point
4 above)
c. the Material_source and Material_sink generic models whose public interface has
d. the liquid_phase_CSTR and reaction_kinetics models you have just completed in the
previous hands on sessions

3. Complete the public interface of the liquid_phase_CSTR model (note, an interface should not be
created for the reaction_kinetics model as it is a lower level model). In the interface tab do the
following:
a. Model icon:
Import the icon CSTR_Reactor.png

b. Model ports:
Create an inlet and an outlet port of type material and place them correctly on the
model icon. Both ports should belong to the same PORT SET to propagate the material
Connection Type parameters throughout a flowsheet. In this way the model user will
have to SET their values in a Material_source type UNIT only. Observe the ports
representation in the Topology and the gPROMS language tabs. The ports should have
the following configuration:

Port name inlet outlet
Connection type material material
Direction inlet outlet
Dimensionality scalar scalar
Port set flow flow

Page 40 2009 Process Systems Enterprise
Modify the gPROMS language tab of the liquid_phase_CSTR model to assure the
connectivity between the PORTs and the model, e.g.:
SET
phys_prop := inlet.phys_prop ;
no_components := inlet.no_components ;
EQUATION
in_temperature = inlet.temperature ;
in_molar_flowrate = inlet.molar_flowrate ;
in_molar_fraction = inlet.molar_fraction ;
outlet.temperature = temperature ;
outlet.molar_flowrate = out_molar_flowrate ;
outlet.molar_fraction = molar_fraction ;

c. Specifications dialog:
Go to the Interface tab and click Edit Specification... to open the Public Model Interface
Builder and create the models dialog box based on the library standards (points 7 and 8
above). Note that the Public Model Attributes are already defined and configured in
declared tabs.

Add the Volume (V) to the Public Model Attributes. Choose a realistic name and
reasonable bounds. In the Configure Specification Dialog configure Volume to belong to
the initial section and its value to be specified in the Initial conditions tab as obligatory.

4. [Optional] Finally, we will configure the Report. We want to see the volume and liquid height of
the reactor as well as the hold-up moles for each component in a Table. Further more, we want
to plot the temperature evolution with time.
a. Enable the Unit Meta Specification editor by going to menu > Edit > Preferences >
Advanced and ticking Show UMS text editor.
b. Go to the specification tab which should now be visible.
c. To set-up the table, use the following formatting template
<PMA_TABLE>
<Attribute id="a_Variable"/>
</PMA_TABLE>
- The previous Xml code creates a table for the variable a_Variable
- Use this template to create a table displaying the reactors volume, height
and hold-up per components.
d. To set-up the 2D plot of the temperature, the formatting template is
<Plot2D version="1">
<Axes>
<Axis orientation="x"/>
<Axis orientation="y"/>
</Axes>
<Line idY=""/>
</Plot2D>
- Configure a 2D plot to display the temperature evolution with time

Page 41 2009 Process Systems Enterprise
e. (Optional) Set-up a plot displaying the reaction rate dependence with the temperature
using an x-y plot. [Hint: use the on-line help to look up additional tags and their
attributes]

Page 42 2009 Process Systems Enterprise
Publishing models for flowsheeting
Hands-on Session PI2:

Model topology development using the PI Model library

Problem description

The PI Model library should be used in following two flowsheeting projects

Simulation of an adiabatic liquid-phase CSTR
Problem description
We want to simulate the first day of operation of a cooled CSTR. The CSTR should be
included in a flowsheet containing a feed source for the reactor with the respective sink. We
want to simulate the same reaction as in hands-on session F2:

1
2
+ +
R
R
A B C D
Process schematic

Things to do
1. Open the PI_ModelLibrary.gPJ you have just completed in the previous hands-on session

2. Create a new project in gPROMS. Go to the File menu and choose New

3. Cross-reference your new project to the PI_ModelLibrary . To do that follow the steps below,
with the library and your project opened in ModelBuilder:

Page 43 2009 Process Systems Enterprise
a. select your project and click on the right mouse button,
b. select properties in the pop-up menu
c. click on the Cross-references tab, and
d. select PI_ModelLibrary in the dialog window

4. Import the IPPFO database file (ReactorProps.ipp) required for the physical property calculations

5. Create a new model entity (e.g. stand_alone_CSTR) in your new project

6. In topology tab develop a flowsheet like the one appearing in the Process schematic (section 2.2)
using the library models

7. Fill in the specification dialogs of all the UNITs in the topology based on the description of hands-
on session F2. These are summarised below:

Source_
Physical properties IPPFO::ReactorProps.ipp<COMP_A,
COMP_B, COMP_C, COMP_D>
Inlet stream molar
flowrate
1.0 kmol/s
Inlet stream molar
fractions
0.5, 0.5, 0, 0
Inlet stream temperature 338.15 K
Reactor
Configuration
Valve constant 0.3
Cross sectional area 5 m
2
Pipe height 5 m
Energy rate 0 J/s

Page 44 2009 Process Systems Enterprise
Reaction data
Number of reactions 2
Order of reactions

1, 1.5, 0, 0
0, 0, 1, 1
Reaction stoichiometry -1, -1, 1, 1
1, 1, -1, -1
Arrhenius constants 4.24E3, 4.55E5
Activation energy 48300, 66200
Enthalpy of reaction -70.5E3, 70.5E3

Initial conditions
Volume 10
Molar fractions , 2*molar_fraction(1), 0, 0
Temperature 338.15 K

8. Create a new PROCESS:
a. declare a UNIT to be of the generic model type stand_alone_CSTR and press F4 to import
dialog specifications
b. type the SCHEDULE section
SCHEDULE
CONTINUE FOR 10000
9. Run a simulation activity and create model reports and stream tables on the results. Compare
with the results obtained from the solution of hands-on session F2.

Simulation of a CSTR reactor train
Problem description
We want to simulate the operation of a CSTR train including two reactors in series. In
addition it is desired to monitor overall molar holdup variation in the two reactors.
Process schematic

Page 45 2009 Process Systems Enterprise

Things to do
1. Create a new model entity (e.g. CSTR_train) in your working project
2. In the topology tab develop a flowsheet like the one appearing in the Process schematic (section
3.2) using the library models
3. Fill in the specification dialogs of all the UNITs in the topology:

Source_
Physical properties IPPFO::ReactorProps.ipp<COMP_A,
COMP_B, COMP_C, COMP_D
Inlet stream molar
flowrate
1.0 kmol/s
Inlet stream molar
fractions
0.5, 0.5, 0, 0
Inlet stream temperature 273.15+65

Pre-Reactor
Configuration
Valve constant 1
Cross sectional area 1 m
2
Pipe height 1 m
Energy rate 0 J/s

Page 46 2009 Process Systems Enterprise
Reaction data
Number of reactions 2
Order of reactions

1, 1.5, 0, 0
0, 0, 1, 1
Reaction stoichiometry -1, -1, 1, 1
1, 1, -1, -1
Arrhenius constants 4.24E3, 4.55E5
Activation energy 48300, 66200
Enthalpy of reaction -70.5E3, 70.5E3

Initial conditions
Volume 0.5
Molar fractions , 2*molar_fraction(1), 0, 0
Temperature 273.15+65

Main-Reactor
Configuration
Valve constant 0.3
Cross sectional area 5 m
2
Pipe height 5 m
Energy rate 0 J/s

Page 47 2009 Process Systems Enterprise
Reaction data
Number of reactions 2
Order of reactions

1, 1.5, 0, 0
0, 0, 1, 1
Reaction stoichiometry -1, -1, 1, 1
1, 1, -1, -1
Arrhenius constants 4.24E3, 4.55E5
Activation energy 48300, 66200
Enthalpy of reaction -70.5E3, 70.5E3

Initial conditions
Volume 10
Molar fractions , 2*molar_fraction(1), 0, 0
Temperature 273.15+65

4. Go to the gPROMS language tab and define the appropriate VARIABLEs and EQUATIONs to
calculate the overall molar holdup in the two reactors (as you did in hands-on session F5)

5. Create a new PROCESS:
a. declare a UNIT to be of the generic model type CSTR_train and press F4 to import dialog
specifications
b. type the SCHEDULE section
SCHEDULE
CONTINUE FOR 10000
Run a simulation activity and create model reports and stream tables on the results.

Page 48 2009 Process Systems Enterprise
Operating procedures
Hands-on Session OP1
Modelling and simulation of a batch reactor operating procedure

Problem description
We want to simulate a batch cycle for an isothermal liquid-phase batch reactor used to carry out
the following reaction:
A B C D + +

Process schematic

Key modelling assumptions

- The tank is well-stirred.
- The operation is isothermal.

Page 49 2009 Process Systems Enterprise

Mathematical model

- Component mass balance
1 1
1
NoInput NoReac
i
out in,k in,i,k i ij j
k j
dM
F X F X V r , i .....NoComp
dt
= =
= + v =

where subscript k is the number of input to the isothermal liquid-phase batch reactor.

- Reaction rates
1
1
ij
NoComp
a
j j
i
i
r k C , j .....NoReac
=
= =
[

- Total volume & total holdup
1
1
NoComp
i
i
i
NoComp
T i
i
M
V
M M
=
=
=

- Component concentrations & molar fractions

1
1
i
i
i
i
T
M
C , i .....NoComp
V
M
X , i .....NoComp
M
= =
= =

- Calculation of liquid level in the tank

V Ah =
- Characterisation of the output flowrate

out p
F V h = o
where V
p
is the valve position.

Data

Page 50 2009 Process Systems Enterprise
- The component and reaction data are the same as in hands-on session F2.
- The cross-sectional area of the cylindrical reactor vessel is 5 m
2
. The outlet valve constant is
0.3.
- There are two input streams. The first contains 90% A, 5% B and 5% D. The second contains 5% A
and 95% B.
- Operating procedure for a single batch:
Initially, the reactor is empty, the flowrates of the input streams are zero and the outlet
valve is closed (V
p
= 0).
Wait for 1 min.
Set the flowrate of the first input stream to 0.1 kmol
.
s
-1
.
Wait until the volume of liquid has reached 2.5 m
3
.
Set the flowrate of the first input stream to 0 and the flowrate of the second input stream to
0.1 kmol
.
s
-1
simultaneously.
Wait until the volume of liquid in the tank has reached 5 m
3
.
Set the flowrate of the second input stream to 0.
Wait until the mole fraction of component C in the tank has reached 0.25.
Open the outlet stream valve. Wait until the tank drains.
Close the outlet stream valve.

Things to do
1. Open the template project file OP1_batch_template.gPJ and save it under a new name. (The
constructed in the MODEL section given by the template.)

2. Specify a SCHEDULE section for the PROCESS SimulateBatchReactor_1 and execute it to simulate
one complete batch of operation using the data shown above. Use gRMS to create a plot of
component concentrations as functions of time.

3. Copy the PROCESS SimulateBatchReactor_1 to a new PROCESS called SimulateBatchReactor_2 to
simulate one complete batch operation using the two TASKs construct below:

- Construct a general TASK called SetFlowrate to manipulate the flowrate of any input stream
The reactor on which it will act.
The index of the input stream.
The required flowrate.
- Construct a general TASK called SetPosition to manipulate the position of the outlet stream
The reactor on which it will act.
The required outlet stream valve position.
Use gRMS to create a plot of component concentrations as functions of time.

4. Copy the operating procedure for a single batch in the PROCESS SimulateBatchReactor_2 to a
new TASK called DoBatch. Copy the PROCESS SimulateBatchReactor_2 to a new PROCESS called
SimulateBatchReactor_3. Revise the PROCESS to make use of the TASK DoBatch. Use gRMS to
create a plot of component concentrations as functions of time.

Page 51 2009 Process Systems Enterprise

5. Construct a new TASK called DoNBatches for carrying out a specified number of batches. Copy
the PROCESS SimulateBatchReactor_3 to a new PROCESS called SimulateBatchReactor_4. Revise
the PROCESS to make use of the TASK DoNBatches and test it for 5 batches. Use gRMS to create a
plot of component concentrations as functions of time.

Page 52 2009 Process Systems Enterprise
Simple Foreign Objects and Foreign Processes in gPROMS
Hands-on Session FO:
Using Excel Foreign Object and Process (MS-Excel
TM
)

Problem description
We want to simulate the first 100 s operation of an isothermal liquid-phase CSTR. The main
objectives of this hands-on session are:
- Using Excel Foreign Object for data
- Using Excel Foreign Process for real-time interaction

Data
The component data, reaction data and reactor geometry are to be supplied by an Excel
spreadsheet called Reactor Data in SFOFP_xl_cstr_template.xls.

Things to do
1. Open the template project file SFOFP_xl_cstr_template.gPJ and save it under a new name.
2. Modify the PROCESS section in the model to include the correct path to the Excel Foreign Object (FO)
and Foreign Process Interface (FPI). The same Excel file (SFOFP_xl_cstr.xls) should be used for both
the FO and the FPI.
3. Execute the simulation from within gPROMS. Since a PAUSE statement is included in the SCHEDULE,
the simulation waits for a signal from the user before continuing. This signal is generated by
recalculating the Excel-spreadsheet. By default, Excel recalculates after any changes made to a
spreadsheet. Change, for example, the input variables in the spreadsheet called Reactor Schematic.
These input variables include:
- Feed flowrate
- Feed compositions for components A, B and C.
Note that the execution continues after as soon as you change one input value in the Excel sheet. You
can change more than one input value changing the calculation settings in Excel: Formulas >
Calculation > Calculation (Excel 2003: Menu > Tools > Options > Calculation > Manual). The Excel
spreadsheet can then be recalculated manually by pressing F9, after which the gPROMS simulation
will continue.
4. Modify the Foreign Process in Excel and PROCESS section in the model to monitor the total holdup of
the system.
- Load the FO and FP macros for Excel (located in your gPROMS start menu). When prompted with
a security warning, ensure you enable macros. After you loaded the macros, switch back to the
FO/FPI workbook.
- Press CTRL+SHIFT+P to define an FPI Variable. Supply appropriate entries for the:
- tag name
- variable type
- Cell cross-reference - this is the location where the results will appear

Page 53 2009 Process Systems Enterprise
- Table mode (new values will be written in a new [R]ow, [C]olumn or [] the same cell)
- Include the newly defined FPI Variable in the SEND section in your gPROMS PROCESS.
5. Execute the simulation again.

gPROMS model developer course
Page 54 2009 Process Systems Enterprise
Hands-on Session SSM1

Steady state simulation of a catalytic tubular reactor

Problem description
We want to do a steady state calculation of a tubular reactor. The accumulation terms have
been removed in the heat and mass balances equations.

Process schematic

Things to do
1. Open the project file SSM_tubular_template.gPJ and save it under a new name.

2. Run the simulation: it will fail during the initialisation calculation due to inadequate
initial guesses.

You will now create a Saved Variable Set with better guesses to help the simulation initialise.

3. Copy and paste the SimulateTubular process to create a new process, and give it a new
name.

4. Modify the ASSIGN section of the new process to ramp the Arrhenius factor from 0 to its
original value in 1 time unit.

5. Introduce an SCHEDULE to CONTINUE for 1 second and SAVE a set of saved variables in
the new process. Run the simulation. The saved variable set will be stored in the
Results folder in the case.

6. Copy the saved variable set from the case into the Saved Variable Sets entity in the
project.

gPROMS model developer course
Page 55 2009 Process Systems Enterprise
7. Modify the SimulateTubular process to perform a STEADY_STATE simulation taking
initial guesses from the Saved Variable Set created above.

8. Consider how you would initialise a dynamic model in STEADY_STATE mode

9. Extra credit: The discretisation scheme chosen for this reactor does not follow the
guidelines covered in the tutorial. Use the appropriate discretisation scheme. The
reactor should initialise at steady state without the need of a saved variable set.

10. Extra credit: Compute the axial Pclet number and based on this decide which terms can
be dropped from the differential equations. Make the appropriate changes to equations,
boundary conditions and discretisation methods. Again, the reactor should initialise at
steady state without the need of a saved variable set.

(The Pclet number is defined as the ratio between advection and diffusion:
L v
Pe
D

= ).