Band function, Costallocatecharge function, Getdata function – Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual
Page 123

5
•
Visualize Energy Usage
123
Band Function
The Band function provides a shortcut for calculating ‘banded’ charges (see the Example).
This function comprises the following script code:
If (Val > Max) Then Result = Max - Min
Else If (Value > Min) Then Result = Val - Min
Else Result = 0
It returns a Double value.
Usage
Quantity = Band(val, min, [max])
Comments
Variables Val, Min, and Max may be constants or expressions that return a Double value.
Max is optional.
Example
In this example, a utility charges 7.12 cents per kWh for the first 1000 kWh, 5.23 cents per
kWh for the next 2000, and 3.15 cents per kWh thereafter. The script returns the total
energy used and the banded charge.
Quantity = Total(ValueType.RealEnergyNet)
Charge = Band(Total(ValueType.RealEnergyNet), 0, 1000) * 0.0712 +
Band(Total(ValueType.RealEnergyNet), 1000, 3000) * 0.0523 +
Band(Total(ValueType.RealEnergyNet), 3000) * 0.0315
CostAllocateCharge Function
The CostAllocateCharge function allocates a monthly charge (typically a demand or fixed
charge) according to the meter's contribution to the total. It provides a simple way to
implement the following calculation:
Result = [ fixedCharg * (meterValue / totalValue) ]
It returns a Double value.
Usage
Charge = CostAllocateCharge(fixedCharge, totalValue, meterValue)
Comments
fixedCharge, totalValue and meterValue are all Double values.
GetData Function
The GetData function returns the selected value from the database.
Usage
Object = GetData(ValueType.enumValue)
Object = GetData(ValueType.enumValue, DateTime TimeStamp)