User Manual

12 Introduction
9. You can observe that the Data Point Variable Declarations section automatically includes
DECLARE statements for each data point in the .UFPTMath template.
For more information on creating FPM projects, see Chapter 5,
Creating FPMs.
Step 4: Writing the FPM Application
You can write the FPM application using the i.LON SmartServer 2.0 Programming Tool. This mainly
entails specifying the logic to be executed on the data points declared in the application. For this
exercise,75
you create a simple addition algorithm in the Work() routine of the UFPTMath.cpp file. Whenever
one of the input data points is updated, the algorithm adds the two input data points and stores the
result in the output data point. Note that the Work() routine is one of four routines in the FPM
application. The other three routines are Initialize(), OnTimer(), and Shutdown().
The Initialize() routine is executed when the FPM application is started or enabled. You
can initialize data point values and start timers in this routine.
The Work() routine is executed when data points declared in the FPM application are updated.
You can write values to the data points declared in your FPM application and read data point
properties in this routine.
The OnTimer() routine is executed when a timer created in the Initialize() routine
expires. You can read data point properties in this routine.
The Shutdown() routine is executed when the FPM application is stopped or disabled. You can
stop timers and perform any required cleanup in this routine.
To write and build the FPM application, follow these steps:
1. In the UFPTMath.cpp file, find the Work() routine.
2. In the Work() routine, enter the following code: