Directly reading and writing network variables, Directly, Directly reading and writing – Echelon LNS User Manual

Page 245: Network variables

Advertising
background image

LNS Programmer's Guide

231

with the configuration currently stored in the devices, even if database changes have

been made subsequently while the system management mode is set to

lcaMgmtModeDeferConfigUpdates

. The configuration of the permanent monitor sets

will not be updated to reflect the database changes until the management mode is

changed to

lcaMgmtModePropagateConfigUpdates

, at which point the devices will

also be updated. Thus, barring any update failures, the configuration of the monitor sets

will always be consistent with the physical devices on the network. As a result, you can
always use permanent monitor sets, regardless of the system management mode.

However, Echelon recommends that you use permanent monitor sets while the system

management mode is set to

lcaMgmtModePropagateConfigUpdates

whenever

possible.

You should also note that monitor points created or modified while in

lcaMgmtModeDeferConfigUpdates

mode cannot be used until the system is set to

lcaMgmtModePropagateConfigUpdates

mode. In addition, all connection changes

made while in

lcaMgmtModeDeferConfigUpdates

have no effect until the network is

placed in

lcaMgmtModePropagateConfigUpdates

mode.

Similarly, the implicit or explicit creation of bound connections causes device connection

changes that will not be propagated to the network while the system management mode
is set to lcaMgmtModeDeferConfigUpdates. As a result, your monitoring application

might fail to receive data, or it might have to resort to polling data. Echelon recommends

that you do not initiate bound monitor and control operations when the system
management mode is set to lcaMgmtModeDeferConfigUpdates.

Directly Reading and Writing Network Variables

At some point, you may want to read or write the value of a single network variable,

without monitoring its value before or after the operation. In this case, you should write
to the network variable directly, without creating a network variable monitor point.

Remember that if you plan on consistently monitoring and controlling a network variable

or group of network variables, monitor sets are the most efficient method to use.

Prior to LNS Turbo Edition0, the NetworkVariable object’s Value property was

provided for single read and write operations to network variables. However, as of LNS
Turbo Edition0, the Value property is deprecated and only supported for backwards

compatibility. You can now use the

GetDataPoint()

method to create

DataPoint

objects to read and write to the values of network variables. When you do so, your

application will have sole access to that data point, and it will manage the format of the

data contained in the network variable locally. As a result, it will avoid misinterpreting
any formatting changes that may be made to a network variable’s value by other client

applications.

To acquire a

DataPoint

object you can use to read or write to the value of a network

variable, follow these steps:

1. Acquire

the

AppDevice

object containing the network variable you want

to modify.

Set MyAppDevices = MySubsystem.AppDevices
Set MyAppDevice = MyAppDevices.Item(“Device 1”)

2. Obtain the device’s

NetworkVariables

collection, and then get the

network variable you want to read or write.

Advertising