Adding message monitor points to a monitor set, Adding message monitor points to a – Echelon LNS User Manual

Page 211

Advertising
background image

LNS Programmer's Guide

197

Adding Message Monitor Points to a Monitor Set

Each

MonitorSet

object contains a

MsgMonitorPoints

property. The

MsgMonitorPoints

property returns a collection of the message monitor points in the

monitor set.

There are two ways to use message monitor points. You can create a message monitor

point to send messages to (and receive messages from) a single device on the network.

Or, you can create a message monitor point to send messages to a group of device

simultaneously by connecting those devices to your application’s Network Service Device.
To do so, you will need to create a dynamic message tag on the Network Service Device.

This section describes both procedures.

To create a message monitor point to send explicit messages to (and receive message

from) a single device on the network, follow these steps:

1. Open

the

ObjectServer

,

Network

, and

System

you plan to monitor and

control, as described in Chapter 4, Programming an LNS Application.

2. Echelon recommends that you use transactions when creating permanent

message monitor points, as this considerably reduces the time required to
create the monitor points. For more information on using transactions

with LNS, see Using Transactions and Sessions on page 65.

MySystem.StartTransaction()

3. Get the device that you plan to send explicit messages to, or that you plan

to receive messages from. Note that this cannot be the Network Service
Device containing the monitor set you plan to add the message monitor

point to.

Set MySubsystem = MySubsystems.Item(“Floor1.Room3”)

Set MyAppDevices = MySubsystem.AppDevices

Set MyAppDevice = MyAppDevices.Item("Vent")

If you only plan to send explicit messages to the device with the message

monitor point, proceed to step 6. If you plan to receive messages from the

device, you need to perform steps 4 and 5 to connect a message tag on the
device to your application’s Network Service Device.

4. Get

the

MessageTag

object on the device that will be used to send the

updates to the monitor and control application:

Set MyInterface = MyAppDevice.Interface

Set MyMessageTags = MyInterface.MessageTags

Set MyTag = MyMessageTags.Item("mTag1")

5. Obtain

the

msg_in message tag on your application’s Network Service

Device, and connect it to the message tag selected in step 4.

Set MonVni = MyNetwork.MyVNI

Set NsdInterface = MonVni.Interface

Set NsdMessageTags = NsdInterface.MessageTags

Set NsdMsgIn = NsdMessageTags.Item(“msg_in”)

MyTag.AddTarget (NsdMsgIn)

MyTag.Connect()

Advertising