Echelon FTXL User Manual

Page 220

Advertising
background image

208

Example FTXL Applications

LonBool processActuatorInputs = FALSE;
unsigned index =
LON_GET_UNSIGNED_WORD(nviRequest.object_id);

memset((void *)&nvoStatus, 0, sizeof(nvoStatus));

LON_SET_UNSIGNED_WORD(nvoStatus.object_id, index);

if (index >= FBIDX_count) {

/* We don't support this object - flag it as an

* invalid ID. */
LON_SET_ATTRIBUTE(nvoStatus, LON_INVALIDID, 1);

}
else {
/* If reportStatus is TRUE, set the objectStatus to

* the status of the specified functional block.

*/
LonBool reportStatus = TRUE;
int i;

/* start and limit define which functional block or

* blocks will be effected.
*/
int start;
int limit;

if (index == FBIDX_NodeObject) {

/* Command applies to all functional blocks. */

start = 0;
limit = FBIDX_count-1;

}

else {

/* Command only applies to the specified

* functional block. */

start = index;

limit = index;

}

switch (nviRequest.object_request) {

case RQ_NORMAL:

/* Set the object (or all objects) to normal by

* clearing the disabled and in_override flags.

*/

for (i = start; i <= limit; i++) {

if (i == FBIDX_VoltActuator &&

LON_GET_ATTRIBUTE(FbStatus[i], LON_DISABLED))

{

/* Actuator was disabled, but is now

* enabled. Process current input values.

*/

processActuatorInputs = TRUE;

}

LON_SET_ATTRIBUTE(FbStatus[i], LON_DISABLED,

0);

LON_SET_ATTRIBUTE(FbStatus[i],
LON_INOVERRIDE, 0);
}

break;

case RQ_UPDATE_STATUS:

Advertising