beautypg.com

Using ufpt local variables – Echelon i.LON SmartServer 2.0 User Manual

Page 89

background image

i.LON SmartServer 2.0 Programming Tools User’s Guide

75

3. An updated DECLARE statement for the selected data point is added to the data point declaration

section just below the namespace declaration.

4. Repeat steps 2–3 to add or update additional data points in the UFPT.

Using UFPT Local Variables

Creating an FPM application or driver with the New FPM Project wizard in the i.LON SmartServer 2.0
Programming Tool generates a class that inherits from CFPM_App. This class provides the
implementation for an FPM functional block. At runtime, only one instance of this class will be
created for each unique FPM. When you add multiple FPM devices on the SmartServer that use that
same unique FPM, multiple functional block instances of the FPM are created. When a Work()
routine in the FPM is called, the FPM framework provides data point values that are applicable to their
respective functional block instances.

If you want to use additional data point variables that also apply to specific functional block instances,
you can use the DECLARE_FB_INSTANCE_LOCAL() macro. For example, you can declare a UFPT
local variable that stores how often the Work() routine has been called by specific functional block
instance or you can declare a UFPT local variable that stores the file name of a functional block
instance.

Consider a scenario in which there is one internal FPM Math device that has two functional block
instances of the Math UFPT (Add1 and Add2). The Math FPM application contains three data points
(in1, in2, and out1), and it has one local variable (callCount) that is incremented when the
Work()

routine is called.

• On the Net/LON/MathFPM/Add1 functional block, in1 is set to 20, and then in2 is set to 5.

This results in the Add1 functional block calling the Work() routine twice. The out1 data point
is updated to 20 and then to 25, and the callCount local variable is updated to 2.

• On the Net/LON/MathFPM/Add2 functional block, in1 is set to 10 (the in2 data point is not

updated). This results in the Add2 functional block calling the Work() routine once. The out1
data point is updated to 10 and the callCount local variable is updated to 1.