Use of Connectors IV – Naming Policy ‘encapsulate’ with All Connected Equation Systems using a Different Notation

In this example, the connected equations have different notations. They have only one common (generic) variable z_{i}=y_{i}=x_{i}. Using the naming policy encapsulate makes it possible to specify only the translation of this common variable while ensuring that all other variables are not matched by accident.

Model description

As in example II for connectors, the equation system reads

   z_{k=1} + A \cdot z_{k=2} = B \\[2ex]  C \cdot (z_{k=2})^{2} = -D + z_{k=1}.

Workflow

Notation

We use the same super notation as in example II. This notation has ID 182746.

Equations

Likewise, the same equations as in example II for connectors with IDs 182732 and 182733 can be used.

Connectors

Now we again need to create two connectors. 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 new super 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, i.e.,
    • Sub Notation: x_i
    • Super Notation: z_{k}
  6. Select the analogous variables and click on Match to achieve the following matching:
    • x_i \rightarrow z_{k}
  7. Make sure by clicking on the pair x_i; z_k to check whether the Index Matching was successful. The Sub index i should have been matched with the Super index k
  8. Save the connector
  9. Repeat these steps for a new connector that connects the user notation and the new super notation. The variables in this case are:
    • Sub Notation: y_j
    • Super Notation: z_{k}
  10. The resultung match must be:
    • y_j \rightarrow z_{k}
  11. Verify the correct setup of the connector and save it

The connectors are available with IDs 182756 and 182757. Figure 1 illustrates how both equations are combined to one equation system.

chart 5Figure 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 from example I with the connector user notation \rightarrow super notation
  2. Load the colleague’s equation from example I with the connector colleague notation \rightarrow super notation
  3. Save the equation system

The equation system has ID 182758.

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 NK to 2 in the tab Indexing
  3. Go to the tab Specifications; you will notice that the variables from the original notations, i.e., \gamma and \delta as well as a and b, are part of the problem, but they have received their own namespace e0e0 and e0e1, respectively
  4. Assign the variables a, b, \gamma, and \delta as design values
  5. Assign the variables z_{k=1} and z_{k=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 182759 with variable specification 182760. The solution will be the same as in the previous examples. To conclude this set of examples, we note that encapsulate can be very powerful to quickly connect various equations or equation systems as long as you do not mind the additional namespaces.