{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "# HDA Flowsheet Simulation and Optimization\n", "\n", "\n", "## Note\n", "\n", "This tutorial will be similar to the HDA flowsheet tutorial in the Tutorials section, except that we use a distillation column instead of a second flash (F102) to produce benzene and toluene products.\n", "\n", "\n", "## Learning outcomes\n", "\n", "\n", "- Construct a steady-state flowsheet using the IDAES unit model library\n", "- Connecting unit models in a flowsheet using Arcs\n", "- Using the SequentialDecomposition tool to initialize a flowsheet with recycle\n", "- Fomulate and solve an optimization problem\n", " - Defining an objective function\n", " - Setting variable bounds\n", " - Adding additional constraints \n", "\n", "\n", "## Problem Statement\n", "\n", "Hydrodealkylation is a chemical reaction that often involves reacting\n", "an aromatic hydrocarbon in the presence of hydrogen gas to form a\n", "simpler aromatic hydrocarbon devoid of functional groups. In this\n", "example, toluene will be reacted with hydrogen gas at high temperatures\n", " to form benzene via the following reaction:\n", "\n", "**C6H5CH3 + H2 → C6H6 + CH4**\n", "\n", "\n", "This reaction is often accompanied by an equilibrium side reaction\n", "which forms diphenyl, which we will neglect for this example.\n", "\n", "This example is based on the 1967 AIChE Student Contest problem as\n", "present by Douglas, J.M., Chemical Design of Chemical Processes, 1988,\n", "McGraw-Hill.\n", "\n", "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, we use a flash tank, F101, to separate out the non-condensibles, and a distillation column, D101, to further separate the benzene-toluene mixture to improve the benzene purity. The non-condensibles separated out in F101 will be partially recycled back to M101 and the rest will be purged. We will assume ideal gas behavior for this flowsheet. The properties required for this module are defined in\n", "\n", "- `hda_ideal_VLE.py`\n", "- `idaes.models.properties.activity_coeff_models.BTX_activity_coeff_VLE`\n", "- `hda_reaction.py`\n", "\n", "We will be using two thermodynamic packages: one (first in the list above) containing all four components (i.e., toluene, hydrogen, benzene, and methane) and the other (second in the list above) containing benzene and toluene only. The latter is needed to simplify the VLE calculations in the distillation column model. \n", "\n", "![](HDA_flowsheet_distillation.png)\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Translator block\n", "\n", "Benzene and toluene are separated by distillation, so the process involves phase equilibrium and two-phase flow conditions. However, the presence of hydrogen and methane complicates the calculations. This is because, hydrogen and methane are non-condensable under all conditions of interest; ergo, a vapor phase will always be present, and the mixture bubble point is extremely low. To simplify the phase equilibrium calculations, hydrogen and methane will be considered completely as non-condensable and insoluble in the liquid outlet from the flash F101.\n", "\n", "Since no hydrogen and methane will be present in the unit operations following the flash, a different component list can be used to simplify the property calculations. IDAES supports the definition of multiple property packages within a single flowsheet via `Translator` blocks. `Translator` blocks convert between different property calculations, component lists, and equations of state. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Importing required pyomo and idaes components\n", "\n", "\n", "To construct a flowsheet, we will need several components from the pyomo and idaes package. Let us first import the following components from Pyomo:\n", "- Constraint (to write constraints)\n", "- Var (to declare variables)\n", "- ConcreteModel (to create the concrete model object)\n", "- Expression (to evaluate values as a function of variables defined in the model)\n", "- Objective (to define an objective function for optimization)\n", "- SolverFactory (to solve the problem)\n", "- TransformationFactory (to apply certain transformations)\n", "- Arc (to connect two unit models)\n", "- SequentialDecomposition (to initialize the flowsheet in a sequential mode)\n", "\n", "For further details on these components, please refer to the pyomo documentation: https://pyomo.readthedocs.io/en/latest/\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pyomo.environ import (Constraint,\n", " Var,\n", " ConcreteModel,\n", " Expression,\n", " Objective,\n", " TransformationFactory,\n", " value)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "