beautypg.com

Write(), Resetpriority() – Echelon i.LON SmartServer 2.0 User Manual

Page 225

background image

i.LON SmartServer 2.0 Programming Tools User’s Guide

211

Note: You can also use temporary data point variables to write values to the fields within a
structured data point. To do this, you declare a temporary data point, 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 temporary data point variables

SNVT_switch tmp_switch;

//create temporary DP variable


tmp_switch.value = 200;

// set DP value in temp DP variable

tmp_switch.state = 1;

// set DP state in temp DP variable

nvoSwitch = tmp_switch;

// assign declared DP to temp DP,

// which triggers a data point write

Write()

You can perform a Write() method in an FPM application to explicitly write values to the data
points declared in an FPM. Typically, you do not need to use this method because updated values are
automatically propagated to the SmartServer’s internal data server after the Work() and OnTimer()
routines are done. However, you can use this method to send multiple data point updates within a
single routine.

SYNTAX

STATUS Write(CVariable& rVar);

The rVar parameter specifies a data point declared in the FPM.

The STATUS value returned by this method can either be ERROR or OK.

EXAMPLE

The following example demonstrates a Write()method that changes the value of a data point
declared in an FPM application.

DECLARE(_0000000000000000_0_::SNVT_temp_f, nviSetPoint,
INPUT_DP)

nviSetPoint = 25.83;
STATUS st = Write(nviSetPoint);

if (st==ERROR) //if dp write failed

{

printf("DP write failed");

}

Notes: Using this Write()method in an FPM application may significantly impact the performance
of the SmartServer; therefore, it is recommended that you use this method sparingly.

ResetPriority()

You can use the ResetPriority()method in the Work() and OnTimer()routines of an FPM
application to enable lower priority applications to write values to a data point declared in the module.

SYNTAX

STATUS ResetPriority(cVariable& rVar,

unsigned short nPrioAuthority);

The rVar parameter specifies the name of a data point declared in the FPM application.

The nPrioAuthority parameter specifies the priority to be used to reset the priority assigned
to the data point. The priority is a value between 0–255 (highest priority) and 255 (lowest
priority) that determines whether an application can write values to a data point.