• No results found

Dynamically Creating Network Variables

In document LonMaker User s Guide (Page 119-121)

Some devices support the dynamic creation of network variables on their functional blocks. This means that you can create new network variables on the device after it is added to the network. Examples of devices that support dynamic network variable creation are network service devices (see Binding Network Variables to the Host), i.LON 1000 Internet Server, i.LON 100 Internet Server, and several MIP devices. To create a network variable on a functional block that supports dynamic functional block creation, follow these steps:

1. Assure that the functional block on which you want to create the network variables has been created in the LonMaker network drawing. If you are creating network variables on a network service device, you should create a functional block shape for the network service device’s virtual functional block.

2. Drag a network variable shape of the desired direction from the LonMaker Basic Shapes stencil to the functional block. If the functional block supports dynamic NV creation, the Choose a Network Variable dialog appears, as described in Adding Network Variables and Message Tag Shapes, except the dialog will also have a button labeled Create NV. If the functional block does not support dynamic network variable creation, this checkbox will not be displayed.

3. Click Create NV. The Creating a Network Variable dialog appears.

4. Click Browse and choose the source network variable. Typically this is the network variable to which you will be binding the new network variable, but you can use any network variable with the appropriate type and direction. The new network variable will have the same type and opposite direction as the source network variable. The source network variable is used as a template for creating the new network variable (with the exception that the direction of the new network variable will be the opposite of the source network variable). The new network variable is not automatically bound to the source network variable.

5. Set Poll Attribute of New NV(s) to determine whether the new network variable will have polled monitoring enabled by default. The Clear and Set options will disable and enable polling on the new network variable, respectively. The Same as Source NV and Opposite of Source NV options will use the source network variable to determine whether polling will be enabled on the new network variable.

6. Click OK. You are returned to the Choose a Network Variable dialog. The new network variable will be selected. Click OK to add the network variable shape to the functional block. 7. Click OK to add the network variable shape to the functional block.

When you create a dynamic network variable using the above procedure, the LonMaker tool assigns a name to the dynamic network variable based on the following rules. The rules are different for a network variable that is a member of a functional block (a functional block network variable or FBNV) and for a network variable that is not a member of functional blocks (device network variable).

The following rules apply to dynamic functional block network variables (FBNVs):

• If the name that you specify for a dynamic FBNV does not contain a "_<xxx>" suffix where "<xxx>" is equal to the functional block index, the LonMaker software will append such a suffix to the name. As a result of this rule, you cannot assign a dynamic

FBNV name containing a suffix of "_<xxx>" where <xxx> is a three digit decimal number, unless the number is the same as the functional block index.

• Dynamic FBNV names are limited to 12 characters, including any member suffix that must be added to make the member name unique within the functional block. This is different than the “_<xxx>” functional block suffix, which does not count to the 12 character limit.

• When you create a dynamic FBNV by dropping a master shape or copying an existing functional block shape, the LonMaker tool will automatically truncate the FBNV name, if required, to meet the 12-character limitation.

• If you drag a master shape containing any functional blocks with dynamic network variables to a drawing, and the creation of any of the dynamic FBNVs fails, the functional block containing the failed dynamic FBNV will not be added, and all subsequent shapes in the master shape will not be processed, including any connections.

• When you rename a dynamic FBNV, if the update to the FBNV’s programmatic name fails for any reason, the name change will not be allowed.

As a result of these rules, the format of the programmatic name of a dynamic FBNV is as follows:

<baseName><memberIndex>_<FBindex>

The baseName is 1 or more characters specified as the name of the FBNV. The memberIndex is 0 or more decimal digits required to make the name unique within the functional block. The FBindex is a 3-digit decimal number that equals the functional block index.

The following rules apply to dynamic device NVs:

• When you create a dynamic device NV, you must specify a name that is valid for the programmatic name for the NV on the device. That is, the name is limited to no more than 16 characters, may use only alphanumeric characters, and the first character must be a letter. In addition, the name must be unique if required by the device. If the name is not valid, the dynamic device NV will not be created.

• Dynamic device NVs cannot have a suffix of "_<xxx>", where <xxx> is a 3-digit decimal number.

• When you rename a dynamic device NV, the LonMaker tool will attempt to update the name of the NV on the device. If the update fails for any reason, the LonMaker tool will report the failure, leaving the name of the NV on the device unchanged, but will update the name locally.

Removing Network Variable and Message Tag

In document LonMaker User s Guide (Page 119-121)