HistoryCumulative

Cumulative values within a given scope and including any prior, historical cumulative values.

Syntax

 HistoryCumulative("Signal Name" in "unit")

The HistoryCumulative("signal name" in "unit") function returns the cumulative sum of the given signal within a given scope, and also automatically includes any historical signal values prior to the start of the given scope.

Note that due to the potentially large amount of data involved in computing the prior history, HistoryCumulative can have a significant performance cost when used on large contexts. Consider using Cumulative instead where applicable or storing prior cumulative results as a separate signal if needed frequently.

Example

In the following P# example, the HistoryCumulative() function includes data prior to the January 2, 2008 start of the scope:
 HistoryCumulative("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 HistoryCumulative() 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/2008#
And #1/9/2008#
Step Daily
End Scope

Table "HistoryCumulative 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 "HistoryCumulative Oil" in "STB"
HistoryCumulative("produced oil per time increment" in "STB")
End Column
End Table

Scope 

Date/Time 

Original Signal 

Cumulative 

Prior to Scope 

12.30.2007 00:00 

13 

NULL 

12.31.2007 00:00 

NULL 

01.01.2008 00:00 

19 

NULL 

Within Scope 

01.02.2008 00:00 

47

01.03.2008 00:00 

47

01.04.2008 00:00 

15 

62

01.05.2008 00:00 

22 

84

01.06.2008 00:00 

24 

108

01.07.2008 00:00 

13 

121

01.08.2008 00:00 

27 

148

01.09.2008 00:00 

154

Post Scope 

01.10.2008 00:00 

12 

NULL 

01.11.2008 00:00 

49 

NULL 

01.12.2008 00:00 

32 

NULL