rule engine in C?

Jan 29, 2006 2 Replies

Hi All,



I'm thinking about looking at some type of rule engine for a project I'm working on. It's part of an embedded server, and it needs to respond to various types of external inputs and assert various outputs as specified by various sets of rules (e.g. "if temperature > 75F and door signal is not open then turn on this X10 device for 10 seconds). The configuration of rules can potentially be quite complex. We already have a web GUI which allows the user to configure the various rules and convert this into an XML document. There is nothing yet on the embedded side to do anything processing of the rule set.



Can anyone recommend any C based rule engines which may be adapted to do this type of rule processing, or if not then maybe offer some suggestions on how best to implement this?



That should be fairly straight-forward to implement from scratch, unless you have some difficult constraints to handle, such as speed, special power outage recovery, etc. If speed is not strained you can probably loop through all your rules in sequence. If speed is tight, you would probably want to go to some sort of event-driven architecture, whereby you parse the rules to set up actions for certain input events.

Thad

I've done similar things. My main caution would be: remember it's a rule engine, not a scripting language. There be dragons...

Also beware of contradictory/interacting rules (hint: ladder logic on PLCs)(hint: state machine, reading/interpretation/actuation phases).

Steve

formatting link

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required