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
- , stream in kmol/h
- , mole fraction in mol/mol
Indices
- , component index 1..NI
- , 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:
- Load the notation created above
- Click on “+ Field Name” and add the variable , name it “Stream” with Dim Scalar and activate In/Out
- Click on “+Field Name” and add the variable , name it “Composition” with Dim Vector and activate In/Out
- 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:
- Load the notation from the example “Use of Functions III – Parameter Lists and Indices” as Sub Notation
- Load the flowsheet notation created above as Super Notation
- Add the variables and as variables in the Sub Notation
- Add the variables and as variables in the Super Notation
- Match and , then match and
- Save the connector for the inlet port
- Repeat these steps with the variables and (Sub Notation) and and (Super Notation)
- 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:
- Load the equation system from the example “Use of Functions III – Parameter Lists and Indices”
- Add a reasonable description
- Go to the Flowsheeting tab and then to the External Ports tab
- Click on “+ Port”, add the Name “Inlet”, select the interface and connector for the inlet created above
- Click on “Check Port Configuration” and then on “Confirm”
- Click on “+ Port” again, change Direction to “out”, add the Name “Outlet”, select the same interface and then the created outlet connector
- Click on “Check Port Configuration” and then on “Confirm”
- 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
- 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:
- Load the flowsheet notation
- Add a reasonable description
- Add the flash unit you just saved twice
- Go to the Flowsheeting tab and then to the Internal Streams
- Click on “+ Stream” and load the interface from above
- 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
- 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
- Click on “Check Stream Connection” and then on “Confirm”
- Save the equation system; recommendation: save it with “flowsheet” in the filename
- 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:
- Add a description for your simulation
- In the tab on the Generic System and load your flowsheet
- In the Indexing tab, enter 2 as Max Value for all appearing indices and then click on “Confirm Index Data”
- Go to the Specifications tab and assign the following variables as design values:
- from the namespace >Inlet e0p1
- in the namespaces e0e0 and e0e1
- in the namespaces e0e0 and e0e1
- in the namespace >Inlet e0p1
- in the namespace >Inlet e0p1
- 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:
- Initialize this example with the design values and initial guesses given in Table 1
- Save the variable specification
- Enter the parameter values given in Table 1 for both namespaces
- Save the parameter specification
- Save the simulation
- Go to the Evaluation tab and generate the code for your preferred environment / software package
- 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.
Name | Description | Value / Initial guess | Solutions |
---|---|---|---|
Feed mole flow in kmol/h in namespace e0p1 | 1.0 | ||
Pressure in Pa in namespace e0e0 | 101325 | ||
Pressure in Pa in namespace e0e1 | 80000 | ||
Temperature in K in namespaces e0e0 and e0e1 | 354.6 | ||
Feed mole fraction of component 1 in mol/mol in namespace e0p1 | 0.5 | ||
Feed mole fraction of component 2 in mol/mol in namespace e0p1 | 0.5 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | 82.718 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | -6904.5 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | -8.8622 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | 7.4664E-6 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | 2.0 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | 73.649 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | -7258.2 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | -7.3037 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | 4.1653E-6 | ||
Parameter in DIPPR equation in namespaces e0e0 and e0e1 | 2.0 | ||
Calculated vapor pressure of component 1 in Pa in namespaces e0e0 and e0e1 | 190176.44 | ||
Calculated vapor pressure of component 2 in Pa in namespaces e0e0 and e0e1 | 50216.55 | ||
Liquid mole flow in kmol/h in namespaces s0 and e0p2 | 0.5 | 0.579 / 0.278 | |
Vapor mole flow in kmol/h in namespaces e0e0 and e0e1 | 0.5 | 0.421 / 0.300 | |
Liquid mole fraction of component 1 in mol/mol in namespaces e0s0 and e0p2 | 0.5 | 0.365 / 0.213 | |
Liquid mole fraction of component 2 in mol/mol in namespaces e0s0 and e0p2 | 0.5 | 0.635 / 0.787 | |
Vapor mole fraction of component 1 in mol/mol in namespaces e0s0 and e0e1 | 0.5 | 0.685 / 0.506 | |
Vapor mole fraction of component 2 in mol/mol in namespaces e0s0 and e0e1 | 0.5 | 0.315 / 0.494 |