Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual

Page 92

Advertising
background image

FactoryTalk EnergyMetrix Software

92

Usage is:

CalcDerivedTags [-sd <start date>] [-ed <end date>] [-t
<metertagID>] [-d]

-sd <start date>

-ed <end date> if not specified, generates values until current
date

-t <meter tag id> if not specified, generates all derived tags in
the system

-d delete old data in the selected interval before generating new
values; if not specified, existing data is not overwritten

Examples

Simple derived tag

In this example, the 'Acme' domain includes a main meter and a meter on one of its
two feeders. The meter on the second feeder is a 'virtual' meter populated with derived
tags. The derived tag script using shortcut method tag names for the Real Power
Demand
tag is:

Result = #MeterTagID456# - #MeterTagId789#

The script may also use fully qualified tag names. This usage will not permit the use of
other derived tags in the formula.

Derived tag using functions

This example calculates a value for Real Power Demand based on a 15 minute fixed
demand period. The referenced meter tag (MeterTagId = 138) is logging Real Energy
Net at a 15 minute log rate.

Result = TagTotal(138, 0, 0, 0, 15) * 4

Consumption derived tag (odometer-style)

This example logs an odometer-style consumption value in derived tag ID 123 by
adding the 15-minute usage of meter tags 456 and 789 to the previous logged value of
the derived tag.

Result = GetTagData(123, DateTime.utcNow.AddMinutes(-15)) _

+ TagTotal(456, 0, 0, 0, 15) _

+ TagTotal(789, 0, 0, 0, 15)

Testing source data

In this example, the source data is tested to avoid writing an incorrect result into the
database. When the If condition is false, no Result is written.(

If (Not GetTagData(456) Is Nothing) And (Not GetTagData(789) Is
Nothing) Then

Result = GetTagData(123, DateTime.utcNow.AddMinutes(-15)) _

+ TagTotal(456, 0, 0, 0, 15) _

+ TagTotal(789, 0, 0, 0, 15)

End If

Advertising