Echelon LonTal Stack User Manual

Page 77

Advertising
background image

LonTalk Stack Developer’s Guide

65

The global keyword causes a configuration property member to be shared among

all the functional blocks or network variables whose property list contains that
configuration property family name. The functional blocks or network variables

in the configuration property family can have only one such global member.
Thus, if you specify a global member for both the functional blocks and the

network variables in a configuration property family, the global member shared

by the functional blocks is a different member than the global member shared by
the network variables.
The static keyword causes a configuration property family member to be shared

among all elements of the array it is associated with (either network variable
array or functional block array). However, the sharing of the static member does

not extend to other network variables or functional blocks outside of the array.

Example 1:

// CP for throttle (default 1 minute)
SCPTmaxSndT cp_family cpMaxSendT = { 0, 0, 1, 0, 0 };

// NVs with shared throttle:
network output SNVT_lev_percent nvoValue1
nv_properties

{

global cpMaxSendT

};
network output SNVT_lev_percent nvoValue2
nv_properties

{

global cpMaxSendT

// the same as the one above

};
network output SNVT_lev_percent nvoValueArray[10]
nv_properties

{

static cpMaxSendT

// shared among the array

//

elements

only

};

In addition to sharing members of a configuration property family, you can use

the static or global keywords for a configuration network variable to specify

sharing. However, a shared configuration property network variable cannot
appear in two or more property lists without the global keyword because there is

only one instance of the network variable (configuration property families can
have multiple instances).
A configuration property that applies to a device cannot be shared because there

is only one device per application.

Example 2:
The following model file defines a three-phase ammeter, implemented with an

array of three SFPTopenLoopSensor functional blocks. The hardware for this
device contains a separate sensor for each phase, but a common analog-to-digital

converter for all three phases. Each phase has individual gain factors, but shares
one property to specify the sample rate for all three phases.

#define NUM_PHASES

3


SCPTgain cp_family cpGain;
SCPTupdateRate cp_family cpUpdateRate;

network output SNVT_amp nvoAmpere[NUM_PHASES];

Advertising