Echelon LNS User Manual
Page 210
LNS Programmer's Guide
196
3. Get the network variable(s) you will be monitoring:
Set MyInterface = MyAppDevice.Interface
Set MyNVs = MyInterface.NetworkVariables
Set MyNV = MyNVs.Item(“nvoTemperature”)
Set MyNV2 = MyNVs.Item(“nvoAlarm”)
4. Repeat steps 2 and 3 until you have acquired all the network variables
you want to monitor, and get the monitor set that will contain the
monitor points for these network variables. You should have first created
a monitor set for this purpose, as described in the Creating Monitor Sets
section. Remember that when adding network variable monitor points to
a permanent monitor set, or when making any persistent changes to a
permanent monitor set’s configuration, you should access the monitor set
through the MyVni property.
Set MonVNI = MyNetwork.MyVNI
Set MySets = MonVNI.MonitorSets
Set MySet = MySets.Item(“Monitor Set 1”)
5. Access the monitor set’s
NvMonitorPoints
collection, and use the
Add()
method to add network variable monitor points to the monitor set. Each
time you call
Add(),
you will pass in the network variable to be
monitored by the new point as the
nv_target
element
.
Echelon recommends that you use transactions when creating permanent
network variable monitor points, as this considerably reduces the time
required to create the monitor points. Transactions should not generally
be used when creating temporary monitor points since they are not stored
in the LNS database, and so starting a transaction would unnecessarily
slow down the process. For more information on using transactions with
LNS, see Using Transactions and Sessions on page 65.
MySystem.StartTransaction()
Dim NvMp1 as LcaNvMonitorPoint
Dim NvMp2 as LcaNvMonitorPoint
Set NvMonitorPoints = MySet.NvMonitorPoints
Set NvMp1 =NvMonitorPoints.Add("nvMP1", MyNV, nothing)
Set NvMp2 =NvMonitorPoints.Add("nvMP2", MyNV2, nothing)
6. Set the properties of the new
NvMonitorPoint
object. Two properties
you should initially set are the
Tag
property and the
DefaultOptions
properties. You can use the
DefaultOptions
property to set the default
monitoring options that will be applied to the new monitor point each
time it is enabled. See the LNS Object Server Reference help file for more
information on the
Tag
property, and for a complete list of the properties
of the
NvMonitorPoint
object. For more information on monitoring
options, see Setting Monitoring Options on page 200.
For permanent monitor points, you should perform these tasks in the
same transaction that the monitor points were created in. When you have
finished, commit the transaction to the database.
MySystem.CommitTransaction()
7. You can now enable the monitor point for monitor and control operations.
For more information on this, see Opening and Enabling Monitor Sets on