Accessing property values from a program – Echelon Neuron C User Manual
Page 195
Neuron C Reference Guide
175
page 171. A range-modification string provided in the instantiation of a CP
family member overrides any range-modification string provided in the
declaration of the CP family.
Example:
UCPTsomeDeviceCp cp_family cpSomeDeviceCp;
SCPTupdateRate cp_family cpUpdateRate = {3};
SCPTlocation cp_family cpLocation;
device_properties {
cpSomeDeviceCp,
cpUpdateRate
range_mod_string(":180"),
cpLocation = { "Unknown" }
};
This example implements three device properties: cpSomeDeviceCp implements
a UCPT with a default value as defined in the user-defined resource file.
cpUpdateRate implements SCPTupdateRate with a maximum value of 180
seconds (the SCPT supports up to 65,535 seconds). Note that the entire
cpUpdateRate configuration property family, not just the cpUpdateRate device
property, uses an implementation-specific default value of 3 seconds (the SCPT is
defined with a default of 0 seconds). Finally, cpLocation shows the declaration of
a SCPTlocation-typed device property with a device-specific default value
("Unknown").
Accessing Property Values from a Program
Configuration properties can be accessed from a program just as any other
variable can be accessed. For example, you can use configuration properties as
function parameters and you can use addresses of configuration properties.
However, to use a CP family member in an expression, the compiler must know
which family member is being accessed, because there could be more than one
member of the same CP family with the same name, but applying to different
network variables. The syntax for accessing a configuration property from a
network variable’s property list is:
nv-context
::
property-identifier
[
index-expr
]
nv-context
::
property-identifier
nv-context
:
identifier
[
index-expr
]
identifier
Example:
// CP for heartbeat and throttle (default 1 min each)
SCPTmaxSndT cp_family cpMaxSendT = { 0, 0, 1, 0, 0 };
SCPTminSndT cp_family cpMinSendT = { 0, 0, 1, 0, 0 };
// NV with heartbeat and throttle:
network output SNVT_lev_percent nvoValue
nv_properties
{
cpMaxSendT,
// Override default for minSendT to 30 seconds
// for this family member, only:
cpMinSendT = { 0, 0, 0, 30, 0 }