Integrations & Setup
...
Calculations
Creating a calculation
creating a calculation is similar as creating a measurement docid\ u5 07ylms2jix9kz m lb configure the basic measurement properties choose a calculation type specify the calculation settings, which depend on the calculation type raw calculation sampled calculation simulated calculation setup the calculation script to reference data references in the script, use its alias (here a ) instead of the reference’s name calculation lifecycle a calculation can either be paused or active paused when clicking the pause button on an active calculation, the calculation will stop its operation until it is resumed a paused calculation will not output any new time series data active to resume the calculation, click the resume button when resuming a calculation, processing will restart at the beginning of the next interval consequently, no new time series data will have been processed while the calculation was paused! calculation context every calculation keeps a stateful context, which retains the last result and timestamp of the calculation along with other information and the local context (see below for a full list) editing the calculation context the context of a calculation can only be changed if the calculation is paused the calculation context will always contain the context itself under the context key the local context is at the top level the calculation context contains the following fields \<local context field 1> \<local context field 2> context previousresult the last result of the calculation value the value returned by the last run of the calculation tags a map of tags set which can be set in the script status the status set in the script, will only be visible if set inside the script intervalms the interval at which the calculation is executed offsetms the offset at which the calculation is executed timestamp the timestamp of the current calculation previoustimestamp the timestamp of the previous calculation previousinput the previous value of the input data reference(s) input data reference alias example a tags the time series tags of the input data reference, example “status” datatype the datatype of the input data reference data reference the name of the input data reference timestamp the timestamp of the input data reference value the value of the input data reference you can edit/add anything inside the context the following variable types are available string int float bool time map array look at some examples on how to use the calculation context here