Text this: Energy Management System for Smart Grid in the Presence of Energy Storage and Photovoltaic Systems