Instantiation of configuration properties, Instantiation of, Configuration properties – Echelon Neuron C User Manual

Page 100: Ge 88 for deta

Advertising
background image

88

Using Configuration Properties to Configure Device Behavior

4

If the configuration property type for the configuration property defines a

default value, then that default value is used as the initial value. This
rule does not apply for a configuration property type that is type-

inheriting; see

Type-Inheriting Configuration Properties

on page 98.

5

If no initial value is available from any of the preceding rules, a value of
all zeros is used.

The cp_family declaration is repeatable. The declaration can be repeated two or
more times, and, as long as the duplicated declarations match in every regard,

the compiler treats them as a single declaration.
The following example shows a valid repetition, two invalid repetitions, and a
non-repeating case.
Example:

// INITIAL declaration of family:
SCPTgain cp_family cpGain = { 2, 3 };

// VALID repetition: families are identical
SCPTgain cp_family cpGain = { 2, 3 };

// INVALID repetition: different initializer!
SCPTgain cp_family cpGain = { 1, 10 };


// INVALID repetition: different cp_info
SCPTgain cp_family cp_info(offline) cpGain = { 2, 3 };

// NO REPETITION, but creation of a valid second family:
SCPTgain cp_family cp_info(offline) cpLowGain = { 1, 8 };

Instantiation of Configuration Properties

Configuration properties can apply to a device, one or more functional blocks, or
one or more network variables. In each case, a configuration property is made to

apply to its respective objects through a

property list

. Property lists for the

device and network variables are explained in the following sections; property

lists for functional blocks are explained in Chapter 5,

Using Functional Blocks to

Implement a Device Interface

, on page 101. You cannot have more than one

configuration property of any given SCPT or UCPT type that applies to an object,

where that object is a network variable, a functional block, or the entire device.
As discussed above, the cp_family declaration is similar to a C language typedef
because no actual variables are created as a result of the declaration. In the case

of a type definition, variables are instantiated when the type definition is used in

a later declaration that is not, itself, another typedef. At that time, variables are

instantiated

, which means that variables are declared and memory is allocated

for and assigned to the variables. The variables can then be used in later
expressions in the executable code of the program.
The instantiation of a CP family member occurs each time the CP family

declaration’s identifier is used in a property list. For exceptions to this rule, see

Sharing of Configuration Properties

on page 96.

However, a configuration network variable is already instantiated at the time it

is declared. For a configuration network variable, the property list serves only to

Advertising