# Use of Connectors V – Connecting Condenser, Trays, and Reboiler with Different Naming Policies

This tutorial demonstrates how to connect a couple of different equation systems to one larger equation for an application in chemical engineering. Here, we have three equation systems for condenser, tray, and reboiler. This example is relatively complex as it features optional elements, such as parameter lists, functions, and connectors. Our goal is to simulate the distillation of water (component 1) and methanol (component 2).

### Model description

In the following, we introduce the model of the three sub-systems. Afterwards, we show the functions calculating the thermodynamic properties liquid molar enthalpy, vapor pressure, and enthalpy of vaporization.

#### Condenser

The condenser model consists of the component balances, the equilibrium (we assume a thermodynamically ideal system), the summation relations for liquid and vapor phase, the energy balance, the momentum balance, the reflux ratio, and the mixing rule for the liquid enthalpy:

#### Trays

The tray model consists of similar equations. In addition, we have the mixing rule for the feed enthalpy, the liquid enthalpy, and the vapor enthalpy. The latter is calculated as sum of liquid enthalpy and enthalpy of vaporization:

#### Reboiler

The reboiler equations also consist of component balances, thermodynamic equilibrium, summation terms, energy balance, and mixing rules for liquid and vapor enthalpy:

#### Functions

Finally, the liquid enthalpy, the vapor pressure, and the enthalpy of vaporization are calculated using DIPPR equations (100, 101, and 106):

### Modeling workflow

In the following, we show the workflow for setting up the equation system with two different naming policies for the variables, i.e., integrate and encapsulate. We start by defining the notation for this example. For the sake of simplicity, we limit ourselves to one notation, but the example would also work with a different notation for each unit.

#### Notation

Set up a notation with the following base names and indices:

##### Base names
• , enthalpy difference in kJ/mol
• , pressure drop in bar
• , parameter
• , bottom product flow in mol/s and parameter
• , parameter
• , distillate flow in mol/s and parameter
• , parameter
• , parameter
• , molar enthalpy in kJ/mol
• , pressure in bar
• , heat flow in kW
• , reflux ratio
• , temperature in K
• , liquid mole fraction in mol/mol
• , vapor mole fraction in mol/mol
##### Superscripts
• f, feed
• h, enthalpy
• in, inlet
• , liquid
• , equilibrium between liquid and vapor
• ref, reference
• , vapor
##### Subscripts
• C, condenser
• d100, DIPPR 100
• d101, DIPPR 101
• d106, DIPPR 106
• product, product
• R, reboiler
• reflux, reflux
##### Indices
• , component index 1…NC
• , tray index 1…NTR

The resulting notation has ID 185711.

#### Parameter list

Go to the parameter list section and add the parameters for the DIPPR equations to the parameter list:

##### DIPPR 100
• , , , , , and
• , , , and
##### DIPPR 106
• , , , , and

Save the parameter lists. The parameter list of this example has ID 185740.

#### Equations

Go to the Equation tab and perform the following steps:

1. Load the notation set up above
2. Enter the equations of condenser, trays, and reboiler and save them

The condenser equations have IDs 185724, 185725, 185726, 185727, 185728, 185752, 185729, and 185730.
The tray equations have IDs 185712, 185714, 185715, 185716, 185717, 185718, 185719, 185720, and 185721.
The reboiler equations have IDs 185733, 185734, 185735, 185736, 185737, 185738, and 185739.

#### Functions

Go to the function tab and do as follows:

1. Load the notation and the parameter list set up above
2. Add a reasonable description
3. Go to the Interface & Body Settings and make sure that Free interface and Specify formula are selected
4. Add as output and as input
5. Add the DIPPR 100 equation as Body Specification
6. Save the function
7. Repeat the steps 1-6 for DIPPR 101 and DIPPR 106 with the outputs and and the input in both cases, respectively

The functions have IDs 185741, 185742, and 185743.

#### Connectors

We could now solve the three systems one by one. However, we cannot connect them as, for example, the liquid flow from the condenser is , whereas the tray model expects the flow . Hence, we need two connectors that translate these variable names. For this purpose, go to the Connector tab and do the following:

1. Add a helpful description for the connector
2. Activate the tab Edit Matching and select the notation of this example as both Sub and Super Notation
3. Generate the missing variables for the Sub Notation and the Super Notation, i.e.,
• Sub Notation: , , , , , , , , and
• Super Notation: , , , , , , , , and
4. Select the analogous variables and click on Match to achieve the following matching:
5. Make sure that the indices were matched by clicking on variable pairs that contain the index
6. Save the connector for the connection of condenser and trays
7. Repeat the steps 1-6 for a second reactor connecting reboiler and trays.
• Therefore, set up the the following variables in sub and super notation:
• Sub Notation: , , , , , , and
• Super Notation: , , , , , , and
• Match these variables as follows:

The connectors are available with IDs 185748 and 185750.

#### Equation systems

To construct the equation systems, go to the Equation System tab and take the following steps.

##### Condenser system
1. Load the notation and add a reasonable description
2. Click on “Add EQU/EQS” and add the equations for the condenser
3. Make sure that the Naming policy is integrate
4. Go to the tab Functions and add the DIPPR 100 function with the applied output variable and the input
5. Make sure that the applied parameter names are , , , , , , and
6. Confirm, then add the DIPPR 101 function with the applied output variable and the input
7. Make that the applied parameter names are , , , , and
8. Save the equation system
##### Tray system
1. Load the notation and add a reasonable description
2. Click on “Add EQU/EQS” and add the equations for the trays
3. Make sure that the Naming policy is integrate
4. Go to the tab Functions and add the DIPPR 100 function with the applied output variables and , and the inputs and , respectively
5. Make that the applied parameter names are , , , , , , and
6. Confirm, then add the DIPPR 101 function with the applied output variable and the input
7. Make that the applied parameter names are , , , , and
8. Confirm, then add the DIPPR 106 function with the applied output variable and the input
9. Make that the applied parameter names are , , , , and , and
10. Save the equation system
##### Reboiler system
1. Load the notation and add a reasonable description
2. Click on “Add EQU/EQS” and add the equations for the reboiler
3. Make sure that the Naming policy is integrate
4. Go to the tab Functions and add the DIPPR 100 function with the applied output variable and the input
5. Make that the applied parameter names are , , , , , , and
6. Confirm, then add the DIPPR 101 function with the applied output variable and the input
7. Make that the applied parameter names are , , , , and
8. Confirm, then add the DIPPR 106 function with the applied output variable and the input
9. Make that the applied parameter names are , , , , and , and
10. Save the equation system

The three equation systems have the IDs 185744, 185745, and 185746.

##### Combined system with naming policy integrate

To combine the three sub-systems, click on “New” and do as follows:

1. Load the notation and add a reasonable description
2. Add the condenser sub-system with naming policy integrate, but also with the prepared connector
3. Add the tray sub-system with naming policy integrate
4. Add the reboiler sub-system with naming policy integrate, but also with the prepared connector
5. Save the equation system
##### Combined system with naming policy encapsulate

To combine the three sub-systems, click on “New” and do as follows:

1. Load the notation and add a reasonable description
2. Add the condenser sub-system with naming policy encapsulate, but also with the prepared connector
3. Add the tray sub-system with naming policy integrate
4. Add the reboiler sub-system with naming policy encapsulate, but also with the prepared connector
5. Save the equation system

### Simulation workflow

#### Equation system and Indexing

##### Equation system and indexing for naming policy integrate

Go to the “Simulation” section and do the following:

1. Load your equation system in the tab Equation System
2. Set the maximum value NC to 2 and the maximum value NTR to 10 in the tab Indexing
##### Equation system and indexing for naming policy encapsulate

Go to the “Simulation” section and do the following:

1. Load your equation system in the tab Equation System
2. Set the maximum value for all NC to 2 and the maximum value for all NTR to 10 in the tab Indexing

#### Initialization and results

##### Potential problems with the naming policy integrate

As you have seen, the naming policy integrate ensures that all variables in the equation system receive the same namespace, i.e., e0. Although everything works out well here, this approach can cause problems: Imagine, you had named the temperature in the condenser and reboiler model “”. Then, these two temperatures would have received the same namespace and would be treated as the same variable. In this example, though, we have given all variables unique names so that this problem does not occur. In general, we recommend the naming policy encapsulate for such applications to avoid equal variable names by accident.

##### Variable and parameter specification for naming policy integrate

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 parameters according to Table 2 and save the parameter specification
4. Save the simulation
5. Go to the Evaluation tab and generate the code for your preferred environment
6. Solve the system using the generated code

This simulation is available with ID 185749 with variable specification 185751 and parameter specification 185753. The solution for all iteration variables is also given in Table 1.

##### Variable and parameter specification for naming policy encapsulate

If you scroll through the variables with this naming policy, you will see that three namespaces were created: e0 for the trays and those variables that are renamed by the connector, e0e0 for the condenser variables, and e0e2 for the reboiler. These names depend on the order in which the sub-systems are included in the equation system. For example, if the tray system would be loaded first, followed by condenser and reboiler system, we would have the namespaces e0, e0e1, and e0e2.

To initialize and specify the model, you could now go through all variables, reassign them as design or iteration variable, and enter their values. This takes time. You could now try instead to naively load the variable specification from above (ID 185751). However, not all variables would be matched because of the different namespaces. Instead, you can do the following:

1. Click on Import Values
2. Select a language specificator, e.g., Matlab NLE
3. Select SpecList as Source and load the variable specification from above (ID: 185751)
4. Select “Match Namespaces” and “Import Classification”
5. 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
6. Click on “+ Match” and enter the namespace e0
7. You can now select three namespaces on the right side in the column System
8. 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”.
9. Repeat this step by changing the namespace in the system to e0e0 (test import and then import) and e0e2 (test import and then import)
10. 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
11. Save the variable specification
12. 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
13. Save the parameter specification
14. Save the simulation
15. Go to the Evaluation tab and generate the code for your preferred environment
16. Solve the system using the generated code

This simulation is available with ID 185755 with variable specification 185756 and parameter specification 185757. The solution for all iteration variables is also given in Table 1.