[Fiware-tech-help] [Proton] Cannot obtain an average aggregation value (#21)

Tal Haham tali.haham at gmail.com
Mon Nov 9 13:21:47 CET 2015


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 at 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>.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fiware.org/private/fiware-tech-help/attachments/20151109/7c40e4e0/attachment.html>


More information about the Fiware-tech-help mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy