beautypg.com

Checking for data point property updates – Echelon i.LON SmartServer 2.0 User Manual

Page 94

background image

80

Creating Freely Programmable Modules

Note: You can modify the behavior of the Changed()method so that it can determine whether any
data point property has changed, including value, status, time of last update, and priority. See the next
section, Checking for Data Point Property Updates, for how to do this.

Checking for Data Point Property Updates

You can call the NotifyOnAllUpdates() method in the constructor of your FPM application so
that the Changed() method checks whether any data point property has been updated, including
value, status, time of last update, and priority (by default, the Changed() method only checks
whether the data point value has changed).

This is ideal if you are using FPMs with external devices that require the same value to be written to a
data point to execute some specific device behavior. In this case, when the same value is written to the
data point (via polling or the same value being explicitly written to the data point), the Changed()
method returns TRUE because the time of last update property has been updated. Another common
use-case is the checking of devices for alarm conditions.

In the NotifyOnAllUpdates() method, you pass in a string vector containing the names of the
data points for which the Changed() method is to check for updates to any of their properties. The
following example demonstrates how to use the NotifyOnAllUpdates() and the Changed()
methods to check whether the properties of specific data points in your FPM application have changed.

Note: If you do not call the NotifyOnAllUpdates()method within the FPM constructor, the
Changed()

method only checks whether the data point value has changed.

// FPM constructor
CUFPTHVACController::CUFPTHVACController()
: CFPM_App(FPM_MODULE_NAME, CFPM_App::eApplication)
{
vector oDpVarNames;
oDpVarNames.push_back("nviTemp");
oDpVarNames.push_back("nvoAC_OnOff");
NotifyOnAllUpdates(oDpVarNames);
}

 

.........

// section datapoint variable declarations
DECLARE(_0000000000000000_0_::SNVT_temp_f, nviTemp, INPUT_DP)
DECLARE(_0000000000000000_0_::SNVT_switch, nvoAC_OnOff, INPUT_DP)

.........

// Work() routine
void CUFPTHVACController::Work()

{

FPM::Dp::PointStatus nviTemp_status;
nviTemp_status =
nviTemp.GetDpPropertyAsPointStatus(FPM::Dp::dataUCPTstatus);

// check whether nviTemp status has changed

if

(Changed(nviTemp))

{

if (nviTemp_status == FPM::Dp::AL_HIGH_LMT_ALM_1)
{

nvoAC_OnOff->value = 200;

nvoAC_OnOff _OnOff->state = 1;
PROPAGATE(nvoAC_OnOff);

}

}

}