Calculations in VTScada

By Jeff MacKinnon, P.Eng., PE

You already know I like VTScada as my HMI/SCADA application of choice, and being able to add functions and calculation to tags is another reason I like it. Its what I use for my Home Energy Management system.

Calculation and Context tags don't count towards your tag limit, so all these tags that I'm adding won't add towards your 50 tag limit.

Calculating cost of energy

The example I'm using is part of the energy management system that I'm putting together at the studio. This is calculating the power using the NS Power Domestic Service Tariff.

The domestic service tariff is:

(Monthly usage in kwh * Base Rate) + Service Charge The Base Rate is currently 15.805 cents/kwh The Service Charge is $10.83 / month

Step 1: Add Constants

First lets add calculation tags for the Base Rate and Service Charge. This way when they change (increase) you only have to change a single tag.

You will have to click "All Tag Type" and scroll down to Calculation
VTSCADA Calculation box

Next type in your name. I have organized my tags such that this is in a Calculations/Tariffs structure. This is using the Context tag type, something that helps with organizing tags.

Then go to the Calc tab. We are using a Constant for this tag.

Everything in dollars

To make sure that I don't mix up dollars and cents, I'm making everything in $. The reason I chose dollars is to make the Engineering Units look clean in the Display tab

Calculation properties

Now do the same for the monthly base charge.

Step 2: Calculate kilowatt-hours

If you have a meter that you are reading KWH directly, and it is resetting for you, you can skip this step. To keep the number of tags to my SCADA as few as possible, I am only reading kW and am using a totalizer tag to calculate my kwh.

First I create a Totalizer Tag to calculate the kw-s.

The tag type is in the header

I have the totalizer looking at the Power tag as the source.

The tag resets every month

This tag resets every month.

Step 3: Convert kWs to kWh

Then in another calculation tag I do my first expression for this example, and call it kW-HR. In this I select expression and the input box on the right.


This expression is very simple, I divide the [kw-S] tag (which is in the same "folder" as the kW-HR tag I'm creating) by 3600, the number of seconds in an hour.

When you select OK, the value will show up in the Calculation tag box. At this moment we have used 687 kWh this month.

Step 4: Putting it all together

Now for the last step, calculate the current cost of power this month.

For this we create our last calculation tag of the example:


I have placed this tag in the Monthly Power context and had to reference up a couple levels in the tag hierarchy to get to the right one, [Calculations\Tariffs\Standard] and [Calculations\Tariffs\Standard Base Charge].

The result of this equation, as of today, is: $120