Echelon LNS User Manual

Page 128

Advertising
background image

LNS Programmer's Guide

114

physical or logical segment of your network, and each Subsystem has its own
AppDevices and Routers collections. These collections contain the application devices
and routers installed on that Subsystem. You can select a subsystem that already exists

using the Item property of your Subsystems collection, or you can create a new
subsystem with the Add() method.

Set MySubsystems = MySystem.Subsystems

Set MySubsystem = MySubsystems.Item("FireSubsystem")

OR:

Set MySubsystems = MySystem.Subsystems

Set MySubsystem = MySubsystems.Add("FireSubsystem")

NOTE: You cannot explicitly add items to AppDevices collections that are contained in
the ALL or Discovered subsystems, as these read-only collections are maintained by

LNS.

2. Fetch

the

AppDevices collection from the selected Subsystem:

Set MyAppDevices = MySubsystem.AppDevices

3. Use

the

Add() method to add a new AppDevice to the AppDevices collection acquired

in step 2.

Set NewAppDevice = MyAppDevices.Add("SmokeDetector", _

MyDeviceTemplate, MyChannel, MySubnet)

The Add() method takes four parameters: the device name, a DeviceTemplate

object, a Channel object, and a Subnet object. The device name is required, and the
Channel and DeviceTemplate objects should be specified whenever possible. You

must specify a DeviceTemplate to create planned network variable connections for

the device in the engineered installation scenario.

If you do not specify the device template and channel, the device template will be

assigned (and recovered from the device if necessary) when the device is
commissioned. In this case, the device’s interface will be unavailable until the device

has been commissioned. Echelon recommends that you specify the template and
channel during device creation whenever possible.

If you do not specify the device template, any dynamic network variables on the

device’s main interface will be uploaded into the LNS database when the device is

commissioned, which may not be desirable. However, you can use the
MoveToInterface() method to move these dynamic network variables to a custom

interface, and then delete them, if desired. For more information on the
MoveToInterface() method, see Using Dynamic Device Interfaces on page 179.

For more information on device templates, see the Device Interfaces section earlier in

this chapter. For more information on channel and subnet allocation, see Managing
Networks with Multiple Channels
on page 169.

Echelon recommends that you do not assign a subnet when creating AppDevice

objects, as LNS will automatically assign the best subnet to the new device, based on

the network topology and resource requirements.

Advertising