Delivering community energy flexibility through space heating - analysis and optimisation of energy system design and control strategies