Skip to main content
Skip table of contents

Defining Formula Functions

Introduction

It is possible to create custom EvalComponents files. These files should be administered by the customer or arranged with HAKOM. Otherwise, it is possible that these special files are not installed when reinstalling. These files can be saved in the folder Custom of the installation package to be picked up for the next installation. For further information please visit: TSM App or WebTSM Services API

Creation and Syntax

To create a custom EvalComponent file, a .vb file has to be created in the bin directory of the TSM installation. The file name has to start with EvalComponent, e.g. EvalComponentMyFunctions.vb

The custom functions must be implemented in a partial class called EvalComponent.

Example

VB
Imports System
Imports HAKOM.Framework.DAL
Imports HAKOM.Framework.Lib
Imports HAKOM.Framework.TimeSeries
Imports System.Collections.Generic
Imports System.Data

Partial Public Class EvalComponent

'custom functions
     
End Class


Attention: Self-made EvalComponents must never be written into the ones delivered by HAKOM (e.g. EvalComponentHAKOM.vb, EvalComponentHAKOMOptional.vb, EvalComponentHAKOMReferences.vb, etc.)

Functions

Custom functions must return a value of type Double and can have any parameters.

The function is called for every data point within the queried time range.

If you want to pass a time series to the function, you have to define a parameter of type Data.

Example

VB
Private Function Add2(data As Data) As Double
      Return data.Value + 2
End Function

The call of this function in the formula looks like this: Add2([1234])

Useful Fields and Properties

Field/Property

Description

Private aktLine As Int32

Represents the current index of all data points to be calculated. It can be used to retrieve items from the arrays mSourceTSData and mCalculationTSData.

Private Property AktWorstStatus As tsMeterdataStatus

Represents the worst status of all time series values used in formula for the current interval. It is used for setting the status of the final calculation result. If you want to override it, you must use the field mAktWorstStatus.

Private mCalculationTSData() As ITimeSeriesDataContains the calculation results. It will be set automatically for every data point in the time range.

Private mSourceTSData As ITimeSeriesData()()

Contains all time series data of the referenced time series. The first dimension of the array corresponds with the index of the time series, the second dimension holds the data points transformed to the calculation interval.

Private mSourceTSDTOs As ITimeSeriesDTO()

Contains all time series data of the referenced time series. The data points are not transformed and therefore in the interval of the referenced time series.

Private mSourceTSDefDTOs As ITimeSeriesDefinitionDTO()

Contains the definitions of the referenced time series.

Private mFormulaTimeSeriesDefinition As ITimeSeriesDefinitionDTO

Contains the definition of the formula time series.

Private mModTime As UniversalTime

Represents the audit time specified when loading the formula time series. It equals zero, if not audit time has been specified.

Private mConnection As IDBConn

Connection to the database where the formula time series is stored. It can be used for further database calls.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.