I have the following rule in my DRL file

rule "inverteroff-evaluate-based-on-pvpower"
    # the if part
    when
        alertDefinition : Alert
($configID:alertConfigID) 
        alertCondition: AlertCondition(name ==
"InverterOff")
        context: EvaluationContext (
                     timeRight == true,
                     pvPower!= null, 
                     pvPower <= 0   
                 ) 
    then
        # what do we do if the rule evaluates to true
        log("Triggered inverteroff alert for
alertConfigID" + $configID);
       
alertDefinition.setState(AlertState.TRIGGERED);
        log("Context info:" + context);
end

I would like to know if I assert an EvaluationContext
for which timeRight == false, will the getPvPower()
method still be called ? (logically it shouldn't be
called since the "," separated conditions are "AND"
conditions)

>From my tests it seems like the getPvPower method is
called irrespective of the value of timeRight.

If that is the expected behaviour how can I improve my
rule definition to ensure that getPvPower isn't called
if it is not necessary.

Thank you,

Rahul Phadnis
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to