You'd have to insert the new ZZZTracker in the first rule.

But this does not compute the average over three values in a sliding window; you'd compute the average for every adjacent window of three events.

Stay with the original rule, but use a "Tracker" for counting valid ZZZSensorBeans, and add another pattern to the original rule: the suitable Tracker must have a count >= 3.

-W

On 19 October 2011 12:28, eskomk <esko.hujanen@ebsolut.fi> wrote:
Hi all,

Sorry, the first rule should read:

when
   $mds : ZZZSensorBean(temperature > 30)
   not ZZZTracker(profileID == $mds.profileID)
then
   ZZZTracker $tracker = new ZZZTracker();
   $tracker.profileID = $mds.profileID;
end

br Esko

--
View this message in context: http://drools.46999.n3.nabble.com/Why-this-rule-fires-immediately-tp3430427p3433905.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users