Example History:  May 15, 2015,   (v1) May 18, 2015,   (v2) May 19, 2015,   (v3) May 27, 2015

NOTE:  All images on this page can be enlarged by clicking on them.

This page is currently UNDER CONSTRUCTION

The Example Program for the TOTALIZER EFB is based on the totalization of liquid flow, which is a typical function required of Industrial Control applications.
The example includes the ability to evaluate the performance with three different Engineering Unit Flow Transmitter Calibrations:
Gallons per Minute (GPM), Thousands of Gallons per Hour (KGH) and Millions of Gallons per Day (MGD).

This example assumes that the Flow Transmitter signal connected to the Analog Input will be linear.  An example of this assumption is:  If the Flow Measurement source is an Orifice Plate producing a Differential Pressure (DP) measurement, then the assumption is that the DP Transmitter includes the required Square Root extraction to linearize the output signal to a Flow Rate.

The Example Program includes a Unity Pro DFB (FIT_SA2Q3_v1) that scales the linearized Analog Input signal into the Engineering Units that match the calibrated range of the Flow measurement and Transmitter.  This DFB also includes the Unity Pro TOTALIZER EFB that will integrate the Flow over time and calculate the Total Volume over three different time periods:
Total (constant running and re-settable), Today (24 Hour: resetting at Midnight), and Yesterday (24 Hours).
When using the TOTALIZER EFB, there are three items that govern the accuracy of the totalization and require consideration:
(1)  The Engineering Units of the Flow Signal.  The TOTALIZER EFB as demonstrated in this example, is based on a one second integration.  So it is necessary to adapt the Engineering Units of the value attached to the IN input pin of the TOTALIZER EFB.  For the three presented rate units, all are converted to Gallons per Second.  This is accomplished by the value assigned to the FIQ_Divisor Public Variable of the FIT_SA2Q3_v1 DFB.

(2)  The Units of Totalization.  If the Gallons per Second value exceeds 10 GPS, then the Units of Totalization cannot be Gallons.  It will have to be x10, x100 etc. Gallons. This is managed by the TOTALIZER PARA 'thld' and the assigned value will also be limited by Item #3 that follows here.
The Units of Totalization is a critical factor to achieve accurate totalization.

(3)  The Scan Time of the execution.  The TOTALIZER EFB uses the dT (delta Time) from execution to execution in its calculations, however, if the proper Units of Totalization are not used, then it is possible for Maximum Flow Rate to result in the TOTALIZER PARA 'thld' being reached in less than 2 executions (scans).  Under these conditions it can be impossible to achieve accurate totalization.  Another important consideration is that over the life of an application the Scan Time can become longer (if additional code, hardware, etc. is added to the system).  So an accurate totalization today, may not be an accurate totalization tomorrow.  Plan for this possibility.

NOTE: In Concept, the TOTALIZER EFB is also governed by these same three items.

Also, be aware that 'where' the TOTALIZER EFB is executed in the Unity Pro Project will play a significant role in its implementation.  Several implementation methods to insure accuracy, regardless of the Scan Time, are presented below.

Here is a simplified view of the code used in the FIT_SA2Q3_v1 DFB that performs the Totalization of Flow.
The Example Program contains a tool (the 'Calcs' Operator Screen and 'Calcs' Section) that simplifies finding the combination of parameters needed to insure accurate totalization.
It is the goal of the 'Calcs' tools to provide conservative recommendations that insure accurate totalization.  To achieve this goal there is a limit in the 'Calcs' which governs the output (the Variable 'MyAccLimit' set to 2.0).  This limit can be adjusted, but caution must be used and all aspects of the totalization understood before using recommendations provided with a modified limit.

Here is an example of how the improper parameters used with the TOTALIZER EFB (executed in the MAST Task) can result in inaccurate totalization.
The above table shows how choosing the wrong Totalized Flow Units can produce inaccurate results.  For accurate results, the totalization must take place over a minimum of two scans of the application.  Anything less will result in a saturation of the TOTALIZER EFB calculations.
Here is a repeat of the same data but this time using the correct selections of Totalized Flow Units (and TOTALIZER EFB 'thld' parameter).
Within the FIT_SA2Q3_v1 DFB provided in the example application is the calculation that validates the TOTALIZER EFB configuration and provides a warning on an output pin of the DFB.  Here is the code (calculation).
In this code:
HEU = High Engineering Units of the Flow Transmitter Calibration and Scaling
FIQ_Divisor = contains the value used to convert the Flow value to Flow per Second (DFB Public Variable)
%SW11 = the application Watch Dog Timer setting in milliseconds
%SW10 = First cycle after a Cold Start status word (prevents errors being reported on the first scan)
FIQ_thld = contains the value used as the 'thld' parameter of the TOTALIZER EFB (DFB Public Variable)

Insuring the accuracy can be achieved by several different means, depending on the type of implementation desired.  In the example application, the TOTALIZER EFB is embedded in a DFB which is executed in the MAST Task.

For all methods that follow:  the TOTALIZER IN value must be in Units/Second.

Execution Location (Task) of the TOTALIZER EFB:
Use the demonstrated methods and set the Units of Totalization (TOTALIZER PARA.thld) to the recommended value.
Use the demonstrated methods and the Period of the FAST Task will define the limit of the Units of Totalization (see Fixed Task Procedure).
EVENT (Timer Events)
Use the demonstrated methods and the Time Base and Preset values of the EVENT (Timer) Task will define the limit of the Units of Totalization (see Fixed Task Procedure).

Fixed Task Procedure - 'Calcs' Tool
  1. Verify that the 'Lock Units' is un-checked
  2. Select the Engineering Units of the Flow Transmitter Calibration and enter the Maximum Flow Calibration
  3. Set the ScanTime value to the execution frequency of the Task
  4. Use the recommended value (DFB FIQ_thld) for the TOTALIZER PARA.thld
Forcing the 'Calcs' Tool to use x1000 Gallons (Units of Totalization)
  1. Verify that the 'Lock Units' is un-checked and the ScanTime is set to 250ms
  2. Select MGD as the Engineering Units and set the Maximum Flow Calibration = 100.0
  3. Check 'Lock Units'
  4. Set the Engineering Units, Maximum Flow Calibration and ScanTime to the required values
  5. If there are no Warnings, the recommendations are valid, else, adjust as required
Similar techniques can be used to Force the 'Calcs' to use other included Units of Totalization

NOTE:  Even though the Example Program hardware configuration is for a MODICON M340:  All application content is relevant to all MODICON Unity CPUs, with the only exception being Unity Momentum CPUs, as they do not provide the FAST TASK nor EVENT (Timer Events) TASK and therefore will need to follow the guidelines presented for the MAST TASK explicitly.  

IMPORTANT NOTE:  If this application is run in the Unity Pro Simulator, use of the Test feature of this application will produce results that are very close to the results of an actual PLC, however, small differences may be realized.  To acquire definitive results:  Test your needs in Hardware.