Cumulative

Cumulative of values within time range.

Syntax

 Cumulative("signal name" in "unit")

The Cumulative("signal name" in "unit") function returns the cumulative sum of the given signal within a given scope.  To take into account prior cumulatives before the start of the specified scope, please see HistoryCumulative.

Example

In the following P# script example, the Cumulative() function sums the signal data within the scope defined in the script. Note that the values prior to the January 2, 2007 start of the given scope are ignored by the Cumulative() function. To take into account these prior values, see HistoryCumulative.
 Cumulative("produced water per time increment" in "STB")

As you see in the following table the Cumulative function which produces following output based on the 'original signal' as input:

// This P# script illustrates how to use the Cumulative() function
Context "Example Context"
Entity Set "Example Well"
Scope "Example Scope"
End Context

Entity Set "Example Well"
"Well A"
End Set

Scope "Example Scope"
Between #1/2/2007#
And #1/9/2007#
Step Daily
End Scope

Table "Cumulative Example"
// This column is not necessary, but is included here for clarity
Column "Produced Oil" in "STB"
"produced oil per time increment" in "STB"
End Column
// This column is where the results are computed
Column "Cumulative Oil" in "STB"
Cumulative("produced oil per time increment" in "STB")
End Column
End Table

Scope 

Date/Time 

Original Signal 

Cumulative 

Prior to Scope 

12.30.2006 00:00 

13 

NULL 

12.31.2006 00:00 

NULL 

01.01.2007 00:00 

19 

NULL 

Within Scope 

01.02.2007 00:00 

01.03.2007 00:00 

01.04.2007 00:00 

15 

23 

01.05.2007 00:00 

22 

45 

01.06.2007 00:00 

24 

69 

01.07.2007 00:00 

13 

82 

01.08.2007 00:00 

27 

109 

01.09.2007 00:00 

115 

Post Scope 

01.10.2007 00:00 

12 

NULL 

01.11.2007 00:00 

49 

NULL 

01.12.2007 00:00 

32 

NULL