User guide

108 Using Functional Blocks to Implement a Device Interface
Shared Functional Block Properties
Just as network variable properties can be shared, functional block properties
can be shared between two or more functional blocks. The global keyword
creates a configuration property member that is shared among two or more
functional blocks. This global member is a
different
member than a global
member shared among network variables. The static keyword creates a
configuration property member that is shared among all the members of a
functional block array, but not with any other functional blocks or network
variables outside the array.
For example, consider a three-phase ampere meter, implemented with an array
of three SFPTopenLoopSensor functional blocks. Assume the hardware contains
a separate amplifier for each phase, but a common analog-to-digital converter for
all three phases. Each phase thus has individual gains factors, but might have to
share one property to specify the sample rate for all three phases:
Example:
#define NUM_AMMETERS 3
SCPTgain cp_family cpGain;
SCPTupdateRate cp_family cpUpdateRate;
network output SNVT_amp nvoAmpere[NUM_AMMETERS];
fblock SFPTopenLoopSensor {
nvoAmpere[0] implements nvoValue;
} fbAmpereMeter[NUM_AMMETERS] external_name("AmpereMeter")
fb_properties {
cpGain,
static cpUpdateRate
};
Assume, furthermore, that the same device also contains a three-phase voltage
meter with an implementation that mirrors the one from the ampere meter.
And, assume there is a SCPTbypassTime configuration property that limits the
duration of a locally initiated bypass mode for all six meters.
The following example implements all six meters, implementing a global
SCPTbypassTime configuration property that is shared between all fblocks that
refer to it, and implementing two static SCPTupdateRate configuration
properties, shared among the members of the respective fblock array:
Example:
#define NUM_PHASES 3
SCPTgain cp_family cpGain;
SCPTupdateRate cp_family cpUpdateRate;
SCPTbypassTime cp_family cpBypassTime;
network output SNVT_amp nvoAmpere[NUM_PHASES];
network output SNVT_volt nvoVolt[NUM_PHASES];
fblock SFPTopenLoopSensor {
nvoAmpere[0] implements nvoValue;
} fbAmpereMeter[NUM_PHASES] external_name("AmpereMeter")