Echelon i.LON SmartServer User's Guide Page 90

  • Download
  • Add to my manuals
  • Print
  • Page
    / 266
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 89
76 Creating Freely Programmable Modules
SYNTAX
DECLARE_FB_INSTANCE_LOCAL(dataType, variableName)
EXAMPLE
// <= section datapoint variable declarations
DECLARE_FB_INSTANCE_LOCAL(int, callCount);
Writing an FPM Application
You can write an FPM application using the i.LON SmartServer 2.0 Programming Tool. An FPM
application reads and writes to the data points declared in it, reads data point properties, executes code
upon data point updates, and controls timers and executes code upon their expiration. To create an
FPM application, you specify the logic to be executed on the data points in the following four routines:
Initialize(), Work(), OnTimer(), and Shutdown():
The Initialize() routine is executed when the FPM application is started or enabled. In the
Initialize() routine, you can set the initial values for data points, and you can start timers
using the Start() method of the CFPM_Timer class or the START_TIMER() macro.
The Work() routine is executed when one or more data points declared in the FPM application
are updated. In the Work() routine, you write an algorithm that is executed when a specified
data point is updated. In the algorithm, you can read data point properties and write values to the
data points. In addition, you can start and stop timers.
The OnTimer() routine handles timer expiration events. You can use this routine in conjunction
with the Start() methods or the START_TIMER() macros called in the Initialize()
routine. You can create an algorithm in this routine that read data point properties and writes
values to the data points upon the expiration of a timer. In addition, you can start and stop timers.
The Shutdown() routine is executed when the FPM application is stopped or disabled as a
result of a reboot. In the Shutdown() routine, you stop timers and perform any required
cleanup.
The i.LON SmartServer 2.0 Programming Tool works with raw data point values. You must
remember to use the appropriate scale factors to convert raw data point values to scaled values. You
can go to types.lonmark.org/index.html to check the scale factors uses for the SCPTs and UCPTs in the
current LONMARK standard resource file.
The Writing the FPM Application Initialize() Routine
The Initialize() routine is executed when the FPM application is started or enabled. You can
use this routine to write initial values to the data points declared in your FPM application. In addition,
you can use this routine to start timers, which you can use in an FPM application to implement tasks
that need to be performed regularly such as checking the status of data points. For more information
on writing values to data points, see the next section,
Writing the FPM Application Work() Routine.
The following code demonstrates how to set initial data point values and start timers in the
Initialize() routine:
DECLARE(_0000000000000000_0_::SNVT_temp_f, nviSetPoint,
INPUT_DP)
CFPM_Timer m_oTimer1; //declared in header file
CFPM_Timer m_oTimer2; //declared in header file
CFPM_Timer m_oTimer3; //declared in header file
void CUFPTHVACController::Initialize()
{
Page view 89
1 2 ... 85 86 87 88 89 90 91 92 93 94 95 ... 265 266

Comments to this Manuals

No comments