Clips- small routine program

Viewed 505

I have 10 sensor that watch an environment. The sensor is 1 if OK and 0 if not. I need to create a functional that will print out a Warning message to the terminal if there are at least 3 sensor that are on 0, and the message warning to be showed only once. This I need to do in clips.

Thank you.

   (deffacts listaSenzor
    (sensor L1 0)
    (sensor L2 0) 
    (sensor L3 1)
    (sensor L4 1)
    (sensor L5 1)
    (sensor L6 1)
    (sensor L7 0)
    (sensor L8 1)
    (sensor L9 0)
    )
    (defrule rr
        (sensor ?a  0 )
        (sensor ?b  0 )
        (sensor ?c  0 )
        =>
        printout t ?a ?b ?c "==>WARNING" crlf)
        )
2 Answers
Related