Hi,

I have called Rete.runUntilHalt() from within a Java program, and have 4
sensors periodically updating 4 javabeans within the engine. I have a Java
method called when the beans are updated. This method starts a thread and if
the beans are not updated again for x seconds, a fact is asserted which
causes a set of rules to fire. This works up until a stage, at which point
all facts to cause a rule to fire are asserted, but the rule does not fire.

For example at time t, calling (facts) produces:

f-0   (MAIN::SmartCouch_LoadCellSensor1_MassEvent_Bean (class
<External-Address:java.lang.Class>) (mass 88.0) (sensorID 1) (OBJECT
<External-Address:SmartCouch_LoadCellSensor1_MassEvent_Bean>))
f-1   (MAIN::SmartCouch_LoadCellSensor2_MassEvent_Bean (class
<External-Address:java.lang.Class>) (mass 18.0) (sensorID 2) (OBJECT
<External-Address:SmartCouch_LoadCellSensor2_MassEvent_Bean>))
f-2   (MAIN::SmartCouch_LoadCellSensor3_MassEvent_Bean (class
<External-Address:java.lang.Class>) (mass 14.0) (sensorID 3) (OBJECT
<External-Address:SmartCouch_LoadCellSensor3_MassEvent_Bean>))
f-3   (MAIN::SmartCouch_LoadCellSensor4_MassEvent_Bean (class
<External-Address:java.lang.Class>) (mass 13.0) (sensorID 4) (OBJECT
<External-Address:SmartCouch_LoadCellSensor4_MassEvent_Bean>))
f-10   (MAIN::active-context InUse)
f-11   (MAIN::context-updated true)
For a total of 6 facts.

And I have the following rule:

(defrule InUse-BottomLeft
?ac <- (active-context InUse)
?cu <- (context-updated true)
(and
(and
(LoadCellSensor1_MassEvent_Bean (sensorID 1))
(LoadCellSensor1_MassEvent_Bean (mass ?LoadCellSensor1_MassEvent&:(>
?LoadCellSensor1_MassEvent ?*averageweight*)))
)
(and
(LoadCellSensor2_MassEvent_Bean (sensorID 2))
(LoadCellSensor2_MassEvent_Bean (mass ?LoadCellSensor2_MassEvent&:(<
?LoadCellSensor2_MassEvent ?*averageweight*)))
)
(and
(LoadCellSensor3_MassEvent_Bean (sensorID 3))
(LoadCellSensor3_MassEvent_Bean (mass ?LoadCellSensor3_MassEvent&:(<
?LoadCellSensor3_MassEvent ?*averageweight*)))
)
(and
(LoadCellSensor4_MassEvent_Bean (sensorID 4))
(LoadCellSensor4_MassEvent_Bean (mass ?LoadCellSensor4_MassEvent&:(<
?LoadCellSensor4_MassEvent ?*averageweight*)))
)
(and
(LoadCellSensor1_MassEvent_Bean (sensorID 1))
(LoadCellSensor1_MassEvent_Bean (mass ?LoadCellSensor1_MassEvent&:(>
?LoadCellSensor1_MassEvent 2)))
)
)
=>
(retract ?ac)
(retract ?cu)
(bind ?*weight* ?*totalweight*)
(assert (active-context BottomLeft))
(printout t "Active context is: BottomLeft" crlf)
)

Total weight is: 133.0, and average weight is: 32.75

All the facts to cause this rule to fire are in working memory, but the rule
does not fire until the beans are updated again, at which point it does
fire. Surely, if I have called runUntilHalt(), and the facts are in working
memory, this rule should fire?

Thanks for all your help and time

Greg

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to