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
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:
- , black value
- , dark blue value
- , dark gray value
- , dark green value
- , light blue value
- , light gray value
- , light green value
- , pink value
- , yellow value
The notation has the ID 182761.
Notation of the interface
Set up a second notation with the following base names:
- , light color value
- , 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:
- 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
- Click on “+ Field Name” and add , render and confirm
- Repeat this step with
- Make sure that both variables are of dimension Dim Scalar and set In/Out to In
- 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:
- 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
- Add and as Sub variables, and and as Super variables
- Match with and with
- Save the connector
- Repeat these steps for a new connector to match with and with ; 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:
- Go to the tab External Ports and click on “+ Port” at the bottom
- Enter the name of the port, i.e., “Port green”
- Load the interface and the connector for the color green
- Click on Check Port Configuration and confirm in case no errors appear
- Repeat these steps for the port name “Port blue” with the connector for the color blue
- 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.
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 and .
Assign the and from both ports as design values as well as , , and . Also, assign and 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.