Use of Connectors III – Naming Policy ‘encapsulate’ with Two Involved Notations

In this example, one connected equation uses a different notation.

Model description

The equation system that shall be solved is the same as in the previous examples for connectors:

    \begin{align*} &y_{j=1} + \alpha \cdot y_{j=2} = \beta \\[2ex] &\gamma \cdot (y_{j=2})^{2} = -\delta + y_{j=1}. \end{align*}

Again, the colleague’s equation shall be used instead of formulating the first equation yourself:

    \begin{align*} x_{i=1} + a \cdot x_{i=2} = b. \end{align*}

Only one (generic) variable, i.e., x_{i}, needs to be translated as the other variables, i.e., a and b, do not appear in the super equation system (not even within the naming convention of the super notation).

Workflow

In the following, we demonstrate the workflow. Again, we will use the equation “of the user” and the equation “of the colleage”.

Notations

The notations are equal to those in example I on connectors. They are available with IDs 182730 and 182731.

Equations

Use the same equations as in example I for connectors. These equations have the IDs 182732 and 182733.

Connector

Now it is necessary to create the new connector. Go to the Connector tab and proceed as follows:

  1. Add a helpful description for the connector
  2. Activate the tab Edit Matching. You see two sections: one for the Sub Notation and one for the Super Notation. Both sections contain a field to import the notation
  3. In the section for the Sub Notation, press the Import button and select the notation of the colleague, then confirm. Alternatively, you can select Import Notation from Connected Element and select the equation of the colleague. This automatically adds all variables used in this equation
  4. Add the user notation as Super Notation. As there is no analogous equation available, you need to select Import Notation directly
  5. Generate the missing variables for the Sub Notation and the Super Notation as follows. Note that you do not have to include a and b. We will see below which consequences this has
    • Sub Notation: x_i
    • Super Notation: y_j
  6. Select the analogous variables and click on Match to achieve the following matching:
    • x_i \rightarrow y_{j}
  7. Make sure by clicking on the pair x_i; y_j to check whether the Index Matching was successful. The Sub index i should have been matched with the Super index j
  8. Save the connector

The connector is available with ID 182752. Figure 1 illustrates how both equations are combined to one equation system.

examples_encapsulate_a

Figure 1: Visualization of the variable naming when using the connector. Note: this figure must be updated to match the variables and names used in this example.

Equation system

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

  1. Load the user equation
  2. Click on “Add EQU/EQS”
  3. Add the user equation as usual
  4. Select and load the colleague’s equation, but do not confirm to close this popup window
  5. Make sure that the Naming policy is encapsulate
  6. Turn on the option Use connector und load your saved connector
  7. Confirm
  8. Your equation system should now contain the colleague’s equation, but with your connector in the Connector column
  9. Add the user equation in the usual way without specifying any connector
  10. Save the equation system

The equation system has ID 182753.

Evaluation / Simulation

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

  1. Load your equation system in the tab Equation System
  2. Set the maximum Value NJ to 2 in the tab Indexing
  3. Go to the tab Specifications; you will notice that the variables \gamma and \delta are part of the problem. In addition, the variables a and b from the colleague’s notation are now part of the variable specification, but have received their own namespace e0e0
  4. Assign the variables a, b, \gamma, and \delta as design values
  5. Assign the variables y_{j=1} and y_{j=2} as iteration values

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 the previous examples
  2. Save the variable specification 
  3. Save the simulation
  4. Go to the Evaluation tab and generate the code for your preferred environment
  5. Solve the system using the generated code

This simulation is available with ID 182754 with variable specification 182755. The solution will be the same as in the previous examples. This example shows that connectors can be much smaller if encapsulate is used because the remaining variables will be placed in their own namespaces and hence cannot be matched by accident.