beautypg.com

Writing data point values – Echelon i.LON SmartServer 2.0 User Manual

Page 97

background image

i.LON SmartServer 2.0 Programming Tools User’s Guide

83

Writing Data Point Values

You can write updated values to the scalar and structured data points declared in your FPM application
in the Work() routine. The updated values are then written back to the data points when the FPM
application exits the Work() routine. You can directly write an updated value to a scalar data point
by simply assigning it a value.

nviTemp = 25.28;

nviSetPoint = 22.22;

Writing an updated value to a structured data point requires a few additional steps. You can directly
write values to the fields of a structured data point and then mark the data point as modified, or you
can create temporary data point variables and use them to write values to the fields of your structured
data points. The following sections describe how to write values to a structured data point using each
of these methods.

Directly Writing to a Structured Data Point

To directly write a value to a structured data point, you use the -> operator (element selection through
pointer), and you then mark the data point as modified using the PROPAGATE()macro. The
following code demonstrates how to write to a structured data point using this method:

DECLARE(_0000000000000000_0_::SNVT_switch,
nvoAirConditioner_OnOff, OUTPUT_DP);
...

void CUFPTHVACController::Work()
{
// use variable directly and tell the system that this value /
should be written back to the data point

nvoAirConditioner_OnOff->value = 200;
nvoAirConditioner_OnOff->state = 1;
PROPAGATE(nvoAirConditioner_OnOff);

}

Using Temporary Data Point Variables to Write to a Structured Data Point

To use a temporary data point variable to write to a structured data point, you declare a temporary data
point in the Work() routine, store the desired values in the various fields of the temporary data point,
and then assign the declared data point a reference to the temporary data point variable. The following
code demonstrates how to write to a structured data point using this method.

DECLARE(_0000000000000000_0_::SNVT_switch,
nvoAirConditioner_OnOff, OUTPUT_DP)
...
void CUFPTHVACController::Work()
{

SNVT_switch tmp;
tmp.value = 200;
tmp.state = 1;
nvoAirConditioner_OnOff = tmp;


// change detected and written to data point automatically

}

See the Programmer’s Reference in Appendix A for more information on writing values to structured
data points.