Apama Documentation : Developing Apama Applications : Developing Apama Applications in Event Modeler : Creating Blocks : An example block : Description of the Correlation Calculator block interface
Description of the Correlation Calculator block interface
The Correlation Calculator block has the following parameters:
Parameter
Description
period
The maximum age of any sample that is used in the calculations, in seconds. Any samples older than this will be discarded before performing the calculation.
size
The maximum number of samples per stream that are used in the calculation.
One or both of the above parameters must be 0, in which case that limit is not imposed. It is not possible to restrict the number of samples by both age and number of samples, but it is possible to remove the limit on the number of samples (thus an unbounded set of samples is kept). Note that imposing a limit after input events have been received will clear all existing samples.
The Correlation Calculator block has the following operations:
Operation
Description
start
Starts the calculation of coefficients. Must be called before the calculator will generate any statistics (output feed).
stop
Stops the calculation of further coefficients. Any subsequent events on the input feeds are ignored.
clear
Discards all current data.
The Correlation Calculator block defines the following input feeds, each with one field:
Input feed
Fields
Description
data1
value
The first input set.
data2
value
The second input set.
Note that at least one value from each feed must have been received (and if set, within period seconds) before an output will be generated.
The Correlation Calculator block has the following output feed:
Output feed
Fields
Description
statistics
correlation
The correlation coefficient (between -1.0 and +1.0).
samples
The number of sample pairs used for this calculation.
The XML elements at the beginning of the Correlation Calculator's block definition file describe this interface. When you create your own block, Apama generates and populates these XML elements for you.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE block SYSTEM "http://www.apama.com/dtd/bdf.dtd">
<!--Apama Block Definition File-->
<block name="Correlation Calculator">
  <version>
    <id>2.0</id>
    <date>7 May 2009</date>
    <author>Rune Madsen</author>
    <comments>Copyright(c) 2013 Software AG, Darmstadt, Germany and/or
its licensors</comments>
  </version>
  <description>Calculates the correlation of two input data streams over a
    configurable time window and sample set size.</description>
  <properties parallel-aware="true" deprecated="false">
    <input-feeds>
      <feed name="data1" id="9578163894100102">
        <description>The first stream of numeric data to use in the correlation
          calculations</description>
        <field name="value" id="9578163894100103">
          <description>The numeric data value</description>
          <validation type="float" stringcase="mixed" trim="true" unique="false"
            mutability="mutable" />
        </field>
      </feed>
      <feed name="data2" id="9578163894100104">
        <description>The second stream of numeric data to use in the correlation
          calculations</description>
        <field name="value" id="9578163894100105">
          <description>The numeric data value</description>
          <validation type="float" stringcase="mixed" trim="true" unique="false"
            mutability="mutable" />
        </field>
      </feed>
    </input-feeds>
    <output-feeds>
      <feed name="statistics" id="9578163894100106">
        <description>Stream of correlation values generated every time a new
           data item arrives</description>
        <field name="correlation" id="9578163894100107">
          <description>The correlation of the samples in the data sets.
            Between -1 and +1.</description>
          <validation type="float" stringcase="mixed" trim="true" unique="false"
            mutability="mutable" />
        </field>
        <field name="samples" id="9578163894100108">
          <description>The number of sample pairs used in the correlation
            calculation</description>
          <validation type="integer" stringcase="mixed" trim="true"
unique="false" mutability="mutable" />
        </field>
      </feed>
    </output-feeds>
    <parameters>
      <field name="period" id="9578163894100109">
        <description>The duration of the configurable time window given in
          seconds. Samples older than the period will be discarded from the
          data set. Set to zero to keep samples indefinitely, up to the
maximum number of samples specified with the size parameter.
</description>
        <validation type="float" stringcase="mixed" trim="true" unique="false"
          mutability="mutable" />
      </field>
      <field name="size" id="9578163894100110">
        <description>The maximum size of the sample set. The oldest sample will
          be replaced by the new sample when the total number of samples has
          reached this limit. Set to zero to keep all samples, unless period
is set.</description>
        <validation type="integer" stringcase="mixed" trim="true" unique="false"
          mutability="mutable" />
      </field>
    </parameters>
    <operations>
      <operation name="start" id="9578163894100111">
        <description>Activate the correlation calculations</description>
      </operation>
      <operation name="stop" id="9578163894100112">
        <description>Pause the correlation calculations</description>
      </operation>
      <operation name="clear" id="9578163894100113">
        <description>Clear the existing sample data</description>
      </operation>
    </operations>
  </properties>
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback