Open specific port(s)

Overview and Key Concepts

The Open specific port(s) activity opens or closes specific input or output ports, or selects a port (only open one or more specified ports and close the rest). It works on individual ports, in that sense it is similar to the command family consisting of openip(), closeip(), openallip(), closeip(), etc. — as opposed to for example openinput().

Note that, in addition to opening or closing the ports, the activity requests a recalculation of the network from the Flow Control. If you were to call, say, closeip() directly, the flow control would not register this change and would continue to send flow through the closed port until the next event in the flow network.

Connectors

The Open specific port(s) activity only allows one connector out. See Adding and Connecting Activities for more information.

Properties

The following image shows properties for the Open specific port(s) activity:

Each of these properties will be explained in the following sections.

Name

Used to change the name of the activity. See Name for more information about this property.

Font

The Font button opens a window to edit the activity's background color and font properties. See Font for more information about this property.

Statistics

The Statistics button opens the activity's statistics window. See Statistics for more information about this property.

Object(s)/ Group / Array

Use the Object(s) / Group / Array box to specify the object(s) you want the activity to affect. You can specify a single object (using the eyedropper tool or a model.find() command), an object group (flat or nested) or an array of objects and/or groups. When a token enters the activity, the expression will be parsed recursively such that arrays of groups or groups will be properly handled.

Action

Specify if the ports you are about to select in the next properties are to be opened, or closed. The third option, Select, will open all selected ports and close all other, non-matching ports.

Ports at

Specify if you want the activity to affect the input ports, or the output ports of the specified object(s).

Port number / Array of ports

Specify a port number (between 1 and the number of input / output ports), or an array of port numbers. By default "All ports" is selected, but you can specify 3 to open/close/select the third input/output port, or [1, 2, 4] to open/close/select ports 1, 2 and 4.

Condition

If the condition is not set to "Always", the activity will only perform its functionality when the condition returns true. If the Object(s) / Group / Array field evaluates to multiple objects, the condition will be checked for each object separately (and passed in as the involved parameter).

The dropdown suggests a few common conditions, such as only working on objects that currently have inflow, or are below their maximum content. You can use it to implement logical conditions (e.g. only open output if a tank is full), but also for model constraints (e.g. only do something with output port 2 if the involved object has at least two output objects).