User guide

50 How Devices Communicate Using Network Variables
Figure 7. A Simple Closed-Loop System
Use of the is_bound( ) Function
A typical application need not know where local output network variables are
connected, and need not know the source of updates to local input network
variables. While such detail is available where necessary, typical applications
can focus on the semantics of the input network variable update and the local
control algorithm.
When necessary, a Neuron C application can determine if a network variable has
been connected by a network tool by calling the is_bound( ) function. For
example, a device might expect periodic updates to a local input network variable
under normal circumstances, and might enter a failure mode if such updates fail
to arrive for a prolonged amount of time. Such an application could then use the
io_bound( ) function as a predicate to disable or enable certain aspects of the
application algorithm.
Whenever an unconnected output network variable is updated, an
nv_update_succeeds event becomes TRUE even though no update actually
occurred (see also
Processing Completion Events for Network Variables
on page
55).
The is_bound( ) function only indicates whether the network variable is bound or
unbound. Another device, such as a network tool for monitoring and control, may
still attempt to obtain the current value of an unbound output network variable
by polling, or may still update an unbound input network variable by setting its
value without a bound connection. Thus, reducing the application’s processing
requirements by conditional processing based on the is_bound( ) function should
be limited to those devices that cannot operate without a bound connection, such
as devices implementing a closed-loop system.