Added and refactored rules engine to carry out plant calculations