Network variables using standard types – Echelon FTXL User Manual

Page 61

Advertising
background image

FTXL User’s Guide

49

However, it is a common practice to use the “nvi” prefix for input network

variables and the "nvo" prefix for output network variables.

network input SNVT_count

nviCount;

network output SNVT_count

nvoCount;

The LonTalk Interface Developer utility compiles this model file into an
application framework that contains, among other things, two global C variables

in the FtxlDev.c file:

volatile SNVT_count nviCount;
SNVT_count nvoCount;

When an update occurs for the input network variable (nviCount), the FTXL

LonTalk protocol stack stores the updated value in the global variable. The
application can use this variable like any other C variable. When the application

needs to update the output value, it updates the nvoCount variable, so that the

FTXL LonTalk protocol stack can read the updated value and send it to the
network.
For more information about how the LonTalk Interface Developer utility-
generated framework represents network variables, see

Using Types

on page 64.

Important: This example is not interoperable because it does not use functional

blocks to define the purpose of these network variables. However, this type of
declaration can define a functioning device for an initial test application.

Network Variables Using Standard Types

A more complete example includes the use of more complex standard network

variable types and declarations. This example provides the model for a simple
electricity meter, where all input data is retrieved from the network through the

nviAmpere, nviVolt, and nviCosPhi input network variables. The result is posted

to the nvoWattage output network variable. A second nvoUsage output network
variable is polled and uses non-volatile storage to count the meter's total lifetime.

network input

SNVT_amp

nviAmpere;

network input

SNVT_volt

nviVolt;

network input

SNVT_angle

nviCosPhi;

network

output

SNVT_power

nvoWattage;

network output polled eeprom SNVT_elapsed_tm

nvoUsage;

The LonTalk Interface Developer utility generates type definitions in the

LonNvTypes.h file for all of the above network variables. However, it does not
generate type definitions in the LonCpTypes.h file because there are no

configuration properties.
In addition to the type definitions and other data, the LonTalk Interface
Developer utility generates the following global C variables for this model file:

volatile SNVT_amp nviAmpere;

volatile SNVT_volt nviVolt;

volatile SNVT_angle nviCosPhi;

SNVT_power nvoWattage;

SNVT_elapsed_tm nvoUsage;

The declaration of the nvoUsage output network variable uses the network
variable modifiers polled and eeprom. The LonTalk Interface Developer utility

stores these attributes in the network-variable table (nvTable[]) in the FtxlDev.c

Advertising