Use of Functions III – Parameter Lists and Indices

Elham Esfehani

Requirements for this tutorial

This is an advanced tutorial that needs the basics explained in other sections of this learning trail. The following should have been worked through or prepared before this tutorial is started:

  • Notations and Variables – Superscripts, Subscripts,Indices should have been worked through and the example created. They should be available for reuse in the learner’s repository. The equations are also given below for reference.
  • Parameter lists I – basic use should be completed as a basic understanding of the use of parameter lists is necessary here.

Example problem

Equation system

Equation System eq_sys_flash
F \cdot z_{i} = B \cdot x_{i} + D \cdot y_{i}
p^{LV}_{o,i} \cdot x_{i} = y_{i} \cdot p
1 =\sum_{i=1}^{NC} x_{i}
1 =\sum_{i=1}^{NC} y_{i}
1 =\sum_{i=1}^{NC} z_{i}

Notation nota_flash

Base Names

[table sort=”desc,asc”]
A,Dippr parameter A in –
B,Bottom molar flow in kmol/h  Dippr parameter B in K
C,Dippr parameter C in –
D,Head molar flow in kmol/h  Dippr parameter D in –
E,Dippr parameter E in –
F,Feed molar flow in kmol/h
K,Constant. Phase equilibrium and others
p,Pressure in Pa
T,Temperature in K
x,Bottom molar fraction in mol/mol
y,Head molar fraction in mol/mol
z,Feed molar fraction in mol/mol


[table sort=”desc,asc”]
LV,Phase equilibrium


[table sort=”desc,asc”]
o,Reference value


[table sort=”desc,asc”]
i,Component index 1…NC

Use of a function
For the calculation of the vapor pressure a DIPPR function is used. As the parameters in this functions specify the mixture used in this process it makes sense to specify them in a parameter list.

Function vapor_pressure_dippr

p ( T ) = p^{sca} \cdot \exp(A + \frac{B}{T} + C \cdot \ln(\frac{T}{T^{sca}} + D \cdot (\frac{T}{T^{sca}})^E))

Notation nota_thermo_variables

Base Names

[table sort=”desc,asc”]
Name, Description
p, Pressure in Pa
T, Temperature in K

Parameter List params_thermo_dippr

A, B, C, D, E, p^{sca}, T^{sca}


Notation nota_thermo_dippr

Base Names

[table sort=”desc,asc”]
Name, Description

A,parameter A
B,parameter B
C,parameter C
D,parameter D
E,parameter E
T,parameter T
p,parameter p



[table sort=”desc,asc”]
Name, Description

sca,indicating a scaling/reference


Problem description
Index maximum value:
NC = 2
Design variables and their values:
F = 1.0
z_{i=1} = 0.5
p = 101325
T = 354.6
Iteration Variables and their initial values:
B = 0.5
D = 0.5
x_{i=1} = 0.5
x_{i=2} = 0.5
y_{i=1} = 0.5
y_{i=2} = 0.5
z_{i=3} = 0.5

Specification of physical parameters:

1,Methanol,81.1,-6880.0,-8.71, 4.05E-6, 2.0

Specification of scaling/reference parameters:

Name,Value, Engineering Unit


Expected simulation results:
B = 0.715
D = 0.285
x_{i=1}= 0.463
x_{i=2}= 0.537
y_{i=1}= 0.592
y_{i=2}= 0.408
z_{i=2}= 0.5

Creating the parameter list

  • Create ‘nota_thermo_dippr’.
  • Create the parameter list ‘params_thermo_dippr’ which uses ‘notation_thermo_dippr’. If you have problems here, refer to the previous sections . Attention: The parameters of the list do not have any index.

Creating the function

  • Create ‘nota_thermo_variables’.
  • Select the Function Editor in the Model Panel.
  • Select ‘nota_thermo_variables’ in the Notation file panel.
  • Select ‘params_thermo_dippr’ in the Parameters file panel.
  • Enter a Description for the new function.
  • In the tab Interface & Body Settings check that Free Interface and Specify formula are selected in the comboboxes for the interface respectively body setting.
  • Activate the tab Interface Specification.
  • Press [Edit Output] and create the variable of the left hand side of the function: ‘p’.
  • Press [Add Input] and create the input variable  ‘T’.
  • Activate the tab Body Specification.
  • Enter the right hand side of the dippr function. The latex expression is: p^{sca} \cdot \exp( A + \frac{B}{T} + C \cdot \ln(\frac{T}{T^{sca}} + D\cdot(\frac{T}{T^{sca}})^{E}))
  • Save the function.

Creating the equation system and applying the function

  • Create the notation ‘nota_flash’. If you want to use the notation created in section 2, you have to extend the existing notation by the base name symbols p and T.
  • Create the mentioned equations of the section ”Equation system eq _sys_flash”
  • Create a new equation system ‘eq_sys_flash’ using notation ‘nota_flash’  and add the above equations (via naming policy ‘integrate’ without a connector).
  • Activate the tab Functions
  • Press [Add Function] and load the function created above.
  • Have a look at the loaded contents:
    • Preview shows the rendered function
    • The field Output Naming shows the output variable as it is defined in the function
    • The table Input Namings contains the input variable ‘T’.
    • There is a section Applications (Function Calls). This section contains an empty table for the Output Variable which later on contains the Applied output namings.
  • We have to add an entry into the list for the Applied Namings of the Output Variable.
  • Press [Add Application] below the above mentioned table. This brings up the Edit Function Application dialog.
  • Press [Edit Output] below the field for the Applied Naming for the Output and enter the name for the vapor pressure as it appears in the equation system with the component index: p_{o,i}^{LV}.
  • Double click at T and enter the naming for the temperature as it should/will appear in the equation system: ‘T’.
  • Enter the matchings for the parameters: A ->A^{par}_{i}, B ->B^{par}_{i}, C ->C^{par}_{i}, D ->D^{par}_{i}, E ->E^{par}_{i},p^{sca} ->p^{par}, T^{sca} ->T^{par}
  • Press [OK] to leave the Edit Function Appliance dialog. The list for the applied output namings contains the entry created above.
  • Press [OK] to leave the Add Function Usage dialog.
  • Save the equation system.

Evaluating the equation system

  • Select the Simulation Editor and activate the Equation System tab.
  • Load equation system ‘eq_sys_flash’ created above in the EQ System file panel. You may check if everything is loaded correctly in the Equations and Functions tab.
  • Activate the Indexing tab, set the maximum values for the indices to 2 and confirm the indexing.
  • Activate the Specifications tab and the Variables sub tab. You will notice that the two P_{o,i}^{LV} are automatically classified as Calculated Variables.
  • Enter the problem specification as specified in the beginning of this tutorial.
  • HINTS:
    • You may select several variables at the same time using the mouse and the control or shift key.
    • Pressing [<<] or [>>] changes the classification of all selected variables.
    • A right mouse click on the selection brings up a dialog where a value can be entered for all selected variables (useful for initialization values).
  • Save the variable specification for later use.
  • Activate the Parameters sub tab and enter the parameters as specified above and save this parameter specification.
  • Enter a description for the simulation/evaluation.
  • Save the Evaluation information using the file panel on top of the Evaluation Editor.
  • Generate the code and simulate the flash