Panini

Language Dictionary

How to Read this Dictionary

This dictionary identifies the keywords used in the Panini analytic domain specific language.  Each keyword is identified with its type.  There are 3 distinct types:  bound attribute, metadata, and workflow hook.

bound attribute

The keyword’s value or the source of its value is derived from analytic context and bound during the binding step of the DSL workflow

metadata

The keyword’s value provides information about the analytic definition itself

workflow hook

The keyword provides the definition creator with a hook into the DSL workflow for use during the execution of the analytic function.

In addition to type, each keyword definition also includes a description, list of parameters accepted by the keyword, an example showing how it is declared in an analytic definition and one or more examples of how it is used in the analytic function.

Entries

alert, bufferedInput, constant, definition, description, input, multivariate, onBind, onCalculate, onInput, onTimerEvent, output, ownerId, version

alert

alert – bound attribute

Declare an alert parameter which can be used in the analytic function to raise an FX5 alert based on the results of the analytic calculation.

parameters:

name            required     A name that will be used to identify the bound alert within the analytic function

description     optional     A description of the alert and its use within the analytic function

declaration:

alert     name:'limitExceeded',     description:'a description of the alert'

usage:

create an alert

createAlert     'limitExceeded'

clear an alert

clearAlert     'limitExceeded'

back to entries

buffered-Input

bufferedInput – bound attribute

Declare an input parameter that buffers (or accumulates) values over time.  Once bound, a bufferedInput parameter will buffer up to 500 values before new values replace to oldest in the buffer.  When values are used, they are removed from the buffer.

parameters:

name                      required     A name that will be used to identify the bound bufferedInput value within the analytic function

type                      optional     The type of the bufferedInput value - one of:  integer, long, float, double, boolean

description               optional     A description of the bufferedInputs use within the analytic function

initialbufferingstate     optional     True or False, begin buffering input values upon start of an analytic block.  Defaults to True

declaration:

bufferedInput     name:'source',     type:'long',     description:'a description of the source buffered input',     initialbufferingstate:false

usage:

access all the values in the buffer

def values = bufferedInput.useValues     'source'

access a subset of the values in the buffer by providing a filter function

def values = bufferedInput.useValues     'source',     { v -> v.getUpdateTimeMillis() < endTime }

turn off buffering for a bufferedInput attribute

bufferedInput.stopBuffering     'source'

turn on buffering for a bufferedInput attribute

bufferedInput.startBuffering     'source'

get the timestamp for the most recent value in the buffer

bufferedInput.getMostRecentTimestamp     'source'

back to entries

constant

constant – bound attribute

Declare constant value that will be provided by the context once bound.

parameters:

name            required     A name that will be used to identify the bound constant within the analytic function

type            optional     The type of the constant value - one of:  integer, long, float, double, boolean

description     optional     A description of the constants use within the analytic function

declaration:

constant        name:'rate',     type:'long',     description:'a description for the rate constant'

usage:

access the bound constant value

constant.get     'rate'

back to entries

definition

definition – metadata

Provide a name for the analytic block definition.

declaration:

definition     'Derivative'

back to entries

description

description – metadata

Provide a description of the analytic block definition.

declaration:

description     'Function that calculates the rate of change for an input'

back to entries

input

input – bound attribute

Declare an input parameter that will provide a stream of data to the analytic function once bound.

parameters:

name            required     A name that will be used to identify the bound input value within the analytic function

type            optional     The type of the input value - one of:  integer, long, float, double, boolean

description     optional     A description of the inputs use within the analytic function

declaration:

input           name:'monitor',     type:'double',    description:'a description of the monitor input'

usage:

access the latest value of the entity bound to the declared input

input.get               'monitor'

access the timestamp of the latest value of the entity bound to the declared input as provided by the input source

input.getTimestamp     'monitor'

back to entries

multivariate

multivariate – bound attribute

Declare a multivariate set of inputs and the expression to evaluate them.

parameters:

description     optional     A description of the multivariate function

declaration:

multivariate     description:'a description of the multivariate function'

usage:

multivariate is for internal use only

an analytic block definition can have only one multivariate defined

determine whether or not the multivariate is ready for execution i.e. has a value from all bound input sources

if( multivariate.ready() ) ...

evaluate the multivariate expression and set the result for publishing

setOutputValue 'result', evalExpression( multivariate.expression() ), System.currentTimeMillis()

back to entries

on-Bind

onBind – workflow hook

Optional – Declare a block that will be executed as the last step in binding a context to an analytic definition creating an executable analytic block

declaration:

onBind {

...

}

usage:

onBind is typically used to initialize local variables and constants with default values in the event that the bound context doesn’t provide a binding

onBind {

sampleThreshold = constant.get 'sampleThreshold' ?: DFLT_THRESHOLD

rateMillis = constant.get 'rateMillis' ?: DFLT_RATE

sampleCount = 0

lastReading = 0.0

lastReadingTimestamp = 0

}

back to entries

on-Calculate

onCalculate – workflow hook

Optional – Declare a block that will be executed when the implementing engine determines that the analytic block should execute.  This will typically be every time a bound input value is updated.

declaration:

onCalculate {

...

}

usage:

onCalculate is used to define an analytic function that will be executed at the discretion of the implementing engine, typically every time an input value changes.  For more control see:  onInput and onTimerEvent

onCalculate {

long currTimeMillis = System.currentTimeMillis()

if( multivariate.ready() ) {

setOutputValue 'result', evalExpression( multivariate.expression() ), currTimeMillis

}

}

back to entries

on-Input

onInput – workflow hook

Optional – Declare a block that will be executed every time the analytic block receives an update to the declared input binding

declaration:

onInput 'source', {

...

}

usage:

Use onInput when there is a need to run a block any time a bound input receives an update.  It is possible to have multiple onInput declarations, up to one for each defined input attribute.

onInput ‘trigger’, {

boolean buffer = input.get ‘trigger’

long triggerTimestamp = input.getTimestamp ‘trigger’

if( buffer ) bufferedInput.startBuffering ‘source’

else {

...

}

...

}

back to entries

on-Timer-Event

onTimerEvent – workflow hook

Optional – Declare a block that will be executed every time a time event is received.  Timer events typically have a 1 second resolution but be sure to understand the execution environment to ensure calculations are triggered at the desired time interval.

declaration:

onTimerEvent {

...

}

usage:

onTimerEvent is used to declare blocks that need to be executed at regular time intervals.

onTimerEvent {

currTime = System.currentTimeMillis()

if( currTime >= endTime ) {

def min = MAX, max = MIN

def vals = bufferedInput.useValues 'source', { v -> v.getUpdateTimeMillis() < endTime }

...

}

...

}

back to entries

output

output – bound attribute

Declare an output parameter that is used to publish analytic results to the bound channel.

parameters:

name                 required     A name that will be used to identify the bound output channel within the analytic function

type                 optional     The type of the value that will be published on the bound channel - one of:  integer, long, float, double, boolean 

description          optional     A description of the output for the analytic function

outputonchangeonly   optional     True or False, publish the calculated value only if it has changed.  Defaults to False

declaration:

output     name:'min',     type:'integer',     description:'a description for the min output parameter',     outputonchangeonly:true

usage:

set an output value with the current timestamp

setOutputValue     'min',     33

set an output value with a timestamp other than current, usually a timestamp from an input parameter that triggered the calculation

setOutputValue     'min',     33,     timestamp

back to entries

ownerId

ownerId – metadata

Provide the ID of the tenant that owns the definition.  an IID of ‘0’ indicates that the definition is provided by FX5 and can be used by any tenant.

declaration:

ownerId          0

back to entries

version

version – metadata

Provide a version to identify an iteration of the definition.

declaration:

version         '1.0'

back to entries

© Copyright 2021 IOT Technology Solutions, an STA Group company. All rights reserved. Privacy Policy.