Ratchet function – Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual

Page 132

Advertising
background image

FactoryTalk EnergyMetrix Software

132

Example

The following example assigns a proration factor as a global variable for Demand charges
if the billing report period is less than or greater than a month.

'Declare a global variable

Dim dblProRateFactor As Double

'In the first line item, add following script

dblProRateFactor = 1

If BillingPeriodDayCount < 28 Or BillingPeriodDayCount > 31 Then

dblProRateFactor = ProRateMonthlyCharge(1)

End If

'In Demand line items, multiply the Charge by the proration
factor

If Charge = 0 then Visible = False

Quantity = Peak(ValueType.RealPowerDemand)

Unit = "kW"

RatePerUnit = 2.35 'rate per kw of demand

Charge = Quantity * RatePerUnit * dblProRateFactor

Ratchet Function

The Ratchet function returns the maximum of the selected value logged during the defined
period, defined by the endDate and intervalInMonths arguments, as well as the periods
defined by the SeasonType, DayType, and TimeOfUseType (or StartHour and EndHour)
arguments. The Ratchet function is generally used for rate-of-change values such as
demand real and reactive power (kW, kVAR). It returns a Double value.

Usage

Quantity = Ratchet(ValueType.enumValue, [endDate],
intervalInMonths)

Quantity = Ratchet(ValueType.enumValue, SeasonType.enumValue,
[endDate], intervalInMonths)

Quantity = Ratchet(ValueType.enumValue, SeasonType.enumValue,
DayType.enumValue, [endDate], intervalInMonths)

Quantity = Ratchet(ValueType.enumValue, DayType.enumValue,
[endDate], intervalInMonths)

Quantity = Ratchet(ValueType.enumValue, startHour, endHour,
[endDate], intervalInMonths)

Quantity = Ratchet(ValueType.enumValue, TimeOfUseType.enumValue,
[endDate], intervalInMonths)

Quantity = Ratchet(ValueType.enumValue, SeasonType.enumValue,
DayType.enumValue, startHour, endHour, [endDate],
intervalInMonths)

Quantity = Ratchet(ValueType.enumValue, SeasonType.enumValue,
DayType.enumValue, TimeOfUseType.enumValue, [endDate],
intervalInMonths)

Quantity = Ratchet(ValueType.enumValue, DayType.enumValue,
TimeOfUseType.enumValue, [endDate], intervalInMonths)

Advertising