Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-5224

FIWARE.Request.Tech.Data.CEP.Cannot obtain an average aggregation value (#21)

    Details

    • Type: extRequest
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Fix Version/s: 2021
    • Component/s: FIWARE-TECH-HELP
    • Labels:
      None

      Description

      You need to change your EPA definition.

      Your evaluation policy is 'Immediate', and your consumption policy for the
      input events is 'Consume'.
      This means that when the first input event, input1, arrives, Proton detects
      the patterns based on input1 event, and gives an average based on input1
      event only.
      When a second event arrives, input2, Proton can't use input1 event, since
      its consumption policy is consume, which means that if it was already used
      to detect this pattern it can't be used again. Hence, Proton detects the
      pattern based on input2 event only, and so forth.

      Usually EPA of type aggregation has a temporal context that ends in some
      point (not 'always') and their evaluation policy is deferred, which means
      that when the temporal context is ended, the pattern is detected based on
      all the input events arrives during the temporal context period.

      Another issue, since you have one input event type, you need to have one
      line for input event in the EPA definition, no matter how many instances
      from this type will arrived to Proton as input event.

      Hope this will solve your issue.

      I cc the FIWARE issue list to have this correspondence documented

      2015-11-09 13:23 GMT+02:00 Alessandro Cavallaro <notifications@github.com>:

      > After configuring proton with this EPN the expectation is to observe an
      > output event with a calculated average value but the output event contains
      > just the last received value.
      >
      > Here is the configuration:
      >
      > {
      > "epn": {
      > "events": [
      > {
      > "name": "Input",
      > "createdDate": "Mon Nov 09 2015",
      > "attributes": [
      >

      { > "name": "Certainty", > "type": "Double", > "defaultValue": "1", > "dimension": 0, > "description": "The certainty that this event happen (value between 0 to 1)" > }

      ,
      >

      { > "name": "OccurrenceTime", > "type": "Date", > "dimension": 0, > "description": "No value means it equals the event detection time, other option is to use one of the defined distribution functions with parameters" > }

      ,
      >

      { > "name": "ExpirationTime", > "type": "Date", > "dimension": 0 > }

      ,
      >

      { > "name": "Cost", > "type": "Double", > "dimension": 0, > "description": "The cost of this event occurrence. Negative if this is an opportunity" > }

      ,
      >

      { > "name": "Duration", > "type": "Double", > "defaultValue": "0", > "dimension": 0, > "description": "Used in case the this event occur within an interval" > }

      ,
      >

      { > "name": "value", > "type": "Double", > "defaultValue": "0", > "dimension": "0" > }

      > ]
      > },
      > {
      > "name": "Output",
      > "createdDate": "Mon Nov 09 2015",
      > "attributes": [
      >

      { > "name": "Certainty", > "type": "Double", > "defaultValue": "1", > "dimension": 0, > "description": "The certainty that this event happen (value between 0 to 1)" > }

      ,
      >

      { > "name": "OccurrenceTime", > "type": "Date", > "dimension": 0, > "description": "No value means it equals the event detection time, other option is to use one of the defined distribution functions with parameters" > }

      ,
      >

      { > "name": "ExpirationTime", > "type": "Date", > "dimension": 0 > }

      ,
      >

      { > "name": "Cost", > "type": "Double", > "dimension": 0, > "description": "The cost of this event occurrence. Negative if this is an opportunity" > }

      ,
      >

      { > "name": "Duration", > "type": "Double", > "defaultValue": "0", > "dimension": 0, > "description": "Used in case the this event occur within an interval" > }

      ,
      >

      { > "name": "avg_value", > "type": "Double", > "defaultValue": "0", > "dimension": "0" > }

      ,
      >

      { > "name": "entityId", > "type": "String", > "defaultValue": "\"id\"", > "dimension": "0" > }

      ,
      >

      { > "name": "entityType", > "type": "String", > "defaultValue": "\"type\"", > "dimension": "0" > }

      > ]
      > }
      > ],
      > "epas": [
      > {
      > "name": "AvgAggregation",
      > "createdDate": "Mon Nov 09 2015",
      > "epaType": "Aggregate",
      > "context": "Always",
      > "inputEvents": [
      >

      { > "name": "Input", > "alias": "I1", > "consumptionPolicy": "Consume", > "instanceSelectionPolicy": "First" > }

      ,
      >

      { > "name": "Input", > "alias": "I2", > "consumptionPolicy": "Consume", > "instanceSelectionPolicy": "First" > }

      ,
      >

      { > "name": "Input", > "alias": "I3", > "consumptionPolicy": "Consume", > "instanceSelectionPolicy": "First" > }

      > ],
      > "computedVariables": [
      >

      { > "name": "avg", > "aggregationType": "Average", > "I1": "I1.value", > "I2": "I2.value", > "I3": "I3.value" > }

      > ],
      > "evaluationPolicy": "Immediate",
      > "cardinalityPolicy": "Unrestricted",
      > "internalSegmentation": [],
      > "derivedEvents": [
      > {
      > "name": "Output",
      > "reportParticipants": false,
      > "expressions":

      { > "Duration": "0", > "avg_value": "avg", > "entityId": "\"id\"", > "entityType": "\"type\"" > }

      > }
      > ]
      > }
      > ],
      > "contexts": {
      > "temporal": [
      >

      { > "name": "Always", > "createdDate": "Mon Nov 09 2015", > "type": "TemporalInterval", > "atStartup": true, > "neverEnding": true, > "initiators": [], > "terminators": [] > }

      > ],
      > "segmentation": [],
      > "composite": []
      > },
      > "consumers": [
      > {
      > "name": "Orion",
      > "createdDate": "Mon Nov 02 2015",
      > "type": "Rest",
      > "properties": [
      >

      { > "name": "URL", > "value": "http://localhost:10026/NGSI10/updateContext" > }

      ,
      >

      { > "name": "contentType", > "value": "application/xml" > }

      ,
      >

      { > "name": "formatter", > "value": "xml" > }

      ,
      >

      { > "name": "delimiter", > "value": ";" > }

      ,
      >

      { > "name": "tagDataSeparator", > "value": "=" > }

      ,
      >

      { > "name": "dateFormat", > "value": "dd/MM/yyyy-HH:mm:ss" > }

      > ],
      > "events": [
      >

      { > "name": "Output" > }

      > ]
      > }
      > ],
      > "producers": [],
      > "name": "AvgTest"
      > }
      > }
      >
      > —
      > Reply to this email directly or view it on GitHub
      > <https://github.com/ishkin/Proton/issues/21>.
      >

      Since January 1st, old domains won't be supported and messages sent to any domain different to @lists.fiware.org will be lost.
      Please, send your messages using the new domain (Fiware-tech-help@lists.fiware.org) instead of the old one.
      _______________________________________________
      Fiware-tech-help mailing list
      Fiware-tech-help@lists.fiware.org
      https://lists.fiware.org/listinfo/fiware-tech-help
      [Created via e-mail received from: Tal Haham <tali.haham@gmail.com>]

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            TALI Fabiana Fournier
            Reporter:
            fw.ext.user FW External User
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: