Advanced Process Modelling in gPROMS 1 111Equation Chapter 1 Section 1Modelling 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. Page 1 2009 Process Systems Enterprise
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Advanced Process Modelling in gPROMS
1 111Equation Chapter 1 Section 1Modelling and simulation of a buffer tank
1.1 ObjectivesBy 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 descriptionWe want to model the dynamic operation of a buffer tank.
Figure 1-1: Buffer tankThe 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 1 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
1.4 ParametersSymbol Description Units gPROMS identifier Parameter type
Horizontal cross-section area of the tank
m2 area REAL
Outlet flowrate coefficient kg/(s.√m) outlet_flowrate_coefficient REALLiquid density kg/m3 density REAL
Table 1-1: Model parameters
1.5 VariablesSymbol Description Units gPROMS identifier Variable type
Inlet mass flowrate kg/s inlet_mass_flowrate mass_flowrateOutlet mass flowrate kg/s outlet_mass_flowrate mass_flowrateAmount of liquid mass contained in the tank
kg mass_holdup mass
Liquid level in the tank m height lengthTable 1-2: Model variables
1.6 EquationsMass balance:
212\* MERGEFORMAT (.)
Liquid level in the tank:
313\* MERGEFORMAT (.)
Outlet mass flowrate:
414\* MERGEFORMAT (.)
1.7 Parameter valuesThe cross-section area of the tank is 1 m2. The liquid density is 1000 kg/m3. The outlet flowrate coefficient is 10 kg/(s.√m).
1.8 Degrees of freedomThe inlet mass flowrate into the tank is constant at 20 kg/s throughout the simulation.
1.9 Initial conditionsAt the start of the operation, the liquid level in the tank is 2.1 m.
1.10 Things to do1. Create a new project.
Go to the menu File > New. A new project called gPROMS_Project_1 appears in the project tree area.
Page 2 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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.
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 don’t 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:
Page 3 2009Process Systems Enterprise
PARAMETER area AS REAL density AS REAL outlet_flowrate_coefficient AS REAL
Advanced Process Modelling in gPROMS
VARIABLE inlet_mass_flowrate AS mass_flowrate outlet_mass_flowrate AS mass_flowrate mass_holdup AS mass height AS length
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 equations to increase readability.
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 don’t need it) and complete the UNIT section by typing the following in the process:
UNIT T101 AS Buffer_tank
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.
Page 4 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
SETWITHIN T101 DO area := 1 ; # m2 outlet_flowrate_coefficient := 10 ; # kg/(s.SQRT(m)) density := 1000 ; # kg/m3END # WITHIN T101
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.
ASSIGN T101.inlet_mass_flowrate := 20 ; # kg/s
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:
INITIAL T101.height = 2.1 ; # m
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:
SCHEDULE CONTINUE FOR 1800
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.
Page 5 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 6 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
2 511Equation Chapter 1 Section 1Modelling and simulation of a Continuous Stirred Tank Reactor
2.1 ObjectivesBy 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 descriptionWe want to simulate the first three days of the dynamic operation of a Continuous Stirred Tank Reactor (CSTR).
Figure 2-2: CSTRThe 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 (H2O):
Or, in different notation,
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 from the bottom of the vessel, and as a result the outlet
flowrate exists only if the liquid level exceeds .
Page 7 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
2.3 Assumptions All components are in liquid phase. 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 ParametersSymbol Description Units gPROMS identifier Parameter
typelist of component names - component_list ORDERED_SETlist of reaction names - reaction_list ORDERED_SETreactor cross section area m2 cross_section_area REALoverflow pipe height m pipe_height REALoutlet valve constant kmol/(m.s) valve_constant REALdensity of component i kmol/m3 component_density REALorder of component i in reaction j
- reaction_order REAL
stoichiometry of component i in reaction j
- reaction_stoichiometry INTEGER
pre-exponential factor in reaction j rate expression
s-1 reaction_pre_exponential_factor
REAL
activation energy for reaction j
kJ/kmol reaction_activation_energy REAL
ideal gas constant kJ/(kmol.K) ideal_gas_constant REALTable 2-4: Model parameters
2.5 VariablesSymbol Description Units gPROMS identifier Variable type
inlet molar flowrate kmol/s inlet_molar_flowrate molar_flowrateinlet molar fraction of component i
kmol/kmol inlet_molar_fraction molar_fraction
outlet molar flowrate
kmol/s outlet_molar_flowrate molar_flowrate
molar fraction of component i
kmol/kmol molar_fraction molar_fraction
total liquid volume m3 total_volume volumeliquid level m level lengthconcentration of component i
kmol/m3 molar_concentration molar_concentration
pressure Pa pressure pressuretemperature K temperature temperatureholdup (i.e. the amount of moles) of component i
kmol holdup_moles moles
total holdup kmol total_holdup_moles molesreaction j rate s-1 molar_reaction_rate reaction_rate
Page 8 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Table 2-5: Model variables
2.6 EquationsMolar balance:
616\* MERGEFORMAT (.)
Reaction rates:
717\* MERGEFORMAT (.)
Total holdup:
818\* MERGEFORMAT (.)
Total volume:
919\* MERGEFORMAT (.)
Molar fractions:
10110\* MERGEFORMAT (.)
Molar concentrations:
11111\* MERGEFORMAT (.)
Liquid level:
12112\* MERGEFORMAT (.)
Outlet flowrate:
13113\* MERGEFORMAT (.)
2.7 Parameter valuesThe components considered are MeOH, HAc, MeAc and H2O. The reactions are referred to by their names: esterification and hydrolysis. The reaction stoichiometry and order are given in Table 2-6:
The cross-section area of the tank is 5 m2.The overflow pipe is located at 5 m above the reactor bottom. The outlet valve coefficient is 0.01 kmol/(m.s). The component densities are given in Table 2-7.
Component Density [kmol/m3]
MeOH 24.1117
HAc 17.0950
MeAc 12.2603
H2O 55.0762
Table 2-7: Component densities
2.8 Degrees of freedomThe 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 conditionsAt 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:
There is no methyl acetate nor water present: .
2.10 Things to do1. 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,
Page 10 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
VARIABLE molar_fraction AS ARRAY ( component_list ) OF molar_fraction
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.
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.
9. Save your project now.
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 11 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
3 Hierarchical decomposition of a Continuus Stirred Tank Reactor model
3.1 ObjectivesBy 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 descriptionThe model is the same as in the previous hands-on session.
Figure 3-3: CSTRThe 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 do1. 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:
Page 12 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 ...
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:
VARIABLE molar_fraction AS ARRAY ( component_list ... temperature AS ... molar_reaction_rate AS ARRAY ( ...
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):
Page 13 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
PARAMETER ...
UNIT kinetics AS reaction_kinetics
VARIABLE ...
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).
Page 14 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
4 Using the IPPFO foreign object to calculate the physical properties of an adiabatic liquid-phase CSTR
4.1 Problem descriptionIn 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:
the specific enthalpy of the mixture at the inlet (htin) and outlet (ht
out) of the reactor which is calculated using the following correlation twice:
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,ni
LiquidEnthalpy Liquid enthalpy T,P,ni
NumberofComponents Number of components
--
Note that the third argument 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 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Page 17 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 DefinitiongPROMS code Units
NoCompNumber of components no_components
NoReac Number of reactions no_reactions
Outlet stream valve position constant
valve_constant
AReactor cross sectional area
cross_section_area m2
hp Outlet pipe height pipe_height M
aijOrder of component i in reaction j
reaction_order
ij
Component i stoichiometric coefficient in reaction j
reaction_stoichiometry
Page 18 2009Process Systems Enterprise
HeightHeightV, ht
T, P, ni
Advanced Process Modelling in gPROMS
kj,0Arrhenius constant for reaction j
reaction_pre_exponential_factor
EA,jArrhenius activation energy for reaction j
reaction_activation_energy J mol-1
ΔHj Enthalpy of reaction j reaction_enthalpy J kmol-1
Patm Atmospheric pressure Patm 101325 Pa
R Ideal gas constant ideal_gas_constant8.314 J mol-1 K-
1
Component liquid density
Density Kmol m-3
Tref Reference temperature Tref 298.15 K
A11
A2i
A3i
A4i
Coefficients used for the component specific enthalpy calculation
A1
A2
A3
A4
4.4.2 Variables
Symbol DefinitiongPROMS code Units
V Liquid volume inside reactor Volume m3
H Liquid level inside reactor Height m
Fin Inlet stream molar flowrate in_molar_flowrate kmol s-1
Xin,iInlet stream molar fraction of component i
in_molar_fraction
Tin Inlet stream temperature in_temperature K
htin Inlet stream specific enthalpy in_molar_specific_enthalpy J kmol-1
Component specific molar enthalpy at the inlet stream
Specific molar enthalpy at the inlet stream
Component specific molar enthalpy inside the reactor and at the outlet stream
Specific molar enthalpy inside the reactor and at the outlet stream
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
Page 21 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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.
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_OBJECTb) All PARAMETERs that are no longer required e.g.: density, Tref, A1… are commented outc) All VARIABLES that are no longer required e.g.: in_component_specific_enthalpy and
out_component_specific_enthalpy are commented outd) 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 NumberofComponentsc) 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 22 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Distributed systems in gPROMS
Hands-on Session DS1
Modelling and simulation of a catalytic tubular reactor
Problem descriptionWe want to simulate 5 seconds operation of a catalytic tubular reactor system in which a gas phase reaction takes place.
Process schematic
Process descriptionThe 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 23 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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
R Reactor radius reactor_radius m
b Bed density bulk_density kg m-3
f Fluid density fluid_density kg m-3
Cpf Fluid specific heat capacity
specific_heat_capacity J kg-1 K-1
Dz Axial diffusivity axial_diffus m2 s-1
Dr Radial diffusivity radial_diffus
kz Axial thermal conductivity
axial_therm_condact
kr Radial thermal conductivity
radial_therm_condact W m-1 K-1
Bed voidage fraction void -H Reaction enthalpy reaction_enthalpy J mol-1
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
Rg Ideal gas constant ideal_gas_constant J mol-1 K-1
Variables
Symbol Definition gPROMS code Unit
Page 24 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Ci(z,r) Concentration of component i molar_conc(z,r) mol m-3
Cpc Coolant specific heat capacity heat_capacity J kg-1 K-1
Vc Cooling jacket volume volume m3
U Overall heat transfer coefficient
U W m-2 K-1
Variables
Symbol Definition gPROMS code Unit
Fc Coolant mass flowrate mass_flowrate kg s-1
Tcin Coolant inlet
temperature in_temperature K
Page 26 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Tc Coolant temperature in the jacket
temperature K
Q Total heat load absorbed by coolant
energy_rate W
Equations
Coolant energy balance
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 usedgPROMS name
Reactor tubular_reactor Reactor
Jacket cooling_jacket Jacket
Equations
Connectivity equation
Heat transfer relationship
Model configuration
Page 27 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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
Cpf 992 J kg-1 K-1
Dz 0.01 m2 s-1
Dr 0.01 m2 s-1
kz 0.5 W m-1 K-1
kr 0.5 W m-1 K-1
0.35
H - 1.2 106 J mol-1
11.45.10-3 mol kg-1 s-1 Pa-2
E 113370 J mol-1
Rg 8.314 J mol-1 K-1
U 500 W m-2 K-1
Cooling Jacket
Parameter name Value
c 2000 kg m-3
Cpc 123900 J kg-1 K-
1
Vc 4.56.10-3 m3
Page 28 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Cooled Reactor
Parameter name Value
U 500 W m-2 K-1
Variable specifications
Tubular reactor
Variable name Value
PAfeed 1100 Pa
PBfeed 21100 Pa
u 0.877 m s-1
Tfeed 625 K
Cooling jacket
Variable name Value
Fc 0.1 kg s-1
Tcin 625 K
Initial conditions
Tubular reactor
Cooling jacket
Things to do
Page 29 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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, reactor length and radius.
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 30 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 31 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 8
Model SpecificationsThe 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 32 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Feed_pipe
Specification mode Standard
Flow coefficient 1e-3 kg/s·Pa
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 33 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Configuration:
Controller class PI
Controller mode cascade
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
Maximum input 1
Page 34 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 35 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Gas_valve
Specification mode Advanced
Inherent characteristic Linear
Stem position specification Controlled
Initial conditions specifications Steady state
Leakage fraction 1e-3
Time constant 0.5 s
Flow directon Reversible
Flow coefficient 2e5 gpm/psi0.5
Recovery factor 34.8
Liquid_valve
Specification mode Advanced
Inherent characteristic Linear
Stem position specification Controlled
Initial conditions specifications Steady state
Leakage fraction 1e-3
Time constant 0.5 s
Flow directon Reversible
Flow coefficient 82 gpm/psi0.5
Gas_product
Property calculation Gas
Mass fraction 0.2 for all species
Page 36 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 doOpen 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 37 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 (3rd 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.
Add annotations to the Flowsheet.
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.
Add layers to the flowsheet 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 perform a simulation for 180 seconds. Tick on the option “transient simulation” and enter
Page 38 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 39 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Publishing models for flowsheetingHands-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 object3. 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 options4. 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 DefinitiongPROMS code Units
NoComp Number of components no_components
PhysProp Physical property FO Phys_prop
b. Variables
Symbol DefinitiongPROMS code Units
F Molar flowrate molar_flowrate Kmol s-1
XiComponent 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 calculationsb. the reactive mixture, c. the conditions (F, Xi, 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 40 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 includedConfiguration hp,, Q (Assigned)
Reaction data NoReac, aij, ij, kj,0, EAj, ΔHj
InitialV (Initial), Xi (i=1…NoComp-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 sessionsb. 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
already been definedd. 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 outletConnection type material materialDirection inlet outletDimensionality scalar scalar Port set flow flow
Page 41 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 model’s 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
Configure a 2D plot to display the temperature evolution with time
Page 42 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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 43 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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:
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 44 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
a. select your project and click on the right mouse button,b. select “properties” in the pop-up menuc. click on the “Cross-references” tab, andd. 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:
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 specificationsb. 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 46 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Things to do1. 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 models3. Fill in the specification dialogs of all the UNITs in the topology:
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
specificationsb. type the SCHEDULE section
SCHEDULE CONTINUE FOR 10000
Run a simulation activity and create model reports and stream tables on the results.
Page 49 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Operating procedures
Hands-on Session OP1Modelling and simulation of a batch reactor operating procedure
Problem descriptionWe want to simulate a batch cycle for an isothermal liquid-phase batch reactor used to carry out the following reaction:
Process schematic
Key modelling assumptions
The tank is well-stirred. The operation is isothermal.
Page 50 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Mathematical model
Component mass balance
where subscript k is the number of input to the isothermal liquid-phase batch reactor.
Reaction rates
Total volume & total holdup
Component concentrations & molar fractions
Calculation of liquid level in the tank
Characterisation of the output flowrate
where Vp is the valve position.
Page 51 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Data 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 m2. 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 (Vp = 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 m3. 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 m3. 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 do1. Open the template project file OP1_batch_template.gPJ and save it under a new name. (The
mathematical equations outlined in the Mathematical Model Section had already been 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 for such a reactor. Your TASK should take as parameters: 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 valve for such a reactor. Your TASK should take as parameters: 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.
Page 52 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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.
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 53 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
Simple Foreign Objects and Foreign Processes in gPROMS
Hands-on Session FO:
Using Excel Foreign Object and Process (MS-ExcelTM)
Problem descriptionWe 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
DataThe 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 do1. 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 54 2009Process Systems Enterprise
Advanced Process Modelling in gPROMS
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.
Page 55 2009Process Systems Enterprise
gPROMS model developer course
Steady state modelling with gPROMS
Hands-on Session SSM1
Steady state simulation of a catalytic tubular reactor
Problem descriptionWe 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 do1. 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.
Page 56 2009Process Systems Enterprise
gPROMS model developer course
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 Péclet 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 Péclet number is defined as the ratio between advection and diffusion: ).