User Manual

LonTalk Stack Developer’s Guide 77
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 file. The API uses this table to access the network variables when the
application runs. In addition, the application can query the data in this table at
runtime.
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.
Functional Blocks without Configuration Properties
The following model file describes a similar meter application as in the previous
example, but implements it using functional blocks to provide an interoperable
interface:
A node object based on the SFPTnodeObject functional profile to manage
the entire device
An array of three meters, each based on the same user-defined
UFPTenergyMeter profile, implementing three identical meters.
Configuration properties are not used in this example.
// Node object
network input SNVT_obj_request nviNodeRequest;
network output polled SNVT_obj_status nvoNodeStatus;
fblock SFPTnodeObject {
nviNodeRequest implements nviRequest;
nvoNodeStatus implements nvoStatus;
} NodeObject external_name("NodeObject");
// UFPTenergyMeter