Monitoring network variables, 65 describes special – Echelon Neuron C User Manual
Page 77

Neuron C Programmer’s Guide
65
Monitoring Network Variables
A monitoring device is a L
ON
W
ORKS
device that receives data from many other
devices. For example, an alarm display device may monitor many alarm sensor
devices. The sensor devices could all have a network variable output declared as
a SNVT_alarm output, and the monitor device could have a network variable
input, declared as a SNVT_alarm input.
Typically, the monitor device waits for a change to its input network variable.
When a change occurs, it must identify which device originated the change. The
method of determining the source of a change depends on the method used to
connect the sensor outputs to the monitor input.
Following are a few options for the network monitor device; in the examples, the
sensor devices all have a single SNVT_alarm output network variable that must
be monitored by the network monitor device:
• Declare the network variable input as an array, and connect each
element of the array to a different sensor. Wait for an nv_update_occurs
event for the entire array, and then use the nv_array_index built-in
variable to determine which device originated the change.
Example:
network input SNVT_alarm nviAlarmArray[50];
SNVT_alarm alarm_value;
unsigned int alarm_device;
when (nv_update_occurs(nviAlarmArray))
{
alarm_device = nv_array_index;
alarm_value = nviAlarmArray[alarm_device];
// Process alarm_device and alarm_value
}
This method is appropriate when the number of devices to be monitored
does not exceed the network variable limits of the monitoring device.
• Declare the network variable input as a single input on the monitor
device, and declare the network variable outputs as polled outputs on the
sensor devices. Create a single connection with all the sensor outputs
and the monitor input. Explicitly poll each of the sensors using explicit
addressing and explicit messages as described in the next chapter.
Because the devices are explicitly polled, the monitor device always
knows the source of a network variable update.
This method is appropriate for any number of devices, as long as the
delays introduced by the polling loop are acceptable for the application.
• Declare the network variable input as a single input and create a single
connection with all the sensor outputs sending their values to the single
monitor input. This configuration is called a
fan-in connection
. Wait for
an nv_update_occurs event for the network variable input, and then use
the nv_in_addr built-in variable to determine the source address of the
device that originated the change. Implement a configuration property
array that is set by the device plug-in to identify the fanned-in devices.