# Module 2 Flowsheet Solution:¶

Module_2_Flowsheet_Solution

## Learning outcomes¶

• 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

## Problem Statement¶

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 is available in the same directory:

• hda_ideal_VLE.py
• hda_reaction.py

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/

In [1]:
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:

• Mixer
• Heater
• StoichiometricReactor
• **Flash**
• Separator (splitter)
• PressureChanger
In [2]:
from idaes.core import FlowsheetBlock

In [3]:
from idaes.unit_models import (PressureChanger,
Mixer,
Separator as Splitter,
Heater,
StoichiometricReactor)

Inline Exercise: Now, import the remaining unit models highlighted in blue above and run the cell using Shift+Enter after typing in the code.
In [4]:
from idaes.unit_models import Flash


We will also be needing some utility tools to put together the flowsheet and calculate the degrees of freedom.

In [5]:
from idaes.unit_models.pressure_changer import ThermodynamicAssumption
from idaes.core.util.model_statistics import degrees_of_freedom


## 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 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
</div>
In [6]:
import hda_ideal_VLE as thermo_props
import hda_reaction as reaction_props


## Constructing the Flowsheet¶

We have now imported all the components, unit models, and property modules we need to construct a flowsheet. Let us create a ConcreteModel and add the flowsheet block as we did in module 1.

In [7]:
m = ConcreteModel()
m.fs = FlowsheetBlock(default={"dynamic": False})


We now need to add the property packages to the flowsheet. Unlike Module 1, where we only had a thermo property package, for this flowsheet we will also need to add a reaction property package.

In [8]:
m.fs.thermo_params = thermo_props.HDAParameterBlock()
m.fs.reaction_params = reaction_props.HDAReactionParameterBlock(
default={"property_package": m.fs.thermo_params})


Let us start adding the unit models we have imported to the flowsheet. Here, we are adding the Mixer (assigned a name M101) and a Heater (assigned a name H101). Note that, all unit models need to be given a property package argument. In addition to that, there are several arguments depending on the unit model, please refer to the documentation for more details (https://idaes-pse.readthedocs.io/en/latest/models/index.html). For example, the Mixer unit model here is given a list consisting of names to the three inlets.

In [9]:
m.fs.M101 = Mixer(default={"property_package": m.fs.thermo_params,
"inlet_list": ["toluene_feed", "hydrogen_feed", "vapor_recycle"]})

m.fs.H101 = Heater(default={"property_package": m.fs.thermo_params,
"has_pressure_change": False,
"has_phase_equilibrium": True})

Inline Exercise: Let us now add the StoichiometricReactor(assign the name R101) and pass the following arguments:
• "property_package": m.fs.thermo_params
• "reaction_package": m.fs.reaction_params
• "has_heat_of_reaction": True
• "has_heat_transfer": True
• "has_pressure_change": False
In [10]:
m.fs.R101 = StoichiometricReactor(
default={"property_package": m.fs.thermo_params,
"reaction_package": m.fs.reaction_params,
"has_heat_of_reaction": True,
"has_heat_transfer": True,
"has_pressure_change": False})


Let us now add the Flash(assign the name F101) and pass the following arguments:

• "property_package": m.fs.thermo_params
• "has_heat_transfer": True
• "has_pressure_change": False
In [11]:
m.fs.F101 = Flash(default={"property_package": m.fs.thermo_params,
"has_heat_transfer": True,
"has_pressure_change": True})


Let us now add the Splitter(S101), PressureChanger(C101) and the second Flash(F102).

In [12]:
m.fs.S101 = Splitter(default={"property_package": m.fs.thermo_params,
"ideal_separation": False,
"outlet_list": ["purge", "recycle"]})

m.fs.C101 = PressureChanger(default={
"property_package": m.fs.thermo_params,
"compressor": True,
"thermodynamic_assumption": ThermodynamicAssumption.isothermal})

m.fs.F102 = Flash(default={"property_package": m.fs.thermo_params,
"has_heat_transfer": True,
"has_pressure_change": True})


## Connecting Unit Models using Arcs¶

We have now added all the unit models we need to the flowsheet. However, we have not yet specifed how the units are to be connected. To do this, we will be using the Arc which is a pyomo component that takes in two arguments: source and destination. Let us connect the outlet of the mixer(M101) to the inlet of the heater(H101).

In [13]:
m.fs.s03 = Arc(source=m.fs.M101.outlet, destination=m.fs.H101.inlet)


Inline Exercise: Now, connect the H101 outlet to the R101 inlet using the cell above as a guide.
In [14]:
m.fs.s04 = Arc(source=m.fs.H101.outlet, destination=m.fs.R101.inlet)


We will now be connecting the rest of the flowsheet as shown below. Notice how the outlet names are different for the flash tanks F101 and F102 as they have a vapor and a liquid outlet.

In [15]:
m.fs.s05 = Arc(source=m.fs.R101.outlet, destination=m.fs.F101.inlet)
m.fs.s06 = Arc(source=m.fs.F101.vap_outlet, destination=m.fs.S101.inlet)
m.fs.s08 = Arc(source=m.fs.S101.recycle, destination=m.fs.C101.inlet)
m.fs.s09 = Arc(source=m.fs.C101.outlet,
destination=m.fs.M101.vapor_recycle)
m.fs.s10 = Arc(source=m.fs.F101.liq_outlet, destination=m.fs.F102.inlet)


We have now connected the unit model block using the arcs. However, each of these arcs link to ports on the two unit models that are connected. In this case, the ports consist of the state variables that need to be linked between the unit models. Pyomo provides a convenient method to write these equality constraints for us between two ports and this is done as follows:

In [16]:
TransformationFactory("network.expand_arcs").apply_to(m)


## Adding expressions to compute purity and operating costs¶

In this section, we will add a few Expressions that allows us to evaluate the performance. Expressions provide a convenient way of calculating certain values that are a function of the variables defined in the model. For more details on Expressions, please refer to: https://pyomo.readthedocs.io/en/latest/pyomo_modeling_components/Expressions.html

For this flowsheet, we are interested in computing the purity of the product Benzene stream (i.e. the mole fraction) and the operating cost which is a sum of the cooling and heating cost.

Let us first add an Expression to compute the mole fraction of benzene in the vap_outlet of F102 which is our product stream. Please note that the var flow_mol_phase_comp has the index - [time, phase, component]. As this is a steady-state flowsheet, the time index by default is 0. The valid phases are ["Liq", "Vap"]. Similarly the valid component list is ["benzene", "toluene", "hydrogen", "methane"].

In [17]:
m.fs.purity = Expression(
expr=m.fs.F102.vap_outlet.flow_mol_phase_comp[0, "Vap", "benzene"] /
(m.fs.F102.vap_outlet.flow_mol_phase_comp[0, "Vap", "benzene"]
+ m.fs.F102.vap_outlet.flow_mol_phase_comp[0, "Vap", "toluene"]))



operating cost = $419122.3387677945  For this operating cost, what is the amount of benzene we are able to produce and what purity we are able to achieve? In [39]: m.fs.F102.report() print() print('benzene purity = ', value(m.fs.purity))  ==================================================================================== Unit : fs.F102 Time: 0.0 ------------------------------------------------------------------------------------ Unit Performance Variables: Key : Value : Fixed : Bounds Heat Duty : 7352.5 : False : (None, None) Pressure Change : -2.0000e+05 : True : (None, None) ------------------------------------------------------------------------------------ Stream Table Inlet Vapor Outlet Liquid Outlet flow_mol_phase_comp ('Liq', 'benzene') 0.20460 1.0000e-08 0.062620 flow_mol_phase_comp ('Liq', 'hydrogen') 2.6712e-07 1.0000e-08 9.4877e-08 flow_mol_phase_comp ('Liq', 'methane') 2.6712e-07 1.0000e-08 9.4877e-08 flow_mol_phase_comp ('Liq', 'toluene') 0.062520 1.0000e-08 0.032257 flow_mol_phase_comp ('Vap', 'benzene') 1.0000e-08 0.14198 1.0000e-08 flow_mol_phase_comp ('Vap', 'hydrogen') 1.0000e-08 1.8224e-07 1.0000e-08 flow_mol_phase_comp ('Vap', 'methane') 1.0000e-08 1.8224e-07 1.0000e-08 flow_mol_phase_comp ('Vap', 'toluene') 1.0000e-08 0.030264 1.0000e-08 pressure 3.5000e+05 1.5000e+05 1.5000e+05 temperature 325.00 375.00 375.00 ==================================================================================== benzene purity = 0.8242962943918918  Next, let's look at how much benzene we are loosing with the light gases out of F101. IDAES has tools for creating stream tables based on the Arcs and/or Ports in a flowsheet. Let us create and print a simple stream table showing the stream leaving the reactor and the vapor stream from F101. Inline Exercise: How much benzene are we loosing in the F101 vapor outlet stream? In [40]: from idaes.core.util.tables import create_stream_table_dataframe, stream_table_dataframe_to_string st = create_stream_table_dataframe({"Reactor": m.fs.s05, "Light Gases": m.fs.s06}) print(stream_table_dataframe_to_string(st))   Reactor Light Gases flow_mol_phase_comp ('Liq', 'benzene') 1.2993e-07 1.0000e-08 flow_mol_phase_comp ('Liq', 'hydrogen') 1.0000e-08 1.0000e-08 flow_mol_phase_comp ('Liq', 'methane') 1.0000e-08 1.0000e-08 flow_mol_phase_comp ('Liq', 'toluene') 8.4147e-07 1.0000e-08 flow_mol_phase_comp ('Vap', 'benzene') 0.35374 0.14915 flow_mol_phase_comp ('Vap', 'hydrogen') 0.32821 0.32821 flow_mol_phase_comp ('Vap', 'methane') 1.2721 1.2721 flow_mol_phase_comp ('Vap', 'toluene') 0.078129 0.015610 pressure 3.5000e+05 3.5000e+05 temperature 771.85 325.00  Inline Exercise: You can querry additional variables here if you like. Use Shift+Enter to run the cell once you have typed in your code. ## Optimization¶ We saw from the results above that the total operating cost for the base case was$419,122 per year. We are producing 0.142 mol/s of benzene at a purity of 82\%. However, we are losing around 42\% of benzene in F101 vapor outlet stream.

Let us try to minimize this cost such that:

• we are producing at least 0.15 mol/s of benzene in F102 vapor outlet i.e. our product stream
• purity of benzne i.e. the mole fraction of benzene in F102 vapor outlet is at least 80%
• restricting the benzene loss in F101 vapor outlet to less than 20%

For this problem, our decision variables are as follows:

• H101 outlet temperature
• R101 cooling duty provided
• F101 outlet temperature
• F102 outlet temperature
• F102 deltaP in the flash tank

Let us declare our objective function for this problem.

In [41]:
m.fs.objective = Objective(expr=m.fs.operating_cost)


Now, we need to unfix the decision variables as we had solved a square problem (degrees of freedom = 0) until now.

In [42]:
m.fs.H101.outlet.temperature.unfix()
m.fs.R101.heat_duty.unfix()
m.fs.F101.vap_outlet.temperature.unfix()
m.fs.F102.vap_outlet.temperature.unfix()

Inline Exercise: Let us now unfix the remaining variable which is F102 pressure drop (F102.deltaP) Use Shift+Enter to run the cell once you have typed in your code.
In [43]:
m.fs.F102.deltaP.unfix()


Next, we need to set bounds on these decision variables to values shown below:

• H101 outlet temperature [500, 600] K
• R101 outlet temperature [600, 800] K
• F101 outlet temperature [298, 450] K
• F102 outlet temperature [298, 450] K
• F102 outlet pressure [105000, 110000] Pa

Let us first set the variable bound for the H101 outlet temperature as shown below:

In [44]:
m.fs.H101.outlet.temperature[0].setlb(500)
m.fs.H101.outlet.temperature[0].setub(600)

Inline Exercise: Now, set the variable bound for the R101 outlet temperature. Use Shift+Enter to run the cell once you have typed in your code.
In [45]:
m.fs.R101.outlet.temperature[0].setlb(600)
m.fs.R101.outlet.temperature[0].setub(800)


Let us fix the bounds for the rest of the decision variables.

In [46]:
m.fs.F101.vap_outlet.temperature[0].setlb(298.0)
m.fs.F101.vap_outlet.temperature[0].setub(450.0)
m.fs.F102.vap_outlet.temperature[0].setlb(298.0)
m.fs.F102.vap_outlet.temperature[0].setub(450.0)
m.fs.F102.vap_outlet.pressure[0].setlb(105000)
m.fs.F102.vap_outlet.pressure[0].setub(110000)


Now, the only things left to define are our constraints on overhead loss in F101, product flow rate and purity in F102. Let us first look at defining a constraint for the overhead loss in F101 where we are restricting the benzene leaving the vapor stream to less than 20 \% of the benzene available in the reactor outlet.

In [47]:
m.fs.overhead_loss = Constraint(
expr=m.fs.F101.vap_outlet.flow_mol_phase_comp[0, "Vap", "benzene"] <=
0.20 * m.fs.R101.outlet.flow_mol_phase_comp[0, "Vap", "benzene"])

Inline Exercise: Now, add the constraint such that we are producing at least 0.15 mol/s of benzene in the product stream which is the vapor outlet of F102. Let us name this constraint as m.fs.product_flow. Use Shift+Enter to run the cell once you have typed in your code.
In [48]:
m.fs.product_flow = Constraint(
expr=m.fs.F102.vap_outlet.flow_mol_phase_comp[0, "Vap", "benzene"] >=
0.15)


Let us add the final constraint on product purity or the mole fraction of benzene in the product stream such that it is at least greater than 80%.

In [49]:
m.fs.product_purity = Constraint(expr=m.fs.purity >= 0.80)


We have now defined the optimization problem and we are now ready to solve this problem.

In [50]:
results = solver.solve(m, tee=True)

Ipopt 3.12.4: tol=1e-06
max_iter=5000

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Eclipse Public License (EPL).
******************************************************************************

This is Ipopt version 3.12.4, running with linear solver ma27.

Number of nonzeros in equality constraint Jacobian...:     1048
Number of nonzeros in inequality constraint Jacobian.:        5
Number of nonzeros in Lagrangian Hessian.............:      901

Total number of variables............................:      343
variables with only lower bounds:        0
variables with lower and upper bounds:      149
variables with only upper bounds:        0
Total number of equality constraints.................:      338
Total number of inequality constraints...............:        3
inequality constraints with only lower bounds:        2
inequality constraints with lower and upper bounds:        0
inequality constraints with only upper bounds:        1

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
0  4.1912234e+05 2.99e+05 6.94e+00  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
1  4.1628396e+05 2.99e+05 6.94e+00  -1.0 4.82e+09    -  1.80e-05 5.83e-06f  1
2  4.1616769e+05 2.99e+05 1.60e+02  -1.0 1.45e+09    -  5.86e-04 1.47e-05f  1
3  4.0783429e+05 2.94e+05 4.85e+02  -1.0 1.35e+09    -  2.61e-04 9.35e-04f  1
4  2.9670827e+05 2.83e+06 6.94e+02  -1.0 4.75e+08    -  7.35e-05 1.50e-03f  1
5  2.9557701e+05 2.82e+06 4.95e+04  -1.0 1.90e+08    -  1.88e-01 1.04e-03f  1
6  2.9452502e+05 2.72e+06 4.63e+05  -1.0 4.40e+07    -  1.88e-01 3.46e-02f  1
7  2.9632753e+05 2.13e+06 4.47e+05  -1.0 1.47e+07    -  7.61e-02 2.19e-01h  1
8  2.9636923e+05 2.12e+06 4.45e+05  -1.0 5.86e+06    -  6.38e-01 3.38e-03h  1
9  2.9647019e+05 2.10e+06 4.42e+05  -1.0 6.53e+06    -  7.25e-01 7.18e-03h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
10  2.9958737e+05 1.63e+06 4.17e+05  -1.0 6.56e+06    -  3.55e-02 2.24e-01h  1
11  3.0436334e+05 9.49e+05 6.96e+05  -1.0 5.55e+06    -  9.46e-01 4.19e-01h  1
12  3.0792618e+05 5.00e+05 4.56e+06  -1.0 4.03e+06    -  9.90e-01 4.73e-01h  1
13  3.0931998e+05 3.46e+05 1.59e+08  -1.0 2.67e+06    -  1.00e+00 3.08e-01h  2
14  3.1261432e+05 5.80e+05 1.20e+11  -1.0 2.00e+06    -  1.00e+00 9.78e-01H  1
15  3.1271509e+05 2.42e+05 8.71e+08  -1.0 1.43e+05    -  1.00e+00 5.84e-01h  1
16  3.1278603e+05 2.73e+03 3.26e+11  -1.0 5.97e+04    -  1.00e+00 9.90e-01h  1
17  3.1278674e+05 1.79e-01 3.96e+09  -1.0 6.18e+02    -  1.00e+00 1.00e+00h  1
18  3.1278674e+05 1.91e-06 3.15e+05  -1.0 5.18e-03    -  1.00e+00 1.00e+00h  1
19  3.1278634e+05 3.47e-05 1.62e+06  -3.8 2.02e+02    -  1.00e+00 1.00e+00f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
20  3.1278634e+05 7.45e-09 1.52e-03  -3.8 1.71e-01    -  1.00e+00 1.00e+00h  1
21  3.1278634e+05 7.45e-09 4.15e+00  -7.0 3.04e-01    -  1.00e+00 1.00e+00f  1
22  3.1278634e+05 7.45e-09 2.61e-05  -7.0 3.93e-07    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 22

(scaled)                 (unscaled)
Objective...............:   3.1278633834102692e+05    3.1278633834102692e+05
Dual infeasibility......:   2.6058325198405561e-05    2.6058325198405561e-05
Constraint violation....:   2.9103830456733704e-11    7.4505805969238281e-09
Complementarity.........:   9.0926527280252916e-08    9.0926527280252916e-08
Overall NLP error.......:   2.0798568651795915e-09    2.6058325198405561e-05

Number of objective function evaluations             = 26
Number of objective gradient evaluations             = 23
Number of equality constraint evaluations            = 26
Number of inequality constraint evaluations          = 26
Number of equality constraint Jacobian evaluations   = 23
Number of inequality constraint Jacobian evaluations = 23
Number of Lagrangian Hessian evaluations             = 22
Total CPU secs in IPOPT (w/o function evaluations)   =      0.021
Total CPU secs in NLP function evaluations           =      0.002

EXIT: Optimal Solution Found.

In [51]:
# For testing purposes
from pyomo.environ import TerminationCondition
assert results.solver.termination_condition == TerminationCondition.optimal


## Optimization Results¶

Display the results and product specifications

In [52]:
print('operating cost = $', value(m.fs.operating_cost)) print() print('Product flow rate and purity in F102') m.fs.F102.report() print() print('benzene purity = ', value(m.fs.purity)) print() print('Overhead loss in F101') m.fs.F101.report()  operating cost =$ 312786.3383410269

Product flow rate and purity in F102

====================================================================================
Unit : fs.F102                                                             Time: 0.0
------------------------------------------------------------------------------------
Unit Performance

Variables:

Key             : Value       : Fixed : Bounds
Heat Duty :      8377.0 : False : (None, None)
Pressure Change : -2.4500e+05 : False : (None, None)

------------------------------------------------------------------------------------
Stream Table
Inlet    Vapor Outlet  Liquid Outlet
flow_mol_phase_comp ('Liq', 'benzene')     0.21743   1.0000e-08      0.067425
flow_mol_phase_comp ('Liq', 'hydrogen') 2.8812e-07   1.0000e-08    1.0493e-07
flow_mol_phase_comp ('Liq', 'methane')  2.8812e-07   1.0000e-08    1.0493e-07
flow_mol_phase_comp ('Liq', 'toluene')    0.070695   1.0000e-08      0.037507
flow_mol_phase_comp ('Vap', 'benzene')  1.0000e-08      0.15000    1.0000e-08
flow_mol_phase_comp ('Vap', 'hydrogen') 1.0000e-08   1.9319e-07    1.0000e-08
flow_mol_phase_comp ('Vap', 'methane')  1.0000e-08   1.9319e-07    1.0000e-08
flow_mol_phase_comp ('Vap', 'toluene')  1.0000e-08     0.033189    1.0000e-08
pressure                                3.5000e+05   1.0500e+05    1.0500e+05
temperature                                 301.88       362.93        362.93
====================================================================================

benzene purity =  0.8188276578112282

====================================================================================
Unit : fs.F101                                                             Time: 0.0
------------------------------------------------------------------------------------
Unit Performance

Variables:

Key             : Value   : Fixed : Bounds
Heat Duty : -56354. : False : (None, None)
Pressure Change :  0.0000 :  True : (None, None)

------------------------------------------------------------------------------------
Stream Table
Inlet    Vapor Outlet  Liquid Outlet
flow_mol_phase_comp ('Liq', 'benzene')  4.3534e-08   1.0000e-08       0.21743
flow_mol_phase_comp ('Liq', 'hydrogen') 1.0000e-08   1.0000e-08    2.8812e-07
flow_mol_phase_comp ('Liq', 'methane')  1.0000e-08   1.0000e-08    2.8812e-07
flow_mol_phase_comp ('Liq', 'toluene')  7.5866e-07   1.0000e-08      0.070695
flow_mol_phase_comp ('Vap', 'benzene')     0.27178     0.054356    1.0000e-08
flow_mol_phase_comp ('Vap', 'hydrogen')    0.35887      0.35887    1.0000e-08
flow_mol_phase_comp ('Vap', 'methane')      1.2414       1.2414    1.0000e-08
flow_mol_phase_comp ('Vap', 'toluene')    0.076085    0.0053908    1.0000e-08
pressure                                3.5000e+05   3.5000e+05    3.5000e+05
temperature                                 696.12       301.88        301.88
====================================================================================


Display optimal values for the decision variables

In [53]:
print('Optimal Values')
print()

print('H101 outlet temperature = ', value(m.fs.H101.outlet.temperature[0]), 'K')

print()
print('R101 outlet temperature = ', value(m.fs.R101.outlet.temperature[0]), 'K')

print()
print('F101 outlet temperature = ', value(m.fs.F101.vap_outlet.temperature[0]), 'K')

print()
print('F102 outlet temperature = ', value(m.fs.F102.vap_outlet.temperature[0]), 'K')
print('F102 outlet pressure = ', value(m.fs.F102.vap_outlet.pressure[0]), 'Pa')

Optimal Values

H101 outlet temperature =  500.0 K

R101 outlet temperature =  696.1161004637527 K

F101 outlet temperature =  301.8784760569282 K

F102 outlet temperature =  362.9347683054898 K
F102 outlet pressure =  105000.0 Pa

In [ ]: