Integration of energy systems