An ontology for modeling flexibility in smart grid energy management