Stepwise procedure to perform rtdb calculation
Hi,
I need to perform a simple algebraic calculation using the variables available in rtdb. I would like to know the step wise procedure to do this. I am using rtdb 4.6. ABB standard document 2PAA110533-D301_-_en_Decathlon_Services_History_Administration_and_Configuratio
n is very confusing and lacks clarity.
Thanks in advance.
Answers
Hello Ashrith N,
First You need to prepeare a calculation module. Calculation modules are written in C#-language and are compiled into .NET assembly libraries (dll). This, of course, requires some C# programming expertise and tools.
As for the code itself - Calculation modules are C# classes located in the ABB.Data.RTDB.EndUser namespace. A calculation class inherits calculation base class ABB.Data.RTDB.EndUser.CalcBase and needs two metods called Initialize and Calculate. It should also reference RTDB_CalcInterface.dll.
The class has automatic access to all variables and histories, but the naming differ:
A lower-case v letter is added in front of the variable name and histories are pre-fixed with a lower-case h. Moreover all non-alphanumeric characters are replaced with an underscore character (_).
You also need to point to correct value field for every variable (for example .Avg for Time Average or .Last for Last Value).
See also the code below for some basic example (adding to average values):
using ABB.Data.RTDB.Calculation;
namespace ABB.Data.RTDB.EndUser
{
public class MyCalc : ABB.Data.RTDB.EndUser.CalcBase
{
public override void Initialize()
{ }
public override void Calculate()
{vMyVariable.Avg = vInputVariable1.Avg + vInputVariable2.Avg;}
}
}
After writting and compiling the code You need to schedule a calculation task.
Define calculation module in CalculationModules table and then task properties and scheduling configuration in CalculationTasks table.
Cyclic tasks are normally executed by RTDB_CalcScheduler which reads the task configurations from above tables.
If RTDB_CalcScheduler is not installed use "RTDB_CalcScheduler -help" in command line to get some info on how to install this service.
Now this are only basic steps. There is a manual covering this topic in detail and You should have it installed with RTDB (search for RTDB Developer's Manual on Your hard drive).
Hope this helps,
Mike
Source: History 4.5 RTDB Developer's Manual
Add new comment