[rules-users] Rule partitioning in a stateful control system
Steve
software.1 at ntlworld.com
Sat Feb 10 17:19:50 EST 2007
Hi, I was wondering what people this might think is good solution to the
following scenario...
I have a Fact that represents a physical piece of equipment in a control
system, this Fact has a number of parameters, param1 and param2. The working
memory is used in a stateful manner. Consider two example rules, cs is a
global vairable that allows calls back to the control system.
rule "Monitor param1"
when
f : Fact( param1 == 1 )
then
cs.DoSomething(f);
end
rule "Monitor param2"
when
f : Fact( param2 == 1)
then
cs.DoSomething(f);
end
If param1 is updated to == 1, the working memory notified (modifyObject) and
the the rules are fired (fireAllRules), consequently the rule "Monitor param1"
will be placed onto the Agenda. Assuming that sometime later param2 is updated
to == 1, notifing the working memory and firing the rules again will result in
rules "Monitor param1" and "Monitor param2" being placed on the agenda. What I
really want is just the change to be detected and not for the "Monitor param1"
rule to fire again.
Is there a pattern to acheive the desired behaviour, I have used agenda-group
but am not sure this is the best solution.
Thanks for your help.
More information about the rules-users
mailing list