Use of Ports and Streams II – Using Streams to Connect Units

In this section the flash created in the third example for functions is used twice to assemble a flowsheet that is connected via ports and streams.

Workflow

Notation of flowsheet

First, we need to define the notation of the flowsheet, which will be used for our ports and streams. Use the following base names and indices:

Base names
  • F, stream in kmol/h 
  • z_i, mole fraction in mol/mol
Indices
  • i, component index 1..NI
  • c, component index 1…NC (this should not be required, but there seems to be a bug at the moment)

The resulting notation has ID 182828.

Interface for ports and streams

Go to the Interface tab and take the following steps:

  1. Load the notation created above
  2. Click on “+ Field Name” and add the variable S, name it “Stream” with Dim Scalar and activate In/Out
  3. Click on “+Field Name” and add the variable z_i, name it “Composition” with Dim Vector and activate In/Out
  4. Save the interface

The interface is available with ID 182823.

Connectors for inlet and outlet port

Go to the Connector tab and proceed as follows:

  1. Load the notation from the example “Use of Functions III – Parameter Lists and Indices” as Sub Notation
  2. Load the flowsheet notation created above as Super Notation
  3. Add the variables F and z_c as variables in the Sub Notation
  4. Add the variables S and z_i as variables in the Super Notation
  5. Match F and S, then match z_c and z_i
  6. Save the connector for the inlet port
  7. Repeat these steps with the variables L and x_c (Sub Notation) and S and z_i (Super Notation)
  8. Save this connector for the outlet port

Both connectors are available with IDs 182824 and 182825.

Equation system and ports

Go to the Equation System tab and take the steps explained below:

  1. Load the equation system from the example “Use of Functions III – Parameter Lists and Indices”
  2. Add a reasonable description
  3. Go to the Flowsheeting tab and then to the External Ports tab
  4. Click on “+ Port”, add the Name “Inlet”, select the interface and connector for the inlet created above
  5. Click on “Check Port Configuration” and then on “Confirm”
  6. Click on “+ Port” again, change Direction to “out”, add the Name “Outlet”, select the same interface and then the created outlet connector
  7. Click on “Check Port Configuration” and then on “Confirm”
  8. Save the equation system; recommendation: save it with “unit” in the filename as you have just created a unit with an inlet and an outlet port
  9. Go to the Flowsheeting tab and click on “Print Unit(s)”. You can now see the unit you created with an inlet and an outlet port

The equation system of the unit is available with ID 182826.

Flowsheet

Click on “New” in the Equation system tab and do as follows:

  1. Load the flowsheet notation
  2. Add a reasonable description
  3. Add the flash unit you just saved twice
  4. Go to the Flowsheeting tab and then to the Internal Streams
  5. Click on “+ Stream” and load the interface from above
  6. Click on “Port 1”, which will open a popup window. Select the equation system with Id “0” and select the output port at the bottom of the window; confirm
  7. Click on “Port “, which will again open a popup window. Select the equation system with Id “1” and select the inlet port at the bottom of the window; confirm
  8. Click on “Check Stream Connection” and then on “Confirm”
  9. Save the equation system; recommendation: save it with “flowsheet” in the filename
  10. Go to the tab Visualization and click on “Print Unit(s)”. You can now see the connections between your two flash units

The equation system is available with ID 182827.

Evaluation / Simulation

Next, we can move to the “Simulation” section and load the flowsheet we just created. Then, take the following steps:

  1. Add a description for your simulation
  2. In the tab on the Generic System and load your flowsheet
  3. In the Indexing tab, enter 2 as Max Value for all appearing indices and then click on “Confirm Index Data”
  4. Go to the Specifications tab and assign the following variables as design values:
    • S from the namespace >Inlet e0p1
    • P in the namespaces e0e0 and e0e1
    • T in the namespaces e0e0 and e0e1
    • z_{i=1} in the namespace >Inlet e0p1
    • z_{i=2} in the namespace >Inlet e0p1
  5. Assign the remaining variables as iteration values (except of course for the calculated values, i.e., the vapor pressures)

Initialization and results

To initialize and specify the model, take the following steps:

  1. Initialize this example with the design values and initial guesses given in Table 1
  2. Save the variable specification 
  3. Enter the parameter values given in Table 1 for both namespaces
  4. Save the parameter specification
  5. Save the simulation
  6. Go to the Evaluation tab and generate the code for your preferred environment / software package
  7. Simulate the flash

This simulation is available with ID 182828 with variable specification 182829 and parameter specification 182831. The solution for all iteration variables is also given in Table 1.

NameDescriptionValue / Initial guessSolutions
SFeed mole flow in kmol/h in namespace e0p11.0
PPressure in Pa in namespace e0e0101325
PPressure in Pa in namespace e0e180000
TTemperature in K in namespaces e0e0 and e0e1354.6
z_{i=1}Feed mole fraction of component 1 in mol/mol in namespace e0p10.5
z_{i=2}Feed mole fraction of component 2 in mol/mol in namespace e0p10.5
A_{c=1}Parameter in DIPPR equation in namespaces e0e0 and e0e182.718 
B_{c=1}Parameter in DIPPR equation in namespaces e0e0 and e0e1-6904.5 
C_{c=1}Parameter in DIPPR equation in namespaces e0e0 and e0e1-8.8622 
D_{c=1}Parameter in DIPPR equation in namespaces e0e0 and e0e17.4664E-6 
E_{c=1}Parameter in DIPPR equation in namespaces e0e0 and e0e12.0 
A_{c=2}Parameter in DIPPR equation in namespaces e0e0 and e0e173.649 
B_{c=2}Parameter in DIPPR equation in namespaces e0e0 and e0e1-7258.2 
C_{c=2}Parameter in DIPPR equation in namespaces e0e0 and e0e1-7.3037 
D_{c=2}Parameter in DIPPR equation in namespaces e0e0 and e0e14.1653E-6 
E_{c=2}Parameter in DIPPR equation in namespaces e0e0 and e0e12.0 
P_{c=1}^{LV}Calculated vapor pressure of component 1 in Pa in namespaces e0e0 and e0e1190176.44
P_{c=1}^{LV}Calculated vapor pressure of component 2 in Pa in namespaces e0e0 and e0e150216.55
SLiquid mole flow in kmol/h in namespaces s0 and e0p20.50.579 / 0.278
VVapor mole flow in kmol/h in namespaces e0e0 and e0e10.50.421 / 0.300
z_{i=1}Liquid mole fraction of component 1 in mol/mol in namespaces e0s0 and e0p20.50.365 / 0.213
z_{i=2}Liquid mole fraction of component 2 in mol/mol in namespaces e0s0 and e0p20.50.635 / 0.787
y_{c=1}Vapor mole fraction of component 1 in mol/mol in namespaces e0s0 and e0e10.50.685 / 0.506
y_{c=2}Vapor mole fraction of component 2 in mol/mol in namespaces e0s0 and e0e10.50.315 / 0.494
Table 1: Overview of parameter values, initial guesses, and the solution.