How to Create a Calculation Tag

When configuring Tags in the OAS server, you can choose Calculation as the Data Source. This allows you to create dynamic data transformations on existing values already being monitored from local or remote sources. You can even use input data directly from OPC Servers with the DirectOPC interface and these items can come from the local service or a remote service.
In this guide you will learn how to create a simple calculation tag to convert a temperature from degrees Celsius to degrees Fahrenheit.
1 - Add Tag for Temperature in Degrees Celsius
In this section you will create a Tag to represent a temperature value in degrees Celsius.
Select Tags in the sidebar.
If you want to add a Tag at the root of the tag list, make sure no Tag Group is selected and click on the + button, then choose Add tag.

If you want to add a Tag to a Tag Group, select the Tag Group first and then click on the + button and choose Add tag here.
You can also add Tag Groups by choosing Add group.
Provide the Tag Name Temperature C and click the Create button.

2 - Add Tag for Temperature in Degrees Fahrenheit
In this section you will create a Tag to represent a temperature value in degrees Fahrenheit.
Select Tags in the sidebar.
If you want to add a Tag at the root of the tag list, make sure no Tag Group is selected and click on the + button, then choose Add tag.

If you want to add a Tag to a Tag Group, select the Tag Group first and then click on the + button and choose Add tag here.
You can also add Tag Groups by choosing Add group.
Provide the Tag Name Temperature F and click the Create button.

3 - Set Tag Data Source
You will now set the Data Source of the Temperature F tag to Calculation so that you can write the function that will convert the temperature from Celsius to Fahrenheit.
Select the Temperature F tag.

Set the Data Source to Calculation.
Click on the Edit… button next to the Calculation field to open the Edit Calculation window.

4 - Apply Temperature Conversion Function
You will now write the function that will convert the temperature from Celsius to Fahrenheit. This function will reference the Temperature C tag and scale the value accordingly.
In the Edit Calculation window type the following function:
([Temperature C.Value] * 9/5) + 32This should appear as follows.

Tips
To insert a tag you can either type the tag path manually and surround it using square brackets
[]or you can use the Browse for Tag window by selecting the Insert Tag button.Tips
To reference a Tag's value remember to add .Value at the end of the tag path.
Click on the OK button and then the Apply changes button to apply the changes.
Check that the quality status is Good and the data in the Value field is as expected.

5 - Verify Calculation
Let's check that the conversion function is working as expected.
Select the Temperature C tag.

In the Enter Value field type in a temperature value in Degrees Celsius.

Click on Apply changes.
Select the Temperature F tag and check that the value matches the expected value.

Ready to get started?
See how OAS fits your environment, or get pricing for your project.
