ICustomFunction Interface
HAKOM.TSM.Net.Api.Calculation.Formulas.CustomFunctions
Section titled “HAKOM.TSM.Net.Api.Calculation.Formulas.CustomFunctions”Base interface for custom functions. This interface provides all properties and methods which are independent of the parameters and return type of the implemented custom function.
public interface ICustomFunctionDerived
↳ ICustomFunction<TParameter,TResult>
↳ ICustomFunction<TParameter1,TParameter2,TParameter3,TParameter4,TParameter5,TParameter6,TParameter7,TParameter8,TParameter9,TResult>
↳ ICustomFunction<TParameter1,TParameter2,TParameter3,TParameter4,TParameter5,TParameter6,TParameter7,TParameter8,TResult>
↳ ICustomFunction<TParameter1,TParameter2,TParameter3,TParameter4,TParameter5,TParameter6,TParameter7,TResult>
↳ ICustomFunction<TParameter1,TParameter2,TParameter3,TParameter4,TParameter5,TParameter6,TResult>
↳ ICustomFunction<TParameter1,TParameter2,TParameter3,TParameter4,TParameter5,TResult>
↳ ICustomFunction<TParameter1,TParameter2,TParameter3,TParameter4,TResult>
↳ ICustomFunction<TParameter1,TParameter2,TParameter3,TResult>
↳ ICustomFunction<TParameter1,TParameter2,TResult>
↳ ICustomFunction<TResult>
Remarks
Section titled “Remarks”Please use one of the sub-interfaces for implementing a custom function.
Methods
Section titled “Methods”ICustomFunction.Initialize<TValue>(ICustomFunctionContext<TValue>) Method
Section titled “ICustomFunction.Initialize<TValue>(ICustomFunctionContext<TValue>) Method”Is called once for every calculation of an IFormula, regardless if the ICustomFunction is used in the IFormula or not. Therefore, the method should require as little runtime and memory as possible.
System.Threading.Tasks.Task Initialize<TValue>(HAKOM.TSM.Net.Api.Calculation.Formulas.CustomFunctions.ICustomFunctionContext<TValue> context) where TValue : System.IEquatable<TValue>, System.IComparable<TValue>;Type parameters
Section titled “Type parameters”TValue
The type of the values, which will be calculated.
Parameters
Section titled “Parameters”context HAKOM.TSM.Net.Api.Calculation.Formulas.CustomFunctions.ICustomFunctionContext<TValue>
The ICustomFunctionContext<TValue> which provides properties like referenced ITimeSeries for the calculation.
Returns
Section titled “Returns”System.Threading.Tasks.Task
An awaitable System.Threading.Tasks.Task.
ICustomFunction.TryGetReference<TValue>(ITimeSeriesData<TValue>, ICustomFunctionContext<TValue>, ITimeSeriesReferenceWithData<TValue>) Method
Section titled “ICustomFunction.TryGetReference<TValue>(ITimeSeriesData<TValue>, ICustomFunctionContext<TValue>, ITimeSeriesReferenceWithData<TValue>) Method”Tries to get the ITimeSeriesReference and ITimeSeriesDataCollection<TValue> containing the data in the reading period of a time series reference using an ITimeSeriesData<TValue>. If the given data does not result form a time series reference this method returns false.
bool TryGetReference<TValue>(HAKOM.TSM.Net.Api.Data.TimeSeries.ITimeSeriesData<TValue> data, HAKOM.TSM.Net.Api.Calculation.Formulas.CustomFunctions.ICustomFunctionContext<TValue> context, out HAKOM.TSM.Net.Api.Calculation.ITimeSeriesReferenceWithData<TValue> reference) where TValue : System.Numerics.IAdditionOperators<TValue, TValue, TValue>, System.Numerics.ISubtractionOperators<TValue, TValue, TValue>, System.Numerics.IMultiplyOperators<TValue, TValue, TValue>, System.Numerics.IDivisionOperators<TValue, TValue, TValue>, System.IEquatable<TValue>, System.IComparable<TValue>;Type parameters
Section titled “Type parameters”TValue
The type of the values, which will be calculated.
Parameters
Section titled “Parameters”data HAKOM.TSM.Net.Api.Data.TimeSeries.ITimeSeriesData<TValue>
The ITimeSeriesData<TValue>, which will be used to get the reference.
context HAKOM.TSM.Net.Api.Calculation.Formulas.CustomFunctions.ICustomFunctionContext<TValue>
The ICustomFunctionContext<TValue>, which provides properties like the referenced ITimeSeries for the calculation.
reference HAKOM.TSM.Net.Api.Calculation.ITimeSeriesReferenceWithData<TValue>
A tuple containing the referenced ITimeSeries and the ITimeSeriesDataCollection<TValue> holding its data.
Returns
Section titled “Returns”System.Boolean
True if a ITimeSeries and ITimeSeriesDataCollection<TValue> could be found to the given ITimeSeriesData<TValue>.