Use of Ports and Streams I – Defining Units by Adding Ports

In this section, the use of ports in MOSAICmodeling is introduced. Ports are useful to define standardized input and output variables and make equation systems usable in flowsheet simulators. In MOSAICmodeling, there is no fixed specification of the variables in a port or stream. In fact, ports and streams can be defined by the modeler and the variable definitions employed therein are reusable. 

Model description

   lb + y \cdot db + p \cdot lgreen^{2} = \frac{lgray}{dgreen} \\ [2ex] dgray \cdot lb + b \cdot db^3 = dgreen.

Workflow

In the following, we demonstrate the workflow for adding ports to an equation system.

Notation of the model

Set up a notation with the following base names:

  • b, black value
  • db, dark blue value
  • dgray, dark gray value
  • dgreen, dark green value
  • lb, light blue value
  • lgray, light gray value
  • lgreen, light green value
  • p, pink value
  • y, yellow value

The notation has the ID 182761.

Notation of the interface

Set up a second notation with the following base names:

  • \lambda, light color value
  • \tau, dark color value

This notation has the ID 182765.

Equations

Create and save the equations from the model with the specified notation. The equations have IDs 182762 and 182763.

Interface

As mentioned above, the specification of the variables contained in a port or stream must be defined by the user. This is done with the help of a model element called Interface. An Interface contains a list of variables and a notation defining their meaning. Such an interface is used in ports for standardization. Here, we want to define an interface for the light and the dark color values of green and blue. 

Start by going to the Interface tab an perform the following steps:

  1. Load the notation of the interface; note that the interface does not require a different notation, but we use this option here to show a broader range of applications
  2. Click on “+ Field Name” and add \lambda, render and confirm
  3. Repeat this step with \tau
  4. Make sure that both variables are of dimension Dim Scalar and set In/Out to In
  5. Save the interface

The interface is available with ID 182766.

Connectors

Now we need to connectors for the two ports we want to add. Go to the Connector tab and do the following:

  1. Load the model notation as Sub Notation and the interface notation as Super Notation. This ensures that the external variables (which are specified for the port) are translated to the respective names in the model equations
  2. Add lgreen and dgreen as Sub variables, and \lambda and \tau as Super variables
  3. Match lgreen with \lambda and dgreen with \tau
  4. Save the connector
  5. Repeat these steps for a new connector to match lb with \lambda and db with \tau; save this second connector

The connectors are available with IDs 182768 and 182769.

Equation system

Go to the tab equation system, enter a helpful description, and add the two equations with naming policy ‘integrate”.

Now, we will use the created nterface and the connectors to add ports to the equation system. Interface and connector together define the mapping of the variables of the equation system to the interface variables. For this purpose, proceed to the tab Flowsheeting within the equation system and take the following steps:

  1. Go to the tab External Ports and click on “+ Port” at the bottom
  2. Enter the name of the port, i.e., “Port green”
  3. Load the interface and the connector for the color green
  4. Click on Check Port Configuration and confirm in case no errors appear
  5. Repeat these steps for the port name “Port blue” with the connector for the color blue
  6. Save the equation system

We have now created a unit, i.e., an equation system with ports as visualized in Figure 1.The equation system is available with ID 182767.

figure 1
Figure 1: Visualization of the equation system with ports.

Evaluation / Simulation

Load the equation system and go to Specifications. You now have three namespaces in your model

  • e0 = namespace of your model
  • e0p1 = namespace of port 1
  • e0p2 = namespace of port 2

If the ports would have the same namespace, we could not differ between both \lambda and \tau.

Assign the \lambda and \tau from both ports as design values as well as b, lgray, and dgray. Also, assign p and y as iteration values. Then, save the variable specification and the simulation. The simulation has the ID 182770 while the variable specification has the ID 182771.

We will not solve this example as this is again relatively straight-forward with any feasible specification of the system.