Development of an energy management system for optimal operation of fuel cell based residential energy systems