Type-inheriting cps for nvs of changeable type – Echelon Neuron C User Manual

Page 111

Advertising
background image

Neuron C Programmer’s Guide

99

functional profile is an example of a functional profile that lists the

SCPTdefOutput configuration property as an optional configuration property,
and it is used to define the default value for the sensor's principal network

variable. The SFPTopenLoopSensor functional profile itself, however, does not

define the type for the principal network variable.

The following example implements a SFPTopenLoopSensor functional block with

an optional SCPTdefOutput configuration property. The configuration property
inherits the type, SNVT_amp in this case, from the network variable it applies to

as shown below.
Example:

SCPTdefOutput cp_family cpDefaultOutput;

network output SNVT_amp nvoAmpere nv_properties {

cpDefaultOutput = 123

};

fblock SFPTopenLoopSensor {

nvoAmpere implements nvoValue;

} fbAmpereMeter;

The initial value (123 in the example) can only be provided in the instantiation of

the configuration property as discussed above, and not in the declaration,
because the type for cpDefaultOutput is not known until it is instantiated and

because it is a type-inheriting configuration property.

Type-Inheriting Configuration Properties for
Network Variables of Changeable Type

Type-inheriting configuration properties can also be combined with changeable-
type network variables; see

Changeable-Type Network Variables

on page 68.

The type of such a network variable can be changed by a network integrator

when the device is installed in a network.

Example:

SCPTdefOutput cp_family cpDefaultOutput;
SCPTnvType cp_family cpNvType;
network output changeable_type SNVT_amp nvoValue
nv_properties

{

cpDefaultOutput

=

123,

cpNvType
};
fblock SFPTopenLoopSensor {

nvoValue implements nvoValue;

} fbGenericMeter;

The nvoValue principal network variable, although it is of changeable type, must

still implement a default type (SNVT_amp in the example above). Because the
SCPTdefOutput type-inheriting configuration property inherits the type

information from this initial type, the initializer for cpDefaultOutput must

therefore be specific to this instantiation. Furthermore, the initializer must be
valid for this initial type.
Should the network integrator decide to change the type of the underlying

network variable at runtime to, for example, SNVT_volt, then it is the

Advertising