Echelon LNS User Manual

Page 229

Advertising
background image

LNS Programmer's Guide

215

method is most efficient if network variable values need to controlled

individually, or if they need to be written infrequently and unpredictably.
For more information on this, see Explicitly Reading and Writing

Network Variable Monitor Points on page 215.

Explicit Bound Monitoring and Control. This method should only be used

for fan-out connections, which is the process of a single host output

network variable controlling two or more input device network variables.
This is most efficient when updating many network variables to the same

value at once. For more information, see The Explicit Bound Network

Variable Monitoring and Control Scenario on page 221.

Explicitly Reading and Writing Network Variable Monitor Points

In this scenario, the application explicitly reads and writes network variable values. This

method is most efficient if network variable values need to be read infrequently and

unpredictably, or written individually.

To explicitly read or write a network variable monitor point, you must first create a

monitor set and add monitor points for the network variables you want to monitor. For

more information on these tasks, see Creating Monitor Sets on page 194, and Managing
Monitor Sets
on page 195.

Following that, you can open and enable the monitor set, and begin explicitly reading

and writing the values of the network variable monitor points in the monitor set. To do

so, you need to acquire a

DataPoint

object representing the network variable monitor

point. You can access such a

DataPoint

object by reading the

NvMonitorPoint

object's

DataPoint

property.

The

DataPoint

object contains the value data for the monitor point. The value data is

stored in three properties on the

DataPoint

object:

Value

,

FormattedValue

, and

RawValue

. All three of these properties point to the same piece of data in memory, but

they format the data in different ways:

• The

Value

property formats the data as a raw, scaled numeric value.

• The

FormattedValue

property formats the data based on the LNS

Object Server’s

CurrentFormatLocale

setting. The data stored in the

FormattedValue

property is scaled and unit-converted based on the

FormatSpec

the data point is using. For more information on

FormatSpec

objects, see Data Formatting in page 241.

• The

RawValue

property formats the data as a raw byte array.

Whenever one of these values is set, the values of the other two properties will be

updated to reflect this change. However, you should note that reading and writing any of

the three value properties does not automatically access or update the network variable
on the source device.

Each

DataPoint

object contains a

Read()

method and a

Write()

method. The

Read()

method copies the monitor point value data from the device into the

DataPoint

object.

The

Write()

method copies the monitor point value data from the

DataPoint

object to

the device. It is possible to automate this process with the

AutoRead

and

AutoWrite

properties. Set the

AutoRead

property to

True

to cause the

Read()

method to be called

automatically before any of the three value properties are read. Set the

AutoWrite

property to

True

to cause the

Write()

method to be called automatically after any of the

three value properties are set.

Advertising