SmartCoDe: Smart Control of Demand for Consumption and Supply to enable balanced, energy-positive buildings and neighbourhoods