This example extends example V for connectors. But instead of simply connecting the three equation systems for condenser, trays, and reboiler, we save them as units and then connect them with streams.
Model description
The model is discussed in Use of Connectors V – Connecting Condenser, Trays, and Reboiler with Different Naming Policies and will therefore not be repeated here.
Modeling workflow
To make things easier, we use the same notation, parameter list, equations, and functions as in the example linked above. However, the use of ports requires us to define an interface and new connectors for these ports. As the tray system has four stream connections for ingoing and outgoing streams, and reboiler and condenser both have two, we need a total of eight connectors. This is a significant overhead. Therefore, using ports and streams is not recommended if a single user wants to solve an equation system. It might, however, be of advantage if you collaborate with others and everyone is working on an individual unit. Then, you can just agree on the generic information that is exchanged via ports.
- Notation ID: 185711
- Parameter list ID: 185740
- Condenser equation IDs: 185724, 185725, 185726, 185727, 185728, 185752, 185729, and 185730
- Tray equation IDs: 185712, 185714, 185715, 185716, 185717, 185718, 185719, 185720, and 185721
- Reboiler equation IDs: 185733, 185734, 185735, 185736, 185737, 185738, and 185739
- Functions IDs: 185741, 185742, and 185743
Notation for stream interface
In addition to the notation of the units, we specify a notation for the stream interface with the following symbols:
Base names
- , mole flow in mol/s
- , molar enthalpy in kJ/mol
- , pressure in bar
- , mole fraction in mol/mol
Indices
- , component index 1…NC
The resulting notation has ID 185768.
Interface
Go to the Interface tab and create a new interface by taking the following steps:
- Set the stream notation you just created as Notation
- Set a description for the interface
- Add variables, i.e., for mole flow, for enthalpy, for pressure, and for mole fractions
- Leave “in/out” as is because streams have no direction
- Leave “Dim” as is. The mole fraction should be automatically set to Dim “Vector”
- Save the interface
Connectors
We now set up the eight connectors for the eight ports. For this purpose, go to the Connector tab and do the following:
- Add a helpful description for the connector, e.g., connector inlet condenser
- Activate the tab Edit Matching, select the notation of the units as Sub Notation and the stream notation created in this example as super notation
- Create the following variables for the Sub Notation:
- Create the following variables for the Super Notation:
- Match the variables accordingly and save the connector
- Click on “Break all connections” below the bin. This puts all variables back in the columns on the left side
- Rename the variables in the Sub Notation to
- Update the connector description, match the variables, and save this second connector
- Repeat steps 6-8 for the following variable sets in the Sub Notation:
- , , ,
- , , ,
- , , ,
- , , ,
- , , ,
- , , ,
The connectors are available with IDs 185770 and 185771 (condenser), 185772-185775 (trays), and 185776 and 185777 (reboiler).
Equation systems
To construct the units from the equation systems of condenser, trays, and reboiler, go to the Equation System tab and take the following steps:
Condenser system
- Load the notation and add a reasonable description
- Click on “Add EQU/EQS” and add the equation system of the condenser (ID 185744)
- Make sure that the Naming policy is integrate
- Go to the tab Flowsheeting and then to the tab External Ports
- Click on “+ Port”, select Direction “in”, give the port a helpful name, load the interface created above and select the connector for the condenser inlet. Then click on “Check Port Configuration” and then on “Confirm”
- Add a second port with Direction “out” and the connector for the condenser outlet
- Save this equation system as unit
Tray system
- Load the notation and add a reasonable description
- Click on “Add EQU/EQS” and add the equation system of the trays (ID 185745)
- Make sure that the Naming policy is integrate
- Go to the tab Flowsheeting and then to the tab External Ports
- Click on “+ Port”, select Direction “in”, give the port a helpful name, load the interface created above and select the connector for the liquid inlet of the trays. Then click on “Check Port Configuration” and then on “Confirm”
- Add a second port with Direction “out” and the connector for the liquid outlet of the trays
- Add a third port with Direction “in” and the connector for the vapor inlet of the trays
- Add a fourth port with Direction “out” and the connector for the vapor outlet of the trays
- Save this equation system as unit
Reboiler system
- Load the notation and add a reasonable description
- Click on “Add EQU/EQS” and add the equation system of the reboiler (ID 185746)
- Make sure that the Naming policy is integrate
- Go to the tab Flowsheeting and then to the tab External Ports
- Click on “+ Port”, select Direction “in”, give the port a helpful name, load the interface created above and select the connector for the reboiler inlet. Then click on “Check Port Configuration” and then on “Confirm”
- Add a second port with Direction “out” and the connector for the reboiler outlet
- Save this equation system as unit
The equation systems of the three units have the IDs 185778, 185779, and 185780.
Flowsheet
To combine the three sub-systems, click on “New” and do as follows:
- Load the notation and add a reasonable description
- Add the three units with naming policy integrate; once added, the naming policy has automatically switched to streams
- Go to the tab Flowsheeting and then to the tab Internal Streams
- Add a stream by clicking on “+ Stream” at the bottom right corner.
- Load the interface created above, then click on “Port 1” and select the equation system of the tray unit; select the vapor outlet port and confirm. Then click on “Port 2” and select the condenser unit; select the condenser inlet port. Give the stream a helpful name, e.g., Trays2Condenser, click on “Check Stream Connection” and then confirm
- Repeat these steps for the other three connections, i.e., condenser to liquid inlet of the trays, liquid outlet of the trays to reboiler, and reboiler to vapor inlet of the trays
- Save the flowsheet as equation system
- Go to the tab Preview and click on “Update Preview”. In the tab Flowsheeting, you can now go to the tab Visualization and click on “Print Unit(s)”. You should now see your flowsheet
Simulation workflow
Equation system and Indexing
Go to the “Simulation” section and do the following:
- Load your equation system containing the flowsheet in the tab Equation System
- Set the maximum value NC to 2 for all indices and the maximum value NTR to 10 for all in the tab Indexing
Initialization and results
If you scroll through the variables, you will see that three namespaces were created: e0e0 for the condenser variables, e0e1 for the tray variables, and e0e2 for the reboiler variables. In addition, the streams have also received their namespaces, i.e., e0s0, e0s1, e0s2, and e0s3. To initialize and specify the model, we now proceed as shown in the example V for connectors:
- Click on Import Values
- Select a language specificator, e.g., Matlab NLE
- Select SpecList as Source and load the variable specification from above (ID: 185751)
- Select “Match Namespaces” and “Import Classification”
- Selecting Match Namespaces adds a second tab. Go to this tab and remove all lines by clicking on “Delete Match” at the bottom right corner
- Click on “+ Match” and enter the namespace e0
- You can now select three namespaces on the right side in the column System
- Select the namespace e0 on the right side and click on “Test Import”. You will now see which variables will be changed if you import them. Close this window and click on “Import”.
- Repeat this step by changing the namespace in the system to e0e0 (test import and then import), e0e1, and e0e2 (test import and then import)
- The stream variables cannot be initialized this way, as they have not only different namespaces, but also different variable names (, , , and ). Hence, you need to initialize them by hand
- When you import the classifications correctly, you will have one degree of freedom left. This is because the condenser pressure is no longer part of the equation system as it is now a stream variable in namespace e0s1. Therefore, select the pressure in this namespace as design value
- Your whole system should now be initialized in the same way as the simulation with the naming policy integrate and have a degree of freedom equal to zero
- Save the variable specification
- Go to the parameter specification and import the parameters the same way as for the variable specification because the parameters also appear in different namespaces now, i.e., import the values from the parameter specification with ID 185753 to the three namespaces e0e0, e0e1, and e0e2
- Save the parameter specification
- Save the simulation
- Go to the Evaluation tab and generate the code for your preferred environment
- Solve the system using the generated code
This simulation is available with ID 185785 with variable specification 185786 and parameter specification 185803. The solution for all iteration variables can be found in Use of Connectors V – Connecting Condenser, Trays, and Reboiler with Different Naming Policies. Note that the name spaces are different for the example at hand.