# Use of Functions III – Parameter Lists and Indices

### Model description

The model consists of very basic flash equations, i.e., the component mole balances, phase equilibria (VLE), and the summation of mole fractions in liquid and vapor phase. The temperature is constant:

Therein, the vapor pressure is to be calculated via a DIPPR equation, which will again be treated as a function:

As the parameters in this functions specify the mixture used in this process, it makes sense to specify them in a parameter list. Thus, we could set up another paramater specification for another mixture and could solve this system with the same variable specification.

### Workflow

#### Notation of equation system

For the notation of the equation, we need to set up the following symbols. Note that we do not define the parameters of the DIPPR equation in a separate notation for simplicity (although it would be possible). However, we will use a parameter list:

##### Base names
• , DIPPR parameter A
• , DIPPR parameter B in K
• , DIPPR parameter C
• , DIPPR parameter D in 1/T^E
• , DIPPR parameter E
• , feed mole flow in kmol/h
• , liquid mole flow in kmol/h
• , pressure in Pa
• , temperature in K
• , vapor mole flow in kmol/h
• , liquid mole fraction in mol/mol
• , vapor mole fraction in mol/mol
• , feed mole fraction in mol/mol
##### Superscripts
• , phase equilibrium
##### Indices
• , component index 1…NC

The resulting notation has ID 182668.

#### Parameter list

After the notation has been set up, we can move to the Parameter List tab. Here, we take the following steps:

1. Load the notation that was created in the previous step
2. Add all parameter by clicking on the “+” button, writing the parameter into the Tex Expression, rendering, and confirming. Add the parameters in their general form, i.e., , , , , and . This is how they will be used in the function. Do not add any component index
3. Save the parameter list

The parameter list is saved with ID 182669.

#### Equations

Now formulate the equations of the model and save them. The parameter list does not need to be loaded for any of the equations.

The equations of this example have the IDs 182670, 182671, 182672, and 182673.

#### Definition of function

To create the DIPPR function for the vapor pressure, we take the following steps:

1. Load the notation of this example
2. Load the parameter list of this example
3. Add an informative description of the function
4. Make sure that Free interface and Specify formula are selected in the Interface & Body Settings
5. Move to the tab Interface Specifications; add as output and as input. Theoretically, it would make sense to use engineering units for this example, but we will not do that in this example. As a result, we need to make sure manually that our equations are unit-consistent
6. Move to the tab Body Specification and add the formula from the section on the model formulation from above:
7. Save the function

The function has ID 182674.

#### Equation system

Go to the tab Equation System and add your equations in the same way as in the previous examples. Then go to the Functions tab within the equation system and take the following steps:

1. Add the function by clicking on the “Add” button at the bottom
3. Add as Applied Naming for the output and as Applied Naming for the input
5. , , , , and (now with component index!) as Applied Naming for the parameters
6. Confirm that and confirm again to close the popup windows. You should now see one application of the function within the equation system

The resulting equation system has ID 182675.

#### Evaluation / Simulation

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

2. In the tab on the Generic System, go to Functions and check whether MOSAICmodeling confirms two usages of the function in one application
3. Go to Indexing and enter 2 as Max Value for NC; then click on Confirm Index Data
4. Go to the Specifications tab and assign the following variables as design values:
5. Assign the remaining six variables – i.e., , , , , , and – as iteration values
6. Now you may wonder where your parameters for the vapor pressure function are. Therefore, go to the Parameters tab where you should find these ten parameters

### 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
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 182676 with variable specification 182677 and parameter specification 182678. The solution for all iteration variables is also given in Table 1.