<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>[Drools Version 5.5.0 Final]</div><div><br></div><div>Hey -&nbsp;</div><div><br></div><div><div>I got an event E1 that is only valid, if the latest event E2 following E1 within 2 minutes has the value 1</div><div>--&gt; I want have the rule fire 2 minutes after E1 but only if E1 is valid</div><div><br></div><div>This is my rule:</div><div><div style="margin: 0px; font-size: 12px; font-family: Monaco; min-height: 16px; "><br></div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(0, 143, 0); "><span style="color: #a91500">rule</span><span style="color: #000000"> </span>"inform about E1"</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(169, 21, 0); ">when</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(146, 144, 0); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>//event (T1) is the initial trigger</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>$event1 : Event(type == EventType.T1)</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(146, 144, 0); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>//there is an event (T2) with value 0 between 0,2m after doorClosed</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>$event2: Event(type == EventType.T2, value == 1,&nbsp;<span style="color: #a91500">this</span> after [0, 2m] $event1, $timestamp : timestamp)</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(146, 144, 0); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>//there is no newer event (T2) within the timeframe</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #a91500">not</span> Measurement(type == EventType.T2,&nbsp;<span style="color: rgb(169, 21, 0); ">this</span>&nbsp;after [0, 2m] $event1, timestamp &gt; $timestamp)&nbsp;</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(146, 144, 0); "><span style="color: rgb(169, 21, 0); ">then</span></div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(146, 144, 0); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>//print info</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>log(drools, <span style="color: #008f00">"E1 valid"</span>);</div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(169, 21, 0); ">end</div></div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(169, 21, 0); "><br></div><div style="margin: 0px; font-size: 12px; font-family: Monaco; color: rgb(169, 21, 0); "><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">An example of Events:</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">12:00:00 &nbsp;- E1</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">12:01:00 &nbsp;- E2 ( value = 0 )&nbsp;</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">12:01:10 &nbsp;- E2 ( value = 0 )&nbsp;</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">12:01:40 &nbsp;- E2 ( value = 0 )&nbsp;</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">12:01:50 &nbsp;- E2 ( value = 1 )&nbsp;</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">12:02:10 &nbsp;- E2 ( value = 0 )</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">I would expect the output: &nbsp; [log() does log the clock-time when my rule fires)</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">12:02:00 E1 valid</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">But what I get is:</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">12:03:50 E1 valid</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">So I see that the late coming E2 (@12:02:10) is correctly ignored, the rule result is basically correct, but the rule is fired much to late. &nbsp;(actually 2 minutes after $event2 and not as expected 2 minutes after $event1).</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">Could someone give me a hint what I did wrong?</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">Regards,&nbsp;</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; ">Alex</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; "></div></div></div></body></html>