Hda Flowsheet Solution¶
HDA Flowsheet Simulation and Optimization¶
- Construct a steady-state flowsheet using the IDAES unit model library
- Connecting unit models in a flowsheet using Arcs
- Using the SequentialDecomposition tool to initialize a flowsheet with recycle
- Fomulate and solve an optimization problem
- Defining an objective function
- Setting variable bounds
- Adding additional constraints
Hydrodealkylation is a chemical reaction that often involves reacting an aromatic hydrocarbon in the presence of hydrogen gas to form a simpler aromatic hydrocarbon devoid of functional groups. In this example, toluene will be reacted with hydrogen gas at high temperatures to form benzene via the following reaction:
C6H5CH3 + H2 → C6H6 + CH4
This reaction is often accompanied by an equilibrium side reaction which forms diphenyl, which we will neglect for this example.
This example is based on the 1967 AIChE Student Contest problem as present by Douglas, J.M., Chemical Design of Chemical Processes, 1988, McGraw-Hill.
The flowsheet that we will be using for this module is shown below with the stream conditions. We will be processing toluene and hydrogen to produce at least 370 TPY of benzene. As shown in the flowsheet, there are two flash tanks, F101 to separate out the non-condensibles and F102 to further separate the benzene-toluene mixture to improve the benzene purity. Note that typically a distillation column is required to obtain high purity benzene but that is beyond the scope of this workshop. The non-condensibles separated out in F101 will be partially recycled back to M101 and the rest will be either purged or combusted for power generation.We will assume ideal gas for this flowsheet. The properties required for this module are available in the same directory:
The state variables chosen for the property package are flows of component by phase, temperature and pressure. The components considered are: toluene, hydrogen, benzene and methane. Therefore, every stream has 8 flow variables, 1 temperature and 1 pressure variable.
Importing required pyomo and idaes components¶
To construct a flowsheet, we will need several components from the pyomo and idaes package. Let us first import the following components from Pyomo:
- Constraint (to write constraints)
- Var (to declare variables)
- ConcreteModel (to create the concrete model object)
- Expression (to evaluate values as a function of variables defined in the model)
- Objective (to define an objective function for optimization)
- SolverFactory (to solve the problem)
- TransformationFactory (to apply certain transformations)
- Arc (to connect two unit models)
- SequentialDecomposition (to initialize the flowsheet in a sequential mode)
For further details on these components, please refer to the pyomo documentation: https://pyomo.readthedocs.io/en/latest/
from pyomo.environ import (Constraint, Var, ConcreteModel, Expression, Objective, SolverFactory, TransformationFactory, value) from pyomo.network import Arc, SequentialDecomposition
From idaes, we will be needing the FlowsheetBlock and the following unit models:
- Separator (splitter)
from idaes.core import FlowsheetBlock
from idaes.models.unit_models import (PressureChanger, Mixer, Separator as Splitter, Heater, StoichiometricReactor)
#Todo: import flash model from idaes.models.unit_models from idaes.models.unit_models import Flash
We will also be needing some utility tools to put together the flowsheet and calculate the degrees of freedom.
from idaes.models.unit_models.pressure_changer import ThermodynamicAssumption from idaes.core.util.model_statistics import degrees_of_freedom # Import idaes logger to set output levels import idaes.logger as idaeslog
Importing required thermo and reaction package¶
The final set of imports are to import the thermo and reaction package for the HDA process. We have created a custom thermo package that assumes Ideal Gas with support for VLE.
The reaction package here is very simple as we will be using only a StochiometricReactor and the reaction package consists of the stochiometric coefficients for the reaction and the parameter for the heat of reaction.
Let us import the following modules and they are in the same directory as this jupyter notebook:
- hda_ideal_VLE as thermo_props
- hda_reaction as reaction_props