A Novel Energy Management System for Optimal Energy and Flexibility Scheduling of Residential Buildings: A Case Study in HSB Living Lab | IEEE Conference Publication | IEEE Xplore