LNS Programmer's Guide
216
Example of Explicitly Reading a Network Variable Monitor Point
To recap the previous discussion, follow these steps to explicitly read a network variable
value via a monitor point:
1. Create a monitor set on the device containing the network variables you
want to monitor, as described in Creating Monitor Sets on page 194.
Then, create a monitor point for each network variable you want to
monitor, as described in Adding Network Variable Monitor Points to a
Monitor Set on page 195.
2. Access the monitor set through the CurrentMonitorSets collection, and
then open and enable the monitor set. In this example, the doEnable
parameter supplied to the open method is set to True, so that the monitor
set is enabled as it is opened.
Set MyMonitorSets = MyNetwork.CurrentMonitorSets
Set MyMonitorSet = MyMonitorSets.Item(“Boiler Set”)
MyMonitorSet.Open(True, True)
3. Acquire the monitor set’s NvMonitorPoints collection, and access the
monitor points for the network variable you want to monitor.
Set MyNvMonitorPoints = MyMonitorSet.NvMonitorPoints
Set MyNvMonitorPoint =MyNvMonitorPoints.Item(“Pressure”)
4. Acquire a DataPoint object to use to explicitly read the value of the
network variable monitor point. Then, call the Read() method. LNS will
read the value of the network variable being monitored, and update the
DataPoint object’s value properties to match the current value.
Set MyDataPoint = MyNvMonitorPoint.DataPoint
MyDataPoint.Read()
Dim readValue as String
readValue = MyDataPoint.FormattedValue
NOTE: If the AutoRead property is set to True, you do not need to call
the Read() method in this step.
There are several ways your application can format the data stored in the DataPoint
object for display. For more information on this, see Data Formatting in page 241.
Example of Explicitly Writing a Network Variable Monitor Point
Follow these steps to explicitly write a network variable value via a monitor point:
1. Acquire the network variable monitor point you want to control, as
described in steps 1 through 3 of the Example of Explicitly Reading a
Network Variable Monitor Point scenario.
Kommentare zu diesen Handbüchern