Stefan Kuntsche, Sanam Sabeti Adibpour, Gregor Tolksdorf

It is assumed that you have already worked through the first section of connectors.

**Rules**

The basic contract of the naming policy **‘encapsulate’** is as follows:

- Basic rule: If an equation or equation system (sub element) is added to a super equation system (super element), the sub element’s variables will get an own namespace.
- Additional rule using a connector: If a sub element is added to a super element by using a connector, only those variable names of the sub element that are translated by the connector will get the super element’s namespace.
- Result: When considering the sub element, only the variables translated by a connector have a
*top level naming*according to the super notation.

**‘Encapsulate’ case a: Two notations involved.**

In this example case one connected equation uses a different notation. Only one (generic) variable needs to be translated as the other variables do not appear in the super equation system (not even within the naming convention of the super notation).

Equation System ‘encaps a’

Notation y

Base Names:

Name | Description |
---|---|

values | |

parameter 1 | |

parameter 2 | |

parameter 3 | |

parameter 4 |

Indices:

Name | Description |
---|---|

value index-max val: Nj |

Collaboration

In this example, an equation is taken from another project. To avoid reimplementation the existing equation using ‘Notation x’ is employed here.

Equation one

Notation x

Base Names:

Name | Description |
---|---|

values | |

parameter 1 | |

parameter 2 | |

parameter 3 | |

parameter 4 |

Indices:

Name | Description |
---|---|

value index-max val: Ni |

Connector selective one

- Subnotation: Notation x
- Supernotation: Notation y
- Value list:

Figure 1: Graph of the variable interpretation

After the parsing process the equations have the following appearance:

Alternatively, the user can decide to view the equations without namespaces:

This view, however, might be confusing as names of different variables can appear identical.

Problem description

Design variables with values:

Iteration variables with guess values:

Iteration variables with result values:

**Re-use of model elements** This section is based on previous sections. Usually you should have created many of the needed model parts. We will try to use as much of the existing parts as possible.

**Creating the connector**

- In the Editor bar click on Connector tab and open ‘Connector one’ that you have created in Connection techniques I and save it as a new one named ‘Connector selective one’.
- Activate tab
.`Edit Matching` - In the table
select the row for**Matching***b*and . - Press [Break]. The symbols
*b*and should have been removed from thetable and be present in the tables`Matching`and**Sub Notation**respectively.`Super Notation` - Remove all matchings except for from the
table as described above.`Matching` - In the
tab load ‘Equation one’ created in Connection techniques I. If everything went well, only the instances of should be matched to instances of .`Test Connector` - Save the connector.

**Creating the equation system**

- In the Equation System Editor specify ‘Notation y’ as the equation system’s notation.
- Press
in the lower right corner, which brings up the`[Add]`dialog.**Edit Connection to Element** - In the dialog press
for the**[Change]**field.**Conn. Elem.** - Select ‘Equation one’ created in Connection techniques I.
- In the
dialog use the drop down list box next to`Edit Connection to Element`and change the value to`Naming policy`.**encapsulate** - In the
section tick the field**Advanced**and press**Use connector**next to the corresponding field.**[Change]** - Select ‘Connector selective one’, which you created above in this tutorial.
- Press
.**[Submit]** - Add ‘Equation two’ created in Connection techniques I using the naming policy ‘integrated’ and without loading any connector.
- Save the equation system.

**Evaluating the equation system**

- Activate the Evaluation Editor and load the equation system ‘encaps_a’ you just created.
- In the
tab specify**Indexing**as a maximum value for the index**2***i*. - Now have a look at the equation system in the
tab.`Instance` - Press
, which toggles the views between the view without the namespaces and the view including the namespaces.**[Name Spaces]** - On the tab
you find the specification of the two namespaces involved.**Info** - Solve the modeling task as usual entering the rest of the information given under Problem description above.

##### ‘Encapsulate’ case b: Three notations involved.

In this example the connected equations have different notations. They have only one common (generic) variable . Using the naming policy encapsulate makes it possible to specify only the translation of this common variable and to assure at the same time that all other variables are not matched by accident.

Equation System ‘encaps b’

Notation z

Base Names:

Name | Description |
---|---|

values | |

parameter 1 | |

parameter 2 | |

parameter 3 | |

parameter 4 |

Indices:

Name | Description |
---|---|

value index-max val: Nk |

Collaboration

In this example, equations (1) and (2) are taken from other projects. To avoid reimplementation, existing equations are used here. The only translation is made to from and respectively.

Equation one

Notation x

Base Names:

Name | Description |
---|---|

values | |

parameter 1 | |

parameter 2 | |

parameter 3 | |

parameter 4 |

Indices:

Name | Description |
---|---|

value index |

Connector x-z

- Subnotation: Notation x
- Supernotation: Notation z
- Value list:

Equation two

Notation y

Base Names:

Name | Description |
---|---|

values | |

parameter 1 | |

parameter 2 | |

parameter 3 | |

parameter 4 |

Indices:

Name | Description |
---|---|

value index-max val: Nj |

Connector y-z

- Subnotation: Notation y
- Supernotation: Notation z
- Value list:

Figure 2: Graph of the variable interpretation

View of the equation system with namespaces:

View of the the equation system without namespaces:

Problem description

Design Variables with values:

Iteration Variables with guess values:

Iteration Variables with result values:

##### Creating the connectors and the equation system

- Create the connectors ‘Connector x-z’ and ‘Connector y-z’.
- Create the equation system ‘encaps b’ using ‘Notation z’.
- Add ‘Equation one’ to ‘encaps b’ specifying the naming policy as ‘encapsulate’ and choosing ‘Connector x-z’.
- Add ‘Equation two’ to ‘encaps b’ as ‘encapsulate’ and choose ‘Connector y-z’.

##### Evaluating the equation system

- Load equation system ‘encaps b’ into the Evaluation Editor and specify the maximum value of the index to
.**2** - Look again at the instance of the equation system in the
tab and toggle between the different views using the**Instance**button.`[Name Spaces]` - In the
tab the three name spaces are specified.`Info` - In the Variable Specification tab select the variable and use the buttons
, [] and [] to navigate between the different namings of this variable.**[T]** - Enter the missing pieces of the problem description and solve the problem.