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:
[table sort=”desc,asc”]
Name, Description
,values
,parameter 1
,parameter 2
,parameter 3
,parameter 4
[/table]
Indices:
[table sort=”desc,asc”]
Name, Description
,value index-max val: Nj
[/table]
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:
[table sort=”desc,asc”]
Name,Description
,values
,parameter 1
,parameter 2
,parameter 3
,parameter 4
[/table]
Indices:
[table sort=”desc,asc”]
Name,Description
,value index-max val: Ni
[/table]
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 Matching select the row for b and
.
- Press [Break]. The symbols b and
should have been removed from the Matching table and be present in the tables Sub Notation and Super Notation respectively.
- Remove all matchings except for
from the Matching table as described above.
- In the Test Connector tab load ‘Equation one’ created in Connection techniques I. If everything went well, only the instances of
should be matched to instances of
.
- Save the connector.
Creating the equation system
- In the Equation System Editor specify ‘Notation y’ as the equation system’s notation.
- Press [Add] in the lower right corner, which brings up the Edit Connection to Element dialog.
- In the dialog press [Change] for the Conn. Elem. field.
- Select ‘Equation one’ created in Connection techniques I.
- In the Edit Connection to Element dialog use the drop down list box next to Naming policy and change the value to encapsulate.
- In the Advanced section tick the field Use connector and press [Change] next to the corresponding field.
- 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 Indexing tab specify 2 as a maximum value for the index i.
- Now have a look at the equation system in the Instance tab.
- Press [Name Spaces], which toggles the views between the view without the namespaces and the view including the namespaces.
- On the tab Info you find the specification of the two namespaces involved.
- 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:
[table sort=”desc,asc”]
Name,Description
,values
,parameter 1
,parameter 2
,parameter 3
,parameter 4
[/table]
Indices:
[table sort=”desc,asc”]
Name,Description
,value index-max val: Nk
[/table]
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:
[table sort=”desc,asc”]
Name,Description
,values
,parameter 1
,parameter 2
,parameter 3
,parameter 4
[/table]
Indices:
[table sort=”desc,asc”]
Name,Description
,value index
[/table]
Connector x-z
- Subnotation: Notation x
- Supernotation: Notation z
- Value list:
Equation two
Notation y
Base Names:
[table sort=”desc,asc”]
Name,Description
,values
,parameter 1
,parameter 2
,parameter 3
,parameter 4
[/table]
Indices:
[table sort=”desc,asc”]
Name,Description
,value index-max val: Nj
[/table]
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 Instance tab and toggle between the different views using the [Name Spaces] button.
- In the Info tab the three name spaces are specified.
- In the Variable Specification tab select the variable
and use the buttons [T], [
] and [
] to navigate between the different namings of this variable.
- Enter the missing pieces of the problem description and solve the problem.