Sum function – Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual

Page 135

Advertising
background image

5

Visualize Energy Usage

135

Sum Function

The Sum function calculates the arithmetic sum of logged non-cumulative (delta-logged)
consumption or production values over the report period or other period defined by the
function arguments. It returns a Double value.

Usage

Quantity = Sum(ValueType.enumValue)

Quantity = Sum(ValueType.enumValue, intervalInMonths)

Quantity = Sum(ValueType.enumValue, endDate, intervalInMonths)

Quantity = Sum(ValueType.enumValue, SeasonType.enumValue)

Quantity = Sum(ValueType.enumValue, SeasonType.enumValue,
DayType.enumValue)

Quantity = Sum(ValueType.enumValue, DayType.enumValue)

Quantity = Sum(ValueType.enumValue, startHour, endHour)

Quantity = Sum(ValueType.enumValue, TimeOfUseType.enumValue)

Quantity = Sum(ValueType.enumValue, SeasonType.enumValue,
DayType.enumValue, startHour, endHour)

Quantity = Sum(ValueType.enumValue, SeasonType.enumValue,
DayType.enumValue, TimeOfUseType.enumValue)

Quantity = Sum(ValueType.enumValue, DayType.enumValue,
TimeOfUseType.enumValue)

Comments

intervalInMonths is an integer value 0 or greater that defines the interval over which the
sum is calculated. The interval ends at the report end date or the data defined by the
endDate argument if included.

endDate is a string expressing the date. The time stamp may be expressed in a few
different formats, for example ‘1/30/2003 12:30 PM’ or ‘2/28/1999’.

The most reliable method is to use the .NET DateTime object:

new DateTime(year, month, day, hour, minute, second)

Use care to select only non-cumulative (delta-logged) values for the ValueType. For
accumulating value types, use the Total() function.

The startHour and endHour arguments are integers in the range of 1…24, where
24 = midnight.

Example

The following script calculates the sum of weekly production values entered into a manual
tag with user-defined Value Type named ‘Weekly Production’.

Quantity = Sum(ValueType.WeeklyProduction)

Advertising